|
@@ -1,10 +1,15 @@
|
|
|
import { FormSchema } from '/@/components/Form';
|
|
|
import {ref} from "vue";
|
|
|
import {ComponentTypes} from "@/views/system/menu/menu/menu.data";
|
|
|
-import {checkAppNameisExist, checkMenuInfoisExist} from "@/views/appmanage/AppBaseInfo.api";
|
|
|
+import {
|
|
|
+ checkAppNameisEdit,
|
|
|
+ checkAppNameisExist
|
|
|
+} from "@/views/appmanage/AppBaseInfo.api";
|
|
|
|
|
|
|
|
|
export const menuInfoisshow = ref(false)
|
|
|
+export const isCheckAppName = ref("isAdd")// 是否触发应用名字校验规则(作为编辑表单时不触发)
|
|
|
+export const dataTsxappid = ref('')
|
|
|
|
|
|
const isValidIp = (_rule, value, callback) => {
|
|
|
if (!value) {
|
|
@@ -28,22 +33,54 @@ const isValidIpAddress = (ip) => {
|
|
|
return regex.test(ip);
|
|
|
};
|
|
|
|
|
|
-export const checkMenuInfo = async (_rule, value, callback) => {
|
|
|
- const res = await checkMenuInfoisExist(value)
|
|
|
- if (res === '该值可用!') {
|
|
|
- callback(); // 校验通过
|
|
|
- } else {
|
|
|
- callback(new Error(res)); // 校验失败
|
|
|
- }
|
|
|
-};
|
|
|
+// export const checkMenuInfo = async (_rule, value, callback) => {
|
|
|
+// console.log("checkMenuInfo"+isCheckAppName.value)
|
|
|
+// if(isCheckAppName.value === 'isEdit'){
|
|
|
+// const name = await checkMenuInfoisEdit(dataTsxappid.value)
|
|
|
+// if (value == name){
|
|
|
+// callback()
|
|
|
+// }else {
|
|
|
+// const res = await checkMenuInfoisExist(value)
|
|
|
+// console.log("乌拉:"+res)
|
|
|
+// if (res === '该值可用!') {
|
|
|
+// callback(); // 校验通过
|
|
|
+// } else {
|
|
|
+// callback(new Error(res)); // 校验失败
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// const res = await checkMenuInfoisExist(value)
|
|
|
+// console.log("芜湖:"+res)
|
|
|
+// if (res === '该值可用!') {
|
|
|
+// callback(); // 校验通过
|
|
|
+// } else {
|
|
|
+// callback(new Error(res)); // 校验失败
|
|
|
+// }
|
|
|
+// }
|
|
|
+// };
|
|
|
|
|
|
// 检查应用名字是否已经存在
|
|
|
export const checkAppName = async (_rule, value, callback) => {
|
|
|
- const res = await checkAppNameisExist(value)
|
|
|
- if (res === '检查通过') {
|
|
|
- callback(); // 校验通过
|
|
|
- } else {
|
|
|
- callback(new Error(res)); // 校验失败
|
|
|
+ if (isCheckAppName.value === 'isEdit'){
|
|
|
+ const name = await checkAppNameisEdit(dataTsxappid.value)
|
|
|
+ if (value == name){
|
|
|
+ callback()
|
|
|
+ }else {
|
|
|
+ const res = await checkAppNameisExist(value)
|
|
|
+ if (res === '检查通过') {
|
|
|
+ callback(); // 校验通过
|
|
|
+ } else {
|
|
|
+ callback(new Error(res)); // 校验失败
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ // @ts-ignore
|
|
|
+ const res = await checkAppNameisExist(value)
|
|
|
+ if (res === '检查通过') {
|
|
|
+ callback(); // 校验通过
|
|
|
+ } else {
|
|
|
+ callback(new Error(res)); // 校验失败
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -139,22 +176,19 @@ export const step1Schemas: FormSchema[] = [
|
|
|
span: 8,
|
|
|
},
|
|
|
},
|
|
|
- {
|
|
|
- field: 'menuInfo',
|
|
|
- component: 'Input',
|
|
|
- label: '菜单信息',
|
|
|
- ifShow: ({ values }) => !(values.component === ComponentTypes.IFrame && values.internalOrExternal),
|
|
|
- rules:[{ validator: checkMenuInfo, trigger: 'blur'}],
|
|
|
- // dynamicRules: ({ model, schema, values }) => {
|
|
|
- // return checkPermDuplication(model, schema, values.menuType !== 2);
|
|
|
- // },
|
|
|
- show: ()=>{
|
|
|
- return menuInfoisshow.value
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 8,
|
|
|
- },
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // field: 'menuInfo',
|
|
|
+ // component: 'Input',
|
|
|
+ // label: '菜单信息',
|
|
|
+ // ifShow: ({ values }) => !(values.component === ComponentTypes.IFrame && values.internalOrExternal),
|
|
|
+ // rules:[{ validator: checkMenuInfo, trigger: 'blur'}],
|
|
|
+ // show: ()=>{
|
|
|
+ // return menuInfoisshow.value
|
|
|
+ // },
|
|
|
+ // colProps: {
|
|
|
+ // span: 8,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
{
|
|
|
field: 'descr',
|
|
|
component: 'InputTextArea',
|
|
@@ -660,14 +694,14 @@ export const registerFormCheckSchemas: FormSchema[] = [
|
|
|
span: 8,
|
|
|
},
|
|
|
},
|
|
|
- {
|
|
|
- field: 'menuInfo',
|
|
|
- component: 'Input',
|
|
|
- label: '菜单信息',
|
|
|
- colProps: {
|
|
|
- span: 8,
|
|
|
- },
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // field: 'menuInfo',
|
|
|
+ // component: 'Input',
|
|
|
+ // label: '菜单信息',
|
|
|
+ // colProps: {
|
|
|
+ // span: 8,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
{
|
|
|
field: 'descr',
|
|
|
component: 'InputTextArea',
|