|
|
@@ -0,0 +1,143 @@
|
|
|
+<template>
|
|
|
+ <BasicModal
|
|
|
+ v-bind="$attrs"
|
|
|
+ @register="register"
|
|
|
+ :title="t('routes.staff.setpower')"
|
|
|
+ @ok="handleSubmit"
|
|
|
+ >
|
|
|
+ <div class="pt-20px">
|
|
|
+ <BasicForm @register="registerForm">
|
|
|
+ <template #label="{ model, field }">
|
|
|
+ {{ model[field] }}
|
|
|
+ </template>
|
|
|
+ </BasicForm>
|
|
|
+ </div>
|
|
|
+ <template #centerFooter> </template>
|
|
|
+ </BasicModal>
|
|
|
+</template>
|
|
|
+<script lang="ts">
|
|
|
+ import { defineComponent, ref } from 'vue';
|
|
|
+ import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
|
+ import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
|
+ // import { BasicTable, useTable, BasicColumn, FormSchema } from '/@/components/Table';
|
|
|
+ // import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ // import { checkUserAddAble } from '/@/api/corporation/modal';
|
|
|
+ import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
+ import { listAll, givePlatformAuth } from '/@/api/archive/list';
|
|
|
+ // import { bindAnchorListParam } from '/@/api/scene/model';
|
|
|
+ // import { Time } from '/@/components/Time';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ // import { useUserStore } from '/@/store/modules/user';
|
|
|
+ const { t } = useI18n();
|
|
|
+ const { createMessage } = useMessage();
|
|
|
+ const schemas: FormSchema[] = [
|
|
|
+ {
|
|
|
+ field: 'userId',
|
|
|
+ component: 'Input',
|
|
|
+ label: 'id',
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'nickName',
|
|
|
+ label: t('common.fullName'),
|
|
|
+
|
|
|
+ component: 'Input',
|
|
|
+ slot: 'label',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'userName',
|
|
|
+ label: t('routes.devices.email'),
|
|
|
+ component: 'Input',
|
|
|
+ slot: 'label',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'companyName',
|
|
|
+ label: t('routes.staff.deptName'),
|
|
|
+ component: 'Input',
|
|
|
+ slot: 'label',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'platformIds',
|
|
|
+ label: t('routes.staff.setpowerpt'),
|
|
|
+ required: true,
|
|
|
+ component: 'CheckboxGroup',
|
|
|
+ colProps: {
|
|
|
+ // xl: 12,
|
|
|
+ // xxl: 12,
|
|
|
+ },
|
|
|
+ componentProps: {
|
|
|
+ api: listAll,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ export default defineComponent({
|
|
|
+ components: { BasicModal, BasicForm },
|
|
|
+ props: {
|
|
|
+ userData: { type: Object },
|
|
|
+ },
|
|
|
+ emits: ['register', 'success'],
|
|
|
+ setup(_, { emit }) {
|
|
|
+ // const { createMessage } = useMessage();
|
|
|
+ const sceneNum = ref('');
|
|
|
+ const options = ref([]);
|
|
|
+ listAll({ page: 1, limit: 1000 }).then((res) => {
|
|
|
+ console.log('listAll', res);
|
|
|
+ options.value = res.map((ele) => {
|
|
|
+ return {
|
|
|
+ label: ele.platformName,
|
|
|
+ value: ele.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ const [registerForm, { setFieldsValue, validate, updateSchema }] = useForm({
|
|
|
+ schemas: schemas,
|
|
|
+ labelWidth: 160,
|
|
|
+ showActionButtonGroup: false,
|
|
|
+
|
|
|
+ actionColOptions: {
|
|
|
+ span: 24,
|
|
|
+ },
|
|
|
+ // submitFunc: handleSubmit,
|
|
|
+ });
|
|
|
+
|
|
|
+ const [register, { closeModal }] = useModalInner((data) => {
|
|
|
+ data && onDataReceive(data);
|
|
|
+ updateSchema({
|
|
|
+ field: 'platformIds',
|
|
|
+ componentProps: {
|
|
|
+ options: options.value,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ function onDataReceive(data) {
|
|
|
+ console.log('Data Received', data, data.num);
|
|
|
+
|
|
|
+ setFieldsValue({
|
|
|
+ ...data,
|
|
|
+ userId: data.id,
|
|
|
+ });
|
|
|
+
|
|
|
+ sceneNum.value = data.num;
|
|
|
+ }
|
|
|
+ const handleSubmit = async () => {
|
|
|
+ let params = await validate();
|
|
|
+ await givePlatformAuth(params);
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ closeModal();
|
|
|
+ emit('reload');
|
|
|
+ console.log(params);
|
|
|
+ };
|
|
|
+
|
|
|
+ return {
|
|
|
+ t,
|
|
|
+ register,
|
|
|
+ schemas,
|
|
|
+ handleSubmit,
|
|
|
+ closeModal,
|
|
|
+ registerForm,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ });
|
|
|
+</script>
|