Browse Source

树组件相关状态保存

x-emr
bianyaqi 2 years ago
parent
commit
0174dc8159
  1. 4
      public/index.html
  2. 31
      src/components/360View/collection.vue

4
public/index.html

@ -39,8 +39,8 @@
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %> <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script> <script>
//http://121.36.16.195:9002/huimu-admin/swagger-ui/index.html //http://121.36.16.195:9002/huimu-admin/swagger-ui/index.html
// window.SITE_CONFIG['apiURL'] = 'http://47.110.224.240:8036/xiangan-crf';
window.SITE_CONFIG['apiURL'] = 'http://192.168.0.168:8036/xiangan-crf';
window.SITE_CONFIG['apiURL'] = 'http://47.110.224.240:8036/xiangan-crf';
// window.SITE_CONFIG['apiURL'] = 'http://192.168.0.168:8036/xiangan-crf';
// window.SITE_CONFIG['apiURL'] = 'http://192.168.4.174:8036/xiangan-crf'; // window.SITE_CONFIG['apiURL'] = 'http://192.168.4.174:8036/xiangan-crf';
</script> </script>
<% } %> <% } %>

31
src/components/360View/collection.vue

@ -14,11 +14,15 @@
<el-button v-if="!collectData.length" size="mini" @click="dialogFormVisible = true">新增节点</el-button> <el-button v-if="!collectData.length" size="mini" @click="dialogFormVisible = true">新增节点</el-button>
<el-tree <el-tree
v-else v-else
ref="collectTree"
:data="collectData" :data="collectData"
node-key="id" node-key="id"
:props="defaultProps" :props="defaultProps"
:default-expanded-keys="defaultExpandIds"
@node-expand="handleNodeExpand"
@node-collapse="handleNodeCollapse"
> >
<span slot-scope="{ node, data }" :class="[curNode.id===data.id?'active':'','custom-tree-node']" @click="levelClick(data)">
<span slot-scope="{ node, data }" :class="[curNode.id===data.id?'active':'','custom-tree-node']" @click="levelClick(data,node)">
<span class="treeDefault"> <span class="treeDefault">
<span>{{ node.label }}</span> <span>{{ node.label }}</span>
</span> </span>
@ -32,8 +36,7 @@
<el-dropdown-item command="child">新增子级节点</el-dropdown-item> <el-dropdown-item command="child">新增子级节点</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<i v-if="data.patientId" style="color: red" class="el-icon-delete" @click="deleteNode(node, data)" />
<el-dropdown v-else trigger="click" style="margin-left: 10px" @command="(command)=>handleNode(command,node,data)">
<el-dropdown trigger="click" style="margin-left: 10px" @command="(command)=>handleNode(command,node,data)">
<span :class="{'active':curNode.id===data.id}">···</span> <span :class="{'active':curNode.id===data.id}">···</span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="rename">编辑</el-dropdown-item> <el-dropdown-item command="rename">编辑</el-dropdown-item>
@ -103,11 +106,13 @@ export default {
}, },
data() { data() {
return { return {
defaultExpandIds: [],
keyword: '', keyword: '',
dialogFormVisible: false, dialogFormVisible: false,
remarkDialog: false, remarkDialog: false,
remark: '', remark: '',
curNode: '', curNode: '',
curExpand: '',
editName: '', editName: '',
editRemark: '', editRemark: '',
editMessage: '新增成功', editMessage: '新增成功',
@ -180,7 +185,7 @@ export default {
searchPatient() { searchPatient() {
this.$http.get('/tree/findCollectPatient', { this.$http.get('/tree/findCollectPatient', {
params: { params: {
doctorld: this.doctorId,
doctorId: this.doctorId,
platform: this.platform, platform: this.platform,
queryStr: this.keyword queryStr: this.keyword
} }
@ -236,8 +241,9 @@ export default {
} }
}) })
}, },
levelClick(data) {
levelClick(data, node) {
this.curNode = data this.curNode = data
this.curExpand = node
this.remark = data.remark || '' this.remark = data.remark || ''
this.tableData = data.treePatientVoList this.tableData = data.treePatientVoList
}, },
@ -371,6 +377,21 @@ export default {
this.editMessage = '重命名成功!' this.editMessage = '重命名成功!'
this.addParam.id = data.id this.addParam.id = data.id
this.addParam.parentId = data.parentId this.addParam.parentId = data.parentId
},
//
handleNodeExpand() {
if (this.defaultExpandIds.indexOf(this.curNode.id) === -1) {
this.defaultExpandIds.push(this.curNode.id)
}
},
//
handleNodeCollapse() {
if (!this.defaultExpandIds.indexOf(this.curNode.id)) {
const index = this.defaultExpandIds.findIndex(item => {
return item === this.curNode.id
})
this.defaultExpandIds.splice(index, 1)
}
} }
} }
} }

Loading…
Cancel
Save