diff --git a/src/views/services/serviceDirective/ConfigServiceDirective.api.ts b/src/views/services/serviceDirective/ConfigServiceDirective.api.ts index 2edfbaf..1e7fe56 100644 --- a/src/views/services/serviceDirective/ConfigServiceDirective.api.ts +++ b/src/views/services/serviceDirective/ConfigServiceDirective.api.ts @@ -23,6 +23,9 @@ enum Api { syncDirective = '/services/serviceDirective/syncDirective', useOrStopCascade = '/services/serviceDirective/useOrStopCascade', compareList = '/services/serviceDirective/compareList', + getSyncCode = '/services/serviceDirective/getSyncCode', + updateSyncCode = '/services/serviceDirective/updateSyncCode', + getOrgCodeBySyncCode = '/services/serviceDirective/getOrgCodeBySyncCode', } /** @@ -155,6 +158,27 @@ export const useOrStopCascade = (params) => { /** * 差异数据对比 * @param params compareOrgCode - * @returns + * @returns */ -export const compareList = (params) => defHttp.get({ url: Api.compareList, params }); \ No newline at end of file +export const compareList = (params) => defHttp.get({ url: Api.compareList, params }); + +/** + * 获取镜像码 + * @param params + * @returns + */ +export const getSyncCode = (params) => defHttp.get({ url: Api.getSyncCode, params }, { isTransformResponse: false }); + +/** + * 更新镜像码 + * @param params + * @returns + */ +export const updateSyncCode = (params) => defHttp.get({ url: Api.updateSyncCode, params }, { isTransformResponse: false }); + +/** + * 根据镜像码获取机构编码 + * @param params + * @returns + */ +export const getOrgCodeBySyncCode = (params) => defHttp.get({ url: Api.getOrgCodeBySyncCode, params }, { isTransformResponse: false }); \ No newline at end of file diff --git a/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue b/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue index f2bc170..b14d0b4 100644 --- a/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue +++ b/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue @@ -34,14 +34,9 @@ - - 新增分类标签 + preIcon="ant-design:plus-outlined">新增分类标签 - @@ -253,40 +247,8 @@ - - - - - -
@@ -294,25 +256,10 @@ - - -
- - + @@ -404,31 +317,6 @@ - - - - - - - - - - - - @@ -462,6 +350,28 @@ + + + + +
+ + + 镜像码:{{ syncCode }} + + + 复制 + 更新 + + +
+
+
+ @@ -491,24 +401,18 @@ import { ref, reactive, watch, onMounted, computed, nextTick } from 'vue'; import { BasicTable, TableAction } from '/@/components/Table'; import { useListPage } from '/@/hooks/system/useListPage'; import { columns, superQuerySchema } from './ConfigServiceDirective.data'; -import { list, batchAdd, deleteOne, batchDelete, getImportUrl, getExportUrl, tree } from './ConfigServiceDirective.api'; +import { list, batchAdd, deleteOne, batchDelete, getImportUrl, getExportUrl, tree, getSyncCode, updateSyncCode } from './ConfigServiceDirective.api'; import ConfigServiceDirectiveModal from './components/ConfigServiceDirectiveModal.vue' -import { useUserStore } from '/@/store/modules/user'; import JInput from "/@/components/Form/src/jeecg/components/JInput.vue"; -import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import { cloneDeep } from "lodash-es"; import ConfigServiceCategoryList from '../serviceCategory/ConfigServiceCategoryList.vue'; import InstructionTag from '../instructiontag/InstructionTag.vue'; import ConfigServiceTypeList from '../serviceType/ConfigServiceTypeList.vue'; -import BodyTagList from '/@/views/services/directivetag/bodytag/BodyTagList.vue'; -import EmotionTagList from '/@/views/services/directivetag/emotiontag/EmotionTagList.vue'; -import { getFileAccessHttpUrl } from '/@/utils/common/compUtils'; import { Empty } from 'ant-design-vue'; import InstructionTagModal from '/@/views/services/InstructionTag/components/InstructionTagModal.vue' import ConfigServiceCategoryModal from '/@/views/services/serviceCategory/components//ConfigServiceCategoryModal.vue' import ConfigServiceTypeModal from '/@/views/services/serviceType/components//ConfigServiceTypeModal.vue' import DirectiveMediaList from '/@/views/services/directivemedia/DirectiveMediaList.vue' -import { queryByKey } from '/@/views/admin/sysconfig/SysConfig.api' import { getOrgInfo } from '@/api/common/api' import { useMessage } from '/@/hooks/web/useMessage'; import AbnormalDirectiveList from './components/AbnormalDirectiveList.vue' @@ -531,8 +435,8 @@ const dmRef = ref() const abnormalListOpen = ref(false) const abnormalListRef = ref() const newDirectiveVisible = ref(false) -const compareListRef = ref() const compareListOpen = ref(false) +const syncCodeVisible = ref(false) const queryParam = reactive({ instructionTagId: '', categoryId: '', @@ -554,11 +458,8 @@ watch( queryParam.typeId = '' } ) -const toggleSearchStatus = ref(false); const registerModal = ref(); const treeData = ref([]); -const userStore = useUserStore(); -const isShowDM = ref(false)//是否展示指令库功能 const selectedKeys = ref([]); const openKeys = ref([]); //注册table数据 @@ -609,65 +510,16 @@ const wrapperCol = reactive({ sm: 20, }); -// 高级查询配置 -const superQueryConfig = reactive(superQuerySchema); - const insTagOpen = ref(false)//分类标签抽屉 const categoryOpen = ref(false)//服务类别抽屉 const typeOpen = ref(false)//服务类型抽屉 -const bodyTagOpen = ref(false)//体型标签抽屉 -const emotionTagOpen = ref(false)//情绪标签抽屉 -const mainOrgCode = ref()//指令库编码 const ownOrgCode = ref('') //本机构编码 const ownOrgName = ref('') //本机构名称 const filterIzEnabled = ref('enabled')//筛选全部/已启用 const directiveMainOrgInfo = ref() function onOpenChange(record: string[]) { - console.log("🚀 ~ onOpenChange ~ record:", record) selectedKeys.value = record - // const latestOpenKey = record.find(key => state.openKeys.indexOf(key) === -1); - // if (state.rootSubmenuKeys.indexOf(latestOpenKey!) === -1) { - // state.openKeys = openKeys; - // } else { - // state.openKeys = latestOpenKey ? [latestOpenKey] : []; - // } -} -/** - * 高级查询事件 - */ -function handleSuperQuery(params) { - Object.keys(params).map((k) => { - queryParam[k] = params[k]; - }); - searchQuery(); -} - -/** - * 新增事件 - */ -function handleAdd() { - registerModal.value.disableSubmit = false; - registerModal.value.opeType = 'add'; - registerModal.value.add(); -} - -/** - * 编辑事件 - */ -function handleEdit(record: Recordable) { - registerModal.value.disableSubmit = false; - registerModal.value.opeType = 'edit'; - registerModal.value.edit(record); -} - -/** - * 编辑指令资源 - */ -function handleMedia(record: Recordable) { - registerModal.value.disableSubmit = false; - registerModal.value.opeType = 'editMedia'; - registerModal.value.editMedia(record); } /** @@ -697,14 +549,6 @@ function getTableAction(record) { label: '详情', onClick: handleDetail.bind(null, record), }, - // { - // label: '编辑', - // onClick: handleEdit.bind(null, record) - // }, - // { - // label: '指令资源', - // onClick: handleMedia.bind(null, record) - // }, ]; } @@ -740,34 +584,6 @@ function expandTreeNodeToLevel4(directiveData: any) { selectedKeys.value = [directiveData.instructionTagId, directiveData.categoryId, directiveData.typeId, directiveData.id] openKeys.value = [directiveData.instructionTagId, directiveData.categoryId, directiveData.typeId, directiveData.id] - // // 清空之前展开的节点 - // expandedKeys.value = []; - // // 递归查找并展开相应的节点 - // const findAndExpandNode = (nodes: any[], level: number, directiveData: any) => { - // for (const node of nodes) { - // // 判断当前节点的 level 是否与 directiveData 的级别匹配 - // if (level === 1 && node.instructionId === directiveData.instructionTagId) { - // expandedKeys.value.push(node.key); - // if (node.children && node.children.length > 0) { - // findAndExpandNode(node.children, 2, directiveData); - // } - // } else if (level === 2 && node.categoryId === directiveData.categoryId) { - // expandedKeys.value.push(node.key); - // if (node.children && node.children.length > 0) { - // findAndExpandNode(node.children, 3, directiveData); - // } - // } else if (level === 3 && node.typeId === directiveData.typeId) { - // expandedKeys.value.push(node.key); - // if (node.children && node.children.length > 0) { - // findAndExpandNode(node.children, 4, directiveData); - // } - // } else if (level === 4 && node.key === directiveData.id) { - // expandedKeys.value.push(node.key); - // } - // } - // }; - // // 调用递归方法,从树的根节点开始查找 - // findAndExpandNode(treeData.value, 1, directiveData); } /** @@ -813,8 +629,6 @@ function searchReset() { queryParam.bodyTags = ''; queryParam.emotionTags = ''; queryParam.id = ''; - // queryParam.izEnabled = ''; - // 刷新数据 reload().then(() => { initTree(); @@ -846,27 +660,6 @@ async function setRangeQuery() { return queryParamClone; } -//分类标签抽屉打开 -function handleinstructionTag() { - insTagOpen.value = true -} -//服务类别抽屉打开 -function handleCategory() { - categoryOpen.value = true -} -//服务类型抽屉打开 -function handleType() { - typeOpen.value = true -} -//体型标签抽屉打开 -function handleBodyTag() { - bodyTagOpen.value = true -} -//情绪标签抽屉打开 -function handleEmotionTag() { - emotionTagOpen.value = true -} - //分类标签抽屉关闭 function onInsTagClose() { insTagOpen.value = false @@ -879,14 +672,6 @@ function onCategoryClose() { function onTypeClose() { typeOpen.value = false } -//体型标签抽屉关闭 -function onBodyTagClose() { - bodyTagOpen.value = false -} -//体型标签抽屉关闭 -function onEmotionTagClose() { - emotionTagOpen.value = false -} const showAudioModal = ref(false); // 控制音频模态框显示 const audioUrl = ref(''); // 音频 URL @@ -929,79 +714,14 @@ const closeVideoModal = () => { }; // 添加以下响应式变量 -const currentPlayingAudio = ref(null); const isPlaying = ref(false); -// 添加音频控制方法 -const playAudio = (url: string) => { - if (currentPlayingAudio.value && currentPlayingAudio.value !== url) { - // 如果正在播放其他音频,先停止 - stopAudio(); - } - - currentPlayingAudio.value = url; - isPlaying.value = true; - - // 确保audio元素存在 - if (audioPlayer.value) { - audioPlayer.value.src = getFileAccessHttpUrl(url); - audioPlayer.value.play().catch(e => { - isPlaying.value = false; - currentPlayingAudio.value = null; - }); - } -}; - -const pauseAudio = () => { - if (audioPlayer.value) { - audioPlayer.value.pause(); - isPlaying.value = false; - } -}; - -const resumeAudio = () => { - if (audioPlayer.value) { - audioPlayer.value.play().catch(e => { - }); - isPlaying.value = true; - } -}; - -const restartAudio = () => { - if (audioPlayer.value) { - audioPlayer.value.currentTime = 0; - audioPlayer.value.play().catch(e => { - }); - isPlaying.value = true; - } -}; - -const stopAudio = () => { - if (audioPlayer.value) { - audioPlayer.value.pause(); - audioPlayer.value.currentTime = 0; - isPlaying.value = false; - currentPlayingAudio.value = null; - } -}; - - -const clickCount = ref(0); -const treeChildData = ref([]); const expandedKeys = ref([]); - // 为每个 node 维护一个菜单状态和 hover 定时器 const menuState = reactive>({ }) -function onNodeEnter(node, level, event) { - node.showIcon = true -} - -function onNodeLeave(node) { - node.showIcon = false -} function onNodeIconEnter(node, level) { // 检查当前节点是否已经展开,如果是,则跳过关闭所有菜单的操作 @@ -1034,14 +754,6 @@ function onNodeIconLeave(node) { delete s.timer } } -// 用户点击图标手动打开 -function openMenu(node, level, ev) { - closeAllMenus(); - const key = node.key - if (!menuState[key]) menuState[key] = { openedByClick: false, open: false } - menuState[key].openedByClick = true - menuState[key].open = true -} // 当 Dropdown 自身触发 openChange(比如点击外部关闭)时,同步状态 function onMenuOpenChange(key: string, open: boolean) { @@ -1216,23 +928,13 @@ function usingDirective(data) { function stopDirective(data) { registerModal.value.usingOrStop(data.key, 'N', true); } -//查看体型标签 -function bodyTagsDetail(data) { -} -//查看情绪标签 -function emotionTagsDetail(data) { - -} // 根据层级返回菜单项 function menuItems(data) { if (data.level === 1) { const items = [ - + { key: 'addIns', label: '新增分类标签', icon: 'ant-design:plus-outlined', canAdd: true, action: addInstruction } ] - if (!!mainOrgCode.value && mainOrgCode.value == ownOrgCode.value) { - items.push({ key: 'addIns', label: '新增分类标签', icon: 'ant-design:plus-outlined', canAdd: true && !!mainOrgCode.value && mainOrgCode.value == ownOrgCode.value, action: addInstruction },) - } if (data.canAdd) { items.push({ key: 'addCat', label: '新增服务类别', icon: 'ant-design:plus-outlined', canAdd: data.canAdd, action: addCategory }) } @@ -1256,10 +958,7 @@ function menuItems(data) { } else if (data.izEnabled === 'Y') { items.push({ key: 'stopCat', label: '停用服务类别', icon: 'ant-design:stop-outlined', canAdd: data.parentLevelEnabled, action: stopCategory }) } - - if (!!mainOrgCode.value && mainOrgCode.value == ownOrgCode.value) { - items.push({ key: 'editCatImg', label: '修改类别图片', icon: 'ant-design:plus-outlined', canAdd: true && !!mainOrgCode.value && mainOrgCode.value == ownOrgCode.value, action: editCategoryAnimationPath },) - } + items.push({ key: 'editCatImg', label: '修改类别图片', icon: 'ant-design:plus-outlined', canAdd: true, action: editCategoryAnimationPath },) return items } else if (data.level === 3) { @@ -1274,42 +973,13 @@ function menuItems(data) { } else if (data.izEnabled === 'Y') { items.push({ key: 'stopTyp', label: '停用服务类型', icon: 'ant-design:stop-outlined', canAdd: data.parentLevelEnabled, action: stopType }) } - if (!!mainOrgCode.value && mainOrgCode.value == ownOrgCode.value) { - items.push({ key: 'editTypeImg', label: '修改类型图片', icon: 'ant-design:plus-outlined', canAdd: true && !!mainOrgCode.value && mainOrgCode.value == ownOrgCode.value, action: editTypeAnimationPath },) - } + items.push({ key: 'editTypeImg', label: '修改类型图片', icon: 'ant-design:plus-outlined', canAdd: true, action: editTypeAnimationPath },) return items } - // else if (data.level === 4) { - // const items = [ - // { key: 'editDir', label: '编辑服务指令', icon: 'ant-design:edit-outlined', canAdd: data.canAdd && data.izEnabled == 'Y', action: editDirective }, - // { key: 'editMedia', label: '编辑指令资源', icon: 'ant-design:edit-outlined', canAdd: data.canAdd && data.izEnabled == 'Y' && mainOrgCode.value == ownOrgCode.value, action: editMedia }, - // ] - // // if (data.canAdd) { - // // items.push({ key: 'addDir', label: '新增服务指令', icon: 'ant-design:plus-outlined', canAdd: data.canAdd , action: addDirective }) - // // } - // if (data.izEnabled === 'N') { - // items.push({ key: 'usingDir', label: '启用服务指令', icon: 'ant-design:check-circle-outlined', canAdd: data.canAdd, action: usingDirective }) - // } else if (data.izEnabled === 'Y') { - // items.push({ key: 'stopDir', label: '停用服务指令', icon: 'ant-design:stop-outlined', canAdd: data.canAdd, action: stopDirective }) - // } - // if (data?.bodyTagList?.length > 0) { - // items.push({ key: 'bodyTagsDetail', label: '查看体型标签', icon: 'ant-design:stop-outlined', canAdd: true, action: bodyTagsDetail }) - // } - // if (data?.emotionTagList?.length > 0) { - // items.push({ key: 'emotionTagsDetail', label: '查看情绪标签', icon: 'ant-design:stop-outlined', canAdd: true, action: emotionTagsDetail }) - // } - // return items - // } return [] } -// 递归取每级第一个 key -function setDefaultExpanded(nodes: any[]) { - // expandedKeys.value.push(nodes[0].key) - // expandedKeys.value.push(nodes[0]?.children?.[0]?.key) - // expandedKeys.value.push(nodes[0]?.children?.[0]?.children?.[0]?.key) -} const treeLoading = ref(false) function reloadTree() { @@ -1376,23 +1046,13 @@ async function initTree() { * 查看指令库 */ function handleDirectiveMainOpen() { - registerModal.value?.openDM(mainOrgCode.value) + registerModal.value?.openDM() } async function getDirectiveMainOrgCode() { let { orgCode, orgName } = await getOrgInfo() ownOrgCode.value = orgCode ownOrgName.value = orgName - let { configValue } = await queryByKey({ key: 'directive_main_org_code' }) - mainOrgCode.value = configValue - if (orgCode != configValue) isShowDM.value = true -} - -function handleBatchAdd() { - batchAddOpen.value = true - nextTick(() => { - dmRef.value?.init() - }) } function onBatchAddClose() { @@ -1407,13 +1067,6 @@ function onBatchAddSubmit() { }) } - -function onAbnormalListOpen() { - abnormalListOpen.value = true - nextTick(() => { - abnormalListRef.value?.reload() - }) -} function onAbnormalListClose() { abnormalListOpen.value = false searchQuery(true, true) @@ -1430,10 +1083,6 @@ async function refreshDMExistedIds(dmOrgInfo, izReset = false, izQuery = true) { } } -async function handleLookNewDirectives() { - await refreshDMExistedIds(directiveMainOrgInfo.value, true) - newDirectiveVisible.value = true -} /** * 关闭新增指令 */ @@ -1441,17 +1090,57 @@ function handleCancelNewDirective() { newDirectiveVisible.value = false } -/** - * 差异比对 - */ -function handleCompare() { - compareListOpen.value = true +const syncCode = ref('') +//打开镜像码管理 +async function directiveSyncCodeMangeFunc() { + syncCode.value = '' + syncCodeVisible.value = true + if (!syncCode.value) { + let res = await getSyncCode({ 'orgCode': ownOrgCode.value }) + syncCode.value = res.result + } } -function onCompareListClose() { - compareListOpen.value = false +async function updateSyncCodeFunc() { + createConfirm({ + iconType: 'warning', + title: '更新镜像码', + content: '更新后旧的镜像码无法继续使用,是否确认更新?', + onOk:async () => { + syncCode.value = '' + let res = await updateSyncCode({ 'orgCode': ownOrgCode.value }) + syncCode.value = res.result + }, + onCancel() { }, + }); } +function copySyncCodeFunc() { + // 创建临时文本域 + const textArea = document.createElement('textarea'); + textArea.value = syncCode.value; + document.body.appendChild(textArea); + textArea.select(); + + try { + // 执行复制命令 + const successful = document.execCommand('copy'); + if (successful) { + createMessage.success('复制成功'); + } else { + createMessage.error('复制失败'); + } + } catch (err) { + console.error('复制失败:', err); + createMessage.error('复制失败'); + } finally { + // 清理DOM + document.body.removeChild(textArea); + } +} + + + // 添加音频结束监听 onMounted(() => { if (audioPlayer.value) { diff --git a/src/views/services/serviceDirective/components/ConfigServiceDirectiveForm.vue b/src/views/services/serviceDirective/components/ConfigServiceDirectiveForm.vue index 33399fd..9b759d3 100644 --- a/src/views/services/serviceDirective/components/ConfigServiceDirectiveForm.vue +++ b/src/views/services/serviceDirective/components/ConfigServiceDirectiveForm.vue @@ -116,44 +116,38 @@ + :value="!!formData.previewFile ? formData.previewFile : defaultPrePic" maxCount="1" /> + :bizPath="formComputedData.mediaFileSavePath" /> + :value="!!formData.previewFileSmall ? formData.previewFileSmall : defaultPreSmallPic" maxCount="1" /> + :bizPath="formComputedData.mediaFileSavePath" /> - + + :bizPath="formComputedData.mediaFileSavePath" maxCount="1" /> - + + :bizPath="formComputedData.mediaFileSavePath" maxCount="1" fileType="mp4" /> + :value="!!formData.immediateFile ? formData.immediateFile : defaultImmediatePic" maxCount="1" /> + :bizPath="formComputedData.mediaFileSavePath" maxCount="1" /> + maxCount="1" /> + :bizPath="formComputedData.mediaFileSavePath" maxCount="1" /> diff --git a/src/views/services/serviceDirective/components/ConfigServiceDirectiveModal.vue b/src/views/services/serviceDirective/components/ConfigServiceDirectiveModal.vue index 2c53829..18d4306 100644 --- a/src/views/services/serviceDirective/components/ConfigServiceDirectiveModal.vue +++ b/src/views/services/serviceDirective/components/ConfigServiceDirectiveModal.vue @@ -1,51 +1,23 @@