소스 검색

修改调拨类型

lilei 3 년 전
부모
커밋
6c8e76ec70

+ 2 - 2
src/config/router.config.js

@@ -839,7 +839,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add/:sn/:name/:dealerLevel',
+                path: 'add/:sn/:dealerLevel',
                 name: 'transferOutAdd',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/allocationManagement/transferOut/edit.vue'),
                 meta: {
@@ -850,7 +850,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'edit/:sn/:name/:dealerLevel',
+                path: 'edit/:sn/:dealerLevel',
                 name: 'transferOutEdit',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/allocationManagement/transferOut/edit.vue'),
                 meta: {

+ 1 - 1
src/views/allocationManagement/transferOut/detail.vue

@@ -141,7 +141,7 @@ export default {
     },
     //  编辑
     handleEdit () {
-      this.$router.push({ path: `/allocationManagement/transferOut/edit/${this.basicInfoData.allocateSn}/${this.basicInfoData.targetName}/${this.basicInfoData.dealerLevel}` })
+      this.$router.push({ path: `/allocationManagement/transferOut/edit/${this.basicInfoData.allocateSn}/${this.basicInfoData.targetType}` })
     },
     // 打印预览/快捷打印
     handlePrint (type) {

+ 61 - 7
src/views/allocationManagement/transferOut/edit.vue

@@ -5,7 +5,6 @@
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
           <a id="allocateBillEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin: 0 15px;color: #666;">调往对象:{{ $route.params.name || '--' }}</span>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template v-if="$hasPermissions('B_transferOut_print')" slot="extra">
@@ -13,6 +12,21 @@
           <a-button key="1" type="primary" id="allocateBillEdit-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
         </template>
       </a-page-header>
+      <a-card size="small" :bordered="false" class="allocateBillEdit-cont">
+        <a-collapse :activeKey="['1']">
+          <a-collapse-panel key="1" header="基础信息">
+            <a-descriptions :column="3">
+              <a-descriptions-item label="调往对象">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调拨单号">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调拨类型">
+                <AllocateType id="allocateEdit-allocateTypeSn" style="width: 200px;" @change="changeAllocateType" v-model="basicInfoData.allocateTypeSn"></AllocateType>
+              </a-descriptions-item>
+              <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remark) || '--' }}</a-descriptions-item>
+            </a-descriptions>
+          </a-collapse-panel>
+        </a-collapse>
+      </a-card>
       <!-- 选择产品 -->
       <a-card size="small" :bordered="false" class="allocateBillEdit-cont">
         <a-collapse :activeKey="['1']">
@@ -180,9 +194,11 @@ import { STable, VSelect } from '@/components'
 import ImportGuideModal from './importGuideModal.vue'
 import { queryStockProductPage } from '@/api/stock'
 import { productPriceInfo } from '@/api/product'
-import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert } from '@/api/allocateBill'
+import AllocateType from '@/views/common/allocateType.js'
+import { allocateBillSave, allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert } from '@/api/allocateBill'
+
 export default {
-  components: { STable, VSelect, ImportGuideModal },
+  components: { STable, VSelect, ImportGuideModal, AllocateType },
   data () {
     return {
       spinning: false,
@@ -224,8 +240,6 @@ export default {
         this.chooseDisabled = true
         const params = Object.assign(parameter, this.chooseQueryParam, { allocateSn: this.$route.params.sn })
         return allocateBillDetailList(params).then(res => {
-          //  合计
-          this.getDetailCount(params)
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
@@ -239,6 +253,7 @@ export default {
         })
       },
       productTotal: null, //  合计
+      basicInfoData: null, // 基本信息
       openGuideModal: false //  导入产品引导
     }
   },
@@ -278,6 +293,33 @@ export default {
     }
   },
   methods: {
+    // 修改调拨类型
+    changeAllocateType (val) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确定要更改调拨类型吗?',
+        centered: true,
+        onOk () {
+          const params = _this.basicInfoData
+          allocateBillSave({
+            id: params.id,
+            allocateSn: params.allocateSn,
+            targetType: params.targetType,
+            targetSn: params.targetSn,
+            targetName: params.targetName,
+            allocateTypeSn: params.allocateTypeSn,
+            remark: params.remark
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.productCode = ''
@@ -397,9 +439,19 @@ export default {
         }
       })
     },
+    // 基本信息
+    getDetail () {
+      allocateBillDetail({ sn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.basicInfoData = res.data
+        } else {
+          this.basicInfoData = null
+        }
+      })
+    },
     // 合计
-    getDetailCount (params) {
-      allocateBillDetailCount(params).then(res => {
+    getDetailCount () {
+      allocateBillDetailCount({ allocateSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.productTotal = res.data
         } else {
@@ -472,6 +524,8 @@ export default {
       }
     },
     pageInit () {
+      this.getDetail()
+      this.getDetailCount()
       this.resetSearchForm()
       this.chooseResetSearchForm()
     }

+ 5 - 19
src/views/allocationManagement/transferOut/list.vue

@@ -17,9 +17,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="调拨类型">
-                <a-select id="allocateBillList-allocateTypeSn" v-model="queryParam.allocateTypeSn" placeholder="请选择调拨类型" allowClear >
-                  <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
-                </a-select>
+                <AllocateType id="allocateBillList-allocateTypeSn" v-model="queryParam.allocateTypeSn"></AllocateType>
               </a-form-item>
             </a-col>
             <template v-if="advanced">
@@ -121,9 +119,9 @@ import basicInfoModal from './basicInfoModal.vue'
 import rangeDate from '@/views/common/rangeDate.vue'
 import auditModal from '@/views/common/auditModal.vue'
 import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport } from '@/api/allocateBill'
-import { allocateTypeAllList } from '@/api/allocateType'
+import AllocateType from '@/views/common/allocateType.js'
 export default {
-  components: { STable, VSelect, basicInfoModal, rangeDate, auditModal },
+  components: { STable, VSelect, basicInfoModal, rangeDate, auditModal, AllocateType },
   data () {
     return {
       spinning: false,
@@ -161,7 +159,6 @@ export default {
       visibleAudit: false,
       auditInfo: null,
       spinningAudit: false,
-      allocateTypeList: [], //  调拨类型
       openModal: false //  新增编辑  弹框
     }
   },
@@ -207,7 +204,7 @@ export default {
     },
     //  基本信息  保存
     handleOk (data) {
-      this.$router.push({ path: `/allocationManagement/transferOut/add/${data.allocateSn}/${data.targetName}/${data.targetType}` })
+      this.$router.push({ path: `/allocationManagement/transferOut/add/${data.allocateSn}/${data.targetType}` })
     },
     //  删除
     handleDel (row) {
@@ -259,7 +256,7 @@ export default {
     },
     //  编辑
     handleEdit (row) {
-      this.$router.push({ path: `/allocationManagement/transferOut/edit/${row.allocateSn}/${row.targetName}/${row.dealerLevel}` })
+      this.$router.push({ path: `/allocationManagement/transferOut/edit/${row.allocateSn}/${row.dealerLevel}` })
     },
     //  导出
     handleExport () {
@@ -284,16 +281,6 @@ export default {
       document.body.appendChild(link)
       link.click()
     },
-    //  调拨类型
-    getAllocateTypeAllList () {
-      allocateTypeAllList().then(res => {
-        if (res.status == 200) {
-          this.allocateTypeList = res.data
-        } else {
-          this.allocateTypeList = []
-        }
-      })
-    },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       this.tableHeight = window.innerHeight - tableSearchH - 245
@@ -316,7 +303,6 @@ export default {
   beforeRouteEnter (to, from, next) {
     next(vm => {
       vm.openModal = false
-      vm.getAllocateTypeAllList()
       if (!vm.disabled) {
         vm.$refs.table.refresh()
       }

+ 68 - 0
src/views/common/allocateType.js

@@ -0,0 +1,68 @@
+import { allocateTypeAllList } from '@/api/allocateType'
+const AllocateType = {
+  template: `
+      <a-select
+        placeholder="请选择调拨类型"
+        :id="id"
+        allowClear
+        :value="defaultVal"
+        :showSearch="true"
+        @change="handleChange"
+        option-filter-prop="children"
+        :filter-option="filterOption">
+        <a-select-option v-for="item in list" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
+      </a-select>
+    `,
+  props: {
+    value: {
+      type: String,
+      defatut: ''
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    sysFlag: {
+      type: String,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      defaultVal: this.value,
+      list: []
+    };
+  },
+  mounted() {
+    this.getProductBrand()
+  },
+  watch: {
+    value(newValue, oldValue) {
+      this.defaultVal = newValue
+    }
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    handleChange(value) {
+      this.defaultVal = value;
+      this.$emit('change', value);
+      this.$emit('input', value);
+    },
+    //  调拨类型
+    getProductBrand () {
+      allocateTypeAllList().then(res => {
+        if (res.status == 200) {
+          this.list = res.data
+        } else {
+          this.list = []
+        }
+      })
+    },
+  },
+};
+
+export default AllocateType