|
@@ -51,13 +51,14 @@
|
|
|
</BasicDrawer>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
- import { defineComponent, ref, computed, unref, nextTick, reactive } from 'vue';
|
|
|
+ import { defineComponent, ref, computed, unref, nextTick, reactive, watch } from 'vue';
|
|
|
import { BasicForm, useForm, FormSchema } from '/@/components/Form/index';
|
|
|
// import { Card } from 'ant-design-vue';
|
|
|
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
+ import type { UserInfo } from '/#/store';
|
|
|
import { data as CascaderData, getCode } from '/@/utils/cascaderData';
|
|
|
import { ListApi } from '/@/api/scene/list';
|
|
|
import { Select } from 'ant-design-vue';
|
|
@@ -73,6 +74,8 @@
|
|
|
} from '/@/api/scene/live';
|
|
|
import { useScript } from '/@/hooks/web/useScript';
|
|
|
import { staffListApi } from '/@/api/staff/list';
|
|
|
+ import { SceneLiveItem } from '/@/api/scene/model';
|
|
|
+ import { isBoolean } from '/@/utils/is';
|
|
|
const A_MAP_URL = 'https://webapi.amap.com/maps?v=2.0&key=e661b00bdf2c44cccf71ef6070ef41b8';
|
|
|
|
|
|
// const A_MAP_URL = 'https://webapi.amap.com/maps?v=2.0&key=5a2d384532ae531bf99bd8487c4f03d2';
|
|
@@ -93,6 +96,8 @@
|
|
|
const token = userStore.getToken;
|
|
|
const userinfo = computed(() => userStore.getUserInfo);
|
|
|
const wrapRef = ref<HTMLDivElement | null>(null);
|
|
|
+ const isDeaultContactUser = ref<UserInfo | false>(false);
|
|
|
+ const editRecord = ref<SceneLiveItem | boolean>(false);
|
|
|
|
|
|
const sceneNumOption = reactive({
|
|
|
list: [],
|
|
@@ -395,6 +400,13 @@
|
|
|
immediate: true,
|
|
|
showSearch: true,
|
|
|
optionFilterProp: 'label',
|
|
|
+ onOptionsChange: async (data) => {
|
|
|
+ const isDeaultUser = data.find((i) => i.value === Number(userinfo.value.id));
|
|
|
+ if (isDeaultUser && !isDeaultContactUser.value) {
|
|
|
+ isDeaultUser.id = Number(isDeaultUser.value);
|
|
|
+ isDeaultContactUser.value = isDeaultUser;
|
|
|
+ }
|
|
|
+ },
|
|
|
onChange: function (model, opt) {
|
|
|
console.log('model', model);
|
|
|
console.log('opt', opt);
|
|
@@ -443,7 +455,7 @@
|
|
|
};
|
|
|
});
|
|
|
sceneNumOption.allList = sceneNumOption.list;
|
|
|
- console.log('isUpdate', isUpdate.value, Option.list);
|
|
|
+ console.log('isUpdate', isUpdate.value, data);
|
|
|
await updateSchema({
|
|
|
field: 'sceneNum',
|
|
|
componentProps: {
|
|
@@ -463,6 +475,9 @@
|
|
|
},
|
|
|
},
|
|
|
});
|
|
|
+
|
|
|
+ // console.log('isDeaultContactUser', isDeaultContactUser.value?.id);
|
|
|
+
|
|
|
if (unref(isUpdate)) {
|
|
|
try {
|
|
|
const res = await getLiveInfoApi({ id: record.id, token });
|
|
@@ -506,14 +521,56 @@
|
|
|
...setDAta,
|
|
|
});
|
|
|
myData.introduceVideoCover = res.introduceVideoCover;
|
|
|
+
|
|
|
+ editRecord.value = res;
|
|
|
} catch (error) {
|
|
|
console.error(error);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ editRecord.value = false;
|
|
|
}
|
|
|
myData.id = (record && record.id) || false;
|
|
|
+
|
|
|
+ // if (isDeaultContactUser.value?.id) {
|
|
|
+ // console.log('hey');
|
|
|
+ // await setFieldsValue({
|
|
|
+ // contactId: isDeaultContactUser.value.id,
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
initMap();
|
|
|
});
|
|
|
|
|
|
+ watch(
|
|
|
+ () => [editRecord, isDeaultContactUser],
|
|
|
+ async ([edit, user]) => {
|
|
|
+ console.log('update', edit.value);
|
|
|
+ // if (!edit.value && user.value) {
|
|
|
+ // await setFieldsValue({
|
|
|
+ // contactId: user.value.id,
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ if (!isBoolean(edit.value) && !isBoolean(user.value)) {
|
|
|
+ if (user.value.contactId === '') {
|
|
|
+ await setFieldsValue({
|
|
|
+ contactId: user.value.id,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //新增
|
|
|
+ if (isBoolean(edit.value) && !isBoolean(user.value)) {
|
|
|
+ await setFieldsValue({
|
|
|
+ contactId: user.value.id,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ );
|
|
|
+
|
|
|
async function initMap() {
|
|
|
console.log('initMap');
|
|
|
await toPromise();
|
|
@@ -705,6 +762,8 @@
|
|
|
async function handleClose() {
|
|
|
map && map.destroy();
|
|
|
resetFields();
|
|
|
+ isDeaultContactUser.value = false;
|
|
|
+ editRecord.value = false;
|
|
|
closeDrawer();
|
|
|
}
|
|
|
|