修改选人组件

This commit is contained in:
sunFlower
2022-10-12 12:13:36 +08:00
parent c40f5f1b7f
commit 6686bd3b1c
11 changed files with 133 additions and 19 deletions
@@ -1,16 +1,33 @@
<template>
<div>
<div class="box-title-text" v-if="!isInput">
<a-input class="box-input" :value="value" @input="indexclick($event)"
:disabled="true"
:title="value"
:placeholder="$t('PleaseSelect')+query.db_field_txt"/>
<div class="itemModelStand-select" v-if="!isInput">
<a-select
class="itemModelStand-input"
:value="valueSelect"
@change="onChange"
mode="multiple"
:disabled="disabled"
:placeholder="$t('PleaseSelect')+query.db_field_txt"
:getPopupContainer="triggerNode=> triggerNode.parentNode">
<a-select-option
v-for="(item,index) in dictOptions"
:key="index"
:value="item.value">
<span class="itemOption" :title="item.title">
{{ item.title }}
</span>
</a-select-option>
</a-select>
<!-- <a-input class="box-input" :value="value" @input="indexclick($event)"-->
<!-- :disabled="true"-->
<!-- :title="value"-->
<!-- :placeholder="$t('PleaseSelect')+query.db_field_txt"/>-->
<a-button type="primary" class="button-box" :disabled="disabled" @click="standardClick">
{{this.$t('PersonnelSelection')}}
</a-button>
<a-button type="primary" v-if='isDelete' class="button-box" @click="standardDelete">
{{this.$t('delete')}}
</a-button>
<!-- <a-button type="primary" v-if='isDelete' class="button-box" @click="standardDelete">-->
<!-- {{this.$t('delete')}}-->
<!-- </a-button>-->
</div>
<div class="box-title-text" v-if="isInput">
<a-input :class="{'box-input':!isClass}" :value="value"
@@ -71,7 +88,6 @@
<a-button @click="handleSubmit" type="primary">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</div>
</template>
@@ -91,6 +107,8 @@
return {
loading: false,
gData: [],
valueSelect: [],
dictOptions: [],
autoExpandParent: false,
checkboxList: [],
expandedKeys: [],
@@ -111,7 +129,35 @@
}
},
mounted() {
this.valueSelect = []
this.dictOptions = []
setTimeout(() => {
if (this.value) {
let contentName = []
let contentId = []
if (this.personneQuery[this.query.db_field_name + 'Name']) {
contentName = this.personneQuery[this.query.db_field_name + 'Name'].split(',')
} else if (this.personneQuery[this.query.db_field_name]) {
contentName = this.personneQuery[this.query.db_field_name].split(',')
} else {
contentName = []
}
if (this.personneQuery[this.query.db_field_name + '_id']) {
contentId = this.personneQuery[this.query.db_field_name + '_id'].split(',')
} else if (this.personneQuery[this.query.db_field_name]) {
contentId = this.personneQuery[this.query.db_field_name].split(',')
} else {
contentId = []
}
contentId.forEach((res, index) => {
this.dictOptions.push({
value: res,
title: contentName[index]
})
this.valueSelect.push(res)
})
}
}, 600)
},
methods: {
// checkChange(val, checked, indeterminate) {
@@ -314,6 +360,28 @@
this.visible = false
this.treeVisible = false
},
onChange(value) {
this.valueSelect = value
console.log(this.valueSelect)
console.log(this.dictOptions)
this.userIds = []
this.userName = []
if (this.valueSelect && this.valueSelect.length > 0) {
value.forEach(res => {
this.dictOptions.forEach(val => {
if (res == val.value) {
this.userIds.push(val.value)
this.userName.push(val.title)
}
})
})
}
let userIds = JSON.parse(JSON.stringify(this.userIds))
let userName = JSON.parse(JSON.stringify(this.userName))
console.log(userIds)
this.$emit('input', userName.join(','))
this.$emit('change', this.query.db_field_name, userIds.join(','), this.query.subscript)
},
handleSubmit() {
// if (this.userIds && this.userIds.length > 0) {
if (this.isSingleChoice) {
@@ -330,6 +398,19 @@
// userIds = userIds.filter(function(item, index) {
// return userIds.indexOf(item) === index // 因为indexOf 只能查找到第一个
// })
if (!this.isInput) {
this.dictOptions = []
this.valueSelect = []
if (userIds && userIds.length > 0) {
userIds.forEach((res, index) => {
this.dictOptions.push({
title: userName[index],
value: res
})
this.valueSelect.push(res)
})
}
}
this.$emit('input', userName.join(','))
this.$emit('change', this.query.db_field_name, userIds.join(','), this.query.subscript)
this.visible = false
@@ -514,11 +595,18 @@
width: 100%;
}
.itemModelStand-input {
width: calc(100% - 100px);
display: inline-block;
height: 38px;
}
.button-box {
width: 90px;
margin-left: 10px;
height: 38px;
line-height: 38px;
float: right;
}
.drawer-bootom-button {
@@ -590,4 +678,18 @@
color: #21c9cc;
display: inline-block;
}
.itemOption {
display: inline-block;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
</style>
<style>
.itemModelStand-select .ant-select-dropdown--multiple {
display: none !important;
}
</style>
@@ -150,6 +150,7 @@
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<PersonnelSelection :query="item"
v-if="isFormInline"
:personneQuery="formInline"
@change="PersonnelSelectionChange"
:disabled="disabled"
@@ -34,6 +34,7 @@
</div>
<a-form-model-item class="itemModel" prop="chargePersonIdName">
<PersonnelSelection
v-if="visible"
:isSingleChoice="true"
:query="{db_field_name:'chargePersonId',db_field_txt:$t('personCharge')}"
:personneQuery="formInline"
@@ -94,7 +94,7 @@
<span class="Required">*</span>
<span class="title-text-text" :title="$t('authorizedUser')">{{$t('authorizedUser')}}</span>
</div>
<a-form-model-item class="itemModel" prop="studioEngineerName">
<a-form-model-item class="itemModel-multi" prop="studioEngineerName">
<PersonnelSelection :query="{db_field_name:'studioEngineer',db_field_txt:$t('authorizedUser')}"
:personneQuery="formInline"
@change="PersonnelSelectionChange"
@@ -255,7 +255,7 @@
<span class="Required" v-if="!disabled">*</span>
<span class="title-text-text" :title="$t('regulatoryContact')">{{$t('regulatoryContact')}}</span>
</div>
<a-form-model-item class="itemModel" prop="lawsContactName">
<a-form-model-item class="itemModel-multi" prop="lawsContactName">
<PersonnelSelection
:query="{db_field_name:'lawsContact',db_field_txt:$t('regulatoryContact')}"
:personneQuery="formInline"
@@ -155,6 +155,7 @@
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<PersonnelSelection :query="item"
v-if="visible"
:personneQuery="formInline"
@change="PersonnelSelectionChange"
:disabled="disabled"
+4 -2
View File
@@ -205,9 +205,10 @@
<span class="title-text-text"
:title="$t('Administrativeprivileges')">{{$t('Administrativeprivileges')}}</span>
</div>
<a-form-model-item class="itemModel" prop="authManageIdsName">
<a-form-model-item class="itemModel-multi" prop="authManageIdsName">
<PersonnelSelection class="box-input add-input"
:personneQuery="form"
v-if="menuRightVisible"
:selectDepartment="true"
:query="{db_field_name:'authManageIds',db_field_txt:$t('Administrativeprivileges')}"
@change="PersonnelSelectionChange"
@@ -223,9 +224,10 @@
<span class="title-text-text"
:title="$t('Checkthepermissions')">{{$t('Checkthepermissions')}}</span>
</div>
<a-form-model-item class="itemModel" prop="authViewIdsName">
<a-form-model-item class="itemModel-multi" prop="authViewIdsName">
<PersonnelSelection
class="box-input add-input"
v-if="menuRightVisible"
:selectDepartment="true"
:personneQuery="form"
:query="{db_field_name:'authViewIds',db_field_txt:$t('Checkthepermissions')}"
@@ -99,6 +99,7 @@
<PersonnelSelection
:query="{db_field_name:'userId',db_field_txt:$t('engineer')}"
:personneQuery="formInline"
v-if="visible"
:distributionEngineerList="distributionEngineerList"
@change="PersonnelSelectionChange"
v-model="formInline.userIdName"/>
@@ -93,10 +93,11 @@
<span class="Required">*</span>
<span class="title-text-text" :title="$t('StudioEngineer')">{{$t('StudioEngineer')}}</span>
</div>
<a-form-model-item class="itemModel" :prop="'studioEngineerName'">
<a-form-model-item class="itemModel-multi" :prop="'studioEngineerName'">
<PersonnelSelection :query="{db_field_name:'studioEngineer',db_field_txt:$t('StudioEngineer')}"
:isSingleChoice="true"
:personneQuery="formInline"
v-if="visible"
@change="PersonnelSelectionChange"
:disabled="disabled"
v-model="formInline.studioEngineerName"/>
@@ -108,10 +109,11 @@
<div class="title-text">
<span class="title-text-text" :title="$t('certifiedEngineer')">{{$t('certifiedEngineer')}}</span>
</div>
<a-form-model-item class="itemModel" :prop="'certificationEngineerName'">
<a-form-model-item class="itemModel-multi" :prop="'certificationEngineerName'">
<PersonnelSelection
:query="{db_field_name:'certificationEngineer',db_field_txt:$t('certifiedEngineer')}"
:personneQuery="formInline"
v-if="visible"
@change="PersonnelSelectionChange"
:disabled="disabled"
v-model="formInline.certificationEngineerName"/>
@@ -176,8 +176,9 @@
<span class="title-text-text" :title="$t('regulatoryEngineer')">{{$t('regulatoryEngineer')}}</span>
</div>
<!-- :prop="'lawEngineerName'"-->
<a-form-model-item class="itemModel">
<a-form-model-item class="itemModel-multi">
<PersonnelSelection
v-if="editVisible"
:query="{db_field_name:'lawEngineer',db_field_txt:$t('regulatoryEngineer')}"
:personneQuery="formInline"
:isDelete='true'
@@ -196,8 +197,9 @@
<span class="title-text-text" :title="$t('engineeringInterfacePerson')">{{$t('engineeringInterfacePerson')}}</span>
</div>
<!-- :prop="'engineeringInterfacePersonName'"-->
<a-form-model-item class="itemModel">
<a-form-model-item class="itemModel-multi">
<PersonnelSelection
v-if="editVisible"
:query="{db_field_name:'engineeringInterfacePerson',db_field_txt:$t('engineeringInterfacePerson')}"
:personneQuery="formInline"
:isDelete='true'
@@ -20,6 +20,7 @@
<PersonnelSelection
:query="{db_field_name:'lawEngineer',db_field_txt:$t('regulatoryEngineer')}"
:personneQuery="formInline"
v-if="visible"
@change="PersonnelSelectionChange"
v-model="formInline.lawEngineerName"/>
</a-form-model-item>
@@ -36,6 +37,7 @@
<PersonnelSelection
:query="{db_field_name:'engineeringInterfacePerson',db_field_txt:$t('engineeringInterfacePerson')}"
:personneQuery="formInline"
v-if="visible"
@change="PersonnelSelectionChange"
v-model="formInline.engineeringInterfacePersonName"/>
</a-form-model-item>