# Conflicts:
#	src/components/Application/src/AppLogo.vue
#	src/layouts/default/header/index.vue
This commit is contained in:
yangjun 2025-08-15 16:36:19 +08:00
commit 0c31c8a181
21 changed files with 3494 additions and 746 deletions

View File

@ -2,7 +2,7 @@
VITE_USE_MOCK = false
# 发布路径
VITE_PUBLIC_PATH = /biz101
VITE_PUBLIC_PATH = /biz103
# 是否启用gzip或brotli压缩
# 选项值: gzip | brotli | none
@ -13,10 +13,10 @@ VITE_BUILD_COMPRESS = 'gzip'
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
#后台接口父地址(必填)
VITE_GLOB_API_URL=/nursingunit101
VITE_GLOB_API_URL=/nursingunit103
#后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=https://www.focusnu.com/nursingunit101
VITE_GLOB_DOMAIN_URL=https://www.focusnu.com/nursingunit103
# 接口父路径前缀
VITE_GLOB_API_URL_PREFIX=

View File

@ -106,4 +106,8 @@ img {
color: #69c0ff !important;
}
// update-end--author:liaozhiyang---date:20230803---forQQYUN-5839windihtml2canvas</style>
.p-2{
padding: 14px;
}
// update-end--author:liaozhiyang---date:20230803---forQQYUN-5839windihtml2canvas
</style>

View File

@ -0,0 +1,45 @@
import { ref, onMounted, onBeforeUnmount, computed } from 'vue';
// 屏幕尺寸枚举(可根据实际需求调整)
export enum ScreenEnum {
XS = 480,
SM = 576,
MD = 768,
LG = 992,
XL = 1200,
XXL = 1600,
}
export function useResponsive() {
const screenWidth = ref(window.innerWidth);
const screenHeight = ref(window.innerHeight);
const getScreenEnum = computed(() => {
if (screenWidth.value >= ScreenEnum.XXL) return ScreenEnum.XXL;
if (screenWidth.value >= ScreenEnum.XL) return ScreenEnum.XL;
if (screenWidth.value >= ScreenEnum.LG) return ScreenEnum.LG;
if (screenWidth.value >= ScreenEnum.MD) return ScreenEnum.MD;
if (screenWidth.value >= ScreenEnum.SM) return ScreenEnum.SM;
return ScreenEnum.XS;
});
const handleResize = () => {
screenWidth.value = window.innerWidth;
screenHeight.value = window.innerHeight;
};
onMounted(() => {
window.addEventListener('resize', handleResize);
});
onBeforeUnmount(() => {
window.removeEventListener('resize', handleResize);
});
return {
screenEnum: ScreenEnum,
screenWidth,
screenHeight,
getScreenEnum,
};
}

View File

@ -263,10 +263,18 @@
}
.headClass{
<<<<<<< .mine
// background-image: url('../resource/img/bj.png') !important;
// background-repeat: no-repeat;
// background-size: 100% auto;
// background-color: #eef3f8 !important;
background: linear-gradient(to right, #e2edff, #eef3f8) !important;
=======
// background-image: url('../resource/img/bj.png') !important;
// background-repeat: no-repeat;
// background-size: 100% auto;
// background-color: #e5f5f9 !important;
>>>>>>> .theirs
}
</style>

View File

@ -83,10 +83,10 @@ async function bootstrap(props?: MainAppProps) {
setupErrorHandle(app);
// 注册第三方组件
// await registerThirdComp(app);
await registerThirdComp(app);
// 当路由准备好时再执行挂载( https://next.router.vuejs.org/api/#isready)
// await router.isReady();
await router.isReady();
// 挂载应用
app.mount(getMountContainer(props), true);

View File

@ -0,0 +1,97 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/elder/elderTag/list',
save='/elder/elderTag/add',
edit='/elder/elderTag/edit',
deleteOne = '/elder/elderTag/delete',
deleteBatch = '/elder/elderTag/deleteBatch',
importExcel = '/elder/elderTag/importExcel',
exportXls = '/elder/elderTag/exportXls',
listByDS = '/elder/elderTag/listByDS',
idListByDS = '/elder/elderTag/idListByDS',
syncElderTag = '/elder/elderTag/syncElderTag',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
* @param isUpdate
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}
/**
* -
* @param params
*/
export const listByDS = (params) => defHttp.get({ url: Api.listByDS, params });
/**
*
* @param params id
* @returns
*/
export const idListByDS = (params) => defHttp.get({ url: Api.idListByDS, params });
/**
*
* @param params
* @returns
*/
export const syncElderTag = (dataSourceCode: string, params: any) => {
return defHttp.post({ url: `${Api.syncElderTag}?sourceOrgCode=${encodeURIComponent(dataSourceCode)}`, params });
};

View File

@ -0,0 +1,49 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '标签类型',
align: 'center',
dataIndex: 'type_dictText',
},
{
title: '标签名称',
align: 'center',
dataIndex: 'tagName',
},
{
title: '价格(元)',
align: 'center',
dataIndex: 'price',
},
{
title: '图标',
align: 'center',
dataIndex: 'pic',
customRender: render.renderImage,
},
{
title: '排序',
align: 'center',
dataIndex: 'sort',
},
{
title: '是否启用',
align: 'center',
dataIndex: 'izEnabled_dictText',
},
];
// 高级查询数据
export const superQuerySchema = {
type: { title: '标签类型', order: 0, view: 'text', type: 'string' },
tagName: { title: '标签名称', order: 1, view: 'text', type: 'string' },
price: { title: '价格', order: 2, view: 'number', type: 'number' },
pic: { title: '图标', order: 3, view: 'text', type: 'string' },
sort: { title: '排序', order: 4, view: 'number', type: 'number' },
izEnabled: { title: '是否启用', order: 5, view: 'text', type: 'string' },
};

View File

@ -0,0 +1,271 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="type">
<template #label><span title="标签类型">标签类型</span></template>
<j-dict-select-tag v-model:value="queryParam.type" dictCode="elder_tag_type" placeholder="请选择标签类型"
allowClear :ignoreDisabled="true" />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="tagName">
<template #label><span title="标签名称">标签名称</span></template>
<JInput v-model:value="queryParam.tagName" placeholder="请输入标签名称" allowClear />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="izEnabled">
<template #label><span title="是否启用">是否启用</span></template>
<j-dict-select-tag type='list' placeholder="请选择是否启用" v-model:value="queryParam.izEnabled"
dictCode="iz_enabled" allow-clear />
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'eldertag:nu_elder_tag:add'" @click="handleAdd"
preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" class="btnPrivate" @click="handleDirectiveMainOpen" v-show="isShowETM"
preIcon="ant-design:profile-outlined">标准标签库</a-button>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
<!-- 表单区域 -->
<ElderTagModal ref="registerModal" @success="handleSuccess"></ElderTagModal>
</div>
</template>
<script lang="ts" name="eldertag-elderTag" setup>
import { ref, reactive, onMounted } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './ElderTag.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './ElderTag.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import ElderTagModal from './components/ElderTagModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
import { queryByKey } from '/@/views/admin/sysconfig/SysConfig.api'
import { getOrgInfo } from '@/api/common/api'
import { useMessage } from '/@/hooks/web/useMessage';
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const userStore = useUserStore();
const isShowETM = ref(false)//
const mainOrgCode = ref()//
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '长者标签',
api: list,
columns,
canResize: false,
useSearchForm: false,
actionColumn: {
width: 120,
fixed: 'right',
},
defSort: {
column: 'sort',
order: 'asc',
},
beforeFetch: async (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "长者标签",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 6,
xxl: 4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
searchQuery();
}
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.opeType = 'add';
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.opeType = 'edit';
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.opeType = 'look';
registerModal.value.edit(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'eldertag:nu_elder_tag:edit'
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
}
];
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//
reload();
}
/**
* 查看指令库
*/
function handleDirectiveMainOpen() {
registerModal.value?.openETM(mainOrgCode.value)
}
async function getElderTagMainOrgCode() {
let { orgCode } = await getOrgInfo()
let { configValue } = await queryByKey({ key: 'elder_tag_main_org_code' })
mainOrgCode.value = configValue
if (orgCode != configValue) isShowETM.value = true
}
//
onMounted(() => {
getElderTagMainOrgCode()
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help) {
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
}
</style>

View File

@ -0,0 +1,43 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '标签类型',
align: 'center',
dataIndex: 'type_dictText',
},
{
title: '标签名称',
align: 'center',
dataIndex: 'tagName',
},
{
title: '价格(元)',
align: 'center',
dataIndex: 'price',
},
{
title: '排序',
align: 'center',
dataIndex: 'sort',
},
{
title: '是否启用',
align: 'center',
dataIndex: 'izEnabled_dictText',
},
];
// 高级查询数据
export const superQuerySchema = {
type: { title: '标签类型', order: 0, view: 'text', type: 'string' },
tagName: { title: '标签名称', order: 1, view: 'text', type: 'string' },
price: { title: '价格', order: 2, view: 'number', type: 'number' },
pic: { title: '图标', order: 3, view: 'text', type: 'string' },
sort: { title: '排序', order: 4, view: 'number', type: 'number' },
izEnabled: { title: '是否启用', order: 5, view: 'text', type: 'string' },
};

View File

@ -0,0 +1,208 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ElderTagForm">
<a-row>
<a-col :span="24">
<a-form-item label="标签类型" v-bind="validateInfos.type" id="ElderTagForm-type" name="type">
<j-dict-select-tag v-model:value="formData.type" dictCode="elder_tag_type" placeholder="请选择标签类型"
allowClear :ignoreDisabled="true" :disabled="!!formData.id" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="标签名称" v-bind="validateInfos.tagName" id="ElderTagForm-tagName" name="tagName">
<a-input v-model:value="formData.tagName" placeholder="请输入标签名称" allow-clear
:disabled="!!formData.id"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="价格(元)" v-bind="validateInfos.price" id="ElderTagForm-price" name="price">
<a-input-number v-model:value="formData.price" placeholder="请输入价格" style="width: 100%" :min="0"
:max="99.99" :precision="2" @keydown="onPriceKeydown" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="图标" v-bind="validateInfos.pic" id="ElderTagForm-pic" name="pic">
<span v-if="disabled && !formData.pic">暂无文件</span>
<JImageUpload v-else-if="opeType == 'dmlook'" :fileMax="1" :value="mediaApiAddress + formData.pic">
</JImageUpload>
<JImageUpload v-else :fileMax="1" v-model:value="formData.pic"></JImageUpload>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="排序" v-bind="validateInfos.sort" id="ElderTagForm-sort" name="sort">
<a-input-number v-model:value="formData.sort" placeholder="请输入排序" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ElderTagForm-izEnabled" name="izEnabled">
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled"
placeholder="请选择是否启用"  allowClear />
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../ElderTag.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true },
mediaApiAddress: '',//
opeType: 'look',
});
const onPriceKeydown = (e: KeyboardEvent) => {
const key = e.key;
//
if (['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab'].includes(key)) return;
//
if (!/[\d.]/.test(key)) {
e.preventDefault();
return;
}
const input = e.target as HTMLInputElement;
const { value, selectionStart: s, selectionEnd: t } = input;
const next = value.slice(0, s!) + key + value.slice(t!);
// 22
if (!/^\d{0,2}(?:\.\d{0,2})?$/.test(next)) {
e.preventDefault();
}
};
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
type: '',
tagName: '',
price: 0,
pic: '',
sort: 99,
izEnabled: '0',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
type: [{ required: true, message: '请输入标签类型!' },],
tagName: [{ required: true, message: '请输入标签名称!' },],
price: [{ required: true, message: '请输入价格!' }, { pattern: /^(([0-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!' },],
izEnabled: [{ required: true, message: '请输入是否启用!' },],
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
} else {
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if (record.hasOwnProperty(key)) {
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>

View File

@ -0,0 +1,144 @@
<template>
<a-drawer :title="title" width="50vw" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" @cancel="handleCancel">
<template #footer>
<a-button @click="handleCancel" style="margin-right: 8px;">关闭</a-button>
<a-button @click="handleOk" v-show="!disableSubmit">确认</a-button>
</template>
<ElderTagForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"
:mediaApiAddress="mediaApiAddress" :opeType="opeType"></ElderTagForm>
</a-drawer>
<a-drawer :title="'标准指令库'" width="80vw" v-model:visible="etmVisible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancelETM" :maskClosable="true">
<a-spin :spinning="loading">
<ElderTagRespositoryList ref="etmRef" :mainOrgCode="mainOrgCode"></ElderTagRespositoryList>
</a-spin>
<template #footer>
<a-button @click="handleCancelETM" style="margin-right: 8px;">关闭</a-button>
<a-button @click="handlePullETM">镜像</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import ElderTagForm from './ElderTagForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
import { clearCache } from '/@/utils/cache/cacheUtil'
import { useMessage } from '/@/hooks/web/useMessage';
import ElderTagRespositoryList from './ElderTagRespositoryList.vue'
import { syncElderTag } from '../ElderTag.api'
const props = defineProps({
mediaApiAddress: '',//
});
const mainOrgCode = ref('')
const etmRef = ref()
const title = ref<string>('');
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
const etmVisible = ref(false)
const { createMessage, createConfirm } = useMessage();
const loading = ref(false)
const opeType = ref('')
function handleCancelETM() {
etmVisible.value = false
clearCache()
emit('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;
}
function openETM(orgCode) {
etmVisible.value = true
mainOrgCode.value = orgCode
nextTick(() => {
etmRef.value?.init()
})
}
function handlePullETM() {
let selectedData = etmRef.value?.getSelectedIds()
if (!selectedData.count) {
createMessage.warning('未选择长者标签')
return
}
createConfirm({
iconType: 'warning',
title: '镜像确认',
content: '是否确认将<span style="font-weight:500;color:#efac0e;"> ' + selectedData.count + ' </span>条长者标签拉取到本平台?',
okText: '确认',
cancelText: '取消',
onOk: () => {
syncElderTag(mainOrgCode.value, { syncIds: selectedData.ids, })
createMessage.success('从标准标签库开始拉取')
// etmRef.value?.init()
handleCancelETM()
}
});
}
defineExpose({
add,
edit,
disableSubmit,
openETM,
opeType,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>

View File

@ -0,0 +1,312 @@
<template>
<div>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol" style="padding-top: 20px;">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="type">
<template #label><span title="标签类型">标签类型</span></template>
<j-dict-select-tag v-model:value="queryParam.type" dictCode="elder_tag_type" placeholder="请选择标签类型"
allowClear :ignoreDisabled="true" />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="tagName">
<template #label><span title="标签名称">标签名称</span></template>
<JInput v-model:value="queryParam.tagName" placeholder="请输入标签名称" allowClear />
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
</div>
<!-- 表单区域 -->
<ElderTagModal ref="registerModal" :mediaApiAddress="mediaApiAddress" @success="handleSuccess"
:mainOrgCode="mainOrgCode">
</ElderTagModal>
</div>
</template>
<script lang="ts" name="serviceDirective-configServiceDirective" setup>
import { ref, reactive, watch, onMounted, computed } from 'vue';
import { BasicTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './ElderTag.data';
import { listByDS, idListByDS } from '../ElderTag.api';
import ElderTagModal from './ElderTagModal.vue'
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { cloneDeep } from "lodash-es";
import { getOrgInfo, getMediaUrlByOrgCode } from '@/api/common/api'
const props = defineProps({
mainOrgCode: '',
});
const mediaApiAddress = ref()//
const orgName = ref('')
const formRef = ref();
const queryParam = reactive<any>({
type: '',
tagName: '',
izEnabled: '0',
});
const registerModal = ref();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '服务指令',
api: listByDS,
columns,
canResize: false,
useSearchForm: false,
showIndexColumn: true,
scroll: { y: '58vh' },
pagination: {
current: 1,
pageSize: 15,
pageSizeOptions: ['15', '50', '70', '100'],
},
actionColumn: {
width: 200,
fixed: 'right',
},
defSort: {
column: 'sort',
order: 'asc',
},
beforeFetch: async (params) => {
params.dataSourceCode = props.mainOrgCode
if (excludeIds.value.length) {
params.excludeIds = excludeIds.value.join(',')
}
params.izEnabled = '0'
return Object.assign(params,queryParam)
},
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 7,
xxl: 6
});
const wrapperCol = reactive({
xs: 24,
sm: 19,
xl: 17,
xxl: 18
});
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.opeType = 'dmlook';
record.orgCode_ = props.mainOrgCode
registerModal.value.edit(record, false, true);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
]
}
/**
* 查询
*/
function searchQuery(reloadTree = true) {
reload()
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields(); //
// queryParam
queryParam.type = '';
queryParam.tagName = '';
//
reload()
}
const excludeIds = ref('')
async function init() {
//
{
formRef.value.resetFields(); //
// queryParam
queryParam.type = '';
queryParam.tagName = '';
selectedRowKeys.value = [];
}
let { ids } = getSelectedIds();
let res = await idListByDS({ dataSourceCode: 'master' });
// ID
let existingExcludeIds = res.records.map(item => item.id);
// ids
if (ids) {
const idsToAdd = ids.split(',');
existingExcludeIds = [...existingExcludeIds, ...idsToAdd];
}
// excludeIds.value
excludeIds.value = [...new Set(existingExcludeIds)];
reload();
}
/**
* 获取到已选择的所有id
*/
function getSelectedIds() {
const ids = selectedRowKeys.value.join(',');
const count = selectedRowKeys.value.length;
return { ids, count }; // ID
}
//
onMounted(() => {
getOrgInfo().then(res => {
orgName.value = res.orgName
})
getMediaUrlByOrgCode({ orgCode: props.mainOrgCode }).then(res => {
mediaApiAddress.value = res.mediaUrl
})
});
defineExpose({
getSelectedIds,
init
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
margin-bottom: 18px;
.table-page-search-submitButtons {
display: block;
margin-bottom: 0px;
white-space: nowrap;
}
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help) {
margin-bottom: 18px;
height: 32px;
}
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
}
audio::-webkit-media-controls-timeline {
display: none;
}
audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
display: none;
}
.btnPrivate {
height: 34px;
margin-left: 4px;
}
.node-title {
display: inline-flex;
align-items: center;
}
.action-icon {
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>

File diff suppressed because it is too large Load Diff

View File

@ -38,34 +38,34 @@ export const columns: BasicColumn[] = [
align: 'center',
dataIndex: 'directiveName',
},
{
title: '体型标签',
align: 'center',
dataIndex: 'bodyTagList',
width: 150,
ellipsis: false,
// format(text, record, index) {
// if (!!text) {
// return text.map((item) => item.tagName).join('、');
// } else {
// return '-';
// }
// },
},
{
title: '情绪标签',
align: 'center',
dataIndex: 'emotionTagList',
width: 150,
ellipsis: false,
// format(text, record, index) {
// if (!!text) {
// return text.map((item) => item.tagName).join('、');
// } else {
// return '-';
// }
// },
},
// {
// title: '体型标签',
// align: 'center',
// dataIndex: 'bodyTagList',
// width: 150,
// ellipsis: false,
// // format(text, record, index) {
// // if (!!text) {
// // return text.map((item) => item.tagName).join('、');
// // } else {
// // return '-';
// // }
// // },
// },
// {
// title: '情绪标签',
// align: 'center',
// dataIndex: 'emotionTagList',
// width: 150,
// ellipsis: false,
// // format(text, record, index) {
// // if (!!text) {
// // return text.map((item) => item.tagName).join('、');
// // } else {
// // return '-';
// // }
// // },
// },
{
title: '收费价格',
align: 'center',

View File

@ -37,7 +37,7 @@
<JInput v-model:value="queryParam.directiveName" placeholder="请输入服务指令名称" allowClear />
</a-form-item>
</a-col>
<a-col :lg="6">
<!-- <a-col :lg="6">
<a-form-item name="bodyTags">
<template #label><span title="体型标签">体型标签</span></template>
<j-dict-select-tag type='list' v-model:value="queryParam.bodyTags"
@ -52,7 +52,7 @@
:dictCode="`nu_config_emotion_tag,tag_name,id,del_flag = '0' and iz_enabled = 0 order by sort asc`"
:ignoreDisabled="true" placeholder="请选择情绪标签" allowClear />
</a-form-item>
</a-col>
</a-col> -->
<!-- <a-col :lg="6">
<a-form-item name="izEnabled">
<template #label><span title="是否启用">是否启用</span></template>
@ -73,7 +73,7 @@
</a-form>
</div>
<div>
<div style="width:350px;float: left;max-height:80vh; overflow:auto;position: relative;">
<div style="width:350px;float: left;height:80vh; background: white; overflow:auto;position: relative;margin-right: 18px;">
<div
style="position: absolute; top: 8px; right: 8px; z-index: 1; background: white; padding: 0px; border-radius: 4px;">
<a-radio-group v-model:value="filterIzEnabled" @change="searchQuery">
@ -89,18 +89,18 @@
<a-empty v-if="!treeLoading && treeLoading" />
<a-button v-if="!treeLoading && treeData.length < 1" type="link" class="btnPrivate" @click="addInstruction"
preIcon="ant-design:plus-outlined">新增分类标签</a-button>
<a-tree style="padding-top: 40px;min-height:80vh;" v-if="!treeLoading && treeData.length > 0"
<a-tree class="container-height" style="padding-top: 40px;" v-if="!treeLoading && treeData.length > 0"
:tree-data="treeData" v-model:expandedKeys="expandedKeys" expandAction="click" @select="handleTreeSelect">
<template #title="{ data }">
<!-- @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 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>
</div> -->
<span v-if="data.level == 4">{{ data?.title + '(' + data?.cycleTypeName + ')' }}</span>
<span v-else>{{ data?.title }}</span>
<span v-if="data?.izEnabled == '1' && data.level != 5" style="color:red;">(已停用)</span>
@ -124,7 +124,7 @@
</template>
</a-tree>
</div>
<div style="width:calc(100% - 360px);float: left;margin-left: 10px;">
<div style="width:calc(100% - 370px);float: left; background-color: white;" class="container-height">
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
@ -134,14 +134,14 @@
<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="handleBodyTag"
<!-- <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>
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="handleDirectiveMainOpen" v-show="isShowDM"
preIcon="ant-design:profile-outlined">指令库</a-button>
preIcon="ant-design:profile-outlined">标准指令库</a-button>
</template>
<!--操作栏-->
<template #action="{ record }">
@ -228,20 +228,20 @@
</a-drawer>
<!-- 体型标签 -->
<a-drawer title="体型标签" width="60vw" :open="bodyTagOpen" @close="onBodyTagClose">
<!-- <a-drawer title="体型标签" width="60vw" :open="bodyTagOpen" @close="onBodyTagClose">
<template #footer>
<a-button type="primary" @click="onBodyTagClose" style="float: right;">关闭</a-button>
</template>
<BodyTagList v-if="bodyTagOpen"></BodyTagList>
</a-drawer>
</a-drawer> -->
<!-- 情绪标签 -->
<a-drawer title="情绪标签" width="60vw" :open="emotionTagOpen" @close="onEmotionTagClose">
<!-- <a-drawer title="情绪标签" width="60vw" :open="emotionTagOpen" @close="onEmotionTagClose">
<template #footer>
<a-button type="primary" @click="onEmotionTagClose" style="float: right;">关闭</a-button>
</template>
<EmotionTagList v-if="emotionTagOpen"></EmotionTagList>
</a-drawer>
</a-drawer> -->
<!-- 音频播放 -->
<a-modal v-model:visible="showAudioModal" title="音频播放" :footer="null" @cancel="closeAudioModal"
@ -1138,7 +1138,7 @@ audio::-webkit-media-controls-time-remaining-display {
}
.btnPrivate {
height: 34px;
height: 40px;
margin-left: 4px;
}
@ -1166,4 +1166,13 @@ audio::-webkit-media-controls-time-remaining-display {
}
}
.container-height {
height: 77vh;
}
@media screen and (min-width: 1600px) and (min-height: 900px) {
.container-height {
height: 81.5vh;
}
}
</style>

View File

@ -38,34 +38,34 @@ export const columns: BasicColumn[] = [
align: 'center',
dataIndex: 'directiveName',
},
{
title: '体型标签',
align: 'center',
dataIndex: 'bodyTagList',
width: 150,
ellipsis: false,
format(text, record, index) {
if (!!text) {
return text.map((item) => item.tagName).join('、');
} else {
return '-';
}
},
},
{
title: '情绪标签',
align: 'center',
dataIndex: 'emotionTagList',
width: 150,
ellipsis: false,
format(text, record, index) {
if (!!text) {
return text.map((item) => item.tagName).join('、');
} else {
return '-';
}
},
},
// {
// title: '体型标签',
// align: 'center',
// dataIndex: 'bodyTagList',
// width: 150,
// ellipsis: false,
// format(text, record, index) {
// if (!!text) {
// return text.map((item) => item.tagName).join('、');
// } else {
// return '-';
// }
// },
// },
// {
// title: '情绪标签',
// align: 'center',
// dataIndex: 'emotionTagList',
// width: 150,
// ellipsis: false,
// format(text, record, index) {
// if (!!text) {
// return text.map((item) => item.tagName).join('、');
// } else {
// return '-';
// }
// },
// },
{
title: '收费价格',
align: 'center',

View File

@ -1,6 +1,6 @@
<template>
<a-spin :spinning="confirmLoading">
<div style="background-color: #fff;border-radius: 10px;box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);">
<div style="padding: 14px; background-color: #fff;border-radius: 10px;box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" :colon="false"
@ -38,10 +38,10 @@
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="机构优惠" v-bind="validateInfos.izPreferential"
id="ConfigServiceDirectiveForm-izPreferential" name="izPreferential">
<j-dict-select-tag type='radio' v-model:value="formData.izPreferential"
dictCode="institutional_discount" allowClear />
<a-form-item label="收费价格(元)" v-bind="validateInfos.tollPrice" id="ConfigServiceDirectiveForm-tollPrice"
name="tollPrice">
<a-input-number v-model:value="formData.tollPrice" placeholder="请输入收费价格" style="width: 100%" :min="0"
:max="99999.99" :precision="2" @keydown="onPriceKeydown" />
</a-form-item>
</a-col>
<a-col :span="12">
@ -51,27 +51,6 @@
placeholder="请选择周期类型" allowClear @upDictCode="upCycleTypeDictCode" :disabled="!!formData.id" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ConfigServiceDirectiveForm-izEnabled"
name="izEnabled">
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled"
placeholder="请选择是否启用"  allowClear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="收费价格(元)" v-bind="validateInfos.tollPrice" id="ConfigServiceDirectiveForm-tollPrice"
name="tollPrice">
<a-input-number v-model:value="formData.tollPrice" placeholder="请输入收费价格" style="width: 100%" :min="0"
:max="99999.99" :precision="2" @keydown="onPriceKeydown" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="医保报销" v-bind="validateInfos.izReimbursement"
id="ConfigServiceDirectiveForm-izReimbursement" name="izReimbursement">
<j-dict-select-tag type='radio' v-model:value="formData.izReimbursement" dictCode="med_ins_reimb"
allowClear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="提成价格(元)" v-bind="validateInfos.comPrice" id="ConfigServiceDirectiveForm-comPrice"
name="comPrice">
@ -79,6 +58,13 @@
:max="99999.99" :precision="2" @keydown="onPriceKeydown" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ConfigServiceDirectiveForm-izEnabled"
name="izEnabled">
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled"
placeholder="请选择是否启用"  allowClear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="服务时长" v-bind="validateInfos.serviceDuration"
id="ConfigServiceDirectiveForm-serviceDuration" name="serviceDuration">
@ -87,150 +73,6 @@
</a-form-item>
</a-col>
</a-row>
<a-row v-show="!isEditMedia"
style="background-color: #f6faff ; border-top: 1px solid #F0F0F0;border-bottom: 1px solid #F0F0F0;">
<a-col :span="12" style="border-right: 1px solid #F0F0F0;padding-top: 20px;">
<a-form-item label="体型标签" id="ConfigServiceDirectiveForm-typeId" name="typeId">
<span v-if="disabled && !formData.bodyTags">-</span>
<JCheckbox v-else v-model:value="formData.bodyTags" :orgCode="mainOrgCode" :dictCode="bodyTagDictCode"
@upDictCode="upBodyTagsDictCode" />
</a-form-item>
</a-col>
<a-col :span="12" style="padding-top: 20px;">
<a-form-item label="情绪标签" name="emoTags">
<span v-if="disabled && !formData.emotionTags">-</span>
<JCheckbox v-else v-model:value="formData.emotionTags" :orgCode="mainOrgCode"
:dictCode="emotionTagDictCode" @upDictCode="upEmotionTagsDictCode" />
</a-form-item>
</a-col>
</a-row>
<a-row style="padding: 20px;">
<a-col :span="6">
<DirectiveRadioCom :directiveMediaBtnValue="directiveMediaBtnValue" @change="mediaBtnChanged">
</DirectiveRadioCom>
</a-col>
</a-row>
<a-row style="padding: 0px 20px;">
<a-col :span="24" v-show="directiveMediaBtnValue == 0">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./pictype.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
<a-col :span="24" v-show="directiveMediaBtnValue == 1">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./mp3type.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
<a-col :span="24" v-show="directiveMediaBtnValue == 2">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./mp4type.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
<a-col :span="24" v-show="directiveMediaBtnValue == 3">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./pictype.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
</a-row>
<a-row style="padding: 20px;">
<a-col :span="2">
<!-- 相对定位的容器 -->
<div class="description-container">
<a-button @click="toggleDescription">服务指令描述</a-button>
<div v-show="showDescription" class="description-box">
<div class="box-header">
<span class="title">服务指令描述</span>
<span class="collapse-icon" @click="toggleDescription">
<DownOutlined style="margin-right: 3px;" />收起
</span>
</div>
<div>
<a-textarea v-model:value="formData.serviceContent" placeholder="请输入服务指令描述" :maxlength="200"
:rows="3" :autosize="{ minRows: 3 }" :showCount="true" />
</div>
<!-- <div style="margin-top: 60px;">
<a-button type="primary" class="confirm-btn">确认</a-button>
</div> -->
</div>
</div>
</a-col>
</a-row>
<a-row style="margin-top: 20px;">
<a-col :span="12" v-show="showMedia">
<a-form-item label="服务指令图片" v-bind="validateInfos.previewFile">
@ -396,7 +238,7 @@ const checkMp3 = (file) => {
const checkMp4 = (file) => {
const isPDF = file.type === 'application/mp4' || file.name.endsWith('.mp4');
if (!isPDF) {
createMessage.error('只能上传 PDF mp4');
createMessage.error('只能上传 mp4 文件!');
return false; //
}
return true;
@ -433,7 +275,7 @@ const formData = reactive<Record<string, any>>({
immediateFile: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 4 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 19 } });
const confirmLoading = ref<boolean>(false);
const isEditMedia = ref(false)

View File

@ -0,0 +1,779 @@
<template>
<a-spin :spinning="confirmLoading">
<div style="padding: 14px;background-color: #fff;border-radius: 10px;box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" :colon="false"
name="ConfigService2DirectiveForm" style="padding: 20px 0px;">
<a-row v-show="!isEditMedia">
<a-col :span="12" v-show="false">
<a-form-item label="分类标签" v-bind="validateInfos.instructionTagId"
id="ConfigServiceDirectiveForm-instructionTagId" name="instructionTagId">
<j-dict-select-tag v-model:value="formData.instructionTagId" :orgCode="mainOrgCode"
:dictCode="`nu_config_service_instruction_tag,instruction_name,id,del_flag = 0 and iz_enabled = 0 order by sort asc`"
placeholder="请选择分类标签" allowClear @upDictCode="upInstructionDictCode" :disabled="!!formData.id" />
</a-form-item>
</a-col>
<a-col :span="12" v-show="false">
<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.id"
:orgCode="mainOrgCode" :dictCode="categoryDictCode" placeholder="请选择服务类别" allow-clear
@upDictCode="upCategoryDictCode" />
</a-form-item>
</a-col>
<a-col :span="12" v-show="false">
<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"
:orgCode="mainOrgCode" :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 :maxlength="20"
:showCount="true" :disabled="!!formData.id"></a-input>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="收费价格(元)" v-bind="validateInfos.tollPrice" id="ConfigServiceDirectiveForm-tollPrice"
name="tollPrice">
<a-input-number v-model:value="formData.tollPrice" placeholder="请输入收费价格" style="width: 100%" :min="0"
:max="99999.99" :precision="2" @keydown="onPriceKeydown" />
</a-form-item>
</a-col>
<a-col :span="12">
<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" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="提成价格(元)" v-bind="validateInfos.comPrice" id="ConfigServiceDirectiveForm-comPrice"
name="comPrice">
<a-input-number v-model:value="formData.comPrice" placeholder="请输入提成价格" style="width: 100%" :min="0"
:max="99999.99" :precision="2" @keydown="onPriceKeydown" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ConfigServiceDirectiveForm-izEnabled"
name="izEnabled">
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled"
placeholder="请选择是否启用"  allowClear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="服务时长" v-bind="validateInfos.serviceDuration"
id="ConfigServiceDirectiveForm-serviceDuration" name="serviceDuration">
<a-input-number v-model:value="formData.serviceDuration" :min="5" :max="55" :step="5" addon-after="分钟"
placeholder="请输入服务时长(分钟)" allow-clear @keydown="onDurationKeydown" />
</a-form-item>
</a-col>
</a-row>
<a-row style="padding: 20px;">
<a-col :span="6">
<DirectiveRadioCom :directiveMediaBtnValue="directiveMediaBtnValue" @change="mediaBtnChanged">
</DirectiveRadioCom>
</a-col>
</a-row>
<a-row style="padding: 0px 20px;">
<a-col :span="24" v-show="directiveMediaBtnValue == 0">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./pictype.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
<a-col :span="24" v-show="directiveMediaBtnValue == 1">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./mp3type.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
<a-col :span="24" v-show="directiveMediaBtnValue == 2">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./mp4type.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
<a-col :span="24" v-show="directiveMediaBtnValue == 3">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./pictype.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
</a-row>
<a-row style="padding: 20px;">
<a-col :span="2">
<div class="description-container">
<a-button @click="toggleDescription">服务指令描述</a-button>
<div v-show="showDescription" class="description-box">
<div class="box-header">
<span class="title">服务指令描述</span>
<span class="collapse-icon" @click="toggleDescription">
<DownOutlined style="margin-right: 3px;" />收起
</span>
</div>
<div>
<a-textarea v-model:value="formData.serviceContent" placeholder="请输入服务指令描述" :maxlength="200"
:rows="3" :autosize="{ minRows: 3 }" :showCount="true" />
</div>
</div>
</div>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</div>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted, watch } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
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, 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';
import { env } from 'process';
import DirectiveRadioCom from './DirectiveRadioCom.vue'
import { QuestionCircleOutlined } from '@ant-design/icons-vue';
import { DownOutlined } from '@ant-design/icons-vue';
const showDescription = ref(false);
//
const toggleDescription = () => {
showDescription.value = !showDescription.value;
};
const fileList = ref([])
const onPriceKeydown = (e: KeyboardEvent) => {
const key = e.key;
//
if (['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab'].includes(key)) return;
//
if (!/[\d.]/.test(key)) {
e.preventDefault();
return;
}
const input = e.target as HTMLInputElement;
const { value, selectionStart: s, selectionEnd: t } = input;
const next = value.slice(0, s!) + key + value.slice(t!);
// 52
if (!/^\d{0,5}(?:\.\d{0,2})?$/.test(next)) {
e.preventDefault();
}
};
const onDurationKeydown = (e: KeyboardEvent) => {
const key = e.key;
//
if (['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab'].includes(key)) return;
//
if (!/[\d.]/.test(key)) {
e.preventDefault();
return;
}
const input = e.target as HTMLInputElement;
const { value, selectionStart: s, selectionEnd: t } = input;
const next = value.slice(0, s!) + key + value.slice(t!);
// 52
if (!/^\d{0,2}$/.test(next)) {
e.preventDefault();
}
};
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true },
mainOrgCode: '',
mediaApiAddress: '',//
opeType: 'look',
});
const checkMp3 = (file) => {
const isPDF = file.type === 'application/mp3' || file.name.endsWith('.mp3');
if (!isPDF) {
createMessage.error('只能上传 mp3 文件!');
return false; //
}
return true;
};
const checkMp4 = (file) => {
const isPDF = file.type === 'application/mp4' || file.name.endsWith('.mp4');
if (!isPDF) {
createMessage.error('只能上传 mp4 文件!');
return false; //
}
return true;
};
const bodyTagDictCode = ref(`nu_config_body_tag,tag_name,id,del_flag = 0 and iz_enabled = 0 order by sort asc`)
const emotionTagDictCode = ref(`nu_config_emotion_tag,tag_name,id,del_flag = 0 and iz_enabled = 0 order by sort asc`)
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
categoryId: '',
typeId: '',
instructionTagId: '',
directiveName: '',
tollPrice: 0,
comPrice: 0,
izReimbursement: '0',
izPreferential: '0',
chargingFrequency: '',
cycleType: '',
sort: 99,
serviceContent: '',
serviceDuration: '5',
status: '',
izEnabled: '0',
createBy: '',
createTime: '',
updateBy: '',
updateTime: '',
mp3File: '',
mp4File: '',
previewFile: '',
immediateFile: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 4 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 19 } });
const confirmLoading = ref<boolean>(false);
const isEditMedia = ref(false)
const instructionTagName = ref('')
const categoryName = ref('')
const typeName = ref('')
const cycleTypeName = ref('')
const orgMediaPathAddress = ref('')//访
//
const validatorRules = reactive({
categoryId: [{ required: true, message: '请选择服务类别!' },],
typeId: [{ required: true, message: '请选择服务类型!' },],
instructionTagId: [{ required: true, message: '请选择分类标签!' },],
directiveName: [{ required: true, message: '请输入服务指令名称!' },],
tollPrice: [{ required: true, message: '请输入收费价格!' }, { pattern: /^(([0-9]*)|([0]\.\d{0,4}|[1-9][0-9]*\.\d{0,4}))$/, message: '请输入正确的金额!' },],
comPrice: [{ required: false }, { pattern: /^(([0-9]*)|([0]\.\d{0,4}|[1-9][0-9]*\.\d{0,4}))$/, message: '请输入正确的金额!' },],
izReimbursement: [{ required: true, message: '请选择是否参与医保报销!' },],
izPreferential: [{ required: true, message: '请选择是否参与机构优惠!' },],
// chargingFrequency: [{ required: true, message: '!' },],
cycleType: [{ required: true, message: '请选择周期类型!' },],
// sort: [{ required: true, message: '!' }, { pattern: /^\d+$/, message: '!' },],
serviceDuration: [
{ required: true, message: '请输入服务时长(分钟)!' },
{ pattern: /^\d+$/, message: '请输入正整数!' },
{
validator: (_, value) => {
if (value % 5 !== 0) {
return Promise.reject('请输入5的倍数!');
}
return Promise.resolve();
},
},
{
validator: (_, value) => {
if (value < 5 || value > 55) {
return Promise.reject('请输入5到55之间的值!');
}
return Promise.resolve();
},
},
],
izEnabled: [{ required: true, message: '请选择是否启用!' },],
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
} else {
return true;
}
}
return props.formDisabled;
});
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_
}
//
const upBodyTagsComDictCode = ref([])
function upBodyTagsDictCode(v_) {
upBodyTagsComDictCode.value = v_
}
//
const upEmotionTagsComDictCode = ref([])
function upEmotionTagsDictCode(v_) {
upEmotionTagsComDictCode.value = v_
}
watch([instructionComDictCode, categoryComDictCode, typeComDictCode, cycleTypeComDictCode, upBodyTagsComDictCode, upEmotionTagsComDictCode], () => {
// formComputedData
}, { deep: true });
const bodyTagsObj = ref([])
const emotionTagsObj = ref([])
const formComputedData = computed(() => {
if (!canUploadPreviewImage.value) return {};
//
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 || '';
//
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}/${cycleTypeName}/${formData.directiveName}`,
instructionName,
categoryName,
typeName,
cycleTypeName,
bodyTagsObj: JSON.stringify(processTags(formData.bodyTags, upBodyTagsComDictCode.value)),
emotionTagsObj: JSON.stringify(processTags(formData.emotionTags, upEmotionTagsComDictCode.value))
};
});
watch(
() => formData.instructionTagId,
(newInstructionTagId) => {
if (needWatch.value) {
formData.categoryId = ''
formData.typeId = ''
formData.cycleType = ''
}
if (!newInstructionTagId) {
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 iz_enabled = 0 and instruction_id = '${newInstructionTagId}' order by sort asc`;
}
}
);
watch(
() => formData.categoryId,
(newCategoryId) => {
if (needWatch.value) {
formData.typeId = ''
formData.cycleType = ''
}
if (!newCategoryId) {
typeDictCode.value = 'nu_config_service_type,type_name,id,1=2';
} else {
typeDictCode.value = `nu_config_service_type,type_name,id,del_flag = 0 and iz_enabled = 0 and category_id = '${newCategoryId}' order by sort asc`;
}
}
);
watch(
() => formData.typeId,
(newTypeId) => {
if (needWatch.value) {
formData.cycleType = ''
}
}
);
/**
* 新增
*/
function add() {
edit({});
}
const needWatch = ref(false)
const showMedia = ref(true)
/**
* 编辑
* isEditMedia_是否为编辑指令资源 隐藏业务字段
*/
function edit(record, isEditMedia_ = false, showMedia_ = true, showExistTags = true) {
if (!!record.bodyTags && showExistTags) {
// "id = 'id1' or id = 'id2'"
const bodyTagConditions = record.bodyTags.split(',')
.map(id => `id = '${id}'`)
.join(' or ');
bodyTagDictCode.value = `nu_config_body_tag,tag_name,id,del_flag = 0 and iz_enabled = 0 ` +
(bodyTagConditions ? ` and (${bodyTagConditions})` : '') +
` order by sort asc`;
}
if (!!record.emotionTags && showExistTags) {
// "id = 'id1' or id = 'id2'"
const emotionTagConditions = record.emotionTags.split(',')
.map(id => `id = '${id}'`)
.join(' or ');
emotionTagDictCode.value = `nu_config_emotion_tag,tag_name,id,del_flag = 0 and iz_enabled = 0 ` +
(emotionTagConditions ? ` and (${emotionTagConditions})` : '') +
` order by sort asc`;
}
needWatch.value = false
showMedia.value = showMedia_
setTimeout(() => {
needWatch.value = true
}, 1000)
isEditMedia.value = isEditMedia_
formData.bodyTags = ''
formData.emotionTags = ''
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if (record.hasOwnProperty(key)) {
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
const computedData = formComputedData.value;
const model = {
...formData,
...computedData
};
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
//
if (model.comPrice != 0 && model.tollPrice < model.comPrice) {
createMessage.warning('提成价格不能高于收费价格!');
confirmLoading.value = false;
return
}
model.mediaFileSavePath = formComputedData.value.mediaFileSavePath
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
/**
* 同步媒体资源给指令所有者对应业务平台
*
*/
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;
});
}
const directiveMediaBtnValue = ref(0)
function mediaBtnChanged(v_) {
directiveMediaBtnValue.value = v_
}
onMounted(() => {
})
defineExpose({
add,
edit,
submitForm,
syncMediaForBizFunc,
syncMediaForAllBizFunc
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
:deep .ant-checkbox-wrapper {
margin-top: 5px;
margin-bottom: 10px;
width: 30%;
}
.upload-area {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.upload-icon {
margin-bottom: 16px;
}
.upload-text {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
margin-bottom: 8px;
}
.upload-hint {
font-size: 12px;
color: rgba(0, 0, 0, 0.45);
display: flex;
align-items: center;
gap: 8px;
}
.divider {
color: rgba(0, 0, 0, 0.2);
}
.description-container {
position: relative;
z-index: 1000;
}
.description-box {
position: absolute;
bottom: 100%;
left: 0;
background: #f6faff;
border-radius: 4px;
padding: 12px;
width: 43vw;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
margin-bottom: 8px;
}
.box-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 8px;
margin-bottom: 12px;
}
.title {
font-weight: bold;
font-size: 16px;
}
.collapse-icon {
color: #1890ff;
cursor: pointer;
}
.content {
background: #fff;
border-radius: 4px;
padding: 12px;
position: relative;
}
.instruction {
color: #8c8c8c;
margin-bottom: 30px;
}
.confirm-btn {
position: absolute;
right: 12px;
bottom: 12px;
background: #1890ff;
border-radius: 20px;
}
/* 渐隐渐现动画 */
.slide-fade-enter-active {
transition: opacity 0.3s ease-out;
}
.slide-fade-leave-active {
transition: opacity 0.3s cubic-bezier(0.5, 0, 0.8, 1);
}
/* 进入时从透明开始 */
.slide-fade-enter-from {
opacity: 0;
}
/* 离开时渐变到透明 */
.slide-fade-leave-to {
opacity: 0;
}
/* 确保容器初始状态无变形 */
.slide-fade-enter-to,
.slide-fade-leave-from {
opacity: 1;
}
</style>

View File

@ -0,0 +1,888 @@
<template>
<a-spin :spinning="confirmLoading">
<div style="background-color: #fff;border-radius: 10px;box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" :colon="false"
name="ConfigService2DirectiveForm" style="padding: 20px 0px;">
<a-row v-show="!isEditMedia">
<a-col :span="12" v-show="false">
<a-form-item label="分类标签" v-bind="validateInfos.instructionTagId"
id="ConfigServiceDirectiveForm-instructionTagId" name="instructionTagId">
<j-dict-select-tag v-model:value="formData.instructionTagId" :orgCode="mainOrgCode"
:dictCode="`nu_config_service_instruction_tag,instruction_name,id,del_flag = 0 and iz_enabled = 0 order by sort asc`"
placeholder="请选择分类标签" allowClear @upDictCode="upInstructionDictCode" :disabled="!!formData.id" />
</a-form-item>
</a-col>
<a-col :span="12" v-show="false">
<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.id"
:orgCode="mainOrgCode" :dictCode="categoryDictCode" placeholder="请选择服务类别" allow-clear
@upDictCode="upCategoryDictCode" />
</a-form-item>
</a-col>
<a-col :span="12" v-show="false">
<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"
:orgCode="mainOrgCode" :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 :maxlength="20"
:showCount="true" :disabled="!!formData.id"></a-input>
</a-form-item>
</a-col>
<!-- <a-col :span="12">
<a-form-item label="机构优惠" v-bind="validateInfos.izPreferential"
id="ConfigServiceDirectiveForm-izPreferential" name="izPreferential">
<j-dict-select-tag type='radio' v-model:value="formData.izPreferential"
dictCode="institutional_discount" allowClear />
</a-form-item>
</a-col> -->
<a-col :span="12">
<a-form-item label="收费价格(元)" v-bind="validateInfos.tollPrice" id="ConfigServiceDirectiveForm-tollPrice"
name="tollPrice">
<a-input-number v-model:value="formData.tollPrice" placeholder="请输入收费价格" style="width: 100%" :min="0"
:max="99999.99" :precision="2" @keydown="onPriceKeydown" />
</a-form-item>
</a-col>
<a-col :span="12">
<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" />
</a-form-item>
</a-col>
<!-- <a-col :span="12">
<a-form-item label="医保报销" v-bind="validateInfos.izReimbursement"
id="ConfigServiceDirectiveForm-izReimbursement" name="izReimbursement">
<j-dict-select-tag type='radio' v-model:value="formData.izReimbursement" dictCode="med_ins_reimb"
allowClear />
</a-form-item>
</a-col> -->
<a-col :span="12">
<a-form-item label="提成价格(元)" v-bind="validateInfos.comPrice" id="ConfigServiceDirectiveForm-comPrice"
name="comPrice">
<a-input-number v-model:value="formData.comPrice" placeholder="请输入提成价格" style="width: 100%" :min="0"
:max="99999.99" :precision="2" @keydown="onPriceKeydown" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ConfigServiceDirectiveForm-izEnabled"
name="izEnabled">
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled"
placeholder="请选择是否启用"  allowClear />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="服务时长" v-bind="validateInfos.serviceDuration"
id="ConfigServiceDirectiveForm-serviceDuration" name="serviceDuration">
<a-input-number v-model:value="formData.serviceDuration" :min="5" :max="55" :step="5" addon-after="分钟"
placeholder="请输入服务时长(分钟)" allow-clear @keydown="onDurationKeydown" />
</a-form-item>
</a-col>
</a-row>
<!-- <a-row v-show="!isEditMedia"
style="background-color: #f6faff ; border-top: 1px solid #F0F0F0;border-bottom: 1px solid #F0F0F0;">
<a-col :span="12" style="border-right: 1px solid #F0F0F0;padding-top: 20px;">
<a-form-item label="体型标签" id="ConfigServiceDirectiveForm-typeId" name="typeId">
<span v-if="disabled && !formData.bodyTags">-</span>
<JCheckbox v-else v-model:value="formData.bodyTags" :orgCode="mainOrgCode" :dictCode="bodyTagDictCode"
@upDictCode="upBodyTagsDictCode" />
</a-form-item>
</a-col>
<a-col :span="12" style="padding-top: 20px;">
<a-form-item label="情绪标签" name="emoTags">
<span v-if="disabled && !formData.emotionTags">-</span>
<JCheckbox v-else v-model:value="formData.emotionTags" :orgCode="mainOrgCode"
:dictCode="emotionTagDictCode" @upDictCode="upEmotionTagsDictCode" />
</a-form-item>
</a-col>
</a-row> -->
<!-- <a-row style="padding: 20px;">
<a-col :span="6">
<DirectiveRadioCom :directiveMediaBtnValue="directiveMediaBtnValue" @change="mediaBtnChanged">
</DirectiveRadioCom>
</a-col>
</a-row>
<a-row style="padding: 0px 20px;">
<a-col :span="24" v-show="directiveMediaBtnValue == 0">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./pictype.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
<a-col :span="24" v-show="directiveMediaBtnValue == 1">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./mp3type.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
<a-col :span="24" v-show="directiveMediaBtnValue == 2">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./mp4type.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
<a-col :span="24" v-show="directiveMediaBtnValue == 3">
<a-upload-dragger name="file" v-model:fileList="fileList" :multiple="false" :show-upload-list="false"
:before-upload="beforeUpload" style="background-color: #F6FAFF;">
<div class="upload-area">
<p class="upload-text">点击或者拖拽上传</p>
<div class="upload-icon">
<img src="./pictype.png" alt="MP3 icon" style="width: 40px; height: 40px;" />
</div>
<p class="upload-hint">
<span>文件大小不超过10MB</span>
<span class="divider">|</span>
<a-tooltip placement="top">
<template #title>
这里是格式说明的具体内容
</template>
<span>
<QuestionCircleOutlined style="margin-right: 0px;" />
格式说明
</span>
</a-tooltip>
</p>
</div>
</a-upload-dragger>
</a-col>
</a-row>
<a-row style="padding: 20px;">
<a-col :span="2">
<div class="description-container">
<a-button @click="toggleDescription">服务指令描述</a-button>
<div v-show="showDescription" class="description-box">
<div class="box-header">
<span class="title">服务指令描述</span>
<span class="collapse-icon" @click="toggleDescription">
<DownOutlined style="margin-right: 3px;" />收起
</span>
</div>
<div>
<a-textarea v-model:value="formData.serviceContent" placeholder="请输入服务指令描述" :maxlength="200" :rows="3"
:autosize="{ minRows: 3 }" :showCount="true" />
</div>
</div>
</div>
</a-col>
</a-row> -->
<a-row style="margin-top: 20px;">
<a-col :span="12" v-show="showMedia">
<a-form-item label="服务指令图片" v-bind="validateInfos.previewFile">
<span v-if="disabled && !formData.previewFile">暂无文件</span>
<JImageUpload v-else-if="opeType == 'dmlook'" :fileMax="1"
:value="mediaApiAddress + formData.previewFile">
</JImageUpload>
<JImageUpload v-else :fileMax="1" v-model:value="formData.previewFile"></JImageUpload>
</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" :autosize="true" placeholder="请输入服务指令描述"
:maxlength="200" :showCount="true" />
</a-form-item>
</a-col>
</a-row>
<a-row v-show="!disabled && showMedia">
<a-col :span="12">
<a-form-item label="指令音频文件" v-bind="validateInfos.mp3File" id="ConfigServiceDirectiveForm-mp3File">
<j-upload v-model:value="formData.mp3File" accept=".mp3" :maxCount="1"
:beforeUpload="checkMp3"></j-upload>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="指令视频文件" v-bind="validateInfos.mp4File" id="ConfigServiceDirectiveForm-mp4File">
<j-upload v-model:value="formData.mp4File" accept=".mp4" :maxCount="1"
:beforeUpload="checkMp4"></j-upload>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
<JFormContainer style="margin-top: -40px;" v-show="showMedia">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" :colon="false"
name="ConfigServiceDirectiveForm">
<a-row>
<a-col :span="12" v-if="!!formData.mp3File">
<a-form-item label="指令音频预览" id="ConfigServiceDirectiveForm-mp3File">
<audio controls disabled="false">
<source
:src="opeType == 'dmlook' ? mediaApiAddress + formData.mp3File : getFileAccessHttpUrl(formData.mp3File)">
</audio>
</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" v-if="!!formData.mp4File" :push="!!formData.mp3File ? 0 : 12">
<a-form-item label="指令视频预览" id="ConfigServiceDirectiveForm-mp4File">
<video controls>
<source
:src="opeType == 'dmlook' ? mediaApiAddress + formData.mp4File : 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-row>
<a-row>
<a-col :span="12">
<a-form-item label="即时指令图标" v-bind="validateInfos.immediateFile">
<span v-if="disabled && !formData.immediateFile">暂无文件</span>
<JImageUpload v-else-if="opeType == 'dmlook'" :fileMax="1"
:value="mediaApiAddress + formData.immediateFile">
</JImageUpload>
<JImageUpload v-else :fileMax="1" v-model:value="formData.immediateFile"></JImageUpload>
</a-form-item>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</div>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted, watch } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
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, 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';
import { env } from 'process';
import DirectiveRadioCom from './DirectiveRadioCom.vue'
import { QuestionCircleOutlined } from '@ant-design/icons-vue';
import { DownOutlined } from '@ant-design/icons-vue';
const showDescription = ref(false);
//
const toggleDescription = () => {
showDescription.value = !showDescription.value;
};
const fileList = ref([])
const onPriceKeydown = (e: KeyboardEvent) => {
const key = e.key;
//
if (['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab'].includes(key)) return;
//
if (!/[\d.]/.test(key)) {
e.preventDefault();
return;
}
const input = e.target as HTMLInputElement;
const { value, selectionStart: s, selectionEnd: t } = input;
const next = value.slice(0, s!) + key + value.slice(t!);
// 52
if (!/^\d{0,5}(?:\.\d{0,2})?$/.test(next)) {
e.preventDefault();
}
};
const onDurationKeydown = (e: KeyboardEvent) => {
const key = e.key;
//
if (['Backspace', 'Delete', 'ArrowLeft', 'ArrowRight', 'Tab'].includes(key)) return;
//
if (!/[\d.]/.test(key)) {
e.preventDefault();
return;
}
const input = e.target as HTMLInputElement;
const { value, selectionStart: s, selectionEnd: t } = input;
const next = value.slice(0, s!) + key + value.slice(t!);
// 52
if (!/^\d{0,2}$/.test(next)) {
e.preventDefault();
}
};
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true },
mainOrgCode: '',
mediaApiAddress: '',//
opeType: 'look',
});
const checkMp3 = (file) => {
const isPDF = file.type === 'application/mp3' || file.name.endsWith('.mp3');
if (!isPDF) {
createMessage.error('只能上传 mp3 文件!');
return false; //
}
return true;
};
const checkMp4 = (file) => {
const isPDF = file.type === 'application/mp4' || file.name.endsWith('.mp4');
if (!isPDF) {
createMessage.error('只能上传 mp4 文件!');
return false; //
}
return true;
};
const bodyTagDictCode = ref(`nu_config_body_tag,tag_name,id,del_flag = 0 and iz_enabled = 0 order by sort asc`)
const emotionTagDictCode = ref(`nu_config_emotion_tag,tag_name,id,del_flag = 0 and iz_enabled = 0 order by sort asc`)
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
categoryId: '',
typeId: '',
instructionTagId: '',
directiveName: '',
tollPrice: 0,
comPrice: 0,
izReimbursement: '0',
izPreferential: '0',
chargingFrequency: '',
cycleType: '',
sort: 99,
serviceContent: '',
serviceDuration: '5',
status: '',
izEnabled: '0',
createBy: '',
createTime: '',
updateBy: '',
updateTime: '',
mp3File: '',
mp4File: '',
previewFile: '',
immediateFile: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 19 } });
const confirmLoading = ref<boolean>(false);
const isEditMedia = ref(false)
const instructionTagName = ref('')
const categoryName = ref('')
const typeName = ref('')
const cycleTypeName = ref('')
const orgMediaPathAddress = ref('')//访
//
const validatorRules = reactive({
categoryId: [{ required: true, message: '请选择服务类别!' },],
typeId: [{ required: true, message: '请选择服务类型!' },],
instructionTagId: [{ required: true, message: '请选择分类标签!' },],
directiveName: [{ required: true, message: '请输入服务指令名称!' },],
tollPrice: [{ required: true, message: '请输入收费价格!' }, { pattern: /^(([0-9]*)|([0]\.\d{0,4}|[1-9][0-9]*\.\d{0,4}))$/, message: '请输入正确的金额!' },],
comPrice: [{ required: false }, { pattern: /^(([0-9]*)|([0]\.\d{0,4}|[1-9][0-9]*\.\d{0,4}))$/, message: '请输入正确的金额!' },],
izReimbursement: [{ required: true, message: '请选择是否参与医保报销!' },],
izPreferential: [{ required: true, message: '请选择是否参与机构优惠!' },],
// chargingFrequency: [{ required: true, message: '!' },],
cycleType: [{ required: true, message: '请选择周期类型!' },],
// sort: [{ required: true, message: '!' }, { pattern: /^\d+$/, message: '!' },],
serviceDuration: [
{ required: true, message: '请输入服务时长(分钟)!' },
{ pattern: /^\d+$/, message: '请输入正整数!' },
{
validator: (_, value) => {
if (value % 5 !== 0) {
return Promise.reject('请输入5的倍数!');
}
return Promise.resolve();
},
},
{
validator: (_, value) => {
if (value < 5 || value > 55) {
return Promise.reject('请输入5到55之间的值!');
}
return Promise.resolve();
},
},
],
izEnabled: [{ required: true, message: '请选择是否启用!' },],
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
//
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
} else {
return true;
}
}
return props.formDisabled;
});
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_
}
//
const upBodyTagsComDictCode = ref([])
function upBodyTagsDictCode(v_) {
upBodyTagsComDictCode.value = v_
}
//
const upEmotionTagsComDictCode = ref([])
function upEmotionTagsDictCode(v_) {
upEmotionTagsComDictCode.value = v_
}
watch([instructionComDictCode, categoryComDictCode, typeComDictCode, cycleTypeComDictCode, upBodyTagsComDictCode, upEmotionTagsComDictCode], () => {
// formComputedData
}, { deep: true });
const bodyTagsObj = ref([])
const emotionTagsObj = ref([])
const formComputedData = computed(() => {
if (!canUploadPreviewImage.value) return {};
//
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 || '';
//
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}/${cycleTypeName}/${formData.directiveName}`,
instructionName,
categoryName,
typeName,
cycleTypeName,
bodyTagsObj: JSON.stringify(processTags(formData.bodyTags, upBodyTagsComDictCode.value)),
emotionTagsObj: JSON.stringify(processTags(formData.emotionTags, upEmotionTagsComDictCode.value))
};
});
watch(
() => formData.instructionTagId,
(newInstructionTagId) => {
if (needWatch.value) {
formData.categoryId = ''
formData.typeId = ''
formData.cycleType = ''
}
if (!newInstructionTagId) {
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 iz_enabled = 0 and instruction_id = '${newInstructionTagId}' order by sort asc`;
}
}
);
watch(
() => formData.categoryId,
(newCategoryId) => {
if (needWatch.value) {
formData.typeId = ''
formData.cycleType = ''
}
if (!newCategoryId) {
typeDictCode.value = 'nu_config_service_type,type_name,id,1=2';
} else {
typeDictCode.value = `nu_config_service_type,type_name,id,del_flag = 0 and iz_enabled = 0 and category_id = '${newCategoryId}' order by sort asc`;
}
}
);
watch(
() => formData.typeId,
(newTypeId) => {
if (needWatch.value) {
formData.cycleType = ''
}
}
);
/**
* 新增
*/
function add() {
edit({});
}
const needWatch = ref(false)
const showMedia = ref(true)
/**
* 编辑
* isEditMedia_是否为编辑指令资源 隐藏业务字段
*/
function edit(record, isEditMedia_ = false, showMedia_ = true, showExistTags = true) {
if (!!record.bodyTags && showExistTags) {
// "id = 'id1' or id = 'id2'"
const bodyTagConditions = record.bodyTags.split(',')
.map(id => `id = '${id}'`)
.join(' or ');
bodyTagDictCode.value = `nu_config_body_tag,tag_name,id,del_flag = 0 and iz_enabled = 0 ` +
(bodyTagConditions ? ` and (${bodyTagConditions})` : '') +
` order by sort asc`;
}
if (!!record.emotionTags && showExistTags) {
// "id = 'id1' or id = 'id2'"
const emotionTagConditions = record.emotionTags.split(',')
.map(id => `id = '${id}'`)
.join(' or ');
emotionTagDictCode.value = `nu_config_emotion_tag,tag_name,id,del_flag = 0 and iz_enabled = 0 ` +
(emotionTagConditions ? ` and (${emotionTagConditions})` : '') +
` order by sort asc`;
}
needWatch.value = false
showMedia.value = showMedia_
setTimeout(() => {
needWatch.value = true
}, 1000)
isEditMedia.value = isEditMedia_
formData.bodyTags = ''
formData.emotionTags = ''
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if (record.hasOwnProperty(key)) {
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
//
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
const computedData = formComputedData.value;
const model = {
...formData,
...computedData
};
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
//
if (model.comPrice != 0 && model.tollPrice < model.comPrice) {
createMessage.warning('提成价格不能高于收费价格!');
confirmLoading.value = false;
return
}
model.mediaFileSavePath = formComputedData.value.mediaFileSavePath
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
/**
* 同步媒体资源给指令所有者对应业务平台
*
*/
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;
});
}
const directiveMediaBtnValue = ref(0)
function mediaBtnChanged(v_) {
directiveMediaBtnValue.value = v_
}
onMounted(() => {
})
defineExpose({
add,
edit,
submitForm,
syncMediaForBizFunc,
syncMediaForAllBizFunc
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
:deep .ant-checkbox-wrapper {
margin-top: 5px;
margin-bottom: 10px;
width: 30%;
}
.upload-area {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.upload-icon {
margin-bottom: 16px;
}
.upload-text {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
margin-bottom: 8px;
}
.upload-hint {
font-size: 12px;
color: rgba(0, 0, 0, 0.45);
display: flex;
align-items: center;
gap: 8px;
}
.divider {
color: rgba(0, 0, 0, 0.2);
}
.description-container {
position: relative;
z-index: 1000;
}
.description-box {
position: absolute;
bottom: 100%;
left: 0;
background: #f6faff;
border-radius: 4px;
padding: 12px;
width: 43vw;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
margin-bottom: 8px;
}
.box-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 8px;
margin-bottom: 12px;
}
.title {
font-weight: bold;
font-size: 16px;
}
.collapse-icon {
color: #1890ff;
cursor: pointer;
}
.content {
background: #fff;
border-radius: 4px;
padding: 12px;
position: relative;
}
.instruction {
color: #8c8c8c;
margin-bottom: 30px;
}
.confirm-btn {
position: absolute;
right: 12px;
bottom: 12px;
background: #1890ff;
border-radius: 20px;
}
/* 渐隐渐现动画 */
.slide-fade-enter-active {
transition: opacity 0.3s ease-out;
}
.slide-fade-leave-active {
transition: opacity 0.3s cubic-bezier(0.5, 0, 0.8, 1);
}
/* 进入时从透明开始 */
.slide-fade-enter-from {
opacity: 0;
}
/* 离开时渐变到透明 */
.slide-fade-leave-to {
opacity: 0;
}
/* 确保容器初始状态无变形 */
.slide-fade-enter-to,
.slide-fade-leave-from {
opacity: 1;
}
</style>

View File

@ -40,7 +40,7 @@
</template>
<DirectiveRespositoryList ref="dmRef" :mainOrgCode="mainOrgCode"></DirectiveRespositoryList>
</j-modal> -->
<a-drawer :title="'指令库'" width="80vw" v-model:visible="dmVisible" :closable="true"
<a-drawer :title="'标准指令库'" width="80vw" v-model:visible="dmVisible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancelDM" :maskClosable="true">
<a-spin :spinning="loading">
<DirectiveRespositoryList ref="dmRef" :mainOrgCode="mainOrgCode"></DirectiveRespositoryList>

View File

@ -1,11 +1,11 @@
<template>
<div class="p-2">
<div>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol" style="padding-top: 20px;">
<a-row :gutter="24">
<a-col :lg="6">
<a-col :lg="5">
<a-form-item name="instructionTagId">
<template #label><span title="分类标签">分类标签</span></template>
<j-dict-select-tag v-model:value="queryParam.instructionTagId" :orgCode="mainOrgCode"
@ -14,7 +14,7 @@
</a-form-item>
</a-col>
<a-col :lg="6">
<a-col :lg="5">
<a-form-item name="categoryId">
<template #label><span title="服务类别">服务类别</span></template>
<j-dict-select-tag type="list" v-model:value="queryParam.categoryId" :orgCode="mainOrgCode"
@ -23,7 +23,7 @@
</a-form-item>
</a-col>
<a-col :lg="6">
<a-col :lg="5">
<a-form-item name="typeId">
<template #label><span title="服务类型">服务类型</span></template>
<j-dict-select-tag type="list" v-model:value="queryParam.typeId" :orgCode="mainOrgCode"
@ -31,13 +31,13 @@
placeholder="请选择服务类型" allowClear :ignoreDisabled="true" />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-col :lg="5">
<a-form-item name="directiveName">
<template #label><span title="服务指令">服务指令</span></template>
<JInput v-model:value="queryParam.directiveName" placeholder="请输入服务指令名称" allowClear />
</a-form-item>
</a-col>
<a-col :lg="6">
<!-- <a-col :lg="6">
<a-form-item name="bodyTags">
<template #label><span title="体型标签">体型标签</span></template>
<j-dict-select-tag type='list' v-model:value="queryParam.bodyTags" :orgCode="mainOrgCode"
@ -52,7 +52,7 @@
:dictCode="`nu_config_emotion_tag,tag_name,id,del_flag = '0' and iz_enabled = 0 order by sort asc`"
:ignoreDisabled="true" placeholder="请选择情绪标签" allowClear />
</a-form-item>
</a-col>
</a-col> -->
<!-- <a-col :lg="6">
<a-form-item name="izEnabled">
<template #label><span title="是否启用">是否启用</span></template>
@ -60,7 +60,7 @@
:ignoreDisabled="true" placeholder="请选择是否启用" allowClear />
</a-form-item>
</a-col> -->
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-col :span="2">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
@ -177,12 +177,14 @@ const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDat
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 6,
xxl: 5
xl: 7,
xxl: 6
});
const wrapperCol = reactive({
xs: 24,
sm: 19,
xl: 17,
xxl: 18
});
/**