index.vue 16 KB

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