Browse Source

SAMPLE

master
pengjun 2 years ago
parent
commit
d92bc73241
  1. 30
      src/components/common/ItemTypeTree.vue
  2. 142
      src/views/diagnosis/diagnosis.vue

30
src/components/common/ItemTypeTree.vue

@ -1,13 +1,15 @@
<template> <template>
<div> <div>
<!--
<div style="margin:2px 2px 2px 2px;"> <div style="margin:2px 2px 2px 2px;">
<el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small" /> <el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small" />
</div> </div>
<div :style="'overflow: scroll;height:' +(window.pageHeight < 600 ? 410 : window.pageHeight - 190) + 'px;'">
-->
<div :style="'overflow: scroll;height:' +(window.pageHeight < 600 ? 450 : window.pageHeight - 150) + 'px;'">
<el-tree :data="dict.itemTypeTree" :props="customerOrg.treeprops" <el-tree :data="dict.itemTypeTree" :props="customerOrg.treeprops"
node-key="id" :filter-node-method="filterNode" node-key="id" :filter-node-method="filterNode"
:default-expanded-keys="customerOrg.defaultExpandedKeys" :default-expanded-keys="customerOrg.defaultExpandedKeys"
@node-click="treeclick" highlight-current ref="customerOrgTree"/>
@node-click="treeclick" highlight-current ref="elTree"/>
</div> </div>
</div> </div>
</template> </template>
@ -19,7 +21,7 @@ import { getTreePids} from "../../utlis/tree";
export default { export default {
components: {}, components: {},
props:['refreshItemTypeId'],
props:['refreshItemTypeId','itemTypeId'],
data() { data() {
return { return {
filterText:'' filterText:''
@ -68,11 +70,27 @@ export default {
}, },
watch: { watch: {
"filterText"(newVal,oldVal){
this.$refs['elTree'].filter(newVal);
},
"itemTypeId":{
immediate: true, //
deep: true, //
handler(newVal,oldVal){
console.log('watch:itemTypeId:',newVal,oldVal)
"filterText"(newVal,oldVal){
this.$refs['customerOrgTree'].filter(newVal);
}
if(newVal && newVal != oldVal){
//this.$refs['elTree'].setCurrentKey(newVal);
this.customerOrg.defaultExpandedKeys = []
this.customerOrg.defaultExpandedKeys.push(newVal)
this.$nextTick(() => {
this.$refs['elTree'].setCurrentKey(newVal);
})
}
}
},
}, },
}; };

142
src/views/diagnosis/diagnosis.vue

@ -7,7 +7,7 @@
<div style="display: flex;"> <div style="display: flex;">
<!-- 类别树组件 --> <!-- 类别树组件 -->
<div :style="'border: 1px solid;width:200px; height:' +(window.pageHeight < 600 ? 450 : window.pageHeight - 150) +'px;'"> <div :style="'border: 1px solid;width:200px; height:' +(window.pageHeight < 600 ? 450 : window.pageHeight - 150) +'px;'">
<ItemTypeTree :refreshItemTypeId="refreshItemTypeId"/>
<ItemTypeTree :refreshItemTypeId="refreshItemTypeId" :itemTypeId="query.itemTypeId"/>
</div> </div>
<!-- 诊断与建议 --> <!-- 诊断与建议 -->
<div style="display: block;"> <div style="display: block;">
@ -16,14 +16,32 @@
<div :style="'width:' + (window.pageWidth - 200 - 110 - 50) + 'px;'"> <div :style="'width:' + (window.pageWidth - 200 - 110 - 50) + 'px;'">
<div style="margin-left: 5px;display: flex; flex-wrap: wrap;"> <div style="margin-left: 5px;display: flex; flex-wrap: wrap;">
<div> <div>
<!--
<el-checkbox v-model="query.itemTypeFlag">项目类别作为查询条件</el-checkbox> <el-checkbox v-model="query.itemTypeFlag">项目类别作为查询条件</el-checkbox>
<el-input placeholder="查询关键字" v-model="query.keyWords" size="small" clearable style="width: 200px" /> <el-input placeholder="查询关键字" v-model="query.keyWords" size="small" clearable style="width: 200px" />
-->
<el-select v-model="diagnosis" placeholder="快速查找" size="small"
filterable :filter-method="filterMethod" value-key="id"
clearable @clear="quickTableData = deepCopy(tableData)"
@change="quickDiagnosis" default-first-option ref="elSelectKeyWords"
style="width:200px;text-align: left;padding-right: 15px;">
<!--
<el-option key='1' value="" label="1" />
<el-option key='2' value="{id:'2',displayName:'n2'}" label="2" />
-->
<!-- -->
<el-option v-for="item in quickTableData" :key="item.id" :value="item" :label="item.displayName" />
</el-select>
</div> </div>
</div> </div>
<div> <div>
<el-table :data="tableData" border id="elTableDiagnosis" row-key="id" <el-table :data="tableData" border id="elTableDiagnosis" row-key="id"
:height="window.pageHeight < 600 ? 200 : Math.floor((window.pageHeight - 200) / 2)" :height="window.pageHeight < 600 ? 200 : Math.floor((window.pageHeight - 200) / 2)"
highlight-current-row @row-click="rowClick" size="small" ref="elTable"> highlight-current-row @row-click="rowClick" size="small" ref="elTable">
<el-table-column type="index" label="序号" width="40" align="center"/>
<el-table-column <el-table-column
v-for="(item, index) in headerCols" v-for="(item, index) in headerCols"
:key="`col_${index}`" :key="`col_${index}`"
@ -40,7 +58,10 @@
{{ scope.row[dropCol[index].prop] == 'Y' ? '是':'否' }} {{ scope.row[dropCol[index].prop] == 'Y' ? '是':'否' }}
</div> </div>
<div v-else-if="dropCol[index].prop == 'itemTypeId'" > <div v-else-if="dropCol[index].prop == 'itemTypeId'" >
{{ dddw(dict.itemTypeTree, "id", scope.row[dropCol[index].prop], "displayName") }}
<el-cascader :options="dict.itemTypeTree" v-model="scope.row[dropCol[index].prop]"
:props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" :show-all-levels="false"
disabled size="small">
</el-cascader>
</div> </div>
<div v-else-if="dropCol[index].prop == 'diagnosisLevelId'" > <div v-else-if="dropCol[index].prop == 'diagnosisLevelId'" >
{{ dddw(dict.diagnosisLevel, "id", scope.row[dropCol[index].prop], "displayName") }} {{ dddw(dict.diagnosisLevel, "id", scope.row[dropCol[index].prop], "displayName") }}
@ -57,13 +78,21 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="排序" width="40" align="center">
<template>
<el-tag class="move" style="cursor: move;" draggable>
<i class="el-icon-d-caret" style="font-size: 14px; color: rgb(113, 113, 113)" />
</el-tag>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
<!--按钮--> <!--按钮-->
<div style="margin-left: 10px;"> <div style="margin-left: 10px;">
<!---->
<div> <div>
<el-button class="btnClass" @click="btnQuery">查询</el-button>
<el-button class="btnClass" @click="btnQuery">刷新</el-button>
</div> </div>
<div> <div>
<el-button type="primary" class="btnClass" @click="btnAdd">新增</el-button> <el-button type="primary" class="btnClass" @click="btnAdd">新增</el-button>
@ -99,14 +128,14 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="名称" prop="displayName"> <el-form-item label="名称" prop="displayName">
<el-input v-model="form.displayName" size="small"/>
<el-input v-model="form.displayName" size="small" @input="inputDisplayName" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="项目类别" prop="itemTypeId"> <el-form-item label="项目类别" prop="itemTypeId">
<el-cascader :options="dict.itemTypeTree" v-model="form.itemTypeId" <el-cascader :options="dict.itemTypeTree" v-model="form.itemTypeId"
:props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" :show-all-levels="false" :props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" :show-all-levels="false"
disabled size="small">
size="small">
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -189,7 +218,9 @@ export default {
itemTypeId:'', itemTypeId:'',
keyWords:'', keyWords:'',
}, },
diagnosis: {}, //null, //{id:'',displayName:''}
tableData:[], // tableData:[], //
quickTableData:[], //
formInit:{}, formInit:{},
form:{ form:{
id:'', id:'',
@ -198,7 +229,7 @@ export default {
displayName:'', displayName:'',
suggestionName:'', suggestionName:'',
forSexId:'A', forSexId:'A',
isSummaryTemplate:'Y',
isSummaryTemplate:'N',
diagnosisLevelId:0, diagnosisLevelId:0,
suggestions:[], suggestions:[],
}, },
@ -213,7 +244,7 @@ export default {
// //
dropCol: [ dropCol: [
{ label: "序号",prop: "sn",minWidth: 40,align:"center"},
//{ label: "",prop: "sn",minWidth: 40,align:"center"},
{ label: "项目类别",prop: "itemTypeId",minWidth: 120,align:"center"}, { label: "项目类别",prop: "itemTypeId",minWidth: 120,align:"center"},
{ label: "诊断级别",prop: "diagnosisLevelId",minWidth: 60,align:"center"}, { label: "诊断级别",prop: "diagnosisLevelId",minWidth: 60,align:"center"},
{ label: "诊断名称",prop: "displayName",minWidth: 100,align:"center"}, { label: "诊断名称",prop: "displayName",minWidth: 100,align:"center"},
@ -236,6 +267,7 @@ export default {
// //
mounted() { mounted() {
this.rowDrop('elTableDiagnosis') this.rowDrop('elTableDiagnosis')
this.btnQuery()
}, },
computed: { computed: {
@ -282,18 +314,58 @@ export default {
btnQuery(){ btnQuery(){
let body = {} let body = {}
if(this.query.itemTypeFlag && this.query.itemTypeId) body.itemTypeId = this.query.itemTypeId
if(this.query.keyWords) body.keyWords = this.query.keyWords
// if(this.query.itemTypeFlag && this.query.itemTypeId) body.itemTypeId = this.query.itemTypeId
// if(this.query.keyWords) body.keyWords = this.query.keyWords
postapi('/api/app/diagnosis/getlistinsuggestion',body).then(res =>{ postapi('/api/app/diagnosis/getlistinsuggestion',body).then(res =>{
if(res.code != -1){ if(res.code != -1){
this.tableData = res.data this.tableData = res.data
this.quickTableData = res.data
this.form = Object.assign({},this.formInit) this.form = Object.assign({},this.formInit)
} }
}) })
//console.log(this.query) //console.log(this.query)
}, },
//
filterMethod(keyWords) {
//console.log('filterMethod',this.dict.asbItemQuick)
if (keyWords) {
this.quickTableData = [];
this.tableData.forEach(item => {
if (item.displayName.indexOf(keyWords) > - 1
|| item.simpleCode.indexOf(keyWords.toUpperCase()) > - 1
|| item.suggestionName.indexOf(keyWords) > - 1) {
this.quickTableData.push(item);
}
});
} else {
this.quickTableData = deepCopy(tableData);
}
},
//
quickDiagnosis(v) {
// value-key value console.log('quickDiagnosis',v)
let lfind = -1
if (v.id) {
lfind = arrayExistObj(this.tableData, 'id', v.id)
if (lfind > -1) {
this.$refs['elTable'].setCurrentRow(this.tableData[lfind])
this.rowClick(this.tableData[lfind])
}
}
//console.log('v,query.diagnosis',v,this.query.diagnosis)
this.$refs['elSelectKeyWords'].focus(); //asbItemId
this.$nextTick(() => {
this.$refs['elSelectKeyWords'].blur(); //total asbItemId
//this.query.keyWords = ''
this.quickTableData = deepCopy(this.tableData)
this.$refs['elSelectKeyWords'].focus(); //total asbItemId
});
},
// //
rowDrop(elId) { rowDrop(elId) {
this.$nextTick(() => { this.$nextTick(() => {
@ -301,7 +373,7 @@ export default {
//console.log('tbody', el) //console.log('tbody', el)
let that = this; let that = this;
Sortable.create(el, { Sortable.create(el, {
//handle: ".move", // class='move'
handle: ".move", // class='move'
animation: 150, // ms, number ms animation: 150, // ms, number ms
// //
onEnd({ newIndex, oldIndex }) { onEnd({ newIndex, oldIndex }) {
@ -314,6 +386,14 @@ export default {
rowClick(row){ rowClick(row){
this.form = deepCopy(row) this.form = deepCopy(row)
//
if(typeof row.itemTypeId == 'string'){
this.query.itemTypeId = row.itemTypeId
}else{
this.query.itemTypeId = row.itemTypeId[row.itemTypeId.length - 1]
}
}, },
btnAdd(){ btnAdd(){
@ -321,6 +401,7 @@ export default {
this.$message.warning("请先选择项目类别!") this.$message.warning("请先选择项目类别!")
return return
} }
console.log('this.form,this.query',this.form,this.query)
this.form = deepCopy(this.formInit) this.form = deepCopy(this.formInit)
this.form.itemTypeId = this.query.itemTypeId this.form.itemTypeId = this.query.itemTypeId
this.dialogVisible = true this.dialogVisible = true
@ -334,8 +415,13 @@ export default {
this.dialogVisible = true this.dialogVisible = true
}, },
inputDisplayName(v){
//console.log(v)
this.form.suggestionName = v
},
onSubmit(formName){ onSubmit(formName){
let msg='',body = {}
let msg='',body = {},itemTypeId=''
this.$refs[formName].validate((valid, fields) => { this.$refs[formName].validate((valid, fields) => {
if (!valid) { if (!valid) {
@ -349,9 +435,15 @@ export default {
return return
} }
if(typeof this.form.itemTypeId == 'object'){
itemTypeId = this.form.itemTypeId[this.form.itemTypeId.length - 1]
}else{
itemTypeId = this.form.itemTypeId
}
body = { body = {
displayName: this.form.displayName, displayName: this.form.displayName,
itemTypeId: this.form.itemTypeId,
itemTypeId,
suggestionName: this.form.suggestionName, suggestionName: this.form.suggestionName,
isIll: this.form.isIll, isIll: this.form.isIll,
isSummaryTemplate: this.form.isSummaryTemplate, isSummaryTemplate: this.form.isSummaryTemplate,
@ -360,14 +452,14 @@ export default {
} }
if(this.form.id){ if(this.form.id){
putapi(`/api/app/diagnosis/${this.form.id}`,body).then(res =>{
postapi(`/api/app/diagnosis/updatediagnosis?id=${this.form.id}`,body).then(res =>{
if(res.code != -1){ if(res.code != -1){
this.$message.success("操作成功!") this.$message.success("操作成功!")
this.dialogVisible = false this.dialogVisible = false
} }
}) })
}else{ }else{
postapi(`/api/app/diagnosis`,body).then(res =>{
postapi(`/api/app/diagnosis/creatediagnosis`,body).then(res =>{
if(res.code != -1){ if(res.code != -1){
this.$message.success("操作成功!") this.$message.success("操作成功!")
this.form = Object.assign(this.form,res.data) this.form = Object.assign(this.form,res.data)
@ -427,7 +519,7 @@ export default {
type: "warning", type: "warning",
}).then(() => { }).then(() => {
//console.log('{patientRegisterIds}',{patientRegisterIds}) //console.log('{patientRegisterIds}',{patientRegisterIds})
return deletapi(`/api/app/diagnosis/${this.form.id}`);
return postapi(`/api/app/diagnosis/deletediagnosis?id=${this.form.id}`);
}).then((res) => { }).then((res) => {
if(res.code != -1){ if(res.code != -1){
this.$message.success("操作成功"); this.$message.success("操作成功");
@ -445,16 +537,16 @@ export default {
}, },
watch: { watch: {
"query.itemTypeId":{
immediate: true, //
deep: true, //
handler(newVal,oldVal){
// console.log('watch:patientRegisterNo:',newVal,oldVal)
if(newVal != oldVal){
this.btnQuery();
}
}
},
// "query.itemTypeId":{
// immediate: true, //
// deep: true, //
// handler(newVal,oldVal){
// // console.log('watch:patientRegisterNo:',newVal,oldVal)
// if(newVal != oldVal){
// this.btnQuery();
// }
// }
// },
}, },
}; };
</script> </script>

Loading…
Cancel
Save