Commit f00dd1d7 by zhangquan

修改所有门店适用编辑

1 parent 1c3466da
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="main-warp"> <div class="main-warp">
<glsx-combi-form ref="submitRef" labelWidth="154px" defaultWidth="284px" :isInline="false" :formObj="formObj" :formData="formData" :formRules="editRule"> <glsx-combi-form ref="submitRef" labelWidth="154px" defaultWidth="284px" :isInline="false" :formObj="formObj" :formData="formData" :formRules="editRule">
<div slot="merchantName"> <div slot="merchantName">
<el-button v-if="routeInfo.type!=2" class="el-icon-plus" @click="selectMerchant()">选择门店</el-button> <el-button v-if="routeInfo.type==1 || (routeInfo.type==3 && routeInfo.merchantId) " class="el-icon-plus" @click="selectMerchant()">选择门店</el-button>
<div <div
class="merchantNameLabel" class="merchantNameLabel"
v-if="formObj.merchantName && formObj.merchantId" v-if="formObj.merchantName && formObj.merchantId"
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<p>所属门店</p> <p>所属门店</p>
<div class="merchantName ellipsis-1">{{ formObj.merchantName }}</div> <div class="merchantName ellipsis-1">{{ formObj.merchantName }}</div>
</div> </div>
<div v-if="routeInfo.type!=1 && !routeInfo.merchantId">所有门店适用</div>
</div> </div>
<div class="equity-class" slot="selectEquity"> <div class="equity-class" slot="selectEquity">
<div class="equity-area" v-for="item in formObj.serviceList" :key="item.serviceCode"> <div class="equity-area" v-for="item in formObj.serviceList" :key="item.serviceCode">
...@@ -181,31 +182,42 @@ export default { ...@@ -181,31 +182,42 @@ export default {
}) })
}, },
submit(){ submit(){
this.$refs.submitRef.$refs.formRef.validate(valid => { if(this.routeInfo.type!=1 && !this.routeInfo.merchantId){
if(!valid) return; this.$refs.submitRef.$refs.formRef.validateField('serviceList', valid => {
if(this.routeInfo.id){ if(valid) return; //检验单个规则空才是通过
this.editService() this.addConfigApi()
return;
}
let { merchantId, merchantName } = this.formObj
let serviceIterm = []
this.formObj.serviceList.forEach(item => {
if(item.checked) {
let {serviceCode, serviceContent, serviceName, summary } = item
serviceIterm.push({serviceCode, serviceContent, serviceName, summary })
}
}) })
let params = { }else{
merchantId, this.$refs.submitRef.$refs.formRef.validate(valid => {
merchantName, console.log(222, valid)
serviceIterm if(!valid) return;
} this.addConfigApi()
this.$apis.serviceConfig.craeteEquity(params).then(res => {
if(res?.length){
this.$message.success('操作成功')
this.$router.push('/serviceConfig/index')
}
}) })
}
},
addConfigApi(){
if(this.routeInfo.id){
this.editService()
return;
}
let { merchantId, merchantName } = this.formObj
let serviceIterm = []
this.formObj.serviceList.forEach(item => {
if(item.checked) {
let {serviceCode, serviceContent, serviceName, summary } = item
serviceIterm.push({serviceCode, serviceContent, serviceName, summary })
}
})
let params = {
merchantId,
merchantName,
serviceIterm
}
this.$apis.serviceConfig.craeteEquity(params).then(res => {
if(res?.length){
this.$message.success('操作成功')
this.$router.push('/serviceConfig/index')
}
}) })
} }
} }
......
...@@ -210,12 +210,13 @@ ...@@ -210,12 +210,13 @@
addClause(type, row) { addClause(type, row) {
// 1新增 2查看 3编辑 // 1新增 2查看 3编辑
const { id } = row || {} const { id, merchantId } = row || {}
let query = { let query = {
type type
} }
if(type!=1){ if(type!=1){
query.id = id query.id = id
query.merchantId = merchantId
} }
const queryStr = encodeURIComponent(JSON.stringify(query)) const queryStr = encodeURIComponent(JSON.stringify(query))
this.$router.push('/serviceConfig/addClause/' + queryStr) this.$router.push('/serviceConfig/addClause/' + queryStr)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!