index.vue 27 KB

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