actionlist.vue 19 KB

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