Commit 3185bc10 authored by yaobeibei's avatar yaobeibei

change note default date

parent 596a5c2d
File added
......@@ -3,8 +3,10 @@ const mongoClient = mongodb.MongoClient
const app = require('express').Router()
const _ = require('lodash')
const moment = require('moment')
const xlsx = require('node-xlsx')
// var reg = /@test.com$|@123.com$|@goyoo.com$|@xiaoyun.com$|^@|^test|@dis.com$|time-stone.cn$|^tangyong|^875652541|@1.com$|@xioayun.com$/i
var reg = /@test.com$|@123.com$|@goyoo.com$|@xiaoyun.com$|^@|^test|@dis.com$|time-stone.cn$|^tangyong|^875652541|@1.com$|@xioayun.com$/i
var dbpath = null
......@@ -233,9 +235,10 @@ app.post('/dataList', async function (req, res) {
// if (item.pv || item.touchCount || item.getCount || item.msgCount || item.callCount) {
// dataArr.push(item)
// }
if (!reg.test(item.email)) {
dataArr.push(item)
}
// if (!reg.test(item.email)) {
// dataArr.push(item)
// }
dataArr.push(item)
item = {}
})
let arrTotal = dataArr.length
......@@ -363,9 +366,10 @@ app.post('/distributor', async function (req, res) {
// if (item.pv || item.touchCount || item.getCount || item.msgCount || item.callCount) {
// dataArr.push(item)
// }
if (!reg.test(item.email)) {
dataArr.push(item)
}
// if (!reg.test(item.email)) {
// dataArr.push(item)
// }
dataArr.push(item)
item = {}
})
let arrTotal = dataArr.length
......@@ -439,9 +443,10 @@ app.post('/consume', async function (req, res) {
// if (item.number || item.preNumber) {
// dataArr.push(item)
// }
if (!reg.test(item.email)) {
dataArr.push(item)
}
// if (!reg.test(item.email)) {
// dataArr.push(item)
// }
dataArr.push(item)
item = {}
})
let dataTotal = dataArr.length
......@@ -514,9 +519,10 @@ app.post('/finance', async function (req, res) {
// dataArr.push(item)
// }
if (!reg.test(item.email)) {
dataArr.push(item)
}
// if (!reg.test(item.email)) {
// dataArr.push(item)
// }
dataArr.push(item)
item = {}
})
let dataTolal = dataArr.length
......@@ -599,9 +605,10 @@ app.post('/surplus', async function (req, res) {
}
})
item.surplus = item.addNum - item.consumeNum
if (!reg.test(item.email)) {
dataArr.push(item)
}
// if (!reg.test(item.email)) {
// dataArr.push(item)
// }
dataArr.push(item)
})
let surPlusTotal = 0
dataArr.forEach(x => {
......@@ -722,7 +729,7 @@ app.post('/checkCall', async function (req, res) {
})
dspCallGroupsName.forEach(z => {
if (x.groupID + '' === z._id + '' || x.groupID === z._id) {
console.log(z.dspgroup)
item.name = x._id
item.groupID = z._id
item.popover = {}
......@@ -743,34 +750,38 @@ app.post('/checkCall', async function (req, res) {
item.popover.consumelist = z.consumelist
item.popover.flowlist = z.flowlist
item.popover.hobbylist = z.hobbylist
item.popover.meta = z.meta
item.popover.interestlist = z.interestlist
item.popover.hostlist = z.hostlist
if (z.applist) {
item.popover.applist = z.applist
}
}
})
if (item.popover) {
if (choose === 'zero' && x.checkStatus === undefined) {
console.log(choose)
item.status = '未审核'
dataArr.push(item)
item = {}
}
if (choose === 'one' && x.checkStatus === 0) {
console.log(choose)
item.status = '审核未通过'
item.disable = true
dataArr.push(item)
item = {}
}
if (choose === 'two' && (x.checkStatus === 1)) {
console.log(choose)
if (choose === 'two' && x.checkStatus === 1) {
item.status = '审核通过'
item.disable = true
dataArr.push(item)
item = {}
}
if (choose === 'all') {
console.log(choose)
if (x.checkStatus === undefined) {
item.status = '未审核'
item.disable = false
......@@ -809,7 +820,7 @@ app.post('/checkCall', async function (req, res) {
item.sendNum = 0
}
item.time = moment(x.createdAt).format('YYYY-MM-DD HH:mm')
console.log(item.time)
oem_mtty_comapnyName.forEach(y => {
if (x.accountID + '' === y._id + '' || x.accountID === y._id) {
item.companyName = y.company
......@@ -817,7 +828,7 @@ app.post('/checkCall', async function (req, res) {
})
oem_mtty_dspCallGroupsName.forEach(z => {
if (x.groupID + '' === z._id + '' || x.groupID === z._id) {
console.log(z.dspgroup)
item.name = x._id
item.groupID = z._id
item.popover = {}
......@@ -838,31 +849,34 @@ app.post('/checkCall', async function (req, res) {
item.popover.consumelist = z.consumelist
item.popover.flowlist = z.flowlist
item.popover.hobbylist = z.hobbylist
item.popover.meta = z.meta
item.popover.interestlist = z.interestlist
item.popover.hostlist = z.hostlist
if (z.applist) {
item.popover.applist = z.applist
}
}
})
if (item.popover) {
if (choose === 'zero' && x.checkStatus === undefined) {
console.log(choose)
item.status = '未审核'
dataArr.push(item)
}
if (choose === 'one' && x.checkStatus === 0) {
console.log(choose)
item.status = '审核未通过'
item.disable = true
dataArr.push(item)
}
if (choose === 'two' && (x.checkStatus === 1)) {
console.log(choose)
if (choose === 'two' && x.checkStatus === 1) {
item.status = '审核通过'
item.disable = true
dataArr.push(item)
}
if (choose === 'all') {
console.log(choose)
if (x.checkStatus === undefined) {
item.status = '未审核'
item.disable = false
......@@ -893,6 +907,7 @@ app.post('/checkCall', async function (req, res) {
oem_xibao_callName.forEach(x => {
console.log(x)
let item = {}
item.oem = x.oem
item.preNum = x.preNum / 3
......@@ -902,7 +917,7 @@ app.post('/checkCall', async function (req, res) {
item.sendNum = 0
}
item.time = moment(x.createdAt).format('YYYY-MM-DD HH:mm')
console.log(item.time)
oem_xibao_comapnyName.forEach(y => {
if (x.accountID + '' === y._id + '' || x.accountID === y._id) {
item.companyName = y.company
......@@ -910,7 +925,7 @@ app.post('/checkCall', async function (req, res) {
})
oem_xibao_dspCallGroupsName.forEach(z => {
if (x.groupID + '' === z._id + '' || x.groupID === z._id) {
console.log(z.dspgroup)
item.name = x._id
item.groupID = z._id
item.popover = {}
......@@ -931,31 +946,34 @@ app.post('/checkCall', async function (req, res) {
item.popover.consumelist = z.consumelist
item.popover.flowlist = z.flowlist
item.popover.hobbylist = z.hobbylist
item.popover.meta = z.meta
item.popover.interestlist = z.interestlist
item.popover.hostlist = z.hostlist
if (z.applist) {
item.popover.applist = z.applist
}
}
})
if (item.popover) {
if (choose === 'zero' && x.checkStatus === undefined) {
console.log(choose)
item.status = '未审核'
dataArr.push(item)
}
if (choose === 'one' && x.checkStatus === 0) {
console.log(choose)
item.status = '审核未通过'
item.disable = true
dataArr.push(item)
}
if (choose === 'two' && (x.checkStatus === 1)) {
console.log(choose)
if (choose === 'two' && x.checkStatus === 1) {
item.status = '审核通过'
item.disable = true
dataArr.push(item)
}
if (choose === 'all') {
console.log(choose)
if (x.checkStatus === undefined) {
item.status = '未审核'
item.disable = false
......@@ -989,8 +1007,9 @@ app.post('/checkCall', async function (req, res) {
app.post('/send', async function (req, res) {
console.log('进入send')
console.log(req.body)
let {taskId, groupId, interestlist, hostlist, status, oem} = req.body
let {taskId, groupId, interestlist, hostlist, applist, status, oem} = req.body
// getSession(sessionID, res)
if (status === 8) {
......@@ -1015,15 +1034,16 @@ app.post('/send', async function (req, res) {
res.send({ status: 200, message: '审核未通过' })
}
if (status === 1) {
let updateTime = new Date()
if (oem === '微聚合' || oem === null || oem === undefined) {
await db.collection('bills').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1 } })
await db.collection('dspCallGroups').update({ '_id': mongodb.ObjectId(groupId) }, { $set: { 'interestlist': interestlist, 'hostlist': hostlist } })
await db.collection('bills').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1 , 'updateTime': updateTime} })
await db.collection('dspCallGroups').update({ '_id': mongodb.ObjectId(groupId) }, { $set: { 'interestlist': interestlist, 'hostlist': hostlist, 'applist': applist } })
} else if (oem === '麦田'){
await db_oem_mtty.collection('bills').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1 } })
await db_oem_mtty.collection('dspCallGroups').update({ '_id': mongodb.ObjectId(groupId) }, { $set: { 'interestlist': interestlist, 'hostlist': hostlist } })
await db_oem_mtty.collection('bills').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1, 'updateTime': updateTime} })
await db_oem_mtty.collection('dspCallGroups').update({ '_id': mongodb.ObjectId(groupId) }, { $set: { 'interestlist': interestlist, 'hostlist': hostlist , 'applist': applist} })
} else {
await db_oem_xibao.collection('bills').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1 } })
await db_oem_xibao.collection('dspCallGroups').update({ '_id': mongodb.ObjectId(groupId) }, { $set: { 'interestlist': interestlist, 'hostlist': hostlist } })
await db_oem_xibao.collection('bills').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1, 'updateTime': updateTime } })
await db_oem_xibao.collection('dspCallGroups').update({ '_id': mongodb.ObjectId(groupId) }, { $set: { 'interestlist': interestlist, 'hostlist': hostlist, 'applist': applist } })
}
......@@ -1031,6 +1051,49 @@ app.post('/send', async function (req, res) {
}
})
// 获取行业标签
app.post('/getTag', async function (req, res) {
console.log('进入tag')
console.log(req.body)
let { oneChoose } = req.body
let onelevel = {}
let twolevel = {}
let twoOK = {}
function getXlsx () {
var obj = xlsx.parse(__dirname+'/hangye.xlsx');
var excelObj=obj[0].data;
var data = [];
for(var i in excelObj){
var arr=[];
var value=excelObj[i];
var obj = {}
for(var j in value){
if (value[j]) {
data.push(value[j]);
}
}
}
for (var x = 4; x < data.length; x++) {
if (x % 2 === 0) {
if (data[x] < 30) {
onelevel[data[x]] = data[x + 1]
} else {
twolevel[data[x]] = data[x + 1]
}
}
}
}
getXlsx()
console.log(twoOK)
res.send({status: 200, onelevel: onelevel, twolevel: twolevel, twoOK: twoOK})
})
// 短信审核信息
app.post('/getCheckNote', async function (req, res) {
......@@ -1084,7 +1147,9 @@ app.post('/getCheckNote', async function (req, res) {
}
})
dspGroupsName.forEach(m => {
if (x.groupID + '' === m._id + '' && x.accountID === m.accountID) {
item.groupID = m._id
item.popover = {
sexlist: m.sexlist,
agelist: m.agelist,
......@@ -1099,6 +1164,18 @@ app.post('/getCheckNote', async function (req, res) {
if (m.operator) {
item.popover.operator = m.operator
}
if (m.interestlist) {
item.popover.interestlist = m.interestlist
}
if (m.hostlist) {
item.popover.hostlist = m.hostlist
}
if (m.interestlist) {
item.popover.applist = m.applist
}
item.popover.meta = m.meta || '无'
}
})
if (operatorId + '' === '联通' + '' && (item.popover.operator === undefined || item.popover.operator === '联通' + '')) {
......@@ -1140,12 +1217,12 @@ app.post('/getCheckNote', async function (req, res) {
let oem_mtty_dspGroupsName = await db_oem_mtty.collection('dspGroups').find().sort({ 'date': -1 }).toArray()
let oem_mtty_dspTask = await db_oem_mtty.collection('dspTask').find({ 'createdAt': { $gte: startTime, $lte: endTime }, 'oemCheckStatus': 1 }).sort({ 'date': 1 }).toArray()
let oem_mtty_dspTask = await db_oem_mtty.collection('dspTask').find({ 'createdAt': { $gte: startTime, $lte: endTime }, 'oemCheckStatus': 1 }).sort({ 'date': -1 }).toArray()
oem_mtty_dspTask.forEach(x => {
let item = {}
item.taskID = x._id
item.oem = x.oem
item.oem = x.oem || '麦田'
item.taskName = x.taskName
item.accountID = x.accountID
item.sendTime = moment(x.sendTime).format('YYYY-MM-DD HH:mm:ss')
......@@ -1168,7 +1245,9 @@ app.post('/getCheckNote', async function (req, res) {
}
})
oem_mtty_dspGroupsName.forEach(m => {
if (x.groupID + '' === m._id + '' && x.accountID === m.accountID) {
if (x.groupID + '' === m._id + '') {
item.groupID = m._id
// console.log(m)
item.popover = {
sexlist: m.sexlist,
agelist: m.agelist,
......@@ -1180,9 +1259,27 @@ app.post('/getCheckNote', async function (req, res) {
citylist: m.citylist,
hobbylist: m.hobbylist
}
if (m.operator) {
item.popover.operator = m.operator
}
if (m.interestlist) {
item.popover.interestlist = m.interestlist
}
if (m.hostlist) {
item.popover.hostlist = m.hostlist
}
if (m.applist) {
item.popover.applist = m.applist
}
item.popover.meta = m.meta || '无'
}
})
if (operatorId + '' === '联通' + '' && (item.popover.operator === undefined || item.popover.operator === '联通' + '')) {
......@@ -1225,10 +1322,11 @@ app.post('/getCheckNote', async function (req, res) {
let oem_xibao_dspTask = await db_oem_xibao.collection('dspTask').find({ 'createdAt': { $gte: startTime, $lte: endTime }, 'oemCheckStatus': 1 }).sort({ 'date': 1 }).toArray()
oem_xibao_dspTask.forEach(x => {
let item = {}
item.taskID = x._id
item.oem = x.oem
item.oem = x.oem || '喜宝'
item.taskName = x.taskName
item.accountID = x.accountID
item.sendTime = moment(x.sendTime).format('YYYY-MM-DD HH:mm:ss')
......@@ -1251,7 +1349,9 @@ app.post('/getCheckNote', async function (req, res) {
}
})
oem_xibao_dspGroupsName.forEach(m => {
if (x.groupID + '' === m._id + '' && x.accountID === m.accountID) {
item.groupID = m._id
item.popover = {
sexlist: m.sexlist,
agelist: m.agelist,
......@@ -1266,6 +1366,18 @@ app.post('/getCheckNote', async function (req, res) {
if (m.operator) {
item.popover.operator = m.operator
}
if (m.interestlist) {
item.popover.interestlist = m.interestlist
}
if (m.hostlist) {
item.popover.hostlist = m.hostlist
}
if (m.interestlist) {
item.popover.applist = m.applist
}
item.popover.meta = m.meta || '无'
}
})
if (operatorId + '' === '联通' + '' && (item.popover.operator === undefined || item.popover.operator === '联通' + '')) {
......@@ -1343,6 +1455,20 @@ app.post('/getCheckNote', async function (req, res) {
}
})
// 向短信打标签
app.post('/creatNoteTag', async function (req, res) {
console.log(req.body)
let {groupID, interestlist, hostlist, applist, oem} = req.body
if (oem === '微聚合' || oem === null || oem === undefined) {
await db.collection('dspGroups').update({_id: mongodb.ObjectId(groupID)}, {$set: {interestlist: interestlist, hostlist: hostlist, applist: applist}})
} else if (oem === '麦田') {
await db_oem_mtty.collection('dspGroups').update({_id: mongodb.ObjectId(groupID)}, {$set: {interestlist: interestlist, hostlist: hostlist, applist: applist}})
} else {
await db_oem_xibao.collection('dspGroups').update({_id: mongodb.ObjectId(groupID)}, {$set: {interestlist: interestlist, hostlist: hostlist, applist: applist}})
}
res.send({status: 200, data: 'OK'})
})
// 短信审核
app.post('/sendCheckNote', async function (req, res) {
console.log('进入send')
......@@ -1374,12 +1500,13 @@ app.post('/sendCheckNote', async function (req, res) {
res.send({ status: 200, message: '审核未通过' })
}
if (status === 2) {
let updateTime = new Date()
if (oem === '微聚合' || oem === null || oem === undefined) {
await db.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1 } })
await db.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1, 'updateTime': updateTime } })
} else if ( oem === '麦田'){
await db_oem_mtty.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1 } })
await db_oem_mtty.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1, 'updateTime': updateTime } })
} else {
await db_oem_xibao.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1 } })
await db_oem_xibao.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'checkStatus': 1, 'updateTime': updateTime } })
}
res.send({ status: 200, message: '审核通过' })
}
......@@ -1403,14 +1530,15 @@ app.post('/sendCheckNote', async function (req, res) {
res.send({ status: 200, message: '审核通过,短信发送中' })
}
if (status === 1) {
if (oem === '微聚合' || oem === null || oem === undefined) {
await db.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'status': 1 } })
await db.collection('bills').update({ taskID: mongodb.ObjectId(taskId), pre: true }, { $set: { pre: false, number: 0 } });
} else if (oem === '喜宝'){
await db_oem_mtty.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'status': 1 } })
await db_oem_mtty.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'status': 1} })
await db_oem_mtty.collection('bills').update({ taskID: mongodb.ObjectId(taskId), pre: true }, { $set: { pre: false, number: 0 } });
} else {
await db_oem_xibao.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'status': 1 } })
await db_oem_xibao.collection('dspTask').update({ '_id': mongodb.ObjectId(taskId) }, { $set: { 'status': 1} })
await db_oem_xibao.collection('bills').update({ taskID: mongodb.ObjectId(taskId), pre: true }, { $set: { pre: false, number: 0 } });
}
......@@ -1453,6 +1581,9 @@ app.post('/getAccount', async function (req, res) {
item.company = x.company
item.phone = x.phone
item.email = x.email
item.onelevelTag = x.onelevelTag || ''
item.twolevelTag = x.twolevelTag || ''
item.tag = { onelvtag: [], twolvtag: [] }
emailArr.push(x.email)
if (choose) {
if (item.email === choose || item.email + '' === choose + '') {
......@@ -1468,6 +1599,15 @@ app.post('/getAccount', async function (req, res) {
res.send({ status: 200, data: dataArr, dataTotal: dataArrTotal, emailArr: emailArr })
})
// 向公司打标签
app.post('/makeAccountTag', async function(req, res){
console.log('进入打标签')
console.log(req.body)
let {accountID, onelevelTag, twolevelTag} = req.body
await db.collection('account').update({'_id': mongodb.ObjectId(accountID)}, {$set: {onelevelTag: onelevelTag, twolevelTag: twolevelTag}})
res.send({status: 200, data: '打入标签了'})
})
// 注销接口
app.post('/deleteAccount', async function (req, res) {
console.log('进入用户控制')
......@@ -1511,7 +1651,7 @@ app.post('/getSlot', async function (req, res) {
let company = await db.collection('account').find({}).toArray()
let slot = await db.collection('slotTemps').find().toArray()
let slot = await db.collection('slotTemps').find().sort({createdAt: -1}).toArray()
let dataArr = []
let emailArr = []
......@@ -1530,7 +1670,7 @@ app.post('/getSlot', async function (req, res) {
} else {
item.disable = true
}
item.time = moment(x.createdAt).format('YYYY-MM-DD')
item.time = moment(x.createdAt).format('YYYY-MM-DD HH:mm')
if (x.isSlotDelete) {
item.isDelete = true
} else {
......@@ -1588,24 +1728,52 @@ app.post('/poolData', async function (req, res) {
console.log('进入营销池数据')
console.log(req.body)
let recognition = await db.collection('marketingPool').find().toArray()
let {pageSize, currentPage, onelevelTag, twolevelTag} = req.body
let recognition = await db.collection('marketingPool').find({}).toArray()
let dataArr = []
recognition.forEach(x => {
let item = {}
item.unikey = x.unikey
item.fromEmail = x.fromEmail
item.fromCompany = x.fromCompany
item.leadTime = moment(x.leadTime).format('YYYY-MM-DD HH:mm:ss')
item.onelevelTag = x.onelevelTag || []
item.twolevelTag = x.twolevelTag || []
item.tags = x.tags
item.exportNum = x.exportNum
item.exportDataArr = x.exportDataArr
dataArr.push(item)
item.exportDataArr = x.exportDataArr
if (onelevelTag && twolevelTag ) {
item.onelevelTag.forEach(y => {
if (onelevelTag === y) {
item.twolevelTag.forEach(z => {
if (twolevelTag === z) {
dataArr.push(item)
}
})
}
})
} else if (onelevelTag && !twolevelTag) {
item.onelevelTag.forEach(n => {
if (onelevelTag === n) {
dataArr.push(item)
}
})
} else {
dataArr.push(item)
}
})
res.send({ status: 200, datas: dataArr })
let dataTotal = dataArr.length
dataArr = dataArr.reverse()
dataArr = dataArr.slice((currentPage - 1) * pageSize, pageSize * currentPage)
res.send({ status: 200, datas: dataArr, dataTotal: dataTotal})
})
// 导入
......@@ -1636,12 +1804,24 @@ app.post('/leadPool', async function (req, res) {
user = _.uniqBy(user, 'unikey')
// console.log('**********')
// console.log(user)
// console.log('**********')
user.forEach(x => {
let item = {}
item.unikey = x.unikey
item.slotID = x.slotID
item.pubID = x.pubID
company.forEach(y => {
item.tags = y.tags || [1, 2, 3, 4]
item.onelevelTag = [y.onelevelTag]
item.twolevelTag = [y.twolevelTag]
if (y.twolevelTag && y.onelevelTag) {
item.tags = [y.onelevelTag + '-' + y.twolevelTag]
} else if (y.onelevelTag){
item.tags = [y.onelevelTag]
} else {
item.tags = []
}
if (accountID === y._id + '') {
leadFromEmail = y.email
leadFromName = y.company
......@@ -1655,6 +1835,7 @@ app.post('/leadPool', async function (req, res) {
let leadArr = []
let filterArr = []
let updateArr = []
if (poolUser.length === 0) {
leadArr = dataArr
......@@ -1662,15 +1843,29 @@ app.post('/leadPool', async function (req, res) {
dataArr.forEach(x => {
poolUser.forEach(y => {
if (x.unikey === y.unikey) {
filterArr.push(x)
}
if (x.pubID === y.pubID && x.slotID === y.slotID) {
filterArr.push(x)
} else{
console.log(x.unikey)
updateArr.push(x)
}
}
})
})
leadArr = _.difference(dataArr, filterArr)
leadArr = _.difference(leadArr, updateArr)
}
leadArr.forEach(x => {
db.collection('marketingPool').insert({ unikey: x.unikey, tags: x.tags, fromEmail: leadFromEmail, fromCompany: leadFromName, leadTime: leadTime })
db.collection('marketingPool').insert({ unikey: x.unikey, onelevelTag: x.onelevelTag, twolevelTag: x.twolevelTag, tags: x.tags, fromEmail: leadFromEmail, fromCompany: leadFromName, leadTime: leadTime })
})
updateArr.forEach(x => {
console.log('更新')
let onelevelTag = x.onelevelTag[0]
let twolevelTag = x.twolevelTag[0]
let tags = x.tags[0]
db.collection('marketingPool').update({ unikey: x.unikey}, {$push: {onelevelTag: onelevelTag, twolevelTag: twolevelTag, tags: tags}})
})
let leadNumber = leadArr.length
......@@ -1699,7 +1894,7 @@ app.post('/getLeadTask', async function (req, res) {
item.leadTime = moment(x.leadTime).format('YYYY-MM-DD HH:mm:SS')
dataArr.push(item)
})
dataArr = dataArr.reverse()
res.send({ status: 200, datas: dataArr })
})
......@@ -1740,7 +1935,6 @@ app.post('/getEmail', async function (req, res) {
})
// 导出
app.post('/exprot', async function (req, res) {
console.log(req.body)
let { selectUnikeyArr, exportDataArr, selectUnikeyNumber } = req.body
......@@ -1805,11 +1999,11 @@ app.post('/getExportTask', async function (req, res) {
item.taskID = x._id
item.exportUnikeyNumber = x.exportUnikeyNumber
item.createRecogNum = x.createRecogNum
item.exportTime = x.exportTime
item.exportTime = moment(x.exportTime).format('YYYY-MM-DD HH:mm:SS')
item.exportDataArr = x.exportDataArr
dataArr.push(item)
})
dataArr = dataArr.reverse()
res.send({ status: 200, datas: dataArr })
})
......
File added
var xlsx = require('node-xlsx');
//读取文件内容
let onelevel = {}
let twolevel = {}
let twoOK = {}
function getXlsx () {
var obj = xlsx.parse(__dirname+'/hangye.xlsx');
var excelObj=obj[0].data;
var data = [];
for(var i in excelObj){
var arr=[];
var value=excelObj[i];
var obj = {}
for(var j in value){
if (value[j]) {
data.push(value[j]);
}
}
}
for (var x = 4; x < data.length; x++) {
if (x % 2 === 0) {
if (data[x] < 30) {
onelevel[data[x]] = data[x + 1]
} else {
twolevel[data[x]] = data[x + 1]
}
}
}
}
getXlsx()
function test (x, arr) {
let t = x
let tes = new RegExp('^' + t, 'i')
console.log(tes)
for (let i in arr) {
if (tes.test(i)) {
if (i.length === t.length + 2) {
twoOK[i] = arr[i]
}
}
}
console.log(twoOK)
}
test('21', twolevel)
#!/usr/bin/env bash
eval "npm run build"
echo -e '\033[44;39m npm build over \033[0m'
eval 'docker build -t reg.yunpro.cn/remarketing/yunying:latest .'
echo -e '\033[44;39m docker build over \033[0m'
eval 'docker push reg.yunpro.cn/remarketing/yunying:latest'
echo -e '\033[44;38m push over \033[0m'
\ No newline at end of file
......@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>list</title>
<title>再营销运营审核平台</title>
</head>
<body>
<div id="app"></div>
......
......@@ -9464,6 +9464,22 @@
"which": "1.3.0"
}
},
"node-xlsx": {
"version": "0.12.1",
"resolved": "https://registry.npmjs.org/node-xlsx/-/node-xlsx-0.12.1.tgz",
"integrity": "sha512-PMIv0Gs05zb+7ZUQIMA5Fw8eFHxT8fVieKUKMUXI5EBuCsZ56bYKeaMaBf7pBAH3cw8Xa+dGK/xaLWZaEuyfiw==",
"requires": {
"buffer-from": "1.1.0",
"xlsx": "0.12.11"
},
"dependencies": {
"buffer-from": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz",
"integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ=="
}
}
},
"nopt": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
......
......@@ -21,17 +21,18 @@
"cookie-parser": "^1.4.3",
"element-ui": "^2.3.6",
"express": "^4.16.3",
"file-saver": "^1.3.8",
"fs": "0.0.1-security",
"http": "0.0.0",
"moment": "^2.22.1",
"mongo": "^0.1.0",
"node-xlsx": "^0.12.1",
"path": "^0.12.7",
"qs": "^6.5.1",
"server": "^1.0.18",
"vue": "^2.5.16",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"file-saver": "^1.3.8",
"xlsx": "^0.12.10"
},
"devDependencies": {
......
......@@ -24,6 +24,11 @@
<el-table-column label='公司名称' prop='company'></el-table-column>
<el-table-column label='账户名称' prop='email'></el-table-column>
<el-table-column label='电话' prop='phone'></el-table-column>
<el-table-column label="行业标签">
<template slot-scope='scope'>
<el-button type='text' @click='openForm(scope.row, scope.$index)' >公司标签</el-button>
</template>
</el-table-column>
<el-table-column label='自动备案'>
<template slot-scope='scope'>
<el-switch
......@@ -62,6 +67,28 @@
style="float: right;margin-top: 15px">
</el-pagination>
</el-main>
<el-dialog title='行业标签' :visible.sync='dialogVisiable' width=60%>
<el-select v-model="oneChoose" filterable clearable placeholder="请选择一级标签" @change='chooseOne'>
<el-option
v-for="(value, key) in onelevel"
:key="key"
:label="value"
:value="key">
</el-option>
</el-select>
<el-select v-model="twoChoose" filterable clearable placeholder="请选择二级标签">
<el-option
v-for="(value, key) in twoOK"
:key="key"
:label="value"
:value="key">
</el-option>
</el-select>
<div slot="footer" class="dialog-footer">
<el-button @click="closeFrom()">取 消</el-button>
<el-button type="primary" @click="makeAccountTag()">确 定</el-button>
</div>
</el-dialog>
</el-container>
</template>
......@@ -78,12 +105,21 @@
currentPage: 1,
pageSize: 10,
total: 100,
emailOptions: null
emailOptions: null,
dialogVisiable: false,
onelevel: {},
twolevel: {},
twoOK: {},
oneChoose: null,
twoChoose: null,
currentdata: null,
currentIndex: null
}
},
mounted () {
this.sessionID = sessionStorage.getItem('sessionID')
this.getData(this.currentPage, this.pageSize, this.inputValue)
this.getAccountTag()
},
computed: {
...mapGetters({
......@@ -91,6 +127,71 @@
})
},
methods: {
makeAccountTag () {
this.dialogVisiable = false
let onelevelTag = this.onelevel[this.oneChoose]
let twolevelTag = this.twolevel[this.twoChoose]
let currentdata = this.currentdata
let accountID = currentdata ? currentdata._id : row._id
console.log(onelevelTag, twolevelTag, accountID)
fetch('/api/makeAccountTag', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({accountID, onelevelTag, twolevelTag})
}).then(res => { return res.json() }).then(data => {
console.log(data)
})
},
chooseOne () {
let choose = this.oneChoose
this.fifterTag(choose, this.twolevel)
},
openForm (data, index) {
this.dialogVisiable = true
this.oneChoose = data.onelevelTag
this.twoChoose = data.twolevelTag
this.currentdata = data
this.currentIndex = index
},
closeFrom () {
this.dialogVisiable = false
this.onelvlist = []
this.twolvlist = []
},
fifterTag (x, arr) {
let self = this
let t = x
let dataArr = {}
let tes = new RegExp('^' + t, 'i')
console.log(tes)
for (let i in arr) {
if (tes.test(i)) {
if (i.length === t.length + 2) {
console.log(arr[i])
dataArr[i] = arr[i]
}
}
}
console.log(dataArr)
this.twoOK = dataArr
},
getAccountTag (choose) {
console.log('tag')
let self = this
let oneChoose = choose
this.dialogVisiable = false
fetch('/api/getTag', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify()
}).then(res => {
return res.json()
}).then(data => {
console.log(data)
self.onelevel = data.onelevel
self.twolevel = data.twolevel
})
},
AutoChange (row) {
console.log(row.isCloseAuto)
console.log(row)
......@@ -129,6 +230,9 @@
self.total = data.dataTotal
self.emailOptions = data.emailArr
})
},
getTag() {
},
handleSizeChange (val) {
this.pageSize = val
......@@ -189,5 +293,20 @@
</script>
<style scoped>
.el-tag + .el-tag {
margin-left: 10px;
}
.button-new-tag {
margin-left: 10px;
height: 32px;
line-height: 30px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
</style>
......@@ -56,10 +56,10 @@
<p>平均流量: <span style='padding: 4px' v-for='item in scope.row.popover.flowlist'>{{item}}</span></p>
<p>终端品牌: <span style='padding: 4px' v-for='item in scope.row.popover.phonelist'>{{item}}</span></p>
</div>
<div>
<!-- <div>
<h4>筛选条件:</h4>
<p><sapn>访问过以下标签:</sapn> <span style='padding: 4px' v-for='item in scope.row.popover.hobbylist'>{{mapHobby[item]}}({{item}}) |</span></p>
</div>
</div> -->
<span slot="reference">
查看详情
</span>
......@@ -97,7 +97,9 @@
:total="total"
style="float: right;margin-top: 15px">
</el-pagination>
<el-dialog title="请添加筛选条件" :visible.sync="dialogFormVisible">
<el-dialog :visible.sync="dialogFormVisible">
<p style="font-size: 16px;font-weight: 800">请添加筛选条件</p>
<p style='margin-left:10p'> 备注: {{meta}}</p>
<div>
<el-tag
:key="tag"
......@@ -141,6 +143,28 @@
</el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput2">添加新域名</el-button>
</div>
<br>
<div>
<el-tag
:key="tag"
v-for="tag in applist"
closable
:disable-transitions="false"
@close="handleClose3(tag)">
{{tag}}
</el-tag>
<el-input
class="input-new-tag"
v-if="inputVisible3"
v-model="inputValue3"
size="small"
ref="saveTagInput3"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"
>
</el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput3">添 加 A P P</el-button>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="closeFrom()">取 消</el-button>
<el-button type="primary" @click="suerSend(1)">确 定</el-button>
......@@ -166,14 +190,18 @@
total: 0,
pageSize: 100,
currentPage: 1,
meta: '',
visible1: false,
visibleInput: false,
interestlist: [],
hostlist: [],
applist: [],
inputVisible: false,
inputVisible2: false,
inputVisible3: false,
inputValue: '',
inputValue2: '',
inputValue3: '',
dialogFormVisible: false,
valueRange: [],
startTime: '',
......@@ -235,8 +263,10 @@
this.interestlist = []
this.hostlist = []
this.dialogFormVisible = true
this.interestlist = data.popover.interestlist
this.hostlist = data.popover.hostlist
this.interestlist = data.popover.interestlist || []
this.hostlist = data.popover.hostlist || []
this.applist = data.popover.applist || []
this.meta = data.popover.meta || ''
this.currentdata = data
this.currentIndex = index
},
......@@ -244,6 +274,8 @@
this.dialogFormVisible = false
this.interestlist = []
this.hostlist = []
this.applist = []
this.meta = ''
},
handleClose (tag) {
this.interestlist.splice(this.interestlist.indexOf(tag), 1)
......@@ -251,6 +283,9 @@
handleClose2 (tag) {
this.hostlist.splice(this.hostlist.indexOf(tag), 1)
},
handleClose3 (tag) {
this.hobbylist.splice(this.hobbylist.indexOf(tag), 1)
},
showInput () {
this.inputVisible = true
this.$nextTick(_ => {
......@@ -264,19 +299,32 @@
this.$refs.saveTagInput2.$refs.input.focus()
})
},
showInput3 () {
this.inputVisible3 = true
console.log(this.$refs)
this.$nextTick(_ => {
this.$refs.saveTagInput3.$refs.input.focus()
})
},
handleInputConfirm () {
let inputValue = this.inputValue
let inputValue2 = this.inputValue2
let inputValue3 = this.inputValue3
if (inputValue) {
this.interestlist.push(inputValue)
}
if (inputValue2) {
this.hostlist.push(inputValue2)
}
if (inputValue3) {
this.applist.push(inputValue3)
}
this.inputVisible = false
this.inputVisible2 = false
this.inputVisible3 = false
this.inputValue = ''
this.inputValue2 = ''
this.inputValue3 = ''
},
handleCommand (command) {
console.log(command)
......@@ -349,6 +397,7 @@
let self = this
let interestlist = this.interestlist
let hostlist = this.hostlist
let applist = this.applist
let currentdata = this.currentdata
let oem = currentdata ? currentdata.oem : row.oem
let taskId = currentdata ? currentdata.name : row.name
......@@ -357,7 +406,7 @@
fetch('/api/send', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({taskId, groupId, interestlist, hostlist, status, oem})
body: JSON.stringify({taskId, groupId, interestlist, hostlist, applist, status, oem})
}).then(res => {
return res.json()
}).then(data => {
......
......@@ -3,7 +3,7 @@
<el-header>
<h4>短信审核</h4>
</el-header>
<el-main>
<el-main style="font-size: 12px">
<el-row>
<el-date-picker
v-model="valueRange"
......@@ -68,6 +68,11 @@
</el-popover>
</template>
</el-table-column>
<el-table-column label='添加标签'>
<template slot-scope="scope">
<el-button type='text' size='small' @click="openForm(scope.row, scope.$index)" :disabled='scope.row.disable'>添加标签</el-button>
</template>
</el-table-column>
<el-table-column label='预计发送数量' prop='preSendNum'></el-table-column>
<el-table-column label='短信内容' prop='msgContent'></el-table-column>
<el-table-column label='预计发送时间' prop='sendTime'></el-table-column>
......@@ -125,6 +130,79 @@
style="float: right;margin-top: 15px">
</el-pagination>
</el-main>
<el-dialog :visible.sync="dialogFormVisible">
<p style="font-size: 16px;font-weight: 800">请添加筛选条件</p>
<p style='margin-left:10p'> 备注: {{meta}}</p>
<div>
<el-tag
:key="tag"
v-for="tag in interestlist"
closable
:disable-transitions="false"
@close="handleClose(tag)">
{{tag}}
</el-tag>
<el-input
class="input-new-tag"
v-if="inputVisible"
ref="saveTagInput"
v-model="inputValue"
size="small"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"
>
</el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput">添加关键词</el-button>
</div>
<br>
<div>
<el-tag
:key="tag"
v-for="tag in hostlist"
closable
:disable-transitions="false"
@close="handleClose2(tag)">
{{tag}}
</el-tag>
<el-input
class="input-new-tag"
v-if="inputVisible2"
v-model="inputValue2"
size="small"
ref="saveTagInput2"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"
>
</el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput2">添加新域名</el-button>
</div>
<br>
<div>
<el-tag
:key="tag"
v-for="tag in applist"
closable
:disable-transitions="false"
@close="handleClose3(tag)">
{{tag}}
</el-tag>
<el-input
class="input-new-tag"
v-if="inputVisible3"
v-model="inputValue3"
size="small"
ref="saveTagInput3"
@keyup.enter.native="handleInputConfirm"
@blur="handleInputConfirm"
>
</el-input>
<el-button v-else class="button-new-tag" size="small" @click="showInput3">添 加 A P P</el-button>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="closeFrom()">取 消</el-button>
<el-button type="primary" @click="creatNoteTag()">确 定</el-button>
</div>
</el-dialog>
</el-container>
</template>
......@@ -140,7 +218,7 @@
url: '/api/getCheckNote',
statue: '未审核',
choose: '任务审核状态',
chooseId: 'all',
chooseId: 'zero',
operatorId: '联通',
total: 0,
pageSize: 100,
......@@ -185,7 +263,22 @@
}
}]
},
mapHobby: {"H001002":"时政要闻", "H001006":"科技资讯", "H001011":"社会资源", "H004011":"旅游出行", "H001008":"财经资讯", "H001005":"军事资讯", "H007012":"电子邮件", "H002008":"专业协会", "H002009":"社交网络", "H004020":"团购打折", "H001012":"综合资讯", "H002999":"通信交流", "H003006":"娱乐搞笑", "H001003":"女性时尚", "H007009":"网络存储", "H004015":"非法网站", "H007004":"系统工具", "H003005":"手机动漫", "H004018":"打车软件", "H004019":"查询服务", "H005010":"营销平台", "H001999":"新闻资讯", "H004009":"医疗健康","H004003":"搜索引擎", "H004005":"生活综合", "H003008":"网络电台", "H004023":"时尚美妆", "H002001":"即时通信", "H004999":"生活服务", "H004021":"福利彩票", "H007008":"应用商店", "H005002":"电子支付", "H004004":"导航网站", "H004012":"物流快递", "H004006":"家居服务", "H007999":"工具软件", "H001010":"企业门户", "H007002":"下载工具","H007006":"词典翻译", "H007007":"主题桌面", "H005009":"求职招聘", "H002002":"婚恋交友", "H004008":"母婴资讯","H004022":"教育学习", "H003009":"影院票务", "H004007":"汽车信息", "H001004":"体育资讯", "H003002":"手机阅读", "H003003":"手机音频", "H004014":"宠物资讯", "H001009":"文化教育", "H004013":"餐饮美食", "H005013":"金融理财", "H004002":"时间天气", "H005008":"商务办公", "H003004":"手机游戏", "H001007":"娱乐资讯", "H004016":"外卖送餐", "H002006":"博客空间", "H003001":"手机视频", "H003007":"摄影图片", "H005001":"网上购物", "H002005":"社区论坛", "H007001":"安全杀毒", "H005012":"手机银行", "H003999":"娱乐休闲", "H004017":"地图导航", "H007011":"无线管理","H007005":"输入法 ","H007003":"浏览器 ","H005011":"云服务 "}
mapHobby: {"H001002":"时政要闻", "H001006":"科技资讯", "H001011":"社会资源", "H004011":"旅游出行", "H001008":"财经资讯", "H001005":"军事资讯", "H007012":"电子邮件", "H002008":"专业协会", "H002009":"社交网络", "H004020":"团购打折", "H001012":"综合资讯", "H002999":"通信交流", "H003006":"娱乐搞笑", "H001003":"女性时尚", "H007009":"网络存储", "H004015":"非法网站", "H007004":"系统工具", "H003005":"手机动漫", "H004018":"打车软件", "H004019":"查询服务", "H005010":"营销平台", "H001999":"新闻资讯", "H004009":"医疗健康","H004003":"搜索引擎", "H004005":"生活综合", "H003008":"网络电台", "H004023":"时尚美妆", "H002001":"即时通信", "H004999":"生活服务", "H004021":"福利彩票", "H007008":"应用商店", "H005002":"电子支付", "H004004":"导航网站", "H004012":"物流快递", "H004006":"家居服务", "H007999":"工具软件", "H001010":"企业门户", "H007002":"下载工具","H007006":"词典翻译", "H007007":"主题桌面", "H005009":"求职招聘", "H002002":"婚恋交友", "H004008":"母婴资讯","H004022":"教育学习", "H003009":"影院票务", "H004007":"汽车信息", "H001004":"体育资讯", "H003002":"手机阅读", "H003003":"手机音频", "H004014":"宠物资讯", "H001009":"文化教育", "H004013":"餐饮美食", "H005013":"金融理财", "H004002":"时间天气", "H005008":"商务办公", "H003004":"手机游戏", "H001007":"娱乐资讯", "H004016":"外卖送餐", "H002006":"博客空间", "H003001":"手机视频", "H003007":"摄影图片", "H005001":"网上购物", "H002005":"社区论坛", "H007001":"安全杀毒", "H005012":"手机银行", "H003999":"娱乐休闲", "H004017":"地图导航", "H007011":"无线管理","H007005":"输入法 ","H007003":"浏览器 ","H005011":"云服务 "},
meta: '',
visible1: false,
visibleInput: false,
interestlist: [],
hostlist: [],
applist: [],
inputVisible: false,
inputVisible2: false,
inputVisible3: false,
inputValue: '',
inputValue2: '',
inputValue3: '',
dialogFormVisible: false,
currentdata: null,
currentIndex: null
}
},
mounted () {
......@@ -201,6 +294,76 @@
})
},
methods: {
openForm (data, index) {
this.interestlist = []
this.hostlist = []
this.applist = []
this.dialogFormVisible = true
this.interestlist = data.popover.interestlist || []
this.hostlist = data.popover.hostlist || []
this.applist = data.popover.applist || []
this.meta = data.popover.meta || ''
this.currentdata = data
this.currentIndex = index
},
closeFrom () {
this.dialogFormVisible = false
this.interestlist = []
this.hostlist = []
this.applist = []
this.meta = ''
this.currentdata = null
this.currentIndex = null
},
handleClose (tag) {
this.interestlist.splice(this.interestlist.indexOf(tag), 1)
},
handleClose2 (tag) {
this.hostlist.splice(this.hostlist.indexOf(tag), 1)
},
handleClose3 (tag) {
this.hobbylist.splice(this.hobbylist.indexOf(tag), 1)
},
showInput () {
this.inputVisible = true
this.$nextTick(_ => {
this.$refs.saveTagInput.$refs.input.focus()
})
},
showInput2 () {
this.inputVisible2 = true
console.log(this.$refs)
this.$nextTick(_ => {
this.$refs.saveTagInput2.$refs.input.focus()
})
},
showInput3 () {
this.inputVisible3 = true
console.log(this.$refs)
this.$nextTick(_ => {
this.$refs.saveTagInput3.$refs.input.focus()
})
},
handleInputConfirm () {
let inputValue = this.inputValue
let inputValue2 = this.inputValue2
let inputValue3 = this.inputValue3
if (inputValue) {
this.interestlist.push(inputValue)
}
if (inputValue2) {
this.hostlist.push(inputValue2)
}
if (inputValue3) {
this.applist.push(inputValue3)
}
this.inputVisible = false
this.inputVisible2 = false
this.inputVisible3 = false
this.inputValue = ''
this.inputValue2 = ''
this.inputValue3 = ''
},
chooseOperator (command) {
let self = this
console.log(command)
......@@ -355,11 +518,48 @@
}).catch(err => {
console.log(err)
})
},
creatNoteTag () {
let self = this
let interestlist = this.interestlist
let hostlist = this.hostlist
let applist = this.applist
let currentdata = this.currentdata
let oem = currentdata ? currentdata.oem : row.oem
let groupID = currentdata ? currentdata.groupID : row.groupID
this.dialogFormVisible = false
fetch('/api/creatNoteTag', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({groupID, interestlist, hostlist, applist, oem})
}).then(res => {
return res.json()
}).then(data => {
console.log(data)
slef.currentdata.popover.applist = applist
this.$set(self.datas, self.currentIndex, self.currentdata)
this.currentdata = null
this.currentIndex = null
})
}
}
}
</script>
<style scoped>
.el-tag + .el-tag {
margin-left: 10px;
}
.button-new-tag {
margin-left: 10px;
height: 32px;
line-height: 30px;
padding-top: 0;
padding-bottom: 0;
}
.input-new-tag {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
</style>
......@@ -43,7 +43,7 @@
methods: {
showExportContent (row) {
console.log(row)
this.exprotContent = row.exportShowArr
this.exprotContent = row.exportDataArr
this.exportContentVisible = true
},
getData () {
......
......@@ -114,10 +114,10 @@
<el-submenu index=7 v-if=' sessionID === "admin" '>
<template slot='title'>
<i class='el-icon-setting'></i>
<span>OEM运营账号</span>
<span>代理商运营账号</span>
</template>
<el-menu-item index='/OEM' @click="routeTo">
创建OME运营账号
创建代理商运营账号
</el-menu-item>
</el-submenu>
......
......@@ -25,6 +25,7 @@
<el-table-column label='公司名称' prop='company'></el-table-column>
<el-table-column label='代码位名称' prop='slotName'></el-table-column>
<el-table-column label='代码位位置' prop='slot'></el-table-column>
<el-table-column label='代码位创建时间' prop='time'></el-table-column>
<el-table-column label='代码位备案规则'>
<template slot-scope='scope'>
<el-button type='text' @click='openDialog(scope)' >备案规则</el-button>
......
......@@ -6,6 +6,22 @@
<el-main>
<el-row style='margin-bottom: 10px'>
<el-button type='primary' style='float: left' @click=' inDialogVisible = true'>导入任务</el-button>
<el-select v-model="oneChoose" filterable clearable placeholder="请选择一级标签" @change='chooseOne' style="margin-left: 10px">
<el-option
v-for="(value, key) in onelevel"
:key="key"
:label="value"
:value="key">
</el-option>
</el-select>
<el-select v-model="twoChoose" filterable clearable placeholder="请选择二级标签" @change="chooseTwo">
<el-option
v-for="(value, key) in twoOK"
:key="key"
:label="value"
:value="key">
</el-option>
</el-select>
<el-button type='primary' style='float: right' @click='openExportDialog'>导出任务</el-button>
</el-row>
<el-table border
......@@ -29,7 +45,16 @@
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100, 1000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
style="float: right;margin-top: 15px">
</el-pagination>
<el-dialog title='新建导入任务' center :visible.sync="inDialogVisible">
<el-row style='margin-bottom: 10px'>
<el-col :span="4" style='line-height: 40px'>任务模式</el-col>
......@@ -98,7 +123,7 @@
<el-col :span='2'><el-button type='text' size='mini' @click='deleteShow(index)'>删除</el-button></el-col>
</el-row>
<el-row>
<el-select v-model="exportAccount" placeholder="请选择账户" @visible-change='selectSlot'>
<el-select v-model="exportAccount" placeholder="请选择账户" filterable clearable @visible-change='selectSlot'>
<el-option
v-for="item in emailOptions"
:key="item.accountID"
......@@ -106,7 +131,7 @@
:value="item.accountID">
</el-option>
</el-select>
<el-select v-model="exportSlot" placeholder="请选择代码位">
<el-select v-model="exportSlot" placeholder="请选择代码位" clearable filterable>
<el-option
v-for="item in slotOptions"
:key="item.slotID"
......@@ -206,13 +231,22 @@
exportShowArr: [],
showEmail: null,
showSlot: null,
exprotContent: []
exprotContent: [],
oneChoose: null,
twoChoose: null,
onelevel: {},
twolevel: {},
twoOK: {},
currentPage: 1,
pageSize: 10,
total: 1000
}
},
mounted () {
this.getTime()
this.getData()
this.getEmail()
this.getAccountTag()
},
methods: {
openExportDialog () {
......@@ -223,6 +257,32 @@
self.exportDialogVisible = true
}
},
chooseOne () {
let choose = this.oneChoose
this.fifterTag(choose, this.twolevel)
this.twoChoose = null
this.getData(this.pageSize, this.currentPage, this.oneChoose, this.twoChoose)
},
chooseTwo () {
this.getData(this.pageSize, this.currentPage, this.oneChoose, this.twoChoose)
},
fifterTag (x, arr) {
let self = this
let t = x
let dataArr = {}
let tes = new RegExp('^' + t, 'i')
console.log(tes)
for (let i in arr) {
if (tes.test(i)) {
if (i.length === t.length + 2) {
console.log(arr[i])
dataArr[i] = arr[i]
}
}
}
console.log(dataArr)
this.twoOK = dataArr
},
showExportContent (row) {
console.log(row)
this.exprotContent = row.exportDataArr
......@@ -251,9 +311,26 @@
}
})
this.exportDataArr.push({accountID: this.exportAccount, slotID: this.exportSlot, accountName: this.showEmail, slotName: this.showSlot})
this.exportAccount = null
this.exportSlot = null
let noRepeat = true
self.exportDataArr.forEach(x => {
// console.log(x)
if (x.accountID === self.exportAccount && x.slotID === self.exportSlot) {
this.$message({
showClose: true,
message: '请不要向同一账号下同一代码位导入相同的用户',
type: 'error'
})
noRepeat = false
}
})
if (noRepeat) {
self.exportDataArr.push({accountID: self.exportAccount, slotID: self.exportSlot, accountName: self.showEmail, slotName: self.showSlot})
self.exportAccount = null
self.exportSlot = null
}
},
handleSelectionChange (valueArr) {
console.log(valueArr)
......@@ -306,17 +383,49 @@
})
}
},
getData () {
handleSizeChange (val) {
console.log('页容量改变')
console.log(val)
this.pageSize = val
this.getData(this.pageSize, this.currentPage, this.chooseOne, this.twoChoose)
},
handleCurrentChange (val) {
console.log('当前页码改变')
this.currentPage = val
console.log(val)
this.getData(this.pageSize, this.currentPage, this.chooseOne, this.twoChoose)
},
getData (pageSize = this.pageSize, currentPage = this.currentPage, oneChoose = this.oneChoose, twoChoose = this.twoChoose) {
let self = this
let onelevelTag = this.onelevel[oneChoose]
let twolevelTag = this.twolevel[twoChoose]
fetch('/api/poolData', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({})
body: JSON.stringify({pageSize, currentPage, onelevelTag, twolevelTag})
}).then(res => { return res.json() }).then(data => {
console.log(data)
self.datas = data.datas
self.total = data.dataTotal
})
},
getAccountTag (choose) {
console.log('tag')
let self = this
let oneChoose = choose
this.dialogVisiable = false
fetch('/api/getTag', {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify()
}).then(res => {
return res.json()
}).then(data => {
console.log(data)
self.onelevel = data.onelevel
self.twolevel = data.twolevel
})
},
getEmail () {
let self = this
let accountID = self.exportAccount
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment