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 Vue from 'vue'
import { message } from '../plugins/element.js' import { message } from '../plugins/element.js'
import { getStaffList } from '@/api/modules/clientManage'
// import { Message, MessageBox, Loading } from 'element-ui'; // import { Message, MessageBox, Loading } from 'element-ui';
// import moment from 'moment' // import moment from 'moment'
let loadingInstance = '' let loadingInstance = ''
export const Util = { export const Util = {
getExplorer: function() {
var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = 'IE'
} else if (ua.match(/firefox/) != null) {
browserType = '火狐'
} else if (ua.match(/ubrowser/) != null) {
browserType = 'UC'
} else if (ua.match(/opera/) != null) {
browserType = '欧朋'
} else if (ua.match(/bidubrowser/) != null) {
browserType = '百度'
} else if (ua.match(/metasr/) != null) {
browserType = '搜狗'
} else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
browserType = 'QQ'
} else if (ua.match(/maxthon/) != null) {
browserType = '遨游'
} else {
browserType = '谷歌'
}
return browserType
},
exportFn: function(url) {
let browserType = getExplorer()
if (browserType == 'QQ') {
window.open(url)
return
}
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = url
document.body.appendChild(iframe)
},
/**
* 校验手机号码格式
*/
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)
},
getExplorer: function() { /**
var ua = navigator.userAgent.toLocaleLowerCase() * 校验固定电话
var browserType = null */
if (ua.match(/msie/) != null || ua.match(/trident/) != null) { validationTel: function(tel) {
browserType = 'IE' let reg = /^0[\d]{2,3}-[\d]{7,8}$/
} else if (ua.match(/firefox/) != null) { return reg.test(tel)
browserType = '火狐' },
} else if (ua.match(/ubrowser/) != null) {
browserType = 'UC'
} else if (ua.match(/opera/) != null) {
browserType = '欧朋'
} else if (ua.match(/bidubrowser/) != null) {
browserType = '百度'
} else if (ua.match(/metasr/) != null) {
browserType = '搜狗'
} else if (ua.match(/tencenttraveler/) != null || ua.match(/qqbrowse/) != null) {
browserType = 'QQ'
} else if (ua.match(/maxthon/) != null) {
browserType = '遨游'
} else {
browserType = '谷歌'
}
return browserType
},
exportFn:function(url) {
let browserType = getExplorer()
if (browserType == 'QQ') {
window.open(url)
return
}
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = url
document.body.appendChild(iframe)
},
/**
* 校验手机号码格式
*/
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);
},
/**
* 是否特殊字符
*/
isSpecialLetter: function (str) {
let reg = new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]");
return reg.test(str);//true/false
},
/**
* 获取当前时间
*/
// getCurrentDate: function () {
// let time = new Date();
// let y = time.getFullYear();
// let m = time.getMonth() + 1;
// let d = time.getDate();
// return {
// date: y + '/' + m + '/' + d
// }
// },
/**
* 获取浏览器参数
*/
getUrlParams: function (name) {
let vars = [],
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];
}
return vars[name];
},
/**
* 根据当前时间,计算往后30天的日期
*/
getAfterDate: function (day) {//计算往后day天
let date1 = new Date();
let date2 = new Date(date1);
let time = 30;
if (day) {
time = day;
}
date2.setDate(date1.getDate() + time);
let _date = date2.getFullYear() + '-' + (date2.getMonth() + 1) + '-' + date2.getDate();
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate()
};
},
/**
* 日期格式转换
*/
// dateFormate: function (str, type) {
// let txt = 'YYYY-MM-DD HH:mm:ss'
// if (!str) {
// return false;
// }
// if (type) {
// txt = type
// }
// let n = new Date(str);
// const m = moment(n).format(txt)
// return m
// },
/**
* 字段截取
*/
cutStr: function (str, num) {
if (!str) {
return ''
}
let m = 10 /**
let n = str * 是否特殊字符
if (num) { */
m = num isSpecialLetter: function(str) {
} let reg = new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]")
if (str.length > m) { return reg.test(str) //true/false
n = str.slice(0, m) + '...' },
}
return n
},
/** /**
* 处理输入框只能输入30个字符,一个汉字2个字符,字母数字1个字符,超过截取最大数量字符 * 获取当前时间
*/ */
cutMaxCharStr:function(e){//e为传入字符串 // getCurrentDate: function () {
let str = e // let time = new Date();
var len = 0 // let y = time.getFullYear();
var singleNum = 0 // let m = time.getMonth() + 1;
var doubleNum = 0 // let d = time.getDate();
for (var i = 0; i < e.length; i++) { // return {
var c = e.charCodeAt(i) // date: y + '/' + m + '/' + d
//单字节加1 // }
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
len++ // },
} else {
len += 2 /**
} * 获取浏览器参数
} */
if (len > 30) { getUrlParams: function(name) {
message.error('字数已达上限') let vars = [],
var subLen = 0 hash
var subLen1 = 0 let hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&')
var subLen2 = 0 for (let i = 0; i < hashes.length; i++) {
for (var v = 0; v < e.length; v++) { hash = hashes[i].split('=')
var ch = e.charCodeAt(v) vars.push(hash[0])
//单字节 vars[hash[0]] = hash[1]
if ((ch >= 0x0001 && ch <= 0x007e) || (0xff60 <= ch && ch <= 0xff9f)) {
singleNum += 1
subLen1++
} else {
doubleNum += 2
subLen2++
} }
if (singleNum + doubleNum >= 30) { return vars[name]
subLen = subLen1 + subLen2 },
console.log(subLen1, subLen2, subLen)
console.log(singleNum, singleNum, '单双数') /**
break * 根据当前时间,计算往后30天的日期
*/
getAfterDate: function(day) {
//计算往后day天
let date1 = new Date()
let date2 = new Date(date1)
let time = 30
if (day) {
time = day
} }
} date2.setDate(date1.getDate() + time)
return str.substr(0, subLen)
}
return str
}
} let _date = date2.getFullYear() + '-' + (date2.getMonth() + 1) + '-' + date2.getDate()
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate()
}
},
/**
* 日期格式转换
*/
// dateFormate: function (str, type) {
// let txt = 'YYYY-MM-DD HH:mm:ss'
// if (!str) {
// return false;
// }
// if (type) {
// txt = type
// }
// let n = new Date(str);
// const m = moment(n).format(txt)
// return m
// },
/**
* 字段截取
*/
cutStr: function(str, num) {
if (!str) {
return ''
}
export const validationTel = Util.validationTel; let m = 10
export const checkPhone = Util.checkPhone; let n = str
export const getExplorer=Util.getExplorer; if (num) {
export const exportFn=Util.exportFn; m = num
export const cutMaxCharStr=Util.cutMaxCharStr; }
if (str.length > m) {
n = str.slice(0, m) + '...'
}
return n
},
/**
* 处理输入框只能输入30个字符,一个汉字2个字符,字母数字1个字符,超过截取最大数量字符
*/
cutMaxCharStr: function(e) {
//e为传入字符串
let str = e
var len = 0
var singleNum = 0
var doubleNum = 0
for (var i = 0; i < e.length; i++) {
var c = e.charCodeAt(i)
//单字节加1
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
len++
} else {
len += 2
}
}
if (len > 30) {
message.error('字数已达上限')
var subLen = 0
var subLen1 = 0
var subLen2 = 0
for (var v = 0; v < e.length; v++) {
var ch = e.charCodeAt(v)
//单字节
if ((ch >= 0x0001 && ch <= 0x007e) || (0xff60 <= ch && ch <= 0xff9f)) {
singleNum += 1
subLen1++
} else {
doubleNum += 2
subLen2++
}
if (singleNum + doubleNum >= 30) {
subLen = subLen1 + subLen2
console.log(subLen1, subLen2, subLen)
console.log(singleNum, singleNum, '单双数')
break
}
}
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 getStaffListApi = Util.getStaffListApi
\ No newline at end of file \ No newline at end of file
...@@ -113,7 +113,6 @@ ...@@ -113,7 +113,6 @@
<script> <script>
import { marketingPeopleListShow, getcrowdManageList, customerClusterListExport } from '@/api/modules/clientDataOverview' import { marketingPeopleListShow, getcrowdManageList, customerClusterListExport } from '@/api/modules/clientDataOverview'
import { getStaffList } from '@/api/modules/clientManage'
import marketingPlan from './components/marketingPlan.vue' import marketingPlan from './components/marketingPlan.vue'
import Swiper from 'swiper' import Swiper from 'swiper'
import 'swiper/dist/css/swiper.min.css' import 'swiper/dist/css/swiper.min.css'
...@@ -317,7 +316,7 @@ export default { ...@@ -317,7 +316,7 @@ export default {
this.crowdGroupDesc = crowInfo.crowdGroupDesc this.crowdGroupDesc = crowInfo.crowdGroupDesc
this.activeName = crowInfo.selectTab == 'first' ? 'first' : 'second' this.activeName = crowInfo.selectTab == 'first' ? 'first' : 'second'
} }
this.getStaffList() this.getFollowStaffList()
}, },
mounted() { mounted() {
this.screenWidth = document.body.clientWidth this.screenWidth = document.body.clientWidth
...@@ -372,6 +371,14 @@ export default { ...@@ -372,6 +371,14 @@ export default {
} }
}, },
methods: { 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() { goback() {
if (this.$route.query && this.$route.query.flag) { if (this.$route.query && this.$route.query.flag) {
this.$router.push('/clientDataOverview/index') this.$router.push('/clientDataOverview/index')
...@@ -436,30 +443,6 @@ export default { ...@@ -436,30 +443,6 @@ export default {
goDetail(scope) { goDetail(scope) {
this.$router.push('/clientManage/clientDetail?id=' + scope.oneId) 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() { searchTable() {
this.$refs.marketPeople.refreshTable() 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!