|
@@ -16,7 +16,7 @@ import type { UploadFile } from 'ant-design-vue/es/upload/interface';
|
|
|
import type { FormInstance } from 'ant-design-vue';
|
|
import type { FormInstance } from 'ant-design-vue';
|
|
|
import Derivation from '@/service/Derivation.vue';
|
|
import Derivation from '@/service/Derivation.vue';
|
|
|
type SystemModel = Partial<SystemItemModel>;
|
|
type SystemModel = Partial<SystemItemModel>;
|
|
|
-const props = defineProps<{ data: SystemModel }>();
|
|
|
|
|
|
|
+const props = defineProps<{ data: SystemModel; institutionId: string | number }>();
|
|
|
const formRef = ref<FormInstance>();
|
|
const formRef = ref<FormInstance>();
|
|
|
const typeOptionsLoading = ref<boolean>(false);
|
|
const typeOptionsLoading = ref<boolean>(false);
|
|
|
const typeOptions = ref<{ label: string; value: string }[]>([]);
|
|
const typeOptions = ref<{ label: string; value: string }[]>([]);
|
|
@@ -32,13 +32,6 @@ const unitOptions = [
|
|
|
{ label: '次', value: '次' },
|
|
{ label: '次', value: '次' },
|
|
|
];
|
|
];
|
|
|
const herbList = ref<any[]>([]);
|
|
const herbList = ref<any[]>([]);
|
|
|
-// function getHerb(value: string) {
|
|
|
|
|
-// console.log(value, 'value==>');
|
|
|
|
|
-// cpMedicinesMethod(1, 10, { keyword: value }).then((res) => {
|
|
|
|
|
-// herbList.value = res.data;
|
|
|
|
|
-// console.log(herbList.value, 'herbList==>');
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
|
|
|
|
|
// 获取所有的机构
|
|
// 获取所有的机构
|
|
|
const branch = ref<any[]>([]);
|
|
const branch = ref<any[]>([]);
|
|
@@ -63,8 +56,8 @@ const form = reactive<SystemItemModel>({
|
|
|
conditioningProgramSupplierId: '',
|
|
conditioningProgramSupplierId: '',
|
|
|
institutionId: '',
|
|
institutionId: '',
|
|
|
cpDynamicPricingRule: [
|
|
cpDynamicPricingRule: [
|
|
|
- { min: 0, max: 0, priceType: 0, price: 0 },
|
|
|
|
|
- { min: 0, max: 0, priceType: 0, price: 0 },
|
|
|
|
|
|
|
+ { min: '', max: '', priceType: '', price: '' },
|
|
|
|
|
+ { min: '', max: '', priceType: '', price: '' },
|
|
|
],
|
|
],
|
|
|
pricingType: '0',
|
|
pricingType: '0',
|
|
|
cpFixedPricingRule: {
|
|
cpFixedPricingRule: {
|
|
@@ -114,6 +107,9 @@ const isShowOnline = ref<boolean>(false);
|
|
|
const isShowDelivery = ref<boolean>(false);
|
|
const isShowDelivery = ref<boolean>(false);
|
|
|
const supplierArr = ref<any[]>([]);
|
|
const supplierArr = ref<any[]>([]);
|
|
|
|
|
|
|
|
|
|
+// 弹层容器:避免模板中直接引用 document 导致类型检查报错
|
|
|
|
|
+const getBodyContainer = () => document.body as HTMLElement;
|
|
|
|
|
+
|
|
|
// 获取所有的供应商
|
|
// 获取所有的供应商
|
|
|
async function getSupplier(params: any) {
|
|
async function getSupplier(params: any) {
|
|
|
supplierOptions.value = [];
|
|
supplierOptions.value = [];
|
|
@@ -138,7 +134,7 @@ function getisOffline(e: any, newOffline: any, newDelivery: any, newType: any) {
|
|
|
} else {
|
|
} else {
|
|
|
if (items.offlineCPTypes?.includes(newType[0])) {
|
|
if (items.offlineCPTypes?.includes(newType[0])) {
|
|
|
form.isOffline = 'Y';
|
|
form.isOffline = 'Y';
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return false;
|
|
return false;
|
|
|
} else if (items.onlineCPTypes?.includes(newType[0])) {
|
|
} else if (items.onlineCPTypes?.includes(newType[0])) {
|
|
|
form.isOffline = 'N';
|
|
form.isOffline = 'N';
|
|
@@ -202,7 +198,6 @@ function getisOffline(e: any, newOffline: any, newDelivery: any, newType: any) {
|
|
|
watch(
|
|
watch(
|
|
|
[() => form.conditioningProgramType, () => form.institutionId, () => form.conditioningProgramSupplierId, () => form.isOffline, () => form.isDelivery],
|
|
[() => form.conditioningProgramType, () => form.institutionId, () => form.conditioningProgramSupplierId, () => form.isOffline, () => form.isDelivery],
|
|
|
([newType, newInstitutionId, newSupplierId, newOffline, newDelivery]) => {
|
|
([newType, newInstitutionId, newSupplierId, newOffline, newDelivery]) => {
|
|
|
-
|
|
|
|
|
getSupplier({
|
|
getSupplier({
|
|
|
conditioningProgramTypes: newType ? [newType] : form.conditioningProgramType ? [form.conditioningProgramType] : [],
|
|
conditioningProgramTypes: newType ? [newType] : form.conditioningProgramType ? [form.conditioningProgramType] : [],
|
|
|
collaborateDeptId: newInstitutionId ? newInstitutionId : form.institutionId ? form.institutionId : '',
|
|
collaborateDeptId: newInstitutionId ? newInstitutionId : form.institutionId ? form.institutionId : '',
|
|
@@ -360,10 +355,8 @@ async function getConditioningProgramType() {
|
|
|
|
|
|
|
|
// 处理下拉框点击事件
|
|
// 处理下拉框点击事件
|
|
|
function handleSelectClick() {
|
|
function handleSelectClick() {
|
|
|
- console.log('下拉框被点击');
|
|
|
|
|
// 如果选项为空且不在加载中,尝试重新获取数据
|
|
// 如果选项为空且不在加载中,尝试重新获取数据
|
|
|
if (typeOptions.value.length === 0 && !typeOptionsLoading.value) {
|
|
if (typeOptions.value.length === 0 && !typeOptionsLoading.value) {
|
|
|
- console.log('下拉框被点击,但选项为空,尝试重新获取数据');
|
|
|
|
|
getConditioningProgramType();
|
|
getConditioningProgramType();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -440,7 +433,9 @@ onMounted(async () => {
|
|
|
}
|
|
}
|
|
|
if (props.data.isType === 'itemsList' && props.data.sourceId) {
|
|
if (props.data.isType === 'itemsList' && props.data.sourceId) {
|
|
|
form.sourceId = form.id;
|
|
form.sourceId = form.id;
|
|
|
- form.institutionId = '';
|
|
|
|
|
|
|
+ // form.institutionId = '';
|
|
|
|
|
+ form.institutionId = props.data.institutionId;
|
|
|
|
|
+ form.institutionName = props.data.institutionName;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 获取方案类型
|
|
// 获取方案类型
|
|
@@ -466,6 +461,19 @@ const uploadProps = reactive({ showRemoveIcon: true });
|
|
|
const fileList = ref<UploadFile[]>([]);
|
|
const fileList = ref<UploadFile[]>([]);
|
|
|
// 操作图片
|
|
// 操作图片
|
|
|
const optionsList = ref<UploadFile[]>([]);
|
|
const optionsList = ref<UploadFile[]>([]);
|
|
|
|
|
+// 安全挂载弹层,避免 document 不可用或被父层遮挡
|
|
|
|
|
+function getSafePopupContainer(triggerNode?: HTMLElement) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // @ts-ignore
|
|
|
|
|
+ if (typeof document !== 'undefined' && document?.body) return document.body;
|
|
|
|
|
+ } catch (e) {}
|
|
|
|
|
+ return (triggerNode?.parentNode as HTMLElement) || undefined;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 统一用 change 处理(避免 @select 改值导致面板被打断)
|
|
|
|
|
+function onInstitutionChange(val: string | number | undefined) {
|
|
|
|
|
+ form.institutionId = val as any;
|
|
|
|
|
+}
|
|
|
// 预览图片
|
|
// 预览图片
|
|
|
const handlePreview = async (file: UploadFile) => {
|
|
const handlePreview = async (file: UploadFile) => {
|
|
|
previewImg.value = file.response?.url ?? file.thumbUrl;
|
|
previewImg.value = file.response?.url ?? file.thumbUrl;
|
|
@@ -492,6 +500,12 @@ const uploading = ref(false);
|
|
|
const progress = ref(0);
|
|
const progress = ref(0);
|
|
|
const videoFileList = ref<UploadFile[]>([]);
|
|
const videoFileList = ref<UploadFile[]>([]);
|
|
|
|
|
|
|
|
|
|
+// 供应商校验规则:仅在“项目应用 勾选 服务包”且“新增项目(itemsList)”时必填
|
|
|
|
|
+const supplierRules = computed(() => {
|
|
|
|
|
+ const need = checkedList.value.includes('1') && form.addType === 'itemsList';
|
|
|
|
|
+ return need ? [{ required: true, message: '请选择供应商', trigger: ['change', 'blur'] }] : [];
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
// 上传前校验
|
|
// 上传前校验
|
|
|
function beforeVideoUpload(file: File) {
|
|
function beforeVideoUpload(file: File) {
|
|
|
const isValidType = accept.split(',').includes(file.type);
|
|
const isValidType = accept.split(',').includes(file.type);
|
|
@@ -631,9 +645,9 @@ watch(
|
|
|
(val) => {
|
|
(val) => {
|
|
|
if (val === '0' && !form.cpFixedPricingRule) {
|
|
if (val === '0' && !form.cpFixedPricingRule) {
|
|
|
form.cpFixedPricingRule = {
|
|
form.cpFixedPricingRule = {
|
|
|
- unitPrice: 0,
|
|
|
|
|
|
|
+ unitPrice: '',
|
|
|
pricingUnit: '',
|
|
pricingUnit: '',
|
|
|
- convertDose: 0,
|
|
|
|
|
|
|
+ convertDose: '',
|
|
|
convertUnit: '',
|
|
convertUnit: '',
|
|
|
};
|
|
};
|
|
|
} else {
|
|
} else {
|
|
@@ -642,7 +656,6 @@ watch(
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
function bindchange(e: any) {
|
|
function bindchange(e: any) {
|
|
|
- console.log(e, 'e==>');
|
|
|
|
|
form.conditioningProgramSupplierId = '';
|
|
form.conditioningProgramSupplierId = '';
|
|
|
form.isOffline = null;
|
|
form.isOffline = null;
|
|
|
}
|
|
}
|
|
@@ -727,18 +740,8 @@ function handleDerivation() {
|
|
|
<a-form-item label="项目名称:" name="name" required>
|
|
<a-form-item label="项目名称:" name="name" required>
|
|
|
<a-input v-model:value="form.name" placeholder="请输入" />
|
|
<a-input v-model:value="form.name" placeholder="请输入" />
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
- <a-form-item label="方案类型:" name="conditioningProgramType" required>
|
|
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="form.conditioningProgramType"
|
|
|
|
|
- :options="typeOptions"
|
|
|
|
|
- placeholder="请选择"
|
|
|
|
|
- allowClear
|
|
|
|
|
- showSearch
|
|
|
|
|
- :filter-option="filterOption"
|
|
|
|
|
- :loading="typeOptionsLoading"
|
|
|
|
|
- @change="bindchange"
|
|
|
|
|
- @click="handleSelectClick"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <a-form-item label="方案类型:" name="conditioningProgramType" required style="width: 100%">
|
|
|
|
|
+ <vxe-select v-model="form.conditioningProgramType" :options="typeOptions" placeholder="请选择" clearable filterable transfer @change="bindchange" style="width: 100%" />
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
<a-form-item label="项目应用:" required v-if="form.addType === 'itemsList'">
|
|
<a-form-item label="项目应用:" required v-if="form.addType === 'itemsList'">
|
|
|
<a-checkbox-group v-model:value="checkedList">
|
|
<a-checkbox-group v-model:value="checkedList">
|
|
@@ -763,7 +766,14 @@ function handleDerivation() {
|
|
|
|
|
|
|
|
<span style="margin-left: 32px">相当于</span>
|
|
<span style="margin-left: 32px">相当于</span>
|
|
|
<a-input v-model:value="form.cpFixedPricingRule.convertDose" placeholder="请输入" style="width: 100px; margin-left: 8px" />
|
|
<a-input v-model:value="form.cpFixedPricingRule.convertDose" placeholder="请输入" style="width: 100px; margin-left: 8px" />
|
|
|
- <a-select v-model:value="form.cpFixedPricingRule.convertUnit" style="width: 100px; margin-left: 8px" :options="unitOptions" placeholder="请选择" />
|
|
|
|
|
|
|
+ <vxe-select
|
|
|
|
|
+ v-model="form.cpFixedPricingRule.convertUnit"
|
|
|
|
|
+ :options="unitOptions"
|
|
|
|
|
+ placeholder="请选择"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ transfer
|
|
|
|
|
+ style="width: 100px; margin-left: 8px"
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
<span style="color: #aaa; margin-left: 8px">(使用单位)</span>
|
|
<span style="color: #aaa; margin-left: 8px">(使用单位)</span>
|
|
|
</div>
|
|
</div>
|
|
@@ -779,14 +789,16 @@ function handleDerivation() {
|
|
|
@change="() => (form.cpDynamicPricingRule[1].max = form.cpDynamicPricingRule[0].min)"
|
|
@change="() => (form.cpDynamicPricingRule[1].max = form.cpDynamicPricingRule[0].min)"
|
|
|
/>个时,</span
|
|
/>个时,</span
|
|
|
>
|
|
>
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="form.cpDynamicPricingRule[0].priceType"
|
|
|
|
|
|
|
+ <vxe-select
|
|
|
|
|
+ v-model="form.cpDynamicPricingRule[0].priceType"
|
|
|
:options="[
|
|
:options="[
|
|
|
{ label: '单价', value: 0, priceType: 0 },
|
|
{ label: '单价', value: 0, priceType: 0 },
|
|
|
{ label: '一口价', value: 1, priceType: 1 },
|
|
{ label: '一口价', value: 1, priceType: 1 },
|
|
|
]"
|
|
]"
|
|
|
- style="width: 100px; margin: 0 4px"
|
|
|
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ transfer
|
|
|
|
|
+ style="width: 100px; margin: 0 4px"
|
|
|
/>
|
|
/>
|
|
|
<span>=</span>
|
|
<span>=</span>
|
|
|
<a-input v-model:value="form.cpDynamicPricingRule[0].price" style="width: 80px; margin: 0 4px" placeholder="请输入" />
|
|
<a-input v-model:value="form.cpDynamicPricingRule[0].price" style="width: 80px; margin: 0 4px" placeholder="请输入" />
|
|
@@ -797,14 +809,16 @@ function handleDerivation() {
|
|
|
<span class="flex items-center"
|
|
<span class="flex items-center"
|
|
|
>当"穴位/经络/部位" > <a-input placeholder="请输入" class="w-20 ml-2 mr-2" v-model:value="form.cpDynamicPricingRule[1].max" disabled />个时,</span
|
|
>当"穴位/经络/部位" > <a-input placeholder="请输入" class="w-20 ml-2 mr-2" v-model:value="form.cpDynamicPricingRule[1].max" disabled />个时,</span
|
|
|
>
|
|
>
|
|
|
- <a-select
|
|
|
|
|
- v-model:value="form.cpDynamicPricingRule[1].priceType"
|
|
|
|
|
|
|
+ <vxe-select
|
|
|
|
|
+ v-model="form.cpDynamicPricingRule[1].priceType"
|
|
|
:options="[
|
|
:options="[
|
|
|
{ label: '单价', value: 0, priceType: 0 },
|
|
{ label: '单价', value: 0, priceType: 0 },
|
|
|
{ label: '一口价', value: 1, priceType: 1 },
|
|
{ label: '一口价', value: 1, priceType: 1 },
|
|
|
]"
|
|
]"
|
|
|
- style="width: 100px; margin: 0 4px"
|
|
|
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ transfer
|
|
|
|
|
+ style="width: 100px; margin: 0 4px"
|
|
|
/>
|
|
/>
|
|
|
<span>=</span>
|
|
<span>=</span>
|
|
|
<a-input v-model:value="form.cpDynamicPricingRule[1].price" style="width: 80px; margin: 0 4px" placeholder="请输入" />
|
|
<a-input v-model:value="form.cpDynamicPricingRule[1].price" style="width: 80px; margin: 0 4px" placeholder="请输入" />
|
|
@@ -991,19 +1005,31 @@ function handleDerivation() {
|
|
|
<!-- 机构名称 -->
|
|
<!-- 机构名称 -->
|
|
|
<a-form-item label="机构名称:" v-if="form?.addType === 'itemsList'" required name="institutionId">
|
|
<a-form-item label="机构名称:" v-if="form?.addType === 'itemsList'" required name="institutionId">
|
|
|
<a-tree-select
|
|
<a-tree-select
|
|
|
|
|
+ :disabled="form.addType === 'itemsList' && !!form.sourceId"
|
|
|
v-model:value="form.institutionId"
|
|
v-model:value="form.institutionId"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
- :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
|
|
|
|
|
|
|
+ :dropdownStyle="{ maxHeight: '400px', overflow: 'auto', zIndex: 4000 }"
|
|
|
|
|
+ :dropdownMatchSelectWidth="false"
|
|
|
|
|
+ :getPopupContainer="getSafePopupContainer"
|
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
|
allow-clear
|
|
allow-clear
|
|
|
tree-default-expand-all
|
|
tree-default-expand-all
|
|
|
:tree-data="branch"
|
|
:tree-data="branch"
|
|
|
:loading="branchLoading"
|
|
:loading="branchLoading"
|
|
|
- @select="handleSelect"
|
|
|
|
|
|
|
+ @change="onInstitutionChange"
|
|
|
></a-tree-select>
|
|
></a-tree-select>
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
- <a-form-item label="供应商:" name="conditioningProgramSupplierId" :required="checkedList.includes('1') && form.addType === 'itemsList'">
|
|
|
|
|
- <a-select v-model:value="form.conditioningProgramSupplierId" :options="supplierOptions" placeholder="请选择" allowClear @change="getConditioningProgramSupplier" />
|
|
|
|
|
|
|
+ <a-form-item label="供应商:" name="conditioningProgramSupplierId" :rules="supplierRules" style="width: 100%">
|
|
|
|
|
+ <vxe-select
|
|
|
|
|
+ v-model="form.conditioningProgramSupplierId"
|
|
|
|
|
+ :options="supplierOptions"
|
|
|
|
|
+ placeholder="请选择"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ filterable
|
|
|
|
|
+ transfer
|
|
|
|
|
+ @change="getConditioningProgramSupplier"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ />
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
|
<a-form-item label="线下项目:" name="isOffline" v-if="isShowOnline" :required="checkedList.includes('1')">
|
|
<a-form-item label="线下项目:" name="isOffline" v-if="isShowOnline" :required="checkedList.includes('1')">
|
|
|
<a-checkbox-group v-model:value="onlineArr" @change="onlineChange">
|
|
<a-checkbox-group v-model:value="onlineArr" @change="onlineChange">
|