Commit 57e804ce by chenwq

feat(销售日报): 新增销售日报管理功能

添加销售日报配置页面、路由和API接口,实现日报人员名单和抽检人员名单的配置功能
1 parent d7a19f60
import { http } from '@/main'
// 销售日报配置项数据
const getSalesDailyConfig = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.sale`
params.routerMethod = 'dj.api.sale.store.daily.report.config.data'
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'post',
data: params,
sign: true
})
}
// 保存销售日报配置项
const saveSalesDailyConfig = params => {
params.method = `scrm.api.boutiquecoupon.rop.router.sale`
params.routerMethod = 'dj.api.sale.store.daily.report.config.save'
return http({
url: 'rop-scrm-boutiquecoupon/router',
method: 'post',
data: params,
sign: true,
returnAll: true
})
}
export default {
getSalesDailyConfig,
saveSalesDailyConfig
}
......@@ -94,6 +94,16 @@ const staticRoutes = Object.freeze([
path: '/saasOrder/index',
component: resolve => require([`@/views/saasOrder/index.vue`], resolve),
meta: {}
},
// 销售日报管理
{
name: 'salesDaily',
path: '/salesDaily/index',
component: resolve => require([`@/views/salesDaily/index.vue`], resolve),
meta: {}
}
])
export default staticRoutes
<template>
<div class="marketing">
<div class="addConfig-wrap">
<div class="header color-3 weight-6 text-16">
销售日报配置
</div>
<div class="config-wrap gl-form-page" v-loading="loading">
<glsx-combi-form ref="showSearch" labelWidth="105px" :isBlock="true" :formObj="editForm" :formData="editFormData"></glsx-combi-form>
</div>
<!--
<el-form ref="form" :model="form" label-width="154px">
<el-form-item label="所属企业:">
<el-select v-model="config.merchantId" placeholder="请选择" @change="handleMerchatChange" @visible-change="hideSelect">
<el-option v-for="item in merchantList" :key="item.merchantId" :label="item.merchantName" :value="item.merchantId"></el-option>
</el-select>
</el-form-item>
</el-form>
</div> -->
</div>
<GLFooter class="footer-panel">
<!-- <el-button @click="handleStaffClose" size="medium">取消</el-button> -->
<el-button type="primary" @click="handleStaffConfirm" size="medium" :loading="loading">保存</el-button>
</GLFooter>
</div>
</template>
<script>
export default {
data() {
return {
loading: false,
editForm: {
dailyReportStaffList: [],
randomCheckStaffList: []
},
editFormData: [
{
label: '所属企业',
name: 'merchantName',
type: 'input',
width: '436px',
isDisabled: true
},
{
label: '推送人',
name: 'robotStaffName',
type: 'input',
width: '436px',
isDisabled: true
},
{
label: '配置群',
name: 'groupName',
type: 'input',
width: '436px',
isDisabled: true
},
{
label: '日报人员名单',
name: 'dailyReportStaffList',
type: 'select',
width: '436px',
multiple: true,
optionList: [],
optionId: 'staffUuid',
optionLabel: 'staffName',
optionsName: 'staffList'
},
{
label: '抽检人员名单',
name: 'randomCheckStaffList',
type: 'select',
width: '436px',
multiple: true,
optionList: [],
optionId: 'staffUuid',
optionLabel: 'staffName',
optionsName: 'staffList'
}
],
baseData: {
staffList: []
}
}
},
mounted() {
this.getSalesDailyConfig()
},
methods: {
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName]?.length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
// 处理再次编辑时,之前已选人员当前已离职/职务变更的情况,直接去掉
dealSelectUser() {
const existUserList = this.baseData.staffList.map(item => item.staffUuid)
this.editForm.dailyReportStaffList = this.editForm.dailyReportStaffList.filter(item => existUserList.includes(item))
this.editForm.randomCheckStaffList = this.editForm.randomCheckStaffList.filter(item => existUserList.includes(item))
},
getSalesDailyConfig() {
this.$apis.salesDaily.getSalesDailyConfig({}).then(res => {
const { groupName, merchantName, robotStaffName, dailyReportStaffList = [], randomCheckStaffList = [] } = res
this.editForm = { groupName, merchantName, robotStaffName, dailyReportStaffList: dailyReportStaffList.map(item => item.staffUuid), randomCheckStaffList: randomCheckStaffList.map(item => item.staffUuid) }
this.baseData.staffList = res.staffList || []
console.log(res, 'staffList')
this.dealSelectUser()
this.getOptionsList('editFormData', false)
})
},
handleStaffConfirm() {
console.log(this.editForm)
if (this.loading) {
return true
}
this.loading = true
var params = {
dailyReportStaffList: [],
randomCheckStaffList: []
}
const attrList = ['dailyReportStaffList', 'randomCheckStaffList']
attrList.forEach(item => {
this.editForm[item].forEach(k => {
params[item].push({
staffUuid: k,
staffName: this.baseData.staffList.find(n => n.staffUuid == k).staffName
})
})
})
console.log(params, 'params')
this.$apis.salesDaily.saveSalesDailyConfig(params).then(res => {
console.log(res)
this.$message({
message: res.code == '0' ? '配置成功!' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
})
.finally(() => {
this.loading = false
})
}
}
}
</script>
<style lang="scss" scoped>
.footer-panel {
margin-top: 20px;
}
.search-groomname {
width: 402px;
margin: 12px 16px 0;
/deep/.el-input {
width: 402px;
}
}
.addConfig-wrap {
background: #fff;
.header {
width: 100%;
height: 58px;
border-bottom: 1px solid #e5e5e5;
line-height: 58px;
padding-left: 20px;
}
.ml12 {
margin-left: 12px;
}
.config-wrap {
padding: 32px 20px;
min-height: 600px;
}
.placeholder {
font-size: 14px;
color: #c0c6ce;
line-height: 20px;
}
}
.is-reverse {
transform: rotate(180deg);
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!