coil.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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="recordTime">
  5. <el-date-picker
  6. v-model="queryParams.recordTime"
  7. type="month"
  8. value-format="yyyy-MM"
  9. placeholder="选择巡检日期"
  10. :clearable="false">
  11. </el-date-picker>
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-table v-loading="loading" :data="temperatureList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  19. <el-table-column label="巡检日期" align="center" prop="recordTime" width="100">
  20. <template slot-scope="scope">
  21. <span>{{ parseTime(scope.row.recordTime, '{y}-{m}-{d}') }}</span>
  22. </template>
  23. </el-table-column>
  24. <el-table-column label="H109 OUT" align="center" prop="h109Out" :show-overflow-tooltip="true">
  25. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  26. <template slot-scope="scope">
  27. <span v-if="scope.row.h109Out[index]>=1080" style="color:red;">{{scope.row.h109Out[index]}}</span>
  28. <span v-if="scope.row.h109Out[index]<1080">{{scope.row.h109Out[index]}}</span>
  29. </template>
  30. </el-table-column>
  31. </el-table-column>
  32. <el-table-column label="H110 OUT" align="center" prop="h110Out" :show-overflow-tooltip="true">
  33. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  34. <template slot-scope="scope">
  35. <span v-if="scope.row.h110Out[index]>=1080" style="color:red;">{{scope.row.h110Out[index]}}</span>
  36. <span v-if="scope.row.h110Out[index]<1080">{{scope.row.h110Out[index]}}</span>
  37. </template>
  38. </el-table-column>
  39. </el-table-column>
  40. <el-table-column label="H111 OUT" align="center" prop="h111Out" :show-overflow-tooltip="true">
  41. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  42. <template slot-scope="scope">
  43. <span v-if="scope.row.h111Out[index]>=1080" style="color:red;">{{scope.row.h111Out[index]}}</span>
  44. <span v-if="scope.row.h111Out[index]<1080">{{scope.row.h111Out[index]}}</span>
  45. </template>
  46. </el-table-column>
  47. </el-table-column>
  48. <el-table-column label="H112 OUT" align="center" prop="h112Out" :show-overflow-tooltip="true">
  49. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  50. <template slot-scope="scope">
  51. <span v-if="scope.row.h112Out[index]>=1080" style="color:red;">{{scope.row.h112Out[index]}}</span>
  52. <span v-if="scope.row.h112Out[index]<1080">{{scope.row.h112Out[index]}}</span>
  53. </template>
  54. </el-table-column>
  55. </el-table-column>
  56. <el-table-column label="H113 OUT" align="center" prop="h113Out" :show-overflow-tooltip="true">
  57. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  58. <template slot-scope="scope">
  59. <span v-if="scope.row.h113Out[index]>=1080" style="color:red;">{{scope.row.h113Out[index]}}</span>
  60. <span v-if="scope.row.h113Out[index]<1080">{{scope.row.h113Out[index]}}</span>
  61. </template>
  62. </el-table-column>
  63. </el-table-column>
  64. <el-table-column label="H114 OUT" align="center" prop="h114Out" :show-overflow-tooltip="true">
  65. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  66. <template slot-scope="scope">
  67. <span v-if="scope.row.h114Out[index]>=1080" style="color:red;">{{scope.row.h114Out[index]}}</span>
  68. <span v-if="scope.row.h114Out[index]<1080">{{scope.row.h114Out[index]}}</span>
  69. </template>
  70. </el-table-column>
  71. </el-table-column>
  72. <el-table-column label="H115 OUT" align="center" prop="h115Out" :show-overflow-tooltip="true">
  73. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  74. <template slot-scope="scope">
  75. <span v-if="scope.row.h115Out[index]>=1080" style="color:red;">{{scope.row.h115Out[index]}}</span>
  76. <span v-if="scope.row.h115Out[index]<1080">{{scope.row.h115Out[index]}}</span>
  77. </template>
  78. </el-table-column>
  79. </el-table-column>
  80. <el-table-column label="H116 OUT" align="center" prop="h116Out" :show-overflow-tooltip="true">
  81. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  82. <template slot-scope="scope">
  83. <span v-if="scope.row.h116Out[index]>=1080" style="color:red;">{{scope.row.h116Out[index]}}</span>
  84. <span v-if="scope.row.h116Out[index]<1080">{{scope.row.h116Out[index]}}</span>
  85. </template>
  86. </el-table-column>
  87. </el-table-column>
  88. <el-table-column label="H117 OUT" align="center" prop="h117Out" :show-overflow-tooltip="true">
  89. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.h117Out[index]>=1080" style="color:red;">{{scope.row.h117Out[index]}}</span>
  92. <span v-if="scope.row.h117Out[index]<1080">{{scope.row.h117Out[index]}}</span>
  93. </template>
  94. </el-table-column>
  95. </el-table-column>
  96. <el-table-column label="H118 OUT" align="center" prop="h118Out" :show-overflow-tooltip="true">
  97. <el-table-column v-for="(item,index) in 8" :label="'PASS '+(index+1).toString()" align="center" width="80">
  98. <template slot-scope="scope">
  99. <span v-if="scope.row.h118Out[index]>=1080" style="color:red;">{{scope.row.h118Out[index]}}</span>
  100. <span v-if="scope.row.h118Out[index]<1080">{{scope.row.h118Out[index]}}</span>
  101. </template>
  102. </el-table-column>
  103. </el-table-column>
  104. <el-table-column label="H130 OUT" align="center" prop="h130Out" :show-overflow-tooltip="true">
  105. <el-table-column v-for="(item,index) in 12" :label="'PASS '+(index+1).toString()" align="center" width="80">
  106. <template slot-scope="scope">
  107. <span v-if="scope.row.h130Out[index]>=1080" style="color:red;">{{scope.row.h130Out[index]}}</span>
  108. <span v-if="scope.row.h130Out[index]<1080">{{scope.row.h130Out[index]}}</span>
  109. </template>
  110. </el-table-column>
  111. </el-table-column>
  112. </el-table>
  113. </div>
  114. </template>
  115. <script>
  116. import { listCoil } from "@/api/production/temperature";
  117. import { treeselect } from "@/api/system/dept";
  118. import { getToken } from "@/utils/auth";
  119. import Treeselect from "@riophae/vue-treeselect";
  120. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  121. export default {
  122. name: "Temperature",
  123. components: { Treeselect },
  124. data() {
  125. return {
  126. // 遮罩层
  127. loading: true,
  128. // 选中数组
  129. ids: [],
  130. // 非单个禁用
  131. single: true,
  132. // 非多个禁用
  133. multiple: true,
  134. // 显示搜索条件
  135. showSearch: true,
  136. // 总条数
  137. total: 0,
  138. // 裂解炉炉管测温表格数据
  139. temperatureList: [],
  140. // 弹出层标题
  141. title: "",
  142. // 部门树选项
  143. deptOptions: undefined,
  144. clientHeight:300,
  145. // 是否显示弹出层
  146. open: false,
  147. // 用户导入参数
  148. upload: {
  149. // 是否显示弹出层(用户导入)
  150. open: false,
  151. // 弹出层标题(用户导入)
  152. title: "",
  153. // 是否禁用上传
  154. isUploading: false,
  155. // 是否更新已经存在的用户数据
  156. updateSupport: 0,
  157. // 设置上传的请求头部
  158. headers: { Authorization: "Bearer " + getToken() },
  159. // 上传的地址
  160. url: process.env.VUE_APP_BASE_API + "/production/temperature/importData"
  161. },
  162. // 查询参数
  163. queryParams: {
  164. pageNum: 1,
  165. pageSize: 20,
  166. furnanceName: null,
  167. recordTime: null,
  168. pass1: null,
  169. pass2: null,
  170. pass3: null,
  171. pass4: null,
  172. pass5: null,
  173. pass6: null,
  174. pass7: null,
  175. pass8: null,
  176. pass9: null,
  177. pass10: null,
  178. pass11: null,
  179. pass12: null,
  180. pass13: null,
  181. pass14: null,
  182. pass15: null,
  183. pass16: null,
  184. deptId: null,
  185. },
  186. recordTime: null,
  187. // 表单参数
  188. form: {},
  189. h109Out:[],
  190. h110Out:[],
  191. h111Out:[],
  192. h112Out:[],
  193. h113Out:[],
  194. h114Out:[],
  195. h115Out:[],
  196. h116Out:[],
  197. h117Out:[],
  198. h118Out:[],
  199. h130Out:[],
  200. // 表单校验
  201. rules: {
  202. id: [
  203. { required: true, message: "主键id不能为空", trigger: "blur" }
  204. ],
  205. }
  206. };
  207. },
  208. watch: {
  209. // 根据名称筛选部门树
  210. deptName(val) {
  211. this.$refs.tree.filter(val);
  212. }
  213. },
  214. created() {
  215. //设置表格高度对应屏幕高度
  216. this.$nextTick(() => {
  217. this.clientHeight = document.body.clientHeight -250
  218. })
  219. // this.getList();
  220. // this.getTreeselect();
  221. },
  222. methods: {
  223. init() {
  224. let date = new Date();
  225. this.queryParams.recordTime = date.getFullYear() + "-" + Number(date.getMonth() + 1);
  226. this.getList();
  227. },
  228. /** 查询裂解炉炉管测温列表 */
  229. getList() {
  230. this.loading = true;
  231. listCoil(this.queryParams).then(response => {
  232. if (response.msg == "incompleteData") {
  233. this.msgInfo("巡检数据录入不完整,暂时无法生成此表格。");
  234. this.temperatureList = [];
  235. } else {
  236. for (let i = 0; i< response.data.length; i++) {
  237. if (response.data[i].h109Out == null) { response.data[i].h109Out = []; } else { response.data[i].h109Out = response.data[i].h109Out.split(','); }
  238. if (response.data[i].h110Out == null) { response.data[i].h110Out = []; } else { response.data[i].h110Out = response.data[i].h110Out.split(','); }
  239. if (response.data[i].h111Out == null) { response.data[i].h111Out = []; } else { response.data[i].h111Out = response.data[i].h111Out.split(','); }
  240. if (response.data[i].h112Out == null) { response.data[i].h112Out = []; } else { response.data[i].h112Out = response.data[i].h112Out.split(','); }
  241. if (response.data[i].h113Out == null) { response.data[i].h113Out = []; } else { response.data[i].h113Out = response.data[i].h113Out.split(','); }
  242. if (response.data[i].h114Out == null) { response.data[i].h114Out = []; } else { response.data[i].h114Out = response.data[i].h114Out.split(','); }
  243. if (response.data[i].h115Out == null) { response.data[i].h115Out = []; } else { response.data[i].h115Out = response.data[i].h115Out.split(','); }
  244. if (response.data[i].h116Out == null) { response.data[i].h116Out = []; } else { response.data[i].h116Out = response.data[i].h116Out.split(','); }
  245. if (response.data[i].h117Out == null) { response.data[i].h117Out = []; } else { response.data[i].h117Out = response.data[i].h117Out.split(','); }
  246. if (response.data[i].h118Out == null) { response.data[i].h118Out = []; } else { response.data[i].h118Out = response.data[i].h118Out.split(','); }
  247. if (response.data[i].h130Out == null) { response.data[i].h130Out = []; } else { response.data[i].h130Out = response.data[i].h130Out.split(','); }
  248. }
  249. this.temperatureList = response.data;
  250. }
  251. this.loading = false;
  252. });
  253. },
  254. /** 查询部门下拉树结构 */
  255. getTreeselect() {
  256. treeselect().then(response => {
  257. this.deptOptions = response.data;
  258. });
  259. },
  260. // 取消按钮
  261. cancel() {
  262. this.open = false;
  263. this.reset();
  264. },
  265. // 表单重置
  266. reset() {
  267. this.form = {
  268. id: null,
  269. furnanceName: null,
  270. recordTime: null,
  271. pass1: null,
  272. pass2: null,
  273. pass3: null,
  274. pass4: null,
  275. pass5: null,
  276. pass6: null,
  277. pass7: null,
  278. pass8: null,
  279. pass9: null,
  280. pass10: null,
  281. pass11: null,
  282. pass12: null,
  283. pass13: null,
  284. pass14: null,
  285. pass15: null,
  286. pass16: null,
  287. deptId: null,
  288. delFlag: null,
  289. createBy: null,
  290. createTime: null,
  291. updateBy: null,
  292. updateTime: null,
  293. };
  294. this.pass1 = [];
  295. this.pass2 = [];
  296. this.pass3 = [];
  297. this.pass4 = [];
  298. this.pass5 = [];
  299. this.pass6 = [];
  300. this.pass7 = [];
  301. this.pass8 = [];
  302. this.pass9 = [];
  303. this.pass10 = [];
  304. this.pass11 = [];
  305. this.pass12 = [];
  306. this.pass13 = [];
  307. this.pass14 = [];
  308. this.pass15 = [];
  309. this.pass16 = [];
  310. this.resetForm("form");
  311. },
  312. /** 搜索按钮操作 */
  313. handleQuery() {
  314. this.queryParams.pageNum = 1;
  315. this.getList();
  316. },
  317. /** 重置按钮操作 */
  318. resetQuery() {
  319. this.resetForm("queryForm");
  320. this.handleQuery();
  321. },
  322. // 多选框选中数据
  323. handleSelectionChange(selection) {
  324. this.ids = selection.map(item => item.id)
  325. this.single = selection.length!==1
  326. this.multiple = !selection.length
  327. },
  328. /** 新增按钮操作 */
  329. handleAdd() {
  330. this.reset();
  331. this.form.furnanceName = "H130";
  332. this.open = true;
  333. this.title = "添加裂解炉炉管测温";
  334. },
  335. /** 修改按钮操作 */
  336. handleUpdate(row) {
  337. this.reset();
  338. const id = row.id || this.ids
  339. getTemperature(id).then(response => {
  340. this.form = response.data;
  341. if (response.data.pass1 == null) { this.pass1 = []; } else { this.pass1 = response.data.pass1.split(','); }
  342. if (response.data.pass2 == null) { this.pass2 = []; } else { this.pass2 = response.data.pass2.split(','); }
  343. if (response.data.pass3 == null) { this.pass3 = []; } else { this.pass3 = response.data.pass3.split(','); }
  344. if (response.data.pass4 == null) { this.pass4 = []; } else { this.pass4 = response.data.pass4.split(','); }
  345. if (response.data.pass5 == null) { this.pass5 = []; } else { this.pass5 = response.data.pass5.split(','); }
  346. if (response.data.pass6 == null) { this.pass6 = []; } else { this.pass6 = response.data.pass6.split(','); }
  347. if (response.data.pass7 == null) { this.pass7 = []; } else { this.pass7 = response.data.pass7.split(','); }
  348. if (response.data.pass8 == null) { this.pass8 = []; } else { this.pass8 = response.data.pass8.split(','); }
  349. if (response.data.pass9 == null) { this.pass9 = []; } else { this.pass9 = response.data.pass9.split(','); }
  350. if (response.data.pass10 == null) { this.pass10 = []; } else { this.pass10 = response.data.pass10.split(','); }
  351. if (response.data.pass11 == null) { this.pass11 = []; } else { this.pass11 = response.data.pass11.split(','); }
  352. if (response.data.pass12 == null) { this.pass12 = []; } else { this.pass12 = response.data.pass12.split(','); }
  353. this.open = true;
  354. this.title = "修改裂解炉炉管测温";
  355. });
  356. },
  357. /** 提交按钮 */
  358. submitForm() {
  359. this.form.pass1 = this.pass1.join(",");
  360. this.form.pass2 = this.pass2.join(",");
  361. this.form.pass3 = this.pass3.join(",");
  362. this.form.pass4 = this.pass4.join(",");
  363. this.form.pass5 = this.pass5.join(",");
  364. this.form.pass6 = this.pass6.join(",");
  365. this.form.pass7 = this.pass7.join(",");
  366. this.form.pass8 = this.pass8.join(",");
  367. this.form.pass9 = this.pass9.join(",");
  368. this.form.pass10 = this.pass10.join(",");
  369. this.form.pass11 = this.pass11.join(",");
  370. this.form.pass12 = this.pass12.join(",");
  371. this.form.pass13 = this.pass13.join(",");
  372. this.form.pass14 = this.pass14.join(",");
  373. this.form.pass15 = this.pass15.join(",");
  374. this.form.pass16 = this.pass16.join(",");
  375. this.$refs["form"].validate(valid => {
  376. if (valid) {
  377. if (this.form.id != null) {
  378. updateTemperature(this.form).then(response => {
  379. this.msgSuccess("修改成功");
  380. this.open = false;
  381. this.getList();
  382. });
  383. } else {
  384. addTemperature(this.form).then(response => {
  385. this.msgSuccess("新增成功");
  386. this.open = false;
  387. this.getList();
  388. });
  389. }
  390. }
  391. });
  392. },
  393. /** 删除按钮操作 */
  394. handleDelete(row) {
  395. const ids = row.id || this.ids;
  396. this.$confirm('是否确认删除?', "警告", {
  397. confirmButtonText: "确定",
  398. cancelButtonText: "取消",
  399. type: "warning"
  400. }).then(function() {
  401. return delTemperature(ids);
  402. }).then(() => {
  403. this.getList();
  404. this.msgSuccess("删除成功");
  405. })
  406. },
  407. /** 导出按钮操作 */
  408. handleExport() {
  409. const queryParams = this.queryParams;
  410. this.$confirm('是否确认导出所有裂解炉炉管测温数据项?', "警告", {
  411. confirmButtonText: "确定",
  412. cancelButtonText: "取消",
  413. type: "warning"
  414. }).then(function() {
  415. return exportTemperature(queryParams);
  416. }).then(response => {
  417. this.download(response.msg);
  418. })
  419. },
  420. /** 导入按钮操作 */
  421. handleImport() {
  422. this.upload.title = "用户导入";
  423. this.upload.open = true;
  424. },
  425. /** 下载模板操作 */
  426. importTemplate() {
  427. importTemplate().then(response => {
  428. this.download(response.msg);
  429. });
  430. },
  431. // 文件上传中处理
  432. handleFileUploadProgress(event, file, fileList) {
  433. this.upload.isUploading = true;
  434. },
  435. // 文件上传成功处理
  436. handleFileSuccess(response, file, fileList) {
  437. this.upload.open = false;
  438. this.upload.isUploading = false;
  439. this.$refs.upload.clearFiles();
  440. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  441. this.getList();
  442. },
  443. // 提交上传文件
  444. submitFileForm() {
  445. this.$refs.upload.submit();
  446. }
  447. }
  448. };
  449. </script>