李林
2024-01-02 e3f6244998e835635154bbab8754a1000b8ef815
修订版本1.0
已修改6个文件
281 ■■■■ 文件已修改
src/assets/api/controller.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/tool/value-table.vue 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/data-reporting.vue 147 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/product-count.vue 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/registrant-count.vue 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/api/controller.js
@@ -30,6 +30,11 @@
    upDataReporting: "/dataReporting/upDataReporting", //修改数据上报
    selectProductCountDtoPageList: "/dataReporting/selectProductCountDtoPageList", //获取项目汇总列表
    selectRegistrantCountDtoPageList: "/dataReporting/selectRegistrantCountDtoPageList", //获取登记人汇总列表
    addDataReporting: "/dataReporting/addDataReporting", //添加数据上报
    delDataReporting: "/dataReporting/delDataReporting", //删除数据上报
    downDataReportingFile: "/dataReporting/downDataReportingFile", //导出数据上报
    downProductCountFile: "/dataReporting/downProductCountFile", //导出项目数据统计
    downRegistrantCountFile: "/dataReporting/downRegistrantCountFile", //导出员工数据统计
    
    selectFansSubmitList: "/dataReporting/selectFansSubmitList", //获取进粉上报列表
    delFansSubmit: "/dataReporting/delFansSubmit", //删除进粉上报信息
@@ -42,6 +47,8 @@
    addFinanceSubmit: "/dataReporting/addFinanceSubmit", //添加财务上报信息
    
    getDataList: "/dataReporting/getDataList", //获取首页数据
    inputCsv: "/dataReporting/inputCsv", //导入
}
const enums = {
src/components/tool/value-table.vue
@@ -16,6 +16,20 @@
        text-align: right;
        margin-top: 10px;
    }
    .down-left {
        width: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .down-right {
        width: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
</style>
<template>
@@ -74,10 +88,10 @@
            </span>
        </el-dialog>
        <el-dialog title="新增" :visible.sync="addDia" width="500px">
            <div class="body" v-if="addDia">
            <div class="body" v-if="addDia" style="max-height: 600px;overflow-y: auto;">
                <el-row v-for="(a, ai) in upHead" :key="ai" style="line-height: 50px;">
                    <el-col :span="5" style="text-align: right;">{{a.value}}:</el-col>
                    <el-col :span="17" :offset="1">
                    <el-col :span="6" style="text-align: right;">{{a.value}}:</el-col>
                    <el-col :span="16" :offset="1">
                        <el-input v-model="upData[a.label]" size="small" clearable :placeholder="`请输入${a.value}`"
                            v-if="showType(a.label, data.selectField) == null"></el-input>
                        <el-select v-model="upData[a.label]" size="small" v-if="showType(a.label, data.selectField) != null"
@@ -95,12 +109,13 @@
        </el-dialog>
        <el-dialog title="导出" :visible.sync="downDia" width="400px">
            <div style="display: flex;width: 100%;height: 100px;">
                <div class="down-left"></div>
                <div class="down-right"></div>
                <div class="down-left" @click="downFile(true)">
                    <el-button>本页导出</el-button>
                </div>
                <div class="down-right" @click="downFile(false)">
                    <el-button>全部导出</el-button>
                </div>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="downDia = false">取 消</el-button>
            </span>
        </el-dialog>
    </div>
</template>
@@ -120,6 +135,10 @@
                default: () => null
            },
            delUrl: {
                type: String,
                default: () => null
            },
            downUrl: {
                type: String,
                default: () => null
            },
@@ -385,8 +404,10 @@
                this.upHead = this.HaveJson(this.tableHead)
                this.upHead = this.upHead.filter(a => a.label != 'createTime' && a.label != 'updateTime')
                var val = this.data.do.filter(a => a.id == 'update')[0]
                if(val == undefined) {
                    val = {field: []}
                if (val == undefined) {
                    val = {
                        field: []
                    }
                }
                val.field.forEach(a => {
                    if (JSON.stringify(this.upData[a]) == undefined) {
@@ -430,8 +451,47 @@
                    this.addLoad = false
                })
            },
            openDownDia(){
            openDownDia() {
                this.downDia = true
            },
            downFile(type) {
                if (this.downUrl == null) {
                    this.$message.error('请给导出请求地址')
                    return
                }
                var page = this.HaveJson(this.page)
                if (!type) {
                    page.current = 0
                    page.size = this.total
                }
                this.loading = true
                this.$axios.post(this.downUrl, {
                    page: page,
                    entity: this.data.entity
                }, {
                    headers: {
                        'Content-Type': 'application/json'
                    }
                }).then(res => {
                    if (res.code === 201) {
                        this.loading = false
                        return
                    }
                    this.downDia = false
                    this.loading = false
                    this.$message.success('导出成功')
                    let eleLink = document.createElement('a')
                    eleLink.style.display = 'none'
                    eleLink.download = res.data
                    eleLink.href = this.javaApi + '/outPath/' + res.data
                    document.body.appendChild(eleLink)
                    eleLink.click()
                    document.body.removeChild(eleLink)
                }).catch(e => {
                    console.log(e);
                    this.loading = false
                    this.$message.error('请刷新页面再尝试')
                })
            }
        }
    }
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="$refs.ValueTable.openDownDia()">
                    <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.updateTime" 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">
@@ -82,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">
@@ -120,7 +135,7 @@
                <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">
@@ -193,6 +208,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>
@@ -218,11 +247,21 @@
                    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'
                        ]
                    }, {
                        id: 'delete',
                        font: '删除',
                        type: 'text',
                        method: 'doDiy'
                    }],
                    tagField: {}
                    tagField: {},
                    selectField: {}
                },
                entityCopy: {},
                upIndex: 0,
@@ -231,12 +270,22 @@
                upLoad: false,
                upData: {},
                product: [],
                uploadDia: false,
                fileList: [],
                uploading: false,
                addPower: true,
                token: null,
                inPower: true,
                outPower: true
            }
        },
        mounted() {
            this.entityCopy = this.HaveJson(this.componentData.entity)
            this.selectProductEnumList()
            this.getPower()
            this.token = {
                'token': sessionStorage.getItem('token')
            }
        },
        methods: {
            refreshTable() {
@@ -250,7 +299,7 @@
                this.upData = this.HaveJson(row)
                this.upDia = true
            },
            saveUpData(){
            saveUpData() {
                this.upLoad = true
                delete this.upData.createTime
                delete this.upData.updateTime
@@ -260,9 +309,9 @@
                    headers: {
                        'Content-Type': 'application/json'
                    }
                }).then(res=>{
                }).then(res => {
                    this.upLoad = false
                    if(res.code == 201){
                    if (res.code == 201) {
                        return
                    }
                    this.$message.success('修改成功')
@@ -270,24 +319,82 @@
                    this.refreshTable()
                })
            },
            selectProductEnumList(){
                this.$axios.get(this.$api.enums.selectProductEnumList).then(res=>{
            selectProductEnumList() {
                this.$axios.get(this.$api.enums.selectProductEnumList).then(res => {
                    this.product = res.data
                })
            },
            // 权限分配
            getPower(){
            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'){
                    if (power[i].menuMethod == 'upDataReporting') {
                        up = true
                        break
                    }
                    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(!up){
                    this.componentData.do = []
                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.success('上传失败')
                this.$refs.upload.clearFiles()
                this.uploading = false
            },
            opeaAdd() {
                this.$refs.ValueTable.openAddDia(this.$api.dataReporting.addDataReporting);
            }
        }
    }
src/components/view/product-count.vue
@@ -42,7 +42,7 @@
            <el-row class="title">
                <el-col :span="12" style="padding-left: 20px;">项目数据统计</el-col>
                <el-col :span="12" style="text-align: right;">
                    <el-button size="small" @click="">
                    <el-button size="small" @click="$refs.ValueTable.openDownDia()" v-if="outPower">
                        <i class="el-icon-download" style="color: #3A7BFA;"></i>
                        <span style="color: #3A7BFA;">导出</span>
                    </el-button>
@@ -77,7 +77,7 @@
            </div>
        </div>
        <div class="table">
            <ValueTable ref="ValueTable" :url="$api.dataReporting.selectProductCountDtoPageList" :componentData="componentData" :key="upIndex"/>
            <ValueTable ref="ValueTable" :url="$api.dataReporting.selectProductCountDtoPageList" :componentData="componentData" :key="upIndex" :downUrl="$api.dataReporting.downProductCountFile"/>
        </div>
    </div>
</template>
@@ -109,12 +109,14 @@
                entityCopy: {},
                upIndex: 0,
                addDia: false,
                product: []
                product: [],
                outPower: true
            }
        },
        mounted() {
            this.entityCopy = this.HaveJson(this.componentData.entity)
            this.selectProductEnumList()
            this.getPower()
        },
        methods: {
            refreshTable() {
@@ -128,6 +130,17 @@
                this.$axios.get(this.$api.enums.selectProductEnumList).then(res=>{
                    this.product = res.data
                })
            },
            // 权限分配
            getPower() {
                let power = JSON.parse(sessionStorage.getItem('power'))
                let outPower = false
                for (var i = 0; i < power.length; i++) {
                    if (power[i].menuMethod == 'downProductCountFile') {
                        outPower = true
                    }
                }
                this.outPower = outPower
            }
        }
    }
src/components/view/registrant-count.vue
@@ -47,7 +47,7 @@
            <el-row class="title">
                <el-col :span="12" style="padding-left: 20px;">员工数据统计</el-col>
                <el-col :span="12" style="text-align: right;">
                    <el-button size="small" @click="">
                    <el-button size="small" @click="$refs.ValueTable.openDownDia()" v-if="outPower">
                        <i class="el-icon-download" style="color: #3A7BFA;"></i>
                        <span style="color: #3A7BFA;">导出</span>
                    </el-button>
@@ -79,7 +79,7 @@
            </div>
        </div>
        <div class="table">
            <ValueTable ref="ValueTable" :url="$api.dataReporting.selectRegistrantCountDtoPageList" :componentData="componentData" :key="upIndex"/>
            <ValueTable ref="ValueTable" :url="$api.dataReporting.selectRegistrantCountDtoPageList" :componentData="componentData" :key="upIndex" :downUrl="$api.dataReporting.downRegistrantCountFile"/>
        </div>
    </div>
</template>
@@ -111,13 +111,15 @@
                upIndex: 0,
                addDia: false,
                product: [],
                custom:[]
                custom:[],
                outPower: true
            }
        },
        mounted() {
            this.entityCopy = this.HaveJson(this.componentData.entity)
            this.selectProductEnumList()
            this.selectCustomEnumList()
            this.getPower()
        },
        methods: {
            refreshTable() {
@@ -136,6 +138,17 @@
                this.$axios.get(this.$api.enums.selectCustomEnumList).then(res=>{
                    this.custom = res.data
                })
            },
            // 权限分配
            getPower() {
                let power = JSON.parse(sessionStorage.getItem('power'))
                let outPower = false
                for (var i = 0; i < power.length; i++) {
                    if (power[i].menuMethod == 'downRegistrantCountFile') {
                        outPower = true
                    }
                }
                this.outPower = outPower
            }
        }
    }
src/main.js
@@ -11,11 +11,16 @@
import api from './assets/api/controller.js'
import swal from 'sweetalert'
Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80"; //前端本地端口
//本地
Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80";
const javaApi = 'http://localhost:8001';
//胜云服务器
// Vue.prototype.LOCATIONVUE = "http://syxt.shxiao2.cn";
// const javaApi = 'http://122.114.52.69:8001';
Vue.prototype.HaveJson = (val) => {
    return JSON.parse(JSON.stringify(val))
}
Vue.prototype.javaApi = javaApi
Vue.use(VueAxios, axios)
Vue.config.productionTip = false