| | |
| | | } |
| | | </style> |
| | | <style> |
| | | .data_reporting .data_reporting_dia .el-dialog__body{ |
| | | .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"> |
| | | <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="small" @click=""> |
| | | <el-button size="medium" @click="openUpload()" 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-col> |
| | | </el-row> |
| | | </div> |
| | |
| | | <div class="search_thing"> |
| | | <div class="search_label">系统日期:</div> |
| | | <div class="search_input"> |
| | | <el-date-picker size="small" v-model="componentData.entity.updateTime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" clearable></el-date-picker> |
| | | <el-date-picker size="small" v-model="componentData.entity.createTime" type="date" placeholder="选择日期" |
| | | value-format="yyyy-MM-dd HH:mm:ss" clearable></el-date-picker> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">登记人:</div> |
| | | <div class="search_input"> |
| | | <el-input size="small" v-model="componentData.entity.registrant" clearable placeholder="登记人" @keyup.enter.native="refreshTable()"></el-input> |
| | | <el-input size="small" v-model="componentData.entity.registrant" clearable placeholder="登记人" |
| | | @keyup.enter.native="refreshTable()"></el-input> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing"> |
| | |
| | | <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> |
| | | </div> |
| | | <div class="table"> |
| | | <ValueTable ref="ValueTable" :url="$api.dataReporting.selectDataReportingList" :componentData="componentData" |
| | | :key="upIndex" @upRole="upRole" /> |
| | | <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"> |
| | |
| | | </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.show" size="small" disabled></el-input> |
| | | <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-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="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-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"> |
| | | <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> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | return { |
| | | componentData: { |
| | | entity: { |
| | | updateTime: null, |
| | | createTime: null, |
| | | registrant: null, |
| | | product: null, |
| | | orderBy: { |
| | |
| | | showSelect: true, |
| | | select: true, |
| | | do: [{ |
| | | id: 'update', |
| | | font: '编辑', |
| | | type: 'text', |
| | | method: 'upRole' |
| | | method: 'upRole', |
| | | field: ['createUserName', 'updateUserName', 'registrant', 'department', 'consumption', |
| | | 'rebateConsumption', 'discountedConsumption', 'profit', 'remark', 'actualCost', 'fansAdd', 'agentRebate' |
| | | ] |
| | | }, { |
| | | id: 'delete', |
| | | font: '删除', |
| | | type: 'text', |
| | | method: 'doDiy' |
| | | }], |
| | | tagField: {} |
| | | tagField: {}, |
| | | selectField: {}, |
| | | requiredAdd:['name2','agent','channel','product','showNum','click','accountConsumption'], |
| | | }, |
| | | entityCopy: {}, |
| | | upIndex: 0, |
| | | addDia: false, |
| | | upDia: false, |
| | | upLoad: false, |
| | | upData: {} |
| | | upData: {}, |
| | | product: [], |
| | | uploadDia: false, |
| | | fileList: [], |
| | | uploading: false, |
| | | addPower: true, |
| | | token: null, |
| | | inPower: true, |
| | | outPower: true |
| | | } |
| | | }, |
| | | 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') |
| | | } |
| | | }, |
| | | methods: { |
| | | refreshTable() { |
| | |
| | | this.upData = this.HaveJson(row) |
| | | this.upDia = true |
| | | }, |
| | | saveUpData(){ |
| | | saveUpData() { |
| | | this.upLoad = true |
| | | delete this.upData.createTime |
| | | delete this.upData.updateTime |
| | |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res=>{ |
| | | }).then(res => { |
| | | this.upLoad = false |
| | | if(res.code == 201){ |
| | | 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 |
| | | 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 (!del) { |
| | | this.componentData.do.splice(1, 1) |
| | | } |
| | | if (!up) { |
| | | this.componentData.do.splice(0, 1) |
| | | } |
| | | this.addPower = add |
| | | this.inPower = inPower |
| | | this.outPower = outPower |
| | | }, |
| | | openUpload() { |
| | | 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(); |
| | | }, |
| | | onSuccess(response, file, fileList) { |
| | | this.$refs.upload.clearFiles() |
| | | this.uploadDia = false |
| | | this.uploading = 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); |
| | | } |
| | | } |
| | | } |