index.vue 25 KB

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