From 8a91d86646b69225115fb16a06d91ac01578a1b4 Mon Sep 17 00:00:00 2001 From: zhujiyan <17812234322@163.com> Date: Mon, 23 Sep 2024 13:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B9=E6=A1=88=E6=95=B0=E6=8D=AE=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=8C=87=E6=A0=87=E9=80=89=E6=8B=A9=E5=90=8E=E8=B0=90?= =?UTF-8?q?=E6=B3=A2=E6=AC=A1=E6=95=B0=E4=B8=8B=E6=8B=89=E6=A1=86=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/planData/components/popup.vue | 42 +- .../planData/components/treeTransfer.vue | 534 ------------------ src/views/govern/device/planData/index.vue | 114 ++-- 3 files changed, 79 insertions(+), 611 deletions(-) delete mode 100644 src/views/govern/device/planData/components/treeTransfer.vue diff --git a/src/views/govern/device/planData/components/popup.vue b/src/views/govern/device/planData/components/popup.vue index a4665e6..ec47fd0 100644 --- a/src/views/govern/device/planData/components/popup.vue +++ b/src/views/govern/device/planData/components/popup.vue @@ -455,21 +455,7 @@ const getData = (rightData: any) => { } checkedIdList.value = [...new Set(checkedIdList.value)] } -const loading = ref(false) -const defaultCheckedKeys: any = ref([]) -const tableData = ref([]) -defineOptions({ - name: 'govern/tourist/index' -}) -const treeIds: any = ref([]) -const pids: any = ref([]) -//绑定选择的数据 -const selectedBindList: any = ref([]) -//未绑定选择的数据 -const selectedUnBindList: any = ref([]) -const deviceInfoTreeRef1 = ref() -const deviceInfoTreeRef2 = ref() //判断是否显示新增页面 false显示详情页面和删除按钮隐藏确定按钮 true显示新增页面与确定按钮隐藏删除按钮 const addFlag = ref(false) const selectId: any = ref('') @@ -511,11 +497,13 @@ const submit = () => { itemName: form.value.itemName, describe: form.value.describe } - addPlan(subForm).then(res => { - ElMessage.success('新增方案成功') - initForm() - emit('onSubmit') - close() + addPlan(subForm).then((res: any) => { + if (res.code == 'A0000') { + ElMessage.success('新增方案成功') + initForm() + emit('onSubmit') + close() + } }) } else { console.log('表单验证失败') @@ -525,7 +513,7 @@ const submit = () => { } //修改方案 if (activeFormIndex.value == 1) { - ruleFormRef1.value.validate(valid => { + ruleFormRef1.value.validate((valid: boolean) => { if (valid) { const subForm = { id: planId.value, @@ -542,7 +530,7 @@ const submit = () => { } //新增测试项 if (activeFormIndex.value == 2) { - ruleFormRef2.value.validate(valid => { + ruleFormRef2.value.validate((valid: boolean) => { if (valid) { let subForm = { id: planId.value, @@ -574,11 +562,13 @@ const submit = () => { // return item.id // }) subForm.list = checkedIdList.value - updateRecord(subForm).then(res => { - ElMessage.success('修改测试项成功') - initForm() - emit('onSubmit') - close() + updateRecord(subForm).then((res:any) => { + if (res.code == 'A0000') { + ElMessage.success('修改测试项成功') + initForm() + emit('onSubmit') + close() + } }) } else { console.log('校验不通过') diff --git a/src/views/govern/device/planData/components/treeTransfer.vue b/src/views/govern/device/planData/components/treeTransfer.vue deleted file mode 100644 index 605f7bb..0000000 --- a/src/views/govern/device/planData/components/treeTransfer.vue +++ /dev/null @@ -1,534 +0,0 @@ - - - - diff --git a/src/views/govern/device/planData/index.vue b/src/views/govern/device/planData/index.vue index d46e612..54e7c6e 100644 --- a/src/views/govern/device/planData/index.vue +++ b/src/views/govern/device/planData/index.vue @@ -3,9 +3,9 @@
- + @@ -19,14 +19,20 @@

测试项信息

- + - + + {{ item.itemName }} @@ -103,6 +109,7 @@ collapse-tags-tooltip v-model="searchForm.index" placeholder="请选择统计指标" + @change="init()" > +
- + + 查询
-
- +
+
@@ -169,9 +175,7 @@ import MyEchart from '@/components/echarts/MyEchart.vue' import { getTestRecordInfo, getHistoryTrend } from '@/api/cs-device-boot/planData' import { useDictData } from '@/stores/dictData' import { queryStatistical } from '@/api/system-boot/csstatisticalset' -import * as echarts from 'echarts' -import { isNonNullChain } from 'typescript' -import { position } from 'html2canvas/dist/types/css/property-descriptors/position' +import { TrendCharts, Plus } from '@element-plus/icons-vue' const dictData = useDictData() defineOptions({ name: 'govern/device/manage' @@ -222,6 +226,7 @@ queryByCode('portable-harmonic').then(res => { }) queryStatistical(res.data.id).then(vv => { legendDictList.value = vv.data + console.log(legendDictList.value, '2362636236636366263636', vv) }) }) const activeName: any = ref() @@ -237,7 +242,7 @@ const nodeClick = async (e: anyObj) => { let id = e.pid ? e.pid : e.id //查询测试项信息 try { - await getTestRecordInfo(id).then(res => { + getTestRecordInfo(id).then(res => { deviceData.value = res.data loading.value = false if (res.data.records.length == 1) { @@ -256,7 +261,7 @@ const nodeClick = async (e: anyObj) => { } catch (error) { loading.value = false } - init() + await init() } const dialogRef = ref() const handleOpen = (val: any, id: any) => { @@ -273,20 +278,8 @@ const refreshTree = () => { const range = (start: any, end: any, step: any) => { return Array.from({ length: (end - start) / step + 1 }, (_, i) => start + i * step) } -const init = async () => { - // 选择指标的时候切换legend内容和data数据 +const init = () => { let list: any = [] - legendDictList.value?.selectedList?.map((item: any) => { - // searchForm.value.index.map((vv: any) => { - // if (item.dataType == vv) { - // list.push(item.eleEpdPqdVOS) - // } - // }) - if (item.dataType == searchForm.value.index) { - list.push(item.eleEpdPqdVOS) - } - }) - //颜色数组 const colorList = [ '#DAA521', @@ -302,7 +295,14 @@ const init = async () => { '#1DD0CE', 'cadetblue' ] - if (historyDevId.value) { + if (historyDevId.value && legendDictList.value && legendDictList.value.selectedList) { + // 选择指标的时候切换legend内容和data数据 + legendDictList.value?.selectedList?.map((item: any) => { + if (item.dataType == searchForm.value.index) { + list.push(item.eleEpdPqdVOS) + } + }) + console.log(legendDictList.value, '2362636236636366263636') //选择的指标使用方法处理 initSearchFormIndexAndCount([searchForm.value.index]) //查询历史趋势 @@ -322,8 +322,8 @@ const init = async () => { } else { middleTitle = '' } - let indexList=[] - indexList=[searchForm.value.index] + let indexList = [] + indexList = [searchForm.value.index] chartTitle.value = deviceData.value.itemName + '_' + middleTitle + '_' indexList.map((item: any, indexs: any) => { indexOptions.value.map((vv: any) => { @@ -346,8 +346,8 @@ const init = async () => { valueType: searchForm.value.type } try { - await getHistoryTrend(obj) - .then(res => { + getHistoryTrend(obj) + .then((res: any) => { if (res.code == 'A0000') { historyDataList.value = res.data echartsData.value = null @@ -358,15 +358,14 @@ const init = async () => { 'path://M1001.661867 796.544c48.896 84.906667 7.68 157.013333-87.552 157.013333H110.781867c-97.834667 0-139.050667-69.504-90.112-157.013333l401.664-666.88c48.896-87.552 128.725333-87.552 177.664 0l401.664 666.88zM479.165867 296.533333v341.333334a32 32 0 1 0 64 0v-341.333334a32 32 0 1 0-64 0z m0 469.333334v42.666666a32 32 0 1 0 64 0v-42.666666a32 32 0 1 0-64 0z' let xAxis: any = [], - timeList: any = [] - let unitList: any = [] + timeList: any = [], + unitList: any = [] historyDataList.value.map((item: any) => { timeList.push(item.time) if (unitList.indexOf(item.unit) == -1) { unitList.push(item.unit) } }) - console.log(timeList, '+++++++++++') xAxis = timeList.sort((a: any, b: any) => { return ( a.replace('-', '').replace('-', '').replace(' ', '').replace(':', '').replace(':', '') - @@ -437,7 +436,7 @@ const init = async () => { left: '3%', right: '3%', bottom: '10%', - top: '5%', + top: '8%', containLabel: true }, xAxis: [ @@ -758,30 +757,34 @@ const initSearchFormIndexAndCount = (list: any) => { if (kk.harmStart && kk.harmEnd) { range(0, 0, 0) countData.value[index].countOptions = range(kk.harmStart, kk.harmEnd, 1) + countData.value[index].count = countData.value[index].countOptions[0] } }) } }) }) + console.log(countData.value, '66666666', legendDictList.value) } } watch( - () => [searchForm.value.index], + () => searchForm.value.index, (val: any, oldval: any) => { if (val) { - initSearchFormIndexAndCount(val) - if (val == 0) { - countData.value = [] - } + let list = [val] + // initSearchFormIndexAndCount(list) + // if (val == 0) { + // countData.value = [] + // } countData.value.map((item: any, key: any) => { if ( - val.findIndex((vv: any) => { + list.findIndex((vv: any) => { return vv == item.index }) == -1 ) { countData.value.splice(key, 1) } }) + init() } }, { @@ -790,6 +793,13 @@ watch( } ) onMounted(() => { + loading.value = true + setTimeout(() => { + init() + loading.value = false + }, 1500) + + // initSearchFormIndexAndCount([searchForm.value.index]) }) @@ -829,15 +839,14 @@ onMounted(() => { } } } - .history_title { width: 100%; - p { height: 32px; line-height: 32px; - font-size: 16px; + font-size: 14px; font-weight: bold; + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif; } } @@ -846,7 +855,7 @@ onMounted(() => { .el-tabs__content { padding: 0 !important; - max-height: 160px !important; + max-height: 130px !important; } } .history_header { @@ -856,12 +865,15 @@ onMounted(() => { width: 95%; display: flex; justify-content: flex-start; - overflow: auto; - height: 45px; + // overflow-x: auto; + // height: 45px; + // padding-top: 18px; // flex-wrap: wrap; .el-form-item { flex: none; max-width: 380px !important; + display: flex; + align-items: center; } .el-select { margin-right: 10px; @@ -884,6 +896,6 @@ onMounted(() => { } ::v-deep .el-select { - width: 200px !important; + width: 120px !important; }