|
@@ -35,64 +35,59 @@
|
|
|
const preventAutoFill = ref(true);
|
|
|
const { companyId } = userinfo.value;
|
|
|
let lastFetchId = 0;
|
|
|
- const fetchUser = debounce((value) => {
|
|
|
- console.log('fetching user', value);
|
|
|
- if(!value){
|
|
|
+ const fetchUser = debounce((e) => {
|
|
|
+ let value = e.target.value;
|
|
|
+ if (!value) {
|
|
|
return;
|
|
|
}
|
|
|
lastFetchId += 1;
|
|
|
const fetchId = lastFetchId;
|
|
|
options.value = [];
|
|
|
- queryByKey({queryKey: value}).then((res) => {
|
|
|
+ setFieldsValue({
|
|
|
+ 'id': null
|
|
|
+ });
|
|
|
+ queryByKey({ queryKey: value }).then((res) => {
|
|
|
console.log('queryByKey', res);
|
|
|
const data = res.map((user) => ({
|
|
|
- label: `${user.queryKey}`,
|
|
|
+ ...user,
|
|
|
+ label: `${user.name}`,
|
|
|
value: user.id,
|
|
|
}));
|
|
|
options.value = data;
|
|
|
+ updateSchema([
|
|
|
+ {
|
|
|
+ field: 'id',
|
|
|
+ ifShow: true,
|
|
|
+ componentProps: {
|
|
|
+ options: options.value,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]);
|
|
|
});
|
|
|
}, 300);
|
|
|
const schemas: FormSchema[] = [
|
|
|
- // {
|
|
|
- // field: 'nickName',
|
|
|
- // component: 'Input',
|
|
|
- // label: '姓名',
|
|
|
- // colProps: {
|
|
|
- // span: 20,
|
|
|
- // },
|
|
|
- // componentProps: {
|
|
|
- // maxLength: 15,
|
|
|
- // },
|
|
|
- // rules: [
|
|
|
- // {
|
|
|
- // required: true,
|
|
|
- // // @ts-ignore
|
|
|
- // validator: async (rule, value) => {
|
|
|
- // var reg_tel = /^[a-zA-Z\u4e00-\u9fa5]+$/;
|
|
|
- // // var reg = /\S+@\S+\.\S+/;
|
|
|
- // if (!value) {
|
|
|
- // return Promise.reject('请输入姓名');
|
|
|
- // }
|
|
|
- // if (!reg_tel.test(value)) {
|
|
|
- // /* eslint-disable-next-line */
|
|
|
- // return Promise.reject('请输入正确的姓名');
|
|
|
- // }
|
|
|
- // return Promise.resolve();
|
|
|
- // },
|
|
|
- // trigger: 'change',
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // },
|
|
|
+ {
|
|
|
+ field: 'idkey',
|
|
|
+ component: 'Input',
|
|
|
+ label: '账号查询',
|
|
|
+ required: true,
|
|
|
+ colProps: {
|
|
|
+ span: 20,
|
|
|
+ },
|
|
|
+ componentProps: {
|
|
|
+ onChange: fetchUser,
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
field: 'id',
|
|
|
- component: 'ApiSelect',
|
|
|
+ component: 'Select',
|
|
|
label: '账号',
|
|
|
required: true,
|
|
|
+ ifShow: false,
|
|
|
colProps: {
|
|
|
span: 20,
|
|
|
},
|
|
|
componentProps: {
|
|
|
- // api: queryByKey,
|
|
|
placeholder: '请选择平台',
|
|
|
'label-in-value': true,
|
|
|
options: options.value,
|
|
@@ -102,7 +97,7 @@
|
|
|
labelField: 'name',
|
|
|
valueField: 'id',
|
|
|
immediate: true,
|
|
|
- onChange:handleChange
|
|
|
+ // onChange: handleChange,
|
|
|
},
|
|
|
},
|
|
|
];
|
|
@@ -121,23 +116,26 @@
|
|
|
data && onDataReceive(data);
|
|
|
});
|
|
|
function onDataReceive(data) {
|
|
|
- console.log('onDataReceive',data)
|
|
|
+ console.log('onDataReceive', data);
|
|
|
// 方式1;
|
|
|
- setTimeout(()=>{
|
|
|
- preventAutoFill.value = false
|
|
|
- updateSchema([{
|
|
|
- field: 'userName',
|
|
|
- componentProps:{
|
|
|
- readonly:false,
|
|
|
- }
|
|
|
- },{
|
|
|
- field: 'password',
|
|
|
- componentProps:{
|
|
|
- readonly:false,
|
|
|
- }
|
|
|
- }])
|
|
|
+ setTimeout(() => {
|
|
|
+ preventAutoFill.value = false;
|
|
|
+ updateSchema([
|
|
|
+ {
|
|
|
+ field: 'userName',
|
|
|
+ componentProps: {
|
|
|
+ readonly: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'password',
|
|
|
+ componentProps: {
|
|
|
+ readonly: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]);
|
|
|
// updateSchema(schemas);
|
|
|
- },500)
|
|
|
+ }, 500);
|
|
|
}
|
|
|
function companyIdChange(companyId) {
|
|
|
// resetFields(['permList'])
|
|
@@ -157,17 +155,18 @@
|
|
|
}
|
|
|
async function handleOk() {
|
|
|
let data = await validate();
|
|
|
- const requestApi = saveAddApi; //data.id ? updateApi :
|
|
|
let res = await jyUserPlatformadd({
|
|
|
- ...data,
|
|
|
+ id: data.id.value,
|
|
|
+ platformId: '2a5ceb3ca61e4763'
|
|
|
});
|
|
|
context && context.emit('ok', res);
|
|
|
createMessage.success(t('common.optSuccess'));
|
|
|
closeModal();
|
|
|
resetFields();
|
|
|
}
|
|
|
- function handleChange(value,b,a) {
|
|
|
- console.log('value', value,b, a);
|
|
|
+ function handleChange(value, b, a) {
|
|
|
+ console.log('value', value, b, a);
|
|
|
+ updateSchema({ field: 'projectNum', ifShow: value == '4' });
|
|
|
}
|
|
|
return {
|
|
|
register,
|