Browse Source

通用配件

chenrui 2 years ago
parent
commit
55ffa4357f
2 changed files with 111 additions and 134 deletions
  1. 57 0
      src/api/productUniversalCode.js
  2. 54 134
      src/views/productManagement/productUniversal/list.vue

+ 57 - 0
src/api/productUniversalCode.js

@@ -0,0 +1,57 @@
+import { axios } from '@/utils/request'
+
+//  通用产品 列表  有分页
+export const productUniversalCodeList = (params) => {
+  const url = `/productUniversalCode/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  通用产品 删除
+export const productUniversalCodeDel = (params) => {
+  const url = `/productUniversalCode/delete/${params.id}`
+  return axios({
+    url: url,
+    method: 'get'
+  })
+}
+//  通用产品 保存
+export const productUniversalCodeSave = (params) => {
+  return axios({
+    url: '/productUniversalCode/save',
+    data: params,
+    method: 'post'
+  })
+}
+//  通用产品 详情
+export const productUniversalCodeDetail = (params) => {
+  const url = `/productUniversalCode/findById/${params.id}`
+  return axios({
+    url: url,
+    method: 'get'
+  })
+}
+//  产品编码模糊搜索  有分页  产品编码
+export const productCodeQueryList = (params) => {
+  const url = `/productUniversalCode/productListPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 导出
+export const productUniversalExport = (params) => {
+  return axios({
+    url: '/productUniversalCode/exportExcel',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 54 - 134
src/views/productManagement/productUniversal/list.vue

@@ -6,39 +6,38 @@
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
             <a-form-item label="产品编码">
-              <a-input id="productChangeRecordList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
+              <a-input id="productUniversalList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="产品名称">
-              <a-input id="productChangeRecordList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
+              <a-input id="productUniversalList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="产品状态">
-              <v-select code="ENABLE_FLAG" id="productInfoList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="通用产品名称">
-              <a-input id="productChangeRecordList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="通用产品编码">
-              <a-input id="productChangeRecordList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
+              <v-select code="ONLINE_FLAG" id="productUniversalList-onlineFalg" v-model="queryParam.onlineFalg" allowClear placeholder="请选择产品状态"></v-select>
             </a-form-item>
           </a-col>
+          <template v-if="advanced">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="通用产品编码">
+                <a-input id="productUniversalList-productCommonCode" v-model.trim="queryParam.productCommonCode" allowClear placeholder="请输入通用产品编码"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="通用产品名称">
+                <a-input id="productUniversalList-productCommonName" v-model.trim="queryParam.productCommonName" allowClear placeholder="请输入通用产品名称"/>
+              </a-form-item>
+            </a-col>
+          </template>
           <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productChangeRecordList-refresh">查询</a-button>
-            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="productChangeRecordList-reset">重置</a-button>
-            <!-- <a-button
-              style="margin: 0 0 18px 8px"
-              type="primary"
-              class="button-warning"
-              @click="handleExport"
-              :loading="exportLoading"
-              id="productChangeRecordList-export">导出</a-button> -->
+            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productUniversalList-refresh">查询</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="productUniversalList-reset">重置</a-button>
+            <a @click="advanced=!advanced" style="margin-left: 5px">
+              {{ advanced ? '收起' : '展开' }}
+              <a-icon :type="advanced ? 'up' : 'down'"/>
+            </a>
           </a-col>
         </a-row>
       </a-form>
@@ -47,7 +46,7 @@
     <s-table
       class="sTable fixPagination"
       ref="table"
-      :style="{ height: tableHeight+122.5+'px' }"
+      :style="{ height: tableHeight+84.5+'px' }"
       size="small"
       :rowKey="(record) => record.id"
       :columns="columns"
@@ -57,32 +56,7 @@
       bordered>
       <!-- 产品分类 -->
       <template slot="productType" slot-scope="text, record">
-        <span v-if="record.productEntity.productTypeName2 || record.productEntity.productTypeName3">{{ record.productEntity.productTypeName2 }} {{ record.productEntity.productTypeName3 ? '>' : '' }} {{ record.productEntity.productTypeName3 }}</span>
-        <span v-else>--</span>
-      </template>
-      <!-- 省级价变更后 -->
-      <template slot="afterProvincePrice" slot-scope="text, record">
-        <span v-if="record.afterProvincePrice || record.afterProvincePrice==0" :class="record.beforeProvincePrice != record.afterProvincePrice ? 'red' : ''">{{ toThousands(record.afterProvincePrice) }}</span>
-        <span v-else>--</span>
-      </template>
-      <!-- 市级价变更后 -->
-      <template slot="afterCityPrice" slot-scope="text, record">
-        <span v-if="record.afterCityPrice || record.afterCityPrice==0" :class="record.beforeCityPrice != record.afterCityPrice ? 'red' : ''">{{ toThousands(record.afterCityPrice) }}</span>
-        <span v-else>--</span>
-      </template>
-      <!-- 特约价变更后 -->
-      <template slot="afterSpecialPrice" slot-scope="text, record">
-        <span v-if="record.afterSpecialPrice || record.afterSpecialPrice==0" :class="record.beforeSpecialPrice != record.afterSpecialPrice ? 'red' : ''">{{ toThousands(record.afterSpecialPrice) }}</span>
-        <span v-else>--</span>
-      </template>
-      <!-- 终端价变更后 -->
-      <template slot="afterTerminalPrice" slot-scope="text, record">
-        <span v-if="record.afterTerminalPrice || record.afterTerminalPrice==0" :class="record.beforeTerminalPrice != record.afterTerminalPrice ? 'red' : ''">{{ toThousands(record.afterTerminalPrice) }}</span>
-        <span v-else>--</span>
-      </template>
-      <!-- 车主价变更后 -->
-      <template slot="afterCarOwnersPrice" slot-scope="text, record">
-        <span v-if="record.afterCarOwnersPrice || record.afterCarOwnersPrice==0" :class="record.beforeCarOwnersPrice != record.afterCarOwnersPrice ? 'red' : ''">{{ toThousands(record.afterCarOwnersPrice) }}</span>
+        <span v-if="record.productCommon.productTypeName2 || record.productCommon.productTypeName3">{{ record.productCommon.productTypeName2 }} {{ record.productCommon.productTypeName3 ? '>' : '' }} {{ record.productCommon.productTypeName3 }}</span>
         <span v-else>--</span>
       </template>
     </s-table>
@@ -91,43 +65,43 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import moment from 'moment'
-import getDate from '@/libs/getDate.js'
 import { STable, VSelect } from '@/components'
-import { productBrandQuery } from '@/api/productBrand'
-import { productTypeQuery } from '@/api/productType'
-import { productPriceChangeList, getCurrentDealer } from '@/api/product'
-// import { downloadExcel } from '@/libs/JGPrint.js'
+import { productUniversalCodeList } from '@/api/productUniversalCode'
 export default {
-  name: 'ProductPriceChangeList',
-  components: { STable, VSelect },
+  name: 'ProductUniversalList',
   mixins: [commonMixin],
+  components: { STable, VSelect },
   data () {
     return {
+      spinning: false,
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0,
       queryParam: { //  查询条件
-        beginDate: getDate.getThreeMonthDays().starttime,
-        endDate: getDate.getCurrMonthDays().endtime,
-        productName: '', //  产品名称
-        productCode: '', //  产品编码
-        productBrandSn: undefined, //  品牌
-        productTypeSn1: '', //  产品一级分类
-        productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '' //  产品三级分类
+        productCode: '',
+        productName: '',
+        onlineFalg: undefined,
+        productCommonName: '',
+        productCommonCode: ''
       },
       productType: [],
       disabled: false, //  查询、重置按钮是否可操作
-      time: [
-        moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
-        moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
-      ], //  变更时间
       exportLoading: false, // 导出loading
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', align: 'center', width: '20%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品状态', dataIndex: 'product.onlineFalgDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '通用产品编码', dataIndex: 'productCommonCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '通用产品名称', dataIndex: 'productCommon.name', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '通用产品分类', scopedSlots: { customRender: 'productType' }, width: '12%', align: 'center' },
+        { title: '通用产品状态', dataIndex: 'productCommon.onlineFalgDictValue', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return productPriceChangeList(Object.assign(parameter, this.queryParam)).then(res => {
+        return productUniversalCodeList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -135,90 +109,31 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
             }
-            this.total = data.count || 0
             this.disabled = false
           }
           this.spinning = false
           return data
         })
       },
-      columns: [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '创建时间', dataIndex: 'updateDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'productEntity.code', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productEntity.name', width: '11%', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
-        { title: '产品状态', dataIndex: 'productEntity.productBrandName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '通用产品编码', dataIndex: 'productEntity.productBrandName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '通用产品名称', scopedSlots: { customRender: 'productType' }, width: '8%', align: 'center' },
-        { title: '通用产品分类', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '通用产品状态', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } }
-      ],
-      total: 0,
-      productBrandList: [], //  品牌下拉数据
-      productTypeList: [] //  分类下拉数据
+      openModal: false, //  编辑  弹框
+      itemId: '' //  当前id
     }
   },
   methods: {
     //  重置
     resetSearchForm () {
-      this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
-      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
       this.queryParam.productCode = ''
       this.queryParam.productName = ''
-      this.queryParam.productBrandSn = undefined
-      this.queryParam.productTypeSn1 = ''
-      this.queryParam.productTypeSn2 = ''
-      this.queryParam.productTypeSn3 = ''
-      this.productType = []
+      this.queryParam.onlineFalg = undefined
+      this.queryParam.productCommonName = ''
+      this.queryParam.productCommonCode = ''
       this.$refs.table.refresh(true)
     },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
-    },
-    //  产品分类  change
-    changeProductType (val, opt) {
-      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
-      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
-      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
-    },
-    //  导出
-    handleExport () {
-      const params = this.queryParam
-      this.exportLoading = true
-      // customerBundleExportDelay(params).then(res => {
-      //   this.exportLoading = false
-      // downloadExcel(res, '价格变更记录')
-      // })
-    },
-    //  产品品牌  列表
-    getProductBrand () {
-      productBrandQuery({}).then(res => {
-        if (res.status == 200) {
-          this.productBrandList = res.data
-        } else {
-          this.productBrandList = []
-        }
-      })
-    },
-    //  产品分类  列表
-    getProductType () {
-      productTypeQuery({}).then(res => {
-        if (res.status == 200) {
-          this.productTypeList = res.data
-        } else {
-          this.productTypeList = []
-        }
-      })
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
-      this.getProductBrand()
-      this.getProductType()
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
@@ -248,6 +163,11 @@ export default {
       this.pageInit()
       this.resetSearchForm()
     }
+    // 仅刷新列表,不重置页面
+    if (this.$store.state.app.updateList) {
+      this.pageInit()
+      this.$refs.table.refresh()
+    }
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {})