lion 2 years ago
parent a14f0a1a88
commit dd523602ea

@ -2,5 +2,5 @@
ENV = 'production' ENV = 'production'
# base api # base api
VUE_APP_BASE_API = https://suzhoukeji-test.ali251.langye.net VUE_APP_BASE_API = https://wx.sstbc.com
VUE_APP_UPLOAD_API = https://suzhoukeji-test.ali251.langye.net/api/admin/upload-file VUE_APP_UPLOAD_API = https://wx.sstbc.com/api/admin/upload-file

@ -55,8 +55,8 @@ export default {
Watermark.set(this.username, this.$refs.containerS); Watermark.set(this.username, this.$refs.containerS);
} }
} }
} },
, created() { created() {
this.$nextTick(function () { this.$nextTick(function () {
this.loadUser() this.loadUser()

@ -1,4 +1,6 @@
import {getparameter} from "@/api/system/dictionary.js" import {
getparameter
} from "@/api/system/dictionary.js"
export default { export default {
data() { data() {
return { return {
@ -8,65 +10,132 @@ export default {
field: 'username', field: 'username',
rule: 'required', rule: 'required',
edit_input: "text", edit_input: "text",
help: '请输入姓名' help: '请输入姓名',
need_fill: 0,
belong_user: 1,
belong_user_table: 'username'
}, { }, {
name: '性别', name: '性别',
field: 'sex', field: 'sex',
rule: 'required', rule: 'required',
edit_input: "text", edit_input: "radio",
help: '请选择性别' help: '请选择性别',
},{ select_item: [{
key: '男',
value: '男'
}, {
key: '女',
value: '女'
}],
need_fill: 0,
belong_user: 1,
belong_user_table: 'sex'
}, {
name: '出生日期',
field: 'birthday',
rule: '',
edit_input: "date",
help: '请选择出生日期',
need_fill: 0,
belong_user: 1,
belong_user_table: 'birthday'
}, {
name: '联系方式', name: '联系方式',
field: 'mobile', field: 'mobile',
rule: 'required', rule: 'required',
edit_input: "text", edit_input: "text",
help: '请输入联系方式' help: '请输入联系方式',
need_fill: 0,
belong_user: 1,
belong_user_table: 'mobile'
}, { }, {
name: '出生日期', name: '身份证号',
field: 'birthday', field: 'idcard',
rule: '', rule: 'idcard',
edit_input: "text", edit_input: "text",
help: '请选择出生日期' help: '请输入身份证号',
need_fill: 0,
belong_user: 1,
select_item: [],
is_open: false,
belong_user_table: 'idcard'
}, { }, {
name: '邮箱', name: '学历',
field: 'email', field: 'education',
rule: '', rule: '',
edit_input: "text", edit_input: "radio",
help: '请输入邮箱' help: '请选择学历',
need_fill: 0,
belong_user: 1,
select_item: [],
is_open: false,
belong_user_table: 'education'
}, { }, {
name: '公司名称', name: '公司名称',
field: 'company_name', field: 'company_name',
rule: '', rule: '',
edit_input: "text", edit_input: "text",
help: '请输入公司名称' help: '请输入公司名称',
need_fill: 0,
belong_user: 1,
belong_user_table: 'company_name'
}, { }, {
name: '职务', name: '职务',
field: 'company_position', field: 'company_position',
rule: '', rule: '',
edit_input: "text", edit_input: "text",
help: '请选择职务' help: '请输入职务',
}], need_fill: 0,
// 自定义表单的 扩展字段 可填可不填 belong_user: 1,
selectFormList: [ { belong_user_table: 'company_position'
name: '身份证号', }, {
field: 'idcard', name: '有无股份',
rule: 'idcard', field: 'company_has_share',
edit_input: "text", rule: '',
help: '请输入身份证号', edit_input: "radio",
need_fill: 0, help: '请选择有无股份',
belong_user: 1, need_fill: 0,
select_item: [], belong_user: 1,
select_item: [{
key: '有',
value: '有'
}, {
key: '无',
value: '无'
}],
is_open: false, is_open: false,
belong_user_table: 'company_has_share'
}, {
name: '人才类型',
field: 'type',
rule: '',
edit_input: "radio",
help: '请选择人才类型',
need_fill: 0,
belong_user: 1,
select_item: [],
is_open: false,
belong_user_table: 'type'
}, { }, {
name: '企业性质', name: '企业性质',
field: 'company_type', field: 'company_type',
rule: '', rule: '',
edit_input: "radio", edit_input: "checkbox",
help: '请选择企业性质', help: '请选择企业性质',
need_fill: 0, need_fill: 0,
belong_user: 1, belong_user: 1,
select_item: [], select_item: [],
is_open: false, // 控制开启关闭的 参数不做保存 is_open: false, // 控制开启关闭的 参数不做保存
belong_user_table: 'company_type'
}, {
name: '融资情况',
field: 'company_fund',
rule: '',
edit_input: "text",
help: '请输入融资情况',
need_fill: 0,
belong_user: 1,
belong_user_table: 'company_fund'
}, { }, {
name: '所在区域', name: '所在区域',
field: 'company_area', field: 'company_area',
@ -76,7 +145,19 @@ export default {
need_fill: 0, need_fill: 0,
belong_user: 1, belong_user: 1,
select_item: [], select_item: [],
is_open: false is_open: false,
belong_user_table: 'company_area'
}, {
name: '公司地址',
field: 'company_address',
rule: '',
edit_input: "text",
help: '请填写公司地址',
need_fill: 0,
belong_user: 1,
select_item: [],
is_open: false,
belong_user_table: 'company_address'
}, { }, {
name: '所属行业', name: '所属行业',
field: 'company_industry', field: 'company_industry',
@ -86,17 +167,123 @@ export default {
need_fill: 0, need_fill: 0,
belong_user: 1, belong_user: 1,
select_item: [], select_item: [],
is_open: false is_open: false,
belong_user_table: 'company_industry'
}, { }, {
name: '人才类型', name: '产品',
field: 'type', field: 'company_product',
rule: '',
edit_input: "text",
help: '请输入产品',
need_fill: 0,
belong_user: 1,
belong_user_table: 'company_product'
}, {
name: '毕业院校',
field: 'school',
rule: '',
edit_input: "text",
help: '请输入产品',
need_fill: 0,
belong_user: 1,
belong_user_table: 'school'
}, {
name: '专业',
field: 'speciality',
rule: '',
edit_input: "text",
help: '请输入专业',
need_fill: 0,
belong_user: 1,
belong_user_table: 'speciality'
}, {
name: '海外经验',
field: 'overseas_experience',
rule: '',
edit_input: "text",
help: '请输入海外经验',
need_fill: 0,
belong_user: 1,
belong_user_table: 'overseas_experience'
}, {
name: '报名渠道',
field: 'sign_from',
rule: '', rule: '',
edit_input: "radio", edit_input: "radio",
help: '请选择人才类型', help: '请选择报名渠道',
need_fill: 0,
belong_user: 1,
belong_user_table: 'sign_from'
}, {
name: '邮箱',
field: 'email',
rule: '',
edit_input: "text",
help: '请输入邮箱',
need_fill: 0,
belong_user: 1,
belong_user_table: 'email'
}],
// 自定义表单的 扩展字段 可填可不填
selectFormList: [{
name: '姓名',
field: 'username',
rule: 'required',
edit_input: "text",
help: '请输入姓名',
need_fill: 0,
belong_user: 1,
belong_user_table: 'username',
sort: 0,
}, {
name: '性别',
field: 'sex',
rule: 'required',
edit_input: "radio",
help: '请选择性别',
select_item: [{
key: '男',
value: '男'
}, {
key: '女',
value: '女'
}],
need_fill: 0,
belong_user: 1,
belong_user_table: 'sex',
sort: 0,
}, {
name: '出生日期',
field: 'birthday',
rule: '',
edit_input: "date",
help: '请选择出生日期',
need_fill: 0,
belong_user: 1,
belong_user_table: 'birthday',
sort: 0,
}, {
name: '联系方式',
field: 'mobile',
rule: 'required',
edit_input: "text",
help: '请输入联系方式',
need_fill: 0,
belong_user: 1,
belong_user_table: 'mobile',
sort: 0,
}, {
name: '身份证号',
field: 'idcard',
rule: 'idcard',
edit_input: "text",
help: '请输入身份证号',
need_fill: 0, need_fill: 0,
belong_user: 1, belong_user: 1,
select_item: [], select_item: [],
is_open: false is_open: false,
belong_user_table: 'idcard',
sort: 0,
}, { }, {
name: '学历', name: '学历',
field: 'education', field: 'education',
@ -106,53 +293,226 @@ export default {
need_fill: 0, need_fill: 0,
belong_user: 1, belong_user: 1,
select_item: [], select_item: [],
is_open: false is_open: false,
}], belong_user_table: 'education',
formSelect:{ sort: 0,
company_position:[], }, {
company_type:[], name: '公司名称',
company_area:[], field: 'company_name',
company_industry:[], rule: '',
type:[], edit_input: "text",
education:[] help: '请输入公司名称',
}, need_fill: 0,
belong_user: 1,
belong_user_table: 'company_name',
sort: 0,
}, {
name: '职务',
field: 'company_position',
rule: '',
edit_input: "text",
help: '请输入职务',
need_fill: 0,
belong_user: 1,
belong_user_table: 'company_position',
sort: 0,
}, {
name: '有无股份',
field: 'company_has_share',
rule: '',
edit_input: "radio",
help: '请选择有无股份',
need_fill: 0,
belong_user: 1,
select_item: [{
key: '有',
value: '有'
}, {
key: '无',
value: '无'
}],
is_open: false,
belong_user_table: 'company_has_share',
sort: 0,
}, {
name: '人才类型',
field: 'type',
rule: '',
edit_input: "radio",
help: '请选择人才类型',
need_fill: 0,
belong_user: 1,
select_item: [],
is_open: false,
belong_user_table: 'type',
sort: 0,
}, {
name: '企业性质',
field: 'company_type',
rule: '',
edit_input: "checkbox",
help: '请选择企业性质',
need_fill: 0,
belong_user: 1,
select_item: [],
is_open: false, // 控制开启关闭的 参数不做保存
belong_user_table: 'company_type',
sort: 0,
}, {
name: '融资情况',
field: 'company_fund',
rule: '',
edit_input: "text",
help: '请输入融资情况',
need_fill: 0,
belong_user: 1,
belong_user_table: 'company_fund',
sort: 0,
}, {
name: '所在区域',
field: 'company_area',
rule: '',
edit_input: "radio",
help: '请选择所在区域',
need_fill: 0,
belong_user: 1,
select_item: [],
is_open: false,
belong_user_table: 'company_area',
sort: 0,
}, {
name: '公司地址',
field: 'company_address',
rule: '',
edit_input: "text",
help: '请填写公司地址',
need_fill: 0,
belong_user: 1,
is_open: false,
belong_user_table: 'company_address',
sort: 0,
}, {
name: '所属行业',
field: 'company_industry',
rule: '',
edit_input: "radio",
help: '请选择所属行业',
need_fill: 0,
belong_user: 1,
select_item: [],
is_open: false,
belong_user_table: 'company_industry',
sort: 0,
}, {
name: '产品',
field: 'company_product',
rule: '',
edit_input: "text",
help: '请输入产品',
need_fill: 0,
belong_user: 1,
belong_user_table: 'company_product',
sort: 0,
}, {
name: '毕业院校',
field: 'school',
rule: '',
edit_input: "text",
help: '请输入产品',
need_fill: 0,
belong_user: 1,
belong_user_table: 'school',
sort: 0,
}, {
name: '专业',
field: 'speciality',
rule: '',
edit_input: "text",
help: '请输入专业',
need_fill: 0,
belong_user: 1,
belong_user_table: 'speciality',
sort: 0,
}, {
name: '海外经验',
field: 'overseas_experience',
rule: '',
edit_input: "text",
help: '请输入海外经验',
need_fill: 0,
belong_user: 1,
belong_user_table: 'overseas_experience',
sort: 0,
}, {
name: '报名渠道',
field: 'sign_from',
rule: '',
edit_input: "radio",
help: '请选择报名渠道',
need_fill: 0,
select_item: [],
belong_user: 1,
belong_user_table: 'sign_from',
sort: 0,
}, {
name: '邮箱',
field: 'email',
rule: '',
edit_input: "text",
help: '请输入邮箱',
need_fill: 0,
belong_user: 1,
belong_user_table: 'email',
sort: 0,
}],
formSelect: {
// company_position: [],
company_type: [],
company_area: [],
company_industry: [],
type: [],
education: [],
sign_from: []
},
} }
}, },
computed: {}, computed: {},
created() { created() {
this.getAllPara() this.getAllPara()
}, },
mounted() {}, mounted() {},
methods: { methods: {
getAllPara(){ getAllPara() {
let number = ['company_position','company_type','company_area','company_industry','type','education'] let number = ['company_type', 'company_area', 'company_industry', 'type', 'education',
getparameter({ 'sign_from'
number:number ]
}).then(res=>{ getparameter({
// 获取数据字典插入到 select中 number: number
res.map(item=>{ }).then(res => {
for(var k in this.formSelect){ // 获取数据字典插入到 select中
if(item.number===k){ res.map(item => {
this.formSelect[k] = item.detail for (var k in this.formSelect) {
} if (item.number === k) {
} this.formSelect[k] = item.detail
}) }
// 数据插入到 selectFormList 的select_item中{key:'',value:''} }
this.selectFormList.map(sform=>{ })
for(var k in this.formSelect){ // 数据插入到 selectFormList 的select_item中{key:'',value:''}
if(sform.field===k){ this.selectFormList.map(sform => {
this.formSelect[k].map(kf=>{ for (var k in this.formSelect) {
sform.select_item.push({ if (sform.field === k) {
key:kf.value, this.formSelect[k].map(kf => {
value:kf.value sform.select_item.push({
}) key: kf.value,
}) value: kf.value
} })
} })
}) }
console.log("this.selectFormList123",this.selectFormList) }
}) })
console.log("this.selectFormList123", this.selectFormList)
})
} }
}, },
}; };

@ -126,6 +126,32 @@
</el-radio-group> </el-radio-group>
</div> </div>
</div> </div>
</template>
<template v-slot:show_txl v-if="active===0">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>是否显示通讯录
</div>
<div class="xy-table-item-content">
<el-radio-group style="width:100%" v-model="form.show_txl">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</div>
</div>
</template>
<template v-slot:show_mobile v-if="active===0">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>是否显示联系方式
</div>
<div class="xy-table-item-content">
<el-radio-group style="width:100%" v-model="form.show_mobile">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</div>
</div>
</template> </template>
<template v-slot:qun_image_id v-if="active===0 && form.is_fee===0"> <template v-slot:qun_image_id v-if="active===0 && form.is_fee===0">
<div class="xy-table-item"> <div class="xy-table-item">
@ -279,7 +305,9 @@
status: 0, status: 0,
is_arrange: 1, is_arrange: 1,
is_fee: 1, is_fee: 1,
show_txl:1,
show_mobile:0,
qun_image_id: '', qun_image_id: '',
image_id: '', image_id: '',
publicize_ids: [], publicize_ids: [],
@ -436,7 +464,8 @@
}).then(res => { }).then(res => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '保存课程成功' message: '保存课程成功',
duration:2000
}) })
this.id = res.id this.id = res.id
this.$emit('refresh') this.$emit('refresh')
@ -466,7 +495,9 @@
this.form.dateRange = res.start_date ? [res.start_date, res.end_date] : '' this.form.dateRange = res.start_date ? [res.start_date, res.end_date] : ''
this.form.status = res.status ? res.status : 0 this.form.status = res.status ? res.status : 0
this.form.is_arrange = res.is_arrange ? res.is_arrange : 0 this.form.is_arrange = res.is_arrange ? res.is_arrange : 0
this.form.is_fee = res.is_fee ? res.is_fee : 0 this.form.is_fee = res.is_fee ? res.is_fee : 0
this.form.show_txl = res.show_txl===0 ? 0 : 1
this.form.show_mobile = res.show_mobile ? res.show_mobile : 0
this.showTinymce = true this.showTinymce = true
}) })
}, },
@ -526,7 +557,9 @@
sign_end_date: '', sign_end_date: '',
status: 0, status: 0,
is_arrange: 1, is_arrange: 1,
is_fee: 1, is_fee: 1,
show_txl:1,
show_mobile:1,
qun_image_id: '', qun_image_id: '',
image_id: '', image_id: '',
publicize_ids: [], publicize_ids: [],
@ -552,7 +585,9 @@
::v-deep .status, ::v-deep .status,
::v-deep .is_arrange, ::v-deep .is_arrange,
::v-deep .is_fee, ::v-deep .is_fee,
::v-deep .show_txl,
::v-deep .show_mobile,
{ {
flex-basis: 33%; flex-basis: 33%;
} }

@ -1,15 +1,15 @@
<template> <template>
<div> <div>
<el-dialog title="创建报名表单" :show-close="false" :visible.sync="dialogVisible" :fullscreen="true" :modal='false'> <el-dialog title="创建报名表单" :show-close="false" :visible.sync="dialogVisible" :fullscreen="true" :modal='false'>
<template v-slot:title> <template v-slot:title>
<div style="display: flex;align-items: center;justify-content: space-between;font-size: 26px;"> <div style="display: flex;align-items: center;justify-content: space-between;font-size: 26px;">
<div>创建报名表单</div> <div>创建报名表单</div>
<div style="cursor: pointer;"> <div style="cursor: pointer;">
<Button type="primary" @click="dialogVisible = false">完成并关闭</Button> <Button type="primary" @click="dialogVisible = false">完成并关闭</Button>
</div> </div>
</div> </div>
</template> </template>
<div style="height: 100%"> <div style="height: 100%">
<Split v-model="splitL" :min="0.05"> <Split v-model="splitL" :min="0.05">
<template #left> <template #left>
@ -23,40 +23,39 @@
<Split v-model="splitR" :min="0.2"> <Split v-model="splitR" :min="0.2">
<template #left> <template #left>
<div style="height: 100%"> <div style="height: 100%">
<el-dialog id="template-dialog" :title="'模板表单'" <el-dialog id="template-dialog" :title="'模板表单'" :show-close="false"
:show-close="false"
style="position: relative; inset: 0 0 0 0; height: 100%" width="80%" top="40px" :visible="true" style="position: relative; inset: 0 0 0 0; height: 100%" width="80%" top="40px" :visible="true"
:modal="false" :append-to-body="false" :modal-append-to-body="false"> :modal="false" :append-to-body="false" :modal-append-to-body="false">
<el-form style="min-height: 200px;display: flex;flex-wrap: wrap;" label-width="80px" <el-form style="min-height: 200px;display: flex;flex-wrap: wrap;" label-width="80px"
label-position="right" size="small"> label-position="right" size="small">
<el-divider>基础字段</el-divider> <el-divider>表单字段</el-divider>
<!-- <el-form-item :label="i.name" :required="
<el-form-item :label="i.name" :required="
i.rule ? !!i.rule.includes('required') : false i.rule ? !!i.rule.includes('required') : false
" v-for="(i, index) in defaultFormList"> " v-for="(i, index) in defaultFormList">
<el-input :placeholder="i.help?i.help:'基础字段'" :disabled="true"></el-input> <el-input :placeholder="i.help?i.help:'表单字段'" :disabled="true"></el-input>
</el-form-item> </el-form-item> -->
<draggable :value="formList" group="items" @change="changeHandler"
<el-divider>选填字段</el-divider> style="display: flex;flex-wrap: wrap;width:100%">
<el-form-item :label="i.name" :required=" <el-form-item style="flex-basis: 100%;" :label="i.name || '字段名称'" :required="
i.rule ? !!i.rule.includes('required') : false
" v-for="(i, index) in formList" @click.native="selectPick(i, index)">
<formSlotRender :config="i" :index="index"></formSlotRender>
</el-form-item>
</draggable>
<!-- <el-divider>选填字段</el-divider> -->
<!-- <el-form-item style="flex-basis: 100%;" :label="i.name" :required="
i.rule ? !!i.rule.includes('required') : false i.rule ? !!i.rule.includes('required') : false
" v-for="(i, index) in selectFormList"> " v-for="(i, index) in selectFormList"
<el-input style="width:60%;margin-right:10px" :placeholder="i.help?i.help:'选填字段'" :disabled="true"></el-input> @click.native="selectPick(i, index)">
<el-input style="width:100%;" :placeholder="i.help?i.help:'表单字段'"></el-input>
<el-switch @change="(e)=>{changeSelect(e,i)}" v-model="i.is_open" active-color="#0077CC" <el-switch @change="(e)=>{changeSelect(e,i)}" v-model="i.is_open" active-color="#0077CC"
inactive-color="#ccc"> inactive-color="#ccc">
</el-switch> </el-switch>
</el-form-item> </el-form-item> -->
<!-- <el-divider>自定义字段</el-divider> -->
<el-divider>自定义字段</el-divider>
<draggable :value="formList" group="items" @change="changeHandler"
style="display: flex;flex-wrap: wrap;width:100%">
<el-form-item style="flex-basis: 100%;" :label="i.name || '字段名称'" :required="
i.rule ? !!i.rule.includes('required') : false
" v-for="(i, index) in formList" @click.native="selectPick(i, index)">
<formSlotRender :config="i" :index="index"></formSlotRender>
</el-form-item>
</draggable>
</el-form> </el-form>
<div slot="footer"> <div slot="footer">
@ -136,6 +135,7 @@
this.types = edit_to_migration.filter(item => item.edit_input !== 'textarea' && item.edit_input !== this.types = edit_to_migration.filter(item => item.edit_input !== 'textarea' && item.edit_input !==
"richtext" && "richtext" &&
item.edit_input !== "file" && item.edit_input !== "map"); item.edit_input !== "file" && item.edit_input !== "map");
}, },
// //
async getFormList() { async getFormList() {
@ -147,9 +147,12 @@
}], }],
...this.select ...this.select
}) })
this.formList = res.data this.formList = res.data
this.updateObjects(this.selectFormList, this.formList) // this.updateObjects(this.selectFormList, this.formList)
// let _arr = this.removeMatchingItems(this.selectFormList, this.formList)
// this.formList.push(..._arr)
// this.selectFormList = _arr
console.log("_arr",_arr)
console.log("this.selectFormList", this.selectFormList, this.formList) console.log("this.selectFormList", this.selectFormList, this.formList)
}, },
@ -161,7 +164,7 @@
if (match) { if (match) {
// a // a
Object.assign(match, objB); Object.assign(match, objB);
match.is_open = true match.is_open = true
return false; // return false; //
} else { } else {
@ -173,6 +176,13 @@
b.length = 0; // b.length = 0; //
b.push(...updatedB); // b.push(...updatedB); //
}, },
removeMatchingItems(a, b) {
// Set b filed
const bFiledValues = new Set(b.map(item => item.field));
// 使 filter a
return a.filter(item => !bFiledValues.has(item.field));
},
// //
changeHandler(e) { changeHandler(e) {
if (e.added) { if (e.added) {
@ -201,11 +211,17 @@
newIndex, newIndex,
oldIndex oldIndex
} = e.moved; } = e.moved;
element.sort = newIndex; element.sort = newIndex;
if (element) { console.log(element)
this.formList.splice(oldIndex, 1); if(element.id){
this.formList.splice(newIndex, 0, element); this.saveSelect(element)
}else{
this.formList.splice(oldIndex, 1);
this.formList.splice(newIndex, 0, element);
} }
// if (element) {
// }
} }
}, },
@ -261,15 +277,15 @@
if (newval) { if (newval) {
this.getFormList() this.getFormList()
} else { } else {
this.course_id = '' this.course_id = ''
this.selectFormList.map(item=>{ this.selectFormList.map(item => {
item.is_open = false item.is_open = false
if(item.id){ if (item.id) {
item.id = '' item.id = ''
} }
if(item.course_id){ if (item.course_id) {
item.course_id = '' item.course_id = ''
} }
}) })
this.$emit("refresh") this.$emit("refresh")
} }

@ -1,278 +1,250 @@
<template> <template>
<div style="padding: 0 10px; height: 100%; overflow: scroll"> <div style="padding: 0 10px; height: 100%; overflow: scroll">
<template v-if="showForm"> <template v-if="showForm">
<el-form <el-form :rules="formRule" ref="form" :model="selectedForm" label-width="80px">
:rules="formRule" <el-form-item prop="belong_user_table" label="更新学员字段">
ref="form" <el-select v-model="selectedForm.belong_user_table" clearable @change="changeIsUser"
:model="selectedForm" :popper-append-to-body="false" placeholder="请选择学员字段" style="width: 100%">
label-width="80px" <el-option v-for="(value, key) in selectFormList" :key="key" :label="value.name"
> :value="value.belong_user_table"></el-option>
<el-form-item prop="name" label="字段名称"> </el-select>
<el-input </el-form-item>
v-model="selectedForm.name" <el-form-item prop="name" label="字段名称">
placeholder="请输入字段名称" <el-input v-model="selectedForm.name" placeholder="请输入字段名称" @input="inputHandler"></el-input>
@input="inputHandler" </el-form-item>
></el-input> <el-form-item required prop="field" label="字段标识">
</el-form-item> <el-input :disabled="selectedForm.belong_user?true:false" v-model="selectedForm.field"></el-input>
<el-form-item required prop="field" label="字段标识"> </el-form-item>
<el-input v-model="selectedForm.field"></el-input> <el-form-item prop="help" label="帮助文字">
</el-form-item> <el-input v-model="selectedForm.help" placeholder="请输入帮助文字"></el-input>
<el-form-item prop="help" label="帮助文字"> </el-form-item>
<el-input <el-form-item prop="sort" label="排序">
v-model="selectedForm.help" <el-input v-model="selectedForm.sort" placeholder="请输入排序"></el-input>
placeholder="请输入帮助文字" </el-form-item>
></el-input> <el-form-item prop="select_item" label="下拉框选项"
</el-form-item> v-if="selectedForm.edit_input==='radio' || selectedForm.edit_input==='checkbox'">
<el-form-item prop="sort" label="排序"> <div class="select-item">
<el-input <div class="select-item__header">
v-model="selectedForm.sort" <span></span>
placeholder="请输入排序" <span></span>
></el-input> </div>
</el-form-item>
<el-form-item prop="select_item" label="下拉框选项" <div class="select-item__body" v-for="(i, index) in selectItem">
v-if="selectedForm.edit_input==='radio' || selectedForm.edit_input==='checkbox'"> <div><el-input v-model="i.key" size="mini"></el-input></div>
<div class="select-item"> <div><el-input v-model="i.value" size="mini"></el-input></div>
<div class="select-item__header"> <div>
<span></span> <el-button type="danger" size="mini" circle icon="el-icon-delete"
<span></span> @click="selectItem.splice(index, 1)"></el-button>
</div> </div>
</div>
<div class="select-item__body" v-for="(i, index) in selectItem">
<div><el-input v-model="i.key" size="mini"></el-input></div> <el-button type="primary" size="mini" circle icon="el-icon-plus"
<div><el-input v-model="i.value" size="mini"></el-input></div> @click="selectItem.push({ key: '', value: '' })"></el-button>
<div> </div>
<el-button </el-form-item>
type="danger" <el-form-item prop="validation" label="校验规则">
size="mini" <el-select v-model="validation" clearable multiple collapse-tags :popper-append-to-body="false"
circle placeholder="请选择校验规则" style="width: 100%">
icon="el-icon-delete" <el-option v-for="(value, key) in rules" :key="key" :label="value" :value="key"></el-option>
@click="selectItem.splice(index, 1)" </el-select>
></el-button> </el-form-item>
</div> <el-form-item>
</div> <el-button type="primary" @click="saveField"></el-button>
<el-popover trigger="hover" ref="el-popover" placement="top" width="160">
<el-button <p>确定删除字段吗</p>
type="primary" <div style="text-align: right; margin: 0">
size="mini" <el-button size="mini" type="text" @click="$refs['el-popover'].doClose()"></el-button>
circle <el-button type="primary" size="mini" @click="destroyField"></el-button>
icon="el-icon-plus" </div>
@click="selectItem.push({ key: '', value: '' })" <el-button type="danger" slot="reference" @click="$refs['el-popover'].doShow()"
></el-button> style="margin-left: 10px">删除</el-button>
</div> </el-popover>
</el-form-item> </el-form-item>
<el-form-item prop="validation" label="校验规则"> </el-form>
<el-select </template>
v-model="validation" <template v-else>
clearable <el-empty style="position: relative; top: 50%; transform: translateY(-50%)" description="暂无选择"></el-empty>
multiple </template>
collapse-tags </div>
:popper-append-to-body="false" </template>
placeholder="请选择校验规则"
style="width: 100%" <script>
> import {
<el-option save,
v-for="(value, key) in rules" destroy
:key="key" } from "@/api/course/form";
:label="value" import {
:value="key" translate
></el-option> } from "@/api/system/customFormField";
</el-select> import {
</el-form-item> debounce,
<el-form-item> deepCopy
<el-button type="primary" @click="saveField"></el-button> } from "@/utils";
<el-popover import formMixins from "@/mixin/formMixin.js";
trigger="hover"
ref="el-popover" export default {
placement="top" mixins: [formMixins],
width="160" props: {
> rules: Object,
<p>确定删除字段吗</p> types: Array,
<div style="text-align: right; margin: 0"> },
<el-button data() {
size="mini" return {
type="text" showForm: false,
@click="$refs['el-popover'].doClose()" debouncedInputHandler: null,
>取消</el-button formRule: {
> name: [{
<el-button required: true,
type="primary" message: "请输入字段名称"
size="mini" }],
@click="destroyField" field: [{
>确定</el-button required: true,
> message: "请输入字段标识"
</div> }],
<el-button },
type="danger" selectedForm: {}, // item
slot="reference" selectedIndex: 0, // item index
@click="$refs['el-popover'].doShow()" selectItem: [], //
style="margin-left: 10px" validation: [], //
>删除</el-button parameters: [], //
> forms: [], //
</el-popover> };
</el-form-item> },
</el-form> methods: {
</template> checkChinese(rule, value, callback) {
<template v-else> const reg = /^[\u4e00-\u9fa5]+$/;
<el-empty if (reg.test(value)) {
style="position: relative; top: 50%; transform: translateY(-50%)" callback();
description="暂无选择" } else {
></el-empty> callback(new Error("请输入中文姓名"));
</template> }
</div> },
</template> inputHandler(e) {
if (this.selectedForm.belong_user) {
<script>
import { save,destroy } from "@/api/course/form"; } else {
import { translate } from "@/api/system/customFormField"; this.debouncedInputHandler(e);
import { debounce } from "@/utils"; }
},
export default { changeIsUser(e) {
props: { console.log("e", e)
rules: Object, console.log(this.selectedForm)
types: Array, this.selectFormList.map(item => {
}, if (e === item.belong_user_table) {
data() { this.selectedForm = this.base.requestToForm(item,this.selectedForm)
return { console.log(this.selectedForm)
showForm:false, }
debouncedInputHandler: null, })
formRule: { },
name: [
{ required: true, message: "请输入字段名称" } saveField() {
],
field: [ this.selectedForm.select_item = []
{ required: true, message: "请输入字段标识" } this.selectedForm.select_item = this.selectItem
], this.selectedForm.rule = this.validation.join(",")
}, if (this.selectedForm.edit_input === 'radio' || this.selectedForm.edit_input === 'checkbox') {
selectedForm:{}, // item if (this.selectedForm.select_item.length === 0) {
selectedIndex:0, // item index this.$Message.warning("请输入下拉框选项")
return
selectItem: [], // }
validation:[], // }
parameters: [], // // return
forms: [], // save(this.selectedForm).then(res => {
}; console.log("res", res)
}, this.$Message.success('保存成功')
methods: { this.$emit("refreshFormItem", 'save')
checkChinese(rule, value, callback) { this.showForm = false
const reg = /^[\u4e00-\u9fa5]+$/; })
if (reg.test(value)) { },
callback();
} else { destroyField() {
callback(new Error("请输入中文姓名")); if (this.selectedForm.id) {
} destroy({
}, id: this.selectedForm.id
inputHandler(e) { }).then(res => {
this.debouncedInputHandler(e); this.$Message.success('删除成功')
}, this.showForm = false
this.$emit("refreshFormItem", 'DelId', this.selectedIndex)
})
saveField() { } else {
this.$Message.success('删除成功')
this.selectedForm.select_item = [] this.showForm = false
this.selectedForm.select_item = this.selectItem this.$emit("refreshFormItem", 'Del', this.selectedIndex)
this.selectedForm.rule = this.validation.join(",") }
if(this.selectedForm.edit_input==='radio' || this.selectedForm.edit_input==='checkbox'){ }
if(this.selectedForm.select_item.length===0){ },
this.$Message.warning("请输入下拉框选项") watch: {
return selectedForm(newVal) {
} console.log("newval", newVal)
} if (newVal) {
// return if (newVal.select_item) {
save(this.selectedForm).then(res=>{ this.selectItem = [];
console.log("res",res) this.selectItem = newVal.select_item
this.$Message.success('保存成功') // for(let key in newVal.select_item) {
this.$emit("refreshFormItem",'save') // this.selectItem.push({
this.showForm = false // key,
}) // value: newVal.select_item[key]
}, // })
// }
destroyField () { }
if(this.selectedForm.id){ this.validation = []
destroy({ if (newVal.rule) {
id:this.selectedForm.id this.validation = newVal.rule.split(',')
}).then(res=>{ }
this.$Message.success('删除成功')
this.showForm = false }
this.$emit("refreshFormItem",'DelId',this.selectedIndex) }
}) },
}else{ created() {
this.$Message.success('删除成功') this.debouncedInputHandler = debounce((e) => {
this.showForm = false if (e) {
this.$emit("refreshFormItem",'Del',this.selectedIndex) this.checkChinese("", e, (err) => {
} if (!err) {
} translate({
}, str: e,
watch: { }).then((en) => {
selectedForm(newVal) { this.selectedForm.field = en.pinyin;
console.log("newval",newVal) });
if(newVal) { }
if(newVal.select_item) { });
this.selectItem = []; }
this.selectItem = newVal.select_item }, 1000);
// for(let key in newVal.select_item) { },
// this.selectItem.push({ };
// key, </script>
// value: newVal.select_item[key]
// }) <style scoped lang="scss">
// } ::v-deep .el-input-number.is-without-controls .el-input__inner {
} text-align: left;
this.validation = [] }
if(newVal.rule){
this.validation = newVal.rule.split(',') .select-item {
} text-align: center;
} &__header {
} font-weight: 600;
}, display: flex;
created() {
this.debouncedInputHandler = debounce((e) => { &>span {
if (e) { flex-basis: 30%;
this.checkChinese("", e, (err) => {
if (!err) { &+span {
translate({ margin-left: 10px;
str: e, }
}).then((en) => { }
this.selectedForm.field = en.pinyin; }
});
} &__body {
}); display: flex;
}
}, 1000); &>div {
}, flex-basis: 30%;
};
</script> &+div {
margin-left: 10px;
<style scoped lang="scss"> }
::v-deep .el-input-number.is-without-controls .el-input__inner { }
text-align: left; }
} }
.select-item {
text-align: center;
&__header {
font-weight: 600;
display: flex;
& > span {
flex-basis: 30%;
& + span {
margin-left: 10px;
}
}
}
&__body {
display: flex;
& > div {
flex-basis: 30%;
& + div {
margin-left: 10px;
}
}
}
}
</style> </style>

@ -52,8 +52,7 @@
<template v-slot:signDate> <template v-slot:signDate>
<el-table-column align='center' label="报名日期" width="200" header-align="center"> <el-table-column align='center' label="报名日期" width="200" header-align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.sign_start_date?scope.row.sign_start_date:''}} {{scope.row.sign_start_date?scope.row.sign_start_date:''}}{{scope.row.sign_end_date?"至"+scope.row.sign_end_date:'起'}}
{{scope.row.sign_end_date?"至"+scope.row.sign_end_date:'起'}}
</template> </template>
</el-table-column> </el-table-column>
</template> </template>

Loading…
Cancel
Save