Procházet zdrojové kódy

feat: 添加说明管理和水印管理

linwenxin před 1 rokem
rodič
revize
76315929bb

+ 5 - 2
src/views/mallManagement/goods/explain_index/index.vue

@@ -1,7 +1,7 @@
 <template>
   <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
     :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
-    :operation="operation" :exportList="exportList">
+    :operation="operation" :exportList="exportList" :defaultSearchData="defaultSearchData">
   </template-page>
 </template>
 
@@ -64,7 +64,10 @@ export default {
   },
   methods: {
     // 列表请求函数
-    getList: templateListPageV2,
+    getList(pm){
+      pm.params.push({ "param": "a.type", "compare": "=", "value": '1' })
+      return templateListPageV2(pm)
+    },
     // 列表导出函数
     exportList: templatePageExport,
     // 表格列解析渲染数据更改

+ 82 - 114
src/views/mallManagement/goods/watermark/index.vue

@@ -1,133 +1,101 @@
 <template>
-  <div class="app-container">
-    <div class="mymain-container">
-      <div class="btn-group clearfix">
-        <div class="fl">
-          <el-button type="primary" icon="el-icon-plus" size="small" @click="addOrEdit('add')">添加水印</el-button>
-        </div>
-      </div>
-
-      <div class="table">
-        <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
-          <el-table-column align="center" label="水印名称" prop="name"></el-table-column>
-          <el-table-column align="center" label="创建时间" prop="createTime"></el-table-column>
-          <el-table-column align="center" label="商户" prop="companyName"></el-table-column>
-          <el-table-column align="center" label="操作" width="140">
-            <template slot-scope="scope">
-              <el-button type="primary" size="mini" @click="addOrEdit('edit', scope.row.commonTemplateId)">编辑</el-button>
-              <el-popconfirm style="margin-left: 10px;" title="确定删除吗?" @confirm="delItem(scope.row.commonTemplateId)" >
-                <el-button slot="reference" size="mini">删除</el-button>
-              </el-popconfirm>
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
-
-      <div class="pagination clearfix">
-        <div class="fr">
-          <el-pagination
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page="currentPage"
-            :page-sizes="[10, 20, 30, 50]"
-            :page-size="10"
-            layout="total, sizes, prev, pager, next, jumper"
-            :total="listTotal">
-          </el-pagination>
-        </div>
-      </div>
-    </div>
-  </div>
+  <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
+    :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
+    :operation="operation" :exportList="exportList" :defaultSearchData="defaultSearchData">
+  </template-page>
 </template>
 
 <script>
-import { getModuleList, deleteModule } from '@/api/goods'
-
+import TemplatePage from '@/components/template/template-page-1.vue'
+import import_mixin from '@/components/template/import_mixin.js'
+import { deleteModule, templateListPageV2, templatePageExport } from '@/api/goods'
 export default {
+  components: { TemplatePage },
+  mixins: [import_mixin],
   data() {
     return {
-      dataList: null, // 列表数据
-      listLoading: true, // 列表加载loading
-      currentPage: 1, // 当前页码
-      pageSize: 10, // 每页数量
-      listTotal: 0, // 列表总数
+      // 事件组合
+      optionsEvensGroup: [
+        [
+          [
+            {
+              name: '添加模块',
+              isRole: true,
+              click: () => {
+                this.$router.push({
+                  name: "watermark_add",
+                  query: {}
+                })
+              }
+            }
+          ],
+        ],
+      ],
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: false
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
     }
   },
-
-  created() {
-    this.getList();
+  computed: {
+    // 更多参数
+    moreParameters() {
+      return []
+    },
   },
-
   methods: {
-
-    getList() {
-      this.listLoading = true;
-
-      let params = {
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        type: 2
-      };
-
-      getModuleList(params).then(res => {
-        this.dataList = res.data.records;
-        this.listTotal = res.data.total;
-        this.listLoading = false;
-      })
+    // 列表请求函数
+    getList(pm){
+      pm.params.push({ "param": "a.type", "compare": "=", "value": '2' })
+      return templateListPageV2(pm)
     },
-
-    // 编辑公共模块
-    editCommonModule() {
-      this.$router.push({
-        name:"explain_common",
-        query: {}
-      })
-    },
-
-    // 添加模块
-    addOrEdit(type, id) {
-      if(type == 'add') {
-        this.$router.push({
-          name:"watermark_add",
-          query: {}
-        })
-      }else {
-        this.$router.push({
-          name:"watermark_add",
-          query: {
-            id
-          }
-        })
-      }
-    },
-
-    // 删除模块
-    delItem(commonTemplateId) {
-      deleteModule({
-        commonTemplateId
-      }).then(res => {
-        this.getList();
-        this.$successMsg();
-      })
+    // 列表导出函数
+    exportList: templatePageExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
     },
-
-    // 更改每页数量
-    handleSizeChange(val) {
-      this.pageSize = val;
-      this.currentPage = 1;
-      this.getList();
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
     },
-
-    // 更改当前页
-    handleCurrentChange(val) {
-      this.currentPage = val;
-      this.getList();
+    // 表格操作列
+    operation(h, { row, index, column }) {
+      return (
+        <div class='operation-btns'>
+          <el-button type="text" onClick={() => {
+            this.$router.push({
+              name: "watermark_add",
+              query: {
+                id: row.commonTemplateId
+              }
+            })
+          }}>编辑</el-button>
+          <el-popconfirm
+            title="确定删除吗?"
+            onConfirm={() => {
+              deleteModule({
+                commonTemplateId: row.commonTemplateId
+              }).then(res => {
+                this.$message({ type: 'success', message: '删除成功!' })
+                this.$refs.pageRef.refreshList()
+              })
+            }}
+          >
+            <el-button type="text" slot="reference">删除</el-button>
+          </el-popconfirm>
+        </div>
+      )
     },
-
   }
 }
 </script>
 
-<style scoped>
-
-</style>
+<style lang="scss" scoped></style>