| | |
| | | |
| | | const props = defineProps({ |
| | | //表单基本信息 |
| | | formInfo: Object, |
| | | formInfo: { |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | } |
| | | }, |
| | | //表单检验规则 |
| | | rules: Object, |
| | | showButtons: { |
| | |
| | | _locations: [ |
| | | { |
| | | required: true, |
| | | // message: '行政区划不能为空', |
| | | trigger: 'change', |
| | | validator: (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error('Please input the age')); |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | message: '行政区划不能为空', |
| | | trigger: 'change' |
| | | } |
| | | ], |
| | | _scenetype: [ |
| | | { |
| | | required: true, |
| | | message: '场景类型不能为空', |
| | | trigger: 'change', |
| | | validator: (rule, value, callback) => { |
| | | if (!value) { |
| | | callback(new Error('Please input the age')); |
| | | } else { |
| | | callback() |
| | | } |
| | | } |
| | | trigger: 'change' |
| | | } |
| | | ] |
| | | }); |
| | |
| | | (nValue) => { |
| | | formObj.value = nValue; |
| | | }, |
| | | { deep: true, immediate: true } |
| | | { deep: false, immediate: true } |
| | | ); |
| | | |
| | | //监听表单重置功能触发 |
| | |
| | | ); |
| | | |
| | | //监听表单编辑状态 |
| | | watch(edit, (nValue) => { |
| | | emit('update:isEdit', nValue); |
| | | watch( |
| | | () => props.isEdit, |
| | | (nV, oV) => { |
| | | if (nV != oV) { |
| | | edit.value = nV; |
| | | } |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | watch(edit, (nV, oV) => { |
| | | if (nV != oV) { |
| | | emit('update:isEdit', nV); |
| | | } |
| | | }); |
| | | |
| | | defineExpose({ onSubmit, onCancel, onReset }); |
| | | defineExpose({ formObj, onSubmit, onCancel, onReset }); |
| | | </script> |
| | | |
| | | <style scoped></style> |