|
@@ -4,9 +4,33 @@
|
|
@cancel="resetFields"
|
|
@cancel="resetFields"
|
|
@register="register"
|
|
@register="register"
|
|
:title="title"
|
|
:title="title"
|
|
- @ok="handleOk"
|
|
|
|
|
|
+ @ok="handlestd"
|
|
>
|
|
>
|
|
- <BasicForm @register="registerForm" />
|
|
|
|
|
|
+ <div class="BasicForms">
|
|
|
|
+ <Select
|
|
|
|
+ v-model:value="modelRef"
|
|
|
|
+ show-search
|
|
|
|
+ placeholder="请输入姓名/手机号码/身份证号码搜索"
|
|
|
|
+ style="width: 350px"
|
|
|
|
+ :default-active-first-option="false"
|
|
|
|
+ :show-arrow="false"
|
|
|
|
+ :filter-option="false"
|
|
|
|
+ not-found-content="暂无数据"
|
|
|
|
+ :options="options"
|
|
|
|
+ @search="fetchUser"
|
|
|
|
+ @change="handleChange"
|
|
|
|
+ />
|
|
|
|
+ <div class="from" v-if="active && active.name">
|
|
|
|
+ <div class="form-item">
|
|
|
|
+ <div>姓名</div>{{active.name}} </div>
|
|
|
|
+ <div class="form-item">
|
|
|
|
+ <div>手机号码</div>{{active.phone || '暂无手机号'}} </div>
|
|
|
|
+ <div class="form-item">
|
|
|
|
+ <div>身份证</div>{{active.idCard || '暂无身份证'}} </div>
|
|
|
|
+ <div class="form-item">
|
|
|
|
+ <div>平台</div>{{active.platformName || '未分配'}} </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</BasicModal>
|
|
</BasicModal>
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
@@ -18,25 +42,26 @@
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
import { debounce } from 'lodash-es';
|
|
import { debounce } from 'lodash-es';
|
|
|
|
+ import { Select } from 'ant-design-vue';
|
|
import { jyPlatformlist, delplatformList } from '/@/api/jyUserPlatform/index'; //roleLIstApi
|
|
import { jyPlatformlist, delplatformList } from '/@/api/jyUserPlatform/index'; //roleLIstApi
|
|
import { platformallList, jyUserPlatformadd, queryByKey } from '/@/api/jyUserPlatform/index';
|
|
import { platformallList, jyUserPlatformadd, queryByKey } from '/@/api/jyUserPlatform/index';
|
|
const { t } = useI18n();
|
|
const { t } = useI18n();
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
- components: { BasicModal, BasicForm },
|
|
|
|
|
|
+ components: { BasicModal, BasicForm, Select },
|
|
props: {
|
|
props: {
|
|
userData: { type: Object },
|
|
userData: { type: Object },
|
|
},
|
|
},
|
|
emits: ['ok'],
|
|
emits: ['ok'],
|
|
setup(_, context) {
|
|
setup(_, context) {
|
|
- const modelRef = ref({});
|
|
|
|
|
|
+ const modelRef = ref();
|
|
|
|
+ const active = ref({})
|
|
const options = ref([]);
|
|
const options = ref([]);
|
|
const userStore = useUserStore();
|
|
const userStore = useUserStore();
|
|
const userinfo = computed(() => userStore.getUserInfo);
|
|
const userinfo = computed(() => userStore.getUserInfo);
|
|
const preventAutoFill = ref(true);
|
|
const preventAutoFill = ref(true);
|
|
const { companyId } = userinfo.value;
|
|
const { companyId } = userinfo.value;
|
|
let lastFetchId = 0;
|
|
let lastFetchId = 0;
|
|
- const fetchUser = debounce((e) => {
|
|
|
|
- let value = e.target.value;
|
|
|
|
|
|
+ const fetchUser = debounce((value) => {
|
|
if (!value) {
|
|
if (!value) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -44,13 +69,15 @@
|
|
const fetchId = lastFetchId;
|
|
const fetchId = lastFetchId;
|
|
options.value = [];
|
|
options.value = [];
|
|
setFieldsValue({
|
|
setFieldsValue({
|
|
- 'id': null
|
|
|
|
|
|
+ id: null,
|
|
});
|
|
});
|
|
queryByKey({ queryKey: value }).then((res) => {
|
|
queryByKey({ queryKey: value }).then((res) => {
|
|
console.log('queryByKey', res);
|
|
console.log('queryByKey', res);
|
|
const data = res.map((user) => ({
|
|
const data = res.map((user) => ({
|
|
...user,
|
|
...user,
|
|
- label: `${user.name}`,
|
|
|
|
|
|
+ label: `${user.name}/${user.phone || '暂无手机号码'}/${user.idCard || ''}/${
|
|
|
|
+ user.platformName || '未分配'
|
|
|
|
+ }`,
|
|
value: user.id,
|
|
value: user.id,
|
|
}));
|
|
}));
|
|
options.value = data;
|
|
options.value = data;
|
|
@@ -77,7 +104,7 @@
|
|
componentProps: {
|
|
componentProps: {
|
|
placeholder: '请输入姓名/手机号码/身份证号码搜索',
|
|
placeholder: '请输入姓名/手机号码/身份证号码搜索',
|
|
onChange: fetchUser,
|
|
onChange: fetchUser,
|
|
- }
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
field: 'id',
|
|
field: 'id',
|
|
@@ -103,7 +130,7 @@
|
|
},
|
|
},
|
|
];
|
|
];
|
|
const title = ref('添加用户');
|
|
const title = ref('添加用户');
|
|
- const { createMessage } = useMessage();
|
|
|
|
|
|
+ const { createMessage, createConfirm } = useMessage();
|
|
const [registerForm, { setFieldsValue, validate, updateSchema, resetFields }] = useForm({
|
|
const [registerForm, { setFieldsValue, validate, updateSchema, resetFields }] = useForm({
|
|
labelWidth: 120,
|
|
labelWidth: 120,
|
|
schemas,
|
|
schemas,
|
|
@@ -154,20 +181,38 @@
|
|
permList: [],
|
|
permList: [],
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ handlestd(){
|
|
|
|
+ createConfirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '该用户已属其他平台,确定为其更换平台?',
|
|
|
|
+ onOk: async () => {
|
|
|
|
+ handleOk()
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
async function handleOk() {
|
|
async function handleOk() {
|
|
- let data = await validate();
|
|
|
|
- let res = await jyUserPlatformadd({
|
|
|
|
- id: data.id.value,
|
|
|
|
- // platformId: data.id.platformId,
|
|
|
|
|
|
+ createConfirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '该用户已属其他平台,确定为其更换平台?',
|
|
|
|
+ onOk: async () => {
|
|
|
|
+ let res = await jyUserPlatformadd({
|
|
|
|
+ id: modelRef,
|
|
|
|
+ });
|
|
|
|
+ context && context.emit('ok', res);
|
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
|
+ closeModal();
|
|
|
|
+ resetFields();
|
|
|
|
+ sceneCopy({ num: record.num }).then((res) => {
|
|
|
|
+ message.success({
|
|
|
|
+ content: '复制成功',
|
|
|
|
+ });
|
|
|
|
+ reload();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
});
|
|
});
|
|
- context && context.emit('ok', res);
|
|
|
|
- createMessage.success(t('common.optSuccess'));
|
|
|
|
- closeModal();
|
|
|
|
- resetFields();
|
|
|
|
}
|
|
}
|
|
- function handleChange(value, b, a) {
|
|
|
|
- console.log('value', value, b, a);
|
|
|
|
- updateSchema({ field: 'projectNum', ifShow: value == '4' });
|
|
|
|
|
|
+ function handleChange(value, b ) {
|
|
|
|
+ active.value = b;
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
register,
|
|
register,
|
|
@@ -178,7 +223,30 @@
|
|
modelRef,
|
|
modelRef,
|
|
handleOk,
|
|
handleOk,
|
|
resetFields,
|
|
resetFields,
|
|
|
|
+ fetchUser,
|
|
|
|
+ options,
|
|
|
|
+ handleChange,
|
|
|
|
+ active,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
|
|
+<style lang="less" scoped>
|
|
|
|
+ .BasicForms {
|
|
|
|
+ margin: 0 auto;
|
|
|
|
+ text-align: center;
|
|
|
|
+ }
|
|
|
|
+ .from{
|
|
|
|
+ width: 350px;
|
|
|
|
+ margin: 0 auto;
|
|
|
|
+ .form-item{
|
|
|
|
+ display: flex;
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ div{
|
|
|
|
+ width: 60px;
|
|
|
|
+ text-align: right;
|
|
|
|
+ margin-right: 10px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</style>
|