|
@@ -23,27 +23,42 @@
|
|
|
top: -0.5px;
|
|
|
margin: 0 8px 0 2px;
|
|
|
}
|
|
|
+.ant-form-item-required::before {
|
|
|
+ display: inline-block;
|
|
|
+ margin-right: 4px;
|
|
|
+ color: #f5222d;
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: SimSun, sans-serif;
|
|
|
+ line-height: 1;
|
|
|
+ content: '*';
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.require-check {
|
|
|
+ /deep/ .ant-form-item-label {
|
|
|
+ label::before {
|
|
|
+ display: inline-block;
|
|
|
+ margin-right: 4px;
|
|
|
+ color: #f5222d;
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: SimSun, sans-serif;
|
|
|
+ line-height: 1;
|
|
|
+ content: '*';
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|
|
|
<template>
|
|
|
- <a-modal v-model="visible" title="定向模板" :width="1100" v-if="visible">
|
|
|
+ <a-modal v-model="visible" :title="type === 'add' ? '新建定向包' : '修改定向包'" :width="1100" v-if="visible">
|
|
|
<a-spin :spinning="spinning">
|
|
|
<a-form @submit="handleSubmit" :form="form">
|
|
|
- <a-form-item
|
|
|
- label="模板名称"
|
|
|
- :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
|
|
|
- :wrapperCol="{ lg: { span: 12 }, sm: { span: 12 } }"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['templateName', { rules: [{ required: true, message: '模板名称必填' }] }]"
|
|
|
- :disabled="type == 'look'"
|
|
|
- ></a-input>
|
|
|
- </a-form-item>
|
|
|
<a-row :gutter="24">
|
|
|
<a-col :md="24" :sm="24" :xxl="24">
|
|
|
<selectTable
|
|
|
:projectId.sync="projectId"
|
|
|
:labelCol="labelCol"
|
|
|
:disabled="disabled"
|
|
|
+ :requireCheck="true"
|
|
|
v-if="!disabled"
|
|
|
></selectTable>
|
|
|
<a-form-item
|
|
@@ -51,11 +66,23 @@
|
|
|
label="项目名称"
|
|
|
:labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
|
|
|
:wrapperCol="{ lg: { span: 12 }, sm: { span: 12 } }"
|
|
|
+ class="require-check"
|
|
|
>
|
|
|
<a-input v-model="projectName" :disabled="disabled"></a-input>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
+ <a-form-item
|
|
|
+ label="模板名称"
|
|
|
+ :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
|
|
|
+ :wrapperCol="{ lg: { span: 12 }, sm: { span: 12 } }"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ v-decorator="['templateName', { rules: [{ required: true, message: '模板名称必填' }] }]"
|
|
|
+ :disabled="type == 'look'"
|
|
|
+ ></a-input>
|
|
|
+ </a-form-item>
|
|
|
+
|
|
|
<targeted-population ref="population" :populationData.sync="populationData" />
|
|
|
</a-form>
|
|
|
</a-spin>
|
|
@@ -72,7 +99,7 @@
|
|
|
取消
|
|
|
</a-button>
|
|
|
<a-button type="primary" @click="handleSubmit" :loading="loading">
|
|
|
- {{ this.type == 'add' ? '确定' : '修改' }}
|
|
|
+ {{ type == 'add' ? '确定' : '修改' }}
|
|
|
</a-button>
|
|
|
</template>
|
|
|
</a-modal>
|
|
@@ -123,10 +150,10 @@ export default {
|
|
|
this.visible = true
|
|
|
this.type = type
|
|
|
var params = {}
|
|
|
- params.id = item.id;
|
|
|
- this.templateId = item.id;
|
|
|
- this.projectName = item.projectName;
|
|
|
- this.projectId = item.projectId;
|
|
|
+ params.id = item.id
|
|
|
+ this.templateId = item.id
|
|
|
+ this.projectName = item.projectName
|
|
|
+ this.projectId = item.projectId
|
|
|
getAction('/kuaishouDirectionalPackage/queryById', params).then((res) => {
|
|
|
if (res.success) {
|
|
|
var dataJson = {
|
|
@@ -151,7 +178,6 @@ export default {
|
|
|
this.populationData.behavior = dataJson.label
|
|
|
this.populationData.interest = dataJson.interestLabel
|
|
|
|
|
|
-
|
|
|
this.populationData.sceneType = dataJson.sceneType ? JSON.parse(dataJson.sceneType) : []
|
|
|
this.populationData.allForm = {}
|
|
|
this.populationData.allForm.regionType =
|
|
@@ -184,7 +210,7 @@ export default {
|
|
|
this.populationData.allForm.checkArr =
|
|
|
this.populationData.allForm.appType == '2' ? JSON.parse(dataJson.appIds) : []
|
|
|
this.populationData.projectId = dataJson.projectId + ''
|
|
|
-
|
|
|
+
|
|
|
this.disabled = true
|
|
|
|
|
|
this.$nextTick(() => {
|
|
@@ -203,42 +229,48 @@ export default {
|
|
|
|
|
|
e.preventDefault()
|
|
|
this.$refs.population.handleSubmit()
|
|
|
- this.form.validateFieldsAndScroll((err, values) => {
|
|
|
+ this.$refs.population.formAll.validateFields((err, value) => {
|
|
|
if (!err) {
|
|
|
- // this.loading = true
|
|
|
-
|
|
|
- var params = {
|
|
|
- ...this.populationData,
|
|
|
- templateName: values.templateName,
|
|
|
- projectId: this.projectId,
|
|
|
- }
|
|
|
- params.label = JSON.stringify(params.behavior)
|
|
|
- params.interestLabel = JSON.stringify(params.interest)
|
|
|
- if (this.type == 'add') {
|
|
|
- postAction('/kuaishouDirectionalPackage/createDirectionalPackage', params).then((res) => {
|
|
|
- if (res.success) {
|
|
|
- this.visible = false
|
|
|
- this.loading = false
|
|
|
- this.$emit('getData')
|
|
|
+ this.form.validateFieldsAndScroll((err, values) => {
|
|
|
+ if (!err) {
|
|
|
+ // this.loading = true
|
|
|
+ if (this.projectId) {
|
|
|
+ var params = {
|
|
|
+ ...this.populationData,
|
|
|
+ templateName: values.templateName,
|
|
|
+ projectId: this.projectId,
|
|
|
+ }
|
|
|
+ params.label = JSON.stringify(params.behavior)
|
|
|
+ params.interestLabel = JSON.stringify(params.interest)
|
|
|
+ if (this.type == 'add') {
|
|
|
+ postAction('/kuaishouDirectionalPackage/createDirectionalPackage', params).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.visible = false
|
|
|
+ this.loading = false
|
|
|
+ this.$emit('getData')
|
|
|
+ } else {
|
|
|
+ this.loading = false
|
|
|
+ this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (this.type == 'edit') {
|
|
|
+ params.id = this.templateId
|
|
|
+ postAction('/kuaishouDirectionalPackage/updateDirectionalPackage', params).then((res) => {
|
|
|
+ this.visible = false
|
|
|
+ if (res.success) {
|
|
|
+ this.loading = false
|
|
|
+ this.$emit('getData')
|
|
|
+ } else {
|
|
|
+ this.loading = false
|
|
|
+ this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.loading = false
|
|
|
- this.$message.error(res.result.message)
|
|
|
+ this.$message.error('请选择项目')
|
|
|
}
|
|
|
- })
|
|
|
- } else if (this.type == 'edit') {
|
|
|
- params.id = this.templateId
|
|
|
- postAction('/kuaishouDirectionalPackage/updateDirectionalPackage', params).then((res) => {
|
|
|
- this.visible = false
|
|
|
- if (res.success) {
|
|
|
- this.loading = false
|
|
|
- this.$emit('getData')
|
|
|
-
|
|
|
- } else {
|
|
|
- this.loading = false
|
|
|
- this.$message.error(res.result.message)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|