diff --git a/frontend/src/api/device/testScript/index.ts b/frontend/src/api/device/testScript/index.ts index b8dc03d..0c3c6be 100644 --- a/frontend/src/api/device/testScript/index.ts +++ b/frontend/src/api/device/testScript/index.ts @@ -30,3 +30,7 @@ export const deletePqScript = (params: string[]) => { export const addScriptDtls = (params: any) => { return http.post(`/pqScript/addScriptDtls`, params) } +//根据脚本id查询检测脚本详情 +export const dlsDetails = (params: any) => { + return http.post(`/pqScript/dlsDetails`, params) +} diff --git a/frontend/src/views/machine/testScript/components/communication.vue b/frontend/src/views/machine/testScript/components/communication.vue index 81cee24..9bf4b6b 100644 --- a/frontend/src/views/machine/testScript/components/communication.vue +++ b/frontend/src/views/machine/testScript/components/communication.vue @@ -52,7 +52,7 @@ interface TabOption { } const props = defineProps({ options: { - type: Array as PropType, + type: Array , required: true } }) diff --git a/frontend/src/views/machine/testScript/components/scriptForm.ts b/frontend/src/views/machine/testScript/components/scriptForm.ts index d88a80e..bdad8d0 100644 --- a/frontend/src/views/machine/testScript/components/scriptForm.ts +++ b/frontend/src/views/machine/testScript/components/scriptForm.ts @@ -1,181 +1,187 @@ -let scriptForm = { - value: '', +let scriptForm: any = { + // value: '', label: '', subType: '', //tabcode - fFreq: 50.01, //频率 + ffreq: 50, //频率 channelList: [ { + channelType: 'Ua', channelFlag: false, //通道使能 harmFlag: false, //谐波使能 inHarmFlag: false, //间谐波使能 flickerFlag: false, //闪变使能 dipFlag: false, //暂态使能 - fAmp: 0, //幅值 - fPhase: 0, //相角 + famp: 0, //幅值 + fphase: 0, //相角 harmList: [ // { // harm: 2, //谐波次数 - // fAmp: 0, //谐波含有率 - // fPhase: 0 // 谐波相角 + // famp: 0, //谐波含有率 + // fphase: 0 // 谐波相角 // }, ], //谐波 inHarmList: [ { inharm: 0, //间谐波次数 - fAmp: 0, //间谐波含有率 - fPhase: 0 // 间谐波相角 + famp: 0, //间谐波含有率 + fphase: 0 // 间谐波相角 } ], //间谐波 flickerData: { - fChagValue: 0, //电压变动幅度 - fChagFre: 0, //波动频度 + fchagValue: 0, //电压变动幅度 + fchagFre: 0, //波动频度 waveFluType: 0, //波动类型 waveType: 0, //波类型 - fDutyCycle: 0 //占空比 + fdutyCycle: 0 //占空比 }, //闪变 dipData: { - fTransValue: 0, // 暂态幅值 - fRetainTime: 0 // 暂态持续时间 + ftransValue: 0, // 暂态幅值 + fretainTime: 0 // 暂态持续时间 } //暂态 }, { + channelType: 'Ia', channelFlag: false, //通道使能 harmFlag: false, //谐波使能 inHarmFlag: false, //间谐波使能 flickerFlag: false, //闪变使能 dipFlag: false, //暂态使能 - fAmp: 0, //幅值 - fPhase: 0, //相角 + famp: 0, //幅值 + fphase: 0, //相角 harmList: [], //谐波 inHarmList: [ { inharm: 1, //间谐波次数 - fAmp: 0, //间谐波含有率 - fPhase: 0 // 间谐波相角 + famp: 0, //间谐波含有率 + fphase: 0 // 间谐波相角 } ], //间谐波 flickerData: { - fChagValue: 0, //电压变动幅度 - fChagFre: 0, //波动频度 + fchagValue: 0, //电压变动幅度 + fchagFre: 0, //波动频度 waveFluType: 0, //波动类型 waveType: 0, //波类型 - fDutyCycle: 0 //占空比 + fdutyCycle: 0 //占空比 }, //闪变 dipData: { - fTransValue: 0, // 暂态幅值 - fRetainTime: 0 // 暂态持续时间 + ftransValue: 0, // 暂态幅值 + fretainTime: 0 // 暂态持续时间 } //暂态 }, { + channelType: 'Ub', channelFlag: false, //通道使能 harmFlag: false, //谐波使能 inHarmFlag: false, //间谐波使能 flickerFlag: false, //闪变使能 dipFlag: false, //暂态使能 - fAmp: 0, //幅值 - fPhase: 0, //相角 + famp: 0, //幅值 + fphase: 0, //相角 harmList: [], //谐波 inHarmList: [ { inharm: 1, //间谐波次数 - fAmp: 0, //间谐波含有率 - fPhase: 0 // 间谐波相角 + famp: 0, //间谐波含有率 + fphase: 0 // 间谐波相角 } ], //间谐波 flickerData: { - fChagValue: 0, //电压变动幅度 - fChagFre: 0, //波动频度 + fchagValue: 0, //电压变动幅度 + fchagFre: 0, //波动频度 waveFluType: 0, //波动类型 waveType: 0, //波类型 - fDutyCycle: 0 //占空比 + fdutyCycle: 0 //占空比 }, //闪变 dipData: { - fTransValue: 0, // 暂态幅值 - fRetainTime: 0 // 暂态持续时间 + ftransValue: 0, // 暂态幅值 + fretainTime: 0 // 暂态持续时间 } //暂态 }, { + channelType: 'Ib', channelFlag: false, //通道使能 harmFlag: false, //谐波使能 inHarmFlag: false, //间谐波使能 flickerFlag: false, //闪变使能 dipFlag: false, //暂态使能 - fAmp: 0, //幅值 - fPhase: 0, //相角 + famp: 0, //幅值 + fphase: 0, //相角 harmList: [], //谐波 inHarmList: [ { inharm: 1, //间谐波次数 - fAmp: 0, //间谐波含有率 - fPhase: 0 // 间谐波相角 + famp: 0, //间谐波含有率 + fphase: 0 // 间谐波相角 } ], //间谐波 flickerData: { - fChagValue: 0, //电压变动幅度 - fChagFre: 0, //波动频度 + fchagValue: 0, //电压变动幅度 + fchagFre: 0, //波动频度 waveFluType: 0, //波动类型 waveType: 0, //波类型 - fDutyCycle: 0 //占空比 + fdutyCycle: 0 //占空比 }, //闪变 dipData: { - fTransValue: 0, // 暂态幅值 - fRetainTime: 0 // 暂态持续时间 + ftransValue: 0, // 暂态幅值 + fretainTime: 0 // 暂态持续时间 } //暂态 }, { + channelType: 'Uc', channelFlag: false, //通道使能 harmFlag: false, //谐波使能 inHarmFlag: false, //间谐波使能 flickerFlag: false, //闪变使能 dipFlag: false, //暂态使能 - fAmp: 0, //幅值 - fPhase: 0, //相角 + famp: 0, //幅值 + fphase: 0, //相角 harmList: [], //谐波 inHarmList: [ { inharm: 1, //间谐波次数 - fAmp: 0, //间谐波含有率 - fPhase: 0 // 间谐波相角 + famp: 0, //间谐波含有率 + fphase: 0 // 间谐波相角 } ], //间谐波 flickerData: { - fChagValue: 0, //电压变动幅度 - fChagFre: 0, //波动频度 + fchagValue: 0, //电压变动幅度 + fchagFre: 0, //波动频度 waveFluType: 0, //波动类型 waveType: 0, //波类型 - fDutyCycle: 0 //占空比 + fdutyCycle: 0 //占空比 }, //闪变 dipData: { - fTransValue: 0, // 暂态幅值 - fRetainTime: 0 // 暂态持续时间 + ftransValue: 0, // 暂态幅值 + fretainTime: 0 // 暂态持续时间 } //暂态 }, { + channelType: 'Ic', channelFlag: false, //通道使能 harmFlag: false, //谐波使能 inHarmFlag: false, //间谐波使能 flickerFlag: false, //闪变使能 dipFlag: false, //暂态使能 - fAmp: 0, //幅值 - fPhase: 0, //相角 + famp: 0, //幅值 + fphase: 0, //相角 harmList: [], //谐波 inHarmList: [ { inharm: 1, //间谐波次数 - fAmp: 0, //间谐波含有率 - fPhase: 0 // 间谐波相角 + famp: 0, //间谐波含有率 + fphase: 0 // 间谐波相角 } ], //间谐波 flickerData: { - fChagValue: 0, //电压变动幅度 - fChagFre: 0, //波动频度 + fchagValue: 0, //电压变动幅度 + fchagFre: 0, //波动频度 waveFluType: 0, //波动类型 waveType: 0, //波类型 - fDutyCycle: 0 //占空比 + fdutyCycle: 0 //占空比 }, //闪变 dipData: { - fTransValue: 0, // 暂态幅值 - fRetainTime: 0 // 暂态持续时间 + ftransValue: 0, // 暂态幅值 + fretainTime: 0 // 暂态持续时间 } //暂态 } ] @@ -186,8 +192,8 @@ function getScriptForm() { scriptForm.channelList.forEach(item => { item.harmList.push({ harm: i, //谐波次数 - fAmp: 0, //谐波含有率 - fPhase: 0 // 谐波相角 + famp: 0, //谐波含有率 + fphase: 0 // 谐波相角 }) }) } diff --git a/frontend/src/views/machine/testScript/components/testProjectPopup.vue b/frontend/src/views/machine/testScript/components/testProjectPopup.vue index 9439561..479ee79 100644 --- a/frontend/src/views/machine/testScript/components/testProjectPopup.vue +++ b/frontend/src/views/machine/testScript/components/testProjectPopup.vue @@ -31,22 +31,31 @@ :cell-style="tableStyle.cellStyle" :header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }" @cell-click="handleRowClick" + :key="key" > @@ -88,7 +97,7 @@
- +
@@ -121,12 +130,12 @@
- + @@ -159,26 +168,27 @@ const props = defineProps({ required: true }, formContent: { - type: Object, + type: [Object, Array], required: true } }) -console.log(`123`, props.formContent) +const key = ref(0) // let valueType const form: any = ref(scriptForm) const childForm: any = ref([]) const ScriptValueType = ref('') +const setValueTableRef = ref() const dialogVisible = ref(false) const dialogTitle = ref() -const valueCode = ref() //Absolute绝对值 +const valueCode = ref('') //Absolute绝对值 const tableData = [ - { name: 'L1', frequency: 'V', electricity: 0, fPhase: 0, sort: 0 }, - { name: 'L1', frequency: 'I', electricity: 0, fPhase: 0, sort: 0 }, - { name: 'L2', frequency: 'V', electricity: 0, fPhase: 0, sort: 1 }, - { name: 'L2', frequency: 'I', electricity: 0, fPhase: 0, sort: 1 }, - { name: 'L3', frequency: 'V', electricity: 0, fPhase: 0, sort: 2 }, - { name: 'L3', frequency: 'I', electricity: 0, fPhase: 0, sort: 2 } + { name: 'L1', frequency: 'Ua', type: 'V', electricity: 0, fphase: 0, sort: 0 }, + { name: 'L1', frequency: 'Ia', type: 'I', electricity: 0, fphase: 0, sort: 0 }, + { name: 'L2', frequency: 'Ub', type: 'V', electricity: 0, fphase: 0, sort: 1 }, + { name: 'L2', frequency: 'Ib', type: 'I', electricity: 0, fphase: 0, sort: 1 }, + { name: 'L3', frequency: 'Uc', type: 'V', electricity: 0, fphase: 0, sort: 2 }, + { name: 'L3', frequency: 'Ic', type: 'I', electricity: 0, fphase: 0, sort: 2 } ] const subType = ref('') const tabChildren: any = ref([]) @@ -226,19 +236,26 @@ const close = () => { // 保存数据 const save = () => { - console.log('🚀 ~ save ~ form.value:', form.value) - // dialogVisible.value = false form.value.subType = subType.value form.value.label = tabChildren.value.filter((item: any) => item.code == subType.value)[0].label let copyForm = JSON.parse(JSON.stringify(form.value)) copyForm.channelList.forEach((channel: any) => { - // 筛选出 fAmp 和 fPhase 不同时为 0 的对象 - channel.harmList = channel.harmList.filter((item: any) => item.fAmp !== 0 || item.fPhase !== 0) + // 筛选出 famp 和 fphase 不同时为 0 的对象 + channel.harmList = channel.harmList.filter((item: any) => item.famp !== 0 || item.fphase !== 0) + channel.inHarmList = channel.inHarmList.filter( + (item: any) => item.inharm !== 0 || item.famp !== 0 || item.fphase !== 0 + ) + }) + console.log('🚀 ~ save ~ form.value:', copyForm) + addScriptDtls({ ...copyForm, scriptId: props.formContent.id, scriptType: props.activeName }).then(res => { + if (res.code === 'A0000') { + ElMessage.success({ message: res.message }) + dialogVisible.value = false + emit('addTab', form.value) + } }) - - addScriptDtls({ ...copyForm, id: props.formContent.id }).then(res => {}) // emit('addTab', form.value) } @@ -255,10 +272,22 @@ const open = (sign: string, row: any) => { .getDictData('Script_Value_Type') .filter(item => item.id == props.formContent.valueType)[0].code } +// 复制 +const copyRow = (index: number) => { + scriptForm.channelList[index + 2] = JSON.parse(JSON.stringify(scriptForm.channelList[index])) + scriptForm.channelList[index + 3] = JSON.parse(JSON.stringify(scriptForm.channelList[index + 1])) + scriptForm.channelList[index].channelType == 'Ua' + ? (scriptForm.channelList[index + 2].channelType = 'Ub') + : (scriptForm.channelList[index + 2].channelType = 'Uc') + scriptForm.channelList[index + 1].channelType == 'Ia' + ? (scriptForm.channelList[index + 3].channelType = 'Ib') + : (scriptForm.channelList[index + 3].channelType = 'Ic') + key.value += 1 +} // 打开 drawer(新增、编辑) const openDialog = () => { - setValueTable.value?.open() + setValueTableRef.value?.open() } // 对外映射 diff --git a/frontend/src/views/machine/testScript/components/testScriptDetail.vue b/frontend/src/views/machine/testScript/components/testScriptDetail.vue index d58c92c..ca2124b 100644 --- a/frontend/src/views/machine/testScript/components/testScriptDetail.vue +++ b/frontend/src/views/machine/testScript/components/testScriptDetail.vue @@ -1,103 +1,266 @@ - diff --git a/frontend/src/views/machine/testScript/components/testScriptDipTab.vue b/frontend/src/views/machine/testScript/components/testScriptDipTab.vue index f6fb315..1ea9443 100644 --- a/frontend/src/views/machine/testScript/components/testScriptDipTab.vue +++ b/frontend/src/views/machine/testScript/components/testScriptDipTab.vue @@ -27,10 +27,10 @@
- + - +
diff --git a/frontend/src/views/machine/testScript/components/testScriptFlickerTab.vue b/frontend/src/views/machine/testScript/components/testScriptFlickerTab.vue index 6b9b07a..0b63857 100644 --- a/frontend/src/views/machine/testScript/components/testScriptFlickerTab.vue +++ b/frontend/src/views/machine/testScript/components/testScriptFlickerTab.vue @@ -5,12 +5,12 @@
- +
- +
- +
diff --git a/frontend/src/views/machine/testScript/components/testScriptHarmTab.vue b/frontend/src/views/machine/testScript/components/testScriptHarmTab.vue index 0a6279f..845a2fa 100644 --- a/frontend/src/views/machine/testScript/components/testScriptHarmTab.vue +++ b/frontend/src/views/machine/testScript/components/testScriptHarmTab.vue @@ -9,7 +9,7 @@ @@ -17,7 +17,7 @@ @@ -28,7 +28,7 @@ @@ -36,7 +36,7 @@ @@ -54,7 +54,7 @@ @@ -62,7 +62,7 @@ @@ -73,7 +73,7 @@ @@ -81,7 +81,7 @@ diff --git a/frontend/src/views/machine/testScript/components/testScriptInHarmTab.vue b/frontend/src/views/machine/testScript/components/testScriptInHarmTab.vue index 04f8136..9910a5b 100644 --- a/frontend/src/views/machine/testScript/components/testScriptInHarmTab.vue +++ b/frontend/src/views/machine/testScript/components/testScriptInHarmTab.vue @@ -10,7 +10,7 @@
- + 添加 @@ -26,7 +26,7 @@ - + 删除 @@ -54,7 +54,7 @@ const num = ref(0) // 添加间谐波 const inHarmFlagAdd = () => { - props.childForm[0].inHarmList.push({ inharm: '0', fAmp: '0', fPhase: '0' }) + props.childForm[0].inHarmList.push({ inharm: '0', fAmp: '0', fphase: '0' }) num.value += 1 } // 删除 diff --git a/frontend/src/views/machine/testScript/components/testScriptPopup.vue b/frontend/src/views/machine/testScript/components/testScriptPopup.vue index 5c822f9..ff9ac06 100644 --- a/frontend/src/views/machine/testScript/components/testScriptPopup.vue +++ b/frontend/src/views/machine/testScript/components/testScriptPopup.vue @@ -138,8 +138,8 @@ const save = () => { pqScriptAdd(formContent.value).then(res => { if (res.code === 'A0000') { ElMessage.success({ message: res.message }) - // scriptId.value = res.data - formContent.value.id = '46296b72528f805376e362df594fc669' + formContent.value.id = JSON.stringify(res.data) + titleType.value == '编辑检测脚本' show.value = true } }) @@ -171,13 +171,13 @@ const open = async (title: string, row: any) => { // 获取树字典 const treeInfo = async (currentMode: string) => { const data: Dict.ResDictTree = { - name: '', - id: '', - pid: '', - pids: '', - code: 'Script_Indicator_Items', - sort: 0 - }; + name: '', + id: '', + pid: '', + pids: '', + code: 'Script_Indicator_Items', + sort: 0 + } const result = await getDictTreeByCode(data) const allOptions = convertToOptions(result.data as Dict.ResDictTree[]) secondLevelOptions.push(...(allOptions[0]?.children || [])) @@ -198,7 +198,7 @@ onMounted(() => { const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => { return dictTree.map(item => ({ value: item.id, - code: item.code, + code: item.code.split('-')[1] || item.code.split('-')[0], label: item.name, children: item.children ? convertToOptions(item.children) : undefined })) diff --git a/frontend/src/views/machine/testScript/components/testScriptVolCurTab.vue b/frontend/src/views/machine/testScript/components/testScriptVolCurTab.vue index e6c7372..a68bbc0 100644 --- a/frontend/src/views/machine/testScript/components/testScriptVolCurTab.vue +++ b/frontend/src/views/machine/testScript/components/testScriptVolCurTab.vue @@ -9,16 +9,16 @@ - + - + - + - +
diff --git a/frontend/src/views/machine/testScript/components/tree.vue b/frontend/src/views/machine/testScript/components/tree.vue index 3566963..4832dc7 100644 --- a/frontend/src/views/machine/testScript/components/tree.vue +++ b/frontend/src/views/machine/testScript/components/tree.vue @@ -1,9 +1,9 @@