actionlist.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <div class="app-container" style="padding: 10px;">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item :label="$t('责任人')" prop="responsible">
  5. <el-input
  6. v-model="queryParams.responsible"
  7. :placeholder="$t('请输入') + $t('责任人')"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item :label="$t('行动')" prop="action">
  14. <el-input
  15. v-model="queryParams.action"
  16. :placeholder="$t('请输入') + $t('行动')"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item :label="$t('截止日期')" prop="deadline">
  23. <el-date-picker clearable size="small" style="width: 200px"
  24. v-model="queryParams.deadline"
  25. type="date"
  26. value-format="yyyy-MM-dd"
  27. :placeholder="$t('请选择') + $t('截止日期')">
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item :label="$t('状态')" prop="status">
  31. <el-select v-model="queryParams.status" :placeholder="$t('请选择') + $t('状态')" clearable size="small">
  32. <el-option
  33. v-for="dict in statusOptions"
  34. :key="dict.dictValue"
  35. :label="dict.dictLabel"
  36. :value="dict.dictValue"
  37. />
  38. </el-select>
  39. </el-form-item>
  40. <el-form-item :label="$t('备注')" prop="remarks">
  41. <el-input
  42. v-model="queryParams.remarks"
  43. :placeholder="$t('请输入') + $t('备注')"
  44. clearable
  45. size="small"
  46. @keyup.enter.native="handleQuery"
  47. />
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  51. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <el-row :gutter="10" class="mb8">
  55. <el-col :span="1.5">
  56. <el-button
  57. type="primary"
  58. icon="el-icon-plus"
  59. size="mini"
  60. @click="handleAdd"
  61. v-hasPermi="['plant:meeting:add']"
  62. >{{ $t('新增') }}</el-button>
  63. </el-col>
  64. <el-col :span="1.5">
  65. <el-button
  66. type="success"
  67. icon="el-icon-edit"
  68. size="mini"
  69. :disabled="single"
  70. @click="handleUpdate"
  71. v-hasPermi="['plant:meeting:edit']"
  72. >{{ $t('修改') }}</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button
  76. type="danger"
  77. icon="el-icon-delete"
  78. size="mini"
  79. :disabled="multiple"
  80. @click="handleDelete"
  81. v-hasPermi="['plant:meeting:remove']"
  82. >{{ $t('删除') }}</el-button>
  83. </el-col>
  84. <el-col :span="1.5">
  85. <el-button
  86. type="primary"
  87. icon="el-icon-s-data"
  88. size="mini"
  89. @click="handleData"
  90. >{{ $t('数据分析') }}</el-button>
  91. </el-col>
  92. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  93. </el-row>
  94. <el-table v-loading="loading" :data="actionlistList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  95. <el-table-column type="selection" width="55" align="center" />
  96. <el-table-column :label="$t('责任人')" width="100" align="center" prop="respName" :show-overflow-tooltip="true"/>
  97. <el-table-column :label="$t('行动')" width="400" align="center" prop="action" />
  98. <el-table-column :label="$t('截止日期')" align="center" prop="deadline" width="100">
  99. <template slot-scope="scope">
  100. <span>{{ parseTime(scope.row.deadline, '{y}-{m}-{d}') }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column :label="$t('状态')" align="center" prop="status" :formatter="statusFormat" />
  104. <el-table-column :label="$t('录入日期')" align="center" prop="inputdate" width="100">
  105. <template slot-scope="scope">
  106. <span>{{ parseTime(scope.row.inputdate, '{y}-{m}-{d}') }}</span>
  107. </template>
  108. </el-table-column>
  109. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  110. <el-table-column label="更新人" align="center" prop="updaterCode" :show-overflow-tooltip="true"/>
  111. <el-table-column label="更新日期" align="center" prop="updatedate" width="100">
  112. <template slot-scope="scope">
  113. <span>{{ parseTime(scope.row.updatedate, '{y}-{m}-{d}') }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding">
  117. <template slot-scope="scope">
  118. <el-button
  119. size="mini"
  120. type="text"
  121. icon="el-icon-edit"
  122. @click="handleUpdate(scope.row)"
  123. v-if="checkPermi(['plant:meeting:edit']) || scope.row.responsible == getStaffId()"
  124. >{{ $t('修改') }}</el-button>
  125. <el-button
  126. size="mini"
  127. type="text"
  128. icon="el-icon-delete"
  129. @click="handleDelete(scope.row)"
  130. v-hasPermi="['plant:meeting:remove']"
  131. >{{ $t('删除') }}</el-button>
  132. </template>
  133. </el-table-column>
  134. </el-table>
  135. <pagination
  136. v-show="total>0"
  137. :total="total"
  138. :page.sync="queryParams.pageNum"
  139. :limit.sync="queryParams.pageSize"
  140. @pagination="getList"
  141. />
  142. <!-- 添加或修改装置会议执行对话框 -->
  143. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="title" :visible.sync="open" width="500px" append-to-body>
  144. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  145. <el-form-item :label="$t('责任人')" prop="responsible">
  146. <el-select v-model="form.responsible" filterable :placeholder="$t('请选择') + $t('负责人姓名')" filterable >
  147. <el-option
  148. v-for="dict in stffmgrOptions"
  149. :key="dict.userId"
  150. :label="dict.nickName"
  151. :value="dict.staffId">
  152. <span style="float: left">{{ dict.nickName }}</span>
  153. <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.staffid }}</span>
  154. </el-option>
  155. </el-select>
  156. </el-form-item>
  157. <el-form-item :label="$t('行动')" prop="action">
  158. <el-input v-model="form.action" :placeholder="$t('请输入') + $t('行动')" />
  159. </el-form-item>
  160. <el-form-item :label="$t('截止日期')" prop="deadline">
  161. <el-date-picker clearable size="small" style="width: 200px"
  162. v-model="form.deadline"
  163. type="date"
  164. value-format="yyyy-MM-dd"
  165. :placeholder="$t('请选择') + $t('截止日期')">
  166. </el-date-picker>
  167. </el-form-item>
  168. <el-form-item :label="$t('状态')" prop="status">
  169. <el-select v-model="form.status" :placeholder="$t('请选择') + $t('状态')">
  170. <el-option
  171. v-for="dict in statusOptions"
  172. :key="dict.dictValue"
  173. :label="dict.dictLabel"
  174. :value="dict.dictValue"
  175. ></el-option>
  176. </el-select>
  177. </el-form-item>
  178. <el-form-item :label="$t('录入日期')" prop="inputdate">
  179. <el-date-picker clearable size="small" style="width: 200px"
  180. v-model="form.inputdate"
  181. type="date"
  182. value-format="yyyy-MM-dd"
  183. :placeholder="$t('请选择') + $t('录入日期')">
  184. </el-date-picker>
  185. </el-form-item>
  186. <el-form-item :label="$t('备注')" prop="remarks">
  187. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  188. </el-form-item>
  189. </el-form>
  190. <div slot="footer" class="dialog-footer">
  191. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  192. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  193. </div>
  194. </el-dialog>
  195. <!-- 用户导入对话框 -->
  196. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  197. <el-upload
  198. ref="upload"
  199. :limit="1"
  200. accept=".xlsx, .xls"
  201. :headers="upload.headers"
  202. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  203. :disabled="upload.isUploading"
  204. :on-progress="handleFileUploadProgress"
  205. :on-success="handleFileSuccess"
  206. :auto-upload="false"
  207. drag
  208. >
  209. <i class="el-icon-upload"></i>
  210. <div class="el-upload__text">
  211. {{ $t('将文件拖到此处,或') }}
  212. <em>{{ $t('点击上传') }}</em>
  213. </div>
  214. <div class="el-upload__tip" slot="tip">
  215. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  216. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  217. </div>
  218. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  219. </el-upload>
  220. <div slot="footer" class="dialog-footer">
  221. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  222. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  223. </div>
  224. </el-dialog>
  225. <el-drawer
  226. :title="$t('数据分析')"
  227. size="600px"
  228. :visible.sync="drawer"
  229. :direction="direction">
  230. <el-row>
  231. <el-col>
  232. <el-card class="box-card" shadow="hover">
  233. <div slot="header" class="clearfix">
  234. <span>{{ $t('状态统计') }}</span>
  235. </div>
  236. <div class="text item">
  237. <action-status-data></action-status-data>
  238. </div>
  239. </el-card>
  240. </el-col>
  241. </el-row>
  242. </el-drawer>
  243. </div>
  244. </template>
  245. <script>
  246. import {
  247. addActionlist,
  248. delActionlist,
  249. exportActionlist,
  250. getActionlist,
  251. importTemplate,
  252. listActionlist,
  253. updateActionlist
  254. } from "@/api/plant/actionlist";
  255. import {treeselect} from "@/api/system/dept";
  256. import {getToken} from "@/utils/auth";
  257. import Treeselect from "@riophae/vue-treeselect";
  258. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  259. import ActionStatusData from "./actionStatusData";
  260. import {listPostUser} from "@/api/system/user";
  261. import {checkPermi} from "@/utils/permission";
  262. export default {
  263. name: "Actionlist",
  264. components: {ActionStatusData, Treeselect },
  265. data() {
  266. return {
  267. drawer: false,
  268. direction: 'rtl',
  269. // 遮罩层
  270. loading: true,
  271. staffId:'',
  272. // 选中数组
  273. ids: [],
  274. // 非单个禁用
  275. single: true,
  276. // 非多个禁用
  277. multiple: true,
  278. // 显示搜索条件
  279. showSearch: false,
  280. // 总条数
  281. total: 0,
  282. // 装置会议执行表格数据
  283. actionlistList: [],
  284. // 弹出层标题
  285. title: "",
  286. // 部门树选项
  287. deptOptions: undefined,
  288. clientHeight:300,
  289. // 是否显示弹出层
  290. open: false,
  291. // 装置字典
  292. plantCodeOptions: [],
  293. stffmgrOptions: [],
  294. // 状态字典
  295. statusOptions: [],
  296. // 用户导入参数
  297. upload: {
  298. // 是否显示弹出层(用户导入)
  299. open: false,
  300. // 弹出层标题(用户导入)
  301. title: "",
  302. // 是否禁用上传
  303. isUploading: false,
  304. // 是否更新已经存在的用户数据
  305. updateSupport: 0,
  306. // 设置上传的请求头部
  307. headers: { Authorization: "Bearer " + getToken() },
  308. // 上传的地址
  309. url: process.env.VUE_APP_BASE_API + "/plant/actionlist/importData"
  310. },
  311. // 查询参数
  312. queryParams: {
  313. pageNum: 1,
  314. pageSize: 50,
  315. responsible: null,
  316. action: null,
  317. deadline: null,
  318. status: null,
  319. remarks: null,
  320. meetingId: null},
  321. // 表单参数
  322. form: {},
  323. // 表单校验
  324. rules: {
  325. }
  326. };
  327. },
  328. watch: {
  329. // 根据名称筛选部门树
  330. deptName(val) {
  331. this.$refs.tree.filter(val);
  332. }
  333. },
  334. computed: {
  335. checkPermi() {
  336. return checkPermi;
  337. },
  338. },
  339. created() {
  340. //设置表格高度对应屏幕高度
  341. this.$nextTick(() => {
  342. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  343. })
  344. this.queryParams.meetingId = this.$route.params && this.$route.params.tableId;
  345. this.getList();
  346. // this.getTreeselect();
  347. this.getStaffmar()
  348. // this.getDicts("PLANT_DIVIDE").then(response => {
  349. // this.plantCodeOptions = response.data;
  350. // });
  351. this.getDicts("ACTION_STATUS").then(response => {
  352. this.statusOptions = response.data;
  353. });
  354. },
  355. methods: {
  356. /** 查询装置会议执行列表 */
  357. getList() {
  358. this.loading = true;
  359. listActionlist(this.queryParams).then(response => {
  360. this.actionlistList = response.rows;
  361. this.total = response.total;
  362. this.loading = false;
  363. });
  364. },
  365. getStaffId(){
  366. return this.$store.state.user.staffId
  367. },
  368. //获取人员表
  369. getStaffmar() {
  370. listPostUser(this.queryParams).then(response => {
  371. this.stffmgrOptions = response;
  372. });
  373. },
  374. /** 查询部门下拉树结构 */
  375. getTreeselect() {
  376. treeselect().then(response => {
  377. this.deptOptions = response.data;
  378. });
  379. },
  380. // 装置字典翻译
  381. plantCodeFormat(row, column) {
  382. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  383. },
  384. // 状态字典翻译
  385. statusFormat(row, column) {
  386. return this.selectDictLabel(this.statusOptions, row.status);
  387. },
  388. // 取消按钮
  389. cancel() {
  390. this.open = false;
  391. this.reset();
  392. },
  393. // 表单重置
  394. reset() {
  395. this.form = {
  396. id: null,
  397. plantCode: null,
  398. responsible: null,
  399. action: null,
  400. deadline: null,
  401. status: null,
  402. inputdate: null,
  403. delFlag: null,
  404. createrCode: null,
  405. createdate: null,
  406. updaterCode: null,
  407. updatedate: null,
  408. deptId: null,
  409. remarks: null,
  410. meetingId: null,
  411. isHis: null
  412. };
  413. this.resetForm("form");
  414. },
  415. /** 搜索按钮操作 */
  416. handleQuery() {
  417. this.queryParams.pageNum = 1;
  418. this.getList();
  419. },
  420. /** 重置按钮操作 */
  421. resetQuery() {
  422. this.resetForm("queryForm");
  423. this.handleQuery();
  424. },
  425. // 多选框选中数据
  426. handleSelectionChange(selection) {
  427. this.ids = selection.map(item => item.id)
  428. this.single = selection.length!==1
  429. this.multiple = !selection.length
  430. },
  431. /** 新增按钮操作 */
  432. handleAdd() {
  433. this.reset();
  434. this.open = true;
  435. this.title = this.$t('新增') + " " + this.$t('装置会议执行');
  436. },
  437. /** 修改按钮操作 */
  438. handleUpdate(row) {
  439. this.reset();
  440. const id = row.id || this.ids
  441. getActionlist(id).then(response => {
  442. this.form = response.data;
  443. this.open = true;
  444. this.title = this.$t('修改') + this.$t('装置会议执行');
  445. });
  446. },
  447. /** 提交按钮 */
  448. submitForm() {
  449. this.$refs["form"].validate(valid => {
  450. if (valid) {
  451. if (this.form.id != null) {
  452. updateActionlist(this.form).then(response => {
  453. this.msgSuccess(this.$t('修改成功'));
  454. this.open = false;
  455. this.getList();
  456. });
  457. } else {
  458. addActionlist(this.form).then(response => {
  459. this.msgSuccess(this.$t('新增成功'));
  460. this.open = false;
  461. this.getList();
  462. });
  463. }
  464. }
  465. });
  466. },
  467. /** 删除按钮操作 */
  468. handleDelete(row) {
  469. const ids = row.id || this.ids;
  470. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  471. confirmButtonText: this.$t('确定'),
  472. cancelButtonText: this.$t('取消'),
  473. type: "warning"
  474. }).then(function() {
  475. return delActionlist(ids);
  476. }).then(() => {
  477. this.getList();
  478. this.msgSuccess(this.$t('删除成功'));
  479. })
  480. },
  481. /** 导出按钮操作 */
  482. handleExport() {
  483. const queryParams = this.queryParams;
  484. this.$confirm(this.$t('是否确认导出所有装置会议执行数据项?'), this.$t('警告'), {
  485. confirmButtonText: this.$t('确定'),
  486. cancelButtonText: this.$t('取消'),
  487. type: "warning"
  488. }).then(function() {
  489. return exportActionlist(queryParams);
  490. }).then(response => {
  491. this.download(response.msg);
  492. })
  493. },
  494. /** 导入按钮操作 */
  495. handleImport() {
  496. this.upload.title = this.$t('用户导入');
  497. this.upload.open = true;
  498. },
  499. /** 下载模板操作 */
  500. importTemplate() {
  501. importTemplate().then(response => {
  502. this.download(response.msg);
  503. });
  504. },
  505. // 文件上传中处理
  506. handleFileUploadProgress(event, file, fileList) {
  507. this.upload.isUploading = true;
  508. },
  509. // 文件上传成功处理
  510. handleFileSuccess(response, file, fileList) {
  511. this.upload.open = false;
  512. this.upload.isUploading = false;
  513. this.$refs.upload.clearFiles();
  514. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  515. this.getList();
  516. },
  517. // 提交上传文件
  518. submitFileForm() {
  519. this.$refs.upload.submit();
  520. },
  521. //数据分析
  522. handleData(){
  523. this.drawer = true
  524. }
  525. }
  526. };
  527. </script>