From d2e867966539004b6b5a73ae3566a659ac6f8b6d Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 30 十月 2025 11:55:34 +0800
Subject: [PATCH] 检验任务数据分类查询问题修复
---
src/views/CNAS/resourceDemand/device/component/state.vue | 235 ++++++++++++----------------------------------------------
1 files changed, 48 insertions(+), 187 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/state.vue b/src/views/CNAS/resourceDemand/device/component/state.vue
index 9994f65..da08131 100644
--- a/src/views/CNAS/resourceDemand/device/component/state.vue
+++ b/src/views/CNAS/resourceDemand/device/component/state.vue
@@ -2,30 +2,24 @@
<template>
<div>
<div class="search">
- <el-row :gutter="10" style="width: 100%;">
- <el-col :span="20" style="display: flex;flex-wrap: wrap;">
- <div class="search_thing">
- <div class="search_label">娴佺▼缂栧彿锛�</div>
- <div class="search_input">
- <el-input v-model="search.processNumber" clearable placeholder="璇疯緭鍏�" size="small" style="width: 100%"
- @keyup.enter.native="getDeviceStatePage(clickNodeVal.value)"></el-input>
- </div>
- </div>
- <div class="search_thing" style="padding-left: 20px;">
- <el-button size="small" @click="resetSearch">閲� 缃�</el-button>
- <el-button size="small" type="primary" @click="getDeviceStatePage(clickNodeVal.value)">鏌� 璇�</el-button>
- </div>
- </el-col>
- <el-col :span="4">
- <div class="btns">
- <el-button size="small" type="primary" @click="dialogVisible = true">鏂板缓</el-button>
- <el-button :loading="outLoading" size="small" type="primary" @click="handleDown">瀵煎嚭Excel</el-button>
- </div>
- </el-col>
- </el-row>
+ <el-form :model="search" ref="search" size="small" :inline="true">
+ <el-form-item label="娴佺▼缂栧彿">
+ <el-input v-model="search.processNumber" clearable placeholder="璇疯緭鍏�" size="small" style="width: 100%"
+ @keyup.enter.native="getDeviceStatePage(clickNodeVal.value)"></el-input>
+ </el-form-item>
+ <el-form-item>
+ <el-button size="mini" type="primary" @click="getDeviceStatePage(clickNodeVal.value)">鏌ヨ</el-button>
+ <el-button size="mini" @click="resetSearch">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
+ <div>
+ <el-button size="small" type="primary" @click="dialogVisible = true">鏂板缓</el-button>
+ <el-button :loading="outLoading" size="small" type="primary" @click="handleDown">瀵煎嚭Excel</el-button>
+ </div>
</div>
<div>
- <el-table :data="tableDatalist" height="calc(100vh - 20em)" style="width: 100% ;">
+ <el-table :data="tableDatalist" height="calc(100vh - 20em)" style="width: 100% ;"
+ :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border>
<!-- 琛ㄦ牸鍒� -->
<el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index"
width="70"></el-table-column>
@@ -53,7 +47,7 @@
</el-table>
<el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
:total="search.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
- @current-change="handleCurrentChange">
+ @current-change="handleCurrentChange" background>
</el-pagination>
</div>
<el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="dialogVisible" title="璁惧鎯呭喌"
@@ -237,7 +231,17 @@
</div>
</template>
<script>
+import {
+ saveDeviceState,
+ selectDeviceByCode,
+ exportDeviceStatus,
+ deleteDeviceState,
+ deviceStateExport,
+ getDeviceStatePage,
+} from '@/api/cnas/resourceDemand/device.js'
+import { selectUserCondition } from "@/api/business/inspectionTask";
import { dateFormat } from '@/utils/date'
+import { mapGetters } from "vuex";
export default {
props: {
clickNodeVal: {
@@ -246,6 +250,9 @@
return {};
}
}
+ },
+ computed: {
+ ...mapGetters(["nickName"]),
},
data() {
return {
@@ -311,25 +318,24 @@
this.$refs.form.validate((valid) => {
if (valid === true || saveState !== '1submit') {
// 缁欏綋鍓嶇幆鑺傝缃垱寤轰汉涓庢椂闂�
- let user = JSON.parse(localStorage.getItem('user'))
const dateTime = dateFormat(new Date())
// 鑾峰彇褰撳墠鐜妭鎿嶄綔浜轰笌鏃ユ湡
switch (this.currentStep) {
case 0:
- this.form.createUser = user.name
- this.form.submitOperatingPersonnel = user.name
+ this.form.createUser = this.nickName
+ this.form.submitOperatingPersonnel = this.nickName
this.form.submitDate = dateTime
break
case 1:
- this.form.departmentOperatingPersonnel = user.name
+ this.form.departmentOperatingPersonnel = this.nickName
this.form.departmentDate = dateTime
break
case 2:
- this.form.measuringRoomOperatingPersonnel = user.name
+ this.form.measuringRoomOperatingPersonnel = this.nickName
this.form.measuringRoomDate = dateTime
break
case 3:
- this.form.approvalOperatingPersonnel = user.name
+ this.form.approvalOperatingPersonnel = this.nickName
this.form.approvalDate = dateTime
break
default:
@@ -355,11 +361,7 @@
// 鑾峰彇褰撳墠鐘舵��
this.form.currentState = currentStepAction === 4 ? '鍏抽棴' : this.steps[currentStepAction]
this.form.deviceId = this.clickNodeVal.value
- this.$axios.post(this.$api.deviceCheck.saveDeviceState, this.form, {
- headers: {
- 'Content-Type': 'application/json'
- }
- }).then(res => {
+ saveDeviceState(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鎻愪氦鎴愬姛')
this.getDeviceStatePage(this.clickNodeVal.value)
@@ -385,7 +387,7 @@
},
openRecordAcceptance() {
// 鑾峰彇璁惧鍩虹淇℃伅
- this.$axios.get(this.$api.deviceScope.selectDeviceByCode + '?id=' + this.clickNodeVal.value).then(res => {
+ selectDeviceByCode({ id: this.clickNodeVal.value }).then(res => {
this.form.deviceName = res.data.deviceName
this.form.specificationModel = res.data.specificationModel
this.form.managementNumber = res.data.managementNumber
@@ -398,7 +400,7 @@
},
// 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
getUserList() {
- this.$axios.get(this.$api.deviceScope.selectUserList).then(res => {
+ selectUserCondition().then(res => {
if (res.code == 200) {
this.responsibleOptions = res.data
}
@@ -418,37 +420,10 @@
// 瀵煎嚭
handleDownOne(row) {
this.outLoading = true
- this.$axios.get(this.$api.deviceCheck.exportDeviceStatus + '?deviceId=' + row.deviceId + '&processNumber=' + row.processNumber, {
- responseType: "blob"
- }).then(res => {
+ exportDeviceStatus({ deviceId: row.deviceId, processNumber: row.processNumber }).then(res => {
this.outLoading = false
const blob = new Blob([res], { type: 'application/octet-stream' });
- //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆
- let reader = new FileReader();
- reader.readAsText(blob, 'utf-8');
- reader.onload = () => {
- try {
- let result = JSON.parse(reader.result);
- if (result.message) {
- this.$message.error(result.message);
- } else {
- const url = URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = url;
- link.download = '璁惧鍋�/鍚敤.doc';
- link.click();
- this.$message.success('瀵煎嚭鎴愬姛')
- }
- } catch (err) {
- console.log(err);
- const url = URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = url;
- link.download = '璁惧鍋�/鍚敤.doc';
- link.click();
- this.$message.success('瀵煎嚭鎴愬姛')
- }
- }
+ this.$download.saveAs(blob, '璁惧鍋�/鍚敤.doc')
})
},
// 鍒犻櫎
@@ -458,7 +433,7 @@
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- this.$axios.delete(this.$api.deviceCheck.deleteDeviceState + '?stateId=' + row.stateId).then(res => {
+ deleteDeviceState({ stateId: row.stateId }).then(res => {
if (res.code == 200) {
this.$message.success('鍒犻櫎鎴愬姛')
this.getDeviceStatePage(this.clickNodeVal.value)
@@ -470,43 +445,17 @@
message: '宸插彇娑堝垹闄�'
});
});
-
},
//瀵煎嚭
handleDown() {
this.outLoading = true
- this.$axios.post(this.$api.deviceCheck.deviceStateExport, {
+ deviceStateExport({
deviceId: this.clickNodeVal.value,
processNumber: this.search.processNumber
- }, { responseType: "blob" }).then(res => {
+ }).then(res => {
this.outLoading = false
const blob = new Blob([res], { type: 'application/octet-stream' });
- //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆
- let reader = new FileReader();
- reader.readAsText(blob, 'utf-8');
- reader.onload = () => {
- try {
- let result = JSON.parse(reader.result);
- if (result.message) {
- this.$message.error(result.message);
- } else {
- const url = URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = url;
- link.download = '璁惧鍋滅敤/鍚敤.xlsx';
- link.click();
- this.$message.success('瀵煎嚭鎴愬姛')
- }
- } catch (err) {
- console.log(err);
- const url = URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = url;
- link.download = '璁惧鍋滅敤/鍚敤.xlsx';
- link.click();
- this.$message.success('瀵煎嚭鎴愬姛')
- }
- }
+ this.$download.saveAs(blob, '璁惧鍋滅敤/鍚敤.xlsx')
}).finally(() => {
this.outLoading = false
})
@@ -521,7 +470,7 @@
this.getDeviceStatePage(this.clickNodeVal.value);
},
getDeviceStatePage(deviceId) {
- this.$axios.get(this.$api.deviceCheck.getDeviceStatePage + '?deviceId=' + deviceId + "&size=" + this.search.size + "¤t=" + this.search.current + "&processNumber=" + this.search.processNumber).then(res => {
+ getDeviceStatePage({ deviceId, ...this.search }).then(res => {
if (res.code == 200) {
this.tableDatalist = res.data.records
this.search.total = res.data.total
@@ -553,98 +502,10 @@
</script>
<style scoped>
-.dialog-content {
- max-height: 70vh;
- /* 璁剧疆鏈�澶ч珮搴� */
- overflow-y: auto;
- /* 鍚敤鍨傜洿婊氬姩 */
-}
-
-h4 {
- font-weight: 400;
- font-size: 16px;
- margin: 10px 0;
-}
-
-/*
-淇濆瓨鎻愪氦鎸夐挳鏍峰紡
-*/
-h4 .title {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
-}
-
-h4 .title .line {
- display: inline-block;
- width: 3px;
- height: 16px;
- background: #3A7BFA;
- margin-right: 4px;
-}
-
-.tables {
- width: 100%;
- height: calc(100vh - 15em);
-}
-
-.el-from {
- max-width: 400px;
- margin: 0 auto;
-}
-
-.form-row {
- display: flex;
- justify-content: space-between;
-}
-
-
-.form-row .el-form-item {
- flex: 1;
- /* 姣忎釜琛ㄥ崟椤瑰崰鎹浉鍚屾瘮渚嬬殑绌洪棿 */
- margin-right: 100px;
- /* 鍙�夛細涓哄彸渚у厓绱犳坊鍔犻棿璺� */
-}
-
-/* 绉婚櫎鏈�鍚庝竴涓厓绱犵殑鍙宠竟璺� */
-.form-row .el-form-item:last-child {
- margin-right: 0;
-
-}
-
.search {
- background-color: #fff;
- margin: 10px 0;
+ height: 46px;
display: flex;
- align-items: center;
- position: relative;
-}
-
-.search_thing {
- display: flex;
- align-items: center;
- height: 40px;
-}
-
-.search_label {
- width: 70px;
- font-size: 14px;
- text-align: right;
-}
-
-.search_input {
- width: 70%;
-}
-
-.btns {
- position: absolute;
- right: 0;
- top: 50%;
- transform: translate(0, -50%);
-}
-
-.form .search_label {
- width: 120px;
+ justify-content: space-between;
+ margin-top: 10px;
}
</style>
--
Gitblit v1.9.3