|
@@ -62,8 +62,8 @@
|
|
filterOption: onFilterOption,
|
|
filterOption: onFilterOption,
|
|
onSearch: onSearch,
|
|
onSearch: onSearch,
|
|
onChange: (data) => {
|
|
onChange: (data) => {
|
|
- const item = optionsName.value && optionsName.value.find(ele => ele.ryId == data)
|
|
|
|
- setFieldsValue({ryNickName: item && item.ryNickName ? item.ryNickName : ''});
|
|
|
|
|
|
+ const item = optionsName.value && optionsName.value.find((ele) => ele.ryId == data);
|
|
|
|
+ setFieldsValue({ ryNickName: item && item.ryNickName ? item.ryNickName : '' });
|
|
},
|
|
},
|
|
},
|
|
},
|
|
colProps: {
|
|
colProps: {
|
|
@@ -91,11 +91,7 @@
|
|
span: 24,
|
|
span: 24,
|
|
},
|
|
},
|
|
componentProps: {
|
|
componentProps: {
|
|
- options: [
|
|
|
|
- { label: '无权编辑', value: 0 },
|
|
|
|
- { label: '不限时编辑', value: 1 },
|
|
|
|
- { label: '限时编辑', value: 2 },
|
|
|
|
- ],
|
|
|
|
|
|
+ options: getOptionList('editAuth', 1),
|
|
onChange: async (value) => {
|
|
onChange: async (value) => {
|
|
let params = await getFieldsValue();
|
|
let params = await getFieldsValue();
|
|
console.log('params', params);
|
|
console.log('params', params);
|
|
@@ -104,7 +100,7 @@
|
|
params.lookAuth = 1;
|
|
params.lookAuth = 1;
|
|
}
|
|
}
|
|
params.isEmpower = isEdit.value ? [] : params.isEmpower;
|
|
params.isEmpower = isEdit.value ? [] : params.isEmpower;
|
|
- setFieldsValue({...params, editAuth: value.target.value});
|
|
|
|
|
|
+ setFieldsValue({ ...params, editAuth: value.target.value });
|
|
updateSchema([
|
|
updateSchema([
|
|
{
|
|
{
|
|
field: 'editEndTime',
|
|
field: 'editEndTime',
|
|
@@ -141,6 +137,16 @@
|
|
disabledDate: (current) => {
|
|
disabledDate: (current) => {
|
|
return current && current < dayjs().endOf('day');
|
|
return current && current < dayjs().endOf('day');
|
|
},
|
|
},
|
|
|
|
+ onChange: (value) => {
|
|
|
|
+ updateSchema({
|
|
|
|
+ field: 'lookEndTime',
|
|
|
|
+ componentProps: {
|
|
|
|
+ disabledDate: (current) => {
|
|
|
|
+ return current && (current < dayjs().endOf('day') || current > dayjs(value));
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -152,10 +158,7 @@
|
|
span: 24,
|
|
span: 24,
|
|
},
|
|
},
|
|
componentProps: {
|
|
componentProps: {
|
|
- options: [
|
|
|
|
- { label: '不限时查看', value: 1 },
|
|
|
|
- { label: '限时查看', value: 2 },
|
|
|
|
- ],
|
|
|
|
|
|
+ options: getOptionList('lookAuth', 1),
|
|
onChange: (value) => {
|
|
onChange: (value) => {
|
|
updateSchema({
|
|
updateSchema({
|
|
field: 'lookEndTime',
|
|
field: 'lookEndTime',
|
|
@@ -190,10 +193,7 @@
|
|
span: 24,
|
|
span: 24,
|
|
},
|
|
},
|
|
componentProps: {
|
|
componentProps: {
|
|
- options: [
|
|
|
|
- { label: '不可授权', value: 0 },
|
|
|
|
- { label: '可授权他人', value: 1 },
|
|
|
|
- ],
|
|
|
|
|
|
+ options: getOptionList('isAuthor', 1),
|
|
onChange: (value) => {
|
|
onChange: (value) => {
|
|
updateSchema({
|
|
updateSchema({
|
|
field: 'isEmpower',
|
|
field: 'isEmpower',
|
|
@@ -215,7 +215,10 @@
|
|
},
|
|
},
|
|
},
|
|
},
|
|
];
|
|
];
|
|
- const [registerForm, { validate, getFieldsValue, resetFields, setFieldsValue, updateSchema }] = useForm({
|
|
|
|
|
|
+ const [
|
|
|
|
+ registerForm,
|
|
|
|
+ { validate, getFieldsValue, resetFields, setFieldsValue, updateSchema },
|
|
|
|
+ ] = useForm({
|
|
labelWidth: 110,
|
|
labelWidth: 110,
|
|
schemas,
|
|
schemas,
|
|
showActionButtonGroup: false,
|
|
showActionButtonGroup: false,
|
|
@@ -229,22 +232,58 @@
|
|
const [register, { closeModal }] = useModalInner(async (data) => {
|
|
const [register, { closeModal }] = useModalInner(async (data) => {
|
|
onSearch('');
|
|
onSearch('');
|
|
let checkAuthOther = await checkAuthOtherApi({ num: data.num });
|
|
let checkAuthOther = await checkAuthOtherApi({ num: data.num });
|
|
|
|
+ let setData = {
|
|
|
|
+ ...checkAuthOther,
|
|
|
|
+ ...data,
|
|
|
|
+ isEmpower: [data.canAuthLook ? 0 : '', data.canEditLook ? 1 : ''],
|
|
|
|
+ };
|
|
if (data) {
|
|
if (data) {
|
|
title.value = data.id ? '编辑授权' : '新增授权';
|
|
title.value = data.id ? '编辑授权' : '新增授权';
|
|
modelRef.value = data.id ? true : false;
|
|
modelRef.value = data.id ? true : false;
|
|
- console.log('checkAuthOther', checkAuthOther);
|
|
|
|
- setFieldsValue({
|
|
|
|
- ...data,
|
|
|
|
- isEmpower:[data.canAuthLook?0:'',data.canEditLook?1:'']
|
|
|
|
- });
|
|
|
|
|
|
+ setFieldsValue(setData);
|
|
} else {
|
|
} else {
|
|
title.value = '新增客户';
|
|
title.value = '新增客户';
|
|
}
|
|
}
|
|
updateSchema([
|
|
updateSchema([
|
|
{ field: 'isEmpower', ifShow: data.isAuthor == 1 },
|
|
{ field: 'isEmpower', ifShow: data.isAuthor == 1 },
|
|
- { field: 'isAuthor', componentProps: { disabled: !checkAuthOther} },
|
|
|
|
- { field: 'editEndTime', ifShow: data.editAuth == 2 },
|
|
|
|
- { field: 'lookEndTime', ifShow: data.lookAuth == 2 },
|
|
|
|
|
|
+ // {
|
|
|
|
+ // field: 'isAuthor',
|
|
|
|
+ // componentProps: { disabled: !setData.isAuthor },
|
|
|
|
+ // },
|
|
|
|
+ {
|
|
|
|
+ field: 'editAuth',
|
|
|
|
+ componentProps: { options: getOptionList('editAuth', setData.editAuth) },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'lookAuth',
|
|
|
|
+ componentProps: { options: getOptionList('lookAuth', setData.editAuth) },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'editEndTime',
|
|
|
|
+ ifShow: data.editAuth == 2,
|
|
|
|
+ componentProps: {
|
|
|
|
+ disabledDate: (current) => {
|
|
|
|
+ if (checkAuthOther.editEndTime) {
|
|
|
|
+ return current && (current < dayjs().endOf('day') || current > dayjs(checkAuthOther.editEndTime));
|
|
|
|
+ } else {
|
|
|
|
+ return current && current < dayjs().endOf('day');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'lookEndTime',
|
|
|
|
+ ifShow: data.lookAuth == 2,
|
|
|
|
+ componentProps: {
|
|
|
|
+ disabledDate: (current) => {
|
|
|
|
+ if (checkAuthOther.lookEndTime) {
|
|
|
|
+ return current && (current < dayjs().endOf('day') || current > dayjs(checkAuthOther.lookEndTime));
|
|
|
|
+ } else {
|
|
|
|
+ return current && current < dayjs().endOf('day');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
]);
|
|
]);
|
|
});
|
|
});
|
|
function onFilterOption(inputText: string, option) {
|
|
function onFilterOption(inputText: string, option) {
|
|
@@ -256,7 +295,8 @@
|
|
}
|
|
}
|
|
async function onSearch(searchText) {
|
|
async function onSearch(searchText) {
|
|
const list = await getByRyId({ ryId: searchText });
|
|
const list = await getByRyId({ ryId: searchText });
|
|
- optionsName.value = list.map((ele) => {
|
|
|
|
|
|
+ optionsName.value =
|
|
|
|
+ list.map((ele) => {
|
|
return { ...ele, value: ele.ryId };
|
|
return { ...ele, value: ele.ryId };
|
|
}) || [];
|
|
}) || [];
|
|
// console.log('paramList', optionsList);
|
|
// console.log('paramList', optionsList);
|
|
@@ -274,8 +314,8 @@
|
|
console.log('params', params);
|
|
console.log('params', params);
|
|
await addAuth({
|
|
await addAuth({
|
|
...params,
|
|
...params,
|
|
- canAuthLook: params.isEmpower && params.isEmpower.every(item => item == 0) ? 1 : 0,
|
|
|
|
- canEditLook: params.isEmpower && params.isEmpower.every(item => item == 1) ? 1 : 0,
|
|
|
|
|
|
+ canAuthLook: params.isEmpower && params.isEmpower.every((item) => item == 0) ? 1 : 0,
|
|
|
|
+ canEditLook: params.isEmpower && params.isEmpower.every((item) => item == 1) ? 1 : 0,
|
|
});
|
|
});
|
|
closeModal();
|
|
closeModal();
|
|
resetFields();
|
|
resetFields();
|
|
@@ -295,6 +335,48 @@
|
|
// console.log(v);
|
|
// console.log(v);
|
|
// v && props.userData && nextTick(() => onDataReceive(props.userData));
|
|
// v && props.userData && nextTick(() => onDataReceive(props.userData));
|
|
}
|
|
}
|
|
|
|
+ function getOptionList(type: string, auth: any) {
|
|
|
|
+ let optionList = {
|
|
|
|
+ editAuth: [
|
|
|
|
+ { label: '无权编辑', value: 0 },
|
|
|
|
+ { label: '不限时编辑', value: 1 },
|
|
|
|
+ { label: '限时编辑', value: 2 },
|
|
|
|
+ ],
|
|
|
|
+ lookAuth: [
|
|
|
|
+ { label: '不限时查看', value: 1 },
|
|
|
|
+ { label: '限时查看', value: 2 },
|
|
|
|
+ ],
|
|
|
|
+ isAuthor: [
|
|
|
|
+ { label: '不可授权', value: 0 },
|
|
|
|
+ { label: '可授权他人', value: 1 },
|
|
|
|
+ ],
|
|
|
|
+ };
|
|
|
|
+ let option = optionList[type];
|
|
|
|
+ if ((!auth && auth != 0) || auth == 1) {
|
|
|
|
+ return option;
|
|
|
|
+ } else if (auth == 2) {
|
|
|
|
+ return option.map((ele) => {
|
|
|
|
+ return {
|
|
|
|
+ ...ele,
|
|
|
|
+ disabled: ele.value == 1,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ return option.map((ele) => {
|
|
|
|
+ if (type == 'lookAuth' && ele.value == 2) {
|
|
|
|
+ return {
|
|
|
|
+ ...ele,
|
|
|
|
+ disabled: false,
|
|
|
|
+ };
|
|
|
|
+ } else {
|
|
|
|
+ return {
|
|
|
|
+ ...ele,
|
|
|
|
+ disabled: ele.value != 0,
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return {
|
|
return {
|
|
register,
|
|
register,
|
|
schemas,
|
|
schemas,
|
|
@@ -303,6 +385,7 @@
|
|
fileFlow,
|
|
fileFlow,
|
|
handleVisibleChange,
|
|
handleVisibleChange,
|
|
handleSubmit,
|
|
handleSubmit,
|
|
|
|
+ getOptionList,
|
|
addListFunc,
|
|
addListFunc,
|
|
resetFields,
|
|
resetFields,
|
|
title,
|
|
title,
|