|
@@ -0,0 +1,398 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="文件名称" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.name"
|
|
|
+ placeholder="请输入文件名称"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ style="width: 140px"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="时间" label-width="40px">
|
|
|
+ <el-date-picker
|
|
|
+ style="margin-top:5px;"
|
|
|
+ v-model="dateRange"
|
|
|
+ size="small"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ type="datetimerange"
|
|
|
+ range-separator="-"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ ></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['system:admin:add']"
|
|
|
+ >下载充值模板</el-button>
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ action="#"
|
|
|
+ :limit = 1
|
|
|
+ :on-change="handleChange"
|
|
|
+ :file-list="fileList"
|
|
|
+ :auto-upload="false"
|
|
|
+ accept=".xlsx,.xls"
|
|
|
+ style="display:inline-block;margin-left:10px;vertical-align: top;"
|
|
|
+ >
|
|
|
+ <el-button size="mini" type="primary">上传充值文件</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="adminList" >
|
|
|
+ <el-table-column label="id" align="center" prop="id" show-overflow-tooltip />
|
|
|
+ <el-table-column label="类别" align="center" prop="businessType" show-overflow-tooltip />
|
|
|
+ <el-table-column label="文件名称" align="center" prop="oriName" show-overflow-tooltip />
|
|
|
+ <el-table-column label="上传时间" align="center" prop="createTime" show-overflow-tooltip />
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" show-overflow-tooltip >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button v-if ="scope.row.url"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-bottom"
|
|
|
+ @click="handleExport(scope.row)"
|
|
|
+ >下载</el-button>
|
|
|
+ <!-- <span v-if="scope.row.url">
|
|
|
+ <span v-if="scope.row.url == '' || scope.row.url == null">文件整理中...请稍后查看</span>
|
|
|
+ <span else>{{scope.row.url}}</span>
|
|
|
+ </span> -->
|
|
|
+
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.current"
|
|
|
+ :limit.sync="queryParams.size"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { addChannel, updataChannel, delChannel, listChannel, fileId, uploadFileApi, fileTakeEffect, getFile, listRecharge } from "@/api/system/product";
|
|
|
+export default {
|
|
|
+ name: "admin",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 导出遮罩层
|
|
|
+ exportLoading: false,
|
|
|
+ dialogFormVisible:false,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 图片显示
|
|
|
+ fileList:[{"url":''}],
|
|
|
+ // 参数表格数据
|
|
|
+ adminList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 类型数据字典
|
|
|
+ typeOptions: [],
|
|
|
+ // 日期范围
|
|
|
+ dateRange: [],
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ current: 1,
|
|
|
+ size: 10,
|
|
|
+ name: undefined,
|
|
|
+ aliasName: undefined,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {
|
|
|
+ id:'',
|
|
|
+ name:'',
|
|
|
+ introduce:'',
|
|
|
+ logo:"",
|
|
|
+ batchNo:undefined,
|
|
|
+ businessType:"产品logo",
|
|
|
+ uploadType:"file",
|
|
|
+ },
|
|
|
+
|
|
|
+ // 上传图片
|
|
|
+ dialogImageUrl: '',
|
|
|
+ dialogVisible: false,
|
|
|
+ disabled: false,
|
|
|
+ imageInfo: {},
|
|
|
+ imageList: [],
|
|
|
+ formInline: {
|
|
|
+ image64: "",
|
|
|
+ imageName: "",
|
|
|
+ },
|
|
|
+ formData:undefined,
|
|
|
+ limit:100,
|
|
|
+ num:0,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleRemove(file) {
|
|
|
+ this.form.logo = undefined
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs['form'].clearValidate(['logo']);
|
|
|
+ // })
|
|
|
+ this.limit = 100
|
|
|
+ document.getElementsByClassName("el-upload-list el-upload-list--picture-card")[0].firstChild.remove()
|
|
|
+ document.getElementsByClassName("el-upload--picture-card")[0].style.display="block"
|
|
|
+ },
|
|
|
+ /** 查询参数列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ let data = this.addDateRange(this.queryParams,this.dateRange)
|
|
|
+ data.params = undefined
|
|
|
+ listRecharge(data).then(response => {
|
|
|
+ if(response.data.records.length>0){
|
|
|
+ let arrBig = response.data.records
|
|
|
+ let arrr = []
|
|
|
+ for(let i =0;i<arrBig.length;i++){
|
|
|
+ if(arrBig[i].businessType == "充值表格"){
|
|
|
+ arrr.push(arrBig[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // let arr = []
|
|
|
+ // arr = response.data.records.map(item =>{
|
|
|
+ // return {
|
|
|
+ // batchNos:[item.logo]
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // for(let i=1;i<response.data.records.length; i++){
|
|
|
+ // arr[0].batchNos.push(response.data.records[i].logo)
|
|
|
+ // }
|
|
|
+ // getFile(arr[0]).then(response =>{
|
|
|
+ // const reverse = response.data.reverse()
|
|
|
+ // for(let i=0;i<response.data.length;i++){
|
|
|
+ // arrBig[i].logo = reverse[i].url
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.loading = false;
|
|
|
+ this.adminList = arrr;
|
|
|
+ this.total = response.data.total;
|
|
|
+ console.log(this.adminList)
|
|
|
+ },1000)
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.adminList = []
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ ids: undefined,
|
|
|
+ name: undefined,
|
|
|
+ aliasName: undefined,
|
|
|
+ adminType: "Y",
|
|
|
+ };
|
|
|
+ this.fileList=[]
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.current = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.dateRange = [];
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.form.id =undefined
|
|
|
+ this.form.name =undefined
|
|
|
+ this.form.introduce =undefined
|
|
|
+ this.form.logo =undefined
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加参数";
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.id)
|
|
|
+ this.single = selection.length!=1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ Object.assign(this.form, row.id ? this.adminList.find(val=>val.id === row.id) : this.adminList.find(val=>val.id === this.ids[0]))
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改参数";
|
|
|
+ },
|
|
|
+
|
|
|
+ handleChange(param){
|
|
|
+ this.limit = 1
|
|
|
+ this.num++
|
|
|
+ if(this.num>1){
|
|
|
+ this.num = 0
|
|
|
+ return false
|
|
|
+ }else{
|
|
|
+ fileId().then(res=>{ //获取文件批号
|
|
|
+ this.form.batchNo = res.data
|
|
|
+ this.formData = new FormData()// FormData 对象
|
|
|
+ this.formData.append('files', param.raw)
|
|
|
+
|
|
|
+ this.form.businessType = "充值表格"
|
|
|
+ uploadFileApi(this.form.batchNo,this.form.businessType,this.formData).then(response => {
|
|
|
+ // getFile({batchNo:this.form.batchNo}).then(response => {
|
|
|
+
|
|
|
+ // })
|
|
|
+ if(response.data.length>0){
|
|
|
+ let ids = new FormData()
|
|
|
+ ids.append('ids[]', response.data[0].id)
|
|
|
+ // 上传图片生效
|
|
|
+ fileTakeEffect(response.data[0].batchNo,ids).then(response => {
|
|
|
+ this.msgSuccess("上传成功");
|
|
|
+ // if (this.form.id != undefined) {
|
|
|
+ // updataChannel(this.form).then(response => {
|
|
|
+ // this.loading = false,
|
|
|
+ // this.msgSuccess("修改成功");
|
|
|
+ // this.open = false;
|
|
|
+ // this.getList();
|
|
|
+ // }).catch(()=>{
|
|
|
+ // this.loading = false,
|
|
|
+ // this.open = false
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // addChannel(this.form).then(response => {
|
|
|
+ // this.loading = false,
|
|
|
+ // this.msgSuccess("新增成功");
|
|
|
+ // this.open = false;
|
|
|
+ // this.getList();
|
|
|
+ // }).catch(()=>{
|
|
|
+ // this.loading = false,
|
|
|
+ // this.open = false
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ }).catch(err =>{
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.$message.error('上传失败')
|
|
|
+ this.getList();
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handSuccess(){
|
|
|
+ this.$refs.img.clearValidate();
|
|
|
+ },
|
|
|
+ //变化设置图片
|
|
|
+ onChange(file, fileList) {
|
|
|
+ this.form.file = fileList;
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm(row) {
|
|
|
+ if(this.form.logo){
|
|
|
+ }else{
|
|
|
+ this.$refs.img.clearValidate();
|
|
|
+ }
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true
|
|
|
+ // 上传图片
|
|
|
+ this.form.businessType = "产品logo",
|
|
|
+ uploadFileApi(this.form.batchNo,this.form.businessType,this.formData).then(response => {
|
|
|
+ if(response.data.length>0){
|
|
|
+ let ids = new FormData()
|
|
|
+ ids.append('ids[]', response.data[0].id)
|
|
|
+ // 上传图片生效
|
|
|
+ fileTakeEffect(response.data[0].batchNo,ids).then(response => {
|
|
|
+ // this.msgSuccess("上传成功");
|
|
|
+ if (this.form.id != undefined) {
|
|
|
+ updataChannel(this.form).then(response => {
|
|
|
+ this.loading = false,
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ }).catch(()=>{
|
|
|
+ this.loading = false,
|
|
|
+ this.open = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ addChannel(this.form).then(response => {
|
|
|
+ this.loading = false,
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ }).catch(()=>{
|
|
|
+ this.loading = false,
|
|
|
+ this.open = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(err =>{
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.$message.error('上传失败')
|
|
|
+ this.getList();
|
|
|
+ })
|
|
|
+ // this.removeImg()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const ids = row.id || this.ids;
|
|
|
+ this.$confirm('是否确认删除', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ return delChannel(ids);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ /** 刷新缓存按钮操作 */
|
|
|
+ handleRefreshCache() {
|
|
|
+ refreshCache().then(() => {
|
|
|
+ this.msgSuccess("刷新成功");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.el-upload-list{
|
|
|
+ display: none !important;
|
|
|
+
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|