diff --git a/src/views/services/serviceDirective/ConfigServiceDirective.api.ts b/src/views/services/serviceDirective/ConfigServiceDirective.api.ts
index 89f816a..ee5141b 100644
--- a/src/views/services/serviceDirective/ConfigServiceDirective.api.ts
+++ b/src/views/services/serviceDirective/ConfigServiceDirective.api.ts
@@ -15,6 +15,8 @@ enum Api {
departList = '/sys/sysDepart/list',
tree = '/services/serviceDirective/tree',
queryById = '/services/serviceDirective/queryById',
+ syncMediaForBiz = '/services/serviceDirective/syncMediaForBiz',
+ syncMediaForAllBiz= '/services/serviceDirective/syncMediaForAllBiz',
}
/**
@@ -89,4 +91,20 @@ export const asyncFunc = (params) => {
* @param params
* @returns
*/
-export const tree = () => defHttp.get({ url: Api.tree });
\ No newline at end of file
+export const tree = () => defHttp.get({ url: Api.tree });
+
+/**
+ * 审批通过后将指令资源同步给业务平台
+ * @param params
+ */
+export const syncMediaForBiz = (params) => {
+ return defHttp.post({ url: Api.syncMediaForBiz, params });
+};
+
+/**
+ * 将指令资源同步给所有业务平台
+ * @param params
+ */
+export const syncMediaForAllBiz = (params) => {
+ return defHttp.post({ url: Api.syncMediaForAllBiz, params });
+};
\ No newline at end of file
diff --git a/src/views/services/serviceDirective/ConfigServiceDirective.data.ts b/src/views/services/serviceDirective/ConfigServiceDirective.data.ts
index b6e13a2..7e34648 100644
--- a/src/views/services/serviceDirective/ConfigServiceDirective.data.ts
+++ b/src/views/services/serviceDirective/ConfigServiceDirective.data.ts
@@ -7,31 +7,31 @@ export const columns: BasicColumn[] = [
align: 'center',
dataIndex: 'instructionTagId_dictText',
width: 100,
- customCell: (record, index, column) => {
- if (record.instructionRowSpan != null) {
- return { rowSpan: record.instructionRowSpan };
- }
- },
+ // customCell: (record, index, column) => {
+ // if (record.instructionRowSpan != null) {
+ // return { rowSpan: record.instructionRowSpan };
+ // }
+ // },
},
{
title: '服务类别',
align: 'center',
dataIndex: 'categoryId_dictText',
- customCell: (record, index, column) => {
- if (record.categoryRowSpan != null) {
- return { rowSpan: record.categoryRowSpan };
- }
- },
+ // customCell: (record, index, column) => {
+ // if (record.categoryRowSpan != null) {
+ // return { rowSpan: record.categoryRowSpan };
+ // }
+ // },
},
{
title: '服务类型',
align: 'center',
dataIndex: 'typeId_dictText',
- customCell: (record, index, column) => {
- if (record.typeRowSpan != null) {
- return { rowSpan: record.typeRowSpan };
- }
- },
+ // customCell: (record, index, column) => {
+ // if (record.typeRowSpan != null) {
+ // return { rowSpan: record.typeRowSpan };
+ // }
+ // },
},
{
title: '服务指令',
diff --git a/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue b/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue
index e3e026a..8e408cf 100644
--- a/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue
+++ b/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue
@@ -75,12 +75,23 @@
-
+ 新增分类标签
+
-
- {{ data?.title + '(' + data?.cycleTypeName + ')' }}
+
+
+
+
+
体型标签:{{data?.bodyTagList?.map(tag => tag.tagName).join('、')}}
+
情绪标签:{{data?.emotionTagList?.map(tag => tag.tagName).join('、')}}
+
+ {{ data?.title + '(' + data?.cycleTypeName + ')' }}
{{ data?.title }}
(已停用)
+
@@ -93,9 +104,9 @@
-
+
@@ -106,17 +117,17 @@
- 配置分类标签
配置服务类别
- 配置服务类型
+ 配置服务类型 -->
配置体型标签
配置情绪标签
- 新增服务指令
+
@@ -365,6 +376,7 @@ function handleSuperQuery(params) {
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
+ registerModal.value.opeType = 'add';
registerModal.value.add();
}
@@ -373,6 +385,7 @@ function handleAdd() {
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
+ registerModal.value.opeType = 'edit';
registerModal.value.edit(record);
}
@@ -381,6 +394,7 @@ function handleEdit(record: Recordable) {
*/
function handleMedia(record: Recordable) {
registerModal.value.disableSubmit = false;
+ registerModal.value.opeType = 'editMedia';
registerModal.value.editMedia(record);
}
@@ -389,6 +403,7 @@ function handleMedia(record: Recordable) {
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
+ registerModal.value.opeType = 'look';
registerModal.value.edit(record);
}
@@ -410,14 +425,14 @@ function getTableAction(record) {
label: '详情',
onClick: handleDetail.bind(null, record),
},
- {
- label: '编辑',
- onClick: handleEdit.bind(null, record)
- },
- {
- label: '指令资源',
- onClick: handleMedia.bind(null, record)
- },
+ // {
+ // label: '编辑',
+ // onClick: handleEdit.bind(null, record)
+ // },
+ // {
+ // label: '指令资源',
+ // onClick: handleMedia.bind(null, record)
+ // },
];
}
@@ -429,23 +444,76 @@ function getDropDownAction(record) {
]
}
+function expandTreeNodeToLevel4(directiveData: any) {
+ // 清空之前展开的节点
+ 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);
+}
+
/**
* 查询
*/
function searchQuery() {
- reload();
+ reload().then(() => {
+ const dataSource = getDataSource();
+ if (dataSource.length === 1) {
+ const directiveData = dataSource[0]; // 获取该结果的所有字段
+ expandTreeNodeToLevel4(directiveData); // 调用展开树的方法
+ }
+ });
}
+
/**
* 重置
*/
function searchReset() {
- formRef.value.resetFields();
- selectedRowKeys.value = [];
- //刷新数据
- reload();
+ formRef.value.resetFields(); // 重置表单字段
+ selectedRowKeys.value = []; // 清空选中的行
+
+ // 清空 queryParam 中相关字段
+ queryParam.instructionTagId = '';
+ queryParam.categoryId = '';
+ queryParam.typeId = '';
+ queryParam.directiveName = ''; // 如果你有其他需要清除的字段,也可以加到这里
+ queryParam.bodyTags = '';
+ queryParam.emotionTags = '';
+ queryParam.izEnabled = '';
+
+ // 刷新数据
+ reload().then(() => {
+ // 清空之前展开的节点
+ expandedKeys.value = [];
+ setDefaultExpanded(treeData.value);
+ });
}
+
let rangeField = 'tollPrice,comPrice,'
/**
@@ -561,7 +629,6 @@ const playAudio = (url: string) => {
if (audioPlayer.value) {
audioPlayer.value.src = getFileAccessHttpUrl(url);
audioPlayer.value.play().catch(e => {
- console.error('播放失败:', e);
isPlaying.value = false;
currentPlayingAudio.value = null;
});
@@ -578,7 +645,6 @@ const pauseAudio = () => {
const resumeAudio = () => {
if (audioPlayer.value) {
audioPlayer.value.play().catch(e => {
- console.error('继续播放失败:', e);
});
isPlaying.value = true;
}
@@ -588,7 +654,6 @@ const restartAudio = () => {
if (audioPlayer.value) {
audioPlayer.value.currentTime = 0;
audioPlayer.value.play().catch(e => {
- console.error('重新播放失败:', e);
});
isPlaying.value = true;
}
@@ -608,68 +673,59 @@ const clickCount = ref(0);
const treeChildData = ref([]);
const expandedKeys = ref([]);
-watch(expandedKeys, () => {
- console.log('expandedKeys', expandedKeys);
-});
// 为每个 node 维护一个菜单状态和 hover 定时器
const menuState = reactive>({
})
-
-function onNodeEnter(node, level) {
- const key = node.key
- if (!menuState[key]) {
- menuState[key] = { openedByClick: false, open: false }
- }
- // 只有前三级需要自动弹
- if (level <= 3 && !menuState[key].openedByClick) {
- menuState[key].timer = window.setTimeout(() => {
- menuState[key].open = true
- }, 2000)
- }
+function onNodeEnter(node, level, event) {
+ node.showIcon = true
}
function onNodeLeave(node) {
+ node.showIcon = false
+}
+
+function onNodeIconEnter(node, level) {
+ // 检查当前节点是否已经展开,如果是,则跳过关闭所有菜单的操作
+ const key = node.key;
+ const currentMenuState = menuState[key];
+
+ if (currentMenuState?.open) {
+ // 当前菜单已经展开,直接返回
+ return;
+ }
+
+ // 如果没有菜单状态,则初始化
+ if (!menuState[key]) {
+ menuState[key] = { openedByClick: false, open: false };
+ }
+
+ // 只有前三级需要自动展开
+ if (level <= 3 && !menuState[key].openedByClick) {
+ menuState[key].timer = window.setTimeout(() => {
+ menuState[key].open = true;
+ }, 2000);
+ }
+}
+
+
+function onNodeIconLeave(node) {
const s = menuState[node.key]
if (s?.timer) {
clearTimeout(s.timer)
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
}
-// 鼠标悬浮:打开或关闭,但不覆盖由点击打开后的状态切换
-function onNodeHover(key: string, level: number, enter: boolean) {
- if (!menuState[key]) menuState[key] = { open: false, openedByClick: false }
- // 只有鼠标移入时,且不是由点击保持打开时,才打开
- if (enter && !menuState[key].openedByClick) {
- closeAllMenus()
- menuState[key].open = true
- }
- // 鼠标移出时,如果不是点击打开的,就关闭
- if (!enter && !menuState[key].openedByClick) {
- menuState[key].open = false
- }
-}
-
-// 点击图标:切换状态,并且每次点击前先关闭其它菜单
-function onIconClick(key: string, level: number) {
- if (!menuState[key]) menuState[key] = { open: false, openedByClick: false }
- // 先关掉其它
- closeAllMenus()
- // 再切换当前
- menuState[key].openedByClick = !menuState[key].openedByClick
- menuState[key].open = menuState[key].openedByClick
-}
-
// 当 Dropdown 自身触发 openChange(比如点击外部关闭)时,同步状态
function onMenuOpenChange(key: string, open: boolean) {
if (!menuState[key]) menuState[key] = { open: false, openedByClick: false }
@@ -746,6 +802,12 @@ function editDirective(data) {
registerModal.value.disableSubmit = false;
registerModal.value.queryByIdFunc(data.key);
}
+//指令资源
+function editMedia(data) {
+ registerModal.value.disableSubmit = false;
+ registerModal.value.opeType = 'editMedia';
+ registerModal.value.queryAndEditMedia(data.key);
+}
//启用服务指令
function usingDirective(data) {
registerModal.value.usingOrStop(data.key, '0');
@@ -754,7 +816,14 @@ function usingDirective(data) {
function stopDirective(data) {
registerModal.value.usingOrStop(data.key, '1');
}
+//查看体型标签
+function bodyTagsDetail(data) {
+}
+//查看情绪标签
+function emotionTagsDetail(data) {
+
+}
// 根据层级返回菜单项
function menuItems(data) {
if (data.level === 1) {
@@ -802,6 +871,7 @@ function menuItems(data) {
else if (data.level === 4) {
const items = [
{ key: 'editDir', label: '编辑服务指令', icon: 'ant-design:edit-outlined', action: editDirective },
+ { key: 'editMedia', label: '编辑指令资源', icon: 'ant-design:edit-outlined', action: editMedia },
]
if (data.canAdd) {
items.push({ key: 'addDir', label: '新增服务指令', icon: 'ant-design:plus-outlined', action: addDirective })
@@ -811,6 +881,12 @@ function menuItems(data) {
} else if (data.izEnabled === '0') {
items.push({ key: 'stopDir', label: '停用服务指令', icon: 'ant-design:stop-outlined', action: stopDirective })
}
+ if (data?.bodyTagList?.length > 0) {
+ items.push({ key: 'bodyTagsDetail', label: '查看体型标签', icon: 'ant-design:stop-outlined', action: bodyTagsDetail })
+ }
+ if (data?.emotionTagList?.length > 0) {
+ items.push({ key: 'emotionTagsDetail', label: '查看情绪标签', icon: 'ant-design:stop-outlined', action: emotionTagsDetail })
+ }
return items
}
return []
@@ -819,21 +895,56 @@ function menuItems(data) {
// 递归取每级第一个 key
function setDefaultExpanded(nodes: any[]) {
- if (!nodes?.length) return
- const first = nodes[0]
- expandedKeys.value.push(first.key)
- if (first.children?.length) {
- setDefaultExpanded(first.children)
- }
+ 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() {
- console.log(3333)
tree().then(res => {
treeData.value = res;
})
}
+
+function handleTreeSelect(selectedKeys: string[], { node }: any) {
+ const level = node.level;
+
+ // 清空不必要的查询条件
+ queryParam.directiveName = '';
+ queryParam.bodyTags = '';
+ queryParam.emotionTags = '';
+ queryParam.izEnabled = '';
+
+ // 根据节点级别设置查询条件
+ switch (level) {
+ case 1: // 分类标签
+ queryParam.instructionTagId = node.instructionId;
+ queryParam.categoryId = '';
+ queryParam.typeId = '';
+ break;
+ case 2: // 服务类别
+ queryParam.instructionTagId = node.instructionId;
+ queryParam.categoryId = node.categoryId;
+ queryParam.typeId = '';
+ break;
+ case 3: // 服务类型
+ queryParam.instructionTagId = node.instructionId;
+ queryParam.categoryId = node.categoryId;
+ queryParam.typeId = node.typeId;
+ break;
+ case 4: // 服务指令
+ // 四级节点特殊处理:设置指令名称
+ queryParam.instructionTagId = node.instructionId;
+ queryParam.categoryId = node.categoryId;
+ queryParam.typeId = node.typeId;
+ queryParam.directiveName = node.title;
+ break;
+ }
+ if (level == 5) return
+ // 触发查询
+ searchQuery();
+}
// 添加音频结束监听
onMounted(() => {
if (audioPlayer.value) {
@@ -909,4 +1020,18 @@ audio::-webkit-media-controls-time-remaining-display {
margin-left: 4px;
cursor: pointer;
}
+
+:deep(.centered-dropdown) {
+ position: fixed;
+ left: 50% !important;
+ top: 50% !important;
+ transform: translate(-50%, -50%) !important;
+ max-height: 80vh;
+ overflow-y: auto;
+
+ .ant-dropdown-menu {
+ max-height: 70vh;
+ overflow-y: auto;
+ }
+}
diff --git a/src/views/services/serviceDirective/components/ConfigServiceDirectiveForm.vue b/src/views/services/serviceDirective/components/ConfigServiceDirectiveForm.vue
index 2898f5d..4bf9e89 100644
--- a/src/views/services/serviceDirective/components/ConfigServiceDirectiveForm.vue
+++ b/src/views/services/serviceDirective/components/ConfigServiceDirectiveForm.vue
@@ -10,15 +10,13 @@
id="ConfigServiceDirectiveForm-instructionTagId" name="instructionTagId">
+ placeholder="请选择分类标签" allowClear @upDictCode="upInstructionDictCode" :disabled="!!formData.id" />
-
@@ -26,15 +24,14 @@
+ :disabled="!!formData.id" placeholder="请选择服务类型" allowClear @upDictCode="upTypeDictCode" />
+ :disabled="!!formData.id">
@@ -69,8 +66,7 @@
+ placeholder="请选择周期类型" allowClear @upDictCode="upCycleTypeDictCode" :disabled="!!formData.id" />
@@ -105,11 +101,11 @@
-
+
- 无文件
- 暂无文件
+
@@ -117,57 +113,60 @@
- 暂无描述
-
+
-
+
-
+
-
-
- 无文件
-