|
@@ -25,7 +25,7 @@
|
|
|
import { companyAdd, companyUpdate } from '/@/api/customer';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import { uploadApi } from '/@/api/product/index';
|
|
|
- import { getByRyId, addAuth, checkAuthOtherApi } from '/@/api/operate';
|
|
|
+ import { getByRyId, getinnerByRyId, addAuth, checkAuthOtherApi } from '/@/api/operate';
|
|
|
import { useModalInner } from '/@/components/Modal';
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
@@ -118,19 +118,46 @@
|
|
|
component: 'AutoComplete',
|
|
|
label: '人员编号',
|
|
|
required: true,
|
|
|
- componentProps: {
|
|
|
- filterOption: onFilterOption,
|
|
|
- onSearch: onSearch,
|
|
|
- onChange: (data) => {
|
|
|
- setTimeout(() => {
|
|
|
- const item = optionsName.value && optionsName.value.find((ele) => ele.ryNo == data);
|
|
|
- setFieldsValue({
|
|
|
- ryNickName: item && item.ryNickName ? item.ryNickName : '',
|
|
|
- id: item && item.id ? item.id : '',
|
|
|
- });
|
|
|
- }, 100);
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ // @ts-ignore
|
|
|
+ validator: async (rule, value) => {
|
|
|
+ let myData = await getFieldsValue();
|
|
|
+ if (!value) {
|
|
|
+ return Promise.reject('请输入人员编号');
|
|
|
+ }
|
|
|
+ let res = await getinnerByRyId({ ryNo: value });
|
|
|
+ console.log('value', value, res);
|
|
|
+ if (res && !res.data) {
|
|
|
+ return Promise.reject('人员编号不存在');
|
|
|
+ }
|
|
|
+ Promise.resolve();
|
|
|
+ let ryNickName = res && res.data && res.data.ryNickName;
|
|
|
+ console.log('id', myData.id != ryNickName || !myData.id);
|
|
|
+ if(myData.ryNickName != ryNickName || !myData.ryNickName){
|
|
|
+ setFieldsValue({
|
|
|
+ ryNickName: res && res.data ? res.data.ryNickName : '',
|
|
|
+ id: res && res.data ? res.data.id : '',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ trigger: 'blur',
|
|
|
},
|
|
|
- },
|
|
|
+ ],
|
|
|
+ // componentProps: {
|
|
|
+ // filterOption: onFilterOption,
|
|
|
+ // onSearch: onSearch,
|
|
|
+ // onChange: (data) => {
|
|
|
+ // setTimeout(() => {
|
|
|
+ // const item = optionsName.value && optionsName.value.find((ele) => ele.ryNo == data);
|
|
|
+ // setFieldsValue({
|
|
|
+ // ryNickName: item && item.ryNickName ? item.ryNickName : '',
|
|
|
+ // id: item && item.id ? item.id : '',
|
|
|
+ // });
|
|
|
+ // }, 100);
|
|
|
+ // },
|
|
|
+ // },
|
|
|
colProps: {
|
|
|
span: 20,
|
|
|
},
|