Prechádzať zdrojové kódy

Merge branch 'test' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-wms into tg

yusheng 9 mesiacov pred
rodič
commit
f674318c82

+ 2 - 1
src/enum/dict.js

@@ -20,5 +20,6 @@ export default {
   条码分类: 'strip_type',
   产地: 'purchase_origin',
   物品机型: 'product_model_key',
-  物品颜色: 'product_color_key'
+  物品颜色: 'product_color_key',
+  流程实例的结果: 'bpm_process_instance_result',
 };

+ 6 - 0
src/utils/dict/warehouse.js

@@ -241,6 +241,12 @@ export const allocationType = [
     label: '库外调拨'
   }
 ];
+// 列表维度
+export const dimensionType = [
+  { code: 1, label: '物品维度' },
+  { code: 2, label: '批次维度' },
+  { code: 3, label: '包装维度' }
+]
 export const allocationStatusDict = [
   {
     code: 1,

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 503 - 321
src/views/warehouseManagement/inventoryAllocation/add.vue


+ 229 - 0
src/views/warehouseManagement/inventoryAllocation/components/print-template-bs-car.vue

@@ -0,0 +1,229 @@
+<template>
+  <ele-modal
+    title="出库单"
+    :visible.sync="QRvisible"
+    v-if="QRvisible"
+    width="90%"
+  >
+    <div
+      id="printSection"
+      style="
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        flex-direction: column;
+      "
+    >
+      <div
+        style="
+          position: relative;
+          width: 100%;
+          height: 100px;
+          display: flex;
+          flex-direction: column;
+          align-items: center;
+        "
+      >
+        <!-- <img
+          v-if="groupName.includes('宝盛')"
+          style="width: 80px; height: 80px; position: absolute; left: 20px"
+          src="@/assets/bslogo.png"
+          alt=""
+        /> -->
+        <div
+          style="
+            font-size: 20px;
+            font-weight: 800;
+            text-align: center;
+            width: 100%;
+          "
+          >{{ groupName || '长沙宝盛汽车配件有限公司' }}送货单</div
+        >
+        <!-- <div
+          style="
+            font-size: 18px;
+            font-weight: 800;
+            text-align: center;
+            width: 100%;
+          "
+          >送货单</div
+        > -->
+      </div>
+      <div
+        style="
+          width: 100%;
+          font-size: 12px;
+          display: flex;
+          justify-content: space-between;
+          margin-bottom: 10px;
+        "
+      >
+        <span style="width: 40%">客户名称:{{ formData.contactName }}</span>
+        <span style="width: 40%"
+          >发货单号:{{ formData.printNo || formData.docNo }}</span
+        >
+      </div>
+      <div
+        style="
+          width: 100%;
+          font-size: 12px;
+          display: flex;
+          justify-content: space-between;
+          margin-bottom: 10px;
+        "
+      >
+        <span style="width: 40%">发货日期:{{ formData.createTime }}</span>
+        <span style="width: 40%"
+          >收货联系人:{{ formData.linkName }}
+
+          <!-- 联系电话:{{ formData.linkPhone }} -->
+        </span>
+        <!-- <span> 车牌号:{{ formData.carNo }} </span> -->
+      </div>
+      <table
+        cellspacing="0"
+        border
+        style="
+          width: 100%;
+          table-layout: fixed;
+          word-break: break-all;
+          word-wrap: break-word;
+          font-size: 12px;
+        "
+      >
+        <tbody>
+          <tr align="center">
+            <td style="padding: 5px; width: 35px"> 序号 </td>
+            <td style="padding: 5px;"> 车型 </td>
+            <td style="padding: 5px;"> 料号 </td>
+            <td style="padding: 5px; width: 50px"> 单位</td>
+            <td style="padding: 5px"> 交货数</td>
+            <td style="padding: 5px"> 实收数量</td>
+            <td style="padding: 5px"> 客户订单号</td>
+            <td style="padding: 5px"> 重量</td>
+            <td style="padding: 5px"> 工艺</td>
+            <td style="padding: 5px"> 备注</td>
+          </tr>
+
+          <tr align="center" v-for="(item, index) in formData.productList">
+            <td style="padding: 5px"> {{ index + 1 }} </td>
+            <td style="padding: 5px"> </td>
+            <td style="padding: 5px"> {{ item.productName }} </td>
+            <td style="padding: 5px">
+              {{ item.productCode }}
+            </td>
+            <td style="padding: 5px"> {{ item.productName }} </td>
+            <td style="padding: 5px"> {{ item.measuringUnit }}</td>
+            <td style="padding: 5px"> {{ item.totalCount }}</td>
+            <td style="padding: 5px"> {{ item.totalCount }}</td>
+            <td style="padding: 5px"> </td>
+            <td style="padding: 5px">{{ item.orderNo }} </td>
+            <td style="padding: 5px"> </td>
+          </tr>
+        </tbody>
+      </table>
+      <div
+        style="
+          width: 100%;
+          font-size: 12px;
+          display: flex;
+          justify-content: space-between;
+          margin-top: 10px;
+        "
+      >
+        <div style="flex: 1">
+          <div>发货人:</div>
+        </div>
+        <div style="flex: 1">
+          <div>送货人:</div>
+        </div>
+        <div style="flex: 1"> 收货人: </div>
+        <div style="flex: 1"> 托盘:{{   formData.trayNum }} </div>
+      
+      </div>
+    </div>
+
+    <div slot="footer">
+      <el-button @click="print">打印预览</el-button>
+      <el-button @click="close">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  // import { getSendSaleOrderrecordDetailSplit } from '@/api/saleManage/saleordersendrecord';
+  import { mapGetters } from 'vuex';
+  export default {
+    name: 'print',
+    computed: {
+      ...mapGetters(['user'])
+    },
+    props: {
+      groupName: ''
+    },
+    data() {
+      return {
+        checked: '',
+        QRvisible: false,
+        isPrintPrice: false,
+        formData: {},
+        outBound: {}
+      };
+    },
+
+    methods: {
+      async open(id) {
+        // this.formData = await getSendSaleOrderrecordDetailSplit(id);
+        this.QRvisible = true;
+        // let dataArray = await getInfoBySourceBizNoAll(this.formData.docNo);
+        // this.outBound = JSON.parse(JSON.stringify(dataArray[0]));
+        // this.outBound['outInDetailRecordRequestList'] = [];
+
+        // dataArray.forEach((item) => {
+        //   item.outInDetailList.forEach((val) => {
+        //     val['orderNo'] = item.orderNo;
+        //     if (val.outInDetailRecordRequestList.length) {
+        //       val.outInDetailRecordRequestList.forEach((j) => {
+        //         j['categoryName'] = val.categoryName;
+        //         j['categoryModel'] = val.categoryModel;
+        //         j['specification'] = val.specification;
+        //         j['categoryCode'] = val.categoryCode;
+        //         j['orderNo'] = item.orderNo;
+
+        //       });
+        //       this.outBound['outInDetailRecordRequestList'].push(
+        //         ...val.outInDetailRecordRequestList
+        //       );
+        //     } else {
+        //       this.outBound['outInDetailRecordRequestList'].push(val);
+        //     }
+        //   });
+        // });
+        //包装维度
+      },
+      close() {
+        this.QRvisible = false;
+      },
+
+      print() {
+        const printSection = document.getElementById('printSection');
+        // 创建打印任务
+        const printWindow = window.open('', '_blank');
+        printWindow.document.open();
+        printWindow.document.write('<html><head><title>打印预览</title>');
+        printWindow.document.write(
+          '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
+        );
+        printWindow.document.write('</head><body>');
+        printWindow.document.write(printSection.innerHTML);
+        printWindow.document.write('</body></html>');
+        printWindow.document.close();
+        printWindow.onload = function () {
+          printWindow.print();
+        };
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>

+ 179 - 0
src/views/warehouseManagement/inventoryAllocation/components/print-template-bs.vue

@@ -0,0 +1,179 @@
+<template>
+  <el-dialog
+    title="送货单详情"
+    :visible.sync="visible"
+    center
+    append-to-body
+    width="70%"
+    :close-on-click-modal="false"
+
+>
+
+    <div id="printSection">
+      <div style="text-align: center; padding-bottom: 20px;">
+        <h3 style="margin: 0; font-size: 20px; font-weight: 800;">送货单</h3>
+      </div>
+
+      <div style="margin-bottom: 15px; width: 100%;">
+        <div style="display: flex; margin-bottom: 8px; width: 100%;">
+          <div style="flex: 1; text-align: left;">客户名称:{{ infoData.customerName || '' }}</div>
+          <div style="flex: 1; text-align: left;">发货单号:{{ infoData.deliveryNumber || '' }}</div>
+        </div>
+        <div style="display: flex; margin-bottom: 8px;">
+          <div style="flex: 1; text-align: left;">发货日期:{{ infoData.deliveryDate || '' }}</div>
+          <div style="flex: 1; text-align: left;">联系人:{{ infoData.contactPerson || '' }}</div>
+        </div>
+        <div style="display: flex;">
+          <div style="flex: 1; text-align: left;">联系电话:{{ infoData.contactPhone || '' }}</div>
+        </div>
+      </div>
+
+      <table style="width: 100%; border-collapse: collapse; margin-bottom: 20px;">
+        <thead>
+          <tr>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center;" width="50px;">序号</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center;">型号</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center; width: 160px;">零件名</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center;">单位</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center;">送货数量</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center;">验收数量</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center;">备注</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center;">订单号</th>
+            <th style="border: 1px solid #000; padding: 8px; text-align: center;">加工工艺</th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr v-for="(item, index) in detailList" :key="index">
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ index + 1 }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.categoryModel || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.categoryName || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.measureUnit || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.measureQuantity || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.measureQuantity || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.remark || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.orderNumber || '' }}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ item.processingTechnology || '' }}</td>
+          </tr>
+          <tr style="height: 40px;">
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td colspan="2" style="border: 1px solid #000; padding: 8px; text-align: center;">合计</td>
+            <!-- <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td> -->
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ detailList.reduce((total, item) => total + Number(item.measureQuantity || 0), 0) || ''}}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;">{{ detailList.reduce((total, item) => total + Number(item.measureQuantity || 0), 0) || ''}}</td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+            <td style="border: 1px solid #000; padding: 8px; text-align: center;"></td>
+          </tr>
+        </tbody>
+      </table>
+
+      <div style="display: flex; margin-top: 20px; width: 100%;">
+        <div style="flex: 1;">发货人:{{ infoData.deliverer || '' }}</div>
+        <div style="flex: 1;">送货人:{{ infoData.carrier || '' }}</div>
+        <div style="flex: 1;">收货人:{{ infoData.receiver || '' }}</div>
+      </div>
+    </div>
+
+    <div
+      slot="footer"
+      style="text-align: right"
+    >
+      <el-button type="primary" @click="confirm">打印预览</el-button>
+      <el-button @click="cancel">返回</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import storageApi from '@/api/warehouseManagement/index.js';
+export default {
+  data () {
+    return {
+      visible: false,
+      row: {
+        customerName: '',
+        contactPerson: '',
+        contactPhone: '',
+        items: [{
+          model: '',
+          partName: '',
+          unit: '',
+          deliveryQuantity: '',
+          receivedQuantity: '',
+          remark: '',
+          orderNumber: '',
+          processingTechnology: '',
+        }],
+        deliverer: '',
+        carrier: '',
+        receiver: '',
+      },
+      detailList: [],
+      infoData: {},
+    }
+  },
+  computed: {
+
+  },
+  methods: {
+    async open (row) {
+      console.log('row', row)
+      this.row = row;
+      this.getData();
+      this.visible = true;
+    },
+    async getData() {
+      const res = await storageApi.getAllotDetailList({
+          applyId: this.row.id
+        });
+        const data = await storageApi.getAllotDetail(this.row.id);
+        this.infoData = data;
+        if (this.infoData.type == 1) {
+          // 库内调拨
+          /* this.infoData.auditStatus = 2; */
+          this.infoData.auditStatus = data.status;
+        } else {
+          // 库外调拨
+          this.infoData.auditStatus = data.status;
+        }
+        this.detailList = res.map((item) => {
+          return {
+            ...item,
+            categoryCode: this.infoData.categoryCode,
+            categoryName: this.infoData.categoryName,
+            brandNum: this.infoData.brandNum,
+            categoryModel: this.infoData.model,
+            specification: this.infoData.specification
+          };
+        });
+        console.log('infoData', this.infoData)
+        console.log('detailList', this.detailList)
+    },
+    confirm () {
+     const printSection = document.getElementById('printSection');
+      // 创建打印任务
+      const printWindow = window.open('', '_blank');
+      printWindow.document.open();
+      printWindow.document.write('<html><head><title>打印预览</title>');
+      printWindow.document.write(
+        '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
+      );
+      printWindow.document.write('</head><body>');
+      printWindow.document.write(printSection.innerHTML);
+      printWindow.document.write('</body></html>');
+      printWindow.document.close();
+      printWindow.onload = function () {
+        printWindow.print();
+      };
+    },
+    cancel () {
+      this.visible = false
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 18 - 1
src/views/warehouseManagement/inventoryAllocation/details.vue

@@ -39,6 +39,14 @@
                 }}</span>
               </el-form-item>
             </el-col>
+            <el-col :span="8">
+              <el-form-item label="列表维度">
+                <span>{{
+                  dimensionType.filter((item) => item.code == infoData.inventoryDimension)[0]
+                    ?.label
+                }}</span>
+              </el-form-item>
+            </el-col>
             <el-col :span="8">
               <el-form-item label="调出库">
                 <span>{{ infoData.sourceWarehouse }}</span>
@@ -145,16 +153,19 @@
               :show-overflow-tooltip="true"
             ></el-table-column>
             <el-table-column
+              v-if="infoData.inventoryDimension == 3"
               label="包装编码"
               prop="packageNo"
               :show-overflow-tooltip="true"
             ></el-table-column>
             <el-table-column
+              v-if="infoData.inventoryDimension == 3"
               label="包装数量"
               prop="packingQuantity"
               :show-overflow-tooltip="true"
             ></el-table-column>
             <el-table-column
+              v-if="infoData.inventoryDimension == 3"
               label="包装单位"
               prop="packingUnit"
               :show-overflow-tooltip="true"
@@ -164,6 +175,11 @@
               prop="measureQuantity"
               :show-overflow-tooltip="true"
             ></el-table-column>
+            <el-table-column
+              label="调拨数量"
+              prop="quantity"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
             <el-table-column
               label="计量单位"
               prop="measureUnit"
@@ -214,7 +230,7 @@
   } from '@/api/bpm/index';
   // import { getDetail } from '@/api/stockManagement/inventoryAllocation'
   import PageHeader from '@/components/PageHeader';
-  import { allocationType } from '@/utils/dict/warehouse';
+  import { allocationType, dimensionType } from '@/utils/dict/warehouse';
   import { useDictLabelFilter } from '@/utils/dict';
   import StatusStep from '@/components/StatusStep/index.vue';
 
@@ -223,6 +239,7 @@
     data() {
       return {
         allocationType,
+        dimensionType,
         auditStatus: [
           { code: 0, label: '未提交', class: 'danger-text' },
           { code: 1, label: '审核中', class: 'primary-text' },

+ 43 - 2
src/views/warehouseManagement/inventoryAllocation/index.vue

@@ -10,11 +10,20 @@
         :pageSize="20"
         :datasource="datasource"
         cache-key="systemRoleTable"
+        :selection.sync="selection"
       >
         <template v-slot:toolbar>
           <el-button icon="el-icon-plus" type="primary" @click="add"
             >新建</el-button
           >
+          <!-- <el-button :disabled="selection.length > 1" icon="el-icon-download" type="primary"  @click="printExl"
+            >打印送货单</el-button
+          > -->
+          <!-- v-if="$hasPermission('wms:inventoryAllocation:print1')" -->
+          <!-- <el-button :disabled="selection.length > 1" icon="el-icon-download" type="primary"  @click="printExl2"
+            >打印送货单</el-button
+          > -->
+          <!-- v-if="$hasPermission('wms:inventoryAllocation:print2')" -->
         </template>
         <!-- 单号链接 -->
         <template v-slot:allotCode="{ row }">
@@ -61,6 +70,9 @@
         </template>
       </ele-pro-table>
     </el-card>
+    <!-- 打印弹窗 -->
+    <printTemplateBs ref="printTemplateBsRef"></printTemplateBs>
+    <printTemplateBsCar ref="printTemplateBsCarRef"></printTemplateBsCar>
   </div>
 </template>
 
@@ -68,11 +80,15 @@
   import { allocationType } from '@/utils/dict/warehouse';
   import storageApi from '@/api/warehouseManagement/index.js';
   import InventorySearch from './components/inventory-search.vue';
+  import printTemplateBs from './components/print-template-bs.vue';
+  import printTemplateBsCar from './components/print-template-bs-car.vue';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
   import { pageRoles } from '@/api/system/role';
   export default {
     components: {
-      InventorySearch
+      InventorySearch,
+      printTemplateBs,
+      printTemplateBsCar 
     },
     data() {
       return {
@@ -93,6 +109,13 @@
             showOverflowTooltip: true,
             fixed: 'left'
           },
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            fixed: 'left'
+          },
           {
             prop: 'name',
             label: '调拨名称',
@@ -181,11 +204,29 @@
           }
         ],
         // 加载状态
-        loading: false
+        loading: false,
+        // 选中的行
+        selection: []
       };
     },
     computed: {},
     methods: {
+      printExl() {
+        console.log('selection', this.selection)
+        if (this.selection.length == 0) {
+          this.$message.warning('请选择要打印的记录');
+          return;
+        }
+        this.$refs.printTemplateBsRef.open(this.selection[0]);
+      },
+      printExl2() {
+        console.log('selection', this.selection)
+        if (this.selection.length == 0) {
+          this.$message.warning('请选择要打印的记录');
+          return;
+        }
+        this.$refs.printTemplateBsCarRef.open(this.selection[0]);
+      },
       // 删除
       async deleted(row) {
         const data = await storageApi.deleteAllot([row.id]);

+ 234 - 199
src/views/warehouseManagement/stockLedger/components/details/InventoryDetails.vue

@@ -1,206 +1,241 @@
 <!-- 入库 -->
 <template>
-    <div class="inWarehouse">
-        <ele-pro-table ref="table1" height="calc(100vh - 300px)" :columns="columns" :datasource="datasource"
-            :pageSize="20" row-key="id" :initLoad="false">
-        </ele-pro-table>
-    </div>
+  <div class="inWarehouse">
+    <ele-pro-table
+      ref="table1"
+      height="calc(100vh - 300px)"
+      :columns="columns"
+      :datasource="datasource"
+      :pageSize="20"
+      row-key="id"
+      :initLoad="false"
+    >
+      <template v-slot:toolbar>
+        <div style="display: flex; align-items: center">
+          列表维度:
+          <el-select
+            clearable
+            v-model="dimension"
+            @change="handleChange"
+            placeholder="请选择"
+            style="margin-left: 10px"
+          >
+            <el-option label="批次维度" :value="2"> </el-option>
+            <el-option label="包装维度" :value="3"> </el-option>
+          </el-select>
+        </div>
+      </template>
+    </ele-pro-table>
+  </div>
 </template>
 <script>
-import storageApi from '@/api/warehouseManagement/index.js';
-export default {
+  import storageApi from '@/api/warehouseManagement/index.js';
+  export default {
     props: {
-        categoryCode: {
-            type: String,
-            default: ''
-        }
+      categoryCode: {
+        type: String,
+        default: ''
+      }
     },
     data() {
-        return {
-            columns: [
-                {
-                    columnKey: 'index',
-                    type: 'index',
-                    width: 50,
-                    align: 'center',
-                    label: '序号',
-                    showOverflowTooltip: true,
-                    fixed: 'left'
-                },
-                {
-                    prop: 'batchNo',
-                    label: '批次号',
-                    align: 'center'
-                },
-                {
-                    prop: 'categoryCode',
-                    label: '物品编码',
-                    align: 'center',
-                    showOverflowTooltip: true
-                },
-                {
-                    slot: 'categoryName',
-                    prop: 'categoryName',
-                    label: '物品名称',
-                    align: 'center',
-                    showOverflowTooltip: true,
-                    minWidth: 200
-                },
-                {
-                    prop: 'inventoryCycle',
-                    label: '存货周期(天)',
-                    align: 'center',
-                    width: 120,
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'brandNum',
-                    label: '牌号',
-                    align: 'center',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'categoryModel',
-                    label: '型号',
-                    align: 'center',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'specification',
-                    label: '规格',
-                    align: 'center',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'level',
-                    label: '级别',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'measureQuantity',
-                    label: '计量数量',
-                    sortable: 'custom',
-                    showOverflowTooltip: true,
-                    width: 130,
-                    align: 'center'
-                },
-                {
-                    prop: 'measureUnit',
-                    label: '计量单位',
-                    align: 'center'
-                },
-                {
-                    prop: 'weight',
-                    label: '重量',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'weightUnit',
-                    label: '重量单位',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'packageNo',
-                    label: '包装编码',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'packingQuantity',
-                    label: '包装数量	',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'packingUnit',
-                    label: '包装单位	',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'warehouseName',
-                    label: '仓库	',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'areaName',
-                    label: '货区	',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'goodsAllocationName',
-                    label: '货架',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'goodsShelfName',
-                    label: '货位',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'productionDate',
-                    label: '生产日期',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'purchaseDate',
-                    label: '采购日期',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'barcodes',
-                    label: '发货条码	',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'clientCode',
-                    label: '客户代号',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'engrave',
-                    label: '刻码	',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'materielDesignation',
-                    label: '物料代号',
-                    width: 120,
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'supplierCode',
-                    label: '供应商代号',
-                    width: 120,
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'provenance',
-                    label: '产地',
-                    showOverflowTooltip: true
-                },
-            ]
-        }
+      return {
+        dimension: 3,
+        columns: [
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 50,
+            align: 'center',
+            label: '序号',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center'
+          },
+          {
+            prop: 'categoryCode',
+            label: '物品编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            slot: 'categoryName',
+            prop: 'categoryName',
+            label: '物品名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+          {
+            prop: 'inventoryCycle',
+            label: '存货周期(天)',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryModel',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'level',
+            label: '级别',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measureQuantity',
+            label: '计量数量',
+            sortable: 'custom',
+            showOverflowTooltip: true,
+            width: 130,
+            align: 'center'
+          },
+          {
+            prop: 'measureUnit',
+            label: '计量单位',
+            align: 'center'
+          },
+          {
+            prop: 'weight',
+            label: '重量',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'packageNo',
+            label: '包装编码',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'packingQuantity',
+            label: '包装数量	',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'packingUnit',
+            label: '包装单位	',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'warehouseName',
+            label: '仓库	',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'areaName',
+            label: '货区	',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'goodsAllocationName',
+            label: '货架',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'goodsShelfName',
+            label: '货位',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productionDate',
+            label: '生产日期',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'purchaseDate',
+            label: '采购日期',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'barcodes',
+            label: '发货条码	',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'clientCode',
+            label: '客户代号',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'engrave',
+            label: '刻码	',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'materielDesignation',
+            label: '物料代号',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'supplierCode',
+            label: '供应商代号',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'provenance',
+            label: '产地',
+            showOverflowTooltip: true
+          }
+        ]
+      };
     },
     created() {
-        this.reload({ keyWord: this.categoryCode });
+      this.reload({ keyWord: this.categoryCode });
     },
     methods: {
-        datasource({ page, limit, where }) {
-            const data = storageApi.getPackingList({ ...where, pageNum:page, size:limit });
-            return data;
-        },
-        reload(where) {
-            this.$nextTick(() => {
-                if (this.$refs.table1 && this.$refs.table1.reload)
-                    this.$refs.table1.reload({ pageNum: 1, where: where });
-            })
-        },
-
-
+      datasource({ page, limit, where }) {
+        let api =
+          this.dimension == '3'
+            ? storageApi.getPackingList
+            : storageApi.getBatchList;
+        const data = api({
+          ...where,
+          pageNum: page,
+          size: limit
+        });
+        return data;
+      },
+      handleChange() {
+        this.$refs.table1.reload({
+          pageNum: 1,
+          where: { keyWord: this.categoryCode }
+        });
+      },
+      reload(where) {
+        this.$nextTick(() => {
+          if (this.$refs.table1 && this.$refs.table1.reload)
+            this.$refs.table1.reload({ pageNum: 1, where: where });
+        });
+      }
     }
-}
+  };
 </script>
 
 <style lang="scss" scoped>
-.inWarehouse {
+  .inWarehouse {
     height: 100%;
     width: 100%;
     padding-top: 20px;
@@ -209,19 +244,19 @@ export default {
     flex-direction: column;
 
     :deep(.table) {
-        flex: 1;
-        display: flex;
-        flex-direction: column;
+      flex: 1;
+      display: flex;
+      flex-direction: column;
 
-        .el-table__body-wrapper {
-            flex: 1;
-        }
+      .el-table__body-wrapper {
+        flex: 1;
+      }
     }
 
     .pagination {
-        flex: 0 0 50px;
-        display: flex;
-        align-items: center;
+      flex: 0 0 50px;
+      display: flex;
+      align-items: center;
     }
-}
-</style>
+  }
+</style>

+ 14 - 5
src/views/warehouseManagement/stockLedger/components/item-list.vue

@@ -67,7 +67,7 @@
           >
           <exportButton
             fileName="库存台账"
-            apiUrl="/wms/statement/exportStockExcel"
+            :apiUrl="exportApiUrl"
             :params="params"
             v-if="selectedDime == 2"
           ></exportButton>
@@ -394,7 +394,12 @@
             align: 'center',
             showOverflowTooltip: true
           },
-
+          {
+            prop: 'colorKey',
+            label: '颜色',
+            align: 'center',
+            showOverflowTooltip: true
+          },
           {
             prop: 'level',
             label: '级别',
@@ -613,6 +618,9 @@
       },
       clientEnvironmentId() {
         return this.$store.state.user.info.clientEnvironmentId;
+      },
+      exportApiUrl() {
+        return '/wms/statement/exportStockExcel';
       }
     },
     methods: {
@@ -719,7 +727,7 @@
 
           if (key.includes(column.property)) {
             const values = data.map((item) => Number(item[column.property]));
-            console.log(values);
+            // console.log(values);
 
             if (!values.every((value) => isNaN(value))) {
               sums[index] = values.reduce((prev, curr) => {
@@ -740,7 +748,7 @@
             sums[index] = '';
           }
         });
-        console.log('sums', sums);
+        // console.log('sums', sums);
 
         return sums;
       },
@@ -915,6 +923,7 @@
       // 监听机构id变化
       current: {
         handler() {
+          console.log('this.current----', this.current);
           this.reload();
         }
       },
@@ -923,7 +932,7 @@
           if (this.type === 'warehouse') {
             this.selectedDime = '3';
           } else {
-            this.selectedDime = '1';
+            this.selectedDime = '2';
           }
           this.reload();
         }

+ 11 - 4
src/views/warehouseManagement/stockLedger/components/item-search.vue

@@ -68,7 +68,6 @@
                 <el-option
                   label="物品维度"
                   value="1"
-                  v-if="type === 'products'"
                 >
                 </el-option>
                 <el-option label="批次维度" value="2"> </el-option>
@@ -87,7 +86,7 @@
           <el-form-item label="关键词:" prop="keyWord">
             <el-input
               clearable
-              placeholder="请输入"
+              placeholder="物品编码/物品名称/批次号/规格/型号"
               v-model.trim="params.keyWord"
             ></el-input>
           </el-form-item>
@@ -160,6 +159,15 @@
             ></el-input>
           </el-form-item>
         </el-col>
+        <el-col :span="6">
+          <el-form-item label="批次号:" prop="batchNo">
+            <el-input
+              clearable
+              v-model="params.batchNo"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </el-col>
         <!-- <el-col v-if="dimension == 3 || dimension == 4" :span="6">
           <el-form-item label="客户代号:" prop="clientCode">
             <el-input
@@ -266,7 +274,7 @@
     watch: {
       type(val) {
         if (val === 'warehouse') {
-          this.dimension = '3';
+          this.dimension = '2';
         } else {
           this.dimension = '2';
         }
@@ -332,7 +340,6 @@
   .ele-form-actions {
     display: flex;
     align-items: center;
-    justify-content: flex-end;
   }
   :deep(.el-form-item) {
     margin-bottom: 5px !important;

+ 86 - 25
src/views/warehouseManagement/stockManagement/add.vue

@@ -256,7 +256,7 @@
               </template>
               <template v-slot:singleWeight="{ row, $index }">
                 <el-input
-                  :disabled="row.isSave"
+                  :disabled="row.isSave || row.weightUnit == row.packingUnit"
                   v-model="row.singleWeight"
                   placeholder="请输入"
                   :min="0"
@@ -264,13 +264,13 @@
                   @input="inputSingleWeight(row, $index)"
                 >
                   <template slot="append">
-                    {{ row.weightUnit + '/' + row.measureUnit }}
+                    {{ row.weightUnit }}
                   </template>
                 </el-input>
               </template>
               <template v-slot:weight="{ row, $index }">
                 <el-input
-                  :disabled="row.isSave"
+                  :disabled="row.isSave || row.weightUnit == row.packingUnit"
                   v-model="row.weight"
                   placeholder="请输入"
                   @input="inputAllweight(row, $index)"
@@ -1533,19 +1533,23 @@
         } else if (row.packingQuantity > 9999) {
           this.$set(this.productList[index], 'singleWeight', 9999);
         }
-        console.log(row.singleWeight);
-        console.log(row.measureQuantity);
+        if (row.measureUnit == row.weightUnit) {
+          row.weight = row.singleWeight * row.packingQuantity;
+          row.measureQuantity = row.weight;
+        } else {
+          row.weight = row.singleWeight * row.measureQuantity;
+        }
 
         //重量
-        if (row.measureType == '2') {
-          if (row.packingUnit == 'KG') {
-            const weight =
-              Number(row.measureQuantity) * Number(row.singleWeight);
-            this.$set(this.productList[index], 'weight', weight);
-          } else {
-            this.$set(this.productList[index], 'weight', measureQuantity);
-          }
-        }
+        // if (row.measureType == '2') {
+        //   if (row.packingUnit == 'KG') {
+        //     const weight =
+        //       Number(row.measureQuantity) * Number(row.singleWeight);
+        //     this.$set(this.productList[index], 'weight', weight);
+        //   } else {
+        //     this.$set(this.productList[index], 'weight', measureQuantity);
+        //   }
+        // }
 
         console.log(row, 'row2');
       },
@@ -1553,8 +1557,17 @@
         if (row.weight < 0) {
           this.$set(this.productList[index], 'weight', 1);
         }
-        const singleWeight = Number(row.weight) / Number(row.measureQuantity);
-        this.$set(this.productList[index], 'singleWeight', singleWeight);
+        if (row.measureUnit == row.weightUnit) {
+          row.measureQuantity = row.weight;
+          row.singleWeight =
+            Math.trunc((row.measureQuantity / row.packingQuantity) * 100) / 100;
+        } else {
+          row.singleWeight = row.measureQuantity
+            ? row.weight / row.measureQuantity
+            : 0;
+        }
+        // const singleWeight = Number(row.weight) / Number(row.measureQuantity);
+        // this.$set(this.productList[index], 'singleWeight', singleWeight);
       },
       // 仓库选择
       // wareHouseSelection(val, index) {
@@ -1580,6 +1593,8 @@
       },
       async computeNum(row, index, isClear) {
         row.packingQuantity = this.format3(row.packingQuantity);
+        console.log(row.packingSpecificationOption);
+        console.log(row.packingUnit);
 
         let data = row.packingSpecificationOption.find(
           (item) => item.id == row.packingUnitId
@@ -1648,6 +1663,9 @@
           let weight = 0;
           if (row.measureUnit == row.weightUnit) {
             weight = row.measureQuantity;
+            row.singleWeight =
+              Math.trunc((row.measureQuantity / row.packingQuantity) * 100) /
+              100;
           } else if (row.singleWeight) {
             weight = row.measureQuantity * Number(row.singleWeight);
           }
@@ -2960,11 +2978,33 @@
                 ]);
               }
             } else {
-              // let pNum =
-              let pNum = Math.ceil(
-                row.measureQuantity /
-                  row.packingSpecificationOption[1]?.packageCell
-              );
+              let pNum = 0;
+              if (row.packingUnitId) {
+                let splitIndex = row.packingSpecificationOption.findIndex(
+                  (item) => item.id == row.packingUnitId
+                );
+                if (splitIndex == 0) {
+                  pNum = Math.ceil(
+                    row.measureQuantity /
+                      row.packingSpecificationOption[1]?.packageCell
+                  );
+                }
+                if (splitIndex == 1) {
+                  pNum = row.packingQuantity;
+                }
+
+                for (; splitIndex > 1; splitIndex--) {
+                  pNum = Math.ceil(
+                    row.packingQuantity *
+                      row.packingSpecificationOption[splitIndex].packageCell
+                  );
+                }
+              } else {
+                pNum = Math.ceil(
+                  row.measureQuantity /
+                    row.packingSpecificationOption[1]?.packageCell
+                );
+              }
               // row.packingQuantity;
               // console.log(row.packingQuantity,'row.packingQuantity')
               // return
@@ -3247,7 +3287,13 @@
                       this.$math.format(filterArr[0].packageCell * index, 14);
               }
             } else {
-              measureQuantity = row.packingSpecificationOption[1].packageCell;
+              //计量单位等于重量单位并且有总重 计量数量=总重/包装数
+              if (row.weightUnit == row.measureUnit && row.weight) {
+                measureQuantity =
+                  Math.trunc((row.weight / packingCodeList.length) * 100) / 100;
+              } else {
+                 measureQuantity = row.packingSpecificationOption[1].packageCell;
+              }
             }
             console.log(
               'meadasdassureQuantity',
@@ -3407,11 +3453,26 @@
 
         const lastIndex = this.packingList.length - 1;
 
-        let remainder =
-          row.measureQuantity % row.packingSpecificationOption[1]?.packageCell;
+        let remainder = 0;
+        if (row.weightUnit != row.measureUnit) {
+          remainder =
+            row.measureQuantity %
+            row.packingSpecificationOption[1]?.packageCell;
+        }
         console.log(remainder, 'remainder');
         if (remainder > 0) {
-          this.$set(this.packingList[lastIndex], 'measureQuantity', remainder);
+          let onlyCode = packingCodeList[packingCodeList.length - 1]?.onlyCode;
+          let index = this.packingList.findIndex(
+            (packingItem) => packingItem.packageNo == onlyCode
+          );
+          this.$set(this.packingList[index], 'measureQuantity', remainder);
+          if (row.singleWeight) {
+            this.$set(
+              this.packingList[index],
+              'weight',
+              row.singleWeight * remainder
+            );
+          }
         }
       },
       //入库明细删除

+ 1 - 0
src/views/warehouseManagement/stockManagement/components/selectType.vue

@@ -73,6 +73,7 @@
             :cache-key="cacheKeyUrl"
             :page-size="20"
             row-key="id"
+            :initLoad="false"
           ></ele-pro-table>
           <!-- <el-table ref="multipleTable" :data="tableData" border tooltip-effect="dark" height="455px"
             style="width: 100%" :header-cell-style="{ background: '#F0F3F3', border: 'none' }"

+ 22 - 1
src/views/warehouseManagement/stockManagement/details.vue

@@ -92,6 +92,11 @@
                   >
                 </el-form-item>
               </el-col>
+              <el-col :span="24">
+                <el-form-item label="生产要求:">
+                  <span>{{ infoData.productionRequirements }}</span>
+                </el-form-item>
+              </el-col>
               <el-col :span="24">
                 <el-form-item label="备注:">
                   <span>{{ infoData.remark }}</span>
@@ -200,6 +205,16 @@
               prop="packingUnit"
             >
             </el-table-column>
+            <el-table-column
+              label="允许拆包"
+              prop="isUnpack"
+              width="100"
+              align="center"
+            >
+              <template slot-scope="{ row }">
+                {{ row.isUnpack == 1 ? '是' : '否' }}
+              </template>
+            </el-table-column>
             <el-table-column
               label="计量数量"
               prop="measureQuantity"
@@ -209,6 +224,13 @@
             </el-table-column>
             <el-table-column label="计量单位" prop="measureUnit" align="center">
             </el-table-column>
+                       <el-table-column
+                label="生产要求"
+                align="center"
+                width="200"
+                prop="productionRequirements"
+                :show-overflow-tooltip="true"
+              ></el-table-column>
             <el-table-column
               label="单重"
               prop="singleWeight"
@@ -594,7 +616,6 @@
                   @click="handleWareHouse(row, $index, '包装')"
                   >上架</el-button
                 >
-                {{ row.areaId }}
               </template>
             </el-table-column>
           </el-table>

+ 1 - 1
src/views/warehouseManagement/stocktaking/plan/components/assignDialog.vue

@@ -49,7 +49,7 @@
               <el-form-item label="执行人员" prop="executorId">
                 <el-select
                   v-model="formData.executorId"
-                  @changeExecutor="executorChange"
+                  @change="executorChange"
                   size="small"
                   style="width: 100%"
                   filterable

+ 10 - 8
src/views/warehouseManagement/stocktaking/reportLoss/components/addReportDialog.vue

@@ -259,14 +259,16 @@
       </el-table>
       <div v-if="addForm.status != 0" style="height: 350px">
         <HeaderTitle title="流程图" size="16px"></HeaderTitle>
-        <my-process-viewer
-          key="designer"
-          v-model="bpmnXML"
-          v-bind="bpmnControlForm"
-          :activityData="activityList"
-          :processInstanceData="processInstance"
-          :taskData="tasks"
-        />
+        <div style="height: calc(100% - 40px);">
+          <my-process-viewer
+            key="designer"
+            v-model="bpmnXML"
+            v-bind="bpmnControlForm"
+            :activityData="activityList"
+            :processInstanceData="processInstance"
+            :taskData="tasks"
+          />
+        </div>
       </div>
     </el-form>
     <div v-if="!isBindPlan" slot="footer">

+ 293 - 244
src/views/warehouseManagement/warehouseDefinition/components/WarehouseEdit.vue

@@ -27,6 +27,23 @@
           maxlength="16"
         ></el-input>
       </el-form-item>
+      <el-form-item label="物品类型" prop="warehouseType">
+        <el-select
+          filterable
+          size="small"
+          class="w100"
+          v-model="formData.warehouseType"
+          placeholder="物品类型"
+          :clearable="true"
+        >
+          <el-option
+            v-for="item in warehousetypeList"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item label="仓库类型" prop="inventoryType">
         <!-- <DictSelection
           dictName="仓库类型"
@@ -108,6 +125,11 @@
         <el-cascader
           size="small"
           class="w100"
+          :props="{
+            value: 'label',
+            label: 'label',
+            children: 'children'
+          }"
           v-model="formData.location"
           :options="locationOptions"
           @change="changeLocation"
@@ -159,131 +181,81 @@
 </template>
 
 <script>
-  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
 
-  // import selectTree from '@/components/selectTree';
-  import DeptSelect from '@/components/CommomSelect/new-dept-select.vue';
+// import selectTree from '@/components/selectTree';
+import DeptSelect from '@/components/CommomSelect/new-dept-select.vue';
 
-  import city from '@/assets/js/city';
-  // import user from '@/api/main/user';
+import { getByCode } from '@/api/system/dictionary-data';
+// import city from '@/assets/js/city';
+import { cityData } from 'ele-admin/packages/utils/regions';
+// import user from '@/api/main/user';
 
-  export default {
-    components: { DeptSelect },
-    data() {
-      return {
-        visible: false,
-        loading: false,
-        formData: {
-          code: '',
-          name: '',
-          inventoryType: [],
-          inventoryName: [],
-          remarks: '',
-          factoryId: '',
-          status: 1,
-          lockStatus: 0,
-          ownerId: '',
-          departmentId: '',
-          contact: '',
-
-        },
-        rules: {
-          code: [
-            { required: true, message: '请输入仓库编码', trigger: 'blur' }
-          ],
-          name: [
-            { required: true, message: '请输入仓库名称', trigger: 'blur' }
-          ],
-          inventoryType: [
-            { required: true, message: '请选择仓库类型', trigger: 'blur' }
-          ],
-          factoryId: [
-            { required: true, message: '请选择工厂名称', trigger: 'blur' }
-          ],
-          departmentId: [
-            { required: true, message: '请选择权属部门', trigger: 'change' }
-          ],
-          ownerId: [
-            { required: true, message: '请选择权属人', trigger: 'change' }
-          ]
-          // status: [
-          //   { required: true, message: '请选择仓库状态', trigger: 'blur' }
-          // ]
-        },
-        type: '新建',
-        userList: [],
-        deptList: [], //部门集合
-        inventoryTypeList: [],
-        factoryList: [], //工厂集合
-        locationOptions: city,
-        loadingVis: false
-      };
-    },
-    watch: {
-      visible: {
-        handler(val) {
-          if (val) {
-            // this.init();
-          }
-        }
+export default {
+  components: { DeptSelect },
+  data() {
+    return {
+      visible: false,
+      loading: false,
+      formData: {
+        code: '',
+        name: '',
+        inventoryType: [],
+        inventoryName: [],
+        remarks: '',
+        factoryId: '',
+        status: 1,
+        lockStatus: 0,
+        ownerId: '',
+        departmentId: '',
+        contact: '',
+        warehouseType: ''
       },
-      loadingVis: {
-        handler(val) {
-          console.log(val);
-          if (!val && this.type == '新建') {
-            this.formData = {
-              code: '',
-              name: '',
-              inventoryType: [],
-              inventoryName: [],
-              remarks: '',
-              factoryId: '',
-              status: 1,
-              lockStatus: 0,
-              ownerId: '',
-              departmentId: ''
-            };
-          }
+      warehousetypeList: [],
+      rules: {
+        code: [{ required: true, message: '请输入仓库编码', trigger: 'blur' }],
+        name: [{ required: true, message: '请输入仓库名称', trigger: 'blur' }],
+        inventoryType: [
+          { required: true, message: '请选择仓库类型', trigger: 'blur' }
+        ],
+        factoryId: [
+          { required: true, message: '请选择工厂名称', trigger: 'blur' }
+        ],
+        departmentId: [
+          { required: true, message: '请选择权属部门', trigger: 'change' }
+        ],
+        ownerId: [
+          { required: true, message: '请选择权属人', trigger: 'change' }
+        ],
+        warehouseType: [
+          { required: true, message: '请选择物品类型', trigger: 'change' }
+        ]
+        // status: [
+        //   { required: true, message: '请选择仓库状态', trigger: 'blur' }
+        // ]
+      },
+      type: '新建',
+      userList: [],
+      deptList: [], //部门集合
+      inventoryTypeList: [],
+      factoryList: [], //工厂集合
+      locationOptions: cityData,
+      loadingVis: false
+    };
+  },
+  watch: {
+    visible: {
+      handler(val) {
+        if (val) {
+          // this.init();
         }
       }
     },
-    created() {},
-    methods: {
-      async open(type, row) {
-        console.log(type);
-        this.type = type;
-        this.visible = true;
-        this.init();
-        if (type === '修改') {
-          console.log(1);
-          this.loadingVis = true;
-          this.$nextTick(async () => {
-            setTimeout(async () => {
-              const { warehouseVO } = await warehouseDefinition.warehouseDetail(
-                row.id
-              );
-              if (warehouseVO.departmentId) {
-                let userData = await warehouseDefinition.getUserPage({
-                  groupId: warehouseVO.departmentId,
-                  size: 9999,
-                  pageNum: 1
-                });
-                this.userList = userData.list;
-              }
-              this.formData = {
-                ...warehouseVO,
-                location: [
-                  warehouseVO.province,
-                  warehouseVO.city,
-                  warehouseVO.area
-                ],
-                inventoryType: warehouseVO.inventoryType.split(','),
-                inventoryName: warehouseVO.inventoryName.split(',')
-              };
-              this.loadingVis = false;
-            }, 2000);
-          });
-        } else {
+
+    loadingVis: {
+      handler(val) {
+        console.log(val);
+        if (!val && this.type == '新建') {
           this.formData = {
             code: '',
             name: '',
@@ -297,152 +269,229 @@
             departmentId: ''
           };
         }
+      }
+    }
+  },
+  created() {
+    this.getwarehousetypeCode('warehouse_type');
+  },
+  methods: {
+    async getwarehousetypeCode(code) {
+      console.log(code);
+      try {
+        const res = await getByCode(code);
+        if (res.code == 0) {
+          let list = Object.values(res.data).map((el) => {
+            let k = Object.keys(el)[0];
+            let v = Object.values(el)[0];
+            return { label: v, value: k };
+          });
+          this.warehousetypeList = list;
+          console.log(this.warehousetypeList);
+        }
+      } catch (err) {
+        this.$message.error(err.message);
+      }
+    },
+    async open(type, row) {
+      console.log(type);
+      this.type = type;
+      this.visible = true;
+      this.init();
+      console.log('locationOptions', this.locationOptions);
+      if (type === '修改') {
+        console.log(1);
+        this.loadingVis = true;
+        this.$nextTick(async () => {
+          setTimeout(async () => {
+            const { warehouseVO } = await warehouseDefinition.warehouseDetail(
+              row.id
+            );
+            if (warehouseVO.departmentId) {
+              let userData = await warehouseDefinition.getUserPage({
+                groupId: warehouseVO.departmentId,
+                size: 9999,
+                pageNum: 1
+              });
+              this.userList = userData.list;
+            }
+            this.formData = {
+              ...warehouseVO,
+              location: [
+                warehouseVO.province,
+                warehouseVO.city,
+                warehouseVO.area
+              ],
+              inventoryType: warehouseVO.inventoryType.split(','),
+              inventoryName: warehouseVO.inventoryName.split(',')
+            };
+            this.loadingVis = false;
+          }, 2000);
+        });
+      } else {
+        this.formData = {
+          code: '',
+          name: '',
+          inventoryType: [],
+          inventoryName: [],
+          remarks: '',
+          factoryId: '',
+          status: 1,
+          lockStatus: 0,
+          ownerId: '',
+          departmentId: ''
+        };
+      }
 
-        // if (type === '新建') {
-        //   let num = 1
-        //   const res = await warehouseList()
-        //   if (res?.success && res.data?.length) {
-        //     num = +res.data[0].code.substr(1) + 1
-        //   }
-        // this.formData.code = 'A' + pushZero(num)
-        // }
-      },
-      async init() {
-        // org.tree().then((tree) => {
-        //   if (tree?.success) {
-        //     this.deptList = tree.data;
-        //   }
-        // });
-        // const tree = await warehouseDefinition.tree();
+      // if (type === '新建') {
+      //   let num = 1
+      //   const res = await warehouseList()
+      //   if (res?.success && res.data?.length) {
+      //     num = +res.data[0].code.substr(1) + 1
+      //   }
+      // this.formData.code = 'A' + pushZero(num)
+      // }
+    },
+    async init() {
+      // org.tree().then((tree) => {
+      //   if (tree?.success) {
+      //     this.deptList = tree.data;
+      //   }
+      // });
+      // const tree = await warehouseDefinition.tree();
 
-        // this.deptList = this.$util.toTreeData({
-        //   data: tree,
-        //   idField: 'id',
-        //   parentIdField: 'parentId'
-        // });
+      // this.deptList = this.$util.toTreeData({
+      //   data: tree,
+      //   idField: 'id',
+      //   parentIdField: 'parentId'
+      // });
 
-        //获取工厂车间列表
-        const res = await warehouseDefinition.getFactoryarea({
-          pageNum: 1,
-          size: 9999,
-          type: 1
-        });
+      //获取工厂车间列表
+      const res = await warehouseDefinition.getFactoryarea({
+        pageNum: 1,
+        size: 9999,
+        type: 1
+      });
 
-        // let data = org.factorys({ status: true });
-        this.factoryList = res.list;
+      // let data = org.factorys({ status: true });
+      this.factoryList = res.list;
 
-        const res2 = await warehouseDefinition.getTreeByGroup({ type: 2 });
-        this.inventoryTypeList = res2;
-      },
-      changeInventoryType(val) {
-        console.log(val, '1');
-        // 根据选中的仓库类型ID数组,获取对应的名称数组
-        const inventoryNames = val.map(typeId => {
-          const item = this.inventoryTypeList.find(item => item.id === typeId);
+      const res2 = await warehouseDefinition.getTreeByGroup({ type: 2 });
+      this.inventoryTypeList = res2;
+    },
+    changeInventoryType(val) {
+      console.log(val, '1');
+      // 根据选中的仓库类型ID数组,获取对应的名称数组
+      const inventoryNames = val
+        .map((typeId) => {
+          const item = this.inventoryTypeList.find(
+            (item) => item.id === typeId
+          );
           return item ? item.name : '';
-        }).filter(name => name !== '');
-        
-        this.formData.inventoryName = inventoryNames;
-        console.log('仓库类型名称数组:', this.formData.inventoryName);
-      },
+        })
+        .filter((name) => name !== '');
+
+      this.formData.inventoryName = inventoryNames;
+      console.log('仓库类型名称数组:', this.formData.inventoryName);
+    },
 
-      handleSave() {
-        this.$refs.formRef.validate(async (value) => {
-          if (value) {
-            let params = Object.assign(this.formData);
-            params.inventoryType = params.inventoryType.join(',');
-            params.inventoryName = params.inventoryName.join(',');
+    handleSave() {
+      this.$refs.formRef.validate(async (value) => {
+        if (value) {
+          let params = Object.assign(this.formData);
+          params.inventoryType = params.inventoryType.join(',');
+          params.inventoryName = params.inventoryName.join(',');
 
-            // if (params.location?.length) {
-            //   const [province, city, area] = params.location;
+          // if (params.location?.length) {
+          //   const [province, city, area] = params.location;
 
-            //   Object.assign(params, {
-            //     province,
-            //     city,
-            //     area
-            //   });
-            // }
-            // delete params.location;
-            // console.log(params);
+          //   Object.assign(params, {
+          //     province,
+          //     city,
+          //     area
+          //   });
+          // }
+          // delete params.location;
+          // console.log(params);
 
-            this.loading = true;
-            const res = await warehouseDefinition
-              .saveOrUpdateWarehouse(params)
-              .finally(() => (this.loading = false));
-            if (res.data?.code == '0') {
-              this.$message.success('保存成功!');
-              this.$emit('success');
-              this.cancel();
-            }
+          this.loading = true;
+          const res = await warehouseDefinition
+            .saveOrUpdateWarehouse(params)
+            .finally(() => (this.loading = false));
+          if (res.data?.code == '0') {
+            this.$message.success('保存成功!');
+            this.$emit('success');
+            this.cancel();
           }
-        });
-      },
-      cancel() {
-        this.$refs.formRef.resetFields();
-        // this.$refs.tree.clearHandle();
-        this.visible = false;
-      },
-      async nodeClick(id, data) {
-        // this.formData.departmentCode = data?.code;
-        this.formData.departmentId = id;
-        if (data) {
-          this.formData.departmentName = data.name;
-        }
-        this.formData.ownerName = '';
-        this.formData.ownerId = '';
-        if (id) {
-          let userData = await warehouseDefinition.getUserPage({
-            groupId: id,
-            size: 9999,
-            pageNum: 1
-          });
-          this.userList = userData.list;
         }
-      },
-      changeOwner(val) {
-        this.formData.ownerId = val;
-        let user = this.userList.find((item) => {
-          return item.id == val;
+      });
+    },
+    cancel() {
+      this.$refs.formRef.resetFields();
+      // this.$refs.tree.clearHandle();
+      this.visible = false;
+    },
+    async nodeClick(id, data) {
+      // this.formData.departmentCode = data?.code;
+      this.formData.departmentId = id;
+      if (data) {
+        this.formData.departmentName = data.name;
+      }
+      this.formData.ownerName = '';
+      this.formData.ownerId = '';
+      if (id) {
+        let userData = await warehouseDefinition.getUserPage({
+          groupId: id,
+          size: 9999,
+          pageNum: 1
         });
-        console.log(user);
+        this.userList = userData.list;
+      }
+    },
+    changeOwner(val) {
+      this.formData.ownerId = val;
+      let user = this.userList.find((item) => {
+        return item.id == val;
+      });
+      console.log(user);
 
-        this.formData.ownerName = user.name;
+      this.formData.ownerName = user.name;
 
-        this.formData.contact = user.phone;
+      this.formData.contact = user.phone;
 
-        // this.$nextTick(() => {
-        //   this.$forceUpdate();
-        // });
-        // this.$set(this.formData, 'ownerId', val);
-        // this.$set(
-        //   this.formData,
-        //   'ownerName',
-        //   this.userList.find((item) => {
-        //     return item.id == val;
-        //   }).name
-        // );
-        // console.log(this.formData);
-        // this.$forceUpdate();
-      },
-      changeLocation(val) {
-        console.log(val, '1');
-        this.$set(this.formData, 'province', val[0]); //省
-        this.$set(this.formData, 'city', val[1]); //市
-        this.$set(this.formData, 'area', val[2]); //区
-        delete this.formData.location;
-      }
+      // this.$nextTick(() => {
+      //   this.$forceUpdate();
+      // });
+      // this.$set(this.formData, 'ownerId', val);
+      // this.$set(
+      //   this.formData,
+      //   'ownerName',
+      //   this.userList.find((item) => {
+      //     return item.id == val;
+      //   }).name
+      // );
+      // console.log(this.formData);
+      // this.$forceUpdate();
+    },
+    changeLocation(val) {
+      console.log(val, '1~~~');
+      this.$set(this.formData, 'province', val[0]); //省
+      this.$set(this.formData, 'city', val[1]); //市
+      this.$set(this.formData, 'area', val[2]); //区
+      // delete this.formData.location;
     }
-  };
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-  ::v-deep .el-form {
-    .el-form-item {
-      margin-bottom: 20px;
-    }
+::v-deep .el-form {
+  .el-form-item {
+    margin-bottom: 20px;
   }
+}
 
-  .el-divider--horizontal {
-    margin: 0 !important;
-  }
+.el-divider--horizontal {
+  margin: 0 !important;
+}
 </style>

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov