Kaynağa Gözat

Merge branch 'dev_v2' of https://gogs.zfire.top/zfire-front/supply-front into dev_v2

zh 2 yıl önce
ebeveyn
işleme
2a5e0bca74

+ 33 - 1
src/api/supply/commercial_list.js

@@ -1,4 +1,4 @@
-import request from '@/utils/request'
+import request, { postBlob, handleImport, getBlob } from '@/utils/request'
 
 // 删除
 export function getBusPriceDelete(params) {
@@ -31,6 +31,38 @@ export function getBusPriceExport(params) {
     params
   })
 }
+// 商用工程产品价格-列表
+export function v2BusPriceList(data) {
+  return request({
+    url: `/v2/bus/price/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+//工程信息单-导出
+export function v2BusPriceListExport(data, name) {
+  return postBlob({
+    url: '/v2/bus/price/list/export',
+    method: 'post',
+    data,
+    name
+  })
+}
+
+//下载商用工程产品价格模板
+export function v2BusPriceListExcel(data, name) {
+  return getBlob({
+    url: 'bus/price/download',
+    data,
+    name
+  })
+}
+//商用工程产品价格-导入
+export function v2BusPriceListImport(data) {
+  return handleImport('/bus/price/import', data.formdata, data.id || '')
+}
+
 // 商用工程产品价格列表
 export function getBusPriceList(params) {
   return request({

+ 139 - 199
src/views/sales/price/commercial_list.vue

@@ -1,208 +1,76 @@
 <template>
-  <div class="app-container">
-    <!-- 筛选条件 -->
-    <div>
-      <Collapse :screen-form="searchForm">
-        <template #right_btn>
-          <el-button size="mini" @click="clearFn">清空</el-button>
-          <el-button size="mini" type="primary" @click="searchFormFn">搜索</el-button>
-        </template>
-        <template #search>
-          <el-form ref="searchForm" :model="searchForm" label-width="70px" size="mini" label-position="left">
-            <el-row :gutter="20">
-              <el-col :xs="24" :sm="12" :lg="6">
-                <el-form-item label="产品类别" prop="categoryId">
-                  <el-input v-model="searchForm.categoryId" placeholder="请输入"></el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :xs="24" :sm="12" :lg="6">
-                <el-form-item label="物料名称" prop="materialName">
-                  <el-input v-model="searchForm.materialName" placeholder="请输入"></el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :xs="24" :sm="12" :lg="6">
-                <el-form-item label="物料编码" prop="materialNumber">
-                  <el-input v-model="searchForm.materialNumber" placeholder="请输入"></el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :xs="24" :sm="12" :lg="6">
-                <el-form-item label="销售类型" prop="saleTypeId">
-                  <el-input v-model="searchForm.saleTypeId" placeholder="请输入"></el-input>
-                </el-form-item>
-              </el-col>
-              <el-col :xs="24" :sm="12" :lg="6">
-                <el-form-item label="规格" prop="specification">
-                  <el-input v-model="searchForm.specification" placeholder="请输入"></el-input>
-                </el-form-item>
-              </el-col>
-            </el-row>
-          </el-form>
-        </template>
-      </Collapse>
-    </div>
-    <!-- 按钮 -->
-    <div class="btn-group clearfix">
-      <div class="fr">
-        <el-button type="primary" size="mini" @click="downLoadFn">模板</el-button>
-        <ExportButton class="import-btn" :exUrl="'bus/price/export'" :exParams="exParams" />
-        <el-upload
-          class="import-btn"
-          action=""
-          :http-request="handleImport"
-          :file-list="importFileList"
-          :show-file-list="false"
-        >
-          <el-button type="primary" size="mini">批量导入</el-button>
-        </el-upload>
-      </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 align="left" label="厂产品编码" prop="productCode" min-width="160" show-overflow-tooltip>
-            <template slot-scope="scope">
-              <CopyButton :copyText="scope.row.productCode" />
-              <span>{{ scope.row.productCode }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column
-            align="left"
-            label="零售价格"
-            prop="retailPrice"
-            min-width="160"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            align="left"
-            label="批发价格"
-            prop="batchPrice"
-            min-width="160"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column align="left" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip>
-            <template slot-scope="scope">
-              <CopyButton :copyText="scope.row.specification" />
-              <span>{{ scope.row.specification }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column
-            align="left"
-            label="销售类型"
-            prop="saleTypeName"
-            min-width="160"
-            show-overflow-tooltip
-          ></el-table-column>
-
-          <el-table-column
-            align="left"
-            label="金蝶物料ID"
-            prop="materialId"
-            min-width="160"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            align="left"
-            label="金蝶物料编码"
-            prop="materialNumber"
-            min-width="160"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            align="left"
-            label="金蝶物料名称"
-            prop="materialName"
-            min-width="160"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            align="left"
-            label="金蝶物料旧编码"
-            prop="materialOldNumber"
-            min-width="160"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column align="left" label="是否促销价" min-width="160" show-overflow-tooltip>
-            <template slot-scope="scope">
-              <el-tag type="success" v-if="scope.row.isPromote">是</el-tag>
-              <el-tag type="danger" v-else>否</el-tag>
-            </template>
-          </el-table-column>
-          <el-table-column align="left" label="是否促作废" min-width="160" show-overflow-tooltip>
-            <template slot-scope="scope">
-              <el-tag type="success" v-if="scope.row.isRevoke">是</el-tag>
-              <el-tag type="danger" v-else>否</el-tag>
-            </template>
-          </el-table-column>
-
-          <el-table-column
-            align="left"
-            label="格力折扣价"
-            prop="discAmount"
-            min-width="160"
-            show-overflow-tooltip
-          ></el-table-column>
-          <el-table-column
-            align="left"
-            label="备注"
-            prop="remark"
-            min-width="160"
-            show-overflow-tooltip
-          ></el-table-column>
-
-          <el-table-column
-            align="center"
-            label="操作"
-            prop="caozuo"
-            min-width="160"
-            show-overflow-tooltip
-            fixed="right"
-          >
-            <template slot-scope="scope">
-              <el-button type="text" class="textColor" @click="seeFn(scope.row)">查看</el-button>
-              <el-popconfirm
-                @onConfirm="deleFn(scope.row.id)"
-                v-if="$checkBtnRole('del', $route.meta.roles)"
-                title="这是一段内容确定删除吗?"
-              >
-                <el-button type="text" class="textColor" slot="reference">删除</el-button>
-              </el-popconfirm>
-              <el-button type="text" class="textColor" @click="stopFn(scope.row.id)">修改</el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
-      <!-- 分页 -->
-      <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>
+  <template-page
+    ref="pageRef"
+    :getList="getList"
+    :operation="operation()"
+    :optionsEvensGroup="optionsEvensGroup"
+    :exportList="exportList"
+    :columnParsing="columnParsing"
+    :tableAttributes="tableAttributes"
+    :tableEvents="tableEvents"
+  >
+  </template-page>
 </template>
 
 <script>
-import { getBusPriceList } from '@/api/supply/commercial_list'
-import { downloadFiles, handleImport } from '@/utils/util'
+import import_mixin from '@/components/template/import_mixin.js'
+import TemplatePage from '@/components/template/template-page-1.vue'
+import {
+  getBusPriceList,
+  v2BusPriceList,
+  v2BusPriceListExport,
+  v2BusPriceListExcel,
+  v2BusPriceListImport
+} from '@/api/supply/commercial_list'
+// import { downloadFiles, handleImport } from '@/utils/util'
 export default {
+  mixins: [import_mixin],
+  components: {
+    TemplatePage
+  },
   data() {
     return {
+      // 事件组合
+      optionsEvensGroup: [
+        [
+          [
+            {
+              name: '',
+              render: this.importButton(v2BusPriceListImport)
+            }
+          ]
+        ],
+        [
+          [
+            {
+              name: '导入模版',
+              click: () => {
+                v2BusPriceListExcel({}, `${this.$route.meta.title}`)
+                  .then(res => {
+                    this.$message({
+                      message: '下载成功',
+                      type: 'success'
+                    })
+                  })
+                  .catch(err => {
+                    this.$message.error('下载失败')
+                  })
+              }
+            }
+          ]
+        ]
+      ],
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: false
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      recordSelected: [],
+
       listLoading: false, // 列表加载loading
       currentPage: 1, // 当前页码
       pageSize: 10, // 每页数量
@@ -225,9 +93,81 @@ export default {
     }
   },
   created() {
-    this.getDataList()
+    // this.getDataList()
   },
   methods: {
+    // 列表请求函数
+    getList: v2BusPriceList,
+    // 列表导出函数
+    exportList: v2BusPriceListExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+    operation() {
+      return (h, { row, index, column }) => {
+        return (
+          <div class="operation-btns">
+            <el-button
+              size="mini"
+              type="text"
+              onClick={async () => {
+                this.seeFn(row)
+              }}
+            >
+              查看
+            </el-button>
+
+            {this.$checkBtnRole('del', this.$route.meta.roles) ? (
+              <el-popconfirm
+                onOnConfirm={async () => {
+                  this.deleFn(row.id)
+                }}
+                title="是否确定需要删除该项内容?"
+              >
+                <el-button slot="reference" size="mini" type="text">
+                  删除
+                </el-button>
+              </el-popconfirm>
+            ) : (
+              ''
+            )}
+
+            {row.flag === 1 ? (
+              <el-button
+                size="mini"
+                type="text"
+                onClick={async () => {
+                  this.stopFn(row.id)
+                }}
+              >
+                停用
+              </el-button>
+            ) : (
+              ''
+            )}
+            {row.flag === 2 ? (
+              <el-button
+                size="mini"
+                type="text"
+                onClick={async () => {
+                  this.rebuild(row)
+                }}
+              >
+                重建
+              </el-button>
+            ) : (
+              ''
+            )}
+          </div>
+        )
+      }
+    },
+
     // 更改每页数量
     handleSizeChange(val) {
       this.pageSize = val