This commit is contained in:
闫晓茹 2024-03-13 17:12:39 +08:00
parent dc66a16ff3
commit f443744104
2 changed files with 116 additions and 30 deletions

View File

@ -356,12 +356,14 @@
</el-form-item> </el-form-item>
<el-form-item label="项目指标最小值" prop="minValue"> <el-form-item label="项目指标最小值" prop="minValue">
<el-input <el-input
:change="checkPrice()"
v-model="form.minValue" v-model="form.minValue"
placeholder="请输入项目指标最小值" placeholder="请输入项目指标最小值"
/> />
</el-form-item> </el-form-item>
<el-form-item label="项目指标最大值" prop="maxValue"> <el-form-item label="项目指标最大值" prop="maxValue">
<el-input <el-input
:change="checkPricemax()"
v-model="form.maxValue" v-model="form.maxValue"
placeholder="请输入项目指标最大值" placeholder="请输入项目指标最大值"
/> />
@ -585,6 +587,41 @@ export default {
this.info(); this.info();
}, },
methods: { methods: {
checkPricemax() {
let checkPlan = "" + this.form.maxValue;
checkPlan = checkPlan
.replace(/[^\d.]/g, "") // .
.replace(/\.{2,}/g, ".") // .
.replace(/^\./g, "") // .
.replace(".", "$#$")
.replace(/\./g, "")
.replace("$#$", ".");
if (checkPlan.indexOf(".") < 0 && checkPlan !== "") {
// 0102
checkPlan = parseFloat(checkPlan) + "";
} else if (checkPlan.indexOf(".") >= 0) {
checkPlan = checkPlan.replace(/^()*(\d+)\.(\d\d).*$/, "$1$2.$3"); //
}
this.form.maxValue = checkPlan;
},
/**只能输入数字且有小数点最多保留两位*/
checkPrice() {
let checkPlan = "" + this.form.minValue;
checkPlan = checkPlan
.replace(/[^\d.]/g, "") // .
.replace(/\.{2,}/g, ".") // .
.replace(/^\./g, "") // .
.replace(".", "$#$")
.replace(/\./g, "")
.replace("$#$", ".");
if (checkPlan.indexOf(".") < 0 && checkPlan !== "") {
// 0102
checkPlan = parseFloat(checkPlan) + "";
} else if (checkPlan.indexOf(".") >= 0) {
checkPlan = checkPlan.replace(/^()*(\d+)\.(\d\d).*$/, "$1$2.$3"); //
}
this.form.minValue = checkPlan;
},
info() { info() {
var dictType = "project_judge_mode"; var dictType = "project_judge_mode";
getAgencytype(dictType).then((res) => { getAgencytype(dictType).then((res) => {

View File

@ -373,10 +373,10 @@
<el-input v-model="form.measureResult" placeholder="请输入检测结果,数字或文字描述" /> <el-input v-model="form.measureResult" placeholder="请输入检测结果,数字或文字描述" />
</el-form-item> </el-form-item>
<el-form-item label="项目指标最大值" prop="maxValue"> <el-form-item label="项目指标最大值" prop="maxValue">
<el-input v-model="form.maxValue" oninput="value=value.replace(/[^\d.]/g,'')" placeholder="请输入项目指标最大值" /> <el-input v-model="form.maxValue" :change="checkPricemax()" placeholder="请输入项目指标最大值" />
</el-form-item> </el-form-item>
<el-form-item label="项目指标最小值" prop="minValue"> <el-form-item label="项目指标最小值" prop="minValue">
<el-input v-model="form.minValue" oninput="value=value.replace(/[^\d.]/g,'')" placeholder="请输入项目指标最小值" /> <el-input v-model="form.minValue" :change="checkPrice()" placeholder="请输入项目指标最小值" />
</el-form-item> </el-form-item>
<el-form-item label="项目指标默认值" prop="defaultValue"> <el-form-item label="项目指标默认值" prop="defaultValue">
<el-input v-model="form.defaultValue" placeholder="请输入项目指标默认值" /> <el-input v-model="form.defaultValue" placeholder="请输入项目指标默认值" />
@ -430,7 +430,13 @@
</template> </template>
<script> <script>
import { listProjectresult, getProjectresult, delProjectresult, addProjectresult, updateProjectresult } from "@/api/manage/projectresult"; import {
listProjectresult,
getProjectresult,
delProjectresult,
addProjectresult,
updateProjectresult,
} from "@/api/manage/projectresult";
export default { export default {
name: "Projectresult", name: "Projectresult",
@ -509,19 +515,54 @@ export default {
// //
rules: { rules: {
patientId: [ patientId: [
{ required: true, message: "患者id不能为空", trigger: "blur" } { required: true, message: "患者id不能为空", trigger: "blur" },
], ],
} },
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
/**只能输入数字且有小数点最多保留两位*/
checkPrice() {
let checkPlan = "" + this.form.minValue;
checkPlan = checkPlan
.replace(/[^\d.]/g, "") // .
.replace(/\.{2,}/g, ".") // .
.replace(/^\./g, "") // .
.replace(".", "$#$")
.replace(/\./g, "")
.replace("$#$", ".");
if (checkPlan.indexOf(".") < 0 && checkPlan !== "") {
// 0102
checkPlan = parseFloat(checkPlan) + "";
} else if (checkPlan.indexOf(".") >= 0) {
checkPlan = checkPlan.replace(/^()*(\d+)\.(\d\d).*$/, "$1$2.$3"); //
}
this.form.minValue = checkPlan;
},
checkPricemax() {
let checkPlan = "" + this.form.maxValue;
checkPlan = checkPlan
.replace(/[^\d.]/g, "") // .
.replace(/\.{2,}/g, ".") // .
.replace(/^\./g, "") // .
.replace(".", "$#$")
.replace(/\./g, "")
.replace("$#$", ".");
if (checkPlan.indexOf(".") < 0 && checkPlan !== "") {
// 0102
checkPlan = parseFloat(checkPlan) + "";
} else if (checkPlan.indexOf(".") >= 0) {
checkPlan = checkPlan.replace(/^()*(\d+)\.(\d\d).*$/, "$1$2.$3"); //
}
this.form.maxValue = checkPlan;
},
/** 查询检测项目结果列表 */ /** 查询检测项目结果列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listProjectresult(this.queryParams).then(response => { listProjectresult(this.queryParams).then((response) => {
this.projectresultList = response.rows; this.projectresultList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -563,7 +604,7 @@ export default {
createBy: null, createBy: null,
createTime: null, createTime: null,
updateBy: null, updateBy: null,
updateTime: null updateTime: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -579,9 +620,9 @@ export default {
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map((item) => item.id);
this.single = selection.length!==1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
@ -592,8 +633,8 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getProjectresult(id).then(response => { getProjectresult(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改检测项目结果"; this.title = "修改检测项目结果";
@ -601,16 +642,16 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateProjectresult(this.form).then(response => { updateProjectresult(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addProjectresult(this.form).then(response => { addProjectresult(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -622,19 +663,27 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除检测项目结果编号为"' + ids + '"的数据项?').then(function() { this.$modal
.confirm('是否确认删除检测项目结果编号为"' + ids + '"的数据项?')
.then(function () {
return delProjectresult(ids); return delProjectresult(ids);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); })
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('manage/projectresult/export', { this.download(
...this.queryParams "manage/projectresult/export",
}, `projectresult_${new Date().getTime()}.xlsx`) {
} ...this.queryParams,
} },
`projectresult_${new Date().getTime()}.xlsx`
);
},
},
}; };
</script> </script>