|
@@ -61,6 +61,10 @@ const props = defineProps({
|
|
|
type: Object,
|
|
|
default: () => ({})
|
|
|
},
|
|
|
+ nodeName: { // 表单名称
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
//初始变量
|
|
@@ -74,6 +78,7 @@ const tableFormItemStyle = ref('')
|
|
|
const loading = ref(false)
|
|
|
const isScroll = ref(props.scroll)
|
|
|
const changeData = ref(props.datas)
|
|
|
+const nodeNames = ref(props.nodeName)
|
|
|
|
|
|
//监听
|
|
|
watch(() => [
|
|
@@ -84,14 +89,16 @@ watch(() => [
|
|
|
props.classify,
|
|
|
props.width,
|
|
|
props.height,
|
|
|
- props.scroll
|
|
|
-], ([project_id, contract_id, tree_id, key_id, cid, width, height, scroll]) => {
|
|
|
+ props.scroll,
|
|
|
+ props.nodeName
|
|
|
+], ([project_id, contract_id, tree_id, key_id, cid, width, height, scroll, nodeName]) => {
|
|
|
projectId.value = project_id
|
|
|
contractId.value = contract_id
|
|
|
treeId.value = tree_id
|
|
|
keyId.value = key_id ? key_id + '' : ''
|
|
|
classify.value = cid
|
|
|
isScroll.value = scroll
|
|
|
+ nodeNames.value = nodeName
|
|
|
setItemStyle(width, height)
|
|
|
})
|
|
|
|
|
@@ -254,19 +261,19 @@ const setTableFormBlurReg = (pkeyId, event, key, reg, val, msg) => {
|
|
|
let regx = new RegExp(reg);
|
|
|
let state = regx.test(val);
|
|
|
if (state) {
|
|
|
- formRegExpJson.value = {}
|
|
|
+ delete formRegExpJson.value[key]
|
|
|
dom.style = ''
|
|
|
} else {
|
|
|
- formRegExpJson.value = {key, reg, val, msg, state}
|
|
|
+ formRegExpJson.value[key] = {key, reg, val, msg, state}
|
|
|
dom.style = '--el-input-border-color: #fe0000; box-shadow: 0 0 0 2px #fe0000 inset;'
|
|
|
window?.$message?.warning(msg)
|
|
|
}
|
|
|
} else {
|
|
|
- formRegExpJson.value = {}
|
|
|
+ delete formRegExpJson.value[key]
|
|
|
dom.style = ''
|
|
|
}
|
|
|
} else {
|
|
|
- formRegExpJson.value = {}
|
|
|
+ delete formRegExpJson.value[key]
|
|
|
dom.style = ''
|
|
|
}
|
|
|
}
|
|
@@ -297,8 +304,12 @@ const getRegExpJson = () => {
|
|
|
return deepClone(formRegExpJson.value);
|
|
|
}
|
|
|
|
|
|
+const getNodeName = () => {
|
|
|
+ return nodeNames.value
|
|
|
+}
|
|
|
+
|
|
|
//正则效验
|
|
|
-const isFormRegExp = () => {
|
|
|
+const isFormRegExp = async () => {
|
|
|
const isRegExp = !!getObjNullValue(formRegExpJson.value)
|
|
|
if (!isRegExp) {
|
|
|
return true
|
|
@@ -313,7 +324,8 @@ defineExpose({
|
|
|
getFormData,
|
|
|
setFormData,
|
|
|
getRegExpJson,
|
|
|
- isFormRegExp
|
|
|
+ isFormRegExp,
|
|
|
+ getNodeName
|
|
|
})
|
|
|
</script>
|
|
|
|