[update] 调文档库的搜索,表头,新增
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="box-title-text">
|
||||
<a-input class="box-input" :value="value" :title="value" @input="indexClick($event)"
|
||||
:disabled="isDisabled"
|
||||
:placeholder="!isDisabled?$t('pleaseEnterOrSelect')+query.db_field_txt:query.db_field_txt"/>
|
||||
<a-input class="box-input" :value="value" :title="value" @click="standardClick"
|
||||
:disabled="isDisabled" readonly
|
||||
:placeholder="!isDisabled?$t('pleaseSelect')+query.dbFieldTxt:query.dbFieldTxt"/>
|
||||
<a-button v-if="!isDisabled" type="primary" class="button-box" @click="standardClick">
|
||||
{{this.$t('standardSelect.standardSelection')}}
|
||||
</a-button>
|
||||
@@ -153,17 +153,17 @@ export default {
|
||||
serialNumber.push(res.serial_number)
|
||||
replaceStandardId.push(res.id)
|
||||
})
|
||||
this.$emit('input', serialNumber.join(','))
|
||||
this.$emit('change', this.query.db_field_name, replaceStandardId.join(','))
|
||||
// this.$emit('input', serialNumber.join(','))
|
||||
this.$emit('change', this.query.dbFieldName, replaceStandardId.join(','))
|
||||
// this.$emit('changecontent', this.content)
|
||||
this.visible = false
|
||||
} else {
|
||||
this.$message.warning(this.$t('selectLeastOne'))
|
||||
}
|
||||
},
|
||||
indexClick (event) {
|
||||
this.$emit('input', event.target.value)
|
||||
},
|
||||
// indexClick (event) {
|
||||
// this.$emit('input', event.target.value)
|
||||
// },
|
||||
onSelectChange (value, row) {
|
||||
this.selectedRowKeys = value
|
||||
this.selectedRowList = row
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{{this.$t('userOrOrganSelect.select')}}
|
||||
</a-button>
|
||||
</div>
|
||||
<user-organ-select-modal ref="selectModal" :selectType="selectType" @change="selectChange"></user-organ-select-modal>
|
||||
<user-organ-select-modal v-bind="$attrs" ref="selectModal" :selectType="selectType" @change="selectChange"></user-organ-select-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -27,6 +27,10 @@ export default {
|
||||
type: String,
|
||||
default: 'all'
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
@@ -37,6 +41,9 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
console.log(this.type)
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
selectValue: []
|
||||
@@ -52,7 +59,12 @@ export default {
|
||||
} else {
|
||||
this.selectValue = arrOne
|
||||
}
|
||||
this.$emit('change', this.selectType)
|
||||
}
|
||||
},
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'change'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -62,10 +62,10 @@
|
||||
<div class="modal-content-title-div">
|
||||
<p class="modal-content-title">选择</p>
|
||||
<div class="table-operator-tab">
|
||||
<a class="switch-item" :class="switchValue === 'organ' ? 'table-operator-tab-active' : ''"
|
||||
<a v-if="selectType === 'all' || selectType === 'organ'" class="switch-item" :class="switchValue === 'organ' ? 'table-operator-tab-active' : ''"
|
||||
@click="switchChange('organ')">组织机构
|
||||
</a>
|
||||
<a class="switch-item" :class="switchValue === 'user' ? 'table-operator-tab-active' : ''"
|
||||
<a v-if="selectType === 'all' || selectType === 'user'" class="switch-item" :class="switchValue === 'user' ? 'table-operator-tab-active' : ''"
|
||||
@click="switchChange('user')">用户列表
|
||||
</a>
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@
|
||||
:scroll="{x: 500}"
|
||||
:data-source="dataSourceOrgan"
|
||||
:pagination="ipaginationOrgan"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeysOrgan, onChange: onSelectChangeOrgan, getCheckboxProps: getCheckboxPropsOrgan }"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeysOrgan, onChange: onSelectChangeOrgan, getCheckboxProps: getCheckboxPropsOrgan, type: type }"
|
||||
:loading="loadingLeft"
|
||||
@change="organLeftTableChange">
|
||||
</a-table>
|
||||
@@ -90,7 +90,7 @@
|
||||
:scroll="{x: 500}"
|
||||
:data-source="dataSourceUser"
|
||||
:pagination="ipaginationUser"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeysUser, onChange: onSelectChangeUser, getCheckboxProps: getCheckboxPropsUser }"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeysUser, onChange: onSelectChangeUser, getCheckboxProps: getCheckboxPropsUser, type: type }"
|
||||
:loading="loadingLeft"
|
||||
@change="userLeftTableChange">
|
||||
</a-table>
|
||||
@@ -139,6 +139,10 @@ export default {
|
||||
type: String,
|
||||
default: 'all'
|
||||
},
|
||||
type: { // 是单选还是多选
|
||||
type: String,
|
||||
default: 'radio'
|
||||
},
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
@@ -154,30 +158,45 @@ export default {
|
||||
immediate: true,
|
||||
handler (val) {
|
||||
if (this.selectType === 'all') {
|
||||
if (val.organ) {
|
||||
this.loadOrganRight(val.organ, () => {
|
||||
if (val.user) {
|
||||
this.loadUserRight(val.user, () => {
|
||||
this.$emit('change', this.dataSourceOrganRight, this.dataSourceUserRight)
|
||||
})
|
||||
} else {
|
||||
this.$emit('change', this.dataSourceOrganRight, [])
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.loadUserRight(val.user, () => {
|
||||
this.$emit('change', [], this.dataSourceUserRight)
|
||||
})
|
||||
if (val.organ && val.organ.length > 0) {
|
||||
this.dataSourceOrganRight = val.organ
|
||||
this.selectedRowKeysOrgan = val.organ.map(item => item.id)
|
||||
}
|
||||
} else if (this.selectType === 'organ') {
|
||||
this.loadOrganRight(val.organ, () => {
|
||||
this.$emit('change', this.dataSourceOrganRight)
|
||||
})
|
||||
} else if (this.selectType === 'user') {
|
||||
this.loadUserRight(val.user, () => {
|
||||
this.$emit('change', this.dataSourceUserRight)
|
||||
})
|
||||
if (val.user && val.user.length > 0) {
|
||||
this.dataSourceUserRight = val.user
|
||||
this.selectedRowKeysUser = val.user.map(item => item.id)
|
||||
}
|
||||
} else if (this.selectType === 'organ' && val.organ && val.organ.length > 0) {
|
||||
this.dataSourceOrganRight = val.organ
|
||||
this.selectedRowKeysOrgan = val.organ.map(item => item.id)
|
||||
} else if (this.selectType === 'user' && val.user && val.user.length > 0) {
|
||||
this.dataSourceUserRight = val.user
|
||||
this.selectedRowKeysUser = val.user.map(item => item.id)
|
||||
}
|
||||
// if (val.organ) {
|
||||
// this.loadOrganRight(val.organ, () => {
|
||||
// if (val.user) {
|
||||
// this.loadUserRight(val.user, () => {
|
||||
// this.$emit('change', this.dataSourceOrganRight, this.dataSourceUserRight)
|
||||
// })
|
||||
// } else {
|
||||
// this.$emit('change', this.dataSourceOrganRight, [])
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
// this.loadUserRight(val.user, () => {
|
||||
// this.$emit('change', [], this.dataSourceUserRight)
|
||||
// })
|
||||
// }
|
||||
// } else if (this.selectType === 'organ') {
|
||||
// this.loadOrganRight(val.organ, () => {
|
||||
// this.$emit('change', this.dataSourceOrganRight)
|
||||
// })
|
||||
// } else if (this.selectType === 'user') {
|
||||
// this.loadUserRight(val.user, () => {
|
||||
// this.$emit('change', this.dataSourceUserRight)
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -299,13 +318,19 @@ export default {
|
||||
],
|
||||
dataSourceUserRight: [],
|
||||
url: {
|
||||
organList: '',
|
||||
organList: '/sys/sysDepart/queryTreeList',
|
||||
userList: '/sys/user/page'
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.loadDataOrgan()
|
||||
mounted () {
|
||||
if (this.selectType === 'all' || this.selectType === 'organ') {
|
||||
this.switchValue = 'organ'
|
||||
this.loadDataOrgan()
|
||||
} else {
|
||||
this.switchValue = 'user'
|
||||
this.loadDataUser()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open () {
|
||||
@@ -348,12 +373,12 @@ export default {
|
||||
this.loadingLeft = true
|
||||
getAction(this.url.organList, params).then((res) => {
|
||||
if (res.success) {
|
||||
if (res.result.current > 1 && res.result.records.length === 0) {
|
||||
if (res.result.current > 1 && res.result.length === 0) {
|
||||
this.ipaginationOrgan.current = res.result.current - 1
|
||||
this.loadDataOrgan()
|
||||
return
|
||||
}
|
||||
this.dataSourceOrgan = res.result.records || []
|
||||
this.dataSourceOrgan = res.result || []
|
||||
this.ipaginationOrgan.total = res.result.total
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
@@ -385,19 +410,19 @@ export default {
|
||||
this.selectedRowKeysOrgan = this.selectedRowKeysOrgan.filter(item => item === record.id)
|
||||
},
|
||||
// 组织机构初始化右侧树列表
|
||||
loadOrganRight (ids, callback) {
|
||||
this.loadingRight = true
|
||||
getAction(this.url.organList, { ids: ids }).then((res) => {
|
||||
if (res.success) {
|
||||
this.dataSourceOrganRight = res.result.records || []
|
||||
callback && callback()
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loadingRight = false
|
||||
})
|
||||
},
|
||||
// loadOrganRight (ids, callback) {
|
||||
// this.loadingRight = true
|
||||
// getAction(this.url.organList, { ids: ids }).then((res) => {
|
||||
// if (res.success) {
|
||||
// this.dataSourceOrganRight = res.result.records || []
|
||||
// callback && callback()
|
||||
// } else {
|
||||
// this.$message.warn(res.message)
|
||||
// }
|
||||
// }).finally(() => {
|
||||
// this.loadingRight = false
|
||||
// })
|
||||
// },
|
||||
/**
|
||||
* 用户相关方法
|
||||
*/
|
||||
@@ -453,19 +478,19 @@ export default {
|
||||
this.selectedRowKeysUser = this.selectedRowKeysUser.filter(item => item === record.id)
|
||||
},
|
||||
// 用户初始化右侧树列表
|
||||
loadUserRight (ids, callback) {
|
||||
this.loadingRight = true
|
||||
getAction(this.url.userList, { ids: ids }).then((res) => {
|
||||
if (res.success) {
|
||||
this.dataSourceUserRight = res.result.records || []
|
||||
callback && callback()
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loadingRight = false
|
||||
})
|
||||
},
|
||||
// loadUserRight (ids, callback) {
|
||||
// this.loadingRight = true
|
||||
// getAction(this.url.userList, { ids: ids }).then((res) => {
|
||||
// if (res.success) {
|
||||
// this.dataSourceUserRight = res.result.records || []
|
||||
// callback && callback()
|
||||
// } else {
|
||||
// this.$message.warn(res.message)
|
||||
// }
|
||||
// }).finally(() => {
|
||||
// this.loadingRight = false
|
||||
// })
|
||||
// },
|
||||
handleOk () {
|
||||
if (this.selectType === 'all') {
|
||||
this.$emit('change', this.dataSourceOrganRight, this.dataSourceUserRight)
|
||||
@@ -487,10 +512,6 @@ export default {
|
||||
this.selectedRowKeysOrgan = []
|
||||
this.selectedRowKeysUser = []
|
||||
}
|
||||
},
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'change'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user