index.vue 17 KB

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