123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <el-dialog :title="title" :visible="visible" width="320px" :append-to-body="true" @close="dialogClose">
- <el-select v-model="user[bindKey]" :placeholder="placeholder" :multiple="isMultiple">
- <el-option v-for="item in memberList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- <div slot="footer">
- <el-button @click="dialogClose">取消</el-button>
- <el-button type="primary" @click="addChapterNode">确定</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- export default {
- name: 'SetUser',
- props: {
- visible: {
- type: Boolean,
- required: true,
- },
- id: {
- type: String,
- default: '',
- },
- memberList: {
- type: Array,
- required: true,
- },
- type: {
- type: String,
- default: 'producer',
- },
- },
- data() {
- return {
- user: {
- id_list: [],
- id: '',
- },
- typeList: [
- { type: 'producer', label: '设置制作人', placeholder: '请选择制作人', bindKey: 'id_list', isMultiple: true },
- { type: 'auditor', label: '设置审校人', placeholder: '请选择审校人', bindKey: 'id_list', isMultiple: true },
- { type: 'mainAuditor', label: '设置主审校人', placeholder: '请选择主审校人', bindKey: 'id', isMultiple: false },
- ],
- };
- },
- computed: {
- title() {
- return this.typeList.find((item) => item.type === this.type).label;
- },
- placeholder() {
- return this.typeList.find((item) => item.type === this.type).placeholder;
- },
- isMultiple() {
- return this.typeList.find((item) => item.type === this.type).isMultiple;
- },
- bindKey() {
- return this.typeList.find((item) => item.type === this.type).bindKey;
- },
- },
- methods: {
- dialogClose() {
- this.$emit('update:visible', false);
- this.user = {
- id_list: [],
- id: '',
- };
- },
- addChapterNode() {
- if (this.type === this.typeList[0].type) {
- this.$emit('chapterSetProducer', { node_id: this.id, producer_id_list: this.user.id_list });
- }
- if (this.type === this.typeList[1].type) {
- this.$emit('SetAuditor', { flow_node_id: this.id, user_id_list: this.user.id_list });
- }
- if (this.type === this.typeList[2].type) {
- this.$emit('SetMainAuditor', { flow_node_id: this.id, user_id: this.user.id });
- }
- this.dialogClose();
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .el-select {
- width: 100%;
- }
- </style>
|