服务指令功能完善

This commit is contained in:
1378012178@qq.com 2025-07-16 08:34:10 +08:00
parent bcfabb7667
commit 3e7639ad74
8 changed files with 164 additions and 54 deletions

View File

@ -24,7 +24,7 @@ export default defineComponent({
default: () => [],
},
},
emits: ['change', 'update:value'],
emits: ['change', 'update:value', 'upDictCode'],
setup(props, { emit }) {
const attrs = useAttrs();
//checkbox
@ -86,6 +86,7 @@ export default defineComponent({
if (res) {
checkOptions.value = res.map((item) => ({ value: item.value, label: item.text, disabled: item.status == 1 && !checkboxArray.value.includes(item.value), color: item.color }));
//console.info('res', dictOptions.value);
emit('upDictCode', checkOptions.value)
} else {
console.error('getDictItems error: : ', res);
checkOptions.value = [];

View File

@ -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>
@ -77,7 +78,7 @@ export default defineComponent({
style: propTypes.any,
ignoreDisabled: propTypes.bool.def(false),
},
emits: ['options-change', 'change', 'update:value'],
emits: ['options-change', 'change', 'update:value', 'upDictCode'],
setup(props, { emit, refs }) {
const dictOptions = ref<any[]>([]);
const attrs = useAttrs();
@ -140,6 +141,7 @@ export default defineComponent({
}
return prev;
}, []);
emit('upDictCode', dictOptions.value)
}
function handleChange(e) {

View File

@ -74,13 +74,15 @@ import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './InstructionTag.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './InstructionTag.api';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './InstructionTag.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import InstructionTagModal from './components/InstructionTagModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
@ -186,19 +188,38 @@ function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
//
function handleIzEnabled(record, izEnabled_) {
record.izEnabled = izEnabled_
saveOrUpdate(record, true).then((res) => {
if (res.success) {
createMessage.success(res.message);
reload();
} else {
createMessage.warning(res.message);
}
})
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record)
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '启用',
onClick: handleIzEnabled.bind(null, record, '0'),
ifShow: record.izEnabled == 1
},
{
label: '停用',
onClick: handleIzEnabled.bind(null, record, '1'),
ifShow: record.izEnabled == 0
},
];
}

View File

@ -82,13 +82,15 @@ import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './ConfigServiceCategory.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './ConfigServiceCategory.api';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './ConfigServiceCategory.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import ConfigServiceCategoryModal from './components/ConfigServiceCategoryModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
@ -194,19 +196,38 @@ function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
//
function handleIzEnabled(record, izEnabled_) {
record.izEnabled = izEnabled_
saveOrUpdate(record, true).then((res) => {
if (res.success) {
createMessage.success(res.message);
reload();
} else {
createMessage.warning(res.message);
}
})
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record)
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '启用',
onClick: handleIzEnabled.bind(null, record, '0'),
ifShow: record.izEnabled == 1
},
{
label: '停用',
onClick: handleIzEnabled.bind(null, record, '1'),
ifShow: record.izEnabled == 0
},
];
}

View File

@ -100,6 +100,12 @@ export const columns: BasicColumn[] = [
dataIndex: 'serviceDuration',
width: 135,
},
{
title: '指令状态',
align: 'center',
dataIndex: 'status_dictText',
width: 100,
},
{
title: '是否启用',
align: 'center',

View File

@ -56,7 +56,7 @@
<a-col :lg="6">
<a-form-item name="izEnabled">
<template #label><span title="是否启用">是否启用</span></template>
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="directive_status"
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled"
:ignoreDisabled="true" placeholder="请选择是否启用" allowClear />
</a-form-item>
</a-col>

View File

@ -10,28 +10,31 @@
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" />
placeholder="请选择分类标签" allowClear @upDictCode="upInstructionDictCode"
:disabled="!!formData.id && formData.status == 0" />
</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
@upDictCode="upCategoryDictCode" />
:disabled="!formData.instructionTagId || (!!formData.id && formData.status == 0)"
: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 @upDictCode="upTypeDictCode" />
:disabled="!formData.categoryId || (!!formData.id && formData.status == 0)" 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></a-input>
<a-input v-model:value="formData.directiveName" placeholder="请输入服务指令名称" allow-clear
:disabled="!!formData.id && formData.status == 0"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
@ -66,7 +69,8 @@
<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" />
placeholder="请选择周期类型" allowClear @upDictCode="upCycleTypeDictCode"
:disabled="!!formData.id && formData.status == 0" />
</a-form-item>
</a-col>
<a-col :span="12">
@ -82,30 +86,31 @@
<a-form-item label="体型标签" id="ConfigServiceDirectiveForm-typeId" :labelCol="labelCol2"
:wrapperCol="wrapperCol2" name="typeId">
<JCheckbox v-model:value="formData.bodyTags"
:dictCode="`nu_config_body_tag,tag_name,id,del_flag = 0 order by sort asc`" />
:dictCode="`nu_config_body_tag,tag_name,id,del_flag = 0 order by sort asc`"
@upDictCode="upBodyTagsDictCode" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="情绪标签" :labelCol="labelCol2" :wrapperCol="wrapperCol2" name="emoTags">
<JCheckbox v-model:value="formData.emotionTags"
:dictCode="`nu_config_emotion_tag,tag_name,id,del_flag = 0 order by sort asc`" />
:dictCode="`nu_config_emotion_tag,tag_name,id,del_flag = 0 order by sort asc`"
@upDictCode="upEmotionTagsDictCode" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ConfigServiceDirectiveForm-izEnabled"
name="izEnabled">
<span v-if="formData.izEnabled == 2">未授权</span>
<j-dict-select-tag v-else type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled"
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled"
placeholder="请选择是否启用"  allowClear />
</a-form-item>
</a-col>
</a-row>
<a-row v-if="formData.izEnabled == 0 || formData.izEnabled == 1">
<a-row v-if="disabled">
<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
:bizPath="directiveBizPath">
:bizPath="formComputedData.mediaFileSavePath">
</JImageUpload>
</a-form-item>
</a-col>
@ -122,14 +127,14 @@
<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
:bizPath="directiveBizPath"></j-upload>
: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
:bizPath="directiveBizPath"></j-upload>
:bizPath="formComputedData.mediaFileSavePath"></j-upload>
</a-form-item>
</a-col>
<a-row>
@ -138,7 +143,7 @@
</a-form>
</template>
</JFormContainer>
<JFormContainer v-if="formData.izEnabled == 0 || formData.izEnabled == 1">
<JFormContainer v-if="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
name="ConfigServiceDirectiveForm">
@ -163,7 +168,7 @@
<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
:bizPath="directiveBizPath">
:bizPath="formComputedData.mediaFileSavePath">
</JImageUpload>
</a-form-item>
</a-col>
@ -212,7 +217,8 @@ const formData = reactive<Record<string, any>>({
sort: 99,
serviceContent: '',
serviceDuration: '5',
izEnabled: '2',
status: '',
izEnabled: '0',
createBy: '',
createTime: '',
updateBy: '',
@ -229,6 +235,10 @@ 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 instructionTagName = ref('')
const categoryName = ref('')
const typeName = ref('')
const cycleTypeName = ref('')
//
const validatorRules = reactive({
categoryId: [{ required: true, message: '请选择服务类别!' },],
@ -296,36 +306,62 @@ function upInstructionDictCode(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_
}
//
const upBodyTagsComDictCode = ref([])
function upBodyTagsDictCode(v_) {
upBodyTagsComDictCode.value = v_
}
//
const upEmotionTagsComDictCode = ref([])
function upEmotionTagsDictCode(v_) {
upEmotionTagsComDictCode.value = v_
}
watch([instructionComDictCode, categoryComDictCode, typeComDictCode, cycleTypeComDictCode], () => {
// directiveBizPath
watch([instructionComDictCode, categoryComDictCode, typeComDictCode, cycleTypeComDictCode, upBodyTagsComDictCode, upEmotionTagsComDictCode], () => {
// formComputedData
}, { deep: true });
const directiveBizPath = computed(() => {
if (!canUploadPreviewImage.value) return '';
const bodyTagsObj = ref([])
const emotionTagsObj = ref([])
const formComputedData = 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;
const instructionName = instructionComDictCode.value.find(d => d.value == formData.instructionTagId)?.label || '';
const categoryName = categoryComDictCode.value.find(d => d.value == formData.categoryId)?.label || '';
const typeName = typeComDictCode.value.find(d => d.value == formData.typeId)?.label || '';
const cycleTypeName = cycleTypeComDictCode.value.find(d => d.value == formData.cycleType)?.label || '';
//
return 'directive/' + `${instructionTagName_}/${categoryName_}/${typeName_}/${formData.directiveName}/${cycleTypeName_}`;
//
const processTags = (tags, dict) => {
if (!tags) return [];
return tags.split(',')
.map(id => dict.find(d => d.value === id))
.filter(Boolean)
.map(item => ({ id: item.value, label: item.label }));
};
return {
mediaFileSavePath: `directive/${instructionName}/${categoryName}/${typeName}/${formData.directiveName}/${cycleTypeName}`,
instructionName,
categoryName,
typeName,
cycleTypeName,
bodyTagsObj: JSON.stringify(processTags(formData.bodyTags, upBodyTagsComDictCode.value)),
emotionTagsObj: JSON.stringify(processTags(formData.emotionTags, upEmotionTagsComDictCode.value))
};
});
watch(
@ -398,7 +434,11 @@ async function submitForm() {
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
const computedData = formComputedData.value;
const model = {
...formData,
...computedData
};
if (model.id) {
isUpdate.value = true;
}
@ -418,12 +458,9 @@ async function submitForm() {
if (model.comPrice != 0 && model.tollPrice <= model.comPrice) {
createMessage.warning('提成价格不能高于收费价格!');
confirmLoading.value = false;
retrun;
return
}
//
model.mediaFileSavePath = directiveBizPath
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {

View File

@ -82,14 +82,16 @@ import { ref, reactive, computed, watch } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './ConfigServiceType.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './ConfigServiceType.api';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './ConfigServiceType.api';
import { defHttp } from '/@/utils/http/axios';
import { downloadFile } from '/@/utils/common/renderUtils';
import ConfigServiceTypeModal from './components/ConfigServiceTypeModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
@ -207,18 +209,38 @@ function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
//
function handleIzEnabled(record, izEnabled_) {
record.izEnabled = izEnabled_
saveOrUpdate(record, true).then((res) => {
if (res.success) {
createMessage.success(res.message);
reload();
} else {
createMessage.warning(res.message);
}
})
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record)
}, {
label: '详情',
onClick: handleDetail.bind(null, record),
}
},
{
label: '启用',
onClick: handleIzEnabled.bind(null, record, '0'),
ifShow: record.izEnabled == 1
},
{
label: '停用',
onClick: handleIzEnabled.bind(null, record, '1'),
ifShow: record.izEnabled == 0
},
];
}