123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <template>
- <div class="app-container">
- <el-row :gutter="20">
-
- <el-col :span="24" :xs="24">
-
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="configPermi.add"
- >添加模板</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
- </el-row>
-
- <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
- <el-table-column type="index" label="序号" align="center" />
- <el-table-column label="模板名称" align="center" key="name" prop="name" v-if="columns[0].visible" :show-overflow-tooltip="true" />
- <el-table-column label="正面图片" align="center" key="mainBg" prop="mainBg" v-if="columns[1].visible" :show-overflow-tooltip="true">
- <template slot-scope="scope">
- <div>
- <img :src="scope.row.mainBg" alt="">
- </div>
- </template>
- </el-table-column>
- <el-table-column label="反面图片" align="center" key="backBg" prop="backBg" v-if="columns[2].visible" :show-overflow-tooltip="true">
- <template slot-scope="scope">
- <div>
- <img :src="scope.row.backBg" alt="">
- </div>
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- align="center"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope" >
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleDetails(scope.row)"
- v-hasPermi="configPermi.details"
- >详情</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="configPermi.edit"
- >编辑</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="configPermi.delect"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </el-col>
- </el-row>
-
- <addAndEdit ref="addAndEdit" @refresh="getList" />
- <detailsBox ref="detailsBox"></detailsBox>
- </div>
- </template>
-
- <script>
- import {
- listTableApi,
- delTableParamsApi
- } from "@/api/CURD";
- import addAndEdit from "./formBox/physicalCardTemplateForm.vue"
- import detailsBox from "./detailsBox/physicalCardTemplateDetails.vue"
- export default {
- name: "User",
- dicts: [],
- components: {addAndEdit,detailsBox},
- data() {
- return {
- title: "模板管理",
- configPermi: {
- add: ['physicalCard:physicalCardTemplate:add'],
- details: ['physicalCard:physicalCardTemplate:details'],
- delect: ['physicalCard:physicalCardTemplate:delect'],
- edit: ['physicalCard:physicalCardTemplate:edit'],
- upload: [''],
- export: [''],
- release: ['']
- },
- configUrl: {
- list: '/merchant/templateEntitycard/pageList',
- delect: '/merchant/templateEntitycard/deleteById',
- upload: '',
- download:'',
- export: '',
- updateStatusById: '',
- },
-
- loading: true,
-
- ids: [],
-
- single: true,
-
- multiple: true,
-
- showSearch: true,
-
- total: 0,
-
- tableList: null,
-
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- },
- dateRange: [],
-
- columns: [
- { key: 0, label: `实体卡名称`, visible: true },
- { key: 2, label: `实体卡价格`, visible: true },
- { key: 3, label: `使用期限`, visible: true },
- { key: 4, label: `生效日期`, visible: true },
- { key: 5, label: `支持储值`, visible: true },
- { key: 6, label: `支持积分`, visible: true },
- { key: 7, label: `创捷时间`, visible: true },
- ],
- };
- },
- created() {
- this.getList();
- },
- methods: {
-
- getList() {
- this.loading = true;
- listTableApi(
- this.configUrl.list,
- this.addDateRange(
- this.queryParams,
- this.dateRange)).then(response => {
- this.tableList = response.data.rows;
- this.total = response.data.total;
- this.loading = false;
- }
- ).catch (error=>{
- console.error('获取列表失败!!!!',error)
- this.tableList = [];
- this.total = 0;
- this.loading = false
- })
- },
-
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
-
- resetQuery() {
- this.dateRange = [];
- this.queryParams = {
- pageNum: 1,
- pageSize: 10,
- }
- this.handleQuery();
- },
-
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id);
- this.single = selection.length != 1;
- this.multiple = !selection.length;
- },
-
- handleAdd() {
- if(this.$refs.addAndEdit) {
- this.$refs.addAndEdit.initData(this.title + '新增', "ADD",{})
- }
- },
-
- handleUpdate(row) {
- if(this.$refs.addAndEdit) {
- this.$refs.addAndEdit.initData(this.title + '基本信息编辑', "EDITInit",{...row})
- }
- },
- handleUpdate(row) {
- if(this.$refs.addAndEdit) {
- this.$refs.addAndEdit.initData(this.title + '规格信息编辑', "EDITInit",{...row})
- }
- },
- handleDetails(row){
- if(this.$refs.detailsBox) {
- this.$refs.detailsBox.initData(this.title + '详情',"DEATILSInit", row)
- }
- },
-
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$modal.confirm('是否确认删除数据项?').then( () => {
- return delTableParamsApi(this.configUrl.delect,{
- id: ids
- });
- }).then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- }).catch((e) => {
- console.error("删除失败====",e)
- });
- },
-
- handleExport() {
- this.download(this.configUrl.export, {
- ...this.queryParams
- }, `${this.title }_${new Date().getTime()}.xlsx`)
- },
-
- handleImport() {
- if(this.$refs.upload) {
- this.$refs.upload.initData({
- width: '400px',
-
- title: this.title + "导入",
-
- importTemplate: this.configUrl.download,
-
- url: this.configUrl.upload
- })
- }
- },
- }
- };
- </script>
-
|