feature: 选择人员组件添加id

This commit is contained in:
zyn
2023-12-28 10:44:17 +08:00
parent f7969b7d2a
commit 4c8d91a3e6
@@ -7,25 +7,29 @@
:clearable="clearable" :clearable="clearable"
:disabled="disabled" :disabled="disabled"
readonly readonly
@click.native="choice('role', placeholder, value)"> @click.native="choice('role', placeholder, value)"
></el-input> />
</el-form-item> </el-form-item>
<Role-tree <Role-tree
:is-title="choiceTitle" :is-title="choiceTitle"
:is-visible.sync="modalShowRoleFlag" :is-visible.sync="modalShowRoleFlag"
@checkedRole="checkedRole"
:nodeList="nodeList" :nodeList="nodeList"
></Role-tree> @checkedRole="checkedRole"
/>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "personFormItem", name: 'PersonFormItem',
props: { props: {
value: { value: {
required: true required: true
}, },
id: {
type: String,
default: ''
},
prop: { prop: {
type: String type: String
}, },
@@ -60,7 +64,7 @@ export default {
choice (type, title, nameId) { choice (type, title, nameId) {
this.nodeList = [] this.nodeList = []
if (nameId) { if (nameId) {
let nameId1 = nameId.split(',') const nameId1 = nameId.split(',')
let idList = [] let idList = []
nameId1.forEach(item => { nameId1.forEach(item => {
let a, b let a, b
@@ -87,9 +91,10 @@ export default {
nameList += item.name nameList += item.name
}) })
this.$emit('input', nameList) this.$emit('input', nameList)
this.$emit('update:id', idList)
this.$emit('change', { this.$emit('change', {
ids: this.unique(data.map(item => item.topUnitId)).join(","), ids: this.unique(data.map(item => item.topUnitId)).join(','),
names: this.unique(data.map(item => item.topUnit)).join(",") names: this.unique(data.map(item => item.topUnit)).join(',')
}) })
}, },
unique (newArr) { unique (newArr) {