index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  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="devNo" label-width="90px">
  5. <el-select v-model="queryParams.devNo" placeholder="请选择或输入安全阀位号" clearable size="small"
  6. @change="handleQuery" filterable allow-create>
  7. <el-option
  8. v-for="item in safetyvavleList"
  9. :key="item.tagno"
  10. :label="item.tagno"
  11. :value="item.tagno"
  12. ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="单元" prop="unit">
  16. <el-select v-model="queryParams.unit" placeholder="请选择单元" clearable size="small" @change="handleQuery"
  17. filterable>
  18. <el-option
  19. v-for="dict in unitOptions"
  20. :key="dict.dictLabel"
  21. :label="dict.dictLabel"
  22. :value="dict.dictLabel"
  23. ></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="离线原因" prop="offlineReason">
  27. <el-input
  28. v-model="queryParams.offlineReason"
  29. placeholder="请输入离线原因"
  30. clearable
  31. size="small"
  32. @keyup.enter.native="handleQuery"
  33. />
  34. </el-form-item>
  35. <el-form-item label="临时措施确认人" prop="confirmerName" label-width="130px">
  36. <el-input
  37. v-model="queryParams.confirmerName"
  38. placeholder="请输入临时措施确认人"
  39. clearable
  40. size="small"
  41. @keyup.enter.native="handleQuery"
  42. />
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  46. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  47. </el-form-item>
  48. </el-form>
  49. <el-row :gutter="10" class="mb8">
  50. <el-col :span="1.5">
  51. <el-button
  52. type="primary"
  53. icon="el-icon-plus"
  54. size="mini"
  55. @click="handleAdd"
  56. v-hasPermi="['apply:offlinevalve:add']"
  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="single"
  66. @click="handleUpdate"
  67. v-hasPermi="['apply:offlinevalve:edit']"
  68. >修改
  69. </el-button>
  70. </el-col>
  71. <el-col :span="1.5">
  72. <el-button
  73. type="danger"
  74. icon="el-icon-delete"
  75. size="mini"
  76. :disabled="multiple"
  77. @click="handleDelete"
  78. v-hasPermi="['apply:offlinevalve:remove']"
  79. >删除
  80. </el-button>
  81. </el-col>
  82. <!-- <el-col :span="1.5">
  83. <el-button
  84. type="info"
  85. icon="el-icon-upload2"
  86. size="mini"
  87. @click="handleImport"
  88. v-hasPermi="['apply:offlinevalve:edit']"
  89. >导入
  90. </el-button>
  91. </el-col>-->
  92. <el-col :span="1.5">
  93. <el-button
  94. type="warning"
  95. icon="el-icon-download"
  96. size="mini"
  97. @click="handleExport"
  98. v-hasPermi="['apply:offlinevalve:export']"
  99. >导出
  100. </el-button>
  101. </el-col>
  102. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  103. </el-row>
  104. <el-table v-loading="loading" :data="offlinevalveList" @selection-change="handleSelectionChange"
  105. :height="clientHeight" border>
  106. <el-table-column type="selection" width="55" align="center" fixed="left"/>
  107. <el-table-column label="安全阀位号" align="center" prop="devNo" :show-overflow-tooltip="true" width="125"
  108. fixed="left"/>
  109. <el-table-column label="单元" align="center" prop="unit" :show-overflow-tooltip="true" width="85" fixed="left"/>
  110. <el-table-column label="申请状态" align="center" prop="approveStatus" :show-overflow-tooltip="true" width="85"
  111. fixed="left" :formatter="approveStatusFormat"/>
  112. <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="90" fixed="left" :formatter="statusFormat"/>
  113. <el-table-column label="离线原因" align="center" prop="offlineReason" :show-overflow-tooltip="true" width="185"/>
  114. <el-table-column label="安全阀锁开是否拆解" align="center" prop="disassembly" :show-overflow-tooltip="true"
  115. width="185"/>
  116. <el-table-column label="临时措施执行人" align="center" prop="executorName" :show-overflow-tooltip="true" width="130"/>
  117. <el-table-column label="临时措施执行时间" align="center" prop="executionTime" width="140">
  118. <template slot-scope="scope">
  119. <span>{{ parseTime(scope.row.executionTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="临时措施确认人" align="center" prop="confirmerName" :show-overflow-tooltip="true"
  123. width="130"/>
  124. <el-table-column label="临时措施确认时间" align="center" prop="temporaryTime" width="140">
  125. <template slot-scope="scope">
  126. <span>{{ parseTime(scope.row.temporaryTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="申请人" align="center" prop="applicantName" :show-overflow-tooltip="true" width="90"/>
  130. <el-table-column label="申请时间" align="center" prop="applicationTime" width="140">
  131. <template slot-scope="scope">
  132. <span>{{ parseTime(scope.row.applicationTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="批准人" align="center" prop="approverName" :show-overflow-tooltip="true" width="90"/>
  136. <el-table-column label="批准时间" align="center" prop="approveTime" width="100">
  137. <template slot-scope="scope">
  138. <span>{{ parseTime(scope.row.approveTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  139. </template>
  140. </el-table-column>
  141. />
  142. <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true" width="140"/>
  143. <el-table-column label="操作" align="center" fixed="right" width="150" class-name="small-padding fixed-width">
  144. <template slot-scope="scope">
  145. <el-button
  146. size="mini"
  147. type="text"
  148. icon="el-icon-document"
  149. @click="openDetail(scope.row)"
  150. >详情
  151. </el-button>
  152. <el-button
  153. size="mini"
  154. type="text"
  155. icon="el-icon-document"
  156. @click="openApproveDetail(scope.row)"
  157. >流转详情
  158. </el-button>
  159. </template>
  160. </el-table-column>
  161. </el-table>
  162. <pagination
  163. v-show="total>0"
  164. :total="total"
  165. :page.sync="queryParams.pageNum"
  166. :limit.sync="queryParams.pageSize"
  167. @pagination="getList"
  168. />
  169. <!-- 添加或修改安全阀离线切出申请对话框 -->
  170. <el-dialog :title="title" :visible.sync="open" width="30%" append-to-body>
  171. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  172. <el-form-item label="安全阀位号" prop="devNo">
  173. <el-select v-model="form.devNo" placeholder="请选择或输入安全阀位号" clearable size="small" filterable
  174. allow-create style="width: 100%">
  175. <el-option
  176. v-for="item in safetyvavleList"
  177. :key="item.tagno"
  178. :label="item.tagno"
  179. :value="item.tagno"
  180. ></el-option>
  181. </el-select>
  182. </el-form-item>
  183. <el-form-item label="单元" prop="unit">
  184. <el-select v-model="form.unit" placeholder="请选择单元" clearable size="small" filterable style="width: 100%">
  185. <el-option
  186. v-for="dict in unitOptions"
  187. :key="dict.dictLabel"
  188. :label="dict.dictLabel"
  189. :value="dict.dictLabel"
  190. ></el-option>
  191. </el-select>
  192. </el-form-item>
  193. <el-form-item label="离线原因" prop="offlineReason">
  194. <el-input type="textarea" v-model="form.offlineReason" placeholder="请输入离线原因"/>
  195. </el-form-item>
  196. <el-form-item label="临时措施执行人" prop="executor">
  197. <el-select v-model="form.executor" placeholder="请选择临时措施执行人" clearable size="small" filterable style="width: 100%" @change="getExecutorName(form.executor)">
  198. <el-option
  199. v-for="item in executorList"
  200. :key="item.userId"
  201. :label="item.nickName"
  202. :value="item.userId"
  203. ></el-option>
  204. </el-select>
  205. </el-form-item>
  206. <el-form-item label="临时措施确认人" prop="confirmer">
  207. <el-select v-model="form.confirmer" placeholder="请选择临时措施确认人" clearable size="small" filterable style="width: 100%" @change="getConfirmerName(form.confirmer)">
  208. <el-option
  209. v-for="item in confirmerList"
  210. :key="item.userId"
  211. :label="item.nickName"
  212. :value="item.userId"
  213. ></el-option>
  214. </el-select>
  215. </el-form-item>
  216. <el-form-item label="备注" prop="remarks">
  217. <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注"/>
  218. </el-form-item>
  219. </el-form>
  220. <div slot="footer" class="dialog-footer">
  221. <el-button type="primary" @click="submitForm">确 定</el-button>
  222. <el-button @click="cancel">取 消</el-button>
  223. </div>
  224. </el-dialog>
  225. <!-- 用户导入对话框 -->
  226. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  227. <el-upload
  228. ref="upload"
  229. :limit="1"
  230. accept=".xlsx, .xls"
  231. :headers="upload.headers"
  232. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  233. :disabled="upload.isUploading"
  234. :on-progress="handleFileUploadProgress"
  235. :on-success="handleFileSuccess"
  236. :auto-upload="false"
  237. drag
  238. >
  239. <i class="el-icon-upload"></i>
  240. <div class="el-upload__text">
  241. 将文件拖到此处,或
  242. <em>点击上传</em>
  243. </div>
  244. <div class="el-upload__tip" slot="tip">
  245. <el-checkbox v-model="upload.updateSupport"/>
  246. 是否更新已经存在的用户数据
  247. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  248. </div>
  249. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  250. </el-upload>
  251. <div slot="footer" class="dialog-footer">
  252. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  253. <el-button @click="upload.open = false">取 消</el-button>
  254. </div>
  255. </el-dialog>
  256. <el-dialog title="申请单详情" :visible.sync="detail.open" width="50%" append-to-body>
  257. <el-descriptions :column="2" border size="medium">
  258. <el-descriptions-item label="安全阀位号" :label-style="labelStyle">{{ this.detail.data.devNo }}
  259. </el-descriptions-item>
  260. <el-descriptions-item label="单元" :label-style="labelStyle">{{ this.detail.data.unit }}</el-descriptions-item>
  261. <el-descriptions-item label="离线原因" :span="2">{{ this.detail.data.offlineReason }}</el-descriptions-item>
  262. <el-descriptions-item label="状态" :label-style="labelStyle">
  263. <el-tag size="small" :type="statusFlag">{{ status[this.detail.data.status] }}</el-tag>
  264. </el-descriptions-item>
  265. <el-descriptions-item label="申请状态">
  266. <el-tag size="small" :type="approveStatusFlag">{{ approveStatus[this.detail.data.approveStatus] }}</el-tag>
  267. </el-descriptions-item>
  268. <el-descriptions-item label="安全评估以及临时措施执行" :span="2" :label-style="labelStyle">
  269. {{ this.detail.data.safa }}
  270. </el-descriptions-item>
  271. <el-descriptions-item label="安全阀锁开是否拆解" :span="2" :label-style="labelStyle">
  272. {{ this.detail.data.disassembly }}
  273. </el-descriptions-item>
  274. <el-descriptions-item label="临时措施执行人" :label-style="labelStyle">
  275. {{ this.detail.data.executorName }}
  276. </el-descriptions-item>
  277. <el-descriptions-item label="临时措施执行时间" :label-style="labelStyle">
  278. <template>
  279. <span>{{ parseTime(this.detail.data.executionTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  280. </template>
  281. </el-descriptions-item>
  282. <el-descriptions-item label="临时措施确认人" :label-style="labelStyle">
  283. {{ this.detail.data.confirmerName }}
  284. </el-descriptions-item>
  285. <el-descriptions-item label="临时措施确认时间" :label-style="labelStyle">
  286. <template>
  287. <span>{{ parseTime(this.detail.data.temporaryTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  288. </template>
  289. </el-descriptions-item>
  290. <el-descriptions-item label="申请人" :label-style="labelStyle">
  291. {{ this.detail.data.applicantName }}
  292. </el-descriptions-item>
  293. <el-descriptions-item label="申请时间" :label-style="labelStyle">
  294. <template>
  295. <span>{{ parseTime(this.detail.data.applicationTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  296. </template>
  297. </el-descriptions-item>
  298. <el-descriptions-item label="批准人" :label-style="labelStyle">
  299. {{ this.detail.data.approverName }}
  300. </el-descriptions-item>
  301. <el-descriptions-item label="批准时间" :label-style="labelStyle">
  302. <template>
  303. <span>{{ parseTime(this.detail.data.approveTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  304. </template>
  305. </el-descriptions-item>
  306. <el-descriptions-item label="离线安全阀是否已经复位" :label-style="labelStyle">
  307. {{ this.detail.data.resetConfirm }}
  308. </el-descriptions-item>
  309. <el-descriptions-item label="离线安全阀复位后现场是否存在泄漏" :label-style="labelStyle">
  310. {{ this.detail.data.leakConfirm }}
  311. </el-descriptions-item>
  312. <el-descriptions-item label="离线安全复位后,之前采取的安全措施是否已撤销" :label-style="labelStyle">
  313. {{ this.detail.data.revokeConfirm }}
  314. </el-descriptions-item>
  315. <el-descriptions-item label="离线安全复位后,是否已经重新上锁" :label-style="labelStyle">
  316. {{ this.detail.data.lockConfirm }}
  317. </el-descriptions-item>
  318. <el-descriptions-item label="确认上锁人员" :label-style="labelStyle" :span="2">
  319. {{ this.detail.data.lockConfirmer1Name }} {{ this.detail.data.lockConfirmer2Name }}
  320. </el-descriptions-item>
  321. <el-descriptions-item label="上述信息确认人" :label-style="labelStyle">
  322. {{ this.detail.data.infoConfirmerName }}
  323. </el-descriptions-item>
  324. <el-descriptions-item label="确认时间" :label-style="labelStyle">
  325. {{ this.detail.data.confirmTime }}
  326. </el-descriptions-item>
  327. <el-descriptions-item label="备注" :span="2" :label-style="labelStyle">
  328. {{ this.detail.data.remarks }}
  329. </el-descriptions-item>
  330. </el-descriptions>
  331. </el-dialog>
  332. <offlinevalve-detail v-if="offlinevalveDetailVisible" ref="offlinevalveDetail"></offlinevalve-detail>
  333. </div>
  334. </template>
  335. <script>
  336. import {
  337. listOfflinevalve,
  338. getOfflinevalve,
  339. delOfflinevalve,
  340. addOfflinevalve,
  341. updateOfflinevalve,
  342. exportOfflinevalve,
  343. importTemplate
  344. } from "@/api/apply/offlinevalve";
  345. import {treeselect} from "@/api/system/dept";
  346. import {getToken} from "@/utils/auth";
  347. import Treeselect from "@riophae/vue-treeselect";
  348. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  349. import {allSafetyvavle} from "@/api/reliability/safetyvavle";
  350. import {listPostUser} from "@/api/system/user";
  351. import OfflinevalveDetail from "@/views/approve/approveDetail/offlinevalve-detail";
  352. export default {
  353. name: "Offlinevalve",
  354. components: {OfflinevalveDetail, Treeselect},
  355. data() {
  356. return {
  357. offlinevalveDetailVisible:false,
  358. executorList:[],
  359. confirmerList:[],
  360. status: {0: "未完成", 1: "已完成"},
  361. approveStatus: {1: "申请中", 2: "已通过", 3: "已拒绝"},
  362. statusFlag: '',
  363. approveStatusFlag: '',
  364. //label样式
  365. labelStyle: {'width': '200px'},
  366. // 遮罩层
  367. loading: true,
  368. // 选中数组
  369. ids: [],
  370. // 非单个禁用
  371. single: true,
  372. // 非多个禁用
  373. multiple: true,
  374. // 显示搜索条件
  375. showSearch: false,
  376. // 总条数
  377. total: 0,
  378. // 安全阀离线切出申请表格数据
  379. offlinevalveList: [],
  380. // 安全阀清单
  381. safetyvavleList: [],
  382. // 字典
  383. unitOptions: [],
  384. statusList: [],
  385. approveStatusList: [],
  386. // 弹出层标题
  387. title: "",
  388. // 部门树选项
  389. deptOptions: undefined,
  390. clientHeight: 300,
  391. // 是否显示弹出层
  392. open: false,
  393. // 用户导入参数
  394. upload: {
  395. // 是否显示弹出层(用户导入)
  396. open: false,
  397. // 弹出层标题(用户导入)
  398. title: "",
  399. // 是否禁用上传
  400. isUploading: false,
  401. // 是否更新已经存在的用户数据
  402. updateSupport: 0,
  403. // 设置上传的请求头部
  404. headers: {Authorization: "Bearer " + getToken()},
  405. // 上传的地址
  406. url: process.env.VUE_APP_BASE_API + "/apply/offlinevalve/importData"
  407. },
  408. // 详情对象
  409. detail: {
  410. open: false,
  411. data: {}
  412. },
  413. // 查询参数
  414. queryParams: {
  415. pageNum: 1,
  416. pageSize: 20,
  417. devNo: null,
  418. unit: null,
  419. offlineReason: null,
  420. safa: null,
  421. disassembly: null,
  422. executor: null,
  423. confirmer: null,
  424. applicant: null,
  425. applicationTime: null,
  426. approver: null,
  427. approveTime: null,
  428. resetConfirm: null,
  429. leakConfirm: null,
  430. revokeConfirm: null,
  431. lockConfirm: null,
  432. lockConfirmer1: null,
  433. lockConfirmer2: null,
  434. infoConfirmer: null,
  435. confirmTime: null,
  436. remarks: null,
  437. temporaryTime: null,
  438. executionTime: null,
  439. status: null,
  440. createrCode: null,
  441. createdate: null,
  442. updaterCode: null,
  443. updatedate: null,
  444. deptId: null,
  445. approveStatus: null,
  446. lockConfirmer1Name: null,
  447. lockConfirmer2Name: null,
  448. infoConfirmerName: null,
  449. executorName: null,
  450. confirmerName: null,
  451. approverName: null,
  452. applicantName: null
  453. },
  454. // 表单参数
  455. form: {},
  456. // 表单校验
  457. rules: {
  458. devNo: [
  459. {required: true, message: "请选择或输入安全阀位号", trigger: "blur"}
  460. ],
  461. unit: [
  462. {required: true, message: "请选择单元", trigger: "blur"}
  463. ],
  464. offlineReason: [
  465. {required: true, message: "请输入离线原因", trigger: "blur"}
  466. ],
  467. executor: [
  468. {required: true, message: "请选择临时措施执行人", trigger: "blur"}
  469. ],
  470. confirmer: [
  471. {required: true, message: "请选择临时措施确认人", trigger: "blur"}
  472. ],
  473. }
  474. };
  475. },
  476. watch: {
  477. // 根据名称筛选部门树
  478. deptName(val) {
  479. this.$refs.tree.filter(val);
  480. }
  481. },
  482. created() {
  483. //设置表格高度对应屏幕高度
  484. this.$nextTick(() => {
  485. this.clientHeight = document.body.clientHeight - 250
  486. })
  487. this.getList();
  488. this.getTreeselect();
  489. allSafetyvavle().then(res => {
  490. this.safetyvavleList = res.data
  491. });
  492. this.getDicts("UNIT").then(response => {
  493. this.unitOptions = response.data;
  494. });
  495. this.getDicts("apply_status").then(response => {
  496. this.statusList = response.data;
  497. });
  498. this.getDicts("apply_approve_status").then(response => {
  499. this.approveStatusList = response.data;
  500. });
  501. listPostUser({
  502. // postCode: 'gyzj'
  503. }).then(response => {
  504. this.executorList = response;
  505. this.confirmerList = response;
  506. });
  507. },
  508. methods: {
  509. openApproveDetail(row) {
  510. this.offlinevalveDetailVisible = true
  511. this.$nextTick(() => {
  512. this.$refs.offlinevalveDetail.init(row.id, '',row.processId,'')
  513. })
  514. },
  515. // 字典翻译
  516. statusFormat(row, column) {
  517. let s = this.selectDictLabel(this.statusList, row.status);
  518. let type = '';
  519. if (row.status === 1) {
  520. type = 'success';
  521. }
  522. return <el-tag type={type}>{s}</el-tag>;
  523. },
  524. // 字典翻译
  525. approveStatusFormat(row, column) {
  526. let s = this.selectDictLabel(this.approveStatusList, row.approveStatus)
  527. let type = '';
  528. if (row.approveStatus === '2') {
  529. type = 'success';
  530. } else if (row.approveStatus === '1') {
  531. type = 'warning';
  532. } else if (row.approveStatus === '3') {
  533. type = 'danger';
  534. }
  535. return <el-tag type={type}>{s}</el-tag>;
  536. },
  537. getExecutorName(userId){
  538. for (let item of this.executorList) {
  539. if (userId===item.userId){
  540. this.form.executorName=item.nickName;
  541. break;
  542. }
  543. }
  544. console.log(this.form.executorName)
  545. },
  546. getConfirmerName(userId){
  547. for (const item of this.confirmerList) {
  548. if (userId===item.userId){
  549. this.form.confirmerName=item.nickName;
  550. break;
  551. }
  552. }
  553. console.log(this.form.confirmerName)
  554. },
  555. openDetail(row) {
  556. this.statusFlag = '';
  557. this.approveStatusFlag = '';
  558. this.detail.open = true;
  559. this.detail.data = row;
  560. if (row.status === 1) {
  561. this.statusFlag = 'success';
  562. }
  563. if (row.approveStatus === '2') {
  564. this.approveStatusFlag = 'success';
  565. } else if (row.approveStatus === '1') {
  566. this.approveStatusFlag = 'warning';
  567. } else if (row.approveStatus === '3') {
  568. this.approveStatusFlag = 'danger';
  569. }
  570. },
  571. /** 查询安全阀离线切出申请列表 */
  572. getList() {
  573. this.loading = true;
  574. listOfflinevalve(this.queryParams).then(response => {
  575. this.offlinevalveList = response.rows;
  576. this.total = response.total;
  577. this.loading = false;
  578. });
  579. },
  580. /** 查询部门下拉树结构 */
  581. getTreeselect() {
  582. treeselect().then(response => {
  583. this.deptOptions = response.data;
  584. });
  585. },
  586. // 取消按钮
  587. cancel() {
  588. this.open = false;
  589. this.reset();
  590. },
  591. // 表单重置
  592. reset() {
  593. this.form = {
  594. id: null,
  595. devNo: null,
  596. unit: null,
  597. offlineReason: null,
  598. safa: null,
  599. disassembly: null,
  600. executor: null,
  601. confirmer: null,
  602. applicant: null,
  603. applicationTime: null,
  604. approver: null,
  605. approveTime: null,
  606. resetConfirm: null,
  607. leakConfirm: null,
  608. revokeConfirm: null,
  609. lockConfirm: null,
  610. lockConfirmer1: null,
  611. lockConfirmer2: null,
  612. infoConfirmer: null,
  613. confirmTime: null,
  614. remarks: null,
  615. temporaryTime: null,
  616. executionTime: null,
  617. status: 0,
  618. delFlag: null,
  619. createrCode: null,
  620. createdate: null,
  621. updaterCode: null,
  622. updatedate: null,
  623. deptId: null,
  624. approveStatus: "1",
  625. lockConfirmer1Name: null,
  626. lockConfirmer2Name: null,
  627. infoConfirmerName: null,
  628. executorName: null,
  629. confirmerName: null,
  630. approverName: null,
  631. applicantName: null
  632. };
  633. this.resetForm("form");
  634. },
  635. /** 搜索按钮操作 */
  636. handleQuery() {
  637. this.queryParams.pageNum = 1;
  638. this.getList();
  639. },
  640. /** 重置按钮操作 */
  641. resetQuery() {
  642. this.resetForm("queryForm");
  643. this.handleQuery();
  644. },
  645. // 多选框选中数据
  646. handleSelectionChange(selection) {
  647. this.ids = selection.map(item => item.id)
  648. this.single = selection.length !== 1
  649. this.multiple = !selection.length
  650. },
  651. /** 新增按钮操作 */
  652. handleAdd() {
  653. this.reset();
  654. this.open = true;
  655. this.title = "添加安全阀离线切出申请表";
  656. },
  657. /** 修改按钮操作 */
  658. handleUpdate(row) {
  659. this.reset();
  660. const id = row.id || this.ids
  661. getOfflinevalve(id).then(response => {
  662. this.form = response.data;
  663. this.open = true;
  664. this.title = "修改安全阀离线切出申请表";
  665. });
  666. },
  667. /** 提交按钮 */
  668. submitForm() {
  669. this.$refs["form"].validate(valid => {
  670. if (valid) {
  671. if (this.form.id != null) {
  672. updateOfflinevalve(this.form).then(response => {
  673. this.msgSuccess("修改成功");
  674. this.open = false;
  675. this.getList();
  676. });
  677. } else {
  678. addOfflinevalve(this.form).then(response => {
  679. this.msgSuccess("新增成功");
  680. this.open = false;
  681. this.getList();
  682. });
  683. }
  684. }
  685. });
  686. },
  687. /** 删除按钮操作 */
  688. handleDelete(row) {
  689. const ids = row.id || this.ids;
  690. this.$confirm('是否确认删除?', "警告", {
  691. confirmButtonText: "确定",
  692. cancelButtonText: "取消",
  693. type: "warning"
  694. }).then(function () {
  695. return delOfflinevalve(ids);
  696. }).then(() => {
  697. this.getList();
  698. this.msgSuccess("删除成功");
  699. })
  700. },
  701. /** 导出按钮操作 */
  702. handleExport() {
  703. const queryParams = this.queryParams;
  704. this.$confirm('是否确认导出所有安全阀离线切出申请表数据项?', "警告", {
  705. confirmButtonText: "确定",
  706. cancelButtonText: "取消",
  707. type: "warning"
  708. }).then(function () {
  709. return exportOfflinevalve(queryParams);
  710. }).then(response => {
  711. this.download(response.msg);
  712. })
  713. },
  714. /** 导入按钮操作 */
  715. handleImport() {
  716. this.upload.title = "用户导入";
  717. this.upload.open = true;
  718. },
  719. /** 下载模板操作 */
  720. importTemplate() {
  721. importTemplate().then(response => {
  722. this.download(response.msg);
  723. });
  724. },
  725. // 文件上传中处理
  726. handleFileUploadProgress(event, file, fileList) {
  727. this.upload.isUploading = true;
  728. },
  729. // 文件上传成功处理
  730. handleFileSuccess(response, file, fileList) {
  731. this.upload.open = false;
  732. this.upload.isUploading = false;
  733. this.$refs.upload.clearFiles();
  734. this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
  735. this.getList();
  736. },
  737. // 提交上传文件
  738. submitFileForm() {
  739. this.$refs.upload.submit();
  740. }
  741. }
  742. };
  743. </script>