diff --git a/src/components/common/ItemTypeTree.vue b/src/components/common/ItemTypeTree.vue index 9b488d3..baab462 100644 --- a/src/components/common/ItemTypeTree.vue +++ b/src/components/common/ItemTypeTree.vue @@ -1,13 +1,15 @@ @@ -19,7 +21,7 @@ import { getTreePids} from "../../utlis/tree"; export default { components: {}, - props:['refreshItemTypeId'], + props:['refreshItemTypeId','itemTypeId'], data() { return { filterText:'' @@ -37,7 +39,7 @@ export default { //挂载组件完成 mounted() { //初始化信息 - this.dictInit(); + this.dictInit(); }, methods: { @@ -68,11 +70,27 @@ export default { }, watch: { - - "filterText"(newVal,oldVal){ - this.$refs['customerOrgTree'].filter(newVal); - } + this.$refs['elTree'].filter(newVal); + }, + + "itemTypeId":{ + immediate: true, // 立即执行 + deep: true, // 深度监听复杂类型内变化 + handler(newVal,oldVal){ + console.log('watch:itemTypeId:',newVal,oldVal) + + + if(newVal && newVal != oldVal){ + //this.$refs['elTree'].setCurrentKey(newVal); + this.customerOrg.defaultExpandedKeys = [] + this.customerOrg.defaultExpandedKeys.push(newVal) + this.$nextTick(() => { + this.$refs['elTree'].setCurrentKey(newVal); + }) + } + } + }, }, }; diff --git a/src/views/diagnosis/diagnosis.vue b/src/views/diagnosis/diagnosis.vue index 50ff39d..de3594b 100644 --- a/src/views/diagnosis/diagnosis.vue +++ b/src/views/diagnosis/diagnosis.vue @@ -7,7 +7,7 @@
- +
@@ -16,14 +16,32 @@
- 项目类别作为查询条件 + + + + + + +
+
- {{ dddw(dict.itemTypeTree, "id", scope.row[dropCol[index].prop], "displayName") }} + +
{{ dddw(dict.diagnosisLevel, "id", scope.row[dropCol[index].prop], "displayName") }} @@ -57,13 +78,21 @@
+ + +
+
- 查询 + 刷新
新增 @@ -99,14 +128,14 @@ - + + size="small"> @@ -187,9 +216,11 @@ export default { query:{ itemTypeFlag:true, //项目类别是否 作为查询条件 itemTypeId:'', - keyWords:'', + keyWords:'', }, + diagnosis: {}, //null, //{id:'',displayName:''} tableData:[], //诊断列表 + quickTableData:[], //快速查找诊断 formInit:{}, form:{ id:'', @@ -198,7 +229,7 @@ export default { displayName:'', suggestionName:'', forSexId:'A', - isSummaryTemplate:'Y', + isSummaryTemplate:'N', diagnosisLevelId:0, suggestions:[], }, @@ -213,7 +244,7 @@ export default { //拖动列(预留) dropCol: [ - { label: "序号",prop: "sn",minWidth: 40,align:"center"}, + //{ label: "序号",prop: "sn",minWidth: 40,align:"center"}, { label: "项目类别",prop: "itemTypeId",minWidth: 120,align:"center"}, { label: "诊断级别",prop: "diagnosisLevelId",minWidth: 60,align:"center"}, { label: "诊断名称",prop: "displayName",minWidth: 100,align:"center"}, @@ -235,7 +266,8 @@ export default { //挂载完成 mounted() { - this.rowDrop('elTableDiagnosis') + this.rowDrop('elTableDiagnosis') + this.btnQuery() }, computed: { @@ -282,18 +314,58 @@ export default { btnQuery(){ 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 =>{ if(res.code != -1){ this.tableData = res.data + this.quickTableData = res.data this.form = Object.assign({},this.formInit) } }) //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) { this.$nextTick(() => { @@ -301,7 +373,7 @@ export default { //console.log('tbody', el) let that = this; Sortable.create(el, { - //handle: ".move", // 选中class='move'的元素按住,方可拖动 + handle: ".move", // 选中class='move'的元素按住,方可拖动 animation: 150, // ms, number 单位:ms,定义排序动画的时间 //拖拽结束 onEnd({ newIndex, oldIndex }) { @@ -314,6 +386,14 @@ export default { rowClick(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(){ @@ -321,6 +401,7 @@ export default { this.$message.warning("请先选择项目类别!") return } + console.log('this.form,this.query',this.form,this.query) this.form = deepCopy(this.formInit) this.form.itemTypeId = this.query.itemTypeId this.dialogVisible = true @@ -334,8 +415,13 @@ export default { this.dialogVisible = true }, + inputDisplayName(v){ + //console.log(v) + this.form.suggestionName = v + }, + onSubmit(formName){ - let msg='',body = {} + let msg='',body = {},itemTypeId='' this.$refs[formName].validate((valid, fields) => { if (!valid) { @@ -348,10 +434,16 @@ export default { this.$message.warning(msg); return } + + if(typeof this.form.itemTypeId == 'object'){ + itemTypeId = this.form.itemTypeId[this.form.itemTypeId.length - 1] + }else{ + itemTypeId = this.form.itemTypeId + } body = { displayName: this.form.displayName, - itemTypeId: this.form.itemTypeId, + itemTypeId, suggestionName: this.form.suggestionName, isIll: this.form.isIll, isSummaryTemplate: this.form.isSummaryTemplate, @@ -360,14 +452,14 @@ export default { } 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){ this.$message.success("操作成功!") this.dialogVisible = false } }) }else{ - postapi(`/api/app/diagnosis`,body).then(res =>{ + postapi(`/api/app/diagnosis/creatediagnosis`,body).then(res =>{ if(res.code != -1){ this.$message.success("操作成功!") this.form = Object.assign(this.form,res.data) @@ -427,7 +519,7 @@ export default { type: "warning", }).then(() => { //console.log('{patientRegisterIds}',{patientRegisterIds}) - return deletapi(`/api/app/diagnosis/${this.form.id}`); + return postapi(`/api/app/diagnosis/deletediagnosis?id=${this.form.id}`); }).then((res) => { if(res.code != -1){ this.$message.success("操作成功"); @@ -445,16 +537,16 @@ export default { }, 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(); + // } + // } + // }, }, };