index.vue 24 KB

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