|
@@ -144,20 +144,27 @@ const props = defineProps({
|
|
type: [String,Number],
|
|
type: [String,Number],
|
|
default: ''
|
|
default: ''
|
|
},
|
|
},
|
|
|
|
+ primaryKeyId: {
|
|
|
|
+ type: [String,Number],
|
|
|
|
+ default: ''
|
|
|
|
+ },
|
|
})
|
|
})
|
|
const {isString, getObjNullValue, getArrValue} = isType()
|
|
const {isString, getObjNullValue, getArrValue} = isType()
|
|
const {setPosInsert, setPosRange} = utilsText()
|
|
const {setPosInsert, setPosRange} = utilsText()
|
|
const listDatas = ref(props.datas)
|
|
const listDatas = ref(props.datas)
|
|
const classify = ref(props.classify)
|
|
const classify = ref(props.classify)
|
|
const isStatus = ref(props.status)
|
|
const isStatus = ref(props.status)
|
|
|
|
+const isPrimaryKeyId = ref(props.primaryKeyId)
|
|
|
|
|
|
//监听
|
|
//监听
|
|
watch(() => [
|
|
watch(() => [
|
|
props.datas,
|
|
props.datas,
|
|
props.classify,
|
|
props.classify,
|
|
-], ([datas, classifyVal]) => {
|
|
|
|
|
|
+ props.primaryKeyId,
|
|
|
|
+], ([datas, classifyVal, primaryKeyId]) => {
|
|
listDatas.value = datas
|
|
listDatas.value = datas
|
|
classify.value = classifyVal
|
|
classify.value = classifyVal
|
|
|
|
+ isPrimaryKeyId.value = primaryKeyId
|
|
setFormDataNum(datas)
|
|
setFormDataNum(datas)
|
|
})
|
|
})
|
|
|
|
|
|
@@ -181,6 +188,7 @@ const getFormDataInit = (item, pkeyId) => {
|
|
contractId: item?.contractId,
|
|
contractId: item?.contractId,
|
|
classify: classify.value,
|
|
classify: classify.value,
|
|
pkeyId: pkeyId ? pkeyId + '' : '',
|
|
pkeyId: pkeyId ? pkeyId + '' : '',
|
|
|
|
+ nodeId: isPrimaryKeyId.value
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -240,7 +248,7 @@ const getExcelHtml = async (item,index) => {
|
|
},
|
|
},
|
|
//表单正则效验
|
|
//表单正则效验
|
|
onBlur: (event, key, reg, val, msg) => {
|
|
onBlur: (event, key, reg, val, msg) => {
|
|
- setTableFormBlurReg(pkeyIds, event, key, reg, val, msg, item)
|
|
|
|
|
|
+ setTableFormBlurReg(pkeyIds, event, key, reg, val, msg, item, index)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
item.isTableFormRender = true
|
|
item.isTableFormRender = true
|
|
@@ -258,7 +266,7 @@ const getExcelHtml = async (item,index) => {
|
|
}
|
|
}
|
|
|
|
|
|
//正则效验
|
|
//正则效验
|
|
-const setTableFormBlurReg = (pkeyId, event, key, reg, val, msg, item) => {
|
|
|
|
|
|
+const setTableFormBlurReg = (pkeyId, event, key, reg, val, msg, item, index) => {
|
|
const dom = document.getElementById(key).parentElement
|
|
const dom = document.getElementById(key).parentElement
|
|
if (val && reg) {
|
|
if (val && reg) {
|
|
let regx = new RegExp(reg);
|
|
let regx = new RegExp(reg);
|
|
@@ -270,7 +278,7 @@ const setTableFormBlurReg = (pkeyId, event, key, reg, val, msg, item) => {
|
|
window?.$message?.warning(msg)
|
|
window?.$message?.warning(msg)
|
|
}
|
|
}
|
|
//暂存
|
|
//暂存
|
|
- formRegExpJson.value[pkeyId] = {key, reg, val, msg, state, nodeName: item.nodeName}
|
|
|
|
|
|
+ formRegExpJson.value[pkeyId] = {key, reg, val, msg, state, nodeName: item.nodeName, itemId: `item-${index}-${item?.pkeyId}`}
|
|
} else {
|
|
} else {
|
|
delete formRegExpJson.value[pkeyId]
|
|
delete formRegExpJson.value[pkeyId]
|
|
dom.style = ''
|
|
dom.style = ''
|
|
@@ -659,10 +667,22 @@ const getFormRegExpJson = () => {
|
|
return deepClone(formRegExpJson.value);
|
|
return deepClone(formRegExpJson.value);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//获取当前展开项
|
|
|
|
+const getActiveKey = () => {
|
|
|
|
+ return ActiveKey.value;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//设置当前展开项
|
|
|
|
+const setActiveKey = (key) => {
|
|
|
|
+ return ActiveKey.value = key;
|
|
|
|
+}
|
|
|
|
+
|
|
// 暴露出去
|
|
// 暴露出去
|
|
defineExpose({
|
|
defineExpose({
|
|
getFormData,
|
|
getFormData,
|
|
- getFormRegExpJson
|
|
|
|
|
|
+ getFormRegExpJson,
|
|
|
|
+ getActiveKey,
|
|
|
|
+ setActiveKey
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|