Explorar el Código

feature: 销售类型

chenqilong hace 2 años
padre
commit
7d357a6989
Se han modificado 2 ficheros con 117 adiciones y 187 borrados
  1. 18 0
      src/api/policy_list.js
  2. 99 187
      src/views/sales_rebate/salestype_list.vue

+ 18 - 0
src/api/policy_list.js

@@ -246,6 +246,24 @@ export function eidtBatch(params) {
 
 // 销售类型
 
+// 销售类型列表V2
+export function saleTypeRebateListV2(data) {
+  return request({
+    url: `/sale/type/rebate/list/v2?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+//销售类型列表V2-导出
+export function saleTypeRebateListV2Export(data, name) {
+  return postBlob({
+    url: '/sale/type/list/v2/export',
+    method: 'post',
+    data,
+    name
+  })
+}
+
 export function getTypeList(params) {
   return request({
     url: '/sale/type/list',

+ 99 - 187
src/views/sales_rebate/salestype_list.vue

@@ -1,133 +1,17 @@
 <template>
-  <div class="app-container">
-    <div class="screen-container">
-      <Collapse :screen-form="screenForm">
-        <template #right_btn>
-          <el-button type="primary" size="mini" @click="submitScreenForm">搜索</el-button>
-          <el-button type="primary" size="mini" @click="resetScreenForm">清空</el-button>
-        </template>
-        <template #search>
-          <el-form ref="screenForm" :model="screenForm" size="mini" label-position="left" label-width="120px">
-            <el-row :gutter="20">
-              <el-col :xs="24" :ms="6" :lg="6">
-                <el-form-item prop="saleCode" label="销售类型编码">
-                  <el-input v-model="screenForm.saleCode" placeholder="销售类型编码" size="small"></el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :xs="24" :ms="6" :lg="6">
-                <el-form-item prop="saleName" label="销售类型名称">
-                  <el-input v-model="screenForm.saleName" placeholder="销售类型名称" size="small"></el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :xs="24" :ms="6" :lg="6">
-                <el-form-item prop="status" label="状态">
-                  <el-select v-model="screenForm.status" placeholder="状态" size="small">
-                    <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
-                    </el-option>
-                  </el-select>
-                </el-form-item>
-              </el-col>
-            </el-row>
-          </el-form>
-        </template>
-      </Collapse>
-    </div>
-    <div class="btn-group clearfix">
-      <div class="fl">
-        <el-button
-          type="primary"
-          size="mini"
-          v-if="$checkBtnRole('add', $route.meta.roles)"
-          @click=";(dialogVisible = true), (type = 1)"
-          >新增</el-button
-        >
-      </div>
-      <div class="fr">
-        <ExportButton :exUrl="'sale/type/export'" :exParams="exParams" />
-      </div>
-    </div>
-    <div class="mymain-container">
-      <div class="table">
-        <el-table
-          v-loading="listLoading"
-          :data="dataList"
-          element-loading-text="Loading"
-          border
-          fit
-          highlight-current-row
-          stripe
-        >
-          <el-table-column type="selection" width="55" align="center"> </el-table-column>
-          <template v-for="col in columns">
-            <el-table-column
-              align="left"
-              :label="col.lable"
-              :prop="col.prop"
-              :min-width="col.widht"
-              show-overflow-tooltip
-              v-if="col.prop == 'status'"
-            >
-              <template slot-scope="scope">
-                <div style="z-index: 99">
-                  <el-switch
-                    v-model="scope.row.status"
-                    @change="handleSwitch($event, scope.row.id)"
-                    :active-text="scope.row.status ? '已启用' : '已禁用'"
-                  >
-                  </el-switch>
-                </div>
-              </template>
-            </el-table-column>
-            <el-table-column
-              v-else
-              align="left"
-              :label="col.lable"
-              :prop="col.prop"
-              :min-width="col.widht"
-              show-overflow-tooltip
-            >
-            </el-table-column>
-          </template>
-
-          <el-table-column align="center" fixed="right" label="操作" min-width="160">
-            <template slot-scope="scope">
-              <el-button
-                type="text"
-                size="small"
-                @click="hanleEdit(scope.row)"
-                v-if="$checkBtnRole('edit', $route.meta.roles)"
-                >编辑</el-button
-              >
-              <!-- <el-button type="text" size="small" @click="hanleDateil(scope.row)">详情</el-button> -->
-              <el-popconfirm
-                title="这是一段内容确定删除吗?"
-                style="margin-left: 10px"
-                v-if="$checkBtnRole('del', $route.meta.roles)"
-                @onConfirm="hanleDatele(scope.row.id)"
-              >
-                <el-button slot="reference" type="text" size="small">删除</el-button>
-              </el-popconfirm>
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
-      <!-- 分页 -->
-      <div style="margin: 20px 0">
-        <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>
+  <template-page
+    ref="pageRef"
+    :getList="getList"
+    :operation="operation()"
+    :optionsEvensGroup="optionsEvensGroup"
+    :exportList="exportList"
+    :columnParsing="columnParsing"
+    :tableAttributes="tableAttributes"
+    :tableEvents="tableEvents"
+  >
     <div>
       <el-dialog :visible.sync="dialogVisible" width="50%" @close="resetForm" :close-on-click-modal="false">
-        <el-form ref="dialogForm" :model="dialogForm" :rules="type == 1 ? rules : ''" label-width="120px" size="normal">
+        <el-form ref="dialogForm" :model="dialogForm" :rules="type == 1 ? rules : {}" label-width="120px" size="normal">
           <el-form-item label="销售类型编码" prop="saleCode">
             <el-input v-model="dialogForm.saleCode"></el-input>
           </el-form-item>
@@ -163,30 +47,27 @@
         </span>
       </el-dialog>
     </div>
-  </div>
-  <!-- <template-page
-    ref="pageRef"
-    :getList="getList"
-    :operation="operation()"
-    :optionsEvensGroup="optionsEvensGroup"
-    :exportList="exportList"
-    :columnParsing="columnParsing"
-    :tableAttributes="tableAttributes"
-    :tableEvents="tableEvents"
-  >
-  </template-page> -->
+  </template-page>
 </template>
 
 <script>
 import TemplatePage from '@/components/template/template-page-1.vue'
-import add_callback_mixin from '@/components/template/add_callback_mixin.js'
+// import add_callback_mixin from '@/components/template/add_callback_mixin.js'
 
-import Mixin from '@/mixin/index'
-import Pagination from '@/components/Pagination'
-import { addData, delTypeData, getProductList, getTypeList, updateType } from '@/api/policy_list'
+// import Mixin from '@/mixin/index'
+// import Pagination from '@/components/Pagination'
+import {
+  addData,
+  delTypeData,
+  getProductList,
+  getTypeList,
+  updateType,
+  saleTypeRebateListV2,
+  saleTypeRebateListV2Export
+} from '@/api/policy_list'
 
 export default {
-  mixins: [Mixin, add_callback_mixin],
+  mixins: [],
   data() {
     return {
       // 事件组合
@@ -195,7 +76,11 @@ export default {
           [
             {
               name: '新增',
-              click: this.addOn(() => {})
+              click: () => {
+                this.dialogVisible = true
+                this.type = 1
+              },
+              isRole: this.$checkBtnRole('add', this.$route.meta.roles)
             }
           ]
         ]
@@ -203,7 +88,7 @@ export default {
       // 表格属性
       tableAttributes: {
         // 启用勾选列
-        selectColumn: true
+        selectColumn: false
       },
       // 表格事件
       tableEvents: {
@@ -218,6 +103,7 @@ export default {
         mainId: '',
         status: ''
       },
+      dialogVisible: false,
       dialogForm: {
         id: '',
         saleCode: '',
@@ -306,9 +192,9 @@ export default {
 
   methods: {
     // 列表请求函数
-    // getList: levelList,
+    getList: saleTypeRebateListV2,
     // 列表导出函数
-    // exportList: exportLevelList,
+    exportList: saleTypeRebateListV2Export,
     // 表格列解析渲染数据更改
     columnParsing(item, defaultData) {
       return defaultData
@@ -321,47 +207,61 @@ export default {
       return (h, { row, index, column }) => {
         return (
           <div class="operation-btns">
-            <el-button size="mini" type="text" onClick={async () => {}}>
-              编辑
-            </el-button>
-            <el-popconfirm
-              onConfirm={async () => {
-                this.$refs.pageRef.refreshList()
-                this.$message.success('删除成功')
-              }}
-              title="是否确定需要删除该项内容?"
-            >
-              <el-button slot="reference" size="mini" type="text">
-                删除
+            {this.$checkBtnRole('edit', this.$route.meta.roles) ? (
+              <el-button
+                size="mini"
+                type="text"
+                onClick={async () => {
+                  this.hanleEdit(row)
+                }}
+              >
+                编辑
               </el-button>
-            </el-popconfirm>
+            ) : (
+              ''
+            )}
+
+            {this.$checkBtnRole('del', this.$route.meta.roles) ? (
+              <el-popconfirm
+                onOnConfirm={async () => {
+                  this.hanleDatele(row.id)
+                }}
+                title="是否确定需要删除该项内容?"
+              >
+                <el-button slot="reference" size="mini" type="text">
+                  删除
+                </el-button>
+              </el-popconfirm>
+            ) : (
+              ''
+            )}
           </div>
         )
       }
     },
 
-    getList() {
-      this.listLoading = true
-      const params = {
-        pageNum: this.currentPage,
-        pageSize: this.pageSize,
-        saleCode: this.screenForm.saleCode,
-        saleName: this.screenForm.saleName,
-        mainId: '',
-        status: this.screenForm.status
-      }
-      getTypeList(params).then(res => {
-        this.dataList = res.data.records
-        this.listTotal = res.data.total
-        this.listLoading = false
-      })
-      getProductList({
-        productCategoryName: '',
-        productCategoryNumber: ''
-      }).then(res => {
-        this.productList = res.data
-      })
-    },
+    // getList() {
+    //   this.listLoading = true
+    //   const params = {
+    //     pageNum: this.currentPage,
+    //     pageSize: this.pageSize,
+    //     saleCode: this.screenForm.saleCode,
+    //     saleName: this.screenForm.saleName,
+    //     mainId: '',
+    //     status: this.screenForm.status
+    //   }
+    //   getTypeList(params).then(res => {
+    //     this.dataList = res.data.records
+    //     this.listTotal = res.data.total
+    //     this.listLoading = false
+    //   })
+    //   getProductList({
+    //     productCategoryName: '',
+    //     productCategoryNumber: ''
+    //   }).then(res => {
+    //     this.productList = res.data
+    //   })
+    // },
     handleChange(e) {
       this.productList.find(k => {
         if (k.productCategoryNumber == e) {
@@ -378,17 +278,28 @@ export default {
           id: ids[0]
         }).then(res => {
           this.$successMsg('删除成功')
-          this.getList()
+          this.$refs.pageRef.refreshList()
+          // this.getList()
         })
       })
     },
+    hanleDeleteAllPromise(id) {
+      return new Promise((resolve, reject) => {
+        const ids = id ? [id] : this.ids
+        if (!ids.length) {
+          this.$errorMsg('请选择删除内容')
+          return
+        }
+        resolve(ids)
+      })
+    },
     hanleEdit(item) {
       this.dialogForm = {
         id: item.id,
         saleCode: item.saleCode,
         saleName: item.saleName,
         mainName: item.mainName,
-        status: item.status
+        status: item.status === '有效' ? true : false
       }
       this.type = 0
       this.dialogVisible = true
@@ -454,11 +365,12 @@ export default {
       }
       // this.$refs.dialogForm.resetFields()
       this.dialogVisible = false
-      this.getList()
+      // this.getList()
+      this.$refs.pageRef.refreshList()
     }
   },
   components: {
-    Pagination
+    TemplatePage
   }
 }
 </script>