index.vue 16 KB

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