切换数据处理原则

This commit is contained in:
caozehui
2025-12-10 11:15:18 +08:00
parent 6334681dc5
commit 03d1db3bb4
3 changed files with 54 additions and 31 deletions

View File

@@ -83,7 +83,8 @@ export const reCalculate = (params: {
deviceId: string deviceId: string
code: string code: string
patternId: string, patternId: string,
chnNum: string chnNum?: string,
dataRuleId: string
}) => { }) => {
return http.post('/result/reCalculate', params, {loading: true}) return http.post('/result/reCalculate', params, {loading: true})
} }
@@ -115,6 +116,7 @@ export const getContrastResult = (params: {
waveNum: number | null waveNum: number | null
isWave: boolean isWave: boolean
patternId: string patternId: string
code: string
}) => { }) => {
return http.post('/result/getContrastResult', params, {loading: true}) return http.post('/result/getContrastResult', params, {loading: true})
} }
@@ -130,7 +132,8 @@ export const changeErrorSystem = (params: {
deviceId: string deviceId: string
code: string code: string
patternId: string, patternId: string,
chnNum: string chnNum?: string,
dataRuleId: string
}) => { }) => {
return http.post('/result/changeErrorSystem', params, {loading: true}) return http.post('/result/changeErrorSystem', params, {loading: true})
} }

View File

@@ -18,7 +18,7 @@
v-model="formContent.errorSysId" v-model="formContent.errorSysId"
placeholder="请选择误差体系" placeholder="请选择误差体系"
autocomplete="off" autocomplete="off"
@change="handleErrorSysChange" @change="handleErrorSysChange('切换误差体系成功')"
> >
<el-option <el-option
v-for="option in pqErrorList" v-for="option in pqErrorList"
@@ -29,7 +29,20 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="数据原则"> <el-form-item label="数据原则">
<el-input v-model="formContent.dataRule" :disabled="true" /> <!-- <el-input v-model="formContent.dataRule" :disabled="true" />-->
<el-select
:disabled="checkStore.showDetailType === 2 || checkStore.showDetailType === 0"
v-model="formContent.dataRule"
placeholder="请选择数据原则"
autocomplete="off"
@change="handleErrorSysChange('切换数据处理原则成功')">
<el-option
v-for="item in dictStore.getDictData('Data_Rule')"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备名称"> <el-form-item label="设备名称">
<el-input v-model="formContent.deviceName" :disabled="true" /> <el-input v-model="formContent.deviceName" :disabled="true" />
@@ -392,6 +405,7 @@ const getBasicInformation = async (scriptType: any) => {
}) })
formContent.dataRule = res.data.dataRule formContent.dataRule = res.data.dataRule
console.log('formContent.dataRule',formContent.dataRule)
formContent.deviceName = res.data.deviceName formContent.deviceName = res.data.deviceName
formContent.errorSysId = res.data.errorSysId formContent.errorSysId = res.data.errorSysId
chnMapList.value = res.data.chnMap chnMapList.value = res.data.chnMap
@@ -507,6 +521,7 @@ const getResults = async (code: any) => {
// 判断是否为录波数据请求 // 判断是否为录波数据请求
const isWaveDataRequest = code === 'wave_data' || isWaveData.value const isWaveDataRequest = code === 'wave_data' || isWaveData.value
console.log(checkStore.plan)
getContrastResult({ getContrastResult({
planId: checkStore.plan.id, planId: checkStore.plan.id,
scriptType: rowList.value.scriptType, scriptType: rowList.value.scriptType,
@@ -515,7 +530,8 @@ const getResults = async (code: any) => {
num: formContent.num == '' ? null : formContent.num, num: formContent.num == '' ? null : formContent.num,
waveNum: isWaveDataRequest ? waveNumber.value : null, waveNum: isWaveDataRequest ? waveNumber.value : null,
isWave: isWaveDataRequest, isWave: isWaveDataRequest,
patternId: pattern.value patternId: pattern.value,
code: checkStore.plan.code + (formContent.errorSysId!=checkStore.plan.errorSysId || formContent.dataRule!=checkStore.plan.dataRule? '_temp':'')
}).then((res: any) => { }).then((res: any) => {
let list: string[] = [] let list: string[] = []
for (let key in res.data.resultMap) { for (let key in res.data.resultMap) {
@@ -556,7 +572,7 @@ const close = async () => {
} }
} }
const handleErrorSysChange = async () => { const handleErrorSysChange = async (msg:string) => {
changeErrorSystem({ changeErrorSystem({
planId: checkStore.plan.id, planId: checkStore.plan.id,
scriptId: '', scriptId: '',
@@ -564,10 +580,11 @@ const handleErrorSysChange = async () => {
deviceId: formContent.deviceId, deviceId: formContent.deviceId,
code: checkStore.plan.code + '', code: checkStore.plan.code + '',
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '', patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
chnNum: formContent.chnNum chnNum: formContent.chnNum,
dataRuleId: formContent.dataRule
}).then(res => { }).then(res => {
if (res.code === ResultEnum.SUCCESS) { if (res.code === ResultEnum.SUCCESS) {
ElMessage.success('切换误差体系成功') ElMessage.success(msg)
handleChnNumChange(formContent.chnNum) handleChnNumChange(formContent.chnNum)
} }
}) })
@@ -581,7 +598,8 @@ const handleReCalculate = async () => {
deviceId: formContent.deviceId, deviceId: formContent.deviceId,
code: checkStore.plan.code + '', code: checkStore.plan.code + '',
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '', patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
chnNum: formContent.chnNum chnNum: formContent.chnNum,
dataRuleId: formContent.dataRule,
}).then(res => { }).then(res => {
if (res.code === ResultEnum.SUCCESS) { if (res.code === ResultEnum.SUCCESS) {
ElMessage.success('重新计算成功!') ElMessage.success('重新计算成功!')

View File

@@ -22,7 +22,7 @@
v-model="formContent.errorSysId" v-model="formContent.errorSysId"
placeholder="请选择误差体系" placeholder="请选择误差体系"
autocomplete="off" autocomplete="off"
@change="handleErrorSysChange" @change="handleErrorSysChange('切换误差体系成功')"
> >
<el-option <el-option
v-for="option in pqErrorList" v-for="option in pqErrorList"
@@ -33,7 +33,20 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="数据原则"> <el-form-item label="数据原则">
<el-input v-model="formContent.dataRule" :disabled="true" /> <!-- <el-input v-model="formContent.dataRule" :disabled="true" />-->
<el-select
:disabled="checkStore.showDetailType === 2 || checkStore.showDetailType === 0"
v-model="formContent.dataRule"
placeholder="请选择数据原则"
autocomplete="off"
@change="handleErrorSysChange('切换数据处理原则成功')">
<el-option
v-for="item in dictStore.getDictData('Data_Rule')"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备名称"> <el-form-item label="设备名称">
<el-input v-model="formContent.deviceName" :disabled="true" /> <el-input v-model="formContent.deviceName" :disabled="true" />
@@ -203,7 +216,6 @@ const formContent = reactive<CheckData.DataCheck>({
}) })
// 原始误差体系id // 原始误差体系id
let originErrorSysId: string = '' let originErrorSysId: string = ''
let planCode: string = ''
// 谐波次数列表 // 谐波次数列表
// const harmNumList = reactive<{ value: string, label: string }[]>([]) // const harmNumList = reactive<{ value: string, label: string }[]>([])
// 当前选中的检测项 // 当前选中的检测项
@@ -273,7 +285,7 @@ const handleNodeClick = async (data: any) => {
} }
} }
const handleErrorSysChange = async () => { const handleErrorSysChange = async (msg:string) => {
changeErrorSystem({ changeErrorSystem({
planId: checkStore.plan.id, planId: checkStore.plan.id,
@@ -281,15 +293,11 @@ const handleErrorSysChange = async () => {
errorSysId: formContent.errorSysId, errorSysId: formContent.errorSysId,
deviceId: deviceId, deviceId: deviceId,
code: checkStore.plan.code + '', code: checkStore.plan.code + '',
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '' patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
dataRuleId: formContent.dataRule
}).then(res => { }).then(res => {
if (res.code === ResultEnum.SUCCESS) { if (res.code === ResultEnum.SUCCESS) {
ElMessage.success('切换误差体系成功') ElMessage.success(msg)
if (originErrorSysId != formContent.errorSysId) {
planCode = checkStore.plan.code + '_temp'
} else {
planCode = checkStore.plan.code + ''
}
if (formContent.chnNum != chnList[0].value) { if (formContent.chnNum != chnList[0].value) {
formContent.chnNum = chnList[0].value formContent.chnNum = chnList[0].value
} else { } else {
@@ -317,7 +325,7 @@ const handleChnNumChange = async () => {
devId: deviceId, devId: deviceId,
devNum: formContent.chnNum + '', devNum: formContent.chnNum + '',
scriptType: originScriptType, scriptType: originScriptType,
code: planCode code: checkStore.plan.code + (formContent.errorSysId!=checkStore.plan.errorSysId || formContent.dataRule!=checkStore.plan.dataRule? '_temp':'')
}) })
updateTreeFly(resTreeDataTemp, 4) updateTreeFly(resTreeDataTemp, 4)
updateTreeFly(resTreeDataTemp, 2) updateTreeFly(resTreeDataTemp, 2)
@@ -379,7 +387,7 @@ const updateTableData = async () => {
scriptId: checkStore.plan.scriptId, scriptId: checkStore.plan.scriptId,
devId: deviceId, devId: deviceId,
devNum: formContent.chnNum + '', devNum: formContent.chnNum + '',
code: planCode, code: checkStore.plan.code + (formContent.errorSysId!=checkStore.plan.errorSysId || formContent.dataRule!=checkStore.plan.dataRule? '_temp':''),
index: parseInt(checkIndex.value) index: parseInt(checkIndex.value)
}) })
@@ -473,7 +481,6 @@ const doCurrentCheckItemUpdate = (newVal: string) => {
} }
const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => { const open = async (_deviceId: string, chnNum: string, _scriptType: string | null) => {
planCode = checkStore.plan.code + ''
deviceId = _deviceId deviceId = _deviceId
originScriptType = _scriptType originScriptType = _scriptType
scriptType = _scriptType scriptType = _scriptType
@@ -510,7 +517,7 @@ const handleGenerateReport = async () => {
planId: checkStore.plan.id, planId: checkStore.plan.id,
devIdList: [deviceId], devIdList: [deviceId],
scriptId: checkStore.plan.scriptId, scriptId: checkStore.plan.scriptId,
planCode: planCode planCode: checkStore.plan.code + (formContent.errorSysId!=checkStore.plan.errorSysId || formContent.dataRule!=checkStore.plan.dataRule? '_temp':'')
}) })
ElMessage.success({ message: `报告生成成功!` }) ElMessage.success({ message: `报告生成成功!` })
} }
@@ -522,14 +529,10 @@ const handleReCalculate = async () => {
errorSysId: formContent.errorSysId, errorSysId: formContent.errorSysId,
deviceId: deviceId, deviceId: deviceId,
code: checkStore.plan.code + '', code: checkStore.plan.code + '',
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '' patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
dataRuleId: formContent.dataRule
}).then(res => { }).then(res => {
ElMessage.success('重新计算成功!') ElMessage.success('重新计算成功!')
// if (originErrorSysId != formContent.errorSysId) {
// planCode = checkStore.plan.code + "_temp"
// } else {
// planCode = checkStore.plan.code + ''
// }
if (formContent.chnNum != chnList[0].value) { if (formContent.chnNum != chnList[0].value) {
formContent.chnNum = chnList[0].value formContent.chnNum = chnList[0].value
} else { } else {
@@ -560,7 +563,6 @@ const close = async () => {
currentScriptTypeName.value = '' currentScriptTypeName.value = ''
currentDesc.value = '' currentDesc.value = ''
pqErrorList.length = 0 pqErrorList.length = 0
planCode = ''
visible.value = false visible.value = false