Browse Source

功能优化

lilei 3 years ago
parent
commit
14e0ba4c54

+ 2 - 1
src/store/modules/app.js

@@ -32,7 +32,8 @@ const app = {
     isNewSubTab: false,
     updateList: false,
     loadingStatus: false,
-    winHeight: 0 //  窗口高度
+    winHeight: 0 ,//  窗口高度
+    isHomeNav: false // 是否从首页流程导航打开的页面
   },
   mutations: {
     SET_SIDEBAR_TYPE: (state, type) => {

+ 1 - 0
src/views/Home.vue

@@ -700,6 +700,7 @@ export default {
             this.$router.push({ path: data.url, query: { pageParams: null } })
           }
         }
+        this.$store.state.app.isHomeNav = true
       }
     },
     // 数据看板信息

+ 41 - 1
src/views/bulkManagement/bulkWarehousingOrder/edit.vue

@@ -212,6 +212,18 @@
     </div>
     <!-- 选择基本信息弹框 -->
     <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+    <!-- 新增产品 -->
+    <a-modal
+      centered
+      class="newProduct-modal"
+      :footer="null"
+      :maskClosable="false"
+      title="新增产品"
+      v-model="showNewProduct"
+      @cancle="showNewProduct=false"
+      :width="800">
+      <newProduct ref="newProduct" pageType="modal" @saveOk="saveProductOk"></newProduct>
+    </a-modal>
   </div>
 </template>
 
@@ -226,16 +238,18 @@ import { warehouseCascadeList } from '@/api/warehouse'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 import Print from '@/views/common/print.vue'
+import newProduct from '@/views/productManagement/productInfo/edit.vue'
 import { hdPrint } from '@/libs/JGPrint'
 export default {
   name: 'BulkWarehousingEdit',
-  components: { STable, VSelect, basicInfoModal, Print, ProductType, ProductBrand },
+  components: { STable, VSelect, basicInfoModal, Print, ProductType, ProductBrand, newProduct },
   mixins: [commonMixin],
   data () {
     return {
       spinning: false,
       loading: false,
       chooseLoading: false,
+      showNewProduct: false,
       queryParam: {
         queryWord: '',
         productBrandSn: undefined,
@@ -281,6 +295,8 @@ export default {
           }
           this.loadDataSource = data.list
           this.disabled = false
+          // 如果没有搜索到产品,直接添加产品
+          this.isAddNewProduct(data.list)
           return data
         })
       },
@@ -347,6 +363,30 @@ export default {
     }
   },
   methods: {
+    // 是否新增产品
+    isAddNewProduct (data) {
+      const _this = this
+      if (data.length == 0) {
+        _this.$confirm({
+          title: '提示',
+          content: '该产品信息不存在,是否马上新增?',
+          centered: true,
+          onOk () {
+            _this.showNewProduct = true
+            _this.$nextTick(() => {
+              _this.$refs.newProduct.pageInit()
+            })
+          }
+        })
+      }
+    },
+    // 添加产品成功
+    saveProductOk (data) {
+      console.log(data)
+      this.showNewProduct = false
+      this.queryParam.queryWord = data.name
+      this.$refs.table.refresh(true)
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.queryWord = ''

+ 30 - 13
src/views/productManagement/productInfo/edit.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="productInfoEdit-wrap">
     <a-spin :spinning="spinning" tip="Loading...">
-      <a-page-header :ghost="false" :backIcon="false" class="productInfoEdit-back">
+      <a-page-header :ghost="false" :backIcon="false" class="productInfoEdit-back" v-if="pageType=='pages'">
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
           <a id="productInfoEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
@@ -21,7 +21,6 @@
               id="productInfoEdit-name"
               :maxLength="100"
               v-model.trim="form.name"
-              @change="filterEmpty"
               placeholder="请输入产品名称(最多100个字符)"
               ref="name"
               @keydown.enter.native="nextFocus('name', 'code', $event)"
@@ -31,7 +30,7 @@
             <a-input
               id="productInfoEdit-code"
               :maxLength="100"
-              :disabled="!!$route.params.id"
+              :disabled="isEdit"
               v-model.trim="form.code"
               placeholder="请输入产品编码(最多100个字符)"
               ref="code"
@@ -42,7 +41,7 @@
             <a-input
               id="productInfoEdit-origCode"
               :maxLength="200"
-              :disabled="!!$route.params.id"
+              :disabled="isEdit"
               v-model.trim="form.origCode"
               placeholder="请输入原厂编码(最多200个字符,多个编码用逗号隔开)"
               ref="origCode"
@@ -75,7 +74,7 @@
               id="productInfoEdit-productBrand"
               v-model="form.productBrandSn"
               placeholder="请输入名称或拼音查询,如果没有请点击 '+' 新增"
-              :disabled="!!$route.params.id"
+              :disabled="isEdit"
               :filter-option="false"
               :not-found-content="fetching ? undefined : null"
               @search="fetchUser"
@@ -89,7 +88,7 @@
             <a-button
               v-if="$hasPermissions('B_product_dealerProductBrand_add')"
               @click="openModal=true"
-              :disabled="!!$route.params.id"
+              :disabled="isEdit"
               icon="plus"
               size="small"
               id="productInfoEdit-add-btn"
@@ -97,7 +96,7 @@
           </a-form-model-item>
           <a-form-model-item label="产品分类" prop="productType">
             <a-cascader
-              :disabled="!!$route.params.id"
+              :disabled="isEdit"
               @change="changeProductType"
               expand-trigger="hover"
               :options="productTypeList"
@@ -170,6 +169,17 @@ export default {
   name: 'ProductInfoEdit',
   components: { STable, VSelect, productBrandEditModal },
   mixins: [commonMixin],
+  props: {
+    pageType: { // 页面表现形式,pages 新页签打开的页面,modal 弹框里的页面
+      type: String,
+      default: 'pages'
+    }
+  },
+  computed: {
+    isEdit () {
+      return this.pageType == 'pages' ? !!this.$route.params.id : false
+    }
+  },
   data () {
     return {
       spinning: false,
@@ -256,21 +266,28 @@ export default {
     handleSubmit (e) {
       e.preventDefault()
       const _this = this
-      if (!this.form.productTypeSn3) {
-        this.$message.warning('产品分类未选到第三级,请修改后再提交!')
-        return
-      }
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
-          form.id = _this.$route.params.id ? _this.$route.params.id : undefined
+          if (!form.productTypeSn3) {
+            this.$message.warning('产品分类未选到第三级,请修改后再提交!')
+            return false
+          }
+          // 编辑
+          if (this.isEdit) {
+            form.id = _this.$route.params.id ? _this.$route.params.id : undefined
+          }
           delete form.productType
           _this.spinning = true
           dealerProductSave(form).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               setTimeout(() => {
-                _this.$router.push({ path: '/productManagement/productInfo/list' })
+                if (_this.pageType == 'pages') {
+                  _this.$router.push({ path: '/productManagement/productInfo/list' })
+                } else {
+                  _this.$emit('saveOk', form)
+                }
                 _this.spinning = false
               }, 1000)
             } else {

+ 3 - 0
src/views/salesManagement/salesQuery/chooseCustomModal.vue

@@ -355,6 +355,9 @@ export default {
       this.form = Object.assign(this.form, data)
       this.buyerSnBak = this.form.buyerSn
       this.priceTypeBak = this.form.priceType
+      this.$nextTick(() => {
+        this.$refs.custList.setData({ key: data.buyerSn, label: data.buyerName, row: data })
+      })
     },
     //  获取详情
     getDetail () {

+ 15 - 9
src/views/salesManagement/salesQuery/edit.vue

@@ -7,6 +7,7 @@
           <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
           <a style="margin: 0 15px;color: #666;font-size: 18px;font-weight: 600;">单号:{{ detailData&&detailData.salesBillNo || '--' }}</a>
           <span style="margin: 0 10px;color: #666;">客户名称:{{ detailData&&detailData.buyerName || '--' }}</span>
+          <a-button id="salesEdit-edit-btn" size="small" @click="handleEdit" style="margin-left:10px" key="0">编辑</a-button>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_salesPrint')">
@@ -248,6 +249,20 @@ export default {
         _this.spinning = false
       })
     },
+    // 编辑客户信息
+    handleEdit () {
+      this.openModal = true
+      this.$refs.custModal.editCust(this.detailData)
+    },
+    // 更新产品列表
+    updateData (priceType) {
+      // 价格类型变更
+      if (priceType != this.$route.params.priceType) {
+        this.$router.push({ name: 'salesEdit', params: { id: this.orderId, sn: this.salesBillSn, priceType: priceType } })
+      } else {
+        this.getOrderDetail(true)
+      }
+    },
     // 已选产品 销售数量  blur
     qtyBlur (val, record) {
       const _this = this
@@ -321,15 +336,6 @@ export default {
     isCost (val) {
       this.isCosts = val
     },
-    // 更新产品列表
-    updateData (priceType) {
-      // 价格类型变更
-      if (priceType != this.$route.params.priceType) {
-        this.$router.push({ name: 'salesEdit', params: { id: this.orderId, sn: this.salesBillSn, priceType: priceType } })
-      } else {
-        this.getOrderDetail(true)
-      }
-    },
     //  重置
     resetSearchForm (flag) {
       if (flag) { this.$refs.partQuery.onlyList = true }

+ 7 - 1
src/views/salesManagement/salesQuery/list.vue

@@ -464,7 +464,13 @@ export default {
     }
   },
   beforeRouteEnter (to, from, next) {
-    next(vm => {})
+    next(vm => {
+      // 从首页点击销售开单过来的,直接打开选择客户弹框
+      if (from.name == 'home' && vm.$store.state.app.isHomeNav && vm.$route.query.pageParams == null) {
+        vm.openModal = true
+        vm.$store.state.app.isHomeNav = false
+      }
+    })
   }
 }
 </script>