服务指令-树处理
This commit is contained in:
parent
405fe93f30
commit
49026c45b0
|
@ -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',
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,3 +92,19 @@ export const asyncFunc = (params) => {
|
|||
* @returns
|
||||
*/
|
||||
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 });
|
||||
};
|
|
@ -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: '服务指令',
|
||||
|
|
|
@ -75,12 +75,23 @@
|
|||
<div>
|
||||
<div style="width:350px;float: left;max-height:77vh; overflow:auto;">
|
||||
<a-empty v-if="treeLoading" />
|
||||
<a-tree v-else :tree-data="treeData" v-model:expandedKeys="expandedKeys" expandAction="click">
|
||||
<a-button v-else-if="!treeLoading && treeData.length < 1" type="link" class="btnPrivate" @click="addInstruction"
|
||||
preIcon="ant-design:plus-outlined">新增分类标签</a-button>
|
||||
<a-tree v-else :tree-data="treeData" v-model:expandedKeys="expandedKeys" expandAction="click"
|
||||
@select="handleTreeSelect">
|
||||
<template #title="{ data }">
|
||||
<span class="node-title" @mouseenter="onNodeEnter(data, data.children)" @mouseleave="onNodeLeave(data)">
|
||||
<span v-if="data.level == 4">{{ data?.title + '(' + data?.cycleTypeName + ')' }}</span>
|
||||
<!-- @click.stop="openMenu(data, data.children, $event)" -->
|
||||
<!-- @contextmenu.prevent="openMenu(data, data.children, $event)" -->
|
||||
<span class="node-title" @mouseenter="onNodeEnter(data, data.children, $event)"
|
||||
@mouseleave="onNodeLeave(data)">
|
||||
<div v-if="data.level == 5">
|
||||
<div><strong>体型标签:</strong>{{data?.bodyTagList?.map(tag => tag.tagName).join('、')}}</div>
|
||||
<div><strong>情绪标签:</strong>{{data?.emotionTagList?.map(tag => tag.tagName).join('、')}}</div>
|
||||
</div>
|
||||
<span v-else-if="data.level == 4">{{ data?.title + '(' + data?.cycleTypeName + ')' }}</span>
|
||||
<span v-else>{{ data?.title }}</span>
|
||||
<span v-if="data?.izEnabled == '1'" style="color:red;">(已停用)</span>
|
||||
|
||||
<!-- 下拉菜单 -->
|
||||
<a-dropdown :open="menuState[data?.key]?.open" @openChange="onMenuOpenChange(data.key, $event)">
|
||||
<template #overlay>
|
||||
|
@ -93,9 +104,9 @@
|
|||
</a-menu>
|
||||
</template>
|
||||
<!-- 图标 -->
|
||||
<Icon style="color:#1890FF;" :icon="iconClass(data.level)" class="action-icon"
|
||||
@click.stop="openMenu(data, data.children, $event)"
|
||||
@contextmenu.prevent="openMenu(data, data.children, $event)"></Icon>
|
||||
<Icon v-show="data.showIcon && data.level != 5" style="color:#1890FF;" :icon="iconClass(data.level)"
|
||||
class="action-icon" @mouseenter="onNodeIconEnter(data, data.children)"
|
||||
@mouseleave="onNodeIconLeave(data)" />
|
||||
</a-dropdown>
|
||||
</span>
|
||||
</template>
|
||||
|
@ -106,17 +117,17 @@
|
|||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" class="btnPrivate" @click="handleinstructionTag"
|
||||
<!-- <a-button type="primary" class="btnPrivate" @click="handleinstructionTag"
|
||||
preIcon="tabler:settings">配置分类标签</a-button>
|
||||
<a-button type="primary" class="btnPrivate" @click="handleCategory"
|
||||
preIcon="tabler:settings">配置服务类别</a-button>
|
||||
<a-button type="primary" class="btnPrivate" @click="handleType" preIcon="tabler:settings">配置服务类型</a-button>
|
||||
<a-button type="primary" class="btnPrivate" @click="handleType" preIcon="tabler:settings">配置服务类型</a-button> -->
|
||||
<a-button type="primary" class="btnPrivate" @click="handleBodyTag"
|
||||
preIcon="tabler:settings">配置体型标签</a-button>
|
||||
<a-button type="primary" class="btnPrivate" @click="handleEmotionTag"
|
||||
preIcon="tabler:settings">配置情绪标签</a-button>
|
||||
<a-button type="primary" class="btnPrivate" @click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined">新增服务指令</a-button>
|
||||
<!-- <a-button type="primary" class="btnPrivate" @click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined">新增服务指令</a-button> -->
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
|
@ -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<any>([]);
|
||||
const expandedKeys = ref<string[]>([]);
|
||||
|
||||
watch(expandedKeys, () => {
|
||||
console.log('expandedKeys', expandedKeys);
|
||||
});
|
||||
|
||||
// 为每个 node 维护一个菜单状态和 hover 定时器
|
||||
const menuState = reactive<Record<string, { timer?: number, openedByClick: boolean, open: boolean }>>({
|
||||
|
||||
})
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -10,15 +10,13 @@
|
|||
id="ConfigServiceDirectiveForm-instructionTagId" name="instructionTagId">
|
||||
<j-dict-select-tag v-model:value="formData.instructionTagId"
|
||||
:dictCode="`nu_config_service_instruction_tag,instruction_name,id,del_flag = 0 order by sort asc`"
|
||||
placeholder="请选择分类标签" allowClear @upDictCode="upInstructionDictCode"
|
||||
:disabled="!!formData.id && formData.status == 0" />
|
||||
placeholder="请选择分类标签" allowClear @upDictCode="upInstructionDictCode" :disabled="!!formData.id" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="服务类别" v-bind="validateInfos.categoryId" id="ConfigServiceDirectiveForm-categoryId"
|
||||
name="categoryId">
|
||||
<j-dict-select-tag type="list" v-model:value="formData.categoryId"
|
||||
:disabled="!formData.instructionTagId || (!!formData.id && formData.status == 0)"
|
||||
<j-dict-select-tag type="list" v-model:value="formData.categoryId" :disabled="!!formData.id"
|
||||
:dictCode="categoryDictCode" placeholder="请选择服务类别" allow-clear @upDictCode="upCategoryDictCode" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -26,15 +24,14 @@
|
|||
<a-form-item label="服务类型" v-bind="validateInfos.typeId" id="ConfigServiceDirectiveForm-typeId"
|
||||
name="typeId">
|
||||
<j-dict-select-tag type="list" v-model:value="formData.typeId" :dictCode="typeDictCode"
|
||||
:disabled="!formData.categoryId || (!!formData.id && formData.status == 0)" placeholder="请选择服务类型"
|
||||
allowClear @upDictCode="upTypeDictCode" />
|
||||
:disabled="!!formData.id" placeholder="请选择服务类型" allowClear @upDictCode="upTypeDictCode" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="服务指令名称" v-bind="validateInfos.directiveName"
|
||||
id="ConfigServiceDirectiveForm-directiveName" name="directiveName">
|
||||
<a-input v-model:value="formData.directiveName" placeholder="请输入服务指令名称" allow-clear
|
||||
:disabled="!!formData.id && formData.status == 0"></a-input>
|
||||
:disabled="!!formData.id"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
|
@ -69,8 +66,7 @@
|
|||
<a-form-item label="周期类型" v-bind="validateInfos.cycleType" id="ConfigServiceDirectiveForm-cycleType"
|
||||
name="cycleType">
|
||||
<j-dict-select-tag type="list" v-model:value="formData.cycleType" dictCode="period_type"
|
||||
placeholder="请选择周期类型" allowClear @upDictCode="upCycleTypeDictCode"
|
||||
:disabled="!!formData.id && formData.status == 0" />
|
||||
placeholder="请选择周期类型" allowClear @upDictCode="upCycleTypeDictCode" :disabled="!!formData.id" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
|
@ -105,11 +101,11 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row v-if="disabled">
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="服务指令图片" v-bind="validateInfos.previewFile">
|
||||
<span v-if="!formData.previewFile">无文件</span>
|
||||
<JImageUpload v-else :fileMax="1" v-model:value="formData.previewFile" disabled
|
||||
<span v-if="disabled && !formData.previewFile">暂无文件</span>
|
||||
<JImageUpload v-else :fileMax="1" v-model:value="formData.previewFile"
|
||||
:bizPath="formComputedData.mediaFileSavePath">
|
||||
</JImageUpload>
|
||||
</a-form-item>
|
||||
|
@ -117,57 +113,60 @@
|
|||
<a-col :span="12">
|
||||
<a-form-item label="服务指令描述" v-bind="validateInfos.serviceContent"
|
||||
id="ConfigServiceDirectiveForm-serviceContent" name="serviceContent">
|
||||
<span v-if="!formData.serviceContent">暂无描述</span>
|
||||
<a-textarea v-else v-model:value="formData.serviceContent" :rows="2" disabled />
|
||||
<a-textarea v-model:value="formData.serviceContent" :rows="2" placeholder="请输入服务指令描述" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<!-- <a-row v-if="formData.izEnabled == 0 || formData.izEnabled == 1">
|
||||
<a-row v-show="!disabled">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="指令音频文件" v-bind="validateInfos.mp3File" id="ConfigServiceDirectiveForm-mp3File">
|
||||
<span v-if="!formData.mp3File">无文件</span>
|
||||
<j-upload v-else v-model:value="formData.mp3File" accept=".mp3" :maxCount="1" disabled
|
||||
<j-upload v-model:value="formData.mp3File" accept=".mp3" :maxCount="1"
|
||||
:bizPath="formComputedData.mediaFileSavePath"></j-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="指令视频文件" v-bind="validateInfos.mp4File" id="ConfigServiceDirectiveForm-mp4File">
|
||||
<span v-if="!formData.mp4File">无文件</span>
|
||||
<j-upload v-else v-model:value="formData.mp4File" accept=".mp4" :maxCount="1" disabled
|
||||
<j-upload v-model:value="formData.mp4File" accept=".mp4" :maxCount="1"
|
||||
:bizPath="formComputedData.mediaFileSavePath"></j-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-row>
|
||||
</a-row>
|
||||
</a-row> -->
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
<JFormContainer v-if="disabled">
|
||||
<JFormContainer style="margin-top: -40px;">
|
||||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
|
||||
name="ConfigServiceDirectiveForm">
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="指令音频文件" id="ConfigServiceDirectiveForm-mp3File">
|
||||
<span v-if="!formData.mp3File">无文件</span>
|
||||
<audio v-else controls disabled="false">
|
||||
<a-col :span="12" v-if="!!formData.mp3File">
|
||||
<a-form-item label="指令音频预览" id="ConfigServiceDirectiveForm-mp3File">
|
||||
<audio controls disabled="false">
|
||||
<source :src="getFileAccessHttpUrl(formData.mp3File)">
|
||||
</audio>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="指令视频文件" id="ConfigServiceDirectiveForm-mp4File">
|
||||
<span v-if="!formData.mp4File">无文件</span>
|
||||
<video v-else controls>
|
||||
<a-col :span="12" v-if="disabled && !formData.mp3File">
|
||||
<a-form-item label="指令音频预览">
|
||||
<span>暂无文件</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12" v-if="!!formData.mp4File" :push="!!formData.mp3File ? 0 : 12">
|
||||
<a-form-item label="指令视频预览" id="ConfigServiceDirectiveForm-mp4File">
|
||||
<video controls>
|
||||
<source :src="getFileAccessHttpUrl(formData.mp4File)">
|
||||
</video>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12" v-if="disabled && !formData.mp3File">
|
||||
<a-form-item label="指令视频预览">
|
||||
<span>暂无文件</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="即时指令图标" v-bind="validateInfos.immediateFile">
|
||||
<span v-if="!formData.immediateFile">无文件</span>
|
||||
<JImageUpload v-else :fileMax="1" v-model:value="formData.immediateFile" disabled
|
||||
<span v-if="disabled && !formData.immediateFile">暂无文件</span>
|
||||
<JImageUpload v-else :fileMax="1" v-model:value="formData.immediateFile"
|
||||
:bizPath="formComputedData.mediaFileSavePath">
|
||||
</JImageUpload>
|
||||
</a-form-item>
|
||||
|
@ -188,7 +187,7 @@ import { JCheckbox } from '/@/components/Form';
|
|||
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
|
||||
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
|
||||
import { getValueType } from '/@/utils';
|
||||
import { saveOrUpdate } from '../ConfigServiceDirective.api';
|
||||
import { saveOrUpdate, syncMediaForBiz, syncMediaForAllBiz } from '../ConfigServiceDirective.api';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
|
||||
|
@ -461,6 +460,8 @@ async function submitForm() {
|
|||
return
|
||||
}
|
||||
|
||||
model.mediaFileSavePath = formComputedData.value.mediaFileSavePath
|
||||
|
||||
await saveOrUpdate(model, isUpdate.value)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
|
@ -475,11 +476,45 @@ async function submitForm() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步媒体资源给指令所有者对应业务平台
|
||||
*
|
||||
*/
|
||||
function syncMediaForBizFunc() {
|
||||
formData.mediaFileSavePath = formComputedData.value.mediaFileSavePath
|
||||
syncMediaForBiz(formData)
|
||||
.then((res) => {
|
||||
createMessage.success('操作成功!');
|
||||
emit('ok');
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步媒体资源给所有业务平台
|
||||
*
|
||||
*/
|
||||
function syncMediaForAllBizFunc() {
|
||||
formData.mediaFileSavePath = formComputedData.value.mediaFileSavePath
|
||||
syncMediaForAllBiz(formData)
|
||||
.then((res) => {
|
||||
createMessage.success('操作成功!');
|
||||
emit('ok');
|
||||
})
|
||||
.finally(() => {
|
||||
confirmLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
submitForm,
|
||||
syncMediaForBizFunc,
|
||||
syncMediaForAllBizFunc
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
:maskClosable="false">
|
||||
<template #footer>
|
||||
<a-button @click="handleCancel">关闭</a-button>
|
||||
<a-button @click="handleOk" :loading="loading">确定</a-button>
|
||||
<!-- <a-button @click="handleOk" v-show="opeType == 'edit' || opeType == 'audit'">确定</a-button>
|
||||
<a-button @click="handleSave" v-show="opeType == 'editMedia' || opeType == 'auditMedia'">暂存</a-button>
|
||||
<a-button @click="handleOk"
|
||||
v-show="opeType == 'add' || opeType == 'edit' || opeType == 'audit' || opeType == 'audit' || opeType == 'editMedia'"
|
||||
:loading="loading">确定</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="handleMediaSyncAllPlat" v-show="opeType == 'editMedia'">同步</a-button> -->
|
||||
</template>
|
||||
|
@ -33,7 +34,7 @@ const visible = ref<boolean>(false);
|
|||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
const opeType = ref('')//操作类型 add新增 edit编辑 editMedia主列表-指令资源 look详情 audit审核 auditMedia审核列表-指令资源
|
||||
|
||||
/**
|
||||
* 新增
|
||||
|
@ -58,6 +59,23 @@ function edit(record) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑指令资源
|
||||
* @param record
|
||||
*/
|
||||
function queryAndEditMedia(id) {
|
||||
title.value = '编辑指令资源';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
loading.value = true
|
||||
queryById({ id }).then(res => {
|
||||
registerForm.value.edit(res, true);
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑指令资源
|
||||
* @param record
|
||||
|
@ -77,6 +95,27 @@ function handleOk() {
|
|||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂存
|
||||
*/
|
||||
function handleSave() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* 给审核对应的业务平台同步资源
|
||||
*/
|
||||
function handleMediaAsync() {
|
||||
registerForm.value.syncMediaForBizFunc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 给所有业务平台同步资源
|
||||
*/
|
||||
function handleMediaSyncAllPlat() {
|
||||
registerForm.value.syncMediaForAllBizFunc();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
|
@ -123,6 +162,8 @@ defineExpose({
|
|||
disableSubmit,
|
||||
usingOrStop,
|
||||
queryByIdFunc,
|
||||
opeType,
|
||||
queryAndEditMedia,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue