From bb472b43a0a58b3156a28b9cfb4ff4030932c6c5 Mon Sep 17 00:00:00 2001
From: “zhuo” <“zhuo@itcast.cn”>
Date: 星期一, 08 一月 2024 17:29:11 +0800
Subject: [PATCH] 员工数据对比
---
src/components/view/data-reporting.vue | 188 +++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 172 insertions(+), 16 deletions(-)
diff --git a/src/components/view/data-reporting.vue b/src/components/view/data-reporting.vue
index 5708237..5db24a8 100644
--- a/src/components/view/data-reporting.vue
+++ b/src/components/view/data-reporting.vue
@@ -36,21 +36,34 @@
}
</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>
@@ -58,13 +71,15 @@
<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">
@@ -72,6 +87,7 @@
<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>
@@ -81,8 +97,8 @@
</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">
@@ -117,9 +133,19 @@
</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;">浠g悊</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">
@@ -161,7 +187,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;">浠g悊杩旂偣</el-col>
+ <el-col :span="4" style="text-align: right;padding-right: 8px;">鍛樺伐浠g悊杩旂偣</el-col>
<el-col :span="7">
<el-input v-model="upData.agentRebate" size="small" disabled></el-input>
</el-col>
@@ -192,6 +218,20 @@
<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>
@@ -205,7 +245,7 @@
return {
componentData: {
entity: {
- updateTime: null,
+ createTime: null,
registrant: null,
product: null,
orderBy: {
@@ -217,22 +257,61 @@
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() {
@@ -246,7 +325,7 @@
this.upData = this.HaveJson(row)
this.upDia = true
},
- saveUpData(){
+ saveUpData() {
this.upLoad = true
delete this.upData.createTime
delete this.upData.updateTime
@@ -256,15 +335,92 @@
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);
}
}
}
--
Gitblit v1.9.3