lxp
2025-03-12 952a20f1c005d80e9bf881287c40e6f4e4266a0b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<template>
    <el-form :model="form" label-width="200px" style="position: relative;" :disabled="disabled" size="small">
        <el-card :body-style="{ height: '350px', overflow: 'auto' }">
            <el-form-item label="责任部门">
                <el-select v-model="form.responsibleDepartmentId" placeholder="请选择" @change="filterUserList">
                    <el-option label="通信产品实验室" :value="18"></el-option>
                    <el-option label="电力产品实验室" :value="19"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="责任人">
                <el-select v-model="form.responsibleDepartmentPersonId" placeholder="请选择">
                    <el-option v-for="(item, index) in userListTwo" :key="index" :label="item.name"
                        :value="item.id"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="消除不符合工作所采取的措施">
                <el-input v-model="form.treatmentMeasures" type="textarea" :rows="2" placeholder="请输入内容"></el-input>
            </el-form-item>
        </el-card>
        <el-form-item v-if="step == 2" label-width="0px" :disabled="disabled">
            <div style=" display: flex; width: 100%; justify-content: space-between; margin-top: 15px;">
                <div>
                    操作人:{{ currentResponsible }}
                </div>
                <div>
                    <el-button @click="cancel">驳回</el-button>
                    <el-button type="primary" @click="onSubmit"
                        :disabled="(departId == 18 && ![12, 10, 16].includes(userId)) || (departId == 19 && ![35, 41, 16].includes(userId))">提交</el-button>
                </div>
            </div>
        </el-form-item>
    </el-form>
</template>
<script>
import { mapGetters } from "vuex";
export default {
    props: {
        departId: {
            type: Number,
            default: () => {
                return null;
            }
        },
        isPermission: {
            type: Boolean,
            default: false,
        },
        currentResponsible: {
            type: String,
            default: ''
        },
        disabled: {
            type: Boolean,
            default: false
        },
        userList: {
            type: Array,
            default: []
        },
        step: {
            type: Number,
            default: 0
        },
        handleForm: {
            type: Object,
            default: () => {
                return {}
            }
        }
    },
    computed: {
        form: {
            get() {
                return this.handleForm
            },
            set(val) {
                this.$emit('update:handleForm', val)
            }
        },
        ...mapGetters(["userId"]),
    },
    data() {
        return {
            userListTwo: []
        }
    },
    mounted() {
        this.userListTwo = JSON.parse(JSON.stringify(this.userList))
    },
    created() {
    },
    methods: {
        filterUserList() {
            this.userListTwo = this.userList.filter(item => item.departLimsId.includes(this.form.responsibleDepartmentId))
            if (!this.userListTwo.some(item => item.id == this.form.responsibleDepartmentPersonId)) {
                this.form.responsibleDepartmentPersonId = null
            }
        },
        onSubmit() {
            this.$emit('nextStep', 'submit')
        },
        save() {
            this.$emit('nextStep', 'save')
        },
        cancel() {
            this.$emit('cancel', 'cancel')
        }
    }
}
</script>