diff --git a/src/components/PermissionButton/index.vue b/src/components/PermissionButton/index.vue index a6f2b56c..8ef32c2e 100644 --- a/src/components/PermissionButton/index.vue +++ b/src/components/PermissionButton/index.vue @@ -40,7 +40,7 @@ - + diff --git a/src/views/device/Product/Save/index.vue b/src/views/device/Product/Save/index.vue index ac8cab7a..f0803d2c 100644 --- a/src/views/device/Product/Save/index.vue +++ b/src/views/device/Product/Save/index.vue @@ -49,7 +49,7 @@ @@ -149,6 +149,7 @@ import { Form } from 'ant-design-vue'; import { getImage } from '@/utils/comm.ts'; import { message } from 'ant-design-vue'; import DialogTips from '../DialogTips/index.vue'; +import { useProductStore } from '@/store/product'; import { filterTreeSelectNode, filterSelectNode } from '@/utils/comm'; import { FILE_UPLOAD } from '@/api/comm'; import { isInput } from '@/utils/regular'; @@ -159,7 +160,7 @@ import { CheckOutlined, DeleteOutlined, } from '@ant-design/icons-vue'; - +const productStore = useProductStore(); const emit = defineEmits(['success']); const props = defineProps({ title: { @@ -178,6 +179,7 @@ const visible = ref(false); const logoLoading = ref(false); const formRef = ref(); const disabled = ref(false); +const idDisabled = ref(false); const useForm = Form.useForm; const _selectedRowKeys = ref([]); const photoValue = ref('/images/device-product.png'); @@ -296,6 +298,7 @@ watch( */ const show = (data: any) => { if (props.isAdd === 2) { + productStore.refresh(data.id); form.name = data.name; form.classifiedId = data.classifiedId; form.classifiedName = data.classifiedName; @@ -303,7 +306,8 @@ const show = (data: any) => { form.deviceType = data.deviceType.value; form.describe = form.describe; form.id = data.id; - disabled.value = true; + disabled.value = productStore.current?.accessId ? true : false; + idDisabled.value = true; } else if (props.isAdd === 1) { form.name = ''; form.classifiedId = ''; @@ -313,6 +317,7 @@ const show = (data: any) => { form.describe = undefined; form.id = undefined; disabled.value = false; + disabled.vlaue = false; } visible.value = true; }; diff --git a/src/views/device/Product/index.vue b/src/views/device/Product/index.vue index d684a3b2..0d69d77c 100644 --- a/src/views/device/Product/index.vue +++ b/src/views/device/Product/index.vue @@ -395,7 +395,7 @@ const beforeUpload = (file: any) => { } return true; } catch { - message.error('请上传json格式文件'); + // message.error('请上传json格式文件'); } return true; }; diff --git a/src/views/media/Device/Channel/Save.vue b/src/views/media/Device/Channel/Save.vue index f5196dfd..76bbfe01 100644 --- a/src/views/media/Device/Channel/Save.vue +++ b/src/views/media/Device/Channel/Save.vue @@ -317,9 +317,14 @@ watch( () => _vis.value, (val) => { if (!val) { - formRef.value.resetFields(); + formRef.value?.resetFields(); // resetFields没有生效 // 以下字段非表单所填, 重置字段需手动置空 - formData.value.id = undefined; + Object.keys(formData.value).forEach((key: string) => { + if (key === 'id') formData.value.id = undefined; + else if (key === 'deviceId') + formData.value.deviceId = route.query.id; + else formData.value[key] = ''; + }); } }, ); diff --git a/src/views/media/Device/Save/index.vue b/src/views/media/Device/Save/index.vue index b1d63fb7..c5334cb9 100644 --- a/src/views/media/Device/Save/index.vue +++ b/src/views/media/Device/Save/index.vue @@ -53,7 +53,7 @@ > diff --git a/src/views/media/Device/const.ts b/src/views/media/Device/const.ts index 1d2ccc69..4af7b2ec 100644 --- a/src/views/media/Device/const.ts +++ b/src/views/media/Device/const.ts @@ -1,6 +1,6 @@ export const PROVIDER_OPTIONS = [ - { label: '固定地址', value: 'fixed-media' }, { label: 'GB/T28181', value: 'gb28181-2016' }, + { label: '固定地址', value: 'fixed-media' }, ] export const streamMode = [ { label: 'UDP', value: 'UDP' }, diff --git a/src/views/media/Device/index.vue b/src/views/media/Device/index.vue index ac0c47dd..3dd5dab0 100644 --- a/src/views/media/Device/index.vue +++ b/src/views/media/Device/index.vue @@ -78,7 +78,12 @@ ...item.tooltip, }" @click="item.onClick" - :hasPermission="'media/Device:' + item.key" + :hasPermission=" + 'media/Device:' + + (item.key !== 'updateChannel' + ? item.key + : 'update') + " > @@ -318,7 +326,7 @@ const getActions = ( }, }, { - key: 'view', // updateChannel + key: 'updateChannel', text: '更新通道', tooltip: { title: @@ -366,6 +374,8 @@ const getActions = ( icon: 'DeleteOutlined', }, ]; - return actions; + return data.provider === 'fixed-media' + ? actions.filter((f: any) => f.key !== 'updateChannel') + : actions; }; diff --git a/src/views/media/SplitScreen/tree.vue b/src/views/media/SplitScreen/tree.vue index 86398634..6dbaecb9 100644 --- a/src/views/media/SplitScreen/tree.vue +++ b/src/views/media/SplitScreen/tree.vue @@ -43,8 +43,8 @@ interface DataNode { /** * 点击节点 - * @param _ - * @param param1 + * @param _ + * @param param1 */ const onSelect = (_: any, { node }: any) => { emit('onSelect', { dId: node.deviceId, cId: node.channelId }); @@ -68,23 +68,25 @@ const treeData = ref([]); const getDeviceList = async () => { const res = await cascadeApi.getMediaTree({ paging: false }); if (res.success) { - treeData.value = res.result.map((m: any) => { - const extra: any = {}; - extra.isLeaf = isLeaf(m); - return { - ...m, - ...extra, - }; - }); + treeData.value = res.result + .sort((a: any, b: any) => a.createTime - b.createTime) + .map((m: any) => { + const extra: any = {}; + extra.isLeaf = isLeaf(m); + return { + ...m, + ...extra, + }; + }); } }; getDeviceList(); /** * 更新数据 - * @param list - * @param key - * @param children + * @param list + * @param key + * @param children */ const updateTreeData = ( list: DataNode[], @@ -146,7 +148,7 @@ const getChildren = (key: any, params: any): Promise => { /** * 异步加载子节点数据 - * @param param0 + * @param param0 */ const onLoadData = ({ key, children }: any): Promise => { return new Promise(async (resolve) => { diff --git a/src/views/notice/Config/SyncUser/index.vue b/src/views/notice/Config/SyncUser/index.vue index d8a8c1b9..289f27cf 100644 --- a/src/views/notice/Config/SyncUser/index.vue +++ b/src/views/notice/Config/SyncUser/index.vue @@ -271,21 +271,31 @@ const getActions = ( /** * 自动绑定 */ -const handleAutoBind = () => { - const arr = dataSource.value - .filter((item: any) => item.userId && item.status.value === 'error') - .map((i: any) => { - return { - userId: i.userId, - providerName: i.userName, - thirdPartyUserId: i.thirdPartyUserId, - }; - }); +const handleAutoBind = async () => { + await getTableData([ + { + column: `id$user-third$${props.data.type}_${props.data.provider}$not`, + }, + ]); + const params = dataSource.value + .filter((f: any) => f.userId && f.status.value === 'error') + .map((m: any) => ({ + userId: m.userId, + providerName: m.thirdPartyUserName, + thirdPartyUserId: m.thirdPartyUserId, + })); - configApi.dingTalkBindUser(arr, props.data.id).then(() => { - message.success('操作成功'); - getTableData(); - }); + if (props.data.type === 'dingTalk') { + configApi.dingTalkBindUser(params, props.data.id).then(() => { + message.success('操作成功'); + getTableData(); + }); + } else if (props.data.type === 'weixin') { + configApi.weChatBindUser(params, props.data.id).then(() => { + message.success('操作成功'); + getTableData(); + }); + } }; /** @@ -335,9 +345,9 @@ const getAllUsers = async (terms?: any) => { */ const dataSource = ref([]); const tableLoading = ref(false); -const getTableData = () => { +const getTableData = (terms?: any) => { tableLoading.value = true; - Promise.all([getDeptUsers(), getBindUsers(), getAllUsers()]) + Promise.all([getDeptUsers(), getBindUsers(), getAllUsers(terms)]) .then((res) => { dataSource.value = []; const [deptUsers, bindUsers, unBindUsers] = res; @@ -359,7 +369,7 @@ const getTableData = () => { thirdPartyUserId: deptUser.id, thirdPartyUserName: deptUser.name, bindId: bindUser?.id, - userId: bindUser?.userId, + userId: unBindUser?.id, userName: unBindUser ? `${unBindUser.name}(${unBindUser.username})` : bindUser?.providerName, @@ -420,7 +430,6 @@ const handleBind = (row: any) => { getAllUsers([ { column: `id$user-third$${props.data.type}_${props.data.provider}$not`, - // value: props.data.id, }, ]); };