feature: 选择人员组件添加id
This commit is contained in:
@@ -2,30 +2,34 @@
|
||||
<div>
|
||||
<el-form-item :label="label" :prop="prop" class="add-form-item form-item-disabled">
|
||||
<el-input
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
:clearable="clearable"
|
||||
:disabled="disabled"
|
||||
readonly
|
||||
@click.native="choice('role', placeholder, value)">
|
||||
></el-input>
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
:clearable="clearable"
|
||||
:disabled="disabled"
|
||||
readonly
|
||||
@click.native="choice('role', placeholder, value)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<Role-tree
|
||||
:is-title="choiceTitle"
|
||||
:is-visible.sync="modalShowRoleFlag"
|
||||
@checkedRole="checkedRole"
|
||||
:nodeList="nodeList"
|
||||
></Role-tree>
|
||||
:is-title="choiceTitle"
|
||||
:is-visible.sync="modalShowRoleFlag"
|
||||
:nodeList="nodeList"
|
||||
@checkedRole="checkedRole"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "personFormItem",
|
||||
name: 'PersonFormItem',
|
||||
props: {
|
||||
value: {
|
||||
required: true
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
prop: {
|
||||
type: String
|
||||
},
|
||||
@@ -57,14 +61,14 @@ export default {
|
||||
handleChange (event) {
|
||||
this.$emit('input', event)
|
||||
},
|
||||
choice(type, title, nameId) {
|
||||
choice (type, title, nameId) {
|
||||
this.nodeList = []
|
||||
if (nameId) {
|
||||
let nameId1 = nameId.split(',')
|
||||
const nameId1 = nameId.split(',')
|
||||
let idList = []
|
||||
nameId1.forEach(item => {
|
||||
let a, b
|
||||
a = item.substring(item.indexOf('(') +1)
|
||||
a = item.substring(item.indexOf('(') + 1)
|
||||
b = a.substring(0, a.lastIndexOf(')'))
|
||||
idList.push(b)
|
||||
})
|
||||
@@ -75,7 +79,7 @@ export default {
|
||||
this.choiceTitle = title
|
||||
this.modalShowRoleFlag = true
|
||||
},
|
||||
checkedRole(data) {
|
||||
checkedRole (data) {
|
||||
let idList = ''
|
||||
let nameList = ''
|
||||
data.forEach(item => {
|
||||
@@ -87,12 +91,13 @@ export default {
|
||||
nameList += item.name
|
||||
})
|
||||
this.$emit('input', nameList)
|
||||
this.$emit('update:id', idList)
|
||||
this.$emit('change', {
|
||||
ids: this.unique(data.map(item => item.topUnitId)).join(","),
|
||||
names: this.unique(data.map(item => item.topUnit)).join(",")
|
||||
ids: this.unique(data.map(item => item.topUnitId)).join(','),
|
||||
names: this.unique(data.map(item => item.topUnit)).join(',')
|
||||
})
|
||||
},
|
||||
unique(newArr) {
|
||||
unique (newArr) {
|
||||
const res = new Map();
|
||||
return newArr.filter((newArr) => !res.has(newArr) && res.set(newArr, 1));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user