actionlist.vue 18 KB

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