Commit fdd8fa68 by 前端

Merge branch 'xuyl_dev_v2.4.0' into 'v2.4.0'

抽取获取跟进员工方法

See merge request !122
2 parents fc70c0f1 bc8f87b4
import Vue from 'vue'
import { message } from '../plugins/element.js'
import { getStaffList } from '@/api/modules/clientManage'
// import { Message, MessageBox, Loading } from 'element-ui';
// import moment from 'moment'
let loadingInstance = ''
export const Util = {
getExplorer: function() {
var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null
......@@ -30,7 +30,7 @@ export const Util = {
return browserType
},
exportFn:function(url) {
exportFn: function(url) {
let browserType = getExplorer()
if (browserType == 'QQ') {
window.open(url)
......@@ -44,25 +44,25 @@ export const Util = {
/**
* 校验手机号码格式
*/
checkPhone: function (mobile) {
let myreg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/;
return myreg.test(mobile);
checkPhone: function(mobile) {
let myreg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
return myreg.test(mobile)
},
/**
* 校验固定电话
*/
validationTel: function (tel) {
let reg = /^0[\d]{2,3}-[\d]{7,8}$/;
return reg.test(tel);
validationTel: function(tel) {
let reg = /^0[\d]{2,3}-[\d]{7,8}$/
return reg.test(tel)
},
/**
* 是否特殊字符
*/
isSpecialLetter: function (str) {
let reg = new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]");
return reg.test(str);//true/false
isSpecialLetter: function(str) {
let reg = new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]")
return reg.test(str) //true/false
},
/**
......@@ -83,41 +83,41 @@ export const Util = {
/**
* 获取浏览器参数
*/
getUrlParams: function (name) {
getUrlParams: function(name) {
let vars = [],
hash;
let hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
hash
let hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&')
for (let i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
hash = hashes[i].split('=')
vars.push(hash[0])
vars[hash[0]] = hash[1]
}
return vars[name];
return vars[name]
},
/**
* 根据当前时间,计算往后30天的日期
*/
getAfterDate: function (day) {//计算往后day天
let date1 = new Date();
let date2 = new Date(date1);
let time = 30;
getAfterDate: function(day) {
//计算往后day天
let date1 = new Date()
let date2 = new Date(date1)
let time = 30
if (day) {
time = day;
time = day
}
date2.setDate(date1.getDate() + time);
date2.setDate(date1.getDate() + time)
let _date = date2.getFullYear() + '-' + (date2.getMonth() + 1) + '-' + date2.getDate();
let _date = date2.getFullYear() + '-' + (date2.getMonth() + 1) + '-' + date2.getDate()
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate()
};
}
},
/**
* 日期格式转换
*/
......@@ -137,7 +137,7 @@ export const Util = {
/**
* 字段截取
*/
cutStr: function (str, num) {
cutStr: function(str, num) {
if (!str) {
return ''
}
......@@ -156,7 +156,8 @@ export const Util = {
/**
* 处理输入框只能输入30个字符,一个汉字2个字符,字母数字1个字符,超过截取最大数量字符
*/
cutMaxCharStr:function(e){//e为传入字符串
cutMaxCharStr: function(e) {
//e为传入字符串
let str = e
var len = 0
var singleNum = 0
......@@ -196,13 +197,39 @@ export const Util = {
return str.substr(0, subLen)
}
return str
},
getStaffListApi: async function(val, searchFormLlist, searchName) {
const searchForm = JSON.parse(searchFormLlist)
const params = {
staffName: val ? val.trim() : ''
}
let id, staff
await getStaffList(params).then(res => {
if (res.length == 0) {
return ''
}
id = searchForm.findIndex(item => {
return item.name == searchName
})
staff = res.map(item => {
return {
label: item.staffName,
value: item.staffName
}
})
staff.unshift({
label: '全部',
value: ''
})
})
console.log(id, staff)
return { id, staff }
}
}
export const validationTel = Util.validationTel;
export const checkPhone = Util.checkPhone;
export const getExplorer=Util.getExplorer;
export const exportFn=Util.exportFn;
export const cutMaxCharStr=Util.cutMaxCharStr;
export const validationTel = Util.validationTel
export const checkPhone = Util.checkPhone
export const getExplorer = Util.getExplorer
export const exportFn = Util.exportFn
export const cutMaxCharStr = Util.cutMaxCharStr
export const getStaffListApi = Util.getStaffListApi
\ No newline at end of file
......@@ -113,7 +113,6 @@
<script>
import { marketingPeopleListShow, getcrowdManageList, customerClusterListExport } from '@/api/modules/clientDataOverview'
import { getStaffList } from '@/api/modules/clientManage'
import marketingPlan from './components/marketingPlan.vue'
import Swiper from 'swiper'
import 'swiper/dist/css/swiper.min.css'
......@@ -317,7 +316,7 @@ export default {
this.crowdGroupDesc = crowInfo.crowdGroupDesc
this.activeName = crowInfo.selectTab == 'first' ? 'first' : 'second'
}
this.getStaffList()
this.getFollowStaffList()
},
mounted() {
this.screenWidth = document.body.clientWidth
......@@ -372,6 +371,14 @@ export default {
}
},
methods: {
// 获取跟进员工
async getFollowStaffList() {
const formListBackup = JSON.stringify(this.marketPeopleFormList)
const { id, staff } = await this.$Utils.getStaffListApi('', formListBackup, 'followStaff')
this.$nextTick(() => {
this.marketPeopleFormList[id].optionList = staff
})
},
goback() {
if (this.$route.query && this.$route.query.flag) {
this.$router.push('/clientDataOverview/index')
......@@ -436,30 +443,6 @@ export default {
goDetail(scope) {
this.$router.push('/clientManage/clientDetail?id=' + scope.oneId)
},
// 获取跟进员工
getStaffList(val) {
const params = {
staffName: val ? val.trim() : ''
}
getStaffList(params).then(res => {
if (res.length == 0) {
return ''
}
const id = this.marketPeopleFormList.findIndex(item => {
return item.name == 'followStaff'
})
const staff = res.map(item => {
return {
label: item.staffName,
value: item.staffName
}
})
staff.unshift({ label: '全部', value: '' })
this.$nextTick(() => {
this.marketPeopleFormList[id].optionList = staff
})
})
},
// 搜索表格
searchTable() {
this.$refs.marketPeople.refreshTable()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!