Преглед на файлове

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-mini-web

zhoux преди 1 година
родител
ревизия
9259ffef25
променени са 6 файла, в които са добавени 883 реда и са изтрити 83 реда
  1. 2 0
      src/api/pages/sale/order.js
  2. 7 0
      src/locale/lang/zh-CN.js
  3. 5 1
      src/mixins/index.js
  4. 63 65
      src/view/mst/basic-data/index.vue
  5. 74 12
      src/view/mst/staff/index.vue
  6. 732 5
      src/view/pur/pur-by-sale/index.vue

+ 2 - 0
src/api/pages/sale/order.js

@@ -13,6 +13,8 @@ export default {
     getOrderTrackReport:'get_order_track_report',
     getOrderTrackReport:'get_order_track_report',
     //首页-查询订单-待办事项个数
     //首页-查询订单-待办事项个数
     countOrderByCond:'count_order_by_cond',
     countOrderByCond:'count_order_by_cond',
+    //以销定采查询
+    purchaseBasedOnSales:'purchase_based_on_sales_web',
   }
   }
 }
 }
 
 

+ 7 - 0
src/locale/lang/zh-CN.js

@@ -116,6 +116,7 @@ export const button = {
   addOrderReturn:'销售退货',
   addOrderReturn:'销售退货',
   addOutReturn:'出库退货',
   addOutReturn:'出库退货',
   refreshReport: '更新报表',
   refreshReport: '更新报表',
+  chooseSalesForPurchase:'选择销售订单',
 }
 }
 
 
 /**
 /**
@@ -298,6 +299,7 @@ export const columns = {
   channelName: '销售渠道',
   channelName: '销售渠道',
   channelCode: '渠道编码',
   channelCode: '渠道编码',
   salesChannel: '销售渠道',
   salesChannel: '销售渠道',
+  channelNames: '渠道名称',
   makeStaffName: '制单员',
   makeStaffName: '制单员',
   makeTime: '制单时间',
   makeTime: '制单时间',
   skuModel: '商品型号',
   skuModel: '商品型号',
@@ -724,6 +726,11 @@ export const columns = {
   objectName:'账务对象名称',
   objectName:'账务对象名称',
   objectCode:'账务对象编码',
   objectCode:'账务对象编码',
   objectPhone:'联系电话',
   objectPhone:'联系电话',
+  transferableQuantity:'可转采购数量',
+  makingTime:'订单日期',
+  inboundProcessingFlag:'开单并入库办理标识',
+  flgCanPcLogin: '电脑登录',
+  flgCanWxLogin:'手机登录',
 }
 }
 
 
 /**
 /**

+ 5 - 1
src/mixins/index.js

@@ -396,7 +396,7 @@ export const indexMixin = {
           return;
           return;
         }
         }
         this.loading = true;
         this.loading = true;
-        // 2、给参数赋值
+        // 2、给参数赋值4
         this._setParams(arg);
         this._setParams(arg);
         // this.params.ftyId = this.$store.state.user.ftyId;// 给工厂赋默认值
         // this.params.ftyId = this.$store.state.user.ftyId;// 给工厂赋默认值
         // this.params.cpId = this.$store.state.user.cpId;
         // this.params.cpId = this.$store.state.user.cpId;
@@ -503,6 +503,10 @@ export const indexMixin = {
           if (res && res.code === this.$config.SUCCESS_CODE) {
           if (res && res.code === this.$config.SUCCESS_CODE) {
             this.formData = res.data;
             this.formData = res.data;
           }
           }
+          // 提供给页面额外赋值的方法
+          if (this.setValuesByEdit){
+            this.setValuesByEdit(res.data);
+          }
         })
         })
       }
       }
       this.editAddModal = true
       this.editAddModal = true

+ 63 - 65
src/view/mst/basic-data/index.vue

@@ -36,6 +36,7 @@
         <DkSplit v-model="split">
         <DkSplit v-model="split">
           <!-- 左边部分   -->
           <!-- 左边部分   -->
           <DkTable slot="left" ref="leftTable" :data="leftData" :height="tableHeight" :page-flag="false"
           <DkTable slot="left" ref="leftTable" :data="leftData" :height="tableHeight" :page-flag="false"
+                   primaryKey="kindCode"
                    :page-total-flag="false" :show-setting-flag="false" :freeze="false" :choose-flag="false"
                    :page-total-flag="false" :show-setting-flag="false" :freeze="false" :choose-flag="false"
                    @current-change="currentChangeEvent($event)">
                    @current-change="currentChangeEvent($event)">
             <DkTableColumn :title="$t('allType')" field="kindName" width="auto" :filter="false" :sortable="false"
             <DkTableColumn :title="$t('allType')" field="kindName" width="auto" :filter="false" :sortable="false"
@@ -102,7 +103,7 @@
           <InputPop v-model="formData.kindName" :disabled="true"/>
           <InputPop v-model="formData.kindName" :disabled="true"/>
         </DkFormItem>
         </DkFormItem>
         <!--仓库名称-->
         <!--仓库名称-->
-        <DkFormItem prop="name" :required="true">
+        <DkFormItem prop="name" :required="true" :label="kindCode === this.$config.kindCode.basicWarehouse ? $t('whName') : (kindCode === this.$config.kindCode.basicChannel ? $t('channelNames') : $t('dataValue'))">
           <InputPop v-model="formData.name"/>
           <InputPop v-model="formData.name"/>
         </DkFormItem>
         </DkFormItem>
         <!--仓库主管 (仓库特有)-->
         <!--仓库主管 (仓库特有)-->
@@ -138,6 +139,7 @@ export default {
   data() {
   data() {
     let self = this
     let self = this
     return {
     return {
+      leftRow:null,
       modalTitle: '',//新建编辑弹窗名称
       modalTitle: '',//新建编辑弹窗名称
       submitType: '',//新建编辑提交类型
       submitType: '',//新建编辑提交类型
       kindCode: null,
       kindCode: null,
@@ -184,54 +186,64 @@ export default {
      */
      */
     currentChangeEvent({row}) {
     currentChangeEvent({row}) {
       if (row != null) {
       if (row != null) {
+        this.leftRow = row
         this.kindCode = row.kindCode
         this.kindCode = row.kindCode
-        let params = {
-          cpId: this.$store.state.user.cpId,
-        }
+        this.searchData();
+      }
+    },
 
 
-        // 仓库
-        if (this.kindCode == this.$config.kindCode.basicWarehouse || this.kindCode == null) {
-          setTimeout(() => {
-            this.wareHouseTableFlag = true
-          }, 100)
-          this.saleChannelTableFlag = false
-          this.dictionaryTableFlag = false
-          params.whCode = row.code
-          params.whName = row.name
-          this.excute(this.$service.wareHouseService, this.$service.wareHouseService.selectByCond, params).then(res => {
-            if (res.code === this.$config.SUCCESS_CODE) {
-              this.wareHouseData = res.data.list
-            }
-          })
-        }
-        // 渠道
-        else if (this.kindCode == this.$config.kindCode.basicChannel) {
-          params.channelCode = row.code
-          params.channelName = row.name
-          this.wareHouseTableFlag = false
-          this.dictionaryTableFlag = false
-          setTimeout(() => {
-            this.saleChannelTableFlag = true
-          }, 100)
-          this.excute(this.$service.saleChannelService, this.$service.saleChannelService.selectByCond, params).then(res => {
-            if (res.code === this.$config.SUCCESS_CODE) {
-              this.saleChannelTableData = res.data.list
-            }
-          })
-        } else {
-          // 数据字典
-          params.dictCode = this.kindCode
-          setTimeout(() => {
-            this.dictionaryTableFlag = true
-          }, 100)
-          this.saleChannelTableFlag = false
-          this.wareHouseTableFlag = false
-          this.excute(this.$service.dictionaryDataService, this.$service.dictionaryDataService.selectByCond, params).then(res => {
-            if (res.code === this.$config.SUCCESS_CODE) {
-              this.dictionaryTableData = res.data.list
-            }
-          })
-        }
+    /**
+     * @desc   : 获取数据
+     * @author : 常皓宁
+     * @date   : 2024/3/9 10:55
+     */
+    getData(params) {
+      // 商品品牌
+      if (this.kindCode == this.$config.kindCode.basicWarehouse || this.kindCode == null) {
+        setTimeout(()=>{
+          this.wareHouseTableFlag = true
+        },100)
+        this.saleChannelTableFlag = false
+        this.dictionaryTableFlag = false
+        console.log("this.leftRow:",this.leftRow)
+        params.whCode = this.leftRow.code
+        params.whName = this.leftRow.name
+        this.excute(this.$service.wareHouseService, this.$service.wareHouseService.selectByCond, params).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.wareHouseData = res.data.list
+          }
+          this.loading = false;
+        })
+      }
+      // 渠道
+      else if (this.kindCode == this.$config.kindCode.basicChannel) {
+        setTimeout(() => {
+          this.saleChannelTableFlag = true
+        }, 100)
+        this.wareHouseTableFlag = false
+        this.dictionaryTableFlag = false
+        params.channelCode = this.leftRow.code
+        params.channelName = this.leftRow.name
+        this.excute(this.$service.saleChannelService, this.$service.saleChannelService.selectByCond, params).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.saleChannelTableData = res.data.list
+          }
+          this.loading = false;
+        })
+      } else {
+        // 数据字典
+        params.dictCode = this.kindCode
+        setTimeout(() => {
+          this.dictionaryTableFlag = true
+        }, 100)
+        this.saleChannelTableFlag = false
+        this.wareHouseTableFlag = false
+        this.excute(this.$service.dictionaryDataService, this.$service.dictionaryDataService.selectByCond, params).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.dictionaryTableData = res.data.list
+          }
+          this.loading = false;
+        })
       }
       }
     },
     },
 
 
@@ -359,23 +371,6 @@ export default {
     },
     },
 
 
     /**
     /**
-     * @desc   : 获取数据
-     * @author : 常皓宁
-     * @date   : 2024/3/9 10:55
-     */
-    getData() {
-      if (this.kindCode) {
-        let data = {
-          kindCode: this.kindCode,
-          code: this.searchCond._value['code'],
-          name: this.searchCond._value['name'],
-        }
-        this.currentChangeEvent({row: data})
-      }
-      this.loading = false
-    },
-
-    /**
      * @desc   : 基础资料左侧列表数据
      * @desc   : 基础资料左侧列表数据
      * @author : 常皓宁
      * @author : 常皓宁
      * @date   : 2024/3/9 13:03
      * @date   : 2024/3/9 13:03
@@ -387,13 +382,16 @@ export default {
       this.leftData = data
       this.leftData = data
       if (this.leftData.size() > 0) {
       if (this.leftData.size() > 0) {
         this.kindCode = this.leftData[0].kindCode
         this.kindCode = this.leftData[0].kindCode
+
       }
       }
     },
     },
   },
   },
+  mounted() {
+    this.getBasicData() //基础资料左侧列表数据
+  },
   created() {
   created() {
     this.primaryKey = 'basicDataId'  // 设置主键Id
     this.primaryKey = 'basicDataId'  // 设置主键Id
     this.routeObjName = 'basicData'  // 设置路由名称
     this.routeObjName = 'basicData'  // 设置路由名称
-    this.getBasicData() //商品属性左侧列表数据
   }
   }
 }
 }
 </script>
 </script>

+ 74 - 12
src/view/mst/staff/index.vue

@@ -86,26 +86,45 @@
         <!--  业务部门  -->
         <!--  业务部门  -->
         <DkFormItem prop="orgId" :label="$t('orgName')" :required="true">
         <DkFormItem prop="orgId" :label="$t('orgName')" :required="true">
           <SelectMagnifier v-model="formData.orgId" :display-text="formData.orgName"
           <SelectMagnifier v-model="formData.orgId" :display-text="formData.orgName"
+                           ref="orgId"
                            :type="this.$config.MagnifierType.org"
                            :type="this.$config.MagnifierType.org"
                            :multiple="false"></SelectMagnifier>
                            :multiple="false"></SelectMagnifier>
         </DkFormItem>
         </DkFormItem>
         <!--登录标识-->
         <!--登录标识-->
-        <DkFormItem prop="flgCanLogin">
+<!--        <DkFormItem prop="flgCanLogin">-->
+<!--          <template>-->
+<!--            <i-switch v-model="formData.flgCanLogin">-->
+<!--              <span slot="open"></span>-->
+<!--              <span slot="close"></span>-->
+<!--            </i-switch>-->
+<!--          </template>-->
+<!--        </DkFormItem>-->
+        <!--电脑登录标识-->
+        <DkFormItem prop="flgCanPcLogin" :label="$t('flgCanPcLogin')">
           <template>
           <template>
-            <i-switch v-model="formData.flgCanLogin">
+            <i-switch v-model="formData.flgCanPcLogin">
               <span slot="open"></span>
               <span slot="open"></span>
               <span slot="close"></span>
               <span slot="close"></span>
             </i-switch>
             </i-switch>
           </template>
           </template>
         </DkFormItem>
         </DkFormItem>
-        <!--登录系统-->
-        <DkFormItem prop="loginType"  v-if="formData.flgCanLogin">
-          <SelectPop v-model="formData.loginType" ref="loginTypeId"
-                     :options="loginTypeList"
-                     :multiple="false"
-                     labelKey="loginTypeName" valueKey="loginTypeId">
-          </SelectPop>
+        <!--手机登录标识-->
+        <DkFormItem prop="flgCanWxLogin" :label="$t('flgCanWxLogin')">
+          <template>
+            <i-switch v-model="formData.flgCanWxLogin">
+              <span slot="open"></span>
+              <span slot="close"></span>
+            </i-switch>
+          </template>
         </DkFormItem>
         </DkFormItem>
+        <!--登录系统-->
+<!--        <DkFormItem prop="loginType"  v-if="formData.flgCanLogin">-->
+<!--          <SelectPop v-model="formData.loginType" ref="loginTypeId"-->
+<!--                     :options="loginTypeList"-->
+<!--                     :multiple="false"-->
+<!--                     labelKey="loginTypeName" valueKey="loginTypeId">-->
+<!--          </SelectPop>-->
+<!--        </DkFormItem>-->
         <!--  角色  -->
         <!--  角色  -->
         <DkFormItem prop="roleIds" :label="$t('roleName')" :data-type="$config.dataType.array">
         <DkFormItem prop="roleIds" :label="$t('roleName')" :data-type="$config.dataType.array">
           <SelectPop v-model="formData.roleIds" ref="roleId"
           <SelectPop v-model="formData.roleIds" ref="roleId"
@@ -176,6 +195,7 @@ export default {
         ],
         ],
       // 表单
       // 表单
       formData: {
       formData: {
+        staffID:null,
         staffCode: '',
         staffCode: '',
         staffName: '',
         staffName: '',
         staffPhone: '',
         staffPhone: '',
@@ -183,6 +203,8 @@ export default {
         orgName: null,
         orgName: null,
         roleIds: null,
         roleIds: null,
         flgCanLogin:false,
         flgCanLogin:false,
+        flgCanPcLogin:false,
+        flgCanWxLogin:false,
         loginType:null,
         loginType:null,
         remarks: ''
         remarks: ''
       },
       },
@@ -489,14 +511,39 @@ export default {
       // 查询数据
       // 查询数据
       return this.excute(this.$service.staffService, this.$service.staffService.selectByCond, params);
       return this.excute(this.$service.staffService, this.$service.staffService.selectByCond, params);
     },
     },
-
+    /**
+     * @desc   : 参数赋值
+     * @author : 姜宁
+     * @date   : 2024/7/29 14:30
+     */
+    setParams(params) {
+      let loginType = 4;
+      // 登录标识赋值
+      if (params.flgCanPcLogin || params.flgCanWxLogin){
+        params.flgCanLogin = true
+        if (params.flgCanPcLogin && params.flgCanWxLogin){
+          loginType = 3;
+        }
+        else if(params.flgCanPcLogin && !params.flgCanWxLogin){
+          loginType = 1;
+        }
+        else{
+          loginType = 2;
+        }
+      }
+      else{
+        params.flgCanLogin = false
+      }
+      params.loginType = loginType;
+      return params
+    },
     /**
     /**
      * @desc   : 提交事件
      * @desc   : 提交事件
      * @author : 常皓宁
      * @author : 常皓宁
      * @date   : 2024/3/5 14:19
      * @date   : 2024/3/5 14:19
      */
      */
     saveData() {
     saveData() {
-      console.log('this.params', this.params)
+      console.log("this.params:",this.params)
       if (this.modalParams.button === this.$config.formMode.add) {
       if (this.modalParams.button === this.$config.formMode.add) {
         delete this.params.staffId // 解决提示主键重复的问题,删除主键代码
         delete this.params.staffId // 解决提示主键重复的问题,删除主键代码
         return this.excute(this.$service.staffService, this.$service.staffService.insert, this.params)
         return this.excute(this.$service.staffService, this.$service.staffService.insert, this.params)
@@ -504,13 +551,13 @@ export default {
         return this.excute(this.$service.staffService, this.$service.staffService.update, this.params)
         return this.excute(this.$service.staffService, this.$service.staffService.update, this.params)
       }
       }
     },
     },
-
     /**
     /**
     * @desc   : 新建完毕后清空窗体
     * @desc   : 新建完毕后清空窗体
     * @author : 常皓宁
     * @author : 常皓宁
     * @date   : 2024/5/17 9:07
     * @date   : 2024/5/17 9:07
     */
     */
     clear() {
     clear() {
+      this.staffID = null
       this.formData.staffCode = null
       this.formData.staffCode = null
       this.formData.staffName = null
       this.formData.staffName = null
       this.formData.staffPhone = null
       this.formData.staffPhone = null
@@ -518,6 +565,8 @@ export default {
       this.formData.orgName = null
       this.formData.orgName = null
       this.formData.roleIds = null
       this.formData.roleIds = null
       this.formData.flgCanLogin = false
       this.formData.flgCanLogin = false
+      this.formData.flgCanPcLogin = false
+      this.formData.flgCanWxLogin = false
       this.formData.loginType = null
       this.formData.loginType = null
       this.formData.remarks = null
       this.formData.remarks = null
     },
     },
@@ -530,6 +579,19 @@ export default {
     detail(id) {
     detail(id) {
       return this.excuteNoParam(this.$service.staffService, this.$service.staffService.selectById, [id], false)
       return this.excuteNoParam(this.$service.staffService, this.$service.staffService.selectById, [id], false)
     },
     },
+    /**
+     * @desc   : 编辑赋值
+     * @author : 姜宁
+     * @date   : 2024/7/29 14:52
+     */
+    setValuesByEdit(data) {
+      if (data.loginType == 1 || data.loginType == 3){
+        this.formData.flgCanPcLogin = true
+      }
+      if (data.loginType == 2 || data.loginType == 3){
+        this.formData.flgCanWxLogin = true
+      }
+    },
     // endregion
     // endregion
   },
   },
   created() {
   created() {

+ 732 - 5
src/view/pur/pur-by-sale/index.vue

@@ -1,13 +1,740 @@
+<!-- @desc:以销定采  @auth:姜宁 @time:2024/07/24 15:15 -->
 <template>
 <template>
+  <div class="main-div" style="position: relative;">
+    <!--按钮区-->
+    <BaseIndexButtonGroup ref="BaseIndexButtonGroup1" id="BaseIndexButtonGroup1">
+      <template #left>
+        <BaseIndexButton ref="chooseSalesForPurchase" name="chooseSalesForPurchase"
+                         @click="chooseSalesForPurchase"></BaseIndexButton>
+      </template>
+    </BaseIndexButtonGroup>
 
 
+    <DkCollapse @on-change="changeCollapse" ref="collapse">
+      <DkPanel prop="essentialInformation">
+        <!--  单据信息  -->
+        <DkForm slot="content" ref="formInline" v-model="formData"
+                style="width:100%" :label-max-words="5">
+          <!--来源单号-->
+          <DkFormItem prop="fromNo" :label="$t('fromNo')">
+            <InputPop ref="fromNo" v-model="formData.fromNos" :readonly="true"/>
+          </DkFormItem>
+          <!--采购单号-->
+<!--          <DkFormItem prop="purNo" :label="$t('purNo')">-->
+<!--            <InputPop ref="purNo" v-model="formData.purNo" :readonly="true"/>-->
+<!--          </DkFormItem>-->
+          <!--供应商-->
+          <DkFormItem prop="supId" :label="$t('supplierName')" :required="true">
+            <SelectMagnifier v-model="formData.supId" :display-text="formData.supplierName"
+                             :type="this.$config.MagnifierType.supplier"
+                             :multiple="false"
+                             :otherCondition="{supplierType:this.$config.kindCode.supplierPur}"
+                             @ok="supplierOk"/>
+          </DkFormItem>
+          <!--收货时间-->
+          <DkFormItem :label="$t('DeliveryDate')"
+                      prop="pickupDate" :required="true" :data-type="$config.dataType.date">
+            <DatePickerPop v-model="formData.pickupDate"
+                           :placeholder="$t('inputWords',{'search-name':$t('DeliveryDate')})"
+                           type="date" :short-cut-flag="true"/>
+          </DkFormItem>
+          <!--收货仓库-->
+          <DkFormItem prop="whId" :label="$t('wareHouse')" :required="true">
+            <SelectPop v-model="formData.whId" ref="whId"
+                       :options="warehouseList"
+                       :multiple="false"
+                       labelKey="whName" valueKey="whId">
+            </SelectPop>
+          </DkFormItem>
+          <!--收货人-->
+          <DkFormItem prop="contactName" :label="$t('contactName')">
+            <InputPop ref="contactName" :readonly="true" v-model="formData.contactName"/>
+          </DkFormItem>
+          <!--收货电话-->
+          <DkFormItem prop="contactPhone" :label="$t('contactPhone')">
+            <InputPop :telephone="true" ref="contactPhone" :readonly="true" v-model="formData.contactPhone"/>
+          </DkFormItem>
+          <!--备注-->
+          <DkFormItem prop="remarks">
+            <InputPop ref="remarks" v-model="formData.remarks"
+                      maxlength=500 textareaFlag/>
+          </DkFormItem>
+          <!--开单并入库办理标识-->
+          <DkFormItem prop="inboundProcessingFlag" >
+            <dkSwitch ref="inboundProcessingFlag" v-model="formData.inboundProcessingFlag"/>
+          </DkFormItem>
+        </DkForm>
+      </DkPanel>
+      <!--商品信息-->
+      <DkPanel prop="goodsInformation">
+        <div id="search-cond-div-goods-info" ref="search-cond-div-goods-info" slot="content">
+          <EditTable slot="left"
+                     ref="detailTable"
+                     majorField="itemId"
+                     :data="purchaseItemList"
+                     :columns="goodsColumns"
+                     :height="400"
+                     :freeze="false"
+                     :show-footer="true"
+                     :add-flag="this.chooseFlag"
+                     controlId="skuId"
+                     @on-choose="getTotals"
+                     @changeValue="getTotals"
+                     @changeNonStandard="changeNonStandard"
+          ></EditTable>
+          <div>
+            <DkForm ref="goodsFootFormData" v-model="goodsFootFormData" :labelMaxWords="5" name="dk-form"
+                    class="read-only-form">
+              <!--合计数量-->
+              <DkFormItem prop="sumQuantity">
+                <InputNumberPop ref="sumQuantity" v-model="goodsFootFormData.sumQuantity" :clearable="false"
+                                :digits="2" :readonly="true"/>
+              </DkFormItem>
+              <!--货物金额-->
+              <DkFormItem prop="sumAmount" class="amount">
+                <InputNumberPop ref="sumAmount" v-model="goodsFootFormData.sumAmount" :clearable="false"
+                                :digits="2" :readonly="true"/>
+              </DkFormItem>
+              <!--标价总额-->
+              <DkFormItem prop="sumStandard" class="amount">
+                <InputNumberPop ref="sumStandard" v-model="goodsFootFormData.sumStandard" :digits="2"
+                                :readonly="true"/>
+              </DkFormItem>
+            </DkForm>
+          </div>
+        </div>
+      </DkPanel>
+      <!--附件-->
+      <DkPanel prop="files">
+        <div id="search-cond-div-files-info" ref="search-cond-div-files-info"
+             slot="content">
+          <DkPicWall v-model="formData.annexPaths"
+                     :table="$config.tables.purchase" :accept="$config.uploadFileConfig.acceptPicType"></DkPicWall>
+        </div>
+      </DkPanel>
+    </DkCollapse>
+
+    <!--      下部分按钮区域-->
+    <DkSaveButton ref="saveButton" :loading="loading" @save="save" @close="close"></DkSaveButton>
+
+    <!--以销定采-->
+    <DkModal
+      :loading="loading"
+      v-model="purchaseBasedOnSalesFlag"
+      :title="$t('chooseSalesForPurchase')"
+      width="1000px"
+      @modalOk="purchaseBasedOnSalesOk"
+      @modalCancel="clearPurchaseBasedOnSales"
+    >
+      <card :padding=0 style="margin-top: 1px;padding: 0">
+        <!--按钮区-->
+        <BaseIndexButtonGroup ref="BaseIndexButtonGroup" id="BaseIndexButtonGroup">
+          <template #left>
+            <BaseIndexButton ref="search" name="search"
+                             @click="chooseSalesForPurchase(true)"></BaseIndexButton>
+            <BaseIndexButton ref="clear" name="clear"
+                             @click="clearPurchaseBasedOnSales(true)"></BaseIndexButton>
+          </template>
+        </BaseIndexButtonGroup>
+        <!-- 查询条件-->
+        <DkForm ref="purchaseBasedOnSalesFormData" v-model="purchaseBasedOnSalesFormData"
+                name="purchase-based-on-sales-form"
+                class="form-content-class" style="margin-top: 5px">
+          <!--客户名称-->
+          <DkFormItem prop="cusName" :label="$t('cusName')">
+            <InputPop ref="cusName" v-model="purchaseBasedOnSalesFormData.customerName"/>
+          </DkFormItem>
+          <!--客户电话-->
+          <DkFormItem prop="cusPhone" :label="$t('cusPhone')">
+            <InputPop ref="cusPhone" v-model="purchaseBasedOnSalesFormData.customerPhone"/>
+          </DkFormItem>
+          <!--商品型号-->
+          <DkFormItem prop="skuModel" :label="$t('skuModel')">
+            <InputPop ref="skuModel" v-model="purchaseBasedOnSalesFormData.skuModel"/>
+          </DkFormItem>
+          <!--商品名称-->
+          <DkFormItem prop="skuName" :label="$t('skuName')">
+            <InputPop ref="skuName" v-model="purchaseBasedOnSalesFormData.skuName"/>
+          </DkFormItem>
+        </DkForm>
+        <DkTable primaryKey="itemId"
+                 ref="table-purchase-based-on-sales-select"
+                 :id="'table-'+$options.name"
+                 name="table"
+                 :data="purchaseBasedOnSalesTableData"
+                 :height="purchaseBasedOnSalesHeight"
+                 :lazy="false"
+                 :selectFlag="false"
+                 :operateFlag="false"
+                 :link-click-checked="true">
+          <DkTableColumn v-for="(item,index) in purchaseBasedOnSalesColumns" :key="index" :field="item.field"
+                         :title="item.title"
+                         :width="item.width"
+                         :filter="false"
+                         :resize-flag="index === purchaseBasedOnSalesColumns.length - 1"></DkTableColumn>
+        </DkTable>
+      </card>
+    </DkModal>
+  </div>
 </template>
 </template>
 
 
 <script>
 <script>
+
+import {formMixin} from '@/mixins/form'
+
 export default {
 export default {
-  name: "index"
-}
-</script>
+  components: {},
+  mixins: [formMixin],
+  data() {
+    let self = this
+    return {
+      //小数位数
+      decimalPlaces:0,
+      chooseFlag: false ,//商品信息新增
+      procureList: [],//每次以销定采选择后存放数据
+      //以销定采
+      purchaseBasedOnSalesFlag: false,
+      purchaseBasedOnSalesTableData: [],
+      purchaseBasedOnSalesHeight: 400,
+      purchaseBasedOnSalesColumns: [
+        {field: 'skuModel'},//商品型号
+        {field: 'skuName'},//商品名称
+        {field: 'skuCode'},//商品编码
+        {
+          field: 'transferableQuantity',
+          type: 'number',
+          digits: 0,
+          sum: true
+        },//可转采购数量
+        {field: 'brandName'},//商品品牌
+        {field: 'nonStdCode'},//非标号
+        {field: 'orderNo', width: '200px'},
+        {field: 'makingTime'},//订单日期
+        {field: 'orderStatusName'},//单据状态
+        {field: 'cusName'},//客户名称
+        {field: 'cusPhone'},//客户电话
+        {field: 'addressFull'},//客户地址
+        {field: 'orgName'},//业务部门
+        {field: 'staffName'},//业务员
+        // {field: 'warehouseName'},//仓库
+        // {field: 'skuWeight', type: 'number', digits: 2, sum: true},//重量
+        // {field: 'skuVolume', type: 'number', digits: 2, sum: true},//体积
+        // {field: 'remarks'},//备注
+      ],
+      orderId: null,
+      //连接业务接口
+      purchaseBasedOnSalesFormData: {
+        orderNo: null,//订单单号
+        deliveryTime: null,//送货日期
+        customerName: null,//客户名称
+        customerPhone: null,//客户电话
+        addressFull: null,//详细地址
+        orgId: null,//业务部门
+        orgName: null,//业务名称
+        skuModel: null,//商品型号
+        skuCode: null,//商品名称
+        skuName: null,//商品编码
+      },
+      loading: false,
+      allCanNoEdit: false, //是否所有的都不允许编辑
+      formData: {
+        purId: null,
+        purNo: null,
+        supId: null,
+        supName:null,
+        whId:null,
+        whName:null,
+        pickupDate: new Date().addDays(1),
+        contactName: null,
+        contactPhone: null,
+        fromIds:null,
+        fromNos:null,
+        remarks: null,
+        annexPaths:null,
+        inboundProcessingFlag:false,
+      },
+      //明细
+      purchaseItemList: [],
+      goodsColumns: [
+        {
+          field: 'skuCode',
+          controlId: 'skuId',
+          treeNode: true,
+          type: 'disabled',
+          fixed: 'left',
+          promotionType: true,
+          dataType: self.$config.tableSelectType.goodsForPurchase,
+          tip: self.$t('W_117'),
+          fieldUpdate:self.$updateColumns.purchaseColum,
+          searchDetailFlag: true
+        },
+        {
+          field: 'skuName',
+          controlId: 'skuId',
+          type: 'disabled',
+          fixed: 'left',
+          promotionType: true,
+          dataType: self.$config.tableSelectType.goodsForPurchase,
+          fieldUpdate: self.$updateColumns.purchaseColum,
+          searchDetailFlag: true
+        },
+        {
+          field: 'itemQty',
+          type: 'number',
+          digits: 0,
+          sum: true,
+          formula: {
+            box: ['itemQty/packBox', 'itemQty', 'packBox'],
+            piece: ['itemQty%packBox', 'itemQty', 'packBox'],
+          }
+        },//数量
+        {
+          field: 'pricePur',
+          type: 'number',
+          digits: 2,
+        },//采购价
+        {
+          field: 'pricePurchase',
+          type: 'disabled',
+          digits: 2,
+          number: true,
+        },//采购标价
+        //基本单位
+        {
+          field: 'unitName',
+          title: self.$t('piece'),
+          type: 'disabled',
+        },
+        // //箱
+        // {
+        //   field: 'box',
+        //   type: 'number',
+        //   digits: 0,
+        //   sum: true,
+        //   formula: {
+        //     itemQty: ['box*packBox+piece', 'box', 'packBox','piece'],
+        //   },
+        // },
+        // //片
+        // {
+        //   field: 'piece',
+        //   type: 'number',
+        //   digits: 0,
+        //   sum: true,
+        //   formula: {
+        //     itemQty: ['box*packBox+piece', 'piece','box','packBox'],
+        //     box: ['(box*packBox+piece)/packBox', 'piece', 'box' , 'packBox','packBox'],
+        //     piece: ['(box*packBox+piece)%packBox', 'piece','box', 'packBox', 'packBox'],
+        //   },
+        // },
+        {
+          field: 'packBox',
+          title: self.$t('boxPiece'),
+          type: 'disabled',
+        },
+        {
+          field: 'remarks',
+          type: 'text',
+        },
+      ],
+      warehouseList: [],//仓库
+      //商品合计信息
+      goodsFootFormData: {
+        sumQuantity: 0,
+        sumAmount: 0,
+        sumStandard: 0,
+        saleDiscount:100,
+      },
+    }
+  },
+
+  methods: {
+
+    /**
+     * @desc   : 修改包装数
+     * @author : 周兴
+     * @date   : 2024/5/24 15:02
+     */
+    changeNonStandard({row,rowIndex,field}){
+      let table = this.$refs['detailTable'].tableData
+      table[rowIndex][field] = (row['nonStandardForm']['box']?row['nonStandardForm']['box']:0)
+        + row['subUnitName']
+        +(row['nonStandardForm']['piece'] == 0 || row['nonStandardForm']['piece'] ?row['nonStandardForm']['piece']:'')
+        +(row['unitName']?(row['nonStandardForm']['piece']?row['unitName']:''):'')
+      table[rowIndex]['itemQty'] = row['packBox'] * (row['nonStandardForm']['box']?row['nonStandardForm']['box']:0) + (row['nonStandardForm']['piece'] ?row['nonStandardForm']['piece']:0)
+      table[rowIndex]['itemAmt'] = table[rowIndex]['itemQty'] * table[rowIndex]['priceSale']
+      table[rowIndex]['box'] = row['nonStandardForm']['box']?row['nonStandardForm']['box']:0
+      table[rowIndex]['piece'] = row['nonStandardForm']['piece'] ?row['nonStandardForm']['piece']:0
+      //计算合计
+      this.getTotale(table)
+    },
+
+    /**
+     * @desc   : 获取商品表格中数量、金额后计算总单信息
+     * @author : 姜宁
+     * @date   : 2024/7/26 14:55
+     */
+    getTotals(field, row, rowIndex) {
+      let table = this.$refs['detailTable'].tableData
+      if (table && table.length > 0) {
+        //计算合计
+        this.getTotale(table)
+        table.forEach(row => {
+          if (!row["itemQty"] || row["itemQty"] == '') {
+            this.$set(row, 'itemQty', 0);
+          }
+          if (!row["itemAmt"] || row["itemQty"] == '') {
+            this.$set(row, 'itemAmt', 0);
+          }
+
+          this.decimalPlaces = row['decimalPlaces']
+          if(row['subUnitId']){
+            row.nonStandardForm = {
+              formula: (row['subUnitName']?'1'+row['subUnitName']+ '=':'' ) + row['packBox'] + row['unitName'],
+              box:(row['itemQty']/row['packBox'] >= 1 ? Math.floor(row['itemQty']/row['packBox']):0),
+              piece:row['itemQty']%row['packBox'],
+            }
+            row.nonStandardItems = [
+              {code:'formula',label:'计算公式',type:'text',readonly:true},
+              {code:'box',label:row['subUnitName'],type:'number' },
+              {code:'piece',label:row['unitName'],type:'number',digits:this.decimalPlaces}
+            ]
+            row['unitInfo'] = (row['itemQty']/row['packBox'] >= 1 ? Math.floor(row['itemQty']/row['packBox']):0) + row['subUnitName'] + (row['itemQty']%row['packBox']).toFixed(this.decimalPlaces) + row['unitName']
+          }else{
+            row.nonStandardForm = {
+              formula: (row['subUnitName']?'1'+row['subUnitName']+ '=':'' ) + row['packBox'] + row['unitName'],
+              piece:row['itemQty'],
+            }
+            row.nonStandardItems = [
+              {code:'formula',label:'计算公式',type:'text',readonly:true},
+              {code:'piece',label:row['unitName'],type:'number',digits: this.decimalPlaces}
+            ]
+            row['unitInfo'] = row['itemQty'] + row['unitName']
+          }
+          row['box'] = row['nonStandardForm']['box']
+          row['piece'] = row['nonStandardForm']['piece']
+
+          // if (!row["whId"] || row["whId"] == '') {
+          //   this.$set(row, 'whId', this.defaultWh.whId);
+          //   this.$set(row, 'whName', this.defaultWh.whName);
+          // }
+        })
+      }
+    },
 
 
-<style scoped>
+    /**
+     * @desc   : 计算合计
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:30
+     */
+    getTotale(table){
+      let sumQuantity = 0;  // 合计数量
+      let sumAmount = 0;    // 货物金额
+      let sumStandard = 0;  // 标价总额
+      if (table && table.length > 0) {
+        table.forEach(row => {
+          row["itemAmt"] = parseFloat(row["pricePur"]) * parseFloat(row["itemQty"]);
+          row["amtStd"] = parseFloat(row["pricePurchase"]) * parseFloat(row["itemQty"]);
+          sumQuantity += parseFloat(row["itemQty"]);
+          sumAmount += row["itemAmt"];
+          sumStandard += row["amtStd"];
+        })
+      }
+      this.goodsFootFormData.sumQuantity = sumQuantity;
+      this.goodsFootFormData.sumAmount = sumAmount;
+      this.goodsFootFormData.sumStandard = sumStandard;
+      this.goodsFootFormData.saleDiscount = (sumAmount / sumStandard * 100).toFixed(2);
+    },
 
 
-</style>
+    /**
+     * @desc   : 以销定采弹窗打开并查询数据
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:30
+     */
+    chooseSalesForPurchase(modalOpenFlag) {
+      this.purchaseBasedOnSalesFlag = true
+      let param = {
+        cpId: this.$store.state.user.cpId,
+        //客户名称
+        cusName: this.purchaseBasedOnSalesFormData.customerName,
+        //客户电话
+        cusPhone: this.purchaseBasedOnSalesFormData.customerPhone,
+        //商品型号
+        skuModel: this.purchaseBasedOnSalesFormData.skuModel,
+        //商品名称
+        skuName: this.purchaseBasedOnSalesFormData.skuName,
+      }
+      this.loading = true;
+      this.excute(this.$service.orderService, this.$service.orderService.purchaseBasedOnSales, param).then(res => {
+        if (res.code === this.$config.SUCCESS_CODE) {
+          this.purchaseBasedOnSalesTableData = res.data.list
+        } else {
+          this.$Message.warning(res.message)
+          this.purchaseBasedOnSalesTableData = []
+        }
+        this.loading = false;
+      })
+    },
+    /**
+     * @desc   : 以销定采选择商品确认带回方法
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:31
+     */
+    purchaseBasedOnSalesOk() {
+      this.purchaseBasedOnSalesFlag = false
+      let arr = this.$refs['table-purchase-based-on-sales-select'].batchRows
+      //本次选择的数据
+      if(arr){
+        arr.map(row =>{
+          let item = row
+          //采购数量
+          this.$set(item, 'itemQty', row['transferableQuantity'])
+          //采购价
+          this.$set(item, 'pricePur', row['pricePurchase'])
+          //采购金额
+          this.$set(item, 'itemAmt', row['pricePurchase'] * row['transferableQuantity'])
+          //采购标价
+          this.$set(item, 'pricePurchase', row['pricePurchase'])
+          //标价金额
+          this.$set(item, 'amtStd', row['pricePurchase'] * row['transferableQuantity'])
+          //销售订单ID
+          this.$set(item, 'fromId', row['orderId'])
+          //销售订单明细ID
+          this.$set(item, 'fromItemId', row['itemId'])
+          this.$set(item, 'packBox', row['packBox'])
+          // 不可查询
+          this.$set(item, 'readOnly', ['skuCode','skuName'])
+          // 去掉销售订单明细Id
+          delete row['itemId']
+        })
+        this.purchaseItemList = arr
+        //不重复Id集合
+        let ids = []
+        //不重复数据集合
+        let fromNos = []
+        let fromIds = []
+        for (let i = 0; i < arr.length; i++) {
+          if (ids.indexOf(arr[i].orderId) == -1) {
+            ids.push(arr[i].orderId)
+            fromNos.push(JSON.parse(JSON.stringify(arr[i]['orderNo'])))
+            fromIds.push(JSON.parse(JSON.stringify(arr[i]['orderId'])))
+          }
+        }
+        this.formData.fromNos = fromNos
+        this.formData.fromIds = fromIds
+        this.chooseFlag = false
+        //计算合计
+        this.getTotale(this.purchaseItemList)
+      }
+    },
+
+    /**
+    * @desc   : 关闭弹窗
+    * @author : 姜宁
+    * @date   : 2024/7/25 14:32
+    */
+    clearPurchaseBasedOnSales() {
+      this.$refs.purchaseBasedOnSalesFormData.$refs['purchase-based-on-sales-form'].resetFields();
+    },
+
+    /**
+     * @desc   : 供应商选择后事件
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:32
+     */
+    supplierOk(val) {
+      this.formData.contactName = val[0]['contactName']
+      this.formData.contactPhone = val[0]['contactPhone']
+    },
+
+    /**
+     * @desc   : 数据校验
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:32
+     */
+    validData() {
+      // 明细必须有数据
+      if (!this.$refs.detailTable.tableData.filter(f => f.skuId).length) {
+        this.$Message.warning(this.$t('W_012'))
+        return false
+      }
+      // 商品数量不能为空
+      if (this.$refs.detailTable.tableData.some(s => !s.itemQty)) {
+        this.$Message.warning(this.$t('W_001', {param: this.$t('itemQty')}))
+        return false
+      }
+      // 采购价不能为空
+      if (this.$refs.detailTable.tableData.some(s => !s.pricePur)) {
+        this.$Message.warning(this.$t('W_001', {param: this.$t('pricePur')}))
+        return false
+      }
+      // 明细必须有数据
+      // let itemTable = this.$refs['detailTable'].getTableDataFilter();
+      // for (let i = 0; i < itemTable.length; i++) {
+      //   // 编辑时 商品数量不能小于已转入库数量
+      //   if (itemTable[i].itemQty > itemTable[i].transferableQuantity) {
+      //     this.$message.warning(this.$t('W_009', {'param1': this.$t('sequence') + (i + 1) + this.$t('rowNo') + this.$t('itemQty'),'param2':this.$t('已转入库数量')}))
+      //     return false;
+      //   }
+      // }
+      return true
+    },
+
+    /**
+     * @desc   : 清空参数
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:32
+     */
+    clear() {
+      this.formData = {
+        purId: null,
+        purNo: null,
+        supId: null,
+        supName:null,
+        whId:null,
+        whName:null,
+        pickupDate: new Date().addDays(1),
+        contactName: null,
+        contactPhone: null,
+        fromIds:null,
+        fromNos:null,
+        remarks: null,
+        annexPaths:null,
+        inboundProcessingFlag:false,
+      }
+      this.purchaseItemList = []
+      this.goodsFootFormData = {
+        sumQuantity: 0,
+          sumAmount: 0,
+          sumStandard: 0,
+          saleDiscount:100,
+      }
+    },
+
+    /**
+     * @desc   : 给参数赋值
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:33
+     */
+    setParams() {
+      this.params = {...this.formData}
+      // 取货日期
+      if (this.formData.pickupDate) {
+        this.params.pickupDate = this.formData.pickupDate.format('yyyy-MM-dd')
+      }
+      // 部门
+      this.params.orgId = this.$store.state.user.orgId
+      // 员工
+      this.params.staffId = this.$store.state.user.staffId
+      // 制单员
+      this.params.makeStaff = this.$store.state.user.staffId
+      // 公司
+      this.params.cpId = this.$store.state.user.cpId
+      let tableFilter = this.$refs['detailTable'].getTableDataFilter();
+      let insertTale = this.countItem(tableFilter)
+      // 采购订单明细
+      this.params.purchaseItemVOList = insertTale
+      // 商品总数量
+      this.params.sumQuantity = insertTale.sum('itemQty')
+      // 标价合计
+      this.params.sumStandard = insertTale.sum('sumStandard').toFixed(2)
+      // 合计金额
+      this.params.sumAmount = insertTale.sum('sumAmount').toFixed(2)
+      // 采购折扣
+      this.params.purDiscount = (parseFloat(insertTale.sum('sumAmount').toFixed(2) )/ parseFloat(insertTale.sum('sumStandard').toFixed(2)) * 100).toFixed(2)
+      // 应付金额
+      this.params.amtPayable = this.params.sumAmount
+      // 还款金额
+      this.params.amtHandle = 0
+      // 剩余应付
+      this.params.amtResidue = parseFloat(this.params.amtPayable - this.params.amtHandle)
+    },
+
+    /**
+     * @desc   : 计算明细数据
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:33
+     */
+    countItem(table){
+      let itemTable = table
+      itemTable.map(row => {
+        let item = row
+        // 标价合计 = 商品数量 * 采购标价
+        let sumStandard = parseFloat(row['itemQty']) * parseFloat(row['pricePurchase'])
+        // 合计金额 = 商品数量 * 采购价
+        let sumAmount = parseFloat(row['itemQty']) * parseFloat(row['pricePur']);
+        // 折扣
+        let priceDiscount =  (parseFloat(row['pricePur']) / parseFloat(row['pricePurchase']) * 100).toFixed(2);
+        this.$set(item, 'sumStandard', sumStandard)
+        this.$set(item, 'sumAmount', sumAmount)
+        // 标价
+        this.$set(item, 'priceStd', row['pricePurchase'])
+        // 标价金额 = 商品数量 * 标价
+        this.$set(item, 'amtStd', sumStandard)
+        // 采购价
+        this.$set(item, 'pricePur', row['pricePur'])
+        // 采购金额 = 商品数量 * 采购价
+        this.$set(item, 'itemAmt', sumAmount)
+        // 折扣
+        this.$set(item, 'priceDiscount', priceDiscount)
+        return item
+      })
+      let itemIndex = 1
+      itemTable.forEach(it =>{
+        this.$set(it,'itemIndex',itemIndex)
+        itemIndex++
+      })
+      return itemTable
+    },
+
+    /**
+     * @desc   : 保存
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:33
+     */
+    saveData() {
+      return this.excute(this.$service.purOrderService, this.$service.purOrderService.insert, this.params)
+    },
+    /***************************列表及其他事件************************************/
+
+    /**
+     * @desc   : 获取仓库
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:33
+     */
+    getWareHouseList() {
+      let params = {
+        cpId:this.$store.state.user.cpId
+      }
+      this.excute(this.$service.commonService, this.$service.commonService.getWarehouse, params, false).then(res => {//调用api查询方法
+        if (res.code === this.$config.SUCCESS_CODE) {
+          this.warehouseList = res.data
+          let warehouseList = this.warehouseList
+          warehouseList.forEach(it =>{
+            if(it.flgDefault){
+              this.formData.whName = it.whName
+              this.formData.whId= it.whId
+            }
+          })
+        }
+      })
+    },
+
+    /**
+     * @desc   : 加载数据
+     * @author : 姜宁
+     * @date   : 2024/7/25 14:34
+     */
+    initData() {
+      this.getWareHouseList();   // 获取仓库数据
+    },
+  },
+  /**
+   * @desc   : 在实例创建完成后被立即同步调用
+   * @author : 姜宁
+   * @date   : 2024/7/25 14:34
+   */
+  created() {
+    this.resizeTableFlag = true;  // 计算表格高度
+  },
+}
+</script>