From 42703ea001fe9e73f30ed17c05760a57b1cb596c Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 05 三月 2024 11:05:45 +0800
Subject: [PATCH] 完成设备总览静态页面
---
src/components/view/data-reporting.vue | 157 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 141 insertions(+), 16 deletions(-)
diff --git a/src/components/view/data-reporting.vue b/src/components/view/data-reporting.vue
index 95beb34..effeab1 100644
--- a/src/components/view/data-reporting.vue
+++ b/src/components/view/data-reporting.vue
@@ -34,6 +34,9 @@
height: calc(100% - 60px - 80px - 10px - 40px);
padding: 20px;
}
+ .el-radio-group{
+ width: 100%;
+ }
</style>
<style>
.data_reporting .data_reporting_dia .el-dialog__body {
@@ -55,7 +58,7 @@
<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="openUpload()" v-if="inPower">
+ <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>
@@ -64,6 +67,7 @@
<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>
@@ -71,15 +75,17 @@
<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="false" :editable="false" @change="refreshTable"></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-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">
@@ -101,7 +107,7 @@
: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">
+ <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">
@@ -130,6 +136,16 @@
<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;">浠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;">
@@ -177,7 +193,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>
@@ -197,9 +213,15 @@
<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="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>
@@ -212,7 +234,7 @@
<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">
+ :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>
@@ -220,6 +242,19 @@
<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>
@@ -235,16 +270,16 @@
return {
componentData: {
entity: {
- updateTime: null,
+ createTime: null,
registrant: null,
product: null,
orderBy: {
field: 'id',
- order: 'desc'
+ order: 'asc'
}
},
isIndex: true,
- showSelect: true,
+ showSelect: false,
select: true,
do: [{
id: 'update',
@@ -252,7 +287,7 @@
type: 'text',
method: 'upRole',
field: ['createUserName', 'updateUserName', 'registrant', 'department', 'consumption',
- 'rebateConsumption', 'discountedConsumption', 'profit', 'remark', 'actualCost'
+ 'rebateConsumption', 'discountedConsumption', 'profit', 'remark', 'actualCost', 'fansAdd', 'agentRebate'
]
}, {
id: 'delete',
@@ -261,7 +296,14 @@
method: 'doDiy'
}],
tagField: {},
- selectField: {}
+ selectField: {
+ vxCard: {
+ select: []
+ }
+ },
+ requiredAdd:['name2','agent','channel','product','showNum','click','accountConsumption','vxCard'],
+ countFleid: ['fansAdd'],
+ uploadStr: ""
},
entityCopy: {},
upIndex: 0,
@@ -276,8 +318,28 @@
addPower: true,
token: null,
inPower: true,
- outPower: 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)
@@ -286,14 +348,19 @@
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)
@@ -332,6 +399,7 @@
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
@@ -348,6 +416,9 @@
if (power[i].menuMethod == 'downDataReportingFile') {
outPower = true
}
+ if (power[i].menuMethod == 'deleteAllData') {
+ delAllPower = true
+ }
}
if (!del) {
this.componentData.do.splice(1, 1)
@@ -358,8 +429,14 @@
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) {
@@ -376,11 +453,13 @@
}
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
@@ -395,7 +474,53 @@
},
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>
\ No newline at end of file
+</script>
--
Gitblit v1.9.3