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() { getExplorer: function() {
var ua = navigator.userAgent.toLocaleLowerCase() var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null var browserType = null
...@@ -30,7 +30,7 @@ export const Util = { ...@@ -30,7 +30,7 @@ export const Util = {
return browserType return browserType
}, },
exportFn:function(url) { exportFn: function(url) {
let browserType = getExplorer() let browserType = getExplorer()
if (browserType == 'QQ') { if (browserType == 'QQ') {
window.open(url) window.open(url)
...@@ -44,25 +44,25 @@ export const Util = { ...@@ -44,25 +44,25 @@ export const Util = {
/** /**
* 校验手机号码格式 * 校验手机号码格式
*/ */
checkPhone: function (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}$/; 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); return myreg.test(mobile)
}, },
/** /**
* 校验固定电话 * 校验固定电话
*/ */
validationTel: function (tel) { validationTel: function(tel) {
let reg = /^0[\d]{2,3}-[\d]{7,8}$/; let reg = /^0[\d]{2,3}-[\d]{7,8}$/
return reg.test(tel); return reg.test(tel)
}, },
/** /**
* 是否特殊字符 * 是否特殊字符
*/ */
isSpecialLetter: function (str) { isSpecialLetter: function(str) {
let reg = new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"); let reg = new RegExp("[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]")
return reg.test(str);//true/false return reg.test(str) //true/false
}, },
/** /**
...@@ -83,41 +83,41 @@ export const Util = { ...@@ -83,41 +83,41 @@ export const Util = {
/** /**
* 获取浏览器参数 * 获取浏览器参数
*/ */
getUrlParams: function (name) { getUrlParams: function(name) {
let vars = [], let vars = [],
hash; hash
let hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); let hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&')
for (let i = 0; i < hashes.length; i++) { for (let i = 0; i < hashes.length; i++) {
hash = hashes[i].split('='); hash = hashes[i].split('=')
vars.push(hash[0]); vars.push(hash[0])
vars[hash[0]] = hash[1]; vars[hash[0]] = hash[1]
} }
return vars[name]; return vars[name]
}, },
/** /**
* 根据当前时间,计算往后30天的日期 * 根据当前时间,计算往后30天的日期
*/ */
getAfterDate: function (day) {//计算往后day天 getAfterDate: function(day) {
let date1 = new Date(); //计算往后day天
let date2 = new Date(date1); let date1 = new Date()
let time = 30; let date2 = new Date(date1)
let time = 30
if (day) { 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 { return {
date: _date, date: _date,
year: date2.getFullYear(), year: date2.getFullYear(),
month: date2.getMonth() + 1, month: date2.getMonth() + 1,
day: date2.getDate() day: date2.getDate()
}; }
}, },
/** /**
* 日期格式转换 * 日期格式转换
*/ */
...@@ -137,7 +137,7 @@ export const Util = { ...@@ -137,7 +137,7 @@ export const Util = {
/** /**
* 字段截取 * 字段截取
*/ */
cutStr: function (str, num) { cutStr: function(str, num) {
if (!str) { if (!str) {
return '' return ''
} }
...@@ -156,7 +156,8 @@ export const Util = { ...@@ -156,7 +156,8 @@ export const Util = {
/** /**
* 处理输入框只能输入30个字符,一个汉字2个字符,字母数字1个字符,超过截取最大数量字符 * 处理输入框只能输入30个字符,一个汉字2个字符,字母数字1个字符,超过截取最大数量字符
*/ */
cutMaxCharStr:function(e){//e为传入字符串 cutMaxCharStr: function(e) {
//e为传入字符串
let str = e let str = e
var len = 0 var len = 0
var singleNum = 0 var singleNum = 0
...@@ -196,13 +197,39 @@ export const Util = { ...@@ -196,13 +197,39 @@ export const Util = {
return str.substr(0, subLen) return str.substr(0, subLen)
} }
return str 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 validationTel = Util.validationTel
export const checkPhone = Util.checkPhone; export const checkPhone = Util.checkPhone
export const getExplorer=Util.getExplorer; export const getExplorer = Util.getExplorer
export const exportFn=Util.exportFn; export const exportFn = Util.exportFn
export const cutMaxCharStr=Util.cutMaxCharStr; 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!