服务指令同步

This commit is contained in:
1378012178@qq.com 2025-07-28 10:25:47 +08:00
parent b1d6bf3b7b
commit fcb5541fec
3 changed files with 48 additions and 25 deletions

View File

@ -85,8 +85,8 @@
<span class="node-title" @mouseenter="onNodeEnter(data, data.children, $event)" <span class="node-title" @mouseenter="onNodeEnter(data, data.children, $event)"
@mouseleave="onNodeLeave(data)"> @mouseleave="onNodeLeave(data)">
<div v-if="data.level == 5"> <div v-if="data.level == 5">
<div><strong>体型标签</strong>{{data?.bodyTagList?.map(tag => tag.tagName).join('、')}}</div> <div><strong>体型标签</strong>{{data?.bodyTagList?.map(tag => tag.tagName).join('、') || '-'}}</div>
<div><strong>情绪标签</strong>{{data?.emotionTagList?.map(tag => tag.tagName).join('、')}}</div> <div><strong>情绪标签</strong>{{data?.emotionTagList?.map(tag => tag.tagName).join('、') || '-'}}</div>
</div> </div>
<span v-else-if="data.level == 4">{{ data?.title + '(' + data?.cycleTypeName + ')' }}</span> <span v-else-if="data.level == 4">{{ data?.title + '(' + data?.cycleTypeName + ')' }}</span>
<span v-else>{{ data?.title }}</span> <span v-else>{{ data?.title }}</span>
@ -479,12 +479,13 @@ function expandTreeNodeToLevel4(directiveData: any) {
* 查询 * 查询
*/ */
function searchQuery() { function searchQuery() {
reload().then(() => { if (!!queryParam.directiveName || !!queryParam.bodyTags || !!queryParam.emotionTags || !!queryParam.izEnabled) {
const dataSource = getDataSource(); queryParam.instructionTagId = '';
if (dataSource.length === 1) { queryParam.categoryId = '';
const directiveData = dataSource[0]; // queryParam.typeId = '';
expandTreeNodeToLevel4(directiveData); //
} }
reload().then(() => {
initTree();
}); });
} }
@ -507,9 +508,7 @@ function searchReset() {
// //
reload().then(() => { reload().then(() => {
// initTree();
expandedKeys.value = [];
setDefaultExpanded(treeData.value);
}); });
} }
@ -795,11 +794,13 @@ function stopType(data) {
// //
function addDirective(data) { function addDirective(data) {
registerModal.value.disableSubmit = false; registerModal.value.disableSubmit = false;
registerModal.value.opeType = 'add';
registerModal.value.edit({ instructionTagId: data.instructionId, categoryId: data.categoryId, typeId: data.typeId }); registerModal.value.edit({ instructionTagId: data.instructionId, categoryId: data.categoryId, typeId: data.typeId });
} }
// //
function editDirective(data) { function editDirective(data) {
registerModal.value.disableSubmit = false; registerModal.value.disableSubmit = false;
registerModal.value.opeType = 'edit';
registerModal.value.queryByIdFunc(data.key); registerModal.value.queryByIdFunc(data.key);
} }
// //
@ -873,9 +874,9 @@ function menuItems(data) {
{ key: 'editDir', label: '编辑服务指令', icon: 'ant-design:edit-outlined', action: editDirective }, { key: 'editDir', label: '编辑服务指令', icon: 'ant-design:edit-outlined', action: editDirective },
{ key: 'editMedia', label: '编辑指令资源', icon: 'ant-design:edit-outlined', action: editMedia }, { key: 'editMedia', label: '编辑指令资源', icon: 'ant-design:edit-outlined', action: editMedia },
] ]
if (data.canAdd) { // if (data.canAdd) {
items.push({ key: 'addDir', label: '新增服务指令', icon: 'ant-design:plus-outlined', action: addDirective }) // items.push({ key: 'addDir', label: '', icon: 'ant-design:plus-outlined', action: addDirective })
} // }
if (data.izEnabled === '1') { if (data.izEnabled === '1') {
items.push({ key: 'usingDir', label: '启用服务指令', icon: 'ant-design:check-circle-outlined', action: usingDirective }) items.push({ key: 'usingDir', label: '启用服务指令', icon: 'ant-design:check-circle-outlined', action: usingDirective })
} else if (data.izEnabled === '0') { } else if (data.izEnabled === '0') {
@ -945,13 +946,8 @@ function handleTreeSelect(selectedKeys: string[], { node }: any) {
// //
searchQuery(); searchQuery();
} }
//
onMounted(() => { function initTree() {
if (audioPlayer.value) {
audioPlayer.value.addEventListener('ended', () => {
isPlaying.value = false;
});
}
treeLoading.value = true treeLoading.value = true
tree().then(res => { tree().then(res => {
treeData.value = res; treeData.value = res;
@ -962,6 +958,16 @@ onMounted(() => {
.finally(() => { .finally(() => {
treeLoading.value = false treeLoading.value = false
}) })
}
//
onMounted(() => {
if (audioPlayer.value) {
audioPlayer.value.addEventListener('ended', () => {
isPlaying.value = false;
});
}
initTree()
}); });
</script> </script>

View File

@ -366,9 +366,12 @@ const formComputedData = computed(() => {
watch( watch(
() => formData.instructionTagId, () => formData.instructionTagId,
(newInstructionTagId) => { (newInstructionTagId) => {
if (!newInstructionTagId) { if (needWatch.value) {
formData.categoryId = '' formData.categoryId = ''
formData.typeId = '' formData.typeId = ''
formData.cycleType = ''
}
if (!newInstructionTagId) {
categoryDictCode.value = 'nu_config_service_category,category_name,id,1=2'; categoryDictCode.value = 'nu_config_service_category,category_name,id,1=2';
} else { } else {
categoryDictCode.value = `nu_config_service_category,category_name,id,del_flag = 0 and instruction_id = '${newInstructionTagId}' order by sort asc`; categoryDictCode.value = `nu_config_service_category,category_name,id,del_flag = 0 and instruction_id = '${newInstructionTagId}' order by sort asc`;
@ -378,26 +381,41 @@ watch(
watch( watch(
() => formData.categoryId, () => formData.categoryId,
(newCategoryId) => { (newCategoryId) => {
if (!newCategoryId) { if (needWatch.value) {
formData.typeId = '' formData.typeId = ''
formData.cycleType = ''
}
if (!newCategoryId) {
typeDictCode.value = 'nu_config_service_type,type_name,id,del_flag = 99 order by sort asc'; typeDictCode.value = 'nu_config_service_type,type_name,id,del_flag = 99 order by sort asc';
} else { } else {
typeDictCode.value = `nu_config_service_type,type_name,id,del_flag = 0 and category_id = '${newCategoryId}' order by sort asc`; typeDictCode.value = `nu_config_service_type,type_name,id,del_flag = 0 and category_id = '${newCategoryId}' order by sort asc`;
} }
} }
); );
watch(
() => formData.typeId,
(newTypeId) => {
if (needWatch.value) {
formData.cycleType = ''
}
}
);
/** /**
* 新增 * 新增
*/ */
function add() { function add() {
edit({}); edit({});
} }
const needWatch = ref(false)
/** /**
* 编辑 * 编辑
* isEditMedia_是否为编辑指令资源 隐藏业务字段 * isEditMedia_是否为编辑指令资源 隐藏业务字段
*/ */
function edit(record, isEditMedia_ = false) { function edit(record, isEditMedia_ = false) {
needWatch.value = false
setTimeout(() => {
needWatch.value = true
}, 1000)
isEditMedia.value = isEditMedia_ isEditMedia.value = isEditMedia_
formData.bodyTags = '' formData.bodyTags = ''
formData.emotionTags = '' formData.emotionTags = ''

View File

@ -4,8 +4,7 @@
:maskClosable="false"> :maskClosable="false">
<template #footer> <template #footer>
<a-button @click="handleCancel">关闭</a-button> <a-button @click="handleCancel">关闭</a-button>
<a-button @click="handleOk" <a-button @click="handleOk" v-show="opeType == 'add' || opeType == 'edit' || opeType == 'editMedia'"
v-show="opeType == 'add' || opeType == 'edit' || opeType == 'audit' || opeType == 'audit' || opeType == 'editMedia'"
:loading="loading">确定</a-button> :loading="loading">确定</a-button>
<!-- <a-button @click="handleSave" v-show="opeType == 'editMedia' || opeType == 'auditMedia'">暂存</a-button> <!-- <a-button @click="handleSave" v-show="opeType == 'editMedia' || opeType == 'auditMedia'">暂存</a-button>
<a-button type="primary" @click="handleMediaAsync" v-show="opeType == 'auditMedia'">同步</a-button> <a-button type="primary" @click="handleMediaAsync" v-show="opeType == 'auditMedia'">同步</a-button>