index.vue 32 KB

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