From 3c510ea35b428feed7f7a1743a595e7dba634518 Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 16 四月 2025 15:50:45 +0800 Subject: [PATCH] 网络分析仪数采配置 --- src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/temperature-humidity-record.vue | 227 +++++++++++++++++++++----------------------------------- 1 files changed, 87 insertions(+), 140 deletions(-) diff --git a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/temperature-humidity-record.vue b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/temperature-humidity-record.vue index f848a42..2fc53ba 100644 --- a/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/temperature-humidity-record.vue +++ b/src/views/CNAS/resourceDemand/facilitiesEnvironment/component/facilities-environmental-conditions/temperature-humidity-record.vue @@ -11,12 +11,9 @@ <el-button size="small" type="primary" @click="clickAdd">鏂� 澧�</el-button> </div> </div> - <el-table - :data="tableData" - height="calc(100vh - 18em)" - highlight-current-row - style="width: 100%" - @row-click="clickRow"> + <el-table :data="tableData" height="calc(100vh - 18em)" highlight-current-row style="width: 100%" + :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border + @row-click="clickRow"> <el-table-column label="搴忓彿" type="index" width="60" align="center"></el-table-column> <el-table-column label="鏈堝害鏃堕棿" min-width="180" prop="monthDate"></el-table-column> <el-table-column label="璇曢獙鍖哄煙鍚嶇О" min-width="180" prop="testAreaName"></el-table-column> @@ -31,33 +28,33 @@ <template v-slot="scope"> <el-button size="small" type="text" @click="downLoadPost(scope.row)">瀵煎嚭</el-button> <el-button size="small" type="text" @click="edit(scope.row)">缂栬緫</el-button> - <el-button :disabled="scope.row.isAffirm === '1'" size="small" type="text" @click="openApprovalDialog(scope.row)">纭</el-button> + <el-button :disabled="scope.row.isAffirm === '1'" size="small" type="text" + @click="openApprovalDialog(scope.row)">纭</el-button> <el-button size="small" type="text" @click="deleteRowFun(scope.row)">鍒犻櫎</el-button> </template> </el-table-column> </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"> + <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" background + :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" + @current-change="handleCurrentChange"> </el-pagination> </el-col> <el-col :span="12"> <div class="header"> <div>娓╂箍搴﹁褰曪細{{ saveRow.monthDate }}</div> <div> - <el-button v-if="saveRow.monthDate" size="small" type="primary" @click="dialogVisible1 = true">鏂� 澧�</el-button> + <el-button v-if="saveRow.monthDate" size="small" type="primary" @click="dialogVisible1 = true">鏂� + 澧�</el-button> </div> </div> - <el-table - :data="tableData1" - height="calc(100vh - 18em)" - style="width: 100%"> + <el-table :data="tableData1" height="calc(100vh - 18em)" style="width: 100%" + :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border> <el-table-column label="搴忓彿" type="index" width="60" align="center"></el-table-column> <el-table-column label="鏃ユ湡" min-width="100" prop="recordDate"></el-table-column> <el-table-column align="center" label="涓婂崍" min-width="200"> <template> - <el-table-column label="鏃堕棿" min-width="110" prop="morningTestTime" show-overflow-tooltip></el-table-column> + <el-table-column label="鏃堕棿" min-width="110" prop="morningTestTime" + show-overflow-tooltip></el-table-column> <el-table-column label="娓╁害" min-width="80" prop="morningTemp" show-overflow-tooltip></el-table-column> <el-table-column label="婀垮害" min-width="80" prop="morningHum" show-overflow-tooltip></el-table-column> </template> @@ -79,37 +76,27 @@ </template> </el-table-column> </el-table> - <el-pagination :current-page="1" :page-size="search1.size" :page-sizes="[10, 20, 30, 50, 100]" - :total="search1.total" layout="->,total, sizes, prev, pager, next, jumper" - @size-change="handleSizeChange1" - @current-change="handleCurrentChange1"> + <el-pagination :current-page="1" :page-size="search1.size" :page-sizes="[10, 20, 30, 50, 100]" background + :total="search1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" + @current-change="handleCurrentChange1"> </el-pagination> </el-col> </el-row> - <el-dialog - :visible.sync="dialogVisible" - title="鎻愮ず" - width="50%"> + <el-dialog :visible.sync="dialogVisible" title="鎻愮ず" width="50%"> <div style="height: 20vh;"> <el-form ref="form" :model="form" label-width="80px"> <el-row> <el-col :span="24"> <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ユ湀搴︽椂闂�', trigger: 'blur' }]" label="鏈堝害鏃堕棿" - prop="monthDate"> - <el-date-picker - v-model="form.monthDate" - format="yyyy-MM" - placeholder="閫夋嫨鏈堜唤" - size="small" - style="width: 100%" - type="month" - value-format="yyyy-MM"> + prop="monthDate"> + <el-date-picker v-model="form.monthDate" format="yyyy-MM" placeholder="閫夋嫨鏈堜唤" size="small" + style="width: 100%" type="month" value-format="yyyy-MM"> </el-date-picker> </el-form-item> </el-col> <el-col :span="24"> <el-form-item :rules="[{ required: true, message: '璇疯緭鍏ヨ瘯楠屽尯鍩�', trigger: 'blur' }]" label="璇曢獙鍖哄煙" - prop="testAreaName"> + prop="testAreaName"> <el-input v-model="form.testAreaName"></el-input> </el-form-item> </el-col> @@ -117,40 +104,25 @@ </el-form> </div> <span slot="footer" class="dialog-footer"> - <el-button @click="dialogVisible = false">鍙� 娑�</el-button> - <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability">纭� 瀹�</el-button> - </span> + <el-button @click="dialogVisible = false">鍙� 娑�</el-button> + <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability">纭� 瀹�</el-button> + </span> </el-dialog> - <el-dialog - :visible.sync="dialogVisible1" - title="鎻愮ず" - width="50%" - @open="openDialog"> + <el-dialog :visible.sync="dialogVisible1" title="鎻愮ず" width="50%" @open="openDialog"> <div style="height: 40vh;"> <el-form ref="form1" :model="form1" label-width="120px"> <el-row> <el-col :span="24"> <el-form-item label="鏃ユ湡"> - <el-date-picker - v-model="form1.recordDate" - format="yyyy-MM-dd" - placeholder="璇烽�夋嫨鏃ユ湡" - size="small" - style="width: 50%" - type="date" - value-format="yyyy-MM-dd"> + <el-date-picker v-model="form1.recordDate" format="yyyy-MM-dd" placeholder="璇烽�夋嫨鏃ユ湡" size="small" + style="width: 50%" type="date" value-format="yyyy-MM-dd"> </el-date-picker> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="涓婂崍鏃堕棿"> - <el-time-picker - v-model="form1.morningTestTime" - size="small" - value-format="HH:mm:ss" - format="HH:mm:ss" - style="width: 100%" - placeholder="璇烽�夋嫨鏃堕棿"> + <el-time-picker v-model="form1.morningTestTime" size="small" value-format="HH:mm:ss" format="HH:mm:ss" + style="width: 100%" placeholder="璇烽�夋嫨鏃堕棿"> </el-time-picker> </el-form-item> </el-col> @@ -166,8 +138,8 @@ </el-col> <el-col :span="12"> <el-form-item label="涓婂崍璁板綍鍛�"> - <el-select v-model="form1.morningRecorderId" clearable filterable placeholder="璇烽�夋嫨" - size="small" style="width: 100%;"> + <el-select v-model="form1.morningRecorderId" clearable filterable placeholder="璇烽�夋嫨" size="small" + style="width: 100%;"> <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> @@ -175,13 +147,8 @@ </el-col> <el-col :span="12"> <el-form-item label="涓嬪崍鏃堕棿"> - <el-time-picker - v-model="form1.afternoonTime" - size="small" - value-format="HH:mm:ss" - format="HH:mm:ss" - style="width: 100%" - placeholder="璇烽�夋嫨鏃堕棿"> + <el-time-picker v-model="form1.afternoonTime" size="small" value-format="HH:mm:ss" format="HH:mm:ss" + style="width: 100%" placeholder="璇烽�夋嫨鏃堕棿"> </el-time-picker> </el-form-item> </el-col> @@ -197,8 +164,8 @@ </el-col> <el-col :span="12"> <el-form-item label="涓嬪崍璁板綍鍛�"> - <el-select v-model="form1.afternoonRecorderId" clearable filterable placeholder="璇烽�夋嫨" - size="small" style="width: 100%;"> + <el-select v-model="form1.afternoonRecorderId" clearable filterable placeholder="璇烽�夋嫨" size="small" + style="width: 100%;"> <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> @@ -206,11 +173,7 @@ </el-col> <el-col :span="24"> <el-form-item label="澶囨敞"> - <el-input - v-model="form1.note" - :rows="2" - placeholder="璇疯緭鍏ュ唴瀹�" - type="textarea"> + <el-input v-model="form1.note" :rows="2" placeholder="璇疯緭鍏ュ唴瀹�" type="textarea"> </el-input> </el-form-item> </el-col> @@ -218,9 +181,9 @@ </el-form> </div> <span slot="footer" class="dialog-footer"> - <el-button @click="dialogVisible1 = false">鍙� 娑�</el-button> - <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability1">纭� 瀹�</el-button> - </span> + <el-button @click="dialogVisible1 = false">鍙� 娑�</el-button> + <el-button type="primary" :loading="submitLoading" @click="addPowerSupplyStability1">纭� 瀹�</el-button> + </span> </el-dialog> <el-dialog :visible.sync="approvalDialog" title="纭" width="30%" @close="subjoin = ''"> <span> @@ -236,6 +199,18 @@ </template> <script> +import { + getFeTempHumDate, + addFeTempHumDate, + getFeTempHumRecordPage, + addFeTempHumRecord, + selectUserCondition, + deleteFeTempHumRecord, + deleteFeTempHumDate, + exportTemperatureAndHumidityRecords, + affirmFeTempHumDate +} from '@/api/cnas/resourceDemand/facilitiesEnvironment/facilitiesAndEnvironment' + export default { data() { return { @@ -283,22 +258,17 @@ } }, methods: { - openApprovalDialog (row) { + openApprovalDialog(row) { this.approvalDialog = true this.approvalRow = row }, - handleApproval () { + handleApproval() { this.approvalLoading = true const params = { dateId: this.approvalRow.dateId, subjoin: this.subjoin, } - this.$axios.post(this.$api.facilitiesAndEnvironment.affirmFeTempHumDate, params, { - headers: { - 'Content-Type': 'application/json' - }, - noQs: true - }).then(res => { + affirmFeTempHumDate(params).then(res => { this.approvalLoading = false if (res.code === 200) { this.$message.success('纭鎴愬姛锛�') @@ -310,7 +280,7 @@ }) }, openDialog() { - this.$axios.get(this.$api.deviceScope.selectUserList).then(res => { + selectUserCondition().then(res => { if (res.code == 200) { this.responsibleOptions = res.data } @@ -320,11 +290,7 @@ this.$refs.form.validate((valid) => { if (valid) { this.submitLoading = true - this.$axios.post(this.$api.facilitiesAndEnvironment.addFeTempHumDate, this.form, { - headers: { - 'Content-Type': 'application/json' - } - }).then(res => { + addFeTempHumDate(this.form).then(res => { if (res.code === 200) { this.$message.success('鏂板鎴愬姛!') this.submitLoading = false @@ -346,11 +312,7 @@ this.submitLoading = true if (valid) { this.form1.dateId = this.saveRow.dateId - this.$axios.post(this.$api.facilitiesAndEnvironment.addFeTempHumRecord, this.form1, { - headers: { - 'Content-Type': 'application/json' - } - }).then(res => { + addFeTempHumRecord(this.form1).then(res => { if (res.code === 200) { this.$message.success('鏂板鎴愬姛!') this.submitLoading = false @@ -368,7 +330,7 @@ this.initData1(row.dateId) }, edit(row) { - this.form = {...row} + this.form = { ...row } this.dialogVisible = true }, deleteRowFun(row) { @@ -377,47 +339,22 @@ cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { - this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeTempHumDate + '?dateId=' + row.dateId).then(res => { + deleteFeTempHumDate({ dateId: row.dateId }).then(res => { this.$message.success('鍒犻櫎鎴愬姛锛�') this.initData() }) }) }, edit1(row) { - this.form1 = {...row} + this.form1 = { ...row } this.dialogVisible1 = true }, // 瀵煎嚭 downLoadPost(row) { - this.$axios.get(this.$api.facilitiesAndEnvironment.exportTemperatureAndHumidityRecords + '?dateId=' + row.dateId,{responseType: "blob"}).then(res => { + exportTemperatureAndHumidityRecords({ dateId: row.dateId }).then(res => { this.outLoading = false - const blob = new Blob([res],{ type: 'application/msword' }); - //灏咮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 = '娓╂箍搴﹁褰�' + '.docx'; - 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 = '娓╂箍搴﹁褰�' + '.docx'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') - } - } + const blob = new Blob([res], { type: 'application/msword' }); + this.$download.saveAs(blob, '娓╂箍搴﹁褰�.docx') }) }, deleteRowFun1(row) { @@ -426,28 +363,38 @@ cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { - this.$axios.delete(this.$api.facilitiesAndEnvironment.deleteFeTempHumRecord + '?tempHumId=' + row.tempHumId).then(res => { + deleteFeTempHumRecord({ tempHumId: row.tempHumId }).then(res => { this.$message.success('鍒犻櫎鎴愬姛锛�') this.initData1(this.saveRow.dateId) }) }) }, initData() { - this.$axios.get(this.$api.facilitiesAndEnvironment.getFeTempHumDate + '?size=' + this.search.size + '¤t=' + this.search.current + '&testAreaName=' + this.search.testAreaName).then(res => { - if (res.code === 201) return; - this.tableData = res.data.records; - this.search.total = res.data.total; - if (res.data.records.length === 0) { - this.tableData1 = [] - this.saveRow.monthDate = '' + getFeTempHumDate({ + ...this.search, + ...this.search + }).then(res => { + if (res.code === 200) { + this.tableData = res.data.records; + this.search.total = res.data.total; + if (res.data.records.length === 0) { + this.tableData1 = [] + this.saveRow.monthDate = '' + } } - }); + + }) }, initData1(dateId) { - this.$axios.get(this.$api.facilitiesAndEnvironment.getFeTempHumRecordPage + '?size=' + this.search1.size + '¤t=' + this.search1.current + '&dateId=' + dateId).then(res => { - if (res.code === 201) return; - this.tableData1 = res.data.records; - this.search1.total = res.data.total; + let form = { dateId: dateId } + getFeTempHumRecordPage({ + ...this.search1, + ...form + }).then(res => { + if (res.code === 200) { + this.tableData1 = res.data.records; + this.search1.total = res.data.total; + } }); }, handleSizeChange(val) { -- Gitblit v1.9.3