|
@@ -4,7 +4,7 @@
|
|
|
* @Autor: XuTongZhang
|
|
|
* @Date: 2020-07-28 16:00:46
|
|
|
* @LastEditors: XuTongZhang
|
|
|
- * @LastEditTime: 2020-08-07 14:22:57
|
|
|
+ * @LastEditTime: 2020-08-10 16:28:03
|
|
|
-->
|
|
|
<template>
|
|
|
<div class="indexPage">
|
|
@@ -20,7 +20,7 @@
|
|
|
></v-table>
|
|
|
<!-- :prop="'questionList.' + index + '.questionName'" -->
|
|
|
<v-pager @page="callPage" :total="totalrecords"></v-pager>
|
|
|
- <el-dialog :visible.sync="dialogFormVisible" width="660px" :before-close="close">
|
|
|
+ <el-dialog :visible.sync="dialogFormVisible" width="660px" :before-close="close" :close-on-click-modal="false">
|
|
|
<el-form :model="form" ref="form" label-width="140px" label-position="left">
|
|
|
<el-form-item label="流程名称" prop="processName" :rules="{
|
|
|
required: true, message: '问题不能为空', trigger: 'blur'
|
|
@@ -31,10 +31,10 @@
|
|
|
<el-form-item
|
|
|
v-for="(item, index) in form.questionList"
|
|
|
:label="'面试问题' + (index + 1)"
|
|
|
- :key="index"
|
|
|
+ :key="item.key"
|
|
|
:prop="'questionList.' + index"
|
|
|
:rules="{
|
|
|
- required: true, validator: validatePass, trigger: 'blur'
|
|
|
+ required: true, validator: validatePass, trigger: 'change'
|
|
|
}"
|
|
|
>
|
|
|
<div v-if="state!=2">
|
|
@@ -71,7 +71,7 @@
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="close">取 消</el-button>
|
|
|
<el-button @click="addDomain" type="success">新增</el-button>
|
|
|
- <el-button type="primary" v-if="state!==2" @click="determine">确 定</el-button>
|
|
|
+ <el-button type="primary" v-if="state!==2" @click="branch">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -81,11 +81,10 @@
|
|
|
export default {
|
|
|
data () {
|
|
|
let validatePass = function (rule, value, callback) {
|
|
|
- console.log(rule, value)
|
|
|
- if (!value.questionName.length) {
|
|
|
+ if (!value.questionName || !value.questionName.length) {
|
|
|
callback(new Error('请输入面试问题'))
|
|
|
} else {
|
|
|
- if (!value.videoIdList.length) {
|
|
|
+ if (!value.videoIdList || !value.videoIdList.length) {
|
|
|
callback(new Error('请选择面试视频'))
|
|
|
}
|
|
|
callback()
|
|
@@ -101,6 +100,7 @@ export default {
|
|
|
{ key: 1 }
|
|
|
]
|
|
|
},
|
|
|
+ info: {},
|
|
|
state: 0,
|
|
|
active: 0,
|
|
|
activeId: '',
|
|
@@ -187,7 +187,8 @@ export default {
|
|
|
})
|
|
|
.then((res) => {
|
|
|
this.open()
|
|
|
- this.form = res.object
|
|
|
+ this.form = JSON.parse(JSON.stringify(res.object))
|
|
|
+ this.info = res.object
|
|
|
})
|
|
|
},
|
|
|
details (row) {
|
|
@@ -223,6 +224,42 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ branch () {
|
|
|
+ if (this.state) {
|
|
|
+ this.uploadQuestion()
|
|
|
+ } else {
|
|
|
+ this.determine()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uploadQuestion () {
|
|
|
+ let a
|
|
|
+ this.$refs['form'].validate((valid) => {
|
|
|
+ a = valid
|
|
|
+ })
|
|
|
+ if (!a) return
|
|
|
+ let list = this.form.questionList.filter(item => !item.id)
|
|
|
+ let b = 0
|
|
|
+ list.length
|
|
|
+ ? list.forEach(item => {
|
|
|
+ let reqdata = item
|
|
|
+ reqdata.processId = this.form.id
|
|
|
+ this.$api
|
|
|
+ .post('/question/saveQuestion', {
|
|
|
+ reqdata
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ b++
|
|
|
+ item.id = res.object.id
|
|
|
+ // this.form.questionList[this.form.questionList.length - index - 1].id = res.object.id
|
|
|
+ console.log(this.form)
|
|
|
+ // console.log(b, num)
|
|
|
+ if (b === list.length) {
|
|
|
+ this.determine()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ : this.determine()
|
|
|
+ },
|
|
|
determine () {
|
|
|
let a
|
|
|
this.$refs['form'].validate((valid) => {
|
|
@@ -236,9 +273,9 @@ export default {
|
|
|
item.questionId = item.id
|
|
|
return item
|
|
|
})
|
|
|
- this.delId.forEach(item => {
|
|
|
- reqdata.questionList.push({ questionId: item })
|
|
|
- })
|
|
|
+ // this.delId.forEach(item => {
|
|
|
+ // reqdata.questionList.push({ questionId: item })
|
|
|
+ // })
|
|
|
}
|
|
|
this.$api
|
|
|
.post(url, {
|
|
@@ -264,6 +301,8 @@ export default {
|
|
|
this.dialogFormVisible = false
|
|
|
this.form = { processName: '', questionList: [] }
|
|
|
this.form.questionList.push({ key: 1, questionName: '' })
|
|
|
+ this.$forceUpdate()
|
|
|
+ console.log(this.form)
|
|
|
},
|
|
|
addDomain () {
|
|
|
this.form.questionList.push({
|