Compare commits
3 Commits
06090b967a
...
1295827497
Author | SHA1 | Date |
---|---|---|
|
1295827497 | |
|
231991eeee | |
|
143d55be01 |
|
@ -23,6 +23,9 @@ VITE_APP_SUB_jeecg-app-1 = '//localhost:8092'
|
|||
# 试验田机构编码
|
||||
VITE_SYTJGBM = '101'
|
||||
|
||||
# 服务指令
|
||||
VITE_DIRECTIVE_UPLOAD_PATH = ''
|
||||
|
||||
# 填写后将作为乾坤子应用启动,主应用注册时AppName需保持一致(放开 VITE_GLOB_QIANKUN_MICRO_APP_NAME 参数表示jeecg-vue3将以乾坤子应用模式启动)
|
||||
#VITE_GLOB_QIANKUN_MICRO_APP_NAME=jeecg-vue3
|
||||
# 作为乾坤子应用启动时必填,需与qiankun主应用注册子应用时填写的 entry 保持一致
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
<a-select-option :value="item.value" :disabled="!ignoreDisabled && item.disabled">
|
||||
<span :class="[useDicColor && item.color ? 'colorText' : '']"
|
||||
:style="{ backgroundColor: `${useDicColor && item.color}` }" :title="item.label">
|
||||
{{ item.label }}<span style="color:rgb(255 39 39);">{{ ignoreDisabled && item.disabled ? '(已停用)' : '' }}</span>
|
||||
{{ item.label }}<span style="color:rgb(255 39 39);">{{ ignoreDisabled && item.disabled ? '(已停用)' : ''
|
||||
}}</span>
|
||||
</span>
|
||||
</a-select-option>
|
||||
</template>
|
||||
|
@ -76,9 +77,9 @@ export default defineComponent({
|
|||
},
|
||||
style: propTypes.any,
|
||||
ignoreDisabled: propTypes.bool.def(false),
|
||||
orgCode:'',//组织机构编码 会切换数据源
|
||||
orgCode: '',//组织机构编码 会切换数据源
|
||||
},
|
||||
emits: ['options-change', 'change', 'update:value'],
|
||||
emits: ['options-change', 'change', 'update:value', 'upDictCode'],
|
||||
setup(props, { emit, refs }) {
|
||||
const dictOptions = ref<any[]>([]);
|
||||
const attrs = useAttrs();
|
||||
|
@ -127,8 +128,8 @@ export default defineComponent({
|
|||
async function initDictData() {
|
||||
let { dictCode, stringToNumber } = props;
|
||||
//根据字典Code, 初始化字典数组
|
||||
const dictData = await initDictOptions(dictCode,props.orgCode);
|
||||
|
||||
const dictData = await initDictOptions(dictCode, props.orgCode);
|
||||
|
||||
dictOptions.value = dictData.reduce((prev, next) => {
|
||||
if (next) {
|
||||
const value = next['value'];
|
||||
|
@ -142,11 +143,13 @@ export default defineComponent({
|
|||
}
|
||||
return prev;
|
||||
}, []);
|
||||
emit('upDictCode', dictOptions.value)
|
||||
}
|
||||
|
||||
function handleChange(e) {
|
||||
const { mode } = unref<Recordable>(getBindValue);
|
||||
let changeValue: any;
|
||||
let changeLabel: any;
|
||||
// 兼容多选模式
|
||||
|
||||
//update-begin---author:wangshuai ---date:20230216 for:[QQYUN-4290]公文发文:选择机关代字报错,是因为值改变触发了change事件三次,导致数据发生改变------------
|
||||
|
@ -162,11 +165,13 @@ export default defineComponent({
|
|||
}
|
||||
} else {
|
||||
changeValue = e?.target?.value ?? e;
|
||||
// changeLabel = dictOptions.value.filter(d => d.value == changeValue)[0].label
|
||||
}
|
||||
state.value = changeValue;
|
||||
|
||||
//update-begin---author:wangshuai ---date:20230403 for:【issues/4507】JDictSelectTag组件使用时,浏览器给出警告提示:Expected Function, got Array------------
|
||||
emit('update:value', changeValue)
|
||||
// emit('upLabel', changeLabel)
|
||||
//update-end---author:wangshuai ---date:20230403 for:【issues/4507】JDictSelectTag组件使用时,浏览器给出警告提示:Expected Function, got Array述------------
|
||||
//update-end---author:wangshuai ---date:20230216 for:[QQYUN-4290]公文发文:选择机关代字报错,是因为值改变触发了change事件三次,导致数据发生改变------------
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
|
@ -203,13 +203,6 @@ function getTableAction(record) {
|
|||
}, {
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
|
@ -203,13 +203,6 @@ function getTableAction(record) {
|
|||
}, {
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
|
@ -199,14 +199,6 @@ function getTableAction(record) {
|
|||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
|
@ -207,14 +207,6 @@ function getTableAction(record) {
|
|||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ import { useMessage } from "/@/hooks/web/useMessage";
|
|||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/services/serviceDirective/configServiceDirective/list',
|
||||
save='/services/serviceDirective/configServiceDirective/add',
|
||||
edit='/services/serviceDirective/configServiceDirective/edit',
|
||||
deleteOne = '/services/serviceDirective/configServiceDirective/delete',
|
||||
deleteBatch = '/services/serviceDirective/configServiceDirective/deleteBatch',
|
||||
importExcel = '/services/serviceDirective/configServiceDirective/importExcel',
|
||||
exportXls = '/services/serviceDirective/configServiceDirective/exportXls',
|
||||
async = '/services/serviceDirective/configServiceDirective/async',
|
||||
list = '/services/serviceDirective/list',
|
||||
save='/services/serviceDirective/add',
|
||||
edit='/services/serviceDirective/edit',
|
||||
deleteOne = '/services/serviceDirective/delete',
|
||||
deleteBatch = '/services/serviceDirective/deleteBatch',
|
||||
importExcel = '/services/serviceDirective/importExcel',
|
||||
exportXls = '/services/serviceDirective/exportXls',
|
||||
async = '/services/serviceDirective/async',
|
||||
departList = '/sys/sysDepart/list',
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { BasicColumn } from '/@/components/Table';
|
||||
import { render } from '/@/utils/common/renderUtils';
|
||||
//列表数据
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
|
@ -106,14 +107,34 @@ export const columns: BasicColumn[] = [
|
|||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '预览图片',
|
||||
title: '服务指令图片',
|
||||
align: 'center',
|
||||
dataIndex: 'previewFileMedia',
|
||||
dataIndex: 'previewFile',
|
||||
customRender: render.renderImage,
|
||||
},
|
||||
{
|
||||
title: '即时指令图片',
|
||||
title: '服务指令描述',
|
||||
align: 'center',
|
||||
dataIndex: 'immediateFileMedia',
|
||||
dataIndex: 'serviceContent',
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: '指令音频文件',
|
||||
align: 'center',
|
||||
dataIndex: 'mp3File',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '指令视频文件',
|
||||
align: 'center',
|
||||
dataIndex: 'mp4File',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '即时指令图标',
|
||||
align: 'center',
|
||||
dataIndex: 'immediateFile',
|
||||
customRender: render.renderImage,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -91,13 +91,41 @@
|
|||
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||
<template v-if="column.dataIndex === 'previewFileMedia'">
|
||||
<!-- 音频播放控制 -->
|
||||
<template v-if="column.dataIndex === 'mp3File'">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<img v-else :src="sysUrlValue + text" style="max-height: 50px;max-width: 80px;">
|
||||
<a-button v-else type="link" class="btnPrivate" @click="openAudioModal(text)">播放</a-button>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'immediateFileMedia'">
|
||||
<!-- <template v-if="column.dataIndex === 'mp3File'">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<img v-else :src="sysUrlValue + text" style="max-height: 50px;max-width: 80px;">
|
||||
<div v-else style="display: flex; align-items: center; gap: 8px;">
|
||||
<audio ref="audioPlayer" :src="getFileAccessHttpUrl(text)" hidden></audio>
|
||||
<a-button v-if="!currentPlayingAudio || currentPlayingAudio !== text" type="link" @click="playAudio(text)"
|
||||
preIcon="ant-design:play-circle-outlined">
|
||||
播放
|
||||
</a-button>
|
||||
|
||||
<template v-else>
|
||||
<a-button v-if="isPlaying" type="link" @click="pauseAudio" preIcon="ant-design:pause-circle-outlined">
|
||||
暂停
|
||||
</a-button>
|
||||
<a-button v-else type="link" @click="resumeAudio" preIcon="ant-design:play-circle-outlined">
|
||||
播放
|
||||
</a-button>
|
||||
|
||||
<a-button type="link" @click="restartAudio" preIcon="ant-design:reload-outlined">
|
||||
重播
|
||||
</a-button>
|
||||
|
||||
<a-button type="link" @click="stopAudio" preIcon="ant-design:stop-outlined">
|
||||
停止
|
||||
</a-button>
|
||||
</template>
|
||||
</div>
|
||||
</template> -->
|
||||
<template v-if="column.dataIndex === 'mp4File'">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button v-else type="link" class="btnPrivate" @click="openVideoModal(text)">播放</a-button>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'bodyTagList'">
|
||||
<span :title="text.map((item) => item.tagName).join('、')">{{text.map((item) =>
|
||||
|
@ -110,7 +138,7 @@
|
|||
</template>
|
||||
</BasicTable>
|
||||
<!-- 表单区域 -->
|
||||
<ConfigServiceDirectiveModal :sysUrlValue="sysUrlValue" ref="registerModal" @success="handleSuccess">
|
||||
<ConfigServiceDirectiveModal ref="registerModal" @success="handleSuccess">
|
||||
</ConfigServiceDirectiveModal>
|
||||
</div>
|
||||
|
||||
|
@ -154,6 +182,15 @@
|
|||
<EmotionTagList v-if="emotionTagOpen"></EmotionTagList>
|
||||
</a-drawer>
|
||||
|
||||
<!-- 音频播放 -->
|
||||
<a-modal v-model:visible="showAudioModal" title="音频播放" :footer="null" @cancel="closeAudioModal"
|
||||
:bodyStyle="{ padding: '0', maxHeight: '80vh', overflow: 'auto' }" :keyboard="true">
|
||||
<audio controls style="width: 100%; display: block; margin: 20px auto;">
|
||||
<source :src="audioUrl">
|
||||
您的浏览器不支持音频播放。
|
||||
</audio>
|
||||
</a-modal>
|
||||
|
||||
<!-- 视频播放 -->
|
||||
<a-modal v-model:visible="showVideoModal" title="视频播放" :footer="null" @cancel="closeVideoModal"
|
||||
:bodyStyle="{ padding: '0', maxHeight: '80vh', overflow: 'auto' }">
|
||||
|
@ -181,10 +218,8 @@ 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 { sysUrl } from '/@/utils/sysBaseInfo/MediaManagePicker.api.ts';
|
||||
|
||||
const formRef = ref();
|
||||
const sysUrlValue = ref('')
|
||||
const queryParam = reactive<any>({
|
||||
instructionTagId: '',
|
||||
categoryId: '',
|
||||
|
@ -223,7 +258,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|||
pageSizeOptions: ['10', '20', '50', '100'],
|
||||
},
|
||||
actionColumn: {
|
||||
width: 160,
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
},
|
||||
beforeFetch: async (params) => {
|
||||
|
@ -290,6 +325,14 @@ function handleEdit(record: Recordable) {
|
|||
registerModal.value.edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑指令资源
|
||||
*/
|
||||
function handleMedia(record: Recordable) {
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.editMedia(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
|
@ -325,12 +368,17 @@ function handleSuccess() {
|
|||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record)
|
||||
}, {
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record)
|
||||
},
|
||||
{
|
||||
label: '指令资源',
|
||||
onClick: handleMedia.bind(null, record)
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -430,6 +478,21 @@ function onEmotionTagClose() {
|
|||
emotionTagOpen.value = false
|
||||
}
|
||||
|
||||
const showAudioModal = ref(false); // 控制音频模态框显示
|
||||
const audioUrl = ref(''); // 音频 URL
|
||||
|
||||
// 打开音频模态框
|
||||
const openAudioModal = (url) => {
|
||||
audioUrl.value = getFileAccessHttpUrl(url);
|
||||
showAudioModal.value = true;
|
||||
};
|
||||
|
||||
// 关闭音频模态框
|
||||
const closeAudioModal = () => {
|
||||
showAudioModal.value = false;
|
||||
audioUrl.value = '';
|
||||
};
|
||||
|
||||
const showVideoModal = ref(false); // 控制模态框显示
|
||||
const videoUrl = ref(''); // 视频 URL
|
||||
|
||||
|
@ -445,10 +508,77 @@ const closeVideoModal = () => {
|
|||
videoUrl.value = '';
|
||||
};
|
||||
|
||||
// 添加以下响应式变量
|
||||
const audioPlayer = ref<HTMLAudioElement | null>(null);
|
||||
const currentPlayingAudio = ref<string | null>(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 => {
|
||||
console.error('播放失败:', 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 => {
|
||||
console.error('继续播放失败:', e);
|
||||
});
|
||||
isPlaying.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const restartAudio = () => {
|
||||
if (audioPlayer.value) {
|
||||
audioPlayer.value.currentTime = 0;
|
||||
audioPlayer.value.play().catch(e => {
|
||||
console.error('重新播放失败:', e);
|
||||
});
|
||||
isPlaying.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const stopAudio = () => {
|
||||
if (audioPlayer.value) {
|
||||
audioPlayer.value.pause();
|
||||
audioPlayer.value.currentTime = 0;
|
||||
isPlaying.value = false;
|
||||
currentPlayingAudio.value = null;
|
||||
}
|
||||
};
|
||||
|
||||
// 添加音频结束监听
|
||||
onMounted(() => {
|
||||
if (audioPlayer.value) {
|
||||
audioPlayer.value.addEventListener('ended', () => {
|
||||
isPlaying.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
sysUrl().then(res => {
|
||||
sysUrlValue.value = res.url
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -4,28 +4,28 @@
|
|||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
|
||||
name="ConfigService2DirectiveForm">
|
||||
<a-row>
|
||||
<a-row v-show="!isEditMedia">
|
||||
<a-col :span="12">
|
||||
<a-form-item label="分类标签" v-bind="validateInfos.instructionTagId"
|
||||
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 />
|
||||
placeholder="请选择分类标签" allowClear @upDictCode="upInstructionDictCode" />
|
||||
</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" :dictCode="categoryDictCode" placeholder="请选择服务类别"
|
||||
allow-clear />
|
||||
:disabled="!formData.instructionTagId" :dictCode="categoryDictCode" placeholder="请选择服务类别" allow-clear
|
||||
@upDictCode="upCategoryDictCode" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<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" placeholder="请选择服务类型" allowClear />
|
||||
:disabled="!formData.categoryId" placeholder="请选择服务类型" allowClear @upDictCode="upTypeDictCode" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
|
@ -66,7 +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 />
|
||||
placeholder="请选择周期类型" allowClear @upDictCode="upCycleTypeDictCode" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
|
@ -76,14 +76,8 @@
|
|||
placeholder="请输入服务时长(分钟)" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="服务说明" v-bind="validateInfos.serviceContent"
|
||||
id="ConfigServiceDirectiveForm-serviceContent" name="serviceContent">
|
||||
<a-textarea v-model:value="formData.serviceContent" :rows="2" placeholder="请输入服务说明" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-row v-show="!isEditMedia">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="体型标签" id="ConfigServiceDirectiveForm-typeId" :labelCol="labelCol2"
|
||||
:wrapperCol="wrapperCol2" name="typeId">
|
||||
|
@ -107,53 +101,34 @@
|
|||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="预览图片" v-bind="validateInfos.previewFile">
|
||||
<a-button @click="showResourcePicker('previewFile', { maxSelect: 1, fileType: 'image' })" type="link"
|
||||
size="small">选取图片</a-button>
|
||||
<!-- <JImageUpload :fileMax="1" v-model:value="formData.previewFileMedia"
|
||||
@change="formData.previewFileChanged = true">
|
||||
</JImageUpload> -->
|
||||
<a-form-item label="服务指令图片" v-bind="validateInfos.previewFile">
|
||||
<JImageUpload :fileMax="1" v-model:value="formData.previewFile" :disabled="!canUploadPreviewImage"
|
||||
:bizPath="directiveBizPath">
|
||||
</JImageUpload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="即时指令图片" v-bind="validateInfos.immediateFile">
|
||||
<a-button @click="showResourcePicker('immediateFile', { maxSelect: 1, fileType: 'image' })" type="link"
|
||||
size="small">选取图片</a-button>
|
||||
<!-- <JImageUpload :fileMax="1" v-model:value="formData.immediateFileMedia"
|
||||
@change="formData.immediateFileChanged = true">
|
||||
</JImageUpload> -->
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12" v-if="!!formData.previewFile">
|
||||
<a-form-item label="预览图片" id="ConfigServiceDirectiveForm-previewFile">
|
||||
<img :src="sysUrlValue + formData.previewFileMedia" style="max-width: 100px; max-height: 100px;" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12" v-if="!!formData.immediateFile" :push="!!formData.previewFile ? 0 : 12">
|
||||
<a-form-item label="即时指令图片" id="ConfigServiceDirectiveForm-immediateFile">
|
||||
<img :src="sysUrlValue + formData.immediateFileMedia" style="max-width: 100px; max-height: 100px;" />
|
||||
<a-form-item label="服务指令描述" v-bind="validateInfos.serviceContent"
|
||||
id="ConfigServiceDirectiveForm-serviceContent" name="serviceContent">
|
||||
<a-textarea v-model:value="formData.serviceContent" :rows="2" placeholder="请输入服务指令描述" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="语音文件" v-bind="validateInfos.mp3File" id="ConfigServiceDirectiveForm-mp3File">
|
||||
<a-button @click="showResourcePicker('mp3File', { maxSelect: 1, fileType: 'audio' })" type="link"
|
||||
size="small">选取文件</a-button>
|
||||
<!-- <j-upload v-model:value="formData.mp3FileMedia" accept=".mp3" :maxCount="1"
|
||||
@change="formData.mp3FileChanged = true"></j-upload> -->
|
||||
<a-form-item label="指令音频文件" v-bind="validateInfos.mp3File" id="ConfigServiceDirectiveForm-mp3File">
|
||||
<j-upload v-model:value="formData.mp3File" accept=".mp3" :maxCount="1"
|
||||
:disabled="!canUploadPreviewImage" :bizPath="directiveBizPath"></j-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="视频文件" v-bind="validateInfos.mp4File" id="ConfigServiceDirectiveForm-mp4File">
|
||||
<a-button @click="showResourcePicker('mp4File', { maxSelect: 1, fileType: 'video' })" type="link"
|
||||
size="small">选取文件</a-button>
|
||||
<!-- <j-upload v-model:value="formData.mp4FileMedia" accept=".mp4" :maxCount="1"
|
||||
@change="formData.mp4FileChanged = true"></j-upload> -->
|
||||
<a-form-item label="指令视频文件" v-bind="validateInfos.mp4File" id="ConfigServiceDirectiveForm-mp4File">
|
||||
<j-upload v-model:value="formData.mp4File" accept=".mp4" :maxCount="1"
|
||||
:disabled="!canUploadPreviewImage" :bizPath="directiveBizPath"></j-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-row>
|
||||
</a-row>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
|
@ -166,25 +141,29 @@
|
|||
<a-col :span="12" v-if="!!formData.mp3File">
|
||||
<a-form-item label="语音预览" id="ConfigServiceDirectiveForm-mp3File">
|
||||
<audio controls disabled="false">
|
||||
<source :src="sysUrlValue + formData.mp3FileMedia">
|
||||
<source :src="getFileAccessHttpUrl(formData.mp3File)">
|
||||
</audio>
|
||||
</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="sysUrlValue + formData.mp4FileMedia">
|
||||
<source :src="getFileAccessHttpUrl(formData.mp4File)">
|
||||
</video>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="即时指令图标" v-bind="validateInfos.immediateFile">
|
||||
<JImageUpload :fileMax="1" v-model:value="formData.immediateFile" :disabled="!canUploadPreviewImage"
|
||||
:bizPath="directiveBizPath">
|
||||
</JImageUpload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
</a-spin>
|
||||
|
||||
<MediaResourcePicker :maxSelect="mediaParams.maxSelect" :fileType="mediaParams.fileType"
|
||||
v-model:visible="pickerVisible" @confirm="handleResourceSelected" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
@ -200,30 +179,13 @@ import { saveOrUpdate } from '../ConfigServiceDirective.api';
|
|||
import { Form } from 'ant-design-vue';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
|
||||
import MediaResourcePicker from '/@/utils/midiaManage/MediaResourcePicker.vue';
|
||||
|
||||
const handleUploadSuccess = (res) => {
|
||||
}
|
||||
|
||||
const props = defineProps({
|
||||
formDisabled: { type: Boolean, default: false },
|
||||
formData: { type: Object, default: () => ({}) },
|
||||
formBpm: { type: Boolean, default: true },
|
||||
sysUrlValue: { type: String, default: '' },
|
||||
});
|
||||
const pickerVisible = ref(false);
|
||||
const mediaParams = ref({ maxSelect: 1, fileType: 'any' })
|
||||
const changedMediaObjStr = ref('')
|
||||
const showResourcePicker = (obj, param) => {
|
||||
changedMediaObjStr.value = obj
|
||||
mediaParams.value = param
|
||||
pickerVisible.value = true;
|
||||
};
|
||||
|
||||
const handleResourceSelected = (selectedResource) => {
|
||||
formData[changedMediaObjStr.value] = selectedResource.id
|
||||
formData[changedMediaObjStr.value + 'Media'] = selectedResource.filePath
|
||||
};
|
||||
const formRef = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
|
@ -251,10 +213,6 @@ const formData = reactive<Record<string, any>>({
|
|||
mp4File: '',
|
||||
previewFile: '',
|
||||
immediateFile: '',
|
||||
mp3FileMedia: '',
|
||||
mp4FileMedia: '',
|
||||
previewFileMedia: '',
|
||||
immediateFileMedia: '',
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 6 } });
|
||||
|
@ -262,6 +220,7 @@ const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
|||
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 3 } });
|
||||
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 20 } });
|
||||
const confirmLoading = ref<boolean>(false);
|
||||
const isEditMedia = ref(false)
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
categoryId: [{ required: true, message: '请选择服务类别!' },],
|
||||
|
@ -311,13 +270,62 @@ const disabled = computed(() => {
|
|||
});
|
||||
const categoryDictCode = ref('')
|
||||
const typeDictCode = ref('')
|
||||
// 计算属性:是否可以上传预览图片
|
||||
const canUploadPreviewImage = computed(() => {
|
||||
return formData.instructionTagId &&
|
||||
formData.categoryId &&
|
||||
formData.typeId &&
|
||||
formData.directiveName &&
|
||||
formData.cycleType;
|
||||
});
|
||||
|
||||
//分类标签名称
|
||||
const instructionComDictCode = ref([])
|
||||
function upInstructionDictCode(v_) {
|
||||
instructionComDictCode.value = v_
|
||||
}
|
||||
//服务类别名称
|
||||
const categoryComDictCode = ref([])
|
||||
function upCategoryDictCode(v_) {
|
||||
categoryComDictCode.value = v_
|
||||
|
||||
}
|
||||
//服务类型名称
|
||||
const typeComDictCode = ref([])
|
||||
function upTypeDictCode(v_) {
|
||||
typeComDictCode.value = v_
|
||||
|
||||
}
|
||||
//周期类型名称
|
||||
const cycleTypeComDictCode = ref([])
|
||||
function upCycleTypeDictCode(v_) {
|
||||
cycleTypeComDictCode.value = v_
|
||||
|
||||
}
|
||||
|
||||
watch([instructionComDictCode, categoryComDictCode, typeComDictCode, cycleTypeComDictCode], () => {
|
||||
// 当这些字典数据变化时,强制重新计算 directiveBizPath
|
||||
}, { deep: true });
|
||||
|
||||
const directiveBizPath = computed(() => {
|
||||
if (!canUploadPreviewImage.value) return '';
|
||||
|
||||
// 获取各个字段的字典值
|
||||
const instructionTagName_ = instructionComDictCode.value.filter(d => d.value == formData.instructionTagId)?.[0]?.label;
|
||||
const categoryName_ = categoryComDictCode.value.filter(d => d.value == formData.categoryId)?.[0]?.label;
|
||||
const typeName_ = typeComDictCode.value.filter(d => d.value == formData.typeId)?.[0]?.label;
|
||||
const cycleTypeName_ = cycleTypeComDictCode.value.filter(d => d.value == formData.cycleType)?.[0]?.label;
|
||||
|
||||
// 构建路径
|
||||
return 'directive/' + `${instructionTagName_}/${categoryName_}/${typeName_}/${formData.directiveName}/${cycleTypeName_}`;
|
||||
});
|
||||
|
||||
watch(
|
||||
() => formData.instructionTagId,
|
||||
(newInstructionTagId) => {
|
||||
if (!newInstructionTagId) {
|
||||
formData.categoryId = ''
|
||||
formData.typeId = ''
|
||||
formData.typeId = ''
|
||||
categoryDictCode.value = 'nu_config_service_category,category_name,id,1=2';
|
||||
} else {
|
||||
categoryDictCode.value = `nu_config_service_category,category_name,id,del_flag = 0 and instruction_id = '${newInstructionTagId}' order by sort asc`;
|
||||
|
@ -328,7 +336,7 @@ watch(
|
|||
() => formData.categoryId,
|
||||
(newCategoryId) => {
|
||||
if (!newCategoryId) {
|
||||
formData.typeId = ''
|
||||
formData.typeId = ''
|
||||
typeDictCode.value = 'nu_config_service_type,type_name,id,del_flag = 99 order by sort asc';
|
||||
} else {
|
||||
typeDictCode.value = `nu_config_service_type,type_name,id,del_flag = 0 and category_id = '${newCategoryId}' order by sort asc`;
|
||||
|
@ -344,8 +352,10 @@ function add() {
|
|||
|
||||
/**
|
||||
* 编辑
|
||||
* isEditMedia_是否为编辑指令资源 (隐藏业务字段)
|
||||
*/
|
||||
function edit(record) {
|
||||
function edit(record, isEditMedia_ = false) {
|
||||
isEditMedia.value = isEditMedia_
|
||||
formData.bodyTags = ''
|
||||
formData.emotionTags = ''
|
||||
nextTick(() => {
|
||||
|
@ -403,6 +413,9 @@ async function submitForm() {
|
|||
retrun;
|
||||
}
|
||||
|
||||
//
|
||||
model.mediaFileSavePath = directiveBizPath
|
||||
|
||||
await saveOrUpdate(model, isUpdate.value)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
|
|
|
@ -1,80 +1,95 @@
|
|||
<template>
|
||||
<j-modal :title="title" width="70vw" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭" :maskClosable="false">
|
||||
<ConfigServiceDirectiveForm ref="registerForm" v-if="visible" @ok="submitCallback" :sysUrlValue="sysUrlValue" :formDisabled="disableSubmit" :formBpm="false"></ConfigServiceDirectiveForm>
|
||||
<j-modal :title="title" width="70vw" :visible="visible" @ok="handleOk"
|
||||
:okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"
|
||||
:maskClosable="false">
|
||||
<ConfigServiceDirectiveForm ref="registerForm" v-if="visible" @ok="submitCallback" :formDisabled="disableSubmit"
|
||||
:formBpm="false"></ConfigServiceDirectiveForm>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose , defineProps} from 'vue';
|
||||
import ConfigServiceDirectiveForm from './ConfigServiceDirectiveForm.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const props = defineProps({
|
||||
sysUrlValue: { type: String, default: '' },
|
||||
import { ref, nextTick, defineExpose, defineProps } from 'vue';
|
||||
import ConfigServiceDirectiveForm from './ConfigServiceDirectiveForm.vue'
|
||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||
|
||||
const props = defineProps({
|
||||
});
|
||||
const title = ref<string>('');
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add();
|
||||
});
|
||||
const title = ref<string>('');
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
disableSubmit,
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑指令资源
|
||||
* @param record
|
||||
*/
|
||||
function editMedia(record) {
|
||||
title.value = '编辑指令资源';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.edit(record,true);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定按钮点击事件
|
||||
*/
|
||||
function handleOk() {
|
||||
registerForm.value.submitForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* form保存回调事件
|
||||
*/
|
||||
function submitCallback() {
|
||||
handleCancel();
|
||||
emit('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
add,
|
||||
edit,
|
||||
editMedia,
|
||||
disableSubmit,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
/**隐藏样式-modal确定按钮 */
|
||||
.jee-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
</a-form>
|
||||
</div>
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<BasicTable @register="registerTable">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
|
@ -218,13 +218,6 @@ function getTableAction(record) {
|
|||
}, {
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
}, {
|
||||
label: '删除',
|
||||
popConfirm: {
|
||||
title: '是否确认删除',
|
||||
confirm: handleDelete.bind(null, record),
|
||||
placement: 'topLeft',
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@ import { useMessage } from "/@/hooks/web/useMessage";
|
|||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/services/serviceDirective/configServiceDirective/list',
|
||||
save='/services/serviceDirective/configServiceDirective/add',
|
||||
edit='/services/serviceDirective/configServiceDirective/edit',
|
||||
deleteOne = '/services/serviceDirective/configServiceDirective/delete',
|
||||
deleteBatch = '/services/serviceDirective/configServiceDirective/deleteBatch',
|
||||
importExcel = '/services/serviceDirective/configServiceDirective/importExcel',
|
||||
exportXls = '/services/serviceDirective/configServiceDirective/exportXls',
|
||||
async = '/services/serviceDirective/configServiceDirective/async',
|
||||
list = '/services/serviceDirective/list',
|
||||
save='/services/serviceDirective/add',
|
||||
edit='/services/serviceDirective/edit',
|
||||
deleteOne = '/services/serviceDirective/delete',
|
||||
deleteBatch = '/services/serviceDirective/deleteBatch',
|
||||
importExcel = '/services/serviceDirective/importExcel',
|
||||
exportXls = '/services/serviceDirective/exportXls',
|
||||
async = '/services/serviceDirective/async',
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useMessage } from "/@/hooks/web/useMessage";
|
|||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/services/serviceDirective/configServiceDirective/list',
|
||||
list = '/services/serviceDirective/list',
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue