fix(数据集): 数据集添加计算参数

This commit is contained in:
dataeaseShu 2024-08-08 15:25:07 +08:00
parent ab9687ddf3
commit 74490007da

View File

@ -64,7 +64,6 @@ const state = reactive({
functionData: [], functionData: [],
dimensionData: [], dimensionData: [],
dimensionList: [], dimensionList: [],
quotaList: [],
quotaData: [] quotaData: []
}) })
const formQuotaRef = ref() const formQuotaRef = ref()
@ -96,13 +95,11 @@ const formQuotaConfirm = () => {
const q = cloneDeep(unref(formQuota)) const q = cloneDeep(unref(formQuota))
fieldForm.params = [q] fieldForm.params = [q]
const i = state.quotaData.find(ele => ele.id === formQuota.id) const i = state.quotaData.find(ele => ele.id === formQuota.id)
const j = state.quotaList.find(ele => ele.id === formQuota.id) if (i) {
if (i && j) {
const str = mirror.value.state.doc.toString() const str = mirror.value.state.doc.toString()
const name2Auto = [] const name2Auto = []
fieldForm.originName = setNameIdTrans('name', 'id', str, name2Auto) fieldForm.originName = setNameIdTrans('name', 'id', str, name2Auto)
Object.assign(i, cloneDeep(unref(formQuota))) Object.assign(i, cloneDeep(unref(formQuota)))
Object.assign(j, cloneDeep(unref(formQuota)))
nextTick(() => { nextTick(() => {
mirror.value.dispatch({ mirror.value.dispatch({
@ -115,7 +112,6 @@ const formQuotaConfirm = () => {
}) })
} else { } else {
state.quotaData.push(q) state.quotaData.push(q)
state.quotaList.push(q)
} }
formQuotaClose() formQuotaClose()
} }
@ -263,9 +259,10 @@ defineExpose({
fieldForm, fieldForm,
formField formField
}) })
const parmasTitle = ref('')
const addParmasToQuota = () => { const addParmasToQuota = () => {
if (disableCaParams.value) return if (disableCaParams.value) return
parmasTitle.value = '添加计算参数'
if (!fieldForm.params) { if (!fieldForm.params) {
fieldForm.params = [] fieldForm.params = []
} }
@ -274,6 +271,7 @@ const addParmasToQuota = () => {
const updateParmasToQuota = () => { const updateParmasToQuota = () => {
const [o] = fieldForm.params const [o] = fieldForm.params
parmasTitle.value = '编辑计算参数'
Object.assign(formQuota, o || {}) Object.assign(formQuota, o || {})
dialogFormVisible.value = true dialogFormVisible.value = true
} }
@ -289,7 +287,6 @@ const delParmasToQuota = () => {
const name2Auto = [] const name2Auto = []
fieldForm.originName = setNameIdTrans('name', 'id', str, name2Auto).replaceAll(`[${o.id}]`, '') fieldForm.originName = setNameIdTrans('name', 'id', str, name2Auto).replaceAll(`[${o.id}]`, '')
state.quotaData = state.quotaData.filter(ele => ele.id !== o.id) state.quotaData = state.quotaData.filter(ele => ele.id !== o.id)
state.quotaList = state.quotaList.filter(ele => ele.id !== o.id)
mirror.value.dispatch({ mirror.value.dispatch({
changes: { changes: {
from: 0, from: 0,