|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <!-- 搜索表单 -->
|
|
|
+ <!-- 搜索表单(保持不变) -->
|
|
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
|
|
|
<el-form-item label="患者姓名" prop="patientName">
|
|
|
<el-input v-model="queryParams.patientName" placeholder="请输入患者姓名" clearable size="small" @keyup.enter.native="handleQuery" />
|
|
|
@@ -14,7 +14,6 @@
|
|
|
<el-form-item label="订单号" prop="orderCode">
|
|
|
<el-input v-model="queryParams.orderCode" placeholder="请输入订单号" clearable size="small" @keyup.enter.native="handleQuery" />
|
|
|
</el-form-item>
|
|
|
- <!-- 创建时间范围查询 -->
|
|
|
<el-form-item label="创建时间">
|
|
|
<el-date-picker
|
|
|
v-model="dateRange"
|
|
|
@@ -52,7 +51,7 @@
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="患者姓名" align="center" prop="patientName" />
|
|
|
<el-table-column label="患者电话" align="center" prop="patientPhone" />
|
|
|
- <el-table-column label="手写信息采集表" align="center" prop="billImgUrl" width="120">
|
|
|
+ <el-table-column label="手写信息采集" align="center" prop="billImgUrl" width="120">
|
|
|
<template slot-scope="scope">
|
|
|
<el-image
|
|
|
style="width: 50px; height: 50px"
|
|
|
@@ -65,7 +64,6 @@
|
|
|
</el-image>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!-- 新增补充图片列 -->
|
|
|
<el-table-column label="补充图片" align="center" prop="extraImgUrl" width="120">
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="scope.row.extraImgUrl">
|
|
|
@@ -105,7 +103,8 @@
|
|
|
<!-- 新增/编辑弹窗 -->
|
|
|
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
- <el-form-item label="手写信息采集表" prop="billImgUrl">
|
|
|
+ <!-- 手写信息采集表(必填) -->
|
|
|
+ <el-form-item label="手写信息采集" prop="billImgUrl">
|
|
|
<div style="display: flex; align-items: center; gap: 10px;">
|
|
|
<image-upload
|
|
|
v-model="form.billImgUrl"
|
|
|
@@ -121,10 +120,15 @@
|
|
|
{{ ocrMsg }}
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
- <!-- 新增补充图片上传 -->
|
|
|
+
|
|
|
+ <!-- 补充图片上传(根据药品标志决定是否必填) -->
|
|
|
<el-form-item label="补充图片" prop="extraImgUrl">
|
|
|
<image-upload v-model="form.extraImgUrl" :limit="10" multiple />
|
|
|
+ <div v-if="extraImgRequired" style="color: red; font-size: 12px; margin-top: 4px;">
|
|
|
+ * 该订单包含药品,补充图片为必传
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item label="患者姓名" prop="patientName">
|
|
|
<el-input v-model="form.patientName" placeholder="请输入患者姓名" />
|
|
|
</el-form-item>
|
|
|
@@ -170,6 +174,7 @@
|
|
|
<script>
|
|
|
import { listCollection, getCollection, addCollection, updateCollection, delCollection, checkOrderCode, getOrderCodeInfo, ocrImage } from "@/api/member/handwriteCollection/handwriteCollection";
|
|
|
import { getStoreOrder } from "@/api/hisStore/storeOrder";
|
|
|
+import { getProductMedicineFlagByOrderCode } from "@/api/store/storeProduct";
|
|
|
import ImageUpload from "@/components/ImageUpload";
|
|
|
|
|
|
export default {
|
|
|
@@ -193,6 +198,8 @@ export default {
|
|
|
ocrMsg: '',
|
|
|
statusOptions: [],
|
|
|
dateRange: [],
|
|
|
+ extraImgRequired: false,
|
|
|
+ isNewRecord: true, //标识是否新增模式(用于控制订单号是否可编辑)
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
@@ -203,16 +210,15 @@ export default {
|
|
|
},
|
|
|
form: {},
|
|
|
rules: {
|
|
|
- patientName: [
|
|
|
- { required: true, message: "患者姓名不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
+ // 手写信息采集表必填(关键修复)
|
|
|
+ billImgUrl: [{ required: true, message: "手写信息采集表不能为空", trigger: "change" }],
|
|
|
+ patientName: [{ required: true, message: "患者姓名不能为空", trigger: "blur" }],
|
|
|
patientPhone: [
|
|
|
{ required: true, message: "患者电话不能为空", trigger: "blur" },
|
|
|
{ pattern: /^1[3-9]\d{9}$/, message: "请输入正确的手机号码", trigger: "blur" }
|
|
|
],
|
|
|
- orderCode: [
|
|
|
- { required: true, message: "订单号不能为空", trigger: "blur" }
|
|
|
- ]
|
|
|
+ orderCode: [{ required: true, message: "订单号不能为空", trigger: "blur" }],
|
|
|
+ extraImgUrl: [{ required: false, message: "请上传补充图片", trigger: "change" }]
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
@@ -224,10 +230,19 @@ export default {
|
|
|
this.statusOptions = [];
|
|
|
});
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ "form.orderCode": {
|
|
|
+ handler(newVal, oldVal) {
|
|
|
+ if (newVal && newVal !== oldVal) {
|
|
|
+ this.loadMedicineFlag(newVal);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: false
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
- // 处理日期范围参数
|
|
|
const params = { ...this.queryParams };
|
|
|
if (this.dateRange && this.dateRange.length === 2) {
|
|
|
params.startDate = this.dateRange[0];
|
|
|
@@ -244,17 +259,19 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
resetQuery() {
|
|
|
- this.dateRange = []; // 重置日期范围
|
|
|
+ this.dateRange = [];
|
|
|
this.$refs.queryForm.resetFields();
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
handleAdd() {
|
|
|
this.reset();
|
|
|
this.open = true;
|
|
|
- this.title = "添加手写信息采集表";
|
|
|
+ this.title = "添加手写信息采集";
|
|
|
this.orderInfoVisible = false;
|
|
|
this.ocrMsg = '';
|
|
|
this.isNewRecord = true;
|
|
|
+ this.extraImgRequired = false;
|
|
|
+ this.updateExtraImgRule(false);
|
|
|
},
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
@@ -263,10 +280,15 @@ export default {
|
|
|
this.form = response.data;
|
|
|
this.originalOrderCode = this.form.orderCode;
|
|
|
this.open = true;
|
|
|
- this.title = "修改手写信息采集表";
|
|
|
+ this.title = "修改手写信息采集";
|
|
|
this.orderInfoVisible = false;
|
|
|
this.ocrMsg = '';
|
|
|
this.isNewRecord = false;
|
|
|
+ if (this.form.orderCode) {
|
|
|
+ this.loadMedicineFlag(this.form.orderCode);
|
|
|
+ } else {
|
|
|
+ this.updateExtraImgRule(false);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
handleImageChange(newUrl, oldUrl) {
|
|
|
@@ -286,9 +308,9 @@ export default {
|
|
|
this.ocrLoading = true;
|
|
|
this.ocrMsg = '';
|
|
|
try {
|
|
|
- const res = await ocrImage({ imgUrl: this.form.billImgUrl });
|
|
|
+ const res = await ocrImage({imgUrl: this.form.billImgUrl});
|
|
|
if (res.code === 200 && res.data) {
|
|
|
- const { name, phone, isParse } = res.data;
|
|
|
+ const {name, phone, isParse} = res.data;
|
|
|
if (isParse === 1) {
|
|
|
if (name) this.form.patientName = name;
|
|
|
if (phone) this.form.patientPhone = phone;
|
|
|
@@ -311,6 +333,36 @@ export default {
|
|
|
loadingInstance.close();
|
|
|
}
|
|
|
},
|
|
|
+ async loadMedicineFlag(orderCode) {
|
|
|
+ if (!orderCode) {
|
|
|
+ this.updateExtraImgRule(false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const res = await getProductMedicineFlagByOrderCode(orderCode);
|
|
|
+ if (res.code === 200) {
|
|
|
+ const required = res.flag === true;
|
|
|
+ this.updateExtraImgRule(required);
|
|
|
+ } else {
|
|
|
+ this.updateExtraImgRule(false);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取药品标志失败', error);
|
|
|
+ this.updateExtraImgRule(false);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ updateExtraImgRule(required) {
|
|
|
+ this.extraImgRequired = required;
|
|
|
+ const newRule = required
|
|
|
+ ? {required: true, message: "该订单包含药品,补充图片为必传", trigger: "change"}
|
|
|
+ : {required: false};
|
|
|
+ this.rules.extraImgUrl = newRule;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.$refs.form) {
|
|
|
+ this.$refs.form.clearValidate('extraImgUrl');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
async fetchOrderInfo() {
|
|
|
const orderCode = this.form.orderCode;
|
|
|
if (!orderCode || orderCode.trim() === '') {
|
|
|
@@ -347,6 +399,7 @@ export default {
|
|
|
};
|
|
|
this.orderInfoVisible = true;
|
|
|
this.$message.success('已加载订单信息,请对照核对');
|
|
|
+ await this.loadMedicineFlag(orderCode);
|
|
|
} else {
|
|
|
this.$message.warning('订单信息不完整');
|
|
|
this.orderInfoVisible = false;
|
|
|
@@ -355,6 +408,12 @@ export default {
|
|
|
async submitForm() {
|
|
|
this.$refs.form.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
+ // 补充图片额外校验
|
|
|
+ if (this.extraImgRequired && (!this.form.extraImgUrl || this.form.extraImgUrl.trim() === '')) {
|
|
|
+ this.$message.error('该订单包含药品,请上传补充图片');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
const isUpdate = this.form.id != null;
|
|
|
let needCheckOrder = true;
|
|
|
|
|
|
@@ -380,12 +439,16 @@ export default {
|
|
|
this.$message.success("修改成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error("修改失败");
|
|
|
});
|
|
|
} else {
|
|
|
addCollection(this.form).then(() => {
|
|
|
this.$message.success("新增成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error("新增失败");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -402,14 +465,14 @@ export default {
|
|
|
}).then(() => {
|
|
|
this.getList();
|
|
|
this.$message.success("删除成功");
|
|
|
- }).catch(() => {});
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
},
|
|
|
handleSelectionChange(selection) {
|
|
|
this.ids = selection.map(item => item.id);
|
|
|
this.single = selection.length !== 1;
|
|
|
this.multiple = !selection.length;
|
|
|
},
|
|
|
- // 将逗号分隔的字符串转为图片URL数组
|
|
|
getExtraImgList(str) {
|
|
|
if (!str) return [];
|
|
|
return str.split(',').filter(url => url.trim() !== '');
|
|
|
@@ -427,8 +490,12 @@ export default {
|
|
|
this.originalOrderCode = null;
|
|
|
this.ocrMsg = '';
|
|
|
this.ocrLoading = false;
|
|
|
+ this.extraImgRequired = false;
|
|
|
+ this.orderInfoVisible = false;
|
|
|
+ this.orderInfo = {};
|
|
|
if (this.$refs.form) {
|
|
|
this.$refs.form.resetFields();
|
|
|
+ this.updateExtraImgRule(false);
|
|
|
}
|
|
|
},
|
|
|
cancel() {
|
|
|
@@ -455,9 +522,11 @@ export default {
|
|
|
border-radius: 4px;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
+
|
|
|
.success-msg {
|
|
|
color: #67C23A;
|
|
|
}
|
|
|
+
|
|
|
.error-msg {
|
|
|
color: #F56C6C;
|
|
|
}
|