<style scoped>
|
.title {
|
height: 60px;
|
line-height: 60px;
|
}
|
|
.search {
|
background-color: #fff;
|
height: 80px;
|
display: flex;
|
align-items: center;
|
}
|
|
.search_thing {
|
width: 350px;
|
display: flex;
|
align-items: center;
|
}
|
|
.search_label {
|
width: 110px;
|
font-size: 14px;
|
text-align: right;
|
}
|
|
.search_input {
|
width: calc(100% - 110px);
|
}
|
|
.table {
|
margin-top: 10px;
|
background-color: #fff;
|
width: calc(100% - 40px);
|
height: calc(100% - 60px - 80px - 10px - 40px);
|
padding: 20px;
|
}
|
.el-radio-group{
|
width: 100%;
|
}
|
</style>
|
<style>
|
.data_reporting .data_reporting_dia .el-dialog__body {
|
padding: 15px 0;
|
}
|
|
.data_reporting .el-upload {
|
width: 100%;
|
}
|
|
.data_reporting .el-upload-dragger {
|
width: 100%;
|
}
|
</style>
|
|
<template>
|
<div class="data_reporting" v-loading="uploading">
|
<div>
|
<el-row class="title">
|
<el-col :span="12" style="padding-left: 20px;">数据上报</el-col>
|
<el-col :span="12" style="text-align: right;padding-right: 8px;">
|
<el-button size="medium" @click="chooseDia = true" v-if="inPower">
|
<i class="el-icon-upload2" style="color: #3A7BFA;"></i>
|
<span style="color: #3A7BFA;">导入</span>
|
</el-button>
|
<el-button size="medium" @click="$refs.ValueTable.openDownDia()" v-if="outPower">
|
<i class="el-icon-download" style="color: #3A7BFA;"></i>
|
<span style="color: #3A7BFA;">导出</span>
|
</el-button>
|
<el-button size="medium" type="primary" @click="opeaAdd" v-if="addPower">新增</el-button>
|
<el-button size="medium" type="danger" @click="delNowAll" v-if="delAllPower">一键删除</el-button>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="search">
|
<div class="search_thing">
|
<div class="search_label">系统日期:</div>
|
<div class="search_input">
|
<el-date-picker size="small" v-model="componentData.entity.createTime" type="date" placeholder="选择日期"
|
value-format="yyyy-MM-dd HH:mm:ss" :clearable="false" :editable="false" @change="refreshTable"></el-date-picker>
|
</div>
|
</div>
|
<div class="search_thing">
|
<div class="search_label">登记人:</div>
|
<div class="search_input">
|
<el-select size="small" style="width: 100%;" placeholder="登记人" v-model="componentData.entity.registrant">
|
<el-option :value="null" label="全部"></el-option>
|
<el-option v-for="(a, ai) in userNames" :key="ai" :label="a" :value="a"></el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="search_thing">
|
<div class="search_label">项目:</div>
|
<div class="search_input">
|
<el-select size="small" style="width: 100%;" placeholder="请选择" v-model="componentData.entity.product">
|
<el-option :value="null" label="全部"></el-option>
|
<el-option v-for="(a, ai) in product" :key="ai" :label="a.product" :value="a.product"></el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="search_thing" style="padding-left: 30px;">
|
<el-button size="small" @click="refresh()">重 置</el-button>
|
<el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
|
</div>
|
</div>
|
<div class="table">
|
<ValueTable ref="ValueTable" :url="$api.dataReporting.selectDataReportingList"
|
:delUrl="$api.dataReporting.delDataReporting" :componentData="componentData" :key="upIndex" @upRole="upRole" :downUrl="$api.dataReporting.downDataReportingFile"/>
|
</div>
|
<el-dialog title="上报修改" :visible.sync="upDia" width="700px" class="data_reporting_dia">
|
<div class="body" v-if="upDia" style="max-height: 550px;overflow-y: auto;">
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">系统日期</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.updateTime" size="small" disabled></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">登记人</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.registrant" size="small" disabled></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">部门</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.department" size="small" disabled></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">账户名</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.name" size="small" disabled></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">渠道</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.channel" size="small" disabled></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">项目</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.product" size="small" disabled></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">姓名</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.name2" size="small" disabled></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">代理</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.agent" size="small" disabled></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">展现量</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.showNum" size="small" disabled></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">点击量</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.click" size="small" disabled></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">账户消费</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.accountConsumption" size="small" disabled></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">客户返点消费</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.rebateConsumption" size="small" disabled></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">消费</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.consumption" size="small" disabled></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">折后消费</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.discountedConsumption" size="small" disabled></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">进粉</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.fansAdd" size="small" disabled></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">实际成本</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.actualCost" size="small" disabled></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">利润</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.profit" size="small" disabled></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">员工代理返点</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.agentRebate" size="small" disabled></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">内部成本</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.internalCosts" size="small"></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">客户成本</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.customerCosts" size="small"></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">客户返点</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.customerRebate" size="small"></el-input>
|
</el-col>
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">做进来</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.remark" size="small"></el-input>
|
</el-col>
|
</el-row>
|
<el-row style="line-height: 50px;">
|
<el-col :span="4" style="text-align: right;padding-right: 8px;">微信号</el-col>
|
<el-col :span="7">
|
<el-input v-model="upData.vxCard" size="small"></el-input>
|
</el-col>
|
</el-row>
|
</div>
|
<span slot="footer" class="dialog-footer" style="margin-right: 18px;">
|
<el-button type="primary" @click="saveUpData" :loading="upLoad">确 定</el-button>
|
<el-button @click="upDia = false">取 消</el-button>
|
</span>
|
</el-dialog>
|
<el-dialog title="数据导入" :visible.sync="uploadDia" width="500px">
|
<div style="margin: 0 auto;">
|
<el-upload ref="upload" drag :action="javaApi + $api.dataReporting.inputCsv" :headers="token"
|
:file-list="fileList" name="file" :auto-upload="false" accept=".csv" :limit="1" :on-change="beforeUpload"
|
:on-success="onSuccess" :on-error="onError" :data="{param: componentData.uploadStr}">
|
<i class="el-icon-upload"></i>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
</el-upload>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="uploadDia = false">取 消</el-button>
|
<el-button type="primary" @click="submitUpload()">上 传</el-button>
|
</span>
|
</el-dialog>
|
<el-dialog title="请选择数据上报的微信号" :visible.sync="chooseDia" width="500px">
|
<div class="body" v-if="chooseDia" style="max-height: 550px;overflow-y: auto;padding: 5px 0;">
|
<el-radio-group v-model="vx">
|
<el-col :span="8" v-for="(a, ai) in vxs" :key="ai" style="margin-bottom: 5px;">
|
<el-radio border size="small" :label="a.vx">{{a.vx}}</el-radio>
|
</el-col>
|
</el-radio-group>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="chooseDia = false">取消</el-button>
|
<el-button type="primary" @click="openUpload()">下一步</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import ValueTable from '../tool/value-table.vue'
|
export default {
|
components: {
|
ValueTable
|
},
|
data() {
|
return {
|
componentData: {
|
entity: {
|
createTime: null,
|
registrant: null,
|
product: null,
|
orderBy: {
|
field: 'id',
|
order: 'asc'
|
}
|
},
|
isIndex: true,
|
showSelect: false,
|
select: true,
|
do: [{
|
id: 'update',
|
font: '编辑',
|
type: 'text',
|
method: 'upRole',
|
field: ['createUserName', 'updateUserName', 'registrant', 'department', 'consumption',
|
'rebateConsumption', 'discountedConsumption', 'profit', 'remark', 'actualCost', 'fansAdd', 'agentRebate'
|
]
|
}, {
|
id: 'delete',
|
font: '删除',
|
type: 'text',
|
method: 'doDiy'
|
}],
|
tagField: {},
|
selectField: {
|
vxCard: {
|
select: []
|
}
|
},
|
requiredAdd:['name2','agent','channel','product','showNum','click','accountConsumption','vxCard'],
|
countFleid: ['fansAdd'],
|
uploadStr: ""
|
},
|
entityCopy: {},
|
upIndex: 0,
|
addDia: false,
|
upDia: false,
|
upLoad: false,
|
upData: {},
|
product: [],
|
uploadDia: false,
|
fileList: [],
|
uploading: false,
|
addPower: true,
|
token: null,
|
inPower: true,
|
outPower: true,
|
delAllPower: true,
|
userNames: [],
|
vxs: [],
|
chooseDia: false,
|
vx: null
|
}
|
},
|
created() {
|
var today = new Date();
|
var yesterday = new Date(today);
|
yesterday.setDate(today.getDate() - 1);
|
var yyyy = yesterday.getFullYear();
|
var mm = yesterday.getMonth() + 1;
|
var dd = yesterday.getDate()
|
if (dd < 10) {
|
dd = "0" + dd;
|
}
|
if (mm < 10) {
|
mm = "0" + mm;
|
}
|
this.componentData.entity.createTime = this.HaveJson(`${yyyy}-${mm}-${dd} 00:00:00`)
|
},
|
mounted() {
|
this.entityCopy = this.HaveJson(this.componentData.entity)
|
this.selectProductEnumList()
|
this.getPower()
|
this.token = {
|
'token': sessionStorage.getItem('token')
|
}
|
this.selectDataReportingForCreateUserNames()
|
this.selectVxs()
|
},
|
methods: {
|
refreshTable() {
|
this.$refs['ValueTable'].selectList()
|
this.selectDataReportingForCreateUserNames()
|
this.selectVxs()
|
},
|
refresh() {
|
this.componentData.entity = this.HaveJson(this.entityCopy)
|
this.upIndex++
|
this.selectDataReportingForCreateUserNames()
|
},
|
upRole(row) {
|
this.upData = this.HaveJson(row)
|
this.upDia = true
|
},
|
saveUpData() {
|
this.upLoad = true
|
delete this.upData.createTime
|
delete this.upData.updateTime
|
delete this.upData.createUser
|
delete this.upData.updateUser
|
this.$axios.post(this.$api.dataReporting.upDataReporting, this.upData, {
|
headers: {
|
'Content-Type': 'application/json'
|
}
|
}).then(res => {
|
this.upLoad = false
|
if (res.code == 201) {
|
return
|
}
|
this.$message.success('修改成功')
|
this.upDia = false
|
this.refreshTable()
|
})
|
},
|
selectProductEnumList() {
|
this.$axios.get(this.$api.enums.selectProductEnumList).then(res => {
|
this.product = res.data
|
})
|
},
|
// 权限分配
|
getPower() {
|
let power = JSON.parse(sessionStorage.getItem('power'))
|
let up = false
|
let del = false
|
let add = false
|
let inPower = false
|
let outPower = false
|
let delAllPower = false
|
for (var i = 0; i < power.length; i++) {
|
if (power[i].menuMethod == 'upDataReporting') {
|
up = true
|
}
|
if (power[i].menuMethod == 'delDataReporting') {
|
del = true
|
}
|
if (power[i].menuMethod == 'addDataReporting') {
|
add = true
|
}
|
if (power[i].menuMethod == 'inputCsv') {
|
inPower = true
|
}
|
if (power[i].menuMethod == 'downDataReportingFile') {
|
outPower = true
|
}
|
if (power[i].menuMethod == 'deleteAllData') {
|
delAllPower = true
|
}
|
}
|
if (!del) {
|
this.componentData.do.splice(1, 1)
|
}
|
if (!up) {
|
this.componentData.do.splice(0, 1)
|
}
|
this.addPower = add
|
this.inPower = inPower
|
this.outPower = outPower
|
this.delAllPower = delAllPower
|
},
|
openUpload() {
|
if(this.vx == null || this.vx == undefined) {
|
this.$message.error('请选择数据上报的微信号')
|
return
|
}
|
this.componentData.uploadStr = this.vx
|
this.uploadDia = true
|
},
|
beforeUpload(file, fileList) {
|
if (file.raw.type != 'text/csv') {
|
this.$message.error('上传文件格式不正确');
|
this.$refs.upload.clearFiles()
|
return false;
|
}
|
},
|
submitUpload() {
|
if (this.$refs.upload.uploadFiles.length == 0) {
|
this.$message.error('未选择文件')
|
return
|
}
|
this.uploading = true
|
this.$refs.upload.submit();
|
this.uploadDia = false
|
},
|
onSuccess(response, file, fileList) {
|
this.$refs.upload.clearFiles()
|
this.uploadDia = false
|
this.uploading = false
|
this.chooseDia = false
|
if(response.code==201){
|
this.$message.error(response.message)
|
return
|
}
|
this.$message.success('上传成功')
|
this.refreshTable()
|
},
|
onError(err, file, fileList) {
|
this.$message.error('上传失败')
|
this.$refs.upload.clearFiles()
|
this.uploading = false
|
},
|
opeaAdd() {
|
this.$refs.ValueTable.openAddDia(this.$api.dataReporting.addDataReporting);
|
},
|
delNowAll(){
|
this.$confirm('是否删除 '+this.componentData.entity.createTime.split(' ')[0]+' 数据时间的全部数据?', "警告", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "error"
|
}).then(() => {
|
this.uploading = true
|
this.$axios.post(this.$api.dataReporting.deleteAllData, {
|
date: this.componentData.entity.createTime.split(' ')[0]
|
}).then(res => {
|
this.uploading = false
|
if (res.code === 201) {
|
return
|
}
|
this.$message.success('删除成功')
|
this.refreshTable()
|
})
|
}).catch(() => {})
|
},
|
selectDataReportingForCreateUserNames(){
|
this.$axios.post(this.$api.dataReporting.selectDataReportingForCreateUserNames,{
|
time: this.componentData.entity.createTime
|
}).then(res => {
|
this.userNames = res.data
|
})
|
},
|
selectVxs(){
|
this.$axios.get(this.$api.dataReporting.selectVxs,{
|
params:{
|
time: this.componentData.entity.createTime
|
}
|
}).then(res => {
|
if (res.code === 201) {
|
return
|
}
|
this.vxs = res.data
|
var str = []
|
res.data.forEach(a => {
|
str.push({
|
label: a.vx,
|
value: a.vx
|
})
|
})
|
this.componentData.selectField.vxCard.select = str
|
})
|
}
|
}
|
}
|
</script>
|