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 label="项目指标最小值" prop="minValue">
<el-input
:change="checkPrice()"
v-model="form.minValue"
placeholder="请输入项目指标最小值"
/>
</el-form-item>
<el-form-item label="项目指标最大值" prop="maxValue">
<el-input
:change="checkPricemax()"
v-model="form.maxValue"
placeholder="请输入项目指标最大值"
/>
@ -585,6 +587,41 @@ export default {
this.info();
},
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() {
var dictType = "project_judge_mode";
getAgencytype(dictType).then((res) => {

View File

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