index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834
  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="PID图号" prop="pidNo">
  14. <el-input
  15. v-model="queryParams.pidNo"
  16. placeholder="请输入PID图号"
  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:lock: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:lock:edit']"
  48. >修改
  49. </el-button>
  50. </el-col>
  51. <el-col :span="1.5">
  52. <el-button
  53. type="success"
  54. icon="el-icon-edit"
  55. size="mini"
  56. :disabled="multiple"
  57. @click="handleBatch"
  58. v-if="isApprove==0"
  59. v-hasPermi="['pssr:lock:edit']"
  60. >批量修改
  61. </el-button>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-button
  65. type="danger"
  66. icon="el-icon-delete"
  67. size="mini"
  68. :disabled="multiple"
  69. @click="handleDelete"
  70. v-if="isApprove==0"
  71. v-hasPermi="['pssr:lock:remove']"
  72. >删除
  73. </el-button>
  74. </el-col>
  75. <el-col :span="1.5">
  76. <el-button
  77. type="warning"
  78. icon="el-icon-download"
  79. size="mini"
  80. @click="handleExport"
  81. v-if="isApprove==0"
  82. v-hasPermi="['pssr:lock:export']"
  83. >导出
  84. </el-button>
  85. </el-col>
  86. <el-col :span="1.5">
  87. <el-button
  88. type="success"
  89. icon="el-icon-s-promotion"
  90. size="mini"
  91. @click="handleApprove"
  92. v-if="isApprove==0"
  93. v-hasPermi="['pssr:lock:edit']"
  94. >发起审批
  95. </el-button>
  96. </el-col>
  97. <el-col :span="1.5">
  98. <el-button
  99. type="primary"
  100. icon="el-icon-check"
  101. size="mini"
  102. v-if="isApprove==4||isApprove==5||isApprove==6"
  103. @click="handleConfirmApprove"
  104. v-hasPermi="['pssr:lock:edit']"
  105. >确认
  106. </el-button>
  107. </el-col>
  108. <el-col :span="1.5">
  109. <el-button
  110. type="danger"
  111. icon="el-icon-refresh-left"
  112. size="mini"
  113. v-if="isApprove==2"
  114. :disabled="multiple"
  115. @click="handleTurnDown"
  116. v-hasPermi="['pssr:lock:edit']"
  117. >驳回
  118. </el-button>
  119. </el-col>
  120. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  121. </el-row>
  122. <div style="width: 100%;text-align: center;margin-bottom: 15px">
  123. <H2>锁开锁关的完整性检查表</H2>
  124. </div>
  125. <el-table v-loading="loading" :data="lockList" @selection-change="handleSelectionChange"
  126. :height="clientHeight"
  127. :row-key="row => { return row.id }"
  128. use-virtual
  129. showBodyOverflow="title"
  130. border>
  131. <el-table-column type="selection" width="55" align="center"/>
  132. <el-table-column label="审批状态" align="center" prop="approveStatus" width="100">
  133. <template slot-scope="scope">
  134. <el-tag v-if="scope.row.approveStatus==0">未审批</el-tag>
  135. <el-tag v-if="scope.row.approveStatus==1" type="warning">待确认</el-tag>
  136. <el-tag v-if="scope.row.approveStatus==3" type="success">已确认1</el-tag>
  137. <el-tag v-if="scope.row.approveStatus==4" type="success">已上锁</el-tag>
  138. <el-tag v-if="scope.row.approveStatus==2" type="success">已确认2</el-tag>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="单元" align="center" prop="unit" :show-overflow-tooltip="true" width="150"/>
  142. <el-table-column label="岗位" align="center" prop="lockPost" :show-overflow-tooltip="true" width="150"/>
  143. <el-table-column label="PID图号" align="center" prop="pidNo" :show-overflow-tooltip="true" width="150"/>
  144. <el-table-column label="编号" align="center" prop="lockCode" :show-overflow-tooltip="true" width="150"/>
  145. <el-table-column label="介质" align="center" prop="medium" :show-overflow-tooltip="true" width="150"/>
  146. <el-table-column label="描述" align="center" prop="position" :show-overflow-tooltip="true" width="150"/>
  147. <el-table-column label="风险等级" align="center" prop="riskLevel" :show-overflow-tooltip="true" width="150"/>
  148. <el-table-column label="尺寸" align="center" prop="lockSize" :show-overflow-tooltip="true" width="150"/>
  149. <el-table-column label="阀门状态" align="center" prop="pidStatus" :show-overflow-tooltip="true" width="150"/>
  150. <el-table-column label="位置正确(✔/✖)" align="center" prop="positionRight" :show-overflow-tooltip="true"
  151. width="150"/>
  152. <el-table-column label="状态一致(✔/✖)" align="center" prop="statusRight" :show-overflow-tooltip="true"
  153. width="150"/>
  154. <el-table-column label="编号一致(✔/✖)" align="center" prop="codeAccord" :show-overflow-tooltip="true"
  155. width="150"/>
  156. <el-table-column label="紧固(✔/✖)" align="center" prop="fastening" :show-overflow-tooltip="true" width="150"/>
  157. <el-table-column label="锁具完好(✔/✖)" align="center" prop="noDamage" :show-overflow-tooltip="true" width="170"/>
  158. <el-table-column label="检查人" align="center" prop="lockeder" :show-overflow-tooltip="true" width="150">
  159. <template slot-scope="scope">
  160. <span>{{ scope.row.confirm1Name }}</span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="确认人" align="center" prop="confirm" :show-overflow-tooltip="true" width="150">
  164. <template slot-scope="scope">
  165. <span>{{ scope.row.confirm2Name }}</span>
  166. </template>
  167. </el-table-column>
  168. <el-table-column label="确认时间" align="center" prop="confirmationDate" width="100">
  169. <template slot-scope="scope">
  170. <span>{{ parseTime(scope.row.confirmationDate, '{y}-{m}-{d}') }}</span>
  171. </template>
  172. </el-table-column>
  173. <el-table-column label="驳回原因" align="center" prop="reason" :show-overflow-tooltip="true"/>
  174. <el-table-column label="操作" align="center" fixed="right" width="120"
  175. class-name="small-padding fixed-width">
  176. <template slot-scope="scope">
  177. <el-button
  178. size="mini"
  179. type="text"
  180. icon="el-icon-folder"
  181. v-if="scope.row.approveStatus!=2"
  182. @click="handleDoc(scope.row)"
  183. >附件
  184. </el-button>
  185. <el-button
  186. size="mini"
  187. type="text"
  188. icon="el-icon-edit"
  189. v-if="scope.row.approveStatus!=2"
  190. @click="handleUpdate(scope.row)"
  191. v-hasPermi="['pssr:lock:edit']"
  192. >修改
  193. </el-button>
  194. <el-button
  195. size="mini"
  196. type="text"
  197. icon="el-icon-delete"
  198. @click="handleDelete(scope.row)"
  199. v-if="scope.row.approveStatus!=2"
  200. v-hasPermi="['pssr:lock:remove']"
  201. >删除
  202. </el-button>
  203. </template>
  204. </el-table-column>
  205. </el-table>
  206. <pagination
  207. v-show="total>0"
  208. :total="total"
  209. :page-sizes="[20,100,500]"
  210. :page.sync="queryParams.pageNum"
  211. :limit.sync="queryParams.pageSize"
  212. @pagination="getList"
  213. />
  214. <!-- 添加或修改锁开锁关阀门状态对话框 -->
  215. <el-dialog :close-on-click-modal="false" :title="title" v-if="isApprove==0" :visible.sync="open" width="500px"
  216. append-to-body>
  217. <el-form ref="form" :model="form" :rules="rules" label-width="85px">
  218. <el-form-item label="PID图号" prop="pidNos">
  219. <el-select v-model="form.pidNos" clearable :disabled="isEdit" multiple filterable style="width: 100%;"
  220. placeholder="请选择PID图号">
  221. <el-option v-for="user in lockOptions"
  222. :label="user.pidNo"
  223. :value="user.pidNo"
  224. :key="user.pidNo"/>
  225. </el-select>
  226. </el-form-item>
  227. <el-form-item label="检查人" prop="lockeder">
  228. <el-select v-model="form.lockeder" clearable filterable style="width: 100%;"
  229. placeholder="请选择检查人">
  230. <el-option v-for="user in userOptions"
  231. :label="user.nickName"
  232. :value="user.userId+''"
  233. :key="user.userId"/>
  234. </el-select>
  235. </el-form-item>
  236. <el-form-item label="确认人" prop="confirm">
  237. <el-select v-model="form.confirm" clearable filterable style="width: 100%;"
  238. placeholder="请选择确认人">
  239. <el-option v-for="user in userOptions"
  240. :label="user.nickName"
  241. :value="user.userId+''"
  242. :key="user.userId"/>
  243. </el-select>
  244. </el-form-item>
  245. </el-form>
  246. <div slot="footer" class="dialog-footer">
  247. <el-button type="primary" @click="submitForm">确 定</el-button>
  248. <el-button @click="cancel">取 消</el-button>
  249. </div>
  250. </el-dialog>
  251. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="approveOpen"
  252. width="700px" append-to-body>
  253. <el-form ref="form" :model="form" :rules="rules" label-width="135px">
  254. <el-form-item label="检查人" prop="lockeder">
  255. <el-select v-model="form.lockeder" clearable filterable style="width: 100%;"
  256. placeholder="请选择检查人">
  257. <el-option v-for="user in userOptions"
  258. :label="user.nickName"
  259. :value="user.userId+''"
  260. :key="user.userId"/>
  261. </el-select>
  262. </el-form-item>
  263. <el-form-item label="确认人" prop="confirm">
  264. <el-select v-model="form.confirm" clearable filterable style="width: 100%;"
  265. placeholder="请选择确认人">
  266. <el-option v-for="user in userOptions"
  267. :label="user.nickName"
  268. :value="user.userId+''"
  269. :key="user.userId"/>
  270. </el-select>
  271. </el-form-item>
  272. <el-form-item label="位置正确(✔/✖)" prop="positionRight">
  273. <el-radio v-model="form.positionRight" label="✔" border>✔</el-radio>
  274. <el-radio v-model="form.positionRight" label="✖" border>✖</el-radio>
  275. </el-form-item>
  276. <el-form-item label="状态一致(✔/✖)" prop="statusRight">
  277. <el-radio v-model="form.statusRight" label="✔" border>✔</el-radio>
  278. <el-radio v-model="form.statusRight" label="✖" border>✖</el-radio>
  279. </el-form-item>
  280. <el-form-item label="编号一致(✔/✖)" prop="fastening">
  281. <el-radio v-model="form.codeAccord" label="✔" border>✔</el-radio>
  282. <el-radio v-model="form.codeAccord" label="✖" border>✖</el-radio>
  283. </el-form-item>
  284. <el-form-item label="紧固(✔/✖)" prop="fastening">
  285. <el-radio v-model="form.fastening" label="✔" border>✔</el-radio>
  286. <el-radio v-model="form.fastening" label="✖" border>✖</el-radio>
  287. </el-form-item>
  288. <el-form-item label="锁体完好(✔/✖)" prop="noDamage">
  289. <el-radio v-model="form.noDamage" label="✔" border>✔</el-radio>
  290. <el-radio v-model="form.noDamage" label="✖" border>✖</el-radio>
  291. </el-form-item>
  292. <el-form-item label="确认时间" prop="confirmationDate">
  293. <el-date-picker clearable size="small" style="width: 200px"
  294. v-model="form.confirmationDate"
  295. type="date"
  296. value-format="yyyy-MM-dd"
  297. placeholder="选择确认时间">
  298. </el-date-picker>
  299. </el-form-item>
  300. </el-form>
  301. <div slot="footer" class="dialog-footer">
  302. <el-button type="primary" @click="submitForm">确 定</el-button>
  303. <el-button @click="cancel">取 消</el-button>
  304. </div>
  305. </el-dialog>
  306. <!-- 批量修改对话框 -->
  307. <el-dialog :close-on-click-modal="false" title="批量修改" :visible.sync="openBatch" width="500px" append-to-body>
  308. <el-form ref="form" :model="form" label-width="80px">
  309. <el-form-item>
  310. <span>已选择 {{ ids.length }} 条数据</span>
  311. </el-form-item>
  312. <el-form-item label="检查人" prop="lockeder">
  313. <el-select v-model="form.lockeder" clearable filterable style="width: 100%;"
  314. placeholder="请选择检查人">
  315. <el-option v-for="user in userOptions"
  316. :label="user.nickName"
  317. :value="user.userId+''"
  318. :key="user.userId"/>
  319. </el-select>
  320. </el-form-item>
  321. <el-form-item label="确认人" prop="confirm">
  322. <el-select v-model="form.confirm" clearable filterable style="width: 100%;"
  323. placeholder="请选择确认人">
  324. <el-option v-for="user in userOptions"
  325. :label="user.nickName"
  326. :value="user.userId+''"
  327. :key="user.userId"/>
  328. </el-select>
  329. </el-form-item>
  330. <el-form-item label="时间" prop="confirmationDate">
  331. <el-date-picker clearable size="small" style="width: 200px"
  332. v-model="form.confirmationDate"
  333. type="date"
  334. value-format="yyyy-MM-dd"
  335. placeholder="选择时间">
  336. </el-date-picker>
  337. </el-form-item>
  338. <el-form-item label="备注" prop="remarks">
  339. <el-input v-model="form.remarks" placeholder="请输入备注"/>
  340. </el-form-item>
  341. </el-form>
  342. <div slot="footer" class="dialog-footer">
  343. <el-button type="primary" @click="submitFormBatch">确 定</el-button>
  344. <el-button @click="cancelBatch">取 消</el-button>
  345. </div>
  346. </el-dialog>
  347. <!-- 用户导入对话框 -->
  348. <el-dialog :close-on-click-modal="false" :title="upload.title" :visible.sync="upload.open" width="400px"
  349. append-to-body>
  350. <el-upload
  351. ref="upload"
  352. :limit="1"
  353. accept=".xlsx, .xls"
  354. :headers="upload.headers"
  355. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  356. :disabled="upload.isUploading"
  357. :on-progress="handleFileUploadProgress"
  358. :on-success="handleFileSuccess"
  359. :auto-upload="false"
  360. drag
  361. >
  362. <i class="el-icon-upload"></i>
  363. <div class="el-upload__text">
  364. 将文件拖到此处,或
  365. <em>点击上传</em>
  366. </div>
  367. <div class="el-upload__tip" slot="tip">
  368. <el-checkbox v-model="upload.updateSupport"/>
  369. 是否更新已经存在的用户数据
  370. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  371. </div>
  372. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  373. </el-upload>
  374. <div slot="footer" class="dialog-footer">
  375. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  376. <el-button @click="upload.open = false">取 消</el-button>
  377. </div>
  378. </el-dialog>
  379. <!-- 附件对话框 -->
  380. <el-dialog :close-on-click-modal="false" v-dialogDrag title="现场照片" :visible.sync="doc.open" width="1000px"
  381. append-to-body>
  382. <el-image v-for="file in doc.fileList" :key="file.id" :src="file.fileUrl" lazy></el-image>
  383. </el-dialog>
  384. <!-- 驳回原因对话框 -->
  385. <el-dialog v-dialogDrag :close-on-click-modal="false" :visible.sync="reason.open" append-to-body title="驳回"
  386. width="1000px">
  387. <el-table :data="items" border>
  388. <el-table-column label="编号" align="center" prop="lockCode" :show-overflow-tooltip="true" width="150"/>
  389. <el-table-column label="驳回原因" align="center" prop="reason" :show-overflow-tooltip="true">
  390. <template slot-scope="scope">
  391. <el-input v-model="scope.row.reason" placeholder="请输入驳回原因"/>
  392. </template>
  393. </el-table-column>
  394. </el-table>
  395. <div slot="footer" class="dialog-footer">
  396. <el-button type="primary" @click="submitReasonForm">确 定</el-button>
  397. <el-button @click="reasonCancel">取 消</el-button>
  398. </div>
  399. </el-dialog>
  400. </div>
  401. </template>
  402. <script>
  403. import {
  404. addLock,
  405. delLock,
  406. exportLock,
  407. getLock,
  408. handleConfirmApproveLock,
  409. handleTurnDownLock,
  410. importTemplate,
  411. listLock,
  412. updateLock,
  413. updateLockBatch,
  414. } from "@/api/pssr/lock";
  415. import {treeselect} from "@/api/system/dept";
  416. import {getToken} from "@/utils/auth";
  417. import Treeselect from "@riophae/vue-treeselect";
  418. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  419. import {getPssrUser} from "@/api/pssr/aboveall";
  420. import {listFile} from "@/api/pssr/file";
  421. import {doApprove} from "@/api/pssr/approve";
  422. import {listLockPid} from "@/api/apply/lock";
  423. import {updateMaterialBatch} from "@/api/pssr/material";
  424. export default {
  425. dicts: ['pssr_approve_status'],
  426. name: "Lock",
  427. components: {Treeselect},
  428. props: {
  429. subId: {
  430. type: Number,
  431. default: 0
  432. },
  433. isApprove: {
  434. type: Number,
  435. default: 0
  436. },
  437. },
  438. data() {
  439. return {
  440. reason: {
  441. open: false
  442. },
  443. doc: {
  444. file: "",
  445. // 是否显示弹出层(报告附件)
  446. open: false,
  447. fileList: [],
  448. queryParams: {
  449. itemId: null,
  450. subId: this.subId,
  451. forShort: 'sksgfmzt'
  452. },
  453. },
  454. isEdit: false,
  455. userOptions: [],
  456. lockOptions: [],
  457. // 遮罩层
  458. loading: true,
  459. // 选中数组
  460. ids: [],
  461. items: [],
  462. // 非单个禁用
  463. single: true,
  464. // 非多个禁用
  465. multiple: true,
  466. // 显示搜索条件
  467. showSearch: false,
  468. // 总条数
  469. total: 0,
  470. // 锁开锁关阀门状态表格数据
  471. lockList: [],
  472. // 弹出层标题
  473. title: "",
  474. // 部门树选项
  475. deptOptions: undefined,
  476. clientHeight: 300,
  477. // 是否显示弹出层
  478. open: false,
  479. openBatch: false,
  480. approveOpen: false,
  481. // 用户导入参数
  482. upload: {
  483. // 是否显示弹出层(用户导入)
  484. open: false,
  485. // 弹出层标题(用户导入)
  486. title: "",
  487. // 是否禁用上传
  488. isUploading: false,
  489. // 是否更新已经存在的用户数据
  490. updateSupport: 0,
  491. // 设置上传的请求头部
  492. headers: {Authorization: "Bearer " + getToken()},
  493. // 上传的地址
  494. url: process.env.VUE_APP_BASE_API + "/pssr/lock/importData"
  495. },
  496. // 查询参数
  497. queryParams: {
  498. pageNum: 1,
  499. pageSize: 20,
  500. subId: this.subId,
  501. approveId: null,
  502. unit: null,
  503. pidNos: [],
  504. position: null,
  505. lockSize: null,
  506. pidStatus: null,
  507. unlocker: null,
  508. unlockDate: null,
  509. lockeder: null,
  510. lockedDate: null,
  511. positionRight: null,
  512. statusRight: null,
  513. fastening: null,
  514. noDamage: null,
  515. confirm: null,
  516. confirmationDate: null,
  517. createrCode: null,
  518. createdate: null,
  519. updaterCode: null,
  520. updatedate: null,
  521. deptId: null,
  522. lockPost: null,
  523. lockCode: null,
  524. medium: null,
  525. riskLevel: null,
  526. codeAccord: null,
  527. remarks: null
  528. },
  529. // 表单参数
  530. form: {},
  531. // 表单校验
  532. rules: {
  533. confirm: [{required: true, message: "人员不可为空", trigger: "blur"}],
  534. lockeder: [{required: true, message: "人员不可为空", trigger: "blur"}],
  535. pidNos: [{required: true, message: "PID图号不可为空", trigger: "blur"}],
  536. noDamage: [{required: true, message: "请选择必选项", trigger: "blur"}],
  537. fastening: [{required: true, message: "请选择必选项", trigger: "blur"}],
  538. statusRight: [{required: true, message: "请选择必选项", trigger: "blur"}],
  539. positionRight: [{required: true, message: "请选择必选项", trigger: "blur"}],
  540. codeAccord: [{required: true, message: "请选择必选项", trigger: "blur"}],
  541. }
  542. };
  543. },
  544. watch: {
  545. // 根据名称筛选部门树
  546. deptName(val) {
  547. this.$refs.tree.filter(val);
  548. }
  549. },
  550. created() {
  551. //设置表格高度对应屏幕高度
  552. this.$nextTick(() => {
  553. this.clientHeight = document.body.clientHeight - 350
  554. })
  555. this.getList();
  556. this.getTreeselect();
  557. getPssrUser({}).then(res => {
  558. this.userOptions = res.data
  559. });
  560. listLockPid({subId: this.subId}).then(res => {
  561. this.lockOptions = res.data;
  562. });
  563. },
  564. methods: {
  565. /** 确认按钮操作*/
  566. handleApprove() {
  567. doApprove(this.subId).then(res => {
  568. this.msgSuccess("已发起确认流程");
  569. this.getList();
  570. })
  571. },
  572. checkSelectable(row) {
  573. return (row.approveStatus != 2 && row.approveStatus != 0 && this.isApprove != 0) || this.isApprove == 0
  574. },
  575. handleConfirmApprove() {
  576. let data = {
  577. ids: this.ids,
  578. subId: this.subId,
  579. taskType: this.isApprove
  580. }
  581. handleConfirmApproveLock(data).then(res => {
  582. this.msgSuccess("确认成功");
  583. this.getList();
  584. this.$emit('refreshHisList');
  585. })
  586. },
  587. handleTurnDown(val) {
  588. this.reason.open=true;
  589. },
  590. userFormat(userId) {
  591. for (let item of this.userOptions) {
  592. if (item.userId == userId) {
  593. return item.nickName
  594. }
  595. }
  596. },
  597. /** 查询锁开锁关阀门状态列表 */
  598. getList() {
  599. this.loading = true;
  600. listLock(this.queryParams).then(response => {
  601. this.lockList = response.rows;
  602. this.total = response.total;
  603. this.loading = false;
  604. });
  605. },
  606. /** 查询部门下拉树结构 */
  607. getTreeselect() {
  608. treeselect().then(response => {
  609. this.deptOptions = response.data;
  610. });
  611. },
  612. // 取消按钮
  613. cancel() {
  614. this.open = false;
  615. this.approveOpen = false;
  616. this.reset();
  617. },
  618. // 表单重置
  619. reset() {
  620. this.form = {
  621. id: null,
  622. subId: this.subId,
  623. approveId: null,
  624. unit: null,
  625. pidNos: [],
  626. position: null,
  627. lockSize: null,
  628. pidStatus: null,
  629. unlocker: null,
  630. unlockDate: null,
  631. lockeder: null,
  632. lockedDate: null,
  633. positionRight: null,
  634. statusRight: null,
  635. fastening: null,
  636. noDamage: null,
  637. confirm: null,
  638. confirmationDate: null,
  639. delFlag: null,
  640. createrCode: null,
  641. createdate: null,
  642. updaterCode: null,
  643. updatedate: null,
  644. deptId: null,
  645. lockPost: null,
  646. lockCode: null,
  647. medium: null,
  648. riskLevel: null,
  649. codeAccord: null,
  650. remarks: null
  651. };
  652. this.resetForm("form");
  653. },
  654. /** 搜索按钮操作 */
  655. handleQuery() {
  656. this.queryParams.pageNum = 1;
  657. this.getList();
  658. },
  659. /** 重置按钮操作 */
  660. resetQuery() {
  661. this.resetForm("queryForm");
  662. this.handleQuery();
  663. },
  664. // 多选框选中数据
  665. handleSelectionChange(selection) {
  666. this.items=selection;
  667. this.ids = selection.map(item => item.id)
  668. this.single = selection.length !== 1
  669. this.multiple = !selection.length
  670. },
  671. /** 新增按钮操作 */
  672. handleAdd() {
  673. this.isEdit = false
  674. this.reset();
  675. this.open = true;
  676. this.title = "添加锁开锁关阀门状态";
  677. },
  678. /** 修改按钮操作 */
  679. handleUpdate(row) {
  680. this.isEdit = true
  681. this.reset();
  682. const id = row.id || this.ids
  683. getLock(id).then(response => {
  684. this.form = response.data;
  685. // if (response.data.approveStatus != 2) {
  686. // if (this.isApprove == 0) {
  687. // this.open = true;
  688. // } else {
  689. // this.approveOpen = true;
  690. // }
  691. // }
  692. this.approveOpen = true;
  693. this.form.pidNos = []
  694. this.form.pidNos.push(this.form.pidNo);
  695. this.title = "修改锁开锁关阀门状态";
  696. });
  697. },
  698. /** 提交按钮 */
  699. submitForm() {
  700. this.$refs["form"].validate(valid => {
  701. if (valid) {
  702. if (this.form.id != null) {
  703. updateLock(this.form).then(response => {
  704. this.msgSuccess("修改成功");
  705. this.open = false;
  706. this.approveOpen = false;
  707. this.getList();
  708. });
  709. } else {
  710. addLock(this.form).then(response => {
  711. this.msgSuccess("新增成功");
  712. this.open = false;
  713. this.getList();
  714. // if (response.msg != "") {
  715. // this.$alert(response.msg, "警告", {dangerouslyUseHTMLString: true});
  716. // }
  717. });
  718. }
  719. }
  720. });
  721. },
  722. /** 删除按钮操作 */
  723. handleDelete(row) {
  724. const ids = row.id || this.ids;
  725. this.$confirm('是否确认删除?', "警告", {
  726. confirmButtonText: "确定",
  727. cancelButtonText: "取消",
  728. type: "warning"
  729. }).then(function () {
  730. return delLock(ids);
  731. }).then(() => {
  732. this.getList();
  733. this.msgSuccess("删除成功");
  734. })
  735. },
  736. /** 导出按钮操作 */
  737. handleExport() {
  738. const queryParams = this.queryParams;
  739. this.$confirm('是否确认导出所有锁开锁关阀门状态数据项?', "警告", {
  740. confirmButtonText: "确定",
  741. cancelButtonText: "取消",
  742. type: "warning"
  743. }).then(function () {
  744. return exportLock(queryParams);
  745. }).then(response => {
  746. this.download(response.msg);
  747. })
  748. },
  749. /** 导入按钮操作 */
  750. handleImport() {
  751. this.upload.title = "用户导入";
  752. this.upload.open = true;
  753. },
  754. /** 下载模板操作 */
  755. importTemplate() {
  756. importTemplate().then(response => {
  757. this.download(response.msg);
  758. });
  759. },
  760. // 文件上传中处理
  761. handleFileUploadProgress(event, file, fileList) {
  762. this.upload.isUploading = true;
  763. },
  764. // 文件上传成功处理
  765. handleFileSuccess(response, file, fileList) {
  766. this.upload.open = false;
  767. this.upload.isUploading = false;
  768. this.$refs.upload.clearFiles();
  769. this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
  770. this.getList();
  771. },
  772. // 提交上传文件
  773. submitFileForm() {
  774. this.$refs.upload.submit();
  775. },
  776. /** 报告附件按钮操作 */
  777. handleDoc(row) {
  778. this.doc.fileList = []
  779. this.doc.open = true;
  780. this.doc.queryParams.itemId = row.id
  781. this.getFileList()
  782. },
  783. getFileList() {
  784. listFile(this.doc.queryParams).then(response => {
  785. this.doc.fileList = response.rows;
  786. this.doc.fileList.forEach(item => {
  787. item.fileUrl = process.env.VUE_APP_BASE_API + item.fileUrl;
  788. });
  789. });
  790. },
  791. reasonCancel() {
  792. this.reason.open = false;
  793. },
  794. submitReasonForm(){
  795. handleTurnDownLock(this.items).then(res => {
  796. this.msgSuccess("驳回成功");
  797. this.reason.open = false;
  798. this.$emit('refreshHisList');
  799. })
  800. },
  801. handleBatch(){
  802. this.reset();
  803. this.openBatch = true
  804. },
  805. // 取消按钮
  806. cancelBatch() {
  807. this.openBatch = false;
  808. this.reset();
  809. },
  810. /** 提交按钮 */
  811. submitFormBatch() {
  812. this.$refs["form"].validate(valid => {
  813. if (valid) {
  814. this.form.ids = this.ids
  815. updateLockBatch(this.form).then(response => {
  816. this.msgSuccess("修改成功");
  817. this.openBatch = false;
  818. this.getList();
  819. });
  820. }
  821. });
  822. },
  823. }
  824. };
  825. </script>