|
|
@@ -19,6 +19,7 @@
|
|
|
<!-- 搜索框 -->
|
|
|
<van-search
|
|
|
v-model="search"
|
|
|
+ :disabled="currentOrgIdValue===''?false:$store.getters.isSuper?false:!isUseScope"
|
|
|
:placeholder="searchPlaceholder"
|
|
|
show-action
|
|
|
@search="onSearch"
|
|
|
@@ -164,9 +165,9 @@
|
|
|
/>
|
|
|
<!--左树-->
|
|
|
<tree-popup
|
|
|
+ ref="elTree"
|
|
|
:visible="treeVisible"
|
|
|
:range.sync="partyType"
|
|
|
-
|
|
|
:script="script"
|
|
|
:is-use-scope="isUseScope"
|
|
|
:party-type-id="partyTypeId"
|
|
|
@@ -182,7 +183,9 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { query } from '@/api/platform/org/user'
|
|
|
+import { queryWoutOrg, queryPageList, queryWithOrg4Position } from '@/api/platform/org/employee'
|
|
|
import { get as getUserById } from '@/api/platform/org/employee'
|
|
|
+import panelTree from './popup-tree/mixins/otherTreeEven'
|
|
|
// import { getScriptValue as getTreeDataByScriptValue } from '@/api/platform/form/common'
|
|
|
import ActionUtils from '@/utils/action'
|
|
|
import i18n from '@/utils/i18n' // Internationalization 国际化
|
|
|
@@ -201,6 +204,7 @@ export default {
|
|
|
IbpsMoreSearch,
|
|
|
TreePopup
|
|
|
},
|
|
|
+ mixins: [panelTree],
|
|
|
props: {
|
|
|
showPopup: Boolean,
|
|
|
multiple: Boolean,
|
|
|
@@ -241,6 +245,7 @@ export default {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
+ seetingSearchPartyType: String, // 设置查询用户类型
|
|
|
partyTypeScope: String,
|
|
|
script: String,
|
|
|
partyTypeId: [String, Number],
|
|
|
@@ -252,13 +257,20 @@ export default {
|
|
|
|
|
|
},
|
|
|
data() {
|
|
|
+ const { first = '', second = '' } = this.$store.getters.level
|
|
|
+ const { isSuper = false } = this.$store.getters
|
|
|
+ let level = second || first
|
|
|
+ if (isSuper) {
|
|
|
+ level = null
|
|
|
+ }
|
|
|
return {
|
|
|
+ level,
|
|
|
search: '',
|
|
|
partyId: '',
|
|
|
moreParams: {},
|
|
|
moreSearchPopup: false,
|
|
|
treeVisible: false,
|
|
|
- partyType: 'org',
|
|
|
+ partyType: 'position',
|
|
|
|
|
|
listData: [],
|
|
|
pagination: {},
|
|
|
@@ -276,10 +288,11 @@ export default {
|
|
|
searchForms: {
|
|
|
forms: [
|
|
|
{ prop: 'Q^ACCOUNT_^SL', label: '账号' },
|
|
|
- { prop: 'Q^EMAIL_^SL', label: '邮箱' },
|
|
|
- { prop: 'Q^WC_ACCOUNT_^SL', label: '微信账户' },
|
|
|
- { prop: 'Q^QQ_^SL', label: 'QQ' },
|
|
|
- { prop: 'Q^MOBILE_^SL', label: '电话' },
|
|
|
+ // { prop: 'Q^PARTY_ALIAS_^SL', label: ''}
|
|
|
+ // { prop: 'Q^EMAIL_^SL', label: '邮箱' },
|
|
|
+ // { prop: 'Q^WC_ACCOUNT_^SL', label: '微信账户' },
|
|
|
+ // { prop: 'Q^QQ_^SL', label: 'QQ' },
|
|
|
+ // { prop: 'Q^MOBILE_^SL', label: '电话' },
|
|
|
{
|
|
|
prop: 'Q^GENDER_^S',
|
|
|
label: '性别',
|
|
|
@@ -296,7 +309,10 @@ export default {
|
|
|
initPage: false,
|
|
|
showSelectorPopup: false,
|
|
|
showDetailPopup: false,
|
|
|
-
|
|
|
+ partyTypeIdValue: '',
|
|
|
+ currentOrgIdValue: '',
|
|
|
+ scriptValue: '',
|
|
|
+ moreSearchParams: {},
|
|
|
currentFilterOption: []
|
|
|
|
|
|
}
|
|
|
@@ -311,7 +327,8 @@ export default {
|
|
|
return ''
|
|
|
}
|
|
|
const checked = this.checkbox[0]
|
|
|
- return this.$utils.isNotEmpty(checked) ? this.cacheData[checked] ? this.cacheData[checked][this.labelKey] : '' : ''
|
|
|
+ const cuser = this.listData.find(i => i.id === checked)
|
|
|
+ return this.$utils.isNotEmpty(checked) ? this.cacheData[checked] ? this.cacheData[checked][this.labelKey] ? this.cacheData[checked][this.labelKey] : '' : cuser.name : ''
|
|
|
}
|
|
|
},
|
|
|
selectedData() {
|
|
|
@@ -322,6 +339,16 @@ export default {
|
|
|
listDatas() {
|
|
|
return this.listData
|
|
|
}
|
|
|
+ // changeParams() {
|
|
|
+ // const { partyTypeId, currentOrgId, isUseScope, script, partyTypeScope } = this
|
|
|
+ // return {
|
|
|
+ // partyTypeId,
|
|
|
+ // currentOrgId,
|
|
|
+ // isUseScope,
|
|
|
+ // script,
|
|
|
+ // partyTypeScope
|
|
|
+ // }
|
|
|
+ // }
|
|
|
},
|
|
|
watch: {
|
|
|
value(val, oldVal) {
|
|
|
@@ -413,48 +440,108 @@ export default {
|
|
|
*/
|
|
|
loadData() {
|
|
|
this.loading = true
|
|
|
- const partyType = this.partyType
|
|
|
- query(partyType, this.getFormatParams()).then(response => {
|
|
|
- ActionUtils.handleListData(this, response.data)
|
|
|
- // 缓存
|
|
|
- if (this.$utils.isNotEmpty(this.listData)) {
|
|
|
- this.listData.forEach((d) => {
|
|
|
- this.cacheData[d[this.valueKey]] = d
|
|
|
- })
|
|
|
+ let type = this.partyType
|
|
|
+ // query(partyType, this.getFormatParams()).then(response => {
|
|
|
+ // ActionUtils.handleListData(this, response.data)
|
|
|
+ // console.log(response.data, 'response.dataresponse.dataresponse.data')
|
|
|
+ // // 缓存
|
|
|
+ // if (this.$utils.isNotEmpty(this.listData
|
|
|
+ // this.listData.forEach((d) => {
|
|
|
+ // this.cacheData[d[this.valueKey]] = d
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }).catch((e) => {
|
|
|
+ // ActionUtils.handleErrorData(this, e)
|
|
|
+ // })
|
|
|
+ console.log(this.treeVisible, '|', this.partyType, '|', this.partyId, '|', this.isUseScope, '|', this.currentOrgIdValue, '|', this.partyTypeIdValue, '|', this.seetingSearchPartyType, 'dddddddddddddd')
|
|
|
+ if (!this.treeVisible) {
|
|
|
+ if (this.$utils.isNotEmpty(this.partyId) || this.isUseScope) {
|
|
|
+ type = this.partyType
|
|
|
+ } else if (this.currentOrgIdValue && this.currentOrgIdValue !== '') {
|
|
|
+ type = 'org'
|
|
|
}
|
|
|
- }).catch((e) => {
|
|
|
- ActionUtils.handleErrorData(this, e)
|
|
|
- })
|
|
|
+ let flag = 0
|
|
|
+ if (type === 'position' && !this.partyId && this.partyTypeIdValue === '1') {
|
|
|
+ type = 'user'
|
|
|
+ flag = '1'
|
|
|
+ }
|
|
|
+ query(type, this.getFormatParams(flag)).then(response => {
|
|
|
+ this.loading = false
|
|
|
+ ActionUtils.handleListData(this, response.data)
|
|
|
+ this.setSelectRow()
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ } else if (this.seetingSearchPartyType === 'position') {
|
|
|
+ queryWithOrg4Position(this.getFormatParams()).then(response => {
|
|
|
+ this.loading = false
|
|
|
+ ActionUtils.handleListData(this, response.data)
|
|
|
+ this.setSelectRow()
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ } else if (this.$utils.isNotEmpty(this.currentOrgIdValue)) {
|
|
|
+ queryWoutOrg(this.getFormatParams()).then(response => {
|
|
|
+ this.loading = false
|
|
|
+ ActionUtils.handleListData(this, response.data)
|
|
|
+ this.setSelectRow()
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ queryPageList(this.getFormatParams('1')).then(response => {
|
|
|
+ this.loading = false
|
|
|
+ ActionUtils.handleListData(this, response.data)
|
|
|
+ this.setSelectRow()
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* 获取查询条件格式化参数
|
|
|
*/
|
|
|
- getFormatParams() {
|
|
|
- const params = {}
|
|
|
- const key = this.partyType === 'org' ? 'orgId'
|
|
|
- : this.partyType === 'position' ? 'positionId'
|
|
|
- : this.partyType === 'role' ? 'roleId'
|
|
|
- : this.partyType === 'group' ? 'groupId' : ''
|
|
|
-
|
|
|
- if (this.$utils.isNotEmpty(this.partyId) || this.currentOrgId !== '') {
|
|
|
- if (this.partyId !== 0 && this.partyId !== '0') {
|
|
|
- params[key] = this.partyId === '' ? this.currentOrgId : this.partyId
|
|
|
+ getFormatParams(flag = '0') {
|
|
|
+ const storeGetters = this.$store.getters
|
|
|
+ const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
|
|
|
+ const key = this.partyType === 'org' ? 'orgId' : this.partyType === 'position' ? 'positionId' : this.partyType === 'role' ? 'roleId' : this.partyType === 'group' ? 'groupId' : ''
|
|
|
+ const deptLists = storeGetters.deptList.map((m) => {
|
|
|
+ return m.positionId
|
|
|
+ })
|
|
|
+ if (!this.treeVisible) {
|
|
|
+ if (this.$utils.isNotEmpty(this.partyId) || this.currentOrgIdValue !== '') {
|
|
|
+ if (this.partyId !== 0 && this.partyId !== '0') {
|
|
|
+ params[key] = this.partyId === '' ? this.currentOrgIdValue : this.partyId
|
|
|
+ }
|
|
|
+ if (!this.partyId && this.partyTypeId === '2' && this.partyType === 'position') {
|
|
|
+ const position = storeGetters.userInfo.employee.positions
|
|
|
+ params.positionId = position
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.partyType === 'position') {
|
|
|
+ params[key] = this.partyTypeId ? (this.partyTypeId === '1' ? '' : this.partyTypeId) : deptLists.join(',')
|
|
|
+ } else {
|
|
|
+ params[key] = this.partyTypeId === '1' ? '' : this.partyTypeId
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- params[key] = this.partyTypeId === '1' ? '' : this.partyTypeId
|
|
|
}
|
|
|
- if (this.$utils.isNotEmpty(this.search)) {
|
|
|
- params['Q^FULL_NAME_^SL'] = this.search
|
|
|
+ if (this.seetingSearchPartyType === 'position') {
|
|
|
+ params['positionId'] = this.partyTypeId
|
|
|
}
|
|
|
-
|
|
|
- if (this.moreParams) {
|
|
|
- Object.assign(params, this.moreParams)
|
|
|
+ if (this.moreSearchParams && Object.keys(this.moreSearchParams).length !== 0) {
|
|
|
+ Object.assign(params, this.moreSearchParams)
|
|
|
}
|
|
|
-
|
|
|
- return ActionUtils.formatParams(
|
|
|
- params,
|
|
|
- this.pagination,
|
|
|
- this.sorts)
|
|
|
+ // if (this.$utils.isNotEmpty(this.currentOrgId)) {
|
|
|
+ // params['orgId'] = this.partyId || this.currentOrgId
|
|
|
+ // }
|
|
|
+ const res = ActionUtils.formatParams(params, this.pagination, this.sorts)
|
|
|
+ // 数据过滤
|
|
|
+ if (this.level && (flag === '1' || this.partyType === 'role')) {
|
|
|
+ res.customs = {
|
|
|
+ position: this.level
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res
|
|
|
},
|
|
|
/**
|
|
|
* 下拉刷新
|
|
|
@@ -470,6 +557,12 @@ export default {
|
|
|
*/
|
|
|
onSearch() {
|
|
|
this.stateActive = false
|
|
|
+ this.moreSearchParams = this.search === '' ? {} : { 'Q^NAME_^SL': this.search }
|
|
|
+ if (this.moreParams && Object.keys(this.moreParams).length !== 0) {
|
|
|
+ Object.keys(this.moreParams).forEach(key => {
|
|
|
+ this.moreSearchParams[key] = this.moreParams[key]
|
|
|
+ })
|
|
|
+ }
|
|
|
ActionUtils.initListData(this)
|
|
|
this.loadData()
|
|
|
},
|
|
|
@@ -478,6 +571,7 @@ export default {
|
|
|
*/
|
|
|
onMoreSearch(params) {
|
|
|
this.moreParams = params
|
|
|
+ console.log(params, '.....params,,,,,')
|
|
|
this.onSearch()
|
|
|
if (this.$utils.isNotEmpty(params)) {
|
|
|
this.stateActive = true
|
|
|
@@ -504,6 +598,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
toggle(data, index) {
|
|
|
+ console.log(this.multiple, '2222222222')
|
|
|
if (!this.multiple) {
|
|
|
this.$refs.checkboxGroup.toggleAll(false)
|
|
|
}
|
|
|
@@ -537,7 +632,10 @@ export default {
|
|
|
this.$emit('cancel')
|
|
|
},
|
|
|
onConfirm() {
|
|
|
- const data = this.multiple ? this.checkbox : [this.radio]
|
|
|
+ // const data = this.multiple ? this.checkbox : [this.radio]
|
|
|
+ const data = this.checkbox
|
|
|
+
|
|
|
+ console.log(this.multiple, this.listData, this.checkbox, data, this.radio, 'this.multiplethis.multiple')
|
|
|
const arr = []
|
|
|
if (this.multiple) {
|
|
|
for (let i = 0; i < this.listData.length; i++) {
|
|
|
@@ -550,11 +648,12 @@ export default {
|
|
|
}
|
|
|
} else {
|
|
|
for (let j = 0; j < this.listData.length; j++) {
|
|
|
- if (this.listData[j].id === this.radio) {
|
|
|
+ if (data.length > 0 && this.listData[j].id === data[0]) {
|
|
|
arr.push(this.listData[j])
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
+ console.log(arr, 'arrrrrrrr')
|
|
|
}
|
|
|
this.$emit('confirm', arr)
|
|
|
this.$emit('callbackData', arr)
|