Commit 640f40c9 authored by miaojiale's avatar miaojiale

增加医联体授权全部按钮,取消懒加载

parent 52c048f5
...@@ -162,7 +162,22 @@ ...@@ -162,7 +162,22 @@
v-el-select-loadmore="loadmore" v-el-select-loadmore="loadmore"
@change="item.func ? item.func($event) : {}" @change="item.func ? item.func($event) : {}"
> >
<!--禁用all的条件: value有值,并且值不是all-->
<el-option <el-option
:key="'all'"
label="全部"
value="all"
:disabled="
form[item.prop]
? form[item.prop].length > 0 &&
form[item.prop].indexOf('all') < 0
: false
"
></el-option>
  
<!--禁用非all条件: form[item.prop]为all-->
<el-option
:disabled="form[item.prop] == 'all'"
v-for="(opt, optIndex) in item.opts" v-for="(opt, optIndex) in item.opts"
:key="optIndex" :key="optIndex"
:label="opt.label" :label="opt.label"
...@@ -368,7 +383,7 @@ export default { ...@@ -368,7 +383,7 @@ export default {
}, },
methods: { methods: {
loadmore() { loadmore() {
this.$emit("loadMore", this.current + 1) // this.$emit("loadMore", this.current + 1)
}, },
open() { open() {
this.visible = true this.visible = true
......
...@@ -439,6 +439,7 @@ export default { ...@@ -439,6 +439,7 @@ export default {
rules: [ rules: [
{ required: true, message: "请选择医联体", trigger: "change" }, { required: true, message: "请选择医联体", trigger: "change" },
], ],
func: this.valueChange,
multiple: true, multiple: true,
}, },
], ],
...@@ -459,6 +460,13 @@ export default { ...@@ -459,6 +460,13 @@ export default {
this.loadMore() this.loadMore()
}, },
methods: { methods: {
valueChange(val) {
console.log(val)
if (val.includes("all")) {
// this.unionIds = this.consortiaList.map((e) => e.id)
console.log(this.consortiaDataRole[0].opts)
}
},
// 修改启用状态 // 修改启用状态
// 启用状态 // 启用状态
openChage(data, index) { openChage(data, index) {
...@@ -478,7 +486,7 @@ export default { ...@@ -478,7 +486,7 @@ export default {
let params = { let params = {
current: current, current: current,
unionName: this.searchQuery ? this.searchQuery : undefined, unionName: this.searchQuery ? this.searchQuery : undefined,
size: 20, size: 10000,
} }
medicalunionList(params).then((res) => { medicalunionList(params).then((res) => {
if (res.code === 1) { if (res.code === 1) {
...@@ -509,19 +517,29 @@ export default { ...@@ -509,19 +517,29 @@ export default {
this.options = [] this.options = []
} }
}, },
// 授权医联体
handleConsortiaConfirm(unionIds) { handleConsortiaConfirm(unionIds) {
console.log(unionIds, this.rowId) let unionIdList = unionIds.consortiaList
if (unionIds.consortiaList.includes("all")) {
unionIdList = this.consortiaDataRole[0].opts.map((e) => e.value)
}
const data = { const data = {
userId: this.rowId, userId: this.rowId,
unionIds: unionIds.consortiaList, unionIds: unionIdList,
} }
baseUnion(data).then((res) => { baseUnion(data)
.then((res) => {
if (res.code === 1) { if (res.code === 1) {
this.$message.success("授权成功") this.$message.success("授权成功")
this.handleSearch() this.handleSearch()
this.$refs.consortiaRole.close() this.$refs.consortiaRole.close()
} else {
this.$refs.consortiaRole.loading = false
} }
}) })
.catch(() => {
this.$refs.consortiaRole.loading = false
})
}, },
orgChange(orgId) { orgChange(orgId) {
const list = [] const list = []
...@@ -594,6 +612,7 @@ export default { ...@@ -594,6 +612,7 @@ export default {
} }
}) })
}, },
// 医联体授权弹窗
handleConsortia({ id }) { handleConsortia({ id }) {
this.rowId = id this.rowId = id
this.$refs.consortiaRole.open() this.$refs.consortiaRole.open()
...@@ -604,10 +623,13 @@ export default { ...@@ -604,10 +623,13 @@ export default {
res.data.unionList.map((item) => { res.data.unionList.map((item) => {
consortiaList.push(item.id) consortiaList.push(item.id)
}) })
if (consortiaList.length == this.consortiaDataRole[0].opts.length) {
this.consortiaList = [...consortiaList] this.consortiaList = ["all"]
} else {
this.consortiaList = consortiaList
}
this.$refs.consortiaRole.initFields({ this.$refs.consortiaRole.initFields({
consortiaList: consortiaList, consortiaList: this.consortiaList,
}) })
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment