Просмотр исходного кода

新增题库、题目管理页面

cfort 2 лет назад
Родитель
Сommit
f49dff6622

+ 76 - 0
src/views/platform/examine/constants.js

@@ -0,0 +1,76 @@
+export const paperTypeOptions = [
+    {
+        label: '专业组考试',
+        value: '专业组考试'
+    },
+    {
+        label: '职能岗位考题',
+        value: '职能岗位考题'
+    },
+    {
+        label: 'ISO15189相关考试',
+        value: 'ISO15189相关考试'
+    },
+    {
+        label: '数学题库',
+        value: '数学题库'
+    }
+]
+
+export const questionType = [
+    {
+        label: '单选题',
+        value: '单选题'
+    },
+    {
+        label: '多选题',
+        value: '多选题'
+    },
+    {
+        label: '判断题',
+        value: '判断题'
+    },
+    {
+        label: '填空题',
+        value: '填空题'
+    },
+    {
+        label: '简答题',
+        value: '简答题'
+    }
+]
+
+export const rateType = {
+    '单选题': '自动',
+    '多选题': '自动',
+    '判断题': '自动',
+    '填空题': '手动',
+    '简答题': '手动'
+}
+
+export const defaultOptions = [
+    {
+        value: 'A',
+        radio: 'A',
+        checkbox: [],
+        content: ''
+    },
+    {
+        value: 'B',
+        radio: '',
+        checkbox: [],
+        content: ''
+    },
+    {
+        value: 'C',
+        radio: '',
+        checkbox: [],
+        content: ''
+    },
+    {
+        value: 'D',
+        radio: '',
+        checkbox: [],
+        content: ''
+    }
+]

+ 590 - 0
src/views/platform/examine/question/edit.vue

@@ -0,0 +1,590 @@
+<template>
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        append-to-body
+        width="60%"
+        class="dialog question-detail-dialog"
+        top="6vh"
+        @close="closeDialog"
+        @open="getQuestionData"
+    >
+        <el-form
+            ref="form"
+            :label-width="formLabelWidth"
+            :model="form"
+            :rules="rules"
+            class="question-form"
+            @submit.native.prevent
+        >
+            <div class="inline-item">
+                <el-form-item label="题型:" prop="ti_xing_">
+                    <el-select
+                        v-model="form.ti_xing_"
+                        filterable
+                        allow-create
+                        width="100%"
+                        placeholder="请选择题型"
+                        @change="changeQuestionType"
+                    >
+                        <el-option
+                            v-for="item in questionType"
+                            :key="item.value"
+                            :label="item.label"
+                            :value="item.value"
+                        />
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="出题人:" prop="chu_ti_ren_">
+                    <!-- <el-cascader v-model="form.chu_ti_ren_" :options="getRaterOptions(userList)" :show-all-levels="false" /> -->
+                    <el-select
+                        v-model="form.chu_ti_ren_"
+                        filterable
+                        allow-create
+                        width="100%"
+                        placeholder="请选择出题人"
+                    >
+                        <el-option
+                            v-for="item in getRaterOptions(userList)"
+                            :key="item.userId"
+                            :label="item.userName"
+                            :value="item.userId"
+                        />
+                    </el-select>
+                </el-form-item>
+            </div>
+            <div class="inline-item">
+                <el-form-item label="评分方式:" prop="ping_fen_fang_shi">
+                    <el-radio-group v-model="questionRateType" disabled>
+                        <el-radio-button label="自动">自动</el-radio-button>
+                        <el-radio-button label="手动">手动</el-radio-button>
+                    </el-radio-group>
+                </el-form-item>
+                <el-form-item v-if="questionRateType === '手动'" label="评分人:" prop="ping_fen_ren_">
+                    <!-- <el-cascader v-model="form.ping_fen_ren_" :options="getRaterOptions(userList)" :show-all-levels="false" /> -->
+                    <el-select
+                        v-model="form.ping_fen_ren_"
+                        filterable
+                        allow-create
+                        width="100%"
+                        placeholder="请选择评分人"
+                    >
+                        <el-option
+                            v-for="item in getRaterOptions(userList)"
+                            :key="item.userId"
+                            :label="item.userName"
+                            :value="item.userId"
+                        />
+                    </el-select>
+                </el-form-item>
+            </div>
+            <el-form-item label="题干:" prop="ti_gan_">
+                <el-input
+                    v-model="form.ti_gan_"
+                    type="textarea"
+                    :maxlength="512"
+                    :rows="2"
+                    placeholder="请输入题干内容"
+                />
+            </el-form-item>
+            <el-form-item label="附图:" prop="fu_tu_">
+                <ibps-image
+                    v-model="form.fu_tu_"
+                    height="100"
+                    width="100"
+                    accept=".jpg,.jpeg,.png,.gif,.bmp,.webp"
+                    multiple
+                    download
+                    size=""
+                    :disabled="false"
+                />
+            </el-form-item>
+            <div class="inline-item">
+                <el-form-item label="分值:" prop="fen_zhi_" :maxlength="8">
+                    <el-input-number
+                        v-model="form.fen_zhi_"
+                        :min="1"
+                        :max="100"
+                        :precision="0"
+                        type="number"
+                        placeholder="请输入题目分值"
+                    />
+                </el-form-item>
+                <el-form-item v-if="['单选题', '多选题'].includes(form.ti_xing_)" label="选项类型:" prop="xuan_xiang_lei_xi">
+                    <el-radio-group v-model="form.xuan_xiang_lei_xi" disabled>
+                        <el-radio-button label="文本">文本</el-radio-button>
+                        <el-radio-button label="图片">图片</el-radio-button>
+                    </el-radio-group>
+                </el-form-item>
+            </div>
+            <template v-if="['单选题', '多选题'].includes(form.ti_xing_)">
+                <el-form-item
+                    v-for="(item, index) in optionList"
+                    :key="`${item.value}${index}`"
+                    prop="da_an_"
+                    :label="`选项${item.value}:`"
+                    class="option-item"
+                >
+                    <el-input
+                        v-model="item.content"
+                        type="textarea"
+                        :rows="1"
+                        placeholder="请输入选项内容,最多可配置8个选项"
+                    />
+                    <el-radio-group v-if="form.ti_xing_ === '单选题'" v-model="item.radio">
+                        <el-radio :label="item.value" @change="changeRadio(index, item.value)">正确选项</el-radio>
+                    </el-radio-group>
+                    <el-checkbox-group v-else-if="form.ti_xing_ === '多选题'" v-model="item.checkbox">
+                        <el-checkbox :label="item.value">正确选项</el-checkbox>
+                    </el-checkbox-group>
+                    <div class="operate-btn">
+                        <el-button
+                            v-if="index === 0 && optionList.length < 8"
+                            type="primary"
+                            :tabindex="-1"
+                            icon="el-icon-plus"
+                            circle
+                            @click="addOption"
+                        />
+                        <el-button
+                            v-else-if="index === optionList.length - 1"
+                            type="danger"
+                            :tabindex="-1"
+                            icon="el-icon-delete"
+                            circle
+                            @click="subOption"
+                        />
+                    </div>
+                </el-form-item>
+            </template>
+            <template v-else-if="form.ti_xing_ === '填空题'">
+                <el-form-item
+                    v-for="(item, index) in optionList"
+                    :key="`${item.value}${index}`"
+                    prop=""
+                    :label="`答案${index + 1}:`"
+                    class="option-item"
+                >
+                    <el-input
+                        v-model="item.content"
+                        type="textarea"
+                        :rows="1"
+                        placeholder="请输入答案内容,最多可配置20个答案"
+                    />
+                    <div class="operate-btn">
+                        <el-button
+                            v-if="index === 0 && optionList.length < 20"
+                            type="primary"
+                            :tabindex="-1"
+                            icon="el-icon-plus"
+                            circle
+                            @click="addOption"
+                        />
+                        <el-button
+                            v-else-if="index === optionList.length - 1"
+                            type="danger"
+                            :tabindex="-1"
+                            icon="el-icon-delete"
+                            circle
+                            @click="subOption"
+                        />
+                    </div>
+                </el-form-item>
+            </template>
+            <template v-else-if="form.ti_xing_ === '判断题'">
+                <el-form-item prop="zheng_que_da_an_" label="答案:" required error="请选择正确答案">
+                    <el-radio-group v-model="form.zheng_que_da_an_">
+                        <el-radio-button label="√">√</el-radio-button>
+                        <el-radio-button label="×">×</el-radio-button>
+                    </el-radio-group>
+                </el-form-item>
+            </template>
+            <template v-else-if="form.ti_xing_ === '简答题'">
+                <el-form-item prop="zheng_que_da_an_" label="答案:" required error="请输入答案内容">
+                    <el-input
+                        v-model="form.zheng_que_da_an_"
+                        type="textarea"
+                        :rows="4"
+                        placeholder="请输入答案内容"
+                    />
+                </el-form-item>
+            </template>
+            <el-form-item label="备注:" prop="bei_zhu_">
+                <el-input v-model="form.bei_zhu_" type="textarea" :rows="2" placeholder="请输入题目备注信息" />
+            </el-form-item>
+        </el-form>
+        <div slot="footer" class="el-dialog--center">
+            <ibps-toolbar
+                :actions="toolbars"
+                @action-event="handleActionEvent"
+            />
+        </div>
+    </el-dialog>
+</template>
+
+<script>
+import ActionUtils from '@/utils/action'
+import { questionType, rateType, defaultOptions } from '../constants'
+export default {
+    components: {
+        IbpsImage: () => import('@/business/platform/file/image')
+    },
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        id: String,
+        parentId: String,
+        data: [Object, String]
+    },
+    data () {
+        const { userList = [], deptList = [], userId } = this.$store.getters || {}
+        const defaultType = questionType.length ? questionType[0].value : ''
+        return {
+            userList,
+            questionType,
+            rateType,
+            deptList: deptList.filter(i => i.depth === 4),
+            title: '添加题目',
+            formLabelWidth: '120px',
+            dialogVisible: this.visible,
+            dialogLoading: false,
+            filePreviewVisible: false,
+            form: {
+                // bu_men_: '',
+                parent_id_: this.parentId,
+                chu_ti_ren_: userId,
+                chu_ti_shi_jian_: this.$common.getDateNow(19),
+                ti_gan_: '',
+                ti_xing_: defaultType,
+                fu_tu_: '',
+                xuan_xiang_lei_xi: '文本',
+                da_an_: '',
+                zheng_que_da_an_: '',
+                ping_fen_fang_shi: rateType[defaultType] || '',
+                ping_fen_ren_: userId,
+                fen_zhi_: '',
+                bei_zhu_: ''
+            },
+            toolbars: [
+                {
+                    key: 'submit',
+                    icon: 'ibps-icon-save',
+                    label: '保存',
+                    hidden: () => {
+                        return this.readonly
+                    }
+                },
+                { key: 'cancel', label: '关闭' }
+            ],
+            rules: {
+                ti_gan_: [{ required: true, message: this.$t('validate.required') }],
+                ti_xing_: [{ required: true, message: this.$t('validate.required') }],
+                xuan_xiang_lei_xi: [{ required: true, message: this.$t('validate.required') }],
+                ping_fen_fang_shi: [{ required: true, message: this.$t('validate.required') }],
+                ping_fen_ren_: [{ required: true, message: this.$t('validate.required') }],
+                chu_ti_ren_: [{ required: true, message: this.$t('validate.required') }],
+                fen_zhi_: [{ required: true, message: this.$t('validate.required') }]
+            },
+            optionList: JSON.parse(JSON.stringify(defaultOptions))
+        }
+    },
+    computed: {
+        formData () {
+            return this.data
+        },
+        questionRateType () {
+            return this.rateType[this.form.ti_xing_] || ''
+        }
+    },
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                this.dialogVisible = this.visible
+            }
+            // immediate: true
+        }
+    },
+    created () {
+        this.getQuestionData()
+    },
+    methods: {
+        addOption () {
+            this.optionList.push({
+                value: String.fromCharCode(this.optionList[0].value.charCodeAt(0) + this.optionList.length),
+                radio: null,
+                checkbox: [],
+                content: ''
+            })
+        },
+        subOption () {
+            this.optionList.pop()
+        },
+        changeRadio (index, value) {
+            this.optionList.map(i => (i.radio = null))
+            this.optionList[index].radio = value
+        },
+        changeCheckbox (index, value) {
+            console.log(value)
+            // if (this.optionList[index].checkbox) {
+
+            // }
+            // this.optionList[index].checkbox = [value]
+        },
+        changeQuestionType (value) {
+            if (value === '填空题') {
+                this.optionList = [{
+                    value: 'A',
+                    radio: null,
+                    checkbox: [],
+                    content: ''
+                }]
+            } else {
+                this.optionList = JSON.parse(JSON.stringify(defaultOptions))
+            }
+            this.form.da_an_ = ''
+            this.form.zheng_que_da_an_ = ''
+            console.log(this.optionList)
+        },
+        getRaterOptions (list) {
+            const data = [
+                {
+                    value: '',
+                    label: '',
+                    children: [
+                        {
+                            value: '',
+                            label: ''
+                        },
+                        {
+                            value: '',
+                            label: ''
+                        }
+                    ]
+                },
+                {
+                    value: '',
+                    label: '',
+                    children: [
+                        {
+                            value: '',
+                            label: ''
+                        },
+                        {
+                            value: '',
+                            label: ''
+                        }
+                    ]
+                }
+            ]
+            return this.userList
+        },
+        handleActionEvent ({ key }) {
+            switch (key) {
+                case 'submit':
+                    this.handleSubmit()
+                    break
+                case 'cancel':
+                    this.closeDialog()
+                    break
+                default:
+                    break
+            }
+        },
+        // 获取题库数据
+        getQuestionData () {
+            if (this.$utils.isEmpty(this.id)) {
+                return
+            }
+            const sql = `select id_, bian_zhi_ren_, bian_zhi_bu_men_, bian_zhi_shi_jian, ti_gan_, ti_xing_, xuan_xiang_lei_xi, xian_kao_ci_shu_, ping_fen_ren_, bei_zhu_, suo_shu_fan_wei_ from t_question where id_ = '${this.id}'`
+            this.$common.request('sql', sql).then(res => {
+                const { data = [] } = res.variables || {}
+                if (!data.length) {
+                    this.$message.error('数据不存在')
+                    return
+                }
+                this.form = data[0]
+                this.form.isLimit = data[0].xian_kao_ci_shu_ === '不限' ? 0 : 1
+            })
+        },
+        handleSubmit () {
+            this.$refs.form.validate((valid) => {
+                if (valid) {
+                    // 表单验证通过,提交表单
+                    this.submitForm()
+                } else {
+                    ActionUtils.saveErrorMessage()
+                }
+            })
+        },
+        getSubmitData () {
+            let a1 = ''
+            const a2 = []
+            const a3 = []
+            const options = {}
+            this.optionList.forEach(item => {
+                options[item.value] = item.content
+                if (item.radio) {
+                    a1 = item.radio
+                }
+                if (item.checkbox && item.checkbox.length) {
+                    a2.push(item.checkbox[0])
+                }
+                a3.push(item.content)
+            })
+            this.form.ping_fen_fang_shi = this.questionRateType
+            switch (this.form.ti_xing_) {
+                case '单选题':
+                    this.form.ping_fen_ren_ = ''
+                    this.form.da_an_ = JSON.stringify(options)
+                    this.form.zheng_que_da_an_ = a1
+                    break
+                case '多选题':
+                    this.form.ping_fen_ren_ = ''
+                    this.form.da_an_ = JSON.stringify(options)
+                    this.form.zheng_que_da_an_ = a2.join(',')
+                    break
+                case '填空题':
+                    this.form.xuan_xiang_lei_xi = ''
+                    this.form.da_an_ = ''
+                    this.form.zheng_que_da_an_ = JSON.stringify(a3)
+                    break
+                case '判断题':
+                    this.form.ping_fen_ren_ = ''
+                    this.form.xuan_xiang_lei_xi = ''
+                    this.form.da_an_ = ''
+                    break
+                case '问答题':
+                    this.form.xuan_xiang_lei_xi = ''
+                    this.form.da_an_ = ''
+                    break
+            }
+        },
+        submitForm () {
+            this.getSubmitData()
+            console.log(this.form)
+            const addParams = {
+                tableName: 't_questions',
+                paramWhere: [this.form]
+            }
+            const updateParams = {
+                tableName: 't_questions',
+                updList: [
+                    {
+                        where: {
+                            id_: this.id
+                        },
+                        param: this.form
+                    }
+                ]
+            }
+            const type = this.id ? 'update' : 'add'
+            const params = type === 'add' ? addParams : updateParams
+            this.$common.request(type, params).then(() => {
+                this.$message.success(this.id ? '保存题目成功' : '添加题目成功')
+                this.updatePaper()
+                this.closeDialog()
+            })
+        },
+        updatePaper () {
+            const sql = `select fen_zhi_ from t_questions where parent_id_ = '${this.parentId}'`
+            this.$common.request('sql', sql).then(res => {
+                const { data = [] } = res.variables || {}
+                const params = {
+                    tableName: 't_question_bank',
+                    updList: [
+                        {
+                            where: {
+                                id_: this.parentId
+                            },
+                            param: {
+                                ti_shu_: data.length,
+                                zong_fen_: data.reduce((sum, item) => sum + parseInt(item.fen_zhi_), 0)
+                            }
+                        }
+                    ]
+                }
+                this.$common.request('update', params).then(() => {
+                    console.log('更新题库信息成功')
+                })
+            })
+        },
+        // 关闭当前窗口
+        closeDialog () {
+            this.$emit('close', false)
+        }
+    }
+}
+</script>
+<style lang="scss" scoped>
+    .question-detail-dialog {
+        ::v-deep {
+            .el-dialog__body {
+                height: calc(88vh - 200px);
+            }
+            .question-form > .el-form-item:first-child {
+                margin-top: 20px;
+            }
+            .el-form-item {
+                margin-bottom: 14px !important;
+                padding: 0 20px;
+            }
+            .el-form-item--small .el-form-item__error {
+                padding-top: 6px;
+            }
+            .el-radio-button__orig-radio {
+                &:disabled + .el-radio-button__inner {
+                    color: #606266;
+                }
+                &:disabled:checked + .el-radio-button__inner {
+                    color: #fff;
+                    background-color: #409EFF;
+                }
+            }
+        }
+        .ibps-image {
+            font-size: 0;
+            ::v-deep {
+                .el-upload--picture-card {
+                    font-size: 24px;
+                }
+            }
+        }
+        .inline-item {
+            display: flex;
+            .el-form-item {
+                flex: 1;
+                .el-select {
+                    width: 100%;
+                }
+            }
+        }
+        .option-item {
+            ::v-deep {
+                .el-form-item__content {
+                    display: flex;
+                    .el-input {
+                        flex: 1;
+                    }
+                    .el-radio-group, .el-checkbox-group {
+                        width: 100px;
+                        margin-left: 10px;
+                        line-height: 28px;
+                        .el-radio {
+                            line-height: 28px;
+                        }
+                    }
+                    .operate-btn {
+                        width: 32px;
+                        min-width: 32px;
+                        margin-left: 10px;
+                        line-height: 30px;
+                    }
+                }
+            }
+        }
+    }
+</style>

+ 0 - 0
src/views/platform/examine/questionBank/detail.vue


+ 309 - 0
src/views/platform/examine/questionBank/edit.vue

@@ -0,0 +1,309 @@
+<template>
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        append-to-body
+        width="60%"
+        class="dialog question-detail-dialog"
+        top="6vh"
+        @close="closeDialog"
+        @open="getQuestionData"
+    >
+        <el-form
+            ref="form"
+            :label-width="formLabelWidth"
+            :model="form"
+            :rules="rules"
+            class="question-form"
+            @submit.native.prevent
+        >
+            <el-form-item label="题库名称:" prop="ti_ku_ming_cheng_">
+                <el-input v-model="form.ti_ku_ming_cheng_" type="text" :maxlength="128" />
+            </el-form-item>
+            <el-form-item label="所属范围:" prop="suo_shu_fan_wei_">
+                <el-radio-group v-model="form.suo_shu_fan_wei_">
+                    <el-radio label="科级">科级</el-radio>
+                    <el-radio label="组级">组级</el-radio>
+                </el-radio-group>
+                <el-select
+                    v-if="form.suo_shu_fan_wei_ === '组级'"
+                    v-model="form.bian_zhi_bu_men_"
+                    width="100%"
+                    placeholder="请选择专业组"
+                >
+                    <el-option
+                        v-for="item in deptList"
+                        :key="item.positionId"
+                        :label="item.positionName"
+                        :value="item.positionId"
+                    />
+                </el-select>
+            </el-form-item>
+            <el-form-item label="题库分类:" prop="ti_ku_fen_lei_">
+                <el-select
+                    v-model="form.ti_ku_fen_lei_"
+                    filterable
+                    allow-create
+                    width="100%"
+                    placeholder="请选择题库分类"
+                >
+                    <el-option
+                        v-for="item in paperTypeOptions"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value"
+                    />
+                </el-select>
+            </el-form-item>
+            <el-form-item label="题库状态:" prop="ti_ku_zhuang_tai_">
+                <el-radio-group v-model="form.ti_ku_zhuang_tai_">
+                    <el-radio label="可用">可用</el-radio>
+                    <el-radio label="不可用">不可用</el-radio>
+                </el-radio-group>
+            </el-form-item>
+            <el-form-item label="限考次数:" prop="xian_kao_ci_shu_" :maxlength="16">
+                <el-radio-group v-model="form.isLimit" @change="changeLimit">
+                    <el-radio :label="0">不限</el-radio>
+                    <el-radio :label="1">限制</el-radio>
+                </el-radio-group>
+                <el-input-number
+                    v-if="form.isLimit"
+                    v-model="form.xian_kao_ci_shu_"
+                    :min="1"
+                    :precision="0"
+                    type="number"
+                    placeholder="请输入单个用户最大限考次数"
+                />
+            </el-form-item>
+            <el-form-item label="默认评分人:" prop="ping_fen_ren_">
+                <!-- <el-cascader v-model="form.ping_fen_ren_" :options="getRaterOptions(userList)" :show-all-levels="false" /> -->
+                <el-select
+                    v-model="form.ping_fen_ren_"
+                    filterable
+                    allow-create
+                    width="100%"
+                    placeholder="请选择默认评分人"
+                >
+                    <el-option
+                        v-for="item in getRaterOptions(userList)"
+                        :key="item.userId"
+                        :label="item.userName"
+                        :value="item.userId"
+                    />
+                </el-select>
+            </el-form-item>
+            <el-form-item label="题库描述:" prop="miao_shu_">
+                <el-input v-model="form.miao_shu_" type="textarea" :rows="4" placeholder="请输入描述内容" />
+            </el-form-item>
+        </el-form>
+        <div slot="footer" class="el-dialog--center">
+            <ibps-toolbar
+                :actions="toolbars"
+                @action-event="handleActionEvent"
+            />
+        </div>
+    </el-dialog>
+</template>
+
+<script>
+import ActionUtils from '@/utils/action'
+import { paperTypeOptions } from '../constants'
+export default {
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        id: String,
+        data: [Object, String]
+    },
+    data () {
+        const { userList = [], deptList = [], userId } = this.$store.getters || {}
+        return {
+            userList,
+            paperTypeOptions,
+            deptList: deptList.filter(i => i.depth === 4),
+            title: '创建题库',
+            formLabelWidth: '120px',
+            dialogVisible: this.visible,
+            dialogLoading: false,
+            filePreviewVisible: false,
+            form: {
+                bian_zhi_bu_men_: '',
+                bian_zhi_ren_: userId,
+                bian_zhi_shi_jian: this.$common.getDateNow(19),
+                ti_ku_ming_cheng_: '',
+                suo_shu_fan_wei_: '科级',
+                ti_ku_fen_lei_: paperTypeOptions.length ? paperTypeOptions[0].value : '',
+                ti_ku_zhuang_tai_: '可用',
+                xian_kao_ci_shu_: '不限',
+                ping_fen_ren_: '',
+                miao_shu_: '',
+                ti_shu_: 0,
+                isLimit: 0
+            },
+            toolbars: [
+                {
+                    key: 'submit',
+                    icon: 'ibps-icon-save',
+                    label: '保存',
+                    hidden: () => {
+                        return this.readonly
+                    }
+                },
+                { key: 'cancel', label: '关闭' }
+            ],
+            rules: {
+                ti_ku_ming_cheng_: [{ required: true, message: this.$t('validate.required') }],
+                suo_shu_fan_wei_: [{ required: true, message: this.$t('validate.required') }],
+                bian_zhi_bu_men_: [{ required: true, message: this.$t('validate.required') }],
+                ti_ku_fen_lei_: [{ required: true, message: this.$t('validate.required') }],
+                ti_ku_zhuang_tai_: [{ required: true, message: this.$t('validate.required') }],
+                xian_kao_ci_shu_: [{ required: true, message: this.$t('validate.required') }]
+            }
+
+        }
+    },
+    computed: {
+        formId () {
+            return this.id
+        },
+        formData () {
+            return this.data
+        }
+    },
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                this.dialogVisible = this.visible
+            }
+            // immediate: true
+        }
+    },
+    created () {
+        this.getQuestionData()
+    },
+    methods: {
+        changeLimit (e) {
+            this.form.xian_kao_ci_shu_ = e ? 1 : '不限'
+        },
+        getRaterOptions (list) {
+            const data = [
+                {
+                    value: '',
+                    label: '',
+                    children: [
+                        {
+                            value: '',
+                            label: ''
+                        },
+                        {
+                            value: '',
+                            label: ''
+                        }
+                    ]
+                },
+                {
+                    value: '',
+                    label: '',
+                    children: [
+                        {
+                            value: '',
+                            label: ''
+                        },
+                        {
+                            value: '',
+                            label: ''
+                        }
+                    ]
+                }
+            ]
+            return this.userList
+        },
+        handleActionEvent ({ key }) {
+            switch (key) {
+                case 'submit':
+                    this.handleSubmit()
+                    break
+                case 'cancel':
+                    this.closeDialog()
+                    break
+                default:
+                    break
+            }
+        },
+        // 获取题库数据
+        getQuestionData () {
+            if (this.$utils.isEmpty(this.formId)) {
+                return
+            }
+            const sql = `select id_, bian_zhi_ren_, bian_zhi_bu_men_, bian_zhi_shi_jian, ti_ku_ming_cheng_, ti_ku_fen_lei_, ti_ku_zhuang_tai_, xian_kao_ci_shu_, ping_fen_ren_, miao_shu_, suo_shu_fan_wei_ from t_question_bank where id_ = '${this.formId}'`
+            this.$common.request('sql', sql).then(res => {
+                const { data = [] } = res.variables || {}
+                if (!data.length) {
+                    this.$message.error('数据不存在')
+                    return
+                }
+                this.form = data[0]
+                this.form.isLimit = data[0].xian_kao_ci_shu_ === '不限' ? 0 : 1
+            })
+        },
+        handleSubmit () {
+            this.$refs.form.validate((valid) => {
+                if (valid) {
+                    // 表单验证通过,提交表单
+                    this.submitForm()
+                } else {
+                    ActionUtils.saveErrorMessage()
+                }
+            })
+        },
+        submitForm () {
+            delete this.form.isLimit
+            const addParams = {
+                tableName: 't_question_bank',
+                paramWhere: [this.form]
+            }
+            const updateParams = {
+                tableName: 't_question_bank',
+                updList: [
+                    {
+                        where: {
+                            id_: this.formId
+                        },
+                        param: this.form
+                    }
+                ]
+            }
+            const type = this.formId ? 'update' : 'add'
+            const params = type === 'add' ? addParams : updateParams
+            this.$common.request(type, params).then(() => {
+                this.$message.success(this.formId ? '保存题库成功' : '新增题库成功')
+                this.closeDialog()
+            })
+        },
+        // 关闭当前窗口
+        closeDialog () {
+            this.$emit('close', false)
+        }
+    }
+}
+</script>
+<style lang="scss" scoped>
+    .question-detail-dialog {
+        ::v-deep {
+            .el-dialog__body {
+                height: calc(88vh - 200px);
+            }
+            .el-form-item {
+                margin-bottom: 14px !important;
+                padding: 0 20px;
+            }
+            .el-form-item--small .el-form-item__error {
+                padding-top: 6px;
+            }
+        }
+    }
+</style>