chenrui %!s(int64=4) %!d(string=hai) anos
pai
achega
b5376a4ecd

+ 41 - 0
src/api/dealerProductBrand.js

@@ -0,0 +1,41 @@
+import { axios } from '@/utils/request'
+
+//  产品品牌列表  分页
+export const dealerProductBrandList = (params) => {
+  const url = `/dealerProductBrand/findPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+//  产品品牌列表  无分页
+export const dealerProductBrandQuery = (params) => {
+  const url = `/dealerProductBrand/query`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 新增/编辑产品品牌
+export const dealerProductBrandSave = params => {
+  return axios({
+    url: '/dealerProductBrand/save',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 产品品牌 更改状态
+export const dealerProductBrandUpdate = params => {
+  return axios({
+    url: '/dealerProductBrand/updateStatus',
+    data: params,
+    method: 'post'
+  })
+}

+ 28 - 16
src/views/productManagement/productBrand/editModal.vue

@@ -18,11 +18,11 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol"
       >
-        <a-form-model-item label="产品品牌名称" prop="name">
+        <a-form-model-item label="产品品牌名称" prop="productBrandName">
           <a-input
-            id="productBrandEdit-name"
+            id="productBrandEdit-productBrandName"
             :maxLength="30"
-            v-model="form.name"
+            v-model="form.productBrandName"
             placeholder="请输入产品品牌名称(最多30个字符)"
             allowClear />
         </a-form-model-item>
@@ -37,6 +37,7 @@
 
 <script>
 import { STable } from '@/components'
+import { dealerProductBrandSave } from '@/api/dealerProductBrand'
 export default {
   name: 'productBrandEditModal',
   components: { STable },
@@ -48,6 +49,10 @@ export default {
     itemId: {
       type: [Number, String],
       default: ''
+    },
+    nowData: {
+      type: Object,
+      default: null
     }
   },
   computed: {
@@ -58,29 +63,39 @@ export default {
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
-      detailsData: null, //  品牌数据
       formItemLayout: {
         labelCol: { span: 6 },
         wrapperCol: { span: 16 }
       },
       form: {
-        name: '', // 产品品牌名称
+        productBrandName: '', // 产品品牌名称
       },
       rules: {
-        name: [
+        productBrandName: [
           { required: true, message: '请输入产品品牌名称', trigger: 'blur' }
         ],
       }
     }
   },
   methods: {
-    //  获取详情
-    getDetail(){
-      
-    },
     //  保存
     handleSave(){
-      
+      const _this = this
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const formData = JSON.parse(JSON.stringify(_this.form))
+          formData.id = _this.itemId ? _this.itemId : null
+          dealerProductBrandSave(formData).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('ok')
+              _this.isShow = false
+            }
+          })
+        } else {
+          return false
+        }
+      })
     },
   },
   watch: {
@@ -92,11 +107,8 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-      }
-    },
-    itemId (newValue, oldValue) {
-      if (this.isShow && newValue) {
-        this.getDetail()
+      }else{
+        this.form.productBrandName = this.nowData && this.nowData.productBrandName ? this.nowData.productBrandName : ''
       }
     }
   }

+ 39 - 54
src/views/productManagement/productBrand/list.vue

@@ -6,12 +6,12 @@
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
             <a-form-item label="品牌名称">
-              <a-input id="productBrandList-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入品牌名称"/>
+              <a-input id="productBrandList-productBrandName" v-model.trim="queryParam.productBrandName" allowClear placeholder="请输入品牌名称"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="状态">
-              <v-select code="CHECK_ENABLE_STATE" id="productBrandList-state" v-model="queryParam.state" allowClear placeholder="请选择状态"></v-select>
+              <v-select code="ENABLED_FLAG" id="productBrandList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
@@ -36,14 +36,14 @@
       :data="loadData"
       bordered>
       <!-- 状态 -->
-      <template slot="status" slot-scope="text, record">
+      <template slot="enabledFlag" slot-scope="text, record">
         <a-switch
           id="productBrandList-enable"
           checkedChildren="启用"
           unCheckedChildren="禁用"
           @change="changeStatus(record)"
-          v-model="record.status" />
-        <!-- <span :class="record.status==1?'green':'red'" v-else> {{ record.status==1? '已启用': '已禁用' }} </span> -->
+          :checked="record.enabledFlag == 1 ? true : false" />
+        <!-- <span :class="record.enabledFlag==1?'green':'red'" v-else> {{ record.enabledFlag==1? '已启用': '已禁用' }} </span> -->
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
@@ -51,13 +51,13 @@
       </template>
     </s-table>
     <!-- 新增/编辑产品品牌 -->
-    <product-brand-edit-modal :openModal="openModal" :itemId="itemId" @close="closeModal" />
+    <product-brand-edit-modal :openModal="openModal" :nowData="nowData" :itemId="itemId" @ok="handleOk" @close="closeModal" />
   </a-card>
 </template>
 
 <script>
 import moment from 'moment'
-// import { customerBundleDelayList, customerBundleExportDelay } from '@/api/FinancialManagement'
+import { dealerProductBrandList, dealerProductBrandUpdate } from '@/api/dealerProductBrand'
 import { STable, VSelect } from '@/components'
 import productBrandEditModal from './editModal.vue'
 export default {
@@ -65,85 +65,74 @@ export default {
   data () {
     return {
       queryParam: { //  查询条件
-        bundleName: '', //  品牌名称
-        state: undefined,  //  状态
+        productBrandName: '', //  品牌名称
+        enabledFlag: undefined,  //  状态
       },
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
         { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
-        { title: '产品品牌名称', dataIndex: 'productName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
-        { title: '首字母', dataIndex: 'productOldNum', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '创建时间', dataIndex: 'inventoryMoney', width: 180, align: 'center' },
-        { title: '状态', scopedSlots: { customRender: 'status' }, width: 180, align: 'center' },
+        { title: '产品品牌名称', dataIndex: 'productBrandName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '首字母', dataIndex: 'firstChar', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '创建时间', dataIndex: 'createDate', width: 180, align: 'center' },
+        { title: '状态', scopedSlots: { customRender: 'enabledFlag' }, width: 180, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
-        //   const data = res.data
-        //   const no = (data.pageNo - 1) * data.pageSize
-        //   for (var i = 0; i < data.list.length; i++) {
-        //     data.list[i].no = no + i + 1
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function(resolve, reject){
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [
-              { id: '1', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
-            ]
-          }
+        return dealerProductBrandList( Object.assign(parameter, this.queryParam) ).then(res => {
+          const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
           }
-          _this.disabled = false
-          resolve(data)
+          this.disabled = false
+          return data
         })
       },
-      openModal: false,  //  新增编辑产品品牌  弹框
-      itemId: ''  //  当前品牌id
+      openModal: false,  //  新增编辑  弹框
+      itemId: '',  //  当前id
+      nowData: null  //  当前记录数据
     }
   },
   methods: {
     //  重置
     resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
+      this.queryParam.productBrandName = ''
+      this.queryParam.enabledFlag = undefined
       this.$refs.table.refresh(true)
     },
     //  新增/编辑
     handleEdit(row){
       this.itemId = row ? row.id : null
+      this.nowData = row ? row : null
       this.openModal = true
     },
+    //  新增/编辑  成功
+    handleOk(){
+      this.$refs.table.refresh(true)
+    },
     //  关闭弹框
     closeModal(){
       this.itemId = ''
+      this.nowData = null
       this.openModal = false
     },
     // 启用 禁用
     changeStatus (record) {
+      const _this = this
       const _data = {
         id: record.id,
-        flag: record.loginFlag ? '1' : '0'
+        enabledFlag: record.enabledFlag == 1 ? '0' : '1'
       }
-      // updateEnableStatus(_data).then(res => {
-      //   if (res.status === 200) {
-      //     this.$message.success(res.message)
-      //   } else {
-      //     record.loginFlag = !record.loginFlag
-      //   }
-      // })
+      dealerProductBrandUpdate(_data).then(res => {
+      	if (res.status == 200) {
+      		_this.$message.success(res.message)
+      		_this.$refs.table.refresh()
+      	} else {
+      		record.enabledFlag = !record.enabledFlag
+      	}
+      })
     },
     //  导入
     handleImport(){},
@@ -151,8 +140,4 @@ export default {
 }
 </script>
 
-<style lang="less">
-  .productBrandList-wrap{
-    
-  }
-</style>
+<style lang="less"></style>

+ 5 - 1
src/views/productManagement/productCategory/list.vue

@@ -72,7 +72,11 @@ export default {
         return dealerProductTypeQuery({}).then(res => {
           //  递归去除空children
           this.recursionFun(res.data)
-          this.defaultExpandedRowKeys[0] = res.data[0].id
+          if(res.data.length > 0){
+            this.defaultExpandedRowKeys[0] = res.data[0].id
+          }else{
+            this.defaultExpandedRowKeys = []
+          }
           return res.data
         })
       },