index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  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="unit">
  5. <el-input
  6. v-model="queryParams.unit"
  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 label="安全阀位号" prop="devNo">
  23. <el-input
  24. v-model="queryParams.devNo"
  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-hasPermi="['pssr:safetyValve:add']"
  44. v-if="isApprove==0"
  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-hasPermi="['pssr:safetyValve:edit']"
  56. v-if="isApprove==0"
  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-hasPermi="['pssr:safetyValve:remove']"
  68. v-if="isApprove==0"
  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-hasPermi="['pssr:safetyValve:edit']"
  79. v-if="isApprove==0"
  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-hasPermi="['pssr:safetyValve:export']"
  90. v-if="isApprove==0"
  91. >导出
  92. </el-button>
  93. </el-col>
  94. <el-col :span="1.5">
  95. <el-button
  96. type="success"
  97. icon="el-icon-s-promotion"
  98. size="mini"
  99. @click="handleApprove"
  100. v-if="isApprove==0"
  101. v-hasPermi="['pssr:safetyValve:edit']"
  102. >发起审批
  103. </el-button>
  104. </el-col>
  105. <el-col :span="1.5">
  106. <el-button
  107. type="primary"
  108. icon="el-icon-check"
  109. size="mini"
  110. v-if="isApprove==4||isApprove==5"
  111. @click="handleConfirmApprove"
  112. v-hasPermi="['pssr:safetyValve:edit']"
  113. >确认
  114. </el-button>
  115. </el-col>
  116. <el-col :span="1.5">
  117. <el-button
  118. type="danger"
  119. icon="el-icon-refresh-left"
  120. size="mini"
  121. v-if="isApprove==2"
  122. :disabled="multiple"
  123. @click="handleTurnDown"
  124. v-hasPermi="['pssr:safetyValve:edit']"
  125. >驳回
  126. </el-button>
  127. </el-col>
  128. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  129. </el-row>
  130. <div style="width: 100%;text-align: center;margin-bottom: 15px">
  131. <h2>安全阀检查清单</h2>
  132. <br>
  133. <span>检查内容:所有的安全阀是否已经校验,是否在有效期内,并确认安装位置是否正确,是否投用,核对安全阀校验压力和设定压力是否一致,是(√),否(×),如有不符合要求的立即联系负责人整改。</span>
  134. </div>
  135. <el-table v-loading="loading" :data="safetyValveList" @selection-change="handleSelectionChange"
  136. :height="clientHeight" border>
  137. <el-table-column type="selection" width="55" align="center"/>
  138. <el-table-column label="审批状态" align="center" prop="approveStatus" :show-overflow-tooltip="true" width="105">
  139. <template slot-scope="scope">
  140. <el-tag v-if="scope.row.approveStatus==0">未审批</el-tag>
  141. <el-tag v-if="scope.row.approveStatus==1" type="warning">待确认</el-tag>
  142. <el-tag v-if="scope.row.approveStatus==3" type="success">已确认1</el-tag>
  143. <el-tag v-if="scope.row.approveStatus==2" type="success">已确认2</el-tag>
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="单元号" align="center" prop="unit" :show-overflow-tooltip="true" width="180"/>
  147. <el-table-column label="P&ID图号" align="center" prop="pidNo" :show-overflow-tooltip="true" width="180"/>
  148. <el-table-column label="安全阀位号" align="center" prop="devNo" :show-overflow-tooltip="true" width="180"/>
  149. <el-table-column label="保护设备" align="center" prop="safetyDev" :show-overflow-tooltip="true" width="180"/>
  150. <el-table-column label="已经校验" align="center" prop="verify" :show-overflow-tooltip="true" width="180"/>
  151. <el-table-column label="在有效期内" align="center" prop="inValidity" :show-overflow-tooltip="true" width="180"/>
  152. <el-table-column label="安装位置" align="center" prop="installLocation" :show-overflow-tooltip="true"
  153. width="180"/>
  154. <el-table-column label="安装位置准确" align="center" prop="installAccuracy" :show-overflow-tooltip="true"
  155. width="180"/>
  156. <el-table-column label="投用" align="center" prop="putUse" :show-overflow-tooltip="true" width="180"/>
  157. <el-table-column label="设定压力" align="center" prop="setPressure" :show-overflow-tooltip="true" width="180"/>
  158. <el-table-column label="校验压力与设定压力一致" align="center" prop="uniformPressure"
  159. :show-overflow-tooltip="true" width="180"/>
  160. <el-table-column label="确认人1" align="center" prop="confirmer1" :show-overflow-tooltip="true" width="180">
  161. <template slot-scope="scope">
  162. <span>{{ userFormat(scope.row.confirmer1) }}</span>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="确认人2" align="center" prop="confirmer2" :show-overflow-tooltip="true" width="180">
  166. <template slot-scope="scope">
  167. <span>{{ userFormat(scope.row.confirmer2) }}</span>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="时间" align="center" prop="confirmationTime" :show-overflow-tooltip="true" width="180">
  171. <template slot-scope="scope">
  172. <span>{{ parseTime(scope.row.confirmationDate, '{y}-{m}-{d}') }}</span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true" width="180"/>
  176. <el-table-column label="操作" align="center" fixed="right" width="120" v-if="isApprove==0"
  177. class-name="small-padding fixed-width">
  178. <template slot-scope="scope">
  179. <el-button
  180. size="mini"
  181. type="text"
  182. icon="el-icon-edit"
  183. @click="handleUpdate(scope.row)"
  184. v-hasPermi="['pssr:safetyValve:edit']"
  185. >修改
  186. </el-button>
  187. <el-button
  188. size="mini"
  189. type="text"
  190. icon="el-icon-delete"
  191. @click="handleDelete(scope.row)"
  192. v-hasPermi="['pssr:safetyValve:remove']"
  193. >删除
  194. </el-button>
  195. </template>
  196. </el-table-column>
  197. </el-table>
  198. <pagination
  199. v-show="total>0"
  200. :total="total"
  201. :page.sync="queryParams.pageNum"
  202. :limit.sync="queryParams.pageSize"
  203. @pagination="getList"
  204. />
  205. <!-- 添加或修改安全设施-安全阀对话框 -->
  206. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="500px" append-to-body>
  207. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  208. <el-form-item label="单元号" prop="unit">
  209. <el-input v-model="form.unit" placeholder="请输入单元号"/>
  210. </el-form-item>
  211. <el-form-item label="P&ID图号" prop="pidNo">
  212. <el-input v-model="form.pidNo" placeholder="请输入P&ID图号"/>
  213. </el-form-item>
  214. <el-form-item label="安全阀位号" prop="devNo">
  215. <el-input v-model="form.devNo" placeholder="请输入安全阀位号"/>
  216. </el-form-item>
  217. <el-form-item label="保护设备" prop="safetyDev">
  218. <el-input v-model="form.safetyDev" placeholder="请输入保护设备"/>
  219. </el-form-item>
  220. <el-form-item label="已经校验" prop="verify">
  221. <el-input v-model="form.verify" placeholder="请输入已经校验"/>
  222. </el-form-item>
  223. <el-form-item label="在有效期内" prop="inValidity">
  224. <el-input v-model="form.inValidity" placeholder="请输入在有效期内"/>
  225. </el-form-item>
  226. <el-form-item label="安装位置" prop="installLocation">
  227. <el-input v-model="form.installLocation" placeholder="请输入安装位置"/>
  228. </el-form-item>
  229. <el-form-item label="安装位置准确" prop="installAccuracy">
  230. <el-input v-model="form.installAccuracy" placeholder="请输入安装位置准确"/>
  231. </el-form-item>
  232. <el-form-item label="设定压力" prop="setPressure">
  233. <el-input v-model="form.setPressure" placeholder="请输入设定压力"/>
  234. </el-form-item>
  235. <el-form-item label="校验压力与设定压力一致" prop="uniformPressure">
  236. <el-input v-model="form.uniformPressure" placeholder="请输入校验压力与设定压力一致"/>
  237. </el-form-item>
  238. <el-form-item label="确认人1" prop="confirmer1">
  239. <el-select v-model="form.confirmer1" filterable placeholder="请选择确认人1">
  240. <el-option v-for="user in userOptions"
  241. :label="user.nickName"
  242. :value="user.userId+''"
  243. :key="user.userId"/>
  244. </el-select>
  245. </el-form-item>
  246. <el-form-item label="确认人2" prop="confirmer2">
  247. <el-select v-model="form.confirmer2" filterable placeholder="请选择确认人2">
  248. <el-option v-for="user in userOptions"
  249. :label="user.nickName"
  250. :value="user.userId+''"
  251. :key="user.userId"/>
  252. </el-select>
  253. </el-form-item>
  254. <el-form-item label="备注" prop="remarks">
  255. <el-input v-model="form.remarks" placeholder="请输入备注"/>
  256. </el-form-item>
  257. </el-form>
  258. <div slot="footer" class="dialog-footer">
  259. <el-button type="primary" @click="submitForm">确 定</el-button>
  260. <el-button @click="cancel">取 消</el-button>
  261. </div>
  262. </el-dialog>
  263. <!-- 用户导入对话框 -->
  264. <el-dialog :close-on-click-modal="false" :title="upload.title" :visible.sync="upload.open" width="400px"
  265. append-to-body>
  266. <el-upload
  267. ref="upload"
  268. :limit="1"
  269. accept=".xlsx, .xls"
  270. :headers="upload.headers"
  271. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  272. :disabled="upload.isUploading"
  273. :on-progress="handleFileUploadProgress"
  274. :on-success="handleFileSuccess"
  275. :auto-upload="false"
  276. drag
  277. >
  278. <i class="el-icon-upload"></i>
  279. <div class="el-upload__text">
  280. 将文件拖到此处,或
  281. <em>点击上传</em>
  282. </div>
  283. <div class="el-upload__tip" slot="tip">
  284. <el-checkbox v-model="upload.updateSupport"/>
  285. 是否更新已经存在的用户数据
  286. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  287. </div>
  288. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  289. </el-upload>
  290. <div slot="footer" class="dialog-footer">
  291. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  292. <el-button @click="upload.open = false">取 消</el-button>
  293. </div>
  294. </el-dialog>
  295. </div>
  296. </template>
  297. <script>
  298. import {
  299. addSafetyValve,
  300. delSafetyValve,
  301. exportSafetyValve,
  302. getSafetyValve,
  303. importTemplate,
  304. listSafetyValve,
  305. updateSafetyValve
  306. } from "@/api/pssr/safetyValve";
  307. import {treeselect} from "@/api/system/dept";
  308. import {getToken} from "@/utils/auth";
  309. import Treeselect from "@riophae/vue-treeselect";
  310. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  311. import {listUserNoPage} from "@/api/system/user";
  312. import {handleconfirmValve, handleturnDownValve} from "@/api/pssr/safety";
  313. import {doApprove} from "@/api/pssr/approve";
  314. export default {
  315. dicts: ['pssr_approve_status'],
  316. name: "SafetyValve",
  317. components: {Treeselect},
  318. props: {
  319. subId: {
  320. type: Number,
  321. default: 0
  322. },
  323. isApprove: {
  324. type: Number,
  325. default: 0
  326. },
  327. },
  328. data() {
  329. return {
  330. userOptions: [],
  331. // 遮罩层
  332. loading: true,
  333. // 选中数组
  334. ids: [],
  335. // 非单个禁用
  336. single: true,
  337. // 非多个禁用
  338. multiple: true,
  339. // 显示搜索条件
  340. showSearch: false,
  341. // 总条数
  342. total: 0,
  343. // 安全设施-安全阀表格数据
  344. safetyValveList: [],
  345. // 弹出层标题
  346. title: "",
  347. // 部门树选项
  348. deptOptions: undefined,
  349. clientHeight: 300,
  350. // 是否显示弹出层
  351. open: false,
  352. // 用户导入参数
  353. upload: {
  354. // 是否显示弹出层(用户导入)
  355. open: false,
  356. // 弹出层标题(用户导入)
  357. title: "",
  358. // 是否禁用上传
  359. isUploading: false,
  360. // 是否更新已经存在的用户数据
  361. updateSupport: 0,
  362. // 设置上传的请求头部
  363. headers: {Authorization: "Bearer " + getToken()},
  364. // 上传的地址
  365. url: process.env.VUE_APP_BASE_API + "/pssr/safetyValve/importData"
  366. },
  367. // 查询参数
  368. queryParams: {
  369. pageNum: 1,
  370. pageSize: 20,
  371. subId: this.subId,
  372. approveId: null,
  373. unit: null,
  374. pidNo: null,
  375. devNo: null,
  376. safetyDev: null,
  377. verify: null,
  378. inValidity: null,
  379. installLocation: null,
  380. installAccuracy: null,
  381. setPressure: null,
  382. uniformPressure: null,
  383. confirmer1: null,
  384. confirmer2: null,
  385. confirmationTime: null,
  386. createrCode: null,
  387. createdate: null,
  388. updaterCode: null,
  389. updatedate: null,
  390. deptId: null,
  391. remarks: null
  392. },
  393. // 表单参数
  394. form: {},
  395. // 表单校验
  396. rules: {}
  397. };
  398. },
  399. watch: {
  400. // 根据名称筛选部门树
  401. deptName(val) {
  402. this.$refs.tree.filter(val);
  403. }
  404. },
  405. created() {
  406. //设置表格高度对应屏幕高度
  407. this.$nextTick(() => {
  408. this.clientHeight = document.body.clientHeight - 380
  409. })
  410. this.getList();
  411. this.getTreeselect();
  412. listUserNoPage({}).then(res => {
  413. this.userOptions = res.data
  414. });
  415. },
  416. methods: {
  417. /** 查询安全设施-安全阀列表 */
  418. getList() {
  419. this.loading = true;
  420. listSafetyValve(this.queryParams).then(response => {
  421. this.safetyValveList = response.rows;
  422. this.total = response.total;
  423. this.loading = false;
  424. });
  425. },
  426. /** 查询部门下拉树结构 */
  427. getTreeselect() {
  428. treeselect().then(response => {
  429. this.deptOptions = response.data;
  430. });
  431. },
  432. // 取消按钮
  433. cancel() {
  434. this.open = false;
  435. this.reset();
  436. },
  437. // 表单重置
  438. reset() {
  439. this.form = {
  440. id: null,
  441. subId: this.subId,
  442. approveId: null,
  443. unit: null,
  444. pidNo: null,
  445. devNo: null,
  446. safetyDev: null,
  447. verify: null,
  448. inValidity: null,
  449. installLocation: null,
  450. installAccuracy: null,
  451. setPressure: null,
  452. uniformPressure: null,
  453. confirmer1: null,
  454. confirmer2: null,
  455. confirmationTime: null,
  456. delFlag: null,
  457. createrCode: null,
  458. createdate: null,
  459. updaterCode: null,
  460. updatedate: null,
  461. deptId: null,
  462. remarks: null
  463. };
  464. this.resetForm("form");
  465. },
  466. /** 搜索按钮操作 */
  467. handleQuery() {
  468. this.queryParams.pageNum = 1;
  469. this.getList();
  470. },
  471. /** 重置按钮操作 */
  472. resetQuery() {
  473. this.resetForm("queryForm");
  474. this.handleQuery();
  475. },
  476. // 多选框选中数据
  477. handleSelectionChange(selection) {
  478. this.ids = selection.map(item => item.id)
  479. this.single = selection.length !== 1
  480. this.multiple = !selection.length
  481. },
  482. /** 新增按钮操作 */
  483. handleAdd() {
  484. this.reset();
  485. this.open = true;
  486. this.title = "添加安全设施-安全阀";
  487. },
  488. /** 修改按钮操作 */
  489. handleUpdate(row) {
  490. this.reset();
  491. const id = row.id || this.ids
  492. getSafetyValve(id).then(response => {
  493. this.form = response.data;
  494. this.open = true;
  495. this.title = "修改安全设施-安全阀";
  496. });
  497. },
  498. /** 提交按钮 */
  499. submitForm() {
  500. this.$refs["form"].validate(valid => {
  501. if (valid) {
  502. if (this.form.id != null) {
  503. updateSafetyValve(this.form).then(response => {
  504. this.msgSuccess("修改成功");
  505. this.open = false;
  506. this.getList();
  507. });
  508. } else {
  509. addSafetyValve(this.form).then(response => {
  510. this.msgSuccess("新增成功");
  511. this.open = false;
  512. this.getList();
  513. });
  514. }
  515. }
  516. });
  517. },
  518. /** 删除按钮操作 */
  519. handleDelete(row) {
  520. const ids = row.id || this.ids;
  521. this.$confirm('是否确认删除?', "警告", {
  522. confirmButtonText: "确定",
  523. cancelButtonText: "取消",
  524. type: "warning"
  525. }).then(function () {
  526. return delSafetyValve(ids);
  527. }).then(() => {
  528. this.getList();
  529. this.msgSuccess("删除成功");
  530. })
  531. },
  532. /** 导出按钮操作 */
  533. handleExport() {
  534. const queryParams = this.queryParams;
  535. this.$confirm('是否确认导出所有安全设施-安全阀数据项?', "警告", {
  536. confirmButtonText: "确定",
  537. cancelButtonText: "取消",
  538. type: "warning"
  539. }).then(function () {
  540. return exportSafetyValve(queryParams);
  541. }).then(response => {
  542. this.download(response.msg);
  543. })
  544. },
  545. /** 导入按钮操作 */
  546. handleImport() {
  547. this.upload.title = "用户导入";
  548. this.upload.open = true;
  549. },
  550. /** 下载模板操作 */
  551. importTemplate() {
  552. importTemplate().then(response => {
  553. this.download(response.msg);
  554. });
  555. },
  556. // 文件上传中处理
  557. handleFileUploadProgress(event, file, fileList) {
  558. this.upload.isUploading = true;
  559. },
  560. // 文件上传成功处理
  561. handleFileSuccess(response, file, fileList) {
  562. this.upload.open = false;
  563. this.upload.isUploading = false;
  564. this.$refs.upload.clearFiles();
  565. this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
  566. this.getList();
  567. },
  568. // 提交上传文件
  569. submitFileForm() {
  570. this.$refs.upload.submit();
  571. },
  572. //发起审批
  573. handleApprove() {
  574. doApprove(this.subId).then(res => {
  575. this.msgSuccess("已发起确认流程");
  576. this.getList();
  577. })
  578. },
  579. handleConfirmApprove() {
  580. let data = {
  581. ids: this.ids,
  582. subId: this.subId,
  583. taskType: this.isApprove
  584. }
  585. handleconfirmValve(data).then(res => {
  586. this.msgSuccess("确认成功");
  587. this.getList()
  588. this.$emit('refreshHisList');
  589. })
  590. },
  591. handleTurnDown(val) {
  592. this.$prompt('请输入驳回原因', '提示', {
  593. confirmButtonText: '确认驳回',
  594. cancelButtonText: '取消',
  595. }).then(({value}) => {
  596. let data = {
  597. ids: this.ids,
  598. subId: this.subId,
  599. remarks: value
  600. }
  601. handleturnDownValve(data).then(res => {
  602. this.msgSuccess("驳回成功");
  603. })
  604. }).catch(() => {
  605. this.$message({
  606. type: 'info',
  607. message: '取消驳回'
  608. });
  609. });
  610. },
  611. userFormat(userId) {
  612. for (let item of this.userOptions) {
  613. if (item.userId == userId) {
  614. return item.nickName
  615. }
  616. }
  617. },
  618. }
  619. };
  620. </script>