Commit 5e899daf by cen

Merge branch 'SAAS+V5.3.0-1117' of http://192.168.3.233:8090/saas_plus/dj-car-li…

…fe-system into SAAS+V5.3.0-1117
2 parents f71d751f 33f90100
......@@ -16,7 +16,7 @@ const request = (
params = {},
method = RequestMethods.GET,
noSignAttr = [],
options
options = {}
) => {
// 兼容线上dj和scrm appkey和secret不一样的情况
let apiName = ""
......@@ -93,18 +93,19 @@ const request = (
var reqData =
method === RequestMethods.POST
? {
baseURL: "/",
data: sign(params, noSignAttr, secret, signWay[apiName])
}
baseURL: "/",
data: sign(params, noSignAttr, secret, signWay[apiName])
}
: { params: sign(params, noSignAttr, secret, signWay[apiName]) }
reqData = reqData = Object.assign(reqData, options, {})
reqData = Object.assign(reqData, options, {})
// 请求进度
if (params?.onProcess) {
reqData.onUploadProgress = params.onProcess
}
// 取消请求
if (params?.cancelFun) {
reqData.cancelToken = new CancelToken(function excutor(c) {
reqData.cancelToken = new CancelToken(function excutor (c) {
params.cancelFun.cancel = c
})
}
......@@ -112,11 +113,13 @@ const request = (
// console.log(url)
// console.log(options)
// console.log(reqData)
return axios({
let axiosParams = {
url,
method,
...reqData
})
}
if (options.returnAll) axiosParams.headers = { 'return-all': true }
return axios(axiosParams)
/**
* mock,请使用以下代码。
......
......@@ -6,8 +6,32 @@ export function potentialCustomersPage(data) {
return request(data, "post")
}
// 潜客详情数据
export function potentialCustomersDetail(data) {
data.method = 'dj.api.smartcarlife.sale.potentialCustomers.detail'
return request(data, "post")
}
// 首次绑定/重新绑定4S店
export function bind4SStore(data) {
data.method = 'dj.api.smartcarlife.sale.potentialCustomers.bind'
return request(data, "post")
}
// 分页查询大区
export function regionPage(data) {
data.method = 'dj.api.smartcarlife.sale.region.page'
return request(data, "post")
}
// 获取大区人员
export function regionUserList(data) {
data.method = 'dj.api.smartcarlife.sale.region.userList'
return request(data, "post")
}
// 更新大区人员
export function updateRegionUser(data) {
data.method = 'dj.api.smartcarlife.sale.region.updateRegionUser'
return request(data, "post")
}
......@@ -59,9 +59,16 @@
>
</span>
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<span v-else-if="item.type === 'showTxt'">{{
formObj[item.name]
}}</span>
<span v-else-if="item.type === 'showTxt'" :style="{ ...item.txtStyle }">
<template v-if="item.formatter">
<span v-if="item.html" v-html="item.formatter(formObj)" />
<template v-if="!item.html">
<span :class="item.className ? item.className(formObj) : ''" />
<span v-text="item.formatter(formObj)" />
</template>
</template>
<template v-else>{{ formObj[item.name] || '-' }}</template>
</span>
<div v-else-if="item.type === 'input'">
<el-input
:placeholder="item.placeholder || '请输入' + item.label"
......
......@@ -119,6 +119,7 @@ service.interceptors.response.use(
// }
const dataAxios = response.data
const ruleResult = baseConfig.axios.result
const returnAll = response.config.returnAll
// 这个状态码是和后端约定的
// 有 code 代表这是一个后端接口 可以进行进一步的判断
var goBackArr = ["20", "21"]
......@@ -132,6 +133,7 @@ service.interceptors.response.use(
// return Promise.reject(new Error("登录超时,请重新登录"))
// return Promise.reject(new Error(response.message || 'Error'))
}
if(returnAll) return dataAxios
const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode
switch (+codeValue) {
case ruleResult.code_success_value:
......
......@@ -8,13 +8,13 @@ import Qs from "qs"
axios.defaults.withCredentials = true
// const expiresMinute = 60 // 过期时间(分钟)
// 创建一个错误
export function errorCreate(msg) {
export function errorCreate (msg) {
const error = new Error(msg)
errorLog(error)
throw error
}
// 记录和显示错误
function errorLog(error) {
function errorLog (error) {
// 添加到日志
store.dispatch("d2admin/log/push", {
message: "数据请求异常",
......@@ -47,7 +47,6 @@ const service = axios.create({
}
]
})
// 请求拦截器
service.interceptors.request.use(
(config) => {
......@@ -121,7 +120,8 @@ service.interceptors.response.use(
const ruleResult = baseConfig.axios.result
const errCodeMsg = baseConfig.errCode
const errCodes = Object.keys(errCodeMsg)
const returnAll = response.config.returnAll
const returnAll = response.config.headers['return-all']
// console.log("baseConfig", baseConfig)
// console.log("response", response)
// console.log("errCodes", errCodes)
......@@ -138,7 +138,7 @@ service.interceptors.response.use(
return errorCreate("登录超时,请重新登录")
// return Promise.reject(new Error(response.message || 'Error'))
}
if(returnAll) return dataAxios
if (returnAll) return dataAxios
const codeValue = dataAxios[ruleResult.code_key] || dataAxios.returnCode
switch (+codeValue) {
case ruleResult.code_success_value:
......
......@@ -32,7 +32,14 @@ export const routerName = {
authId: "9210102",
parentId: "92101",
label: "首次绑定",
handle: "handleEdit"
handle: "handleEdit",
ruleObj: {
attr: "potentialCustomersStatus",
rule: {
3: "首次绑定",
4: "重新绑定"
}
}
},
{
authId: "9210103",
......
......@@ -31,6 +31,7 @@
v-model="smsCode"
class="input-width"
maxlength="6"
placeholder="请输入验证码"
>
</el-input>
<el-button
......@@ -64,7 +65,7 @@ export default {
return this.visible
},
set (val) {
this.$emit('dialogClose', { flag: this.refreshFlag })
this.$emit('dialogClose')
}
},
phoneText () {
......@@ -75,6 +76,19 @@ export default {
return this.userInfo.loginAccount.phone
}
},
watch: {
visible: {
handler (val) {
if (val) {
this.phoneError = ''
this.smsError = ''
}
},
immediate: true,
deep: true
}
},
mounted () {
},
data () {
......@@ -95,21 +109,25 @@ export default {
},
methods: {
async getSmsCode (e) {
let { phone } = this
if (!phone) return this.phoneError = '手机号不能为空'
if (!/^1[3456789]\d{9}$/.test(phone)) return this.phoneError = '手机号格式错误'
this.countDownStatus = true
let data = await sendSmsCode({
phone
})
if (data) {
this.countDown()
let target = e.target
if (target.nodeName == 'SPAN') target = e.target.parentNode
target.blur()
this.notice.okTips('发送短信成功')
} else {
this.notice.errorTips('发送短信失败')
try {
let { phone } = this
if (!phone) return this.phoneError = '手机号不能为空'
if (!/^1[3456789]\d{9}$/.test(phone)) return this.phoneError = '手机号格式错误'
this.countDownStatus = true
let data = await sendSmsCode({
phone
})
if (data) {
this.countDown()
let target = e.target
if (target.nodeName == 'SPAN') target = e.target.parentNode
target.blur()
this.notice.okTips('发送短信成功')
} else {
this.countDownStatus = false
this.notice.errorTips('发送短信失败')
}
} catch (error) {
this.countDownStatus = false
}
},
......@@ -135,7 +153,7 @@ export default {
if (!/^1[3456789]\d{9}$/.test(phone)) return this.phoneError = '手机号格式错误'
if (!smsCode) return this.smsError = '验证码不能为空'
if (smsCode.length < 6) return this.smsError = '验证码错误,请重试!'
let { code} = await verifySmsCode({
let { code } = await verifySmsCode({
phone,
smsCode
})
......
......@@ -55,9 +55,10 @@
<script>
import { getFundUsageLimitDetail, getFundUsageLimitOaList } from "@api/usedCarManagement"
import { mapActions, mapState } from "vuex"
import reportTrackPageMixin from "@/mixins/reportTrackPageMixin"
export default {
name: "DetailDialog",
mixins: [reportTrackPageMixin],
components: {
},
props: {
......@@ -221,6 +222,7 @@ export default {
})
},
handleExport () {
this.setReportTrackData(0, 'usedcar_fund_warning_oa_list_export', {})
let params = {
method: "dj.smartcarlife.api.fund.usage.limit.oa.export.async",
fundUsageLimitId: this.paramsObj.id
......
......@@ -21,9 +21,6 @@
每次“新增使用额度”都会重置上次限额,且上次未使用额度不会延续叠加使用(仅当期有效);
预警通知触发条件:当额度使用率达到70%、80%、90%、95%时,各触发一次预警;
“使用额度”仅控制二手车业务自动付款,超过当期额度后无法自动付款。
<!-- 每次“新增使用额度”都会重置上次限额,且上次未使用额度不会延续叠加使用(仅当期有效);
预警通知触发条件:当额度使用率达到70%、80%、90%、95%时,各触发一次预警;
“使用额度”仅控制二手车业务自动付款,超过当期额度后无法自动付款。 -->
</div>
<el-form
label-width="150px"
......@@ -38,10 +35,12 @@
prop="usageLimit"
>
<el-input
v-model="infoForm.usageLimit"
v-model.number="infoForm.usageLimit"
class="input-width"
:maxlength="15"
@input="handleUsageLimitNum"
@blur="handleBlur"
placeholder="请输入当前使用额度"
>
</el-input>
......@@ -54,6 +53,8 @@
<el-input
v-model="infoForm.warningEmail"
class="input-width"
:maxlength="200"
placeholder="请输入预警通知邮箱(多邮箱用逗号隔开,最多五个)"
>
</el-input>
</el-form-item>
......@@ -93,7 +94,9 @@ export default {
visible: {
handler (val) {
if (val) {
this.oldVal = ''
this.infoForm = this.$options.data.call(this).infoForm
this.$refs?.editRef?.resetFields()
}
},
immediate: true,
......@@ -155,6 +158,10 @@ export default {
}
},
methods: {
handleBlur (event) {
let { usageLimit } = this.infoForm
this.infoForm.usageLimit = usageLimit <= 0 ? '' : usageLimit
},
handleUsageLimitNum (event) {
this.infoForm.usageLimit = limitPrice(event, this.oldVal, 15, 2)
this.oldVal = this.infoForm.usageLimit
......
......@@ -14,8 +14,8 @@
>
<template #inputRangeHtml>
<input-range
start-placeholder="最小金额"
end-placeholder="最大金额"
start-placeholder="最小额度"
end-placeholder="最大额度"
:display-value="searchForm.amtList"
maxLength="15"
inputMaxLength="15"
......@@ -75,7 +75,7 @@
</div>
</template>
<div class="btns flex">
<span data-event-code="usedcar_fund_warning_management_list_export">
<span data-event-code="usedcar_add_fund_warning">
<auth-button
category="Button"
:show-btn-ids="['9051501']"
......@@ -102,7 +102,15 @@
slot-scope="scope"
>
<!-- 详情 -->
<span style="margin-right: 10px">
<span
style="margin-right: 10px"
:data-track="
JSON.stringify({
id: scope.scope.id
})
"
data-event-code="used_car_fund_warning_detail"
>
<auth-button
:data="scope.scope"
:show-btn-ids="['9051503']"
......@@ -175,6 +183,7 @@ export default {
{
label: "认证手机号",
name: "authPhone",
inputType: "number",
type: "input",
isClear: true,
maxlength: 20
......
......@@ -91,7 +91,10 @@ import {
NB_TRANSFER_STATUS,
} from "../contant"
import dayjs from 'dayjs'
import reportTrackPageMixin from "@/mixins/reportTrackPageMixin"
export default {
mixins: [reportTrackPageMixin],
name: "DetailDialog",
components: {
},
......@@ -121,6 +124,7 @@ export default {
visible: {
handler (val) {
if (val) {
this.pushLoading = false
this.loading = true
this.getDetail()
}
......@@ -267,6 +271,7 @@ export default {
}
},
dataPush () {
this.setReportTrackData(0, 'usedcar_payment_push', {})
this.pushLoading = true
this.$confirm('请确认是否要执行当前操作?', '提示', {
confirmButtonText: '确定',
......@@ -276,6 +281,7 @@ export default {
}).then(() => {
const ids = [this.paramsObj.id]
batchRepush({ idList: ids }).then(res => {
this.pushLoading = false
this.notice.okTips()
this.getDetail()
this.refreshFlag = true
......@@ -289,6 +295,7 @@ export default {
},
handleReceipt (url) {
this.setReportTrackData(0, 'usedcar_payment_receipt', {})
window.open(url)
}
}
......
......@@ -68,7 +68,7 @@
<div class="d2-container-content">
<d2-table-header>
<span
data-event-code="usedcar_payment_management_list_export"
data-event-code="usedcar_payment_push_list"
style="margin-right: 10px;"
>
<auth-button
......@@ -108,14 +108,22 @@
slot-scope="scope"
>
<!-- 详情 -->
<span style="margin-right: 10px">
<span
style="margin-right: 10px"
:data-track="
JSON.stringify({
id: scope.scope.id
})
"
data-event-code="usedcar_payment_detail"
>
<auth-button
:data="scope.scope"
:show-btn-ids="['9051403']"
/>
</span>
<!-- 回单 -->
<span>
<span data-event-code="usedcar_payment_receipt">
<auth-button
:data="scope.scope"
:show-btn-ids="['9051404']"
......@@ -509,7 +517,7 @@ export default {
if (!selectedData?.length) {
this.pushPayBillLoading = false
this.$message({
message: "请选择要重推的明细",
message: "请选择要重推的付款单",
type: "warning",
showClose: true
})
......@@ -536,14 +544,15 @@ export default {
type: 'warning',
closeOnClickModal: false
}).then(() => {
this.pushPayBillLoading = false
batchRepush({ idList: ids }).then(res => {
this.pushPayBillLoading = false
this.notice.okTips()
this.$refs.usedCarPaymentManageTable.refreshTable()
}).catch(err => {
this.pushPayBillLoading = false
})
}).catch(err => {
this.pushPayBillLoading = false
console.log(err)
})
},
handleReceipt (row) {
......
<!-- 发货单详情弹窗 -->
<template>
<div>
<d2-dialog title="详情" :is-visible="detailVisible" class="stockMonthDailog" width="1080px" :no-cancel="true" btn-ok-label="关闭" @closeDialog="handleClose" @confirmDialog="handleClose">
<div class="detail-info">
<div class="title">门店详情</div>
<glsx-combi-form class="edit-form-container" ref="editFormRef" :label-width="labelWidth" :form-obj="detailInfo" :form-data="editFormData">
</glsx-combi-form>
<div class="title">拜访记录</div>
<d2-table ref="recordTable" :table-data="detailInfo.visitRecordList" :table-params="tableParams" :has-page="hasPage">
</d2-table>
</div>
</d2-dialog>
</div>
</template>
<script>
import { Util, deepClone } from '@/common/util'
import { mapActions } from 'vuex'
import { potentialCustomersDetail } from "@api/salesManagement"
import { busTypeOpt, cooperModeOpt, flowSituateOpt, potentialCustomerOpt } from '../constant/baseData'
import { baseConfig } from '@/main'
export default {
name: 'CustomerDetailDialog',
data() {
const editItemStyle = {
width: "50%",
marginRight: '0px'
}
const contentStyle = {
width: "358px",
display: 'inline-block',
'word-break': 'break-all',
'white-space': 'pre-wrap'
}
return {
userInfo: this.$store.state.d2admin.user.info,
labelWidth: '140px',
detailInfo: {},
editFormData: [{
label: '状态',
name: 'potentialCustomersStatus',
type: 'showTxt',
style: editItemStyle,
formatter: (cellValue) => {
return (
this.baseData.potentialCustomerOpt.find(
(item) => item.confId == cellValue.potentialCustomersStatus
)?.confLabel || "-"
)
},
className: (cellValue) => {
return {
1: "yellowSpot",
2: "redSpot",
3: "greenSpot",
4: "greenSpot"
}[cellValue.potentialCustomersStatus]
}
}, {
label: '门店名称',
name: 'storeName',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
}, {
label: '业务类型',
name: 'businessTypeList',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (cellValue) => {
return cellValue.businessTypeList ? cellValue.businessTypeList.map(item => this.baseData.busTypeOpt.find(opt => opt.confId == item)?.confLabel || '').join(',') : '-'
}
}, {
label: '合作模式',
name: 'cooperationMode',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (cellValue) => {
return this.baseData.cooperModeOpt.find(opt => opt.confId == cellValue.cooperationMode)?.confLabel || '-'
}
}, {
label: '直营品牌',
name: 'brandList',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (cellValue) => {
return cellValue.brandList ? cellValue.brandList.map(item => item.subBrandName).join(',') : '-'
}
}, {
label: '流量情况',
name: 'flowSituation',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (cellValue) => {
return this.baseData.flowSituateOpt.find(opt => opt.confId == cellValue.flowSituation)?.confLabel || '-'
}
}, {
label: '所在地区',
name: '',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (cellValue) => {
return (cellValue.provinceName || '') + (cellValue.city || '') + (cellValue.districtName || '') || '-'
}
}, {
label: '详细地址',
name: 'address',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle
}, {
label: '店面门头照片',
name: 'storePhoto',
type: 'showTxt',
style: { width: '100%', marginRight: '0px' }
}, {
label: '备注信息',
name: 'remark',
type: 'showTxt',
style: { width: '100%', marginRight: '0px' },
txtStyle: { ...contentStyle, width: '890px' }
}, {
label: '店总',
name: 'salePotentialCustomerPersonnelInfoDTOList',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (cellValue) => {
const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
// 人员类型(1-店总 2-销售经理 3-交付经理 4-装饰经理 5-保险经理)
return (list && list.length) ? (list.filter(item => item.personnelType == 1).map(item => item.personnelName).join(',') || '-') : '-'
}
}, {
label: '销售经理',
name: '',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (cellValue) => {
const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
// 人员类型(1-店总 2-销售经理 3-交付经理 4-装饰经理 5-保险经理)
return (list && list.length) ? (list.filter(item => item.personnelType == 2).map(item => item.personnelName).join(',') || '-') : '-'
}
}, {
label: '交付经理',
name: '',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (cellValue) => {
const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
// 人员类型(1-店总 2-销售经理 3-交付经理 4-装饰经理 5-保险经理)
return (list && list.length) ? (list.filter(item => item.personnelType == 3).map(item => item.personnelName).join(',') || '-') : '-'
}
}, {
label: '装饰经理',
name: '',
type: 'showTxt',
style: editItemStyle,
txtStyle: contentStyle,
formatter: (cellValue) => {
const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
// 人员类型(1-店总 2-销售经理 3-交付经理 4-装饰经理 5-保险经理)
return (list && list.length) ? (list.filter(item => item.personnelType == 4).map(item => item.personnelName).join(',') || '-') : '-'
}
}, {
label: '保险经理',
name: '',
type: 'showTxt',
txtStyle: contentStyle,
style: editItemStyle,
formatter: (cellValue) => {
const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
// 人员类型(1-店总 2-销售经理 3-交付经理 4-装饰经理 5-保险经理)
return (list && list.length) ? (list.filter(item => item.personnelType == 5).map(item => item.personnelName).join(',') || '-') : '-'
}
}],
// 拜访记录表格
hasPage: false,
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: false,
tableColumns: [{
label: '跟进人',
prop: 'followUpPersonName'
// width: '150px'
}, {
label: '拜访时间',
prop: 'visitTime'
}, {
label: '联系人',
prop: 'contactPerson'
}, {
label: '拜访内容',
prop: 'visitContent'
}, {
label: '拜访照片',
prop: 'visitPhotos'
}, {
label: '拜访签到',
prop: 'checkInLocation'
}]
},
baseData: {
busTypeOpt: busTypeOpt,
cooperModeOpt: cooperModeOpt,
flowSituateOpt: flowSituateOpt,
potentialCustomerOpt: potentialCustomerOpt
}
}
},
props: {
detailVisible: {
type: Boolean,
default: false
},
recordInfo: {
type: Object,
default: () => { }
}
},
computed: {
},
mounted() {
this.getDetail()
},
methods: {
...mapActions({
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
getDetail() {
var params = { id: deepClone(this.recordInfo.id) }
potentialCustomersDetail(params).then(res => {
console.log(res)
this.detailInfo = res
// this.detailInfo.storeName = '门店名称很长很长很长很长就折行处理,折行注意行距20px43434343433'
})
},
handleClose() {
this.$emit('dialogClose')
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
padding: 0 20px 20px;
}
::v-deep .el-dialog__header {
color: #333333;
font-size: 20px;
font-weight: bold;
border-bottom: 1px solid #e5e5e5;
}
::v-deep .el-form-item--small .el-form-item__label,
::v-deep .el-form-item--small .el-form-item__content {
line-height: 20px;
}
.detail-info {
// display: flex;
// align-items: center;
// justify-content: space-between;
// color: #666666ff;
// font-size: 14px;
// margin-bottom: 16px;
.title {
width: 100%;
height: 50px;
line-height: 50px;
font-weight: 500;
color: #333333;
font-size: 16px;
font-weight: bold;
margin-bottom: 16px;
border-bottom: 1px solid #e5e5e5;
}
span {
color: #333333ff;
}
.add-btn {
font-size: 14px;
color: #5850ff;
cursor: pointer;
}
}
.deliveryCardCon {
max-height: 60vh;
overflow: auto;
}
.lookNumber {
// font-size: 14px;
// color: ;
// color: #5850ff!important;
cursor: pointer;
margin-left: 8px;
}
.table-wrap {
border: 1px solid #e5e5e5;
padding: 16px;
box-sizing: border-box;
margin-top: 16px;
// /deep/ .el-form-item__error {
// padding-top: 2px;
// z-index: 9999999;
// position: static;
// }
}
</style>
......@@ -21,6 +21,25 @@ export const busTypeOpt = [
}
]
export const potentialCustomerOpt = [
{
confId: 1,
confLabel: "跟进中"
},
{
confId: 2,
confLabel: "未签约"
},
{
confId: 3,
confLabel: "已签约"
},
{
confId: 4,
confLabel: "已绑定"
}
]
export const cooperModeOpt = [
{
confId: "1",
......
<!-- 编辑 - 组织架构信息 -->
<template>
<d2-container class="edit-page edit-tmpl">
<div style="padding: 20px">
<glsx-combi-form class="edit-form-container" ref="editFormRef" label-width="250px" default-width="314px" :isBlock="isBlock" :form-ref="editChildRef" :form-obj="editData" :form-data="editFormData" :form-rules="formRules">
</glsx-combi-form>
<div class="footer">
<el-button @click="handleConfirm" type="primary" :loading="$store.state.d2admin.loading.value">提交</el-button>
<el-button @click="handleCancel">取消</el-button>
</div>
</div>
</d2-container>
</template>
<script>
import { deepClone } from "@/common/util"
import { regionUserList, updateRegionUser } from '@api/salesManagement'
export default {
name: "EditOrganize",
data() {
return {
editChildRef: "editChildRef",
isBlock: true,
routeInfo: {},
// 控制“对账字段”,确保拿到已选数据
showTmpl: false,
tmplSelectList: [],
formRules: {
regionName: [{ required: true, message: "请输入大区名称" }]
},
editData: {
regionName: '',
operateUserId: '',
salesList: []
},
editFormData: [
{
label: "大区名称",
name: "regionName",
type: "input",
maxlength: 100,
isDisabled: true
}, {
label: '区域运营',
name: 'operateUserId',
type: 'select',
isClear: true,
optionList: [],
optionId: 'uuid',
optionLabel: 'staffName',
optionsName: 'operateUserOpt',
changeAttr: (value, targetItem) => {
console.log(value, targetItem)
this.editData.operateUserId = value
this.dealListDisable()
}
}, {
label: '销售人员',
name: 'salesList',
type: 'select',
isClear: true,
multiple: true,
optionList: [],
optionId: 'uuid',
optionLabel: 'staffName',
optionsName: 'salesPersonOpt',
changeAttr: (value, targetItem) => {
console.log(value, targetItem)
this.editData.salesList = value
this.dealListDisable()
}
}
],
selectedStaffList: [],
baseData: {
staffList: [],
operateUserOpt: [],
salesPersonOpt: []
}
}
},
mounted() {
this.routeInfo.userList = this.$route.query.userList || []
this.editData.id = this.$route.query.id
this.editData.regionName = this.$route.query.regionName
this.getregionUserList()
this.getOptionsList("editFormData", false)
},
methods: {
getregionUserList() {
regionUserList({}).then((res) => {
this.baseData.staffList = deepClone(res.staffList)
this.baseData.operateUserOpt = deepClone(res.staffList)
this.baseData.salesPersonOpt = deepClone(res.staffList)
this.selectedStaffList = res.selectedStaffList
this.dealRegionList()
})
},
dealListDisable() {
// 其他大区已选的人,在当前大区不能再选
const otherRegionSelectList = this.selectedStaffList.filter(item => item.regionId != this.editData.id).map(item => item.userId)
this.baseData.operateUserOpt.forEach((item, idx) => {
if (otherRegionSelectList.includes(item.uuid)) {
this.baseData.operateUserOpt[idx].isDisabled = true
} else {
// 本大区下,已选的销售人员,不能再选为区域运营
this.baseData.operateUserOpt[idx].isDisabled = !!this.editData.salesList.includes(item.uuid)
}
})
this.baseData.salesPersonOpt.forEach((item, idx) => {
if (otherRegionSelectList.includes(item.uuid)) {
this.baseData.salesPersonOpt[idx].isDisabled = true
} else {
// 本大区下,已选的区域运营,不能再选为销售人员
this.baseData.salesPersonOpt[idx].isDisabled = this.editData.operateUserId == item.uuid
}
})
this.getOptionsList('editFormData', false)
console.log(this.editFormData)
},
dealRegionList() {
const existUserList = this.baseData.salesPersonOpt.map(item => item.uuid)
// userType 人员类型(1.大区经理,2.销售人员)
this.routeInfo.userList.forEach(item => {
if (existUserList.includes(item.userId)) {
if (item.userType === 1) {
this.editData.operateUserId = item.userId
}
if (item.userType === 2) {
this.editData.salesList.push(item.userId)
}
}
})
this.dealListDisable()
},
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', 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 (['select', 'radio'].includes(item.type) && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', 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)
}
}
})
}
},
findInfo(uuid) {
return this.baseData.staffList.find(item => item.uuid === uuid) || {}
},
getParams() {
const params = {
id: this.editData.id,
userList: []
}
if (this.editData.operateUserId) {
params.userList.push({
userId: this.editData.operateUserId,
// 人员类型(1.大区经理,2.销售人员)
userType: 1,
userName: this.findInfo(this.editData.operateUserId).staffName || '',
userPhone: this.findInfo(this.editData.operateUserId).staffPhone || ''
})
}
this.editData.salesList.forEach(item => {
params.userList.push({
userId: item,
// 人员类型(1.大区经理,2.销售人员)
userType: 2,
userName: this.findInfo(item).staffName || '',
userPhone: this.findInfo(item).staffPhone || ''
})
})
return params
},
handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid) => {
if (valid) {
const params = this.getParams()
console.log(params)
updateRegionUser(params).then(res => {
console.log(res)
this.$message.success("操作成功")
this.handleCancel()
})
}
})
},
// 取消按钮返回列表页
handleCancel() {
this.$router.push({
name: "organize"
})
}
}
}
</script>
<style lang="scss" scoped>
.edit-page.edit-tmpl {
margin: 0 20px 20px;
background: #ffffff;
.title {
height: 50px;
line-height: 50px;
padding: 0 20px;
border-bottom: 1px solid #e5e5e5;
font-size: 16px;
font-weight: 600;
color: #333333;
}
}
.edit-tmpl {
.add-mer-btn {
margin-left: 12px;
}
}
.footer {
text-align: center;
}
</style>
......@@ -39,14 +39,14 @@ export default {
prop: 'userList',
formatter: (cellValue) => {
// 人员类型(1.大区经理,2.销售人员)
return cellValue.userList.length ? cellValue.userList.filter(item => item.userType == 1).map(item => item.userName).join(',') : '--'
return (cellValue.userList && cellValue.userList.length) ? (cellValue.userList.filter(item => item.userType == 1).map(item => item.userName).join(',') || '-') : '-'
}
}, {
label: '销售人员',
prop: 'userList',
formatter: (cellValue) => {
// 人员类型(1.大区经理,2.销售人员)
return cellValue.userList.length ? cellValue.userList.filter(item => item.userType == 2).map(item => item.userName).join(',') : '--'
return (cellValue.userList && cellValue.userList.length) ? cellValue.userList.filter(item => item.userType == 2).map(item => item.userName).join(',') || '-' : '-'
}
}]
},
......@@ -66,12 +66,12 @@ export default {
methods: {
handleEdit(row = {}) {
const editType = row?.id ? 'edit' : 'add'
this.$router.push({
name: "editOrganize",
query: {
editType: editType,
id: row?.id || ''
id: row?.id || '',
regionName: row?.regionName || '',
userList: row?.userList || []
}
})
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!