Browse Source

range 优化

master
pengjun 2 years ago
parent
commit
4d3d713dd5
  1. 76
      src/components/itemSet/ReferenceRange.vue
  2. 21
      src/utlis/proFunc.js

76
src/components/itemSet/ReferenceRange.vue

@ -3,14 +3,25 @@
<div style="width: 90%">
<el-table :data="tableData" border style="width: 100%" row-key="id" class="el-table__body-wrapper tbody"
height="200" @row-click="rowick" highlight-current-row>
<el-table-column prop="forSexId" label="性别" />
<el-table-column prop="forSexId" label="性别">
<template slot-scope="scope">
<div>{{ ldddw(forSexId, 'id', scope.row.forSexId, 'displayName') }}</div>
</template>
</el-table-column>
<el-table-column prop="ageLowerLimit" label="年龄上限" />
<el-table-column prop="ageUpperLimit" label="年龄下限" />
<el-table-column prop="referenceRangeValue" label="参考范围" />
<el-table-column prop="criticalRangeValue" label="警告范围" />
<el-table-column prop="lowerDiagnosisId" label="偏低诊断" />
<el-table-column prop="upperDiagnosisId" label="偏高诊断" />
<el-table-column prop="lowerDiagnosisId" label="偏低诊断">
<template slot-scope="scope">
<div>{{ ldddw(diagnosis, 'id', scope.row.lowerDiagnosisId, 'displayName') }}</div>
</template>
</el-table-column>
<el-table-column prop="upperDiagnosisId" label="偏高诊断">
<template slot-scope="scope">
<div>{{ ldddw(diagnosis, 'id', scope.row.upperDiagnosisId, 'displayName') }}</div>
</template>
</el-table-column>
<el-table-column label="操作" width="">
<template>
<el-tag class="move" style="cursor: move; margin-left: 15px" draggable="true">
@ -59,13 +70,13 @@
<el-col :span="8">
<el-form-item label="偏低诊断" prop="lowerDiagnosisId">
<el-select v-model="form.lowerDiagnosisId" placeholder="请选择">
<el-option v-for="item in lowerDiagnosisId" :key="item.id" :label="item.displayName" :value="item.id">
<el-option v-for="item in diagnosis" :key="item.id" :label="item.displayName" :value="item.id">
</el-option>
</el-select> </el-form-item></el-col>
<el-col :span="8">
<el-form-item label="偏高诊断" prop="upperDiagnosisId">
<el-select v-model="form.upperDiagnosisId" placeholder="请选择">
<el-option v-for="item in upperDiagnosisId" :key="item.id" :label="item.displayName" :value="item.id">
<el-option v-for="item in diagnosis" :key="item.id" :label="item.displayName" :value="item.id">
</el-option>
</el-select> </el-form-item></el-col>
</el-row>
@ -80,9 +91,9 @@
<script>
import { mapState } from "vuex";
import { getapi, postapi, putapi,deletapi } from "@/api/api";
import { referencerangelist, getporjectlists } from "@/request/commonapi";
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import { examinationgender } from "@/request/systemapi";
import { dddw } from '../../utlis/proFunc'
// import
export default {
props: ['itemId', 'ReferenceRangeTypeFlag'],
@ -116,7 +127,6 @@ export default {
// Sorting: "displayOrder desc",
},
dialogVisible: false,
title: 1,
form: {
itemId: "",
forSexId: "",
@ -130,9 +140,7 @@ export default {
},
id: '', /// id
forSexId: [], //
lowerDiagnosisId: [], //
upperDiagnosisId: [], //
initTableData: [],
diagnosis: [], //
tableData: [],
};
},
@ -143,8 +151,10 @@ export default {
mounted() {
//console.log('@', this.itemId, this.ReferenceRangeTypeFlag)
this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
this.addtoedit()
this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
},
computed: {
...mapState(['itemSet'])
@ -162,7 +172,10 @@ export default {
this.form = row
},
//ldddw(forSexId, 'id', scope.row.forSexId, 'displayName')
ldddw(arrayData,key,value,display){
return dddw(arrayData,key,value,display)
},
//
@ -173,8 +186,7 @@ export default {
});
//
postapi("/api/app/diagnosis/getlistinfilter").then((res) => {
this.lowerDiagnosisId = res.data.items;
this.upperDiagnosisId = res.data.items;
this.diagnosis = res.data.items;
});
},
@ -200,22 +212,22 @@ export default {
return
}
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletapi(`/api/app/reference-range/${this.id}`, this.form).then(res => {
this.$message.success('删除成功')
this.getlist(this.itemId, this.ReferenceRangeTypeFlag)
this.id = ''
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletapi(`/api/app/reference-range/${this.id}`, this.form).then(res => {
this.$message.success('删除成功')
this.getlist(this.itemId, this.ReferenceRangeTypeFlag)
this.id = ''
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
//
@ -226,7 +238,7 @@ export default {
postapi("/api/app/reference-range", this.form).then((res) => {
this.$message.success("新增成功");
this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
console.log('res',res)
console.log('res', res)
this.id = res.data.id;
});
}

21
src/utlis/proFunc.js

@ -1,5 +1,5 @@
//多级联动选择数据处理
//多级联动选择数据处理 add by pengjun
exports.tcdate = (date) => {
for (var i = 0; i < date.length; i++) {
if (date[i].treeChildren.length == 0) {
@ -10,9 +10,24 @@ exports.tcdate = (date) => {
}
}
//json 对像赋值 只从 from 对象 赋值 to 中有的 key 项
//json 对像赋值 只从 from 对象 赋值 to 中有的 key 项 add by pengjun
exports.objCopy = (from,to) => {
for(let key in to){
to[key] = from[key]
}
}
}
//类似PB中的dddw的功能 add by pengjun
exports.dddw = (arrayData,key,value,display) => {
//console.log(arrayData,key,value,display)
let ret = value
for(let i=0;i<arrayData.length;i++){
if(arrayData[i][key] == value){
ret = arrayData[i][display]
break
}
}
return ret
}
Loading…
Cancel
Save