|
@@ -1159,7 +1159,7 @@ const handWritClick = () => {
|
|
|
try {
|
|
|
let { text, eleMap } = formulaArrayToString(processFormula.value, resultFormula.value)
|
|
|
handWritText.value = text
|
|
|
- handWritEleMap.value = eleMap
|
|
|
+ handWritEleMap.value = JSON.stringify(eleMap)
|
|
|
isHandWritEle.value = true
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
@@ -1169,13 +1169,26 @@ const handWritClick = () => {
|
|
|
|
|
|
//手写模式转换
|
|
|
const handWritTransform = () => {
|
|
|
-
|
|
|
- handWritEleClose()
|
|
|
+ try {
|
|
|
+ let formula = formulaStringToArray(handWritText.value, handWritEleMap.value, formulaMenuMap.value)
|
|
|
+ processFormula.value = getArrValue(formula.processFormula)
|
|
|
+ const results = resultFormula.value
|
|
|
+ formula.resultFormula[0].id = results[0].id
|
|
|
+ formula.resultFormula[0].name = results[0].name
|
|
|
+ formula.resultFormula[0].tableElementKey = results[0].tableElementKey
|
|
|
+ resultFormula.value[0].children = formula.resultFormula[0].children
|
|
|
+ handWritEleClose()
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ window?.$message.error('转成配置用的数组失败')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//手写模式关闭
|
|
|
const handWritEleClose = () => {
|
|
|
isHandWritEle.value = false
|
|
|
+ handWritText.value = ''
|
|
|
+ handWritEleMap.value = {}
|
|
|
}
|
|
|
|
|
|
//保存
|
|
@@ -1184,9 +1197,83 @@ const submitClick = async () => {
|
|
|
if (isResetFun.value) {
|
|
|
//重置函数
|
|
|
setProcessFormula()
|
|
|
- } else if (deviationRangeShow.value) {
|
|
|
+ } else {
|
|
|
//允许偏差值范围
|
|
|
- console.log('1111')
|
|
|
+ const result = deviationRangeResult.value
|
|
|
+ deviationRangeObj.value = {
|
|
|
+ symbol: deviationRangeSymbol.value,
|
|
|
+ model: result,
|
|
|
+ arguments1: result === '2' ? selectEleFormula3.value : deviationRangeTag1.value,
|
|
|
+ arguments2: result === '2' ? selectEleFormula4.value : deviationRangeTag2.value,
|
|
|
+ }
|
|
|
+ //处理数据
|
|
|
+ const process = processFormula.value, results = resultFormula.value
|
|
|
+ let obj = formulaArrayToString(process, results)
|
|
|
+ let deviationRangeText = rangeToString(deviationRangeObj.value, obj.eleMap)
|
|
|
+ obj.eleMap.deviationRangeJson = JSON.stringify(deviationRangeObj.value)
|
|
|
+ //特殊公式会有number
|
|
|
+ let number = ''
|
|
|
+ for (let i = 0; i < process.length; i++) {
|
|
|
+ if (process[i].children) {
|
|
|
+ for (let j = 0; j < process[i].children.length; j++) {
|
|
|
+ if (process[i].children[j].number) {
|
|
|
+ number = process[i].children[j].number
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (number) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (number === '') {
|
|
|
+ for (let i = 0; i < results.length; i++) {
|
|
|
+ if (results[i].children) {
|
|
|
+ for (let j = 0; j < results[i].children.length; j++) {
|
|
|
+ if (results[i].children[j].number) {
|
|
|
+ number = results[i].children[j].number
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (number) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //发起请求
|
|
|
+ const { eleId, globalType, nodeId, pid } = getObjValue(dataInfo.value)
|
|
|
+ if (isNullES(formulaId.value)) {
|
|
|
+ //新增
|
|
|
+ const { code } = await formulaApi.save({
|
|
|
+ formula:obj.text,
|
|
|
+ remark:'',
|
|
|
+ nodeId:nodeId,
|
|
|
+ elementId:eleId,
|
|
|
+ scale:isRetain.value ? retainNum.value : '',
|
|
|
+ number:number,
|
|
|
+ map:JSON.stringify(obj.eleMap),
|
|
|
+ scope:globalType,
|
|
|
+ projectId:projectId.value || pid,
|
|
|
+ dev:deviationRangeText,
|
|
|
+ ver:1,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ //更新
|
|
|
+ const { code } = await formulaApi.update({
|
|
|
+ id: formulaId.value,
|
|
|
+ formula:obj.text,
|
|
|
+ remark:'',
|
|
|
+ nodeId:nodeId,
|
|
|
+ elementId:eleId,
|
|
|
+ scale:isRetain.value ? retainNum.value : '',
|
|
|
+ number:number,
|
|
|
+ map:JSON.stringify(obj.eleMap),
|
|
|
+ scope:globalType,
|
|
|
+ projectId:projectId.value || pid,
|
|
|
+ dev:deviationRangeText,
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1214,6 +1301,10 @@ const drawerClose = () => {
|
|
|
selectEleFormula.value = []
|
|
|
selectEleFormula3.value = []
|
|
|
selectEleFormula4.value = []
|
|
|
+ //手写模式
|
|
|
+ isHandWritEle.value = false
|
|
|
+ handWritText.value = ''
|
|
|
+ handWritEleMap.value = {}
|
|
|
emit('close')
|
|
|
}
|
|
|
}
|