repairEnter.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template xmlns="http://www.w3.org/1999/html">
  2. <div class="checkTable">
  3. <el-dialog :visible.sync="dialog.dialogFormVisible" width="1800px" :close-on-click-modal="false"
  4. title='维修点清单'>
  5. <el-row>
  6. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
  7. <el-form-item label="装置" prop="plantId">
  8. <el-select v-model="queryParams.plantId" @change="handleQuery"
  9. placeholder="请选择装置" clearable size="small" disabled>
  10. <el-option
  11. v-for="plant in plantOperation"
  12. :key="plant.plantId"
  13. :label="plant.plantName"
  14. :value="plant.plantId"
  15. />
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="群组编码" prop="groupCode">
  19. <el-input
  20. v-model="queryParams.groupCode"
  21. placeholder="请输入群组编码"
  22. clearable
  23. @keyup.enter.native="handleQuery"
  24. />
  25. </el-form-item>
  26. <el-form-item label="密封点类型" prop="pointType" label-width="90px">
  27. <el-select v-model="queryParams.pointType" @change="handleQuery" placeholder="请选择密封点类型" clearable
  28. size="small">
  29. <el-option
  30. v-for="dict in pointOptions"
  31. :key="dict.dictValue"
  32. :label="dict.dictLabel"
  33. :value="dict.dictValue"
  34. />
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item>
  38. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  39. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  40. </el-form-item>
  41. </el-form>
  42. </el-row>
  43. <el-row :gutter="10" class="mb8">
  44. <el-col :span="1.5">
  45. <el-button
  46. type="warning"
  47. plain
  48. icon="el-icon-download"
  49. size="mini"
  50. @click="handleExport"
  51. v-hasPermi="['check:checkpoints:export']"
  52. >导出维修点清单
  53. </el-button>
  54. </el-col>
  55. <el-col :span="1.5">
  56. <el-button
  57. type="warning"
  58. plain
  59. icon="el-icon-upload"
  60. size="mini"
  61. @click="handleImport"
  62. v-if="isEnter"
  63. v-hasPermi="['check:checkpoints:add']"
  64. >导入维修数据
  65. </el-button>
  66. </el-col>
  67. <el-col :span="1.5">
  68. <el-button
  69. type="info"
  70. plain
  71. icon="el-icon-position"
  72. size="mini"
  73. :disabled="leftMultiple"
  74. @click="handleToApprove"
  75. v-if="isEnter"
  76. >送审
  77. </el-button>
  78. </el-col>
  79. <el-col :span="1.5">
  80. <el-button
  81. type="info"
  82. plain
  83. icon="el-icon-s-check"
  84. size="mini"
  85. :disabled="leftMultiple"
  86. @click="handleApprove"
  87. v-if="isEnter"
  88. v-hasPermi="['task:repair:approve']"
  89. >审核
  90. </el-button>
  91. </el-col>
  92. </el-row>
  93. <el-row>
  94. <el-table :data="leftData" style="width: 100%;" height="500px" border
  95. @selection-change="saveLeft"
  96. ref="leftData" :cell-style="tableCellStyle">
  97. <el-table-column type="selection" align="center" fixed="left"></el-table-column>
  98. <el-table-column label="审核状态" fixed="left" align="center" prop="approveStatus" width="80"
  99. :formatter="approveStatusFormat"/>
  100. <el-table-column label="净检测值" align="center" prop="netTestValue" width="80"/>
  101. <el-table-column label="泄漏程度" align="center" prop="leakageDegree" width="80" :formatter="leakageFormat"/>
  102. <el-table-column label="泄露部位" align="center" prop="leakagePosition" width="130"
  103. :show-overflow-tooltip="true"/>
  104. <el-table-column label="维修方法" align="center" prop="repairFunc" width="130" :show-overflow-tooltip="true"/>
  105. <el-table-column label="维修状态" align="center" prop="repairType" width="130" :show-overflow-tooltip="true"/>
  106. <el-table-column label="维修次数" align="center" prop="repairCount" width="130"
  107. :show-overflow-tooltip="true"/>
  108. <el-table-column label="装置名称" align="center" prop="plantName" width="130" :show-overflow-tooltip="true"/>
  109. <el-table-column label="区域名称" align="center" prop="regionName" width="130" :show-overflow-tooltip="true"/>
  110. <el-table-column label="平台(层)" align="center" prop="layer" width="130" :show-overflow-tooltip="true"/>
  111. <el-table-column label="设备/管线名称" align="center" prop="devName" width="130"
  112. :show-overflow-tooltip="true"/>
  113. <el-table-column label="设备/管线编号" align="center" prop="devCode" width="130"
  114. :show-overflow-tooltip="true"/>
  115. <el-table-column label="群组编码" align="center" prop="groupCode" width="130" :show-overflow-tooltip="true"/>
  116. <el-table-column label="密封点扩展号编码" align="center" prop="extendCode" width="150"
  117. :show-overflow-tooltip="true"/>
  118. <el-table-column label="密封点类型" align="center" prop="pointType" width="130"
  119. :show-overflow-tooltip="true"/>
  120. <el-table-column label="仪器编号" align="center" prop="instrumentCode" width="130"
  121. :show-overflow-tooltip="true"/>
  122. <el-table-column label="维修人员" align="center" prop="repairer" width="130" :show-overflow-tooltip="true"/>
  123. <el-table-column label="维修日期" align="center" prop="repairDate" width="180" :show-overflow-tooltip="true">
  124. <template slot-scope="scope">
  125. <span>{{ parseTime(scope.row.repairDate, '{y}-{m}-{d}') }}</span>
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. <pagination
  130. v-show="leftTotal>0"
  131. :total="leftTotal"
  132. :page.sync="queryParams.pageNum"
  133. :limit.sync="queryParams.pageSize"
  134. @pagination="getList"
  135. />
  136. </el-row>
  137. <div slot="footer" class="dialog-footer" style="text-align: center">
  138. <el-button @click="cancel">返回</el-button>
  139. </div>
  140. </el-dialog>
  141. <!-- 用户导入对话框 -->
  142. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  143. <el-upload
  144. ref="upload"
  145. :limit="1"
  146. accept=".xlsx, .xls"
  147. :headers="upload.headers"
  148. :action="upload.url"
  149. :disabled="upload.isUploading"
  150. :on-progress="handleFileUploadProgress"
  151. :on-success="handleFileSuccess"
  152. :auto-upload="false"
  153. drag
  154. >
  155. <i class="el-icon-upload"></i>
  156. <div class="el-upload__text">
  157. {{ $t('将文件拖到此处,或') }}
  158. <em>{{ $t('点击上传') }}</em>
  159. </div>
  160. <div class="el-upload__tip" slot="tip">
  161. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  162. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  163. </div>
  164. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  165. <input name="type" :value="upload.type" hidden/>
  166. </form>
  167. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  168. </el-upload>
  169. <div slot="footer" class="dialog-footer">
  170. <el-button type="primary" @click="submitFileForm" v-loading.fullscreen.lock="fullscreenLoading">{{
  171. $t('确 定')
  172. }}
  173. </el-button>
  174. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  175. </div>
  176. </el-dialog>
  177. </div>
  178. </template>
  179. <script>
  180. import {getAllPlantName} from "@/api/base/plant";
  181. import {getToken} from "@/utils/auth";
  182. import {approveRepairpoints, listRepairpoints} from "@/api/check/repairpoints";
  183. export default {
  184. name: "repairEnter",
  185. data() {
  186. return {
  187. leftTotal: 0,
  188. checkAgain: false,
  189. fullscreenLoading: false,
  190. // 查询参数
  191. queryParams: {
  192. pageNum: 1,
  193. pageSize: 10,
  194. pointId: null,
  195. repairId: null,
  196. netTestValue: null,
  197. repairFunc: null,
  198. repairType: null,
  199. repairCount: null,
  200. plantName: null,
  201. regionName: null,
  202. layer: null,
  203. devName: null,
  204. devCode: null,
  205. groupCode: null,
  206. extendCode: null,
  207. pointType: null,
  208. instrumentCode: null,
  209. leakagePosition: null,
  210. repairer: null,
  211. repairDate: null,
  212. leakageDegree: null,
  213. remarks: null,
  214. approveStatus: null,
  215. approveTime: null,
  216. deptId: null,
  217. createrCode: null,
  218. createdate: null,
  219. updaterCode: null,
  220. updatedate: null,
  221. plantId: null,
  222. regionId: null,
  223. devId: null,
  224. instrumentId: null,
  225. plantType: null,
  226. mediumType: null,
  227. choose: null,
  228. },
  229. row: {},
  230. leftData: [],
  231. left: [], //左边选中的数据
  232. leftMultiple: true,
  233. approveStatusOperation: [],
  234. dialog: {
  235. dialogFormVisible: false,
  236. },
  237. repairId: 0,
  238. pointOptions: [],
  239. plantOperation: [],
  240. isEnter: false,
  241. // 用户导入参数
  242. upload: {
  243. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  244. //下载模板类型
  245. type: "repairPoint",
  246. // 是否显示弹出层(用户导入)
  247. open: false,
  248. // 弹出层标题(用户导入)
  249. title: "",
  250. // 是否禁用上传
  251. isUploading: false,
  252. // 是否更新已经存在的用户数据
  253. updateSupport: 0,
  254. // 设置上传的请求头部
  255. headers: {Authorization: "Bearer " + getToken()},
  256. // 上传的地址
  257. url: process.env.VUE_APP_BASE_API + "/check/repairpoints/importData/",
  258. },
  259. }
  260. },
  261. methods: {
  262. tableCellStyle({row, column, rowIndex, columnIndex}) {
  263. if (columnIndex === 1 && row.approveStatus == 2) {
  264. return "color:#13C2C2;";
  265. }
  266. if (columnIndex === 1 && row.approveStatus == 1) {
  267. return "color:#0000FF;";
  268. }
  269. if (columnIndex === 1 && row.approveStatus == 0) {
  270. return "color:#ff0000;";
  271. }
  272. if (columnIndex === 3 && row.leakageDegree == 1) {
  273. return "color:#00ff00;font-size:200%";
  274. }
  275. if (columnIndex === 3 && row.leakageDegree == 2) {
  276. return "color:#FFDF00;font-size:200%";
  277. }
  278. if (columnIndex === 3 && row.leakageDegree == 3) {
  279. return "color:#ff0000;font-size:200%";
  280. }
  281. },
  282. leakageFormat(row, column) {
  283. return row.leakageDegree ? "●" : null;
  284. },
  285. approveStatusFormat(row, column) {
  286. return this.selectDictLabel(this.approveStatusOperation, row.approveStatus);
  287. },
  288. // 提交上传文件
  289. submitFileForm() {
  290. this.$refs.upload.submit();
  291. this.fullscreenLoading = true;
  292. },
  293. /** 导入按钮操作 */
  294. handleImport() {
  295. this.upload.title = this.$t('用户导入');
  296. this.upload.open = true;
  297. },
  298. /** 导出按钮操作 */
  299. handleExport() {
  300. this.download('check/repairpoints/export', {
  301. ...this.queryParams
  302. }, `checkpoints_${new Date().getTime()}.xlsx`)
  303. },
  304. /** 下载模板操作 */
  305. importTemplate() {
  306. this.$refs['downloadFileForm'].submit()
  307. },
  308. // 文件上传中处理
  309. handleFileUploadProgress(event, file, fileList) {
  310. this.upload.isUploading = true;
  311. },
  312. // 文件上传成功处理
  313. handleFileSuccess(response, file, fileList) {
  314. this.upload.open = false;
  315. this.upload.isUploading = false;
  316. this.$refs.upload.clearFiles();
  317. this.fullscreenLoading = false;
  318. if (response.data === 0) {
  319. this.$alert(this.$t('导入失败!') + response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  320. } else if (response.data[0] != null) {
  321. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败') + "。", this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  322. } else {
  323. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  324. }
  325. this.getList();
  326. },
  327. /** 重置按钮操作 */
  328. resetQuery() {
  329. this.resetForm("queryForm");
  330. this.handleQuery();
  331. },
  332. pointFormat(row, column) {
  333. return this.selectDictLabel(this.pointOptions, row.pointType);
  334. },
  335. handleQuery() {
  336. this.queryParams.pageNum = 1;
  337. this.getList();
  338. },
  339. cancel() {
  340. this.leftData = [];
  341. this.dialog.dialogFormVisible = false;
  342. },
  343. openDialog(row) {
  344. this.leftData = [];
  345. this.row = row;
  346. this.queryParams.plantId = row.plantId;
  347. this.queryParams.repairId = row.id;
  348. this.upload.url = process.env.VUE_APP_BASE_API + "/check/repairpoints/importData/" + row.id;;
  349. if (row.isEnter && row.status == 1) {
  350. this.isEnter = true;
  351. }
  352. this.dialog.dialogFormVisible = true;
  353. this.checkAgain = row.taskType == 2 ? true : false;
  354. this.getList();
  355. this.getDicts("point_type").then(response => {
  356. this.pointOptions = response.data;
  357. });
  358. getAllPlantName().then(response => {
  359. this.plantOperation = response.data;
  360. })
  361. this.getDicts("base_approve_status").then(response => {
  362. this.approveStatusOperation = response.data;
  363. });
  364. },
  365. /** 查询检测点列表 */
  366. getList() {
  367. listRepairpoints(this.queryParams).then(response => {
  368. this.leftData = response.rows;
  369. this.leftTotal = response.total;
  370. });
  371. },
  372. saveLeft(rows) {
  373. this.left = [];
  374. if (rows) {
  375. this.left = rows.map(row => row.checkId);
  376. this.leftMultiple = !rows.length;
  377. }
  378. },
  379. handleToApprove() {
  380. let data = {};
  381. data.checkIds = this.left;
  382. data.approveStatus = 1;
  383. this.$modal.confirm("是否确认送审?").then(() => {
  384. return approveRepairpoints(data).then(response => {
  385. this.$modal.msgSuccess("送审成功");
  386. this.getList();
  387. }).catch(() => {
  388. this.$modal.msgWarning("送审失败!请确认数据是否填写完整!");
  389. }
  390. )
  391. })
  392. },
  393. handleApprove() {
  394. let data = {};
  395. data.checkIds = this.left;
  396. data.approveStatus = 2;
  397. data.repairCount = 1;
  398. data.repairId = this.row.id;
  399. this.$modal.confirm("确认审核?").then(() => {
  400. return approveRepairpoints(data).then(response => {
  401. this.$modal.msgSuccess("审核成功");
  402. this.getList();
  403. }).catch(() => {
  404. this.$modal.msgWarning("审核失败!请确认数据是否填写完整!");
  405. }
  406. )
  407. })
  408. }
  409. }
  410. }
  411. </script>
  412. <style scoped>
  413. .checkTable .el-scrollbar {
  414. height: 100%;
  415. }
  416. .checkTable ::-webkit-scrollbar {
  417. /* 设置竖向滚动条的宽度 */
  418. width: 10px;
  419. /* 设置横向滚动条的高度 */
  420. height: 10px;
  421. }
  422. .checkTable ::-webkit-scrollbar-thumb {
  423. /*滚动条的背景色*/
  424. background-color: rgba(144, 147, 153, .3);
  425. border-radius: 35px;
  426. }
  427. </style>