Compare commits

..

3 Commits

14 changed files with 376 additions and 226 deletions

View File

@ -23,6 +23,9 @@ VITE_APP_SUB_jeecg-app-1 = '//localhost:8092'
# 试验田机构编码 # 试验田机构编码
VITE_SYTJGBM = '101' VITE_SYTJGBM = '101'
# 服务指令
VITE_DIRECTIVE_UPLOAD_PATH = ''
# 填写后将作为乾坤子应用启动主应用注册时AppName需保持一致放开 VITE_GLOB_QIANKUN_MICRO_APP_NAME 参数表示jeecg-vue3将以乾坤子应用模式启动 # 填写后将作为乾坤子应用启动主应用注册时AppName需保持一致放开 VITE_GLOB_QIANKUN_MICRO_APP_NAME 参数表示jeecg-vue3将以乾坤子应用模式启动
#VITE_GLOB_QIANKUN_MICRO_APP_NAME=jeecg-vue3 #VITE_GLOB_QIANKUN_MICRO_APP_NAME=jeecg-vue3
# 作为乾坤子应用启动时必填需与qiankun主应用注册子应用时填写的 entry 保持一致 # 作为乾坤子应用启动时必填需与qiankun主应用注册子应用时填写的 entry 保持一致

View File

@ -34,7 +34,8 @@
<a-select-option :value="item.value" :disabled="!ignoreDisabled && item.disabled"> <a-select-option :value="item.value" :disabled="!ignoreDisabled && item.disabled">
<span :class="[useDicColor && item.color ? 'colorText' : '']" <span :class="[useDicColor && item.color ? 'colorText' : '']"
:style="{ backgroundColor: `${useDicColor && item.color}` }" :title="item.label"> :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> </span>
</a-select-option> </a-select-option>
</template> </template>
@ -76,9 +77,9 @@ export default defineComponent({
}, },
style: propTypes.any, style: propTypes.any,
ignoreDisabled: propTypes.bool.def(false), ignoreDisabled: propTypes.bool.def(false),
orgCode:'',// orgCode: '',//
}, },
emits: ['options-change', 'change', 'update:value'], emits: ['options-change', 'change', 'update:value', 'upDictCode'],
setup(props, { emit, refs }) { setup(props, { emit, refs }) {
const dictOptions = ref<any[]>([]); const dictOptions = ref<any[]>([]);
const attrs = useAttrs(); const attrs = useAttrs();
@ -127,8 +128,8 @@ export default defineComponent({
async function initDictData() { async function initDictData() {
let { dictCode, stringToNumber } = props; let { dictCode, stringToNumber } = props;
//Code, //Code,
const dictData = await initDictOptions(dictCode,props.orgCode); const dictData = await initDictOptions(dictCode, props.orgCode);
dictOptions.value = dictData.reduce((prev, next) => { dictOptions.value = dictData.reduce((prev, next) => {
if (next) { if (next) {
const value = next['value']; const value = next['value'];
@ -142,11 +143,13 @@ export default defineComponent({
} }
return prev; return prev;
}, []); }, []);
emit('upDictCode', dictOptions.value)
} }
function handleChange(e) { function handleChange(e) {
const { mode } = unref<Recordable>(getBindValue); const { mode } = unref<Recordable>(getBindValue);
let changeValue: any; let changeValue: any;
let changeLabel: any;
// //
//update-begin---author:wangshuai ---date:20230216 for[QQYUN-4290],change------------ //update-begin---author:wangshuai ---date:20230216 for[QQYUN-4290],change------------
@ -162,11 +165,13 @@ export default defineComponent({
} }
} else { } else {
changeValue = e?.target?.value ?? e; changeValue = e?.target?.value ?? e;
// changeLabel = dictOptions.value.filter(d => d.value == changeValue)[0].label
} }
state.value = changeValue; state.value = changeValue;
//update-begin---author:wangshuai ---date:20230403 forissues/4507JDictSelectTag使Expected Function, got Array------------ //update-begin---author:wangshuai ---date:20230403 forissues/4507JDictSelectTag使Expected Function, got Array------------
emit('update:value', changeValue) emit('update:value', changeValue)
// emit('upLabel', changeLabel)
//update-end---author:wangshuai ---date:20230403 forissues/4507JDictSelectTag使Expected Function, got Array------------ //update-end---author:wangshuai ---date:20230403 forissues/4507JDictSelectTag使Expected Function, got Array------------
//update-end---author:wangshuai ---date:20230216 for[QQYUN-4290],change------------ //update-end---author:wangshuai ---date:20230216 for[QQYUN-4290],change------------

View File

@ -35,7 +35,7 @@
</a-form> </a-form>
</div> </div>
<!--引用表格--> <!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable">
<!--插槽:table标题--> <!--插槽:table标题-->
<template #tableTitle> <template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
@ -203,13 +203,6 @@ function getTableAction(record) {
}, { }, {
label: '详情', label: '详情',
onClick: handleDetail.bind(null, record), onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
} }
]; ];
} }

View File

@ -35,7 +35,7 @@
</a-form> </a-form>
</div> </div>
<!--引用表格--> <!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable">
<!--插槽:table标题--> <!--插槽:table标题-->
<template #tableTitle> <template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
@ -203,13 +203,6 @@ function getTableAction(record) {
}, { }, {
label: '详情', label: '详情',
onClick: handleDetail.bind(null, record), onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
} }
]; ];
} }

View File

@ -35,7 +35,7 @@
</a-form> </a-form>
</div> </div>
<!--引用表格--> <!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable">
<!--插槽:table标题--> <!--插槽:table标题-->
<template #tableTitle> <template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
@ -199,14 +199,6 @@ function getTableAction(record) {
label: '详情', label: '详情',
onClick: handleDetail.bind(null, record), onClick: handleDetail.bind(null, record),
}, },
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
}
]; ];
} }

View File

@ -43,7 +43,7 @@
</a-form> </a-form>
</div> </div>
<!--引用表格--> <!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable">
<!--插槽:table标题--> <!--插槽:table标题-->
<template #tableTitle> <template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
@ -207,14 +207,6 @@ function getTableAction(record) {
label: '详情', label: '详情',
onClick: handleDetail.bind(null, record), onClick: handleDetail.bind(null, record),
}, },
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
}
]; ];
} }

View File

@ -4,14 +4,14 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage(); const { createConfirm } = useMessage();
enum Api { enum Api {
list = '/services/serviceDirective/configServiceDirective/list', list = '/services/serviceDirective/list',
save='/services/serviceDirective/configServiceDirective/add', save='/services/serviceDirective/add',
edit='/services/serviceDirective/configServiceDirective/edit', edit='/services/serviceDirective/edit',
deleteOne = '/services/serviceDirective/configServiceDirective/delete', deleteOne = '/services/serviceDirective/delete',
deleteBatch = '/services/serviceDirective/configServiceDirective/deleteBatch', deleteBatch = '/services/serviceDirective/deleteBatch',
importExcel = '/services/serviceDirective/configServiceDirective/importExcel', importExcel = '/services/serviceDirective/importExcel',
exportXls = '/services/serviceDirective/configServiceDirective/exportXls', exportXls = '/services/serviceDirective/exportXls',
async = '/services/serviceDirective/configServiceDirective/async', async = '/services/serviceDirective/async',
departList = '/sys/sysDepart/list', departList = '/sys/sysDepart/list',
} }

View File

@ -1,4 +1,5 @@
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
//列表数据 //列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
@ -106,14 +107,34 @@ export const columns: BasicColumn[] = [
width: 100, width: 100,
}, },
{ {
title: '预览图片', title: '服务指令图片',
align: 'center', align: 'center',
dataIndex: 'previewFileMedia', dataIndex: 'previewFile',
customRender: render.renderImage,
}, },
{ {
title: '即时指令图片', title: '服务指令描述',
align: 'center', 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,
}, },
]; ];

View File

@ -91,13 +91,41 @@
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" /> <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template> </template>
<template v-slot:bodyCell="{ column, record, index, text }"> <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> <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>
<template v-if="column.dataIndex === 'immediateFileMedia'"> <!-- <template v-if="column.dataIndex === 'mp3File'">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> <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>
<template v-if="column.dataIndex === 'bodyTagList'"> <template v-if="column.dataIndex === 'bodyTagList'">
<span :title="text.map((item) => item.tagName).join('、')">{{text.map((item) => <span :title="text.map((item) => item.tagName).join('、')">{{text.map((item) =>
@ -110,7 +138,7 @@
</template> </template>
</BasicTable> </BasicTable>
<!-- 表单区域 --> <!-- 表单区域 -->
<ConfigServiceDirectiveModal :sysUrlValue="sysUrlValue" ref="registerModal" @success="handleSuccess"> <ConfigServiceDirectiveModal ref="registerModal" @success="handleSuccess">
</ConfigServiceDirectiveModal> </ConfigServiceDirectiveModal>
</div> </div>
@ -154,6 +182,15 @@
<EmotionTagList v-if="emotionTagOpen"></EmotionTagList> <EmotionTagList v-if="emotionTagOpen"></EmotionTagList>
</a-drawer> </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" <a-modal v-model:visible="showVideoModal" title="视频播放" :footer="null" @cancel="closeVideoModal"
:bodyStyle="{ padding: '0', maxHeight: '80vh', overflow: 'auto' }"> :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 BodyTagList from '/@/views/services/directivetag/bodytag/BodyTagList.vue';
import EmotionTagList from '/@/views/services/directivetag/emotiontag/EmotionTagList.vue'; import EmotionTagList from '/@/views/services/directivetag/emotiontag/EmotionTagList.vue';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils'; import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import { sysUrl } from '/@/utils/sysBaseInfo/MediaManagePicker.api.ts';
const formRef = ref(); const formRef = ref();
const sysUrlValue = ref('')
const queryParam = reactive<any>({ const queryParam = reactive<any>({
instructionTagId: '', instructionTagId: '',
categoryId: '', categoryId: '',
@ -223,7 +258,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
pageSizeOptions: ['10', '20', '50', '100'], pageSizeOptions: ['10', '20', '50', '100'],
}, },
actionColumn: { actionColumn: {
width: 160, width: 200,
fixed: 'right', fixed: 'right',
}, },
beforeFetch: async (params) => { beforeFetch: async (params) => {
@ -290,6 +325,14 @@ function handleEdit(record: Recordable) {
registerModal.value.edit(record); 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) { function getTableAction(record) {
return [ return [
{ {
label: '编辑',
onClick: handleEdit.bind(null, record)
}, {
label: '详情', label: '详情',
onClick: handleDetail.bind(null, record), 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 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 showVideoModal = ref(false); //
const videoUrl = ref(''); // URL const videoUrl = ref(''); // URL
@ -445,10 +508,77 @@ const closeVideoModal = () => {
videoUrl.value = ''; 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(() => { onMounted(() => {
sysUrl().then(res => {
sysUrlValue.value = res.url
})
}) })
</script> </script>

View File

@ -4,28 +4,28 @@
<template #detail> <template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" <a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
name="ConfigService2DirectiveForm"> name="ConfigService2DirectiveForm">
<a-row> <a-row v-show="!isEditMedia">
<a-col :span="12"> <a-col :span="12">
<a-form-item label="分类标签" v-bind="validateInfos.instructionTagId" <a-form-item label="分类标签" v-bind="validateInfos.instructionTagId"
id="ConfigServiceDirectiveForm-instructionTagId" name="instructionTagId"> id="ConfigServiceDirectiveForm-instructionTagId" name="instructionTagId">
<j-dict-select-tag v-model:value="formData.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`" :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-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="服务类别" v-bind="validateInfos.categoryId" id="ConfigServiceDirectiveForm-categoryId" <a-form-item label="服务类别" v-bind="validateInfos.categoryId" id="ConfigServiceDirectiveForm-categoryId"
name="categoryId"> name="categoryId">
<j-dict-select-tag type="list" v-model:value="formData.categoryId" <j-dict-select-tag type="list" v-model:value="formData.categoryId"
:disabled="!formData.instructionTagId" :dictCode="categoryDictCode" placeholder="请选择服务类别" :disabled="!formData.instructionTagId" :dictCode="categoryDictCode" placeholder="请选择服务类别" allow-clear
allow-clear /> @upDictCode="upCategoryDictCode" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="服务类型" v-bind="validateInfos.typeId" id="ConfigServiceDirectiveForm-typeId" <a-form-item label="服务类型" v-bind="validateInfos.typeId" id="ConfigServiceDirectiveForm-typeId"
name="typeId"> name="typeId">
<j-dict-select-tag type="list" v-model:value="formData.typeId" :dictCode="typeDictCode" <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-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
@ -66,7 +66,7 @@
<a-form-item label="周期类型" v-bind="validateInfos.cycleType" id="ConfigServiceDirectiveForm-cycleType" <a-form-item label="周期类型" v-bind="validateInfos.cycleType" id="ConfigServiceDirectiveForm-cycleType"
name="cycleType"> name="cycleType">
<j-dict-select-tag type="list" v-model:value="formData.cycleType" dictCode="period_type" <j-dict-select-tag type="list" v-model:value="formData.cycleType" dictCode="period_type"
placeholder="请选择周期类型" allowClear /> placeholder="请选择周期类型" allowClear @upDictCode="upCycleTypeDictCode" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
@ -76,14 +76,8 @@
placeholder="请输入服务时长(分钟)" allow-clear /> placeholder="请输入服务时长(分钟)" allow-clear />
</a-form-item> </a-form-item>
</a-col> </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> <a-row v-show="!isEditMedia">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="体型标签" id="ConfigServiceDirectiveForm-typeId" :labelCol="labelCol2" <a-form-item label="体型标签" id="ConfigServiceDirectiveForm-typeId" :labelCol="labelCol2"
:wrapperCol="wrapperCol2" name="typeId"> :wrapperCol="wrapperCol2" name="typeId">
@ -107,53 +101,34 @@
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="预览图片" v-bind="validateInfos.previewFile"> <a-form-item label="服务指令图片" v-bind="validateInfos.previewFile">
<a-button @click="showResourcePicker('previewFile', { maxSelect: 1, fileType: 'image' })" type="link" <JImageUpload :fileMax="1" v-model:value="formData.previewFile" :disabled="!canUploadPreviewImage"
size="small">选取图片</a-button> :bizPath="directiveBizPath">
<!-- <JImageUpload :fileMax="1" v-model:value="formData.previewFileMedia" </JImageUpload>
@change="formData.previewFileChanged = true">
</JImageUpload> -->
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="即时指令图片" v-bind="validateInfos.immediateFile"> <a-form-item label="服务指令描述" v-bind="validateInfos.serviceContent"
<a-button @click="showResourcePicker('immediateFile', { maxSelect: 1, fileType: 'image' })" type="link" id="ConfigServiceDirectiveForm-serviceContent" name="serviceContent">
size="small">选取图片</a-button> <a-textarea v-model:value="formData.serviceContent" :rows="2" placeholder="请输入服务指令描述" />
<!-- <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> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="语音文件" v-bind="validateInfos.mp3File" id="ConfigServiceDirectiveForm-mp3File"> <a-form-item label="指令音频文件" v-bind="validateInfos.mp3File" id="ConfigServiceDirectiveForm-mp3File">
<a-button @click="showResourcePicker('mp3File', { maxSelect: 1, fileType: 'audio' })" type="link" <j-upload v-model:value="formData.mp3File" accept=".mp3" :maxCount="1"
size="small">选取文件</a-button> :disabled="!canUploadPreviewImage" :bizPath="directiveBizPath"></j-upload>
<!-- <j-upload v-model:value="formData.mp3FileMedia" accept=".mp3" :maxCount="1"
@change="formData.mp3FileChanged = true"></j-upload> -->
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="视频文件" v-bind="validateInfos.mp4File" id="ConfigServiceDirectiveForm-mp4File"> <a-form-item label="指令视频文件" v-bind="validateInfos.mp4File" id="ConfigServiceDirectiveForm-mp4File">
<a-button @click="showResourcePicker('mp4File', { maxSelect: 1, fileType: 'video' })" type="link" <j-upload v-model:value="formData.mp4File" accept=".mp4" :maxCount="1"
size="small">选取文件</a-button> :disabled="!canUploadPreviewImage" :bizPath="directiveBizPath"></j-upload>
<!-- <j-upload v-model:value="formData.mp4FileMedia" accept=".mp4" :maxCount="1"
@change="formData.mp4FileChanged = true"></j-upload> -->
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-row>
</a-row>
</a-row> </a-row>
</a-form> </a-form>
</template> </template>
@ -166,25 +141,29 @@
<a-col :span="12" v-if="!!formData.mp3File"> <a-col :span="12" v-if="!!formData.mp3File">
<a-form-item label="语音预览" id="ConfigServiceDirectiveForm-mp3File"> <a-form-item label="语音预览" id="ConfigServiceDirectiveForm-mp3File">
<audio controls disabled="false"> <audio controls disabled="false">
<source :src="sysUrlValue + formData.mp3FileMedia"> <source :src="getFileAccessHttpUrl(formData.mp3File)">
</audio> </audio>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12" v-if="!!formData.mp4File" :push="!!formData.mp3File ? 0 : 12"> <a-col :span="12" v-if="!!formData.mp4File" :push="!!formData.mp3File ? 0 : 12">
<a-form-item label="视频预览" id="ConfigServiceDirectiveForm-mp4File"> <a-form-item label="视频预览" id="ConfigServiceDirectiveForm-mp4File">
<video controls> <video controls>
<source :src="sysUrlValue + formData.mp4FileMedia"> <source :src="getFileAccessHttpUrl(formData.mp4File)">
</video> </video>
</a-form-item> </a-form-item>
</a-col> </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-row>
</a-form> </a-form>
</template> </template>
</JFormContainer> </JFormContainer>
</a-spin> </a-spin>
<MediaResourcePicker :maxSelect="mediaParams.maxSelect" :fileType="mediaParams.fileType"
v-model:visible="pickerVisible" @confirm="handleResourceSelected" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -200,30 +179,13 @@ import { saveOrUpdate } from '../ConfigServiceDirective.api';
import { Form } from 'ant-design-vue'; import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue'; import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils'; import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import MediaResourcePicker from '/@/utils/midiaManage/MediaResourcePicker.vue';
const handleUploadSuccess = (res) => {
}
const props = defineProps({ const props = defineProps({
formDisabled: { type: Boolean, default: false }, formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) }, formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true }, 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 formRef = ref();
const useForm = Form.useForm; const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']); const emit = defineEmits(['register', 'ok']);
@ -251,10 +213,6 @@ const formData = reactive<Record<string, any>>({
mp4File: '', mp4File: '',
previewFile: '', previewFile: '',
immediateFile: '', immediateFile: '',
mp3FileMedia: '',
mp4FileMedia: '',
previewFileMedia: '',
immediateFileMedia: '',
}); });
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 6 } }); 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 labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 3 } });
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 20 } }); const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 20 } });
const confirmLoading = ref<boolean>(false); const confirmLoading = ref<boolean>(false);
const isEditMedia = ref(false)
// //
const validatorRules = reactive({ const validatorRules = reactive({
categoryId: [{ required: true, message: '请选择服务类别!' },], categoryId: [{ required: true, message: '请选择服务类别!' },],
@ -311,13 +270,62 @@ const disabled = computed(() => {
}); });
const categoryDictCode = ref('') const categoryDictCode = ref('')
const typeDictCode = 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( watch(
() => formData.instructionTagId, () => formData.instructionTagId,
(newInstructionTagId) => { (newInstructionTagId) => {
if (!newInstructionTagId) { if (!newInstructionTagId) {
formData.categoryId = '' formData.categoryId = ''
formData.typeId = '' formData.typeId = ''
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`;
@ -328,7 +336,7 @@ watch(
() => formData.categoryId, () => formData.categoryId,
(newCategoryId) => { (newCategoryId) => {
if (!newCategoryId) { if (!newCategoryId) {
formData.typeId = '' formData.typeId = ''
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`;
@ -344,8 +352,10 @@ function add() {
/** /**
* 编辑 * 编辑
* isEditMedia_是否为编辑指令资源 隐藏业务字段
*/ */
function edit(record) { function edit(record, isEditMedia_ = false) {
isEditMedia.value = isEditMedia_
formData.bodyTags = '' formData.bodyTags = ''
formData.emotionTags = '' formData.emotionTags = ''
nextTick(() => { nextTick(() => {
@ -403,6 +413,9 @@ async function submitForm() {
retrun; retrun;
} }
//
model.mediaFileSavePath = directiveBizPath
await saveOrUpdate(model, isUpdate.value) await saveOrUpdate(model, isUpdate.value)
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {

View File

@ -1,80 +1,95 @@
<template> <template>
<j-modal :title="title" width="70vw" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭" :maskClosable="false"> <j-modal :title="title" width="70vw" :visible="visible" @ok="handleOk"
<ConfigServiceDirectiveForm ref="registerForm" v-if="visible" @ok="submitCallback" :sysUrlValue="sysUrlValue" :formDisabled="disableSubmit" :formBpm="false"></ConfigServiceDirectiveForm> :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> </j-modal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, nextTick, defineExpose , defineProps} from 'vue'; import { ref, nextTick, defineExpose, defineProps } from 'vue';
import ConfigServiceDirectiveForm from './ConfigServiceDirectiveForm.vue' import ConfigServiceDirectiveForm from './ConfigServiceDirectiveForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue'; import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const props = defineProps({ const props = defineProps({
sysUrlValue: { type: String, default: '' }, });
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']);
/**
/** * 编辑
* 新增 * @param record
*/ */
function add() { function edit(record) {
title.value = '新增'; title.value = disableSubmit.value ? '详情' : '编辑';
visible.value = true; visible.value = true;
nextTick(() => { nextTick(() => {
registerForm.value.add(); registerForm.value.edit(record);
});
}
/**
* 编辑
* @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 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> </script>
<style lang="less"> <style lang="less">
/**隐藏样式-modal确定按钮 */ /**隐藏样式-modal确定按钮 */
.jee-hidden { .jee-hidden {
display: none !important; display: none !important;
} }
</style> </style>
<style lang="less" scoped></style> <style lang="less" scoped></style>

View File

@ -47,7 +47,7 @@
</a-form> </a-form>
</div> </div>
<!--引用表格--> <!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable">
<!--插槽:table标题--> <!--插槽:table标题-->
<template #tableTitle> <template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
@ -218,13 +218,6 @@ function getTableAction(record) {
}, { }, {
label: '详情', label: '详情',
onClick: handleDetail.bind(null, record), onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
}
} }
]; ];
} }

View File

@ -4,14 +4,14 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage(); const { createConfirm } = useMessage();
enum Api { enum Api {
list = '/services/serviceDirective/configServiceDirective/list', list = '/services/serviceDirective/list',
save='/services/serviceDirective/configServiceDirective/add', save='/services/serviceDirective/add',
edit='/services/serviceDirective/configServiceDirective/edit', edit='/services/serviceDirective/edit',
deleteOne = '/services/serviceDirective/configServiceDirective/delete', deleteOne = '/services/serviceDirective/delete',
deleteBatch = '/services/serviceDirective/configServiceDirective/deleteBatch', deleteBatch = '/services/serviceDirective/deleteBatch',
importExcel = '/services/serviceDirective/configServiceDirective/importExcel', importExcel = '/services/serviceDirective/importExcel',
exportXls = '/services/serviceDirective/configServiceDirective/exportXls', exportXls = '/services/serviceDirective/exportXls',
async = '/services/serviceDirective/configServiceDirective/async', async = '/services/serviceDirective/async',
} }
/** /**

View File

@ -4,7 +4,7 @@ import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage(); const { createConfirm } = useMessage();
enum Api { enum Api {
list = '/services/serviceDirective/configServiceDirective/list', list = '/services/serviceDirective/list',
} }
/** /**