|
|
|
|
@ -22,7 +22,6 @@
|
|
|
|
|
@click="form.company_ids.push({ type_id: '',type_name:'', company_id: '',name:'' })"
|
|
|
|
|
>新增</Button
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<xy-table
|
|
|
|
|
style="width: 620px"
|
|
|
|
|
:height="260"
|
|
|
|
|
@ -52,6 +51,47 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:fields>
|
|
|
|
|
<div class="xy-table-item">
|
|
|
|
|
<div class="xy-table-item-label">活动提交字段:</div>
|
|
|
|
|
<div class="xy-table-item-content">
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
icon="md-add"
|
|
|
|
|
style="margin-bottom: 10px"
|
|
|
|
|
@click="form.fields.push({ name: '',filed:'', is_reqired: '',data_name:'',data_id:'' })"
|
|
|
|
|
>新增</Button
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<xy-table
|
|
|
|
|
style="width: 620px"
|
|
|
|
|
:height="260"
|
|
|
|
|
:is-page="false"
|
|
|
|
|
:list="form.fields"
|
|
|
|
|
:table-item="fieldsTable"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column
|
|
|
|
|
label="操作"
|
|
|
|
|
width="90"
|
|
|
|
|
header-align="center"
|
|
|
|
|
align="center"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:default="scope">
|
|
|
|
|
<Button
|
|
|
|
|
size="small"
|
|
|
|
|
type="primary"
|
|
|
|
|
ghost
|
|
|
|
|
@click="form.fields.splice(scope.$index, 1)"
|
|
|
|
|
>删除</Button
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</template>
|
|
|
|
|
</xy-table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<!-- <template v-slot:shopId>
|
|
|
|
|
<div class="xy-table-item">
|
|
|
|
|
<div class="xy-table-item-label">
|
|
|
|
|
@ -419,9 +459,9 @@ import {index as companyIndex} from "@/api/activitycompany"
|
|
|
|
|
import {store,show,save} from "@/api/activity"
|
|
|
|
|
import {index as indexType} from "@/api/activityType"
|
|
|
|
|
import { Message } from 'element-ui'
|
|
|
|
|
import { getparameter } from "@/api/system/dictionary";
|
|
|
|
|
import { getparameter,listparameter } from "@/api/system/dictionary";
|
|
|
|
|
import xyTinymce from "@/components/XyTinymce/index.vue";
|
|
|
|
|
import {replaceAll} from "@/utils/index"
|
|
|
|
|
import {replaceAll} from "@/utils/index"
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components:{
|
|
|
|
|
@ -434,10 +474,12 @@ export default {
|
|
|
|
|
type:'add',
|
|
|
|
|
id:'',
|
|
|
|
|
action:`${process.env.VUE_APP_BASE_API}api/admin/upload-file`,
|
|
|
|
|
companykeyword:"",
|
|
|
|
|
companykeyword:"",
|
|
|
|
|
parameterList:[],
|
|
|
|
|
form:{
|
|
|
|
|
activeName:"",
|
|
|
|
|
company_ids:[],
|
|
|
|
|
fields:[],
|
|
|
|
|
shopId:0,
|
|
|
|
|
sponsor:0,
|
|
|
|
|
sponsorLogo:"",
|
|
|
|
|
@ -514,6 +556,97 @@ companykeyword:"",
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
types:[],
|
|
|
|
|
fieldsTable:[
|
|
|
|
|
{
|
|
|
|
|
label: "字段名",
|
|
|
|
|
width: 140,
|
|
|
|
|
customFn: (row) => {
|
|
|
|
|
return ( <el-input placeholder = "必填(如:姓名)"
|
|
|
|
|
type = "text"
|
|
|
|
|
v-model = {
|
|
|
|
|
row.name
|
|
|
|
|
} >
|
|
|
|
|
</el-input>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "字段标识",
|
|
|
|
|
width: 140,
|
|
|
|
|
customFn: (row) => {
|
|
|
|
|
return ( <el-input placeholder = "必填(如:name)"
|
|
|
|
|
type = "text"
|
|
|
|
|
v-model = {
|
|
|
|
|
row.filed
|
|
|
|
|
} >
|
|
|
|
|
</el-input>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "是否必填",
|
|
|
|
|
minWidth: 120,
|
|
|
|
|
customFn: (row,scope) => {
|
|
|
|
|
return (
|
|
|
|
|
<el-select
|
|
|
|
|
placeholder="必填"
|
|
|
|
|
style="width: 100px"
|
|
|
|
|
value={row.is_reqired}
|
|
|
|
|
|
|
|
|
|
on={{
|
|
|
|
|
["change"]: (e) => (row.is_reqired=e),
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
['是','否'].map((item,index)=>{
|
|
|
|
|
return(
|
|
|
|
|
<el-option
|
|
|
|
|
// v-for={item in types}
|
|
|
|
|
value={item}
|
|
|
|
|
key={index}
|
|
|
|
|
label={item}
|
|
|
|
|
>
|
|
|
|
|
</el-option>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</el-select>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "关联数据",
|
|
|
|
|
width: 140,
|
|
|
|
|
customFn: (row) => {
|
|
|
|
|
return (
|
|
|
|
|
<el-select
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
style="width: 140px"
|
|
|
|
|
value={row.data_name}
|
|
|
|
|
clearable
|
|
|
|
|
on={{
|
|
|
|
|
["change"]: (e) => (row.data_name=e.name,row.data_id = e.id),
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
this.parameterList.map((item,index)=>{
|
|
|
|
|
return(
|
|
|
|
|
<el-option
|
|
|
|
|
// v-for={item in types}
|
|
|
|
|
value={item}
|
|
|
|
|
key={item.id}
|
|
|
|
|
label={item.name}
|
|
|
|
|
>
|
|
|
|
|
</el-option>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</el-select>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
contentTable: [
|
|
|
|
|
{
|
|
|
|
|
label: "关联方类型",
|
|
|
|
|
@ -577,6 +710,7 @@ companykeyword:"",
|
|
|
|
|
},
|
|
|
|
|
created(){
|
|
|
|
|
this.getLabels()
|
|
|
|
|
this.getparameterList()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
|
|
@ -607,7 +741,11 @@ companykeyword:"",
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async getparameterList(){
|
|
|
|
|
const res = await listparameter()
|
|
|
|
|
console.log("listparameter",res)
|
|
|
|
|
this.parameterList = res.data
|
|
|
|
|
},
|
|
|
|
|
async getLabels() {
|
|
|
|
|
const res = await getparameter({
|
|
|
|
|
number: "activeCompanyType",
|
|
|
|
|
@ -643,6 +781,7 @@ companykeyword:"",
|
|
|
|
|
// shopId:{value:res.shop_id,label:res.shop.name},
|
|
|
|
|
// sponsor:res.sponsor,
|
|
|
|
|
company_ids:res.company_ids?JSON.parse(res.company_ids):[],
|
|
|
|
|
fields:res.fields?JSON.parse(res.fields):[],
|
|
|
|
|
sponsorLogo:res.sponsor_logo,
|
|
|
|
|
sponsorAdvertise:res.sponsor_advertise,
|
|
|
|
|
recommend:res.recommend,
|
|
|
|
|
@ -681,7 +820,22 @@ companykeyword:"",
|
|
|
|
|
await this.submit()
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
hasEmptyValue(obj) {
|
|
|
|
|
for (let key in obj) {
|
|
|
|
|
if (obj.hasOwnProperty(key) && key !== 'data_id' && key !== 'data_name') {
|
|
|
|
|
if (obj[key] === null || obj[key] === undefined || obj[key] === '') {
|
|
|
|
|
return true;
|
|
|
|
|
} else if (typeof obj[key] === 'object') {
|
|
|
|
|
if (hasEmptyValue(obj[key]) === true) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
submit(){
|
|
|
|
|
|
|
|
|
|
let end_date = this.form.date[1]
|
|
|
|
|
let apply_end = this.form.applyDate[1]
|
|
|
|
|
if(this.compareDate(apply_end,end_date)){
|
|
|
|
|
@ -692,12 +846,27 @@ companykeyword:"",
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(this.form.fields&&this.form.fields.length>0){
|
|
|
|
|
this.form.fields.map((item,index)=>{
|
|
|
|
|
if(this.hasEmptyValue(item)){
|
|
|
|
|
Message({
|
|
|
|
|
type:'warning',
|
|
|
|
|
message:`活动提交字段第${index+1}必要字段为空`
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// console.log(this.form)
|
|
|
|
|
// return
|
|
|
|
|
if(this.type === 'add'||this.type === 'copy'){
|
|
|
|
|
console.log(this.form)
|
|
|
|
|
// return
|
|
|
|
|
return
|
|
|
|
|
store({
|
|
|
|
|
active_name:this.form.activeName,
|
|
|
|
|
company_ids:this.form.company_ids,
|
|
|
|
|
fields:this.form.fields,
|
|
|
|
|
shop_id:0,
|
|
|
|
|
sponsor:0,
|
|
|
|
|
sponsor_logo:this.form.sponsorLogo,
|
|
|
|
|
@ -742,6 +911,7 @@ companykeyword:"",
|
|
|
|
|
id:this.id,
|
|
|
|
|
active_name:this.form.activeName,
|
|
|
|
|
company_ids:this.form.company_ids,
|
|
|
|
|
fields:this.form.fields,
|
|
|
|
|
shop_id:0,
|
|
|
|
|
sponsor:0,
|
|
|
|
|
sponsor_logo:this.form.sponsorLogo,
|
|
|
|
|
|