liuying
2024-04-23 96294e88135f07c1c3794c9dc2224bd7ca3ab986
物料信息
已添加16个文件
已重命名3个文件
已修改9个文件
已复制2个文件
已删除3个文件
6044 ■■■■ 文件已修改
iWare_RawMaterialWarehouse_Web/src/components/Editor/WangEditor.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsContainerPackaging/addForm.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsContainerPackaging/editForm.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsContainerPackaging/index.vue 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/addForm.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/addFormContainerPackaging.vue 246 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/editForm.vue 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/excelForm.vue 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/index.vue 523 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/addForm.vue 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/detail.vue 604 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/details.vue 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/editForm.vue 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/excelForm.vue 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/index.vue 512 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/addForm.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/addFormWmsSubstituteGood.vue 285 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/editForm.vue 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/excelForm.vue 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/index.vue 547 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/addForm.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/addFormBaseCustomer.vue 205 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/editForm.vue 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/excelForm.vue 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/index.vue 717 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsMaterial/addForm.vue 260 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsMaterial/editForm.vue 263 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/views/main/WmsMaterial/index.vue 349 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/Dto/WmsContainerPackagingInput.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/Dto/WmsContainerPackagingOutput.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/WmsContainerPackagingService.cs 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsContainerPackagingImport.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
iWare_RawMaterialWarehouse_Web/src/components/Editor/WangEditor.vue
@@ -103,7 +103,7 @@
        this.editor.create() // ç”Ÿæˆç¼–辑器
        this.editor.txt.text(this.value) // ç”Ÿæˆç¼–辑器
        this.$emit('oninit', this.editor)
        this.$emit('ok', this.editor)
      }
    },
    beforeCreate () {
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsContainerPackaging/addForm.vue
@@ -9,22 +9,22 @@
    <a-spin :spinning="confirmLoading">
        <a-form :form="form">
        <a-form-item label="容器类型ID" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入容器类型ID" v-decorator="['containerTypeId']" />
          <a-input placeholder="请输入容器类型ID" v-decorator="['containerTypeId', {rules: [{required: true, message: '请输入容器类型ID!'}]}]" />
        </a-form-item>
        <a-form-item label="容器类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入容器类型名称" v-decorator="['containerTypeName']" />
          <a-input placeholder="请输入容器类型名称" v-decorator="['containerTypeName', {rules: [{required: true, message: '请输入容器类型名称!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型ID" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型ID" v-decorator="['materialTypeId']" />
          <a-input placeholder="请输入物料类型ID" v-decorator="['materialTypeId', {rules: [{required: true, message: '请输入物料类型ID!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型编号" v-decorator="['materialTypeCode']" />
          <a-input placeholder="请输入物料类型编号" v-decorator="['materialTypeCode', {rules: [{required: true, message: '请输入物料类型编号!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型名称" v-decorator="['materialTypeName']" />
          <a-input placeholder="请输入物料类型名称" v-decorator="['materialTypeName', {rules: [{required: true, message: '请输入物料类型名称!'}]}]" />
        </a-form-item>
        <a-form-item label="物料容器容量" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料容器容量" v-decorator="['boxQty']" />
          <a-input placeholder="请输入物料容器容量" v-decorator="['boxQty', {rules: [{required: true, message: '请输入物料容器容量!'}]}]" />
        </a-form-item>
      </a-form>
    </a-spin>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsContainerPackaging/editForm.vue
@@ -9,22 +9,22 @@
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-form-item label="容器类型ID" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入容器类型ID" v-decorator="['containerTypeId']" />
          <a-input placeholder="请输入容器类型ID" v-decorator="['containerTypeId', {rules: [{required: true, message: '请输入容器类型ID!'}]}]" />
        </a-form-item>
        <a-form-item label="容器类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入容器类型名称" v-decorator="['containerTypeName']" />
          <a-input placeholder="请输入容器类型名称" v-decorator="['containerTypeName', {rules: [{required: true, message: '请输入容器类型名称!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型ID" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型ID" v-decorator="['materialTypeId']" />
          <a-input placeholder="请输入物料类型ID" v-decorator="['materialTypeId', {rules: [{required: true, message: '请输入物料类型ID!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型编号" v-decorator="['materialTypeCode']" />
          <a-input placeholder="请输入物料类型编号" v-decorator="['materialTypeCode', {rules: [{required: true, message: '请输入物料类型编号!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型名称" v-decorator="['materialTypeName']" />
          <a-input placeholder="请输入物料类型名称" v-decorator="['materialTypeName', {rules: [{required: true, message: '请输入物料类型名称!'}]}]" />
        </a-form-item>
        <a-form-item label="物料容器容量" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料容器容量" v-decorator="['boxQty']" />
          <a-input placeholder="请输入物料容器容量" v-decorator="['boxQty', {rules: [{required: true, message: '请输入物料容器容量!'}]}]" />
        </a-form-item>
        <a-form-item v-show="false"><a-input v-decorator="['id']" /></a-form-item>
      </a-form>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsContainerPackaging/index.vue
@@ -158,14 +158,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
    }
    }
    },
@@ -178,14 +178,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
    }
    }
    },
@@ -198,14 +198,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
    }
    }
    },
@@ -218,14 +218,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
    }
    }
    },
@@ -238,14 +238,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
    }
    }
    },
@@ -258,14 +258,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '130px'//最小列宽设置
    }
    }
    },
@@ -278,14 +278,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '120px'//最小列宽设置
    }
    }
    },
@@ -298,14 +298,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '120px'//最小列宽设置
    }
    }
    },
@@ -318,14 +318,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '120px'//最小列宽设置
    }
    }
    },
@@ -338,14 +338,14 @@
    customHeaderCell: () => {
    return {
     style: {
    'min-width': ''//最小列宽设置
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': ''//最小列宽设置
    'min-width': '120px'//最小列宽设置
    }
    }
    },
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue
@@ -14,7 +14,7 @@
         <add-form ref="addForm" @ok="handleOk" />
        </a-tab-pane>
        <a-tab-pane key="2" tab="控制属性" force-render>
          Content of Tab Pane 2
          <add-control-rule ref="WmsControlRule" @ok="handleOk" />
        </a-tab-pane>
        <a-tab-pane key="3" tab="批次属性">
          éœ€æ±‚待定
@@ -38,16 +38,18 @@
<script>
import { WmsMaterialAdd, GetAreas, GetStations } from '@/api/modular/main/WmsMaterialManage'
import addForm from './tabItem/addForm.vue'
import addFormBaseCustomer from './tabItem/addFormBaseCustomer.vue'
import addFormContainerPackaging from './tabItem/addFormContainerPackaging.vue'
import addFormSub from './tabItem/addFormWmsSubstituteGood.vue'
import addFormBaseCustomer from './tabItem/addFormBaseCustomer/addFormBaseCustomer.vue'
import addFormContainerPackaging from './tabItem/WmsContainerPackaging/addFormContainerPackaging.vue'
import addFormSub from './tabItem/WmsSubstituteGood/addFormWmsSubstituteGood.vue'
import addControlRule from './tabItem/WmsControlRule/index.vue'
export default {
  components: {
    addForm,
    addFormBaseCustomer,
    addFormContainerPackaging,
    addFormSub
    addFormSub,
    addControlRule
  },
  data() {
    return {
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/addForm.vue
ÎļþÃû´Ó iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormContainerPackaging.vue ÐÞ¸Ä
@@ -1,25 +1,34 @@
<template>
  <!-- åŒ…装关系基础表 -->
  <a-form :form="form">
  <a-modal
    title="新增包装关系基础表"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
        <a-form :form="form">
        <a-form-item label="容器类型ID" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入容器类型ID" v-decorator="['containerTypeId']" />
          <a-input placeholder="请输入容器类型ID" v-decorator="['containerTypeId', {rules: [{required: true, message: '请输入容器类型ID!'}]}]" />
        </a-form-item>
        <a-form-item label="容器类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入容器类型名称" v-decorator="['containerTypeName']" />
          <a-input placeholder="请输入容器类型名称" v-decorator="['containerTypeName', {rules: [{required: true, message: '请输入容器类型名称!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型ID" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型ID" v-decorator="['materialTypeId']" />
          <a-input placeholder="请输入物料类型ID" v-decorator="['materialTypeId', {rules: [{required: true, message: '请输入物料类型ID!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型编号" v-decorator="['materialTypeCode']" />
          <a-input placeholder="请输入物料类型编号" v-decorator="['materialTypeCode', {rules: [{required: true, message: '请输入物料类型编号!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型名称" v-decorator="['materialTypeName']" />
          <a-input placeholder="请输入物料类型名称" v-decorator="['materialTypeName', {rules: [{required: true, message: '请输入物料类型名称!'}]}]" />
        </a-form-item>
        <a-form-item label="物料容器容量" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料容器容量" v-decorator="['boxQty']" />
          <a-input placeholder="请输入物料容器容量" v-decorator="['boxQty', {rules: [{required: true, message: '请输入物料容器容量!'}]}]" />
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/addFormContainerPackaging.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,246 @@
<template>
  <!-- åŒ…装关系 -->
  <div style="background-color: white">
    <!-- <a-spin :spinning="loading"> -->
    <div class="wms-task-management-detail-div">
      <div class="drawer-content">
        <!-- <span style="font-weight:bold;cursor:default;">
          <a style="cursor:default;">{{ row.no }}</a>单据详情
        </span> -->
        <div style="margin-top: 10px;">
          <a-table :columns="columns" :data-source="list" row-key="id" :pagination="false" :scroll="{ x: true }">
            <template slot="index" slot-scope="text, record, index">{{ index + 1 }}</template>
            <span slot="containerStatusscopedSlots" slot-scope="text">
              <a-tag :color="text == '1' ? '#daa520' : text == '2' ? '#cd5c5c' : text == '3' ? '#add8e6' : '#696969'">{{
                'orderdetails_statusenum' | dictType(text)
              }}</a-tag>
            </span>
            <span slot="action" slot-scope="text, record">
              <a-popconfirm v-if="hasPerm('BaseCustomer:delete')" placement="topRight" title="确认删除?"
                @confirm="() => itemDelete(record, index)">
                <a>删除</a>
              </a-popconfirm>
            </span>
          </a-table>
        </div>
      </div>
      <p @click="visible = true">新增行</p>
      <a-modal title="包装关系" :width="900" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit"
        @cancel="handleCancel">
        <show-list ref="showList" @ok="handleOk" />
        <!-- <a-spin :spinning="confirmLoading"></a-spin> -->
      </a-modal>
    </div>
  </div>
</template>
<script>
import { WmsOrderRukuDetail } from '@/api/modular/main/WmsOrderManage'
import showList from './index.vue'
export default {
  name: 'wmsOrderRukuManagementDetailDrawer',
  emits: ['update:visible'],
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    row: {
      type: Object,
      default: function () {
        return {}
      }
    }
  },
  components: {
    showList
  },
  data() {
    return {
      loading: false,
      containerStatusData: [],
      list: [],
      columns: [
        {
          dataIndex: 'index',
          title: '序号',
          fixed: 'left',
          width: '60',
          scopedSlots: { customRender: 'index' },
          align: 'center'
        },
        {
          title: '容器类型名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'containerTypeName'
        },
        {
          title: '物料类型编号',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'materialTypeCode'
        },
        {
          title: '物料类型名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'materialTypeName'
        },
        {
          title: '物料容器容量',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'boxQty'
        },
      ],
      // åˆ†é¡µ
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30', '40'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + '共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0,
        size: 'small'
      }
    }
  },
  created() {
    const containerStatusOption = this.$options
    this.containerStatusData = containerStatusOption.filters['dictData']('orderdetails_statusenum')
    this.columns.push({
      title: '操作',
      width: '150px',
      dataIndex: 'action',
      scopedSlots: { customRender: 'action' }
    })
  },
  methods: {
    onClose() {
      this.close()
    },
    close() {
      this.$emit('update:visible', false)
    },
    afterVisibleChange(visible) {
      if (visible) {
        this.initShow()
      } else {
        this.afterClsoe()
      }
    },
    initShow() {
      this.loading = true
      this.getList(() => {
        this.loading = false
      })
    },
    getList(row) {
      let params = { id: row.id }
      WmsOrderRukuDetail(params)
        .then(d => {
          this.list = d.data.rows || []
          this.$emit('update:visible', true)
          // callback && callback(true)
        })
        .catch(() => {
          this.$emit('update:visible', false)
          this.list = []
          // callback && callback(false)
        })
    },
    afterClsoe() {
      this.list = []
    },
    handleOk(param) {
      this.list = param
    },
    handleSubmit() {
      this.visible = false
    },
    handleCancel() {
      this.visible = false
    },
    itemDelete(record, index) {
      this.list.splice(index, 1)
    }
  }
}
</script>
<style lang="less" scoped>
.wms-task-management-detail-div {
  height: 100%;
  overflow: auto;
  .drawer-content {
    padding: 16px;
  }
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/editForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,119 @@
<template>
  <a-modal
    title="编辑包装关系基础表"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-form-item label="容器类型ID" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入容器类型ID" v-decorator="['containerTypeId', {rules: [{required: true, message: '请输入容器类型ID!'}]}]" />
        </a-form-item>
        <a-form-item label="容器类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入容器类型名称" v-decorator="['containerTypeName', {rules: [{required: true, message: '请输入容器类型名称!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型ID" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型ID" v-decorator="['materialTypeId', {rules: [{required: true, message: '请输入物料类型ID!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型编号" v-decorator="['materialTypeCode', {rules: [{required: true, message: '请输入物料类型编号!'}]}]" />
        </a-form-item>
        <a-form-item label="物料类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料类型名称" v-decorator="['materialTypeName', {rules: [{required: true, message: '请输入物料类型名称!'}]}]" />
        </a-form-item>
        <a-form-item label="物料容器容量" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入物料容器容量" v-decorator="['boxQty', {rules: [{required: true, message: '请输入物料容器容量!'}]}]" />
        </a-form-item>
        <a-form-item v-show="false"><a-input v-decorator="['id']" /></a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import moment from 'moment'
  import {
  WmsContainerPackagingEdit
  } from '@/api/modular/main/WmsBase/WmsContainerPackagingManage'
  export default {
  data () {
  return {
  Id: 0,
  labelCol: {
  xs: { span: 24 },
  sm: { span: 5 }
  },
  wrapperCol: {
  xs: { span: 24 },
  sm: { span: 15 }
  },
  record: {},
        visible: false,
        confirmLoading: false,
        form: this.$form.createForm(this)
      }
    },
    methods: {
    moment,
      // åˆå§‹åŒ–方法
      edit (record) {
        this.visible = true;
        this.Id = record.id;
        this.$nextTick(() => {
        });
        //深度拷贝 ç§»é™¤VUE的监听,防止INDEX页面值变动
        this.record = JSON.parse(JSON.stringify(record))
        this.$nextTick(() => {
          this.form.setFieldsValue(
            {
              id: record.id,
              containerTypeId: record.containerTypeId,
              containerTypeName: record.containerTypeName,
              materialTypeId: record.materialTypeId,
              materialTypeCode: record.materialTypeCode,
              materialTypeName: record.materialTypeName,
              boxQty: record.boxQty
            }
          )
        })
      },
      handleSubmit () {
        const { form: { validateFields } } = this
        this.confirmLoading = true
        validateFields((errors, values) => {
          if (!errors) {
            for (const key in values) {
              if (values[key] == null) continue
              if (typeof (values[key]) === 'object') {
                values[key] = JSON.stringify(values[key])
                 this.record[key] = values[key]
              } else {
                 this.record[key] = values[key]
              }
            }
            WmsContainerPackagingEdit(this.record).then((res) => {
              if (res.success) {
                this.$message.success('编辑成功')
                this.confirmLoading = false
                this.$emit('ok', this.record)
                this.handleCancel()
              } else {
                this.$message.error('编辑失败:' + JSON.stringify(res.message))
              }
            }).finally((res) => {
              this.confirmLoading = false
            })
          }else{
            this.confirmLoading = false
          }
        });
      },
      handleCancel () {
        this.form.resetFields()
        this.visible = false
      }
    }
  }
</script>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/excelForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,181 @@
<template>
  <a-modal
    :width="850"
    :destroyOnClose="true"
    :visible="visible"
    :forceRender="true"
    title="批量导入"
    cancelText="取消上传"
    okText="开始上传"
    @cancel="handleCancel"
    @ok="handleSubmit">
    <a-spin :spinning="confirmLoading">
      <a-row :span="24">
        <span>请选择要导入的数据文件(Excel格式)</span>
      </a-row>
      <p></p>
      <a-row>
        <a-col :span="16">
          <a-upload-dragger accept=".xlsx,.xls" :multiple="false" :customRequest="customRequest" @change="handleChange" :beforeUpload="beforeUpload">
            <a-icon style="font-size: 40px;" type="cloud-upload" />
          </a-upload-dragger>
        </a-col>
        <!--<a-col :span="8">
          <span>导入模式:</span>
          <a-select
            style="width: 130px"
            placeholder="请选择导入模式"
            v-model="importExcelType">
            <a-select-option
              v-for="(item,index) in importExcelTypeData"
              :key="index"
              :value="item.code">{{ item.name }}
            </a-select-option>
          </a-select>
        </a-col>-->
      </a-row>
      <a-row :span="24">
        <!--<a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="!detailed">
          ç‚¹å‡»æŸ¥çœ‹æ–‡ä»¶ä¸Šä¼ è¦æ±‚
        </a-button>-->
        <span>【</span>
        <a-button style="width: 90px;text-align: left;" @click="wmsContainerPackagingDownloadExcelTemplate" type="link">下载导入模板</a-button>,填写并上传
        <span>】</span>
        <a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="detailed">
          æ”¶èµ·
        </a-button>
      </a-row>
      <a-row v-show="detailed" style="background: #fef4e8; height: 30px;" :span="24">
        <a-breadcrumb>
          <a-breadcrumb-item style="line-height: 30px;color: #faad14;margin-left: 18px;">文件上传要求</a-breadcrumb-item>
        </a-breadcrumb>
      </a-row>
      <pre v-show="detailed">
        <div v-html="demandText"></div>
      </pre>
      <a-table v-show="detailed" :columns="columns" :data-source="dataList" :rowKey="(record) => record.processID" :pagination="false"></a-table>
      <pre v-show="detailed">
        <div v-html="columnText"></div>
      </pre>
    </a-spin>
  </a-modal>
</template>
<script>
  import { downloadFile, checkFile, parseExcelFieldText, parseDemandText } from '@/utils/util'
  import { WmsContainerPackagingImportExcel, WmsContainerPackagingDownloadExcelTemplate} from '@/api/modular/main/WmsBase/WmsContainerPackagingManage'
  import { sysExcelTemplateGetColumnList } from '@/api/modular/system/excelTemplateManage'
  export default {
  components: {
  },
  data() {
  return {
  visible: false,
  detailed: false,
  confirmLoading: false,
  fileList: [],
  importExcelTypeData: [],
  importExcelType: '1',
  uploadFile: null,
  columns: [],
  dataList: [],
  demandText:'',
  columnText: ''
  }
  },
  methods: {
  index() {
  this.visible = true;
  this.importExcelTypeData = this.$options.filters['dictData']('import_excel_type')
  this.demandText = parseDemandText("wmsContainerPackagingDownloadExcelTemplate")
  window.downloadFile = this.wmsContainerPackagingDownloadExcelTemplate;
  this.getTable();
  },
  showDemand() {
  this.detailed = !this.detailed;
  },
  customRequest(document) {
  this.uploadFile = document
  },
  getTable() {
  sysExcelTemplateGetColumnList({className: "WmsContainerPackaging"}).then(res =>
  {
  if (res.success) {
  this.columns =[];
  this.dataList = [{}];
  res.data.forEach(x => {
  this.columns.push({
  dataIndex: x.columnName,
  key: x.columnName,
  title: x.columnComment
  });
  this.dataList[0][x.columnName] = x.isRequired ? "必填" : "非必填"
  });
  this.columnText = parseExcelFieldText(res.data);
  }
  });
  },
  beforeUpload(fileInfo) {
  let res = checkFile(fileInfo, 1073741824, ['.xlsx', '.xls']);
  if (!res.success) {
  this.$message.warning(res.msg)
  return false
  }
  setTimeout(() => {this.uploadFile.onSuccess(this.uploadFile.file)}, 1000)
  },
  handleChange(fileInfo) {
  if (fileInfo.file.status === 'error') {
  fileInfo.fileList.splice(0, 1)
  }
  if (fileInfo.file.status === 'done') {
  if (fileInfo.fileList.length > 1) {
  fileInfo.fileList.splice(0, 1)
  }
  this.fileList = fileInfo.file
  }
  },
  handleSubmit() {
  this.confirmLoading = true
  const formData = new FormData()
  formData.append('file', this.uploadFile.file)
  WmsContainerPackagingImportExcel(formData, {importExcelType: this.importExcelType}).then(res => {
  this.$message.success('操作成功')
  this.confirmLoading = false
  this.$emit('ok', [])
  this.handleCancel()
  }).finally((res)=>{this.confirmLoading = false})
  },
  handleCancel() {
  this.visible = false
  this.detailed = false
  },
  wmsContainerPackagingDownloadExcelTemplate() {
  WmsContainerPackagingDownloadExcelTemplate({version: "v2"}).then((res) => {
  downloadFile(res);
  }).catch((err) => {
  this.$message.error('下载错误:获取文件流错误' + err)
  })
  }
  }
  }
</script>
<style scoped>
::v-deep .ant-upload.ant-upload-drag {
  position: relative;
  width: 140px;
  height: 135px;
  text-align: center;
  background: #fafafa;
  border: 1px dashed #d9d9d9;
  border-radius: 2px;
  cursor: pointer;
  -webkit-transition: border-color 0.3s;
  transition: border-color 0.3s;
}
::v-deep .ant-btn:focus:not(.ant-btn-primary):not(.ant-btn-danger), .ant-btn:hover:not(.ant-btn-primary):not(.ant-btn-danger) {
  color: #ffc53d;
  border-color: white;
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsContainerPackaging/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,523 @@
<template>
  <div ref="boxOutWrap" class="boxOutWrap">
    <div ref="boxForm" class="boxForm">
      <a-card :bordered="false" :bodyStyle="tstyle">
        <div class="table-page-search-wrapper" v-if="hasPerm('WmsContainerPackaging:page')">
          <a-form layout="inline">
            <a-row :gutter="48">
              <a-col :md="8" :sm="24">
                <a-form-item label="容器类型ID">
                  <a-input v-model="queryParam.containerTypeId" allow-clear placeholder="请输入容器类型ID" />
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="容器类型名称">
                  <a-input v-model="queryParam.containerTypeName" allow-clear placeholder="请输入容器类型名称" />
                </a-form-item> </a-col
              ><template v-if="advanced">
                <a-col :md="8" :sm="24">
                  <a-form-item label="物料类型ID">
                    <a-input v-model="queryParam.materialTypeId" allow-clear placeholder="请输入物料类型ID" />
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="24">
                  <a-form-item label="物料类型编号">
                    <a-input v-model="queryParam.materialTypeCode" allow-clear placeholder="请输入物料类型编号" />
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="24">
                  <a-form-item label="物料类型名称">
                    <a-input v-model="queryParam.materialTypeName" allow-clear placeholder="请输入物料类型名称" />
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="24">
                  <a-form-item label="物料容器容量">
                    <a-input v-model="queryParam.boxQty" allow-clear placeholder="请输入物料容器容量" />
                  </a-form-item>
                </a-col>
                <!--年月日时分秒-->
                <!--时间范围-->
                <a-col :md="8" :sm="24">
                  <a-form-item label="创建时间">
                    <a-range-picker
                      style="width: 100%"
                      :placeholder="['开始时间', '结束时间']"
                      :show-time="{
                        format: 'HH:mm:ss',
                        defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')]
                      }"
                      v-model="queryParam.createdTime"
                      value-format="YYYY-MM-DD HH:mm:ss"
                      format="YYYY-MM-DD HH:mm:ss"
                      @change="onChangecreatedTime"
                    />
                  </a-form-item>
                </a-col>
                <!--年月日时分秒-->
                <!--时间范围-->
                <a-col :md="8" :sm="24">
                  <a-form-item label="更新时间">
                    <a-range-picker
                      style="width: 100%"
                      :placeholder="['开始时间', '结束时间']"
                      :show-time="{
                        format: 'HH:mm:ss',
                        defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')]
                      }"
                      v-model="queryParam.updatedTime"
                      value-format="YYYY-MM-DD HH:mm:ss"
                      format="YYYY-MM-DD HH:mm:ss"
                      @change="onChangeupdatedTime"
                    />
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="24">
                  <a-form-item label="创建者名称">
                    <a-input v-model="queryParam.createdUserName" allow-clear placeholder="请输入创建者名称" />
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="24">
                  <a-form-item label="修改者名称">
                    <a-input v-model="queryParam.updatedUserName" allow-clear placeholder="请输入修改者名称" />
                  </a-form-item>
                </a-col>
              </template>
              <a-col :md="8" :sm="24">
                <span class="table-page-search-submitButtons">
                  <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
                  <a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
                  <a @click="toggleAdvanced" style="margin-left: 8px">
                    {{ advanced ? '收起' : '展开' }}
                    <a-icon :type="advanced ? 'up' : 'down'" />
                  </a>
                </span>
              </a-col>
            </a-row>
          </a-form>
        </div>
      </a-card>
    </div>
    <a-card :bordered="false">
      <s-table
        ref="table"
        :columns="columns"
        :data="loadData"
        :alert="true"
        @changeTablePage="pageInfo = $event"
        :scroll="{ x: true, y: tableHeight }"
        :rowKey="record => record.id"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
      >
        <template class="table-operator" slot="operator" v-if="hasPerm('WmsContainerPackaging:add')">
          <!-- <div ref="actionBar" class="actionBar">
            <a-button type="info" v-if="hasPerm('sysExcelTemplate:importExcel')" icon="upload" @click="$refs.excelForm.index()">
            å¯¼å…¥
          </a-button>
          <a-button type="info" v-if="hasPerm('WmsContainerPackaging:exportExcel')" icon="download" @click="WmsContainerPackagingToExcel()">
            å¯¼å‡º
          </a-button>
            <a-button type="primary" v-if="hasPerm('WmsContainerPackaging:add')" icon="plus" @click="$refs.addForm.add()">新增包装关系基础表</a-button>
        </div> -->
        </template>
        <!-- <span slot="action" slot-scope="text, record">
            <a v-if="hasPerm('WmsContainerPackaging:edit')" @click="$refs.editForm.edit(record)">编辑</a>
          <a-divider type="vertical" v-if="hasPerm('WmsContainerPackaging:edit') & hasPerm('WmsContainerPackaging:delete')"/>
          <a-popconfirm v-if="hasPerm('WmsContainerPackaging:delete')" placement="topRight" title="确认删除?" @confirm="() => WmsContainerPackagingDelete(record)">
            <a>删除</a>
          </a-popconfirm>
        </span> -->
      </s-table>
      <add-form ref="addForm" @ok="handleOk" />
      <edit-form ref="editForm" @ok="handleOk" />
      <excel-form ref="excelForm" @ok="handleOk" />
    </a-card>
  </div>
</template>
<script>
import { STable } from '@/components'
import moment from 'moment'
import {
  WmsContainerPackagingPage,
  WmsContainerPackagingDelete,
  WmsContainerPackagingToExcel
} from '@/api/modular/main/WmsBase/WmsContainerPackagingManage'
//自定义table高度
import setTableHtMixin from '@/mixins/handleTableHt.js'
import addForm from './addForm.vue'
import { exportExcel } from '@/utils/exportToExcel'
import { downloadFile } from '@/utils/util'
import editForm from './editForm.vue'
import excelForm from './excelForm.vue'
export default {
  mixins: [setTableHtMixin],
  components: {
    STable,
    addForm,
    editForm,
    excelForm
  },
  data() {
    return {
      advanced: false, // é«˜çº§æœç´¢ å±•å¼€/关闭
      queryParam: {},
      pageInfo: {
        current: 1,
        pageSize: 10
      },
      columns: [
        {
          title: '序号',
          width: '60px',
          align: 'center',
          customRender: (text, record, index) => `${index + 1 + (this.pageInfo.current - 1) * this.pageInfo.pageSize}`
        },
        {
          title: '容器类型ID',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'containerTypeId'
        },
        {
          title: '容器类型名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'containerTypeName'
        },
        {
          title: '物料类型ID',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'materialTypeId'
        },
        {
          title: '物料类型编号',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'materialTypeCode'
        },
        {
          title: '物料类型名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'materialTypeName'
        },
        {
          title: '物料容器容量',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '130px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'boxQty'
        },
        {
          title: '创建时间',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'createdTime'
        },
        {
          title: '更新时间',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'updatedTime'
        },
        {
          title: '创建者名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'createdUserName'
        },
        {
          title: '修改者名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'updatedUserName'
        }
      ],
      tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
      // åŠ è½½æ•°æ®æ–¹æ³• å¿…须为 Promise å¯¹è±¡
      loadData: parameter => {
        return WmsContainerPackagingPage(Object.assign(parameter, this.switchingDate())).then(res => {
          return res.data
        })
      },
      selectedRowKeys: [],
      selectedRows: []
    }
  },
  created() {
    // if (this.hasPerm('WmsContainerPackaging:edit') || this.hasPerm('WmsContainerPackaging:delete')) {
    //   this.columns.push({
    //     title: '操作',
    //     width: '150px',
    //     dataIndex: 'action',
    //     scopedSlots: { customRender: 'action' }
    //   })
    // }
    const path = this.$route.path
    const columnStr = window.localStorage.getItem(path)
    if (columnStr) {
      var _columns = JSON.parse(columnStr)
      this.columns.forEach(element => {
        var fObj = _columns.find((item, index) => {
          return item.dataIndex === element.dataIndex
        })
        if (fObj != undefined && fObj != null) {
          element.checked = fObj.checked
        }
      })
    }
    this.handleTableHt() //设置主表表格高度
    window.addEventListener(
      'resize',
      () => {
        this.handleTableHt() // ç›‘听屏幕大小改变表格高度
      },
      false
    )
  },
  methods: {
    moment,
    /**
     * æŸ¥è¯¢å‚数组装
     */
    switchingDate() {
      const obj = JSON.parse(JSON.stringify(this.queryParam))
      return obj
    },
    WmsContainerPackagingDelete(record) {
      WmsContainerPackagingDelete(record).then(res => {
        if (res.success) {
          this.$message.success('删除成功')
          this.$refs.table.refresh()
        } else {
          this.$message.error('删除失败') // + res.message
        }
      })
    },
    WmsContainerPackagingToExcel() {
      this.loading = true
      let entozh = {}
      const path = this.$route.path
      if (window.localStorage.getItem(path)) {
        JSON.parse(window.localStorage.getItem(path)).forEach(item => {
          if (item.dataIndex != 'action' && item.checked) {
            entozh[item.dataIndex] = item.title
          }
        })
      } else {
        //直接点导出
        this.columns.forEach(item => {
          if (item.dataIndex != 'action') {
            entozh[item.dataIndex] = item.title
          }
        })
      }
      WmsContainerPackagingPage(Object.assign({ pageSize: 100000, pageIndex: 1 }, this.queryParam))
        .then(res => {
          this.loading = false
          //需要截取日期的字段
          var arrDataCutout = this.columns.filter(v => v.customCutout == true)
          res.data.rows.forEach(item => {
            var arrKeys = Object.keys(item)
            arrKeys.forEach(key => {
              var strFieldDic = key + 'Data'
              //枚举转值
              if (this[strFieldDic] && this[strFieldDic].length > 0) {
                let arrFieldDic = this[strFieldDic].filter(v => String(v.code) == String(item[key]))
                if (arrFieldDic.length > 0) {
                  item[key] = arrFieldDic[0]?.name || '没有枚举值'
                }
              }
              // æ—¥æœŸæˆªå–
              if (arrDataCutout.length > 0) {
                arrDataCutout.forEach(itemIn => {
                  if (key == itemIn.dataIndex && item[key]) {
                    item[key] = item[key].split(' ')[0]
                  }
                })
              }
            })
          })
          exportExcel(res.data.rows, entozh, 'xlsx', `${this.$route.meta.title}`)
        })
        .catch(err => {
          this.loading = false
          this.$message.error('下载错误:获取文件流错误' + err)
        })
    },
    toggleAdvanced() {
      this.advanced = !this.advanced
      this.handleTableHt() //设置主表表格高度
    },
    onChangecreatedTime(date, dateString) {
      this.queryParam.createdTime = dateString
    },
    onChangeupdatedTime(date, dateString) {
      this.queryParam.updatedTime = dateString
    },
    handleOk() {
      this.$refs.table.refresh()
    },
    onSelectChange(selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
      this.$emit('ok', selectedRows)
    }
  }
}
</script>
<style lang="less">
.table-operator {
  margin-bottom: 18px;
}
button {
  margin-right: 8px;
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/addForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,94 @@
<template>
  <a-modal
    title="新增控制属性规则"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
        <a-form :form="form">
        <a-form-item label="规则编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入规则编号" v-decorator="['ruleCode', {rules: [{required: true, message: '请输入规则编号!'}]}]" />
        </a-form-item>
        <a-form-item label="规则名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入规则名称" v-decorator="['ruleName', {rules: [{required: true, message: '请输入规则名称!'}]}]" />
        </a-form-item>
        <a-form-item label="规则描述" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入规则描述" v-decorator="['ruleDesc']" />
        </a-form-item>
        <a-form-item label="是否禁用" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-switch v-decorator="['isDisabled',{rules: [{ required: true, message: '请选择是否禁用!' }], valuePropName: 'checked'}]" />
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
  import moment from 'moment'
  import {
  WmsControlRuleAdd
  } from '@/api/modular/main/WmsBase/WmsControlRuleManage'
  export default {
  data () {
  return {
  labelCol: {
  xs: { span: 24 },
  sm: { span: 5 }
  },
  wrapperCol: {
  xs: { span: 24 },
  sm: { span: 15 }
  },
        visible: false,
        confirmLoading: false,
        form: this.$form.createForm(this)
      }
    },
    methods: {
    moment,
      // åˆå§‹åŒ–方法
      add (record) {
        this.visible = true
        this.$nextTick(() => {
        });
      },
      /**
       * æäº¤è¡¨å•
       */
      handleSubmit () {
        const { form: { validateFields } } = this
        this.confirmLoading = true
        validateFields((errors, values) => {
          if (!errors) {
            for (const key in values) {
              if (typeof (values[key]) === 'object') {
                values[key] = JSON.stringify(values[key])
              }
            }
            WmsControlRuleAdd(values).then((res) => {
              if (res.success) {
                this.$message.success('新增成功')
                this.confirmLoading = false
                this.$emit('ok', values)
                this.handleCancel()
              } else {
                this.$message.error('新增失败:' + JSON.stringify(res.message))
              }
            }).finally((res) => {
              this.confirmLoading = false
            })
          } else {
            this.confirmLoading = false
          }
        })
      },
      handleCancel () {
        this.form.resetFields()
        this.visible = false
      }
    }
  }
</script>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/detail.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,604 @@
<template>
  <div ref="boxOutWrap" class="boxOutWrap">
    <div ref="boxForm" class="boxForm">
    <a-card :bordered="false" :bodyStyle="tstyle">
      <div class="table-page-search-wrapper" v-if="hasPerm('WmsControlRuleDetail:page')">
        <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="8" :sm="24">
              <a-form-item label="控制属性规则ID">
                <a-input v-model="queryParam.controlRuleId" allow-clear placeholder="请输入控制属性规则ID"/>
              </a-form-item>
            </a-col>
            <a-col :md="8" :sm="24">
              <a-form-item label="最高库存">
                <a-input v-model="queryParam.maxImumqty" allow-clear placeholder="请输入最高库存"/>
              </a-form-item>
            </a-col><template v-if="advanced">
              <a-col :md="8" :sm="24">
                <a-form-item label="最低库存">
                  <a-input v-model="queryParam.minImumqty" allow-clear placeholder="请输入最低库存"/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="安全库存">
                  <a-input v-model="queryParam.safeImumqty" allow-clear placeholder="请输入安全库存"/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="最小库龄">
                  <a-input v-model="queryParam.minStorageAge" allow-clear placeholder="请输入最小库龄"/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="最大库龄">
                  <a-input v-model="queryParam.maxStorageAge" allow-clear placeholder="请输入最大库龄"/>
                </a-form-item>
              </a-col>
            <a-col :md="8" :sm="24">
                <a-form-item label="是否免检">
                    <a-select :allowClear="true" style="width: 100%" v-model="queryParam.isNotChek" placeholder="请选择是否免检">
                        <a-select-option v-for="(item,index) in isNotChekData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
                    </a-select>
                </a-form-item>
            </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="保质期天数">
                  <a-input v-model="queryParam.shelfLifeDays" allow-clear placeholder="请输入保质期天数"/>
                </a-form-item>
              </a-col>
            <a-col :md="8" :sm="24">
                <a-form-item label="是否禁用">
                    <a-select :allowClear="true" style="width: 100%" v-model="queryParam.isDisabled" placeholder="请选择是否禁用">
                        <a-select-option v-for="(item,index) in isDisabledData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
                    </a-select>
                </a-form-item>
            </a-col>
                  <!--年月日时分秒-->
            <!--时间范围-->
                <a-col :md="8" :sm="24">
                    <a-form-item label="创建时间">
                        <a-range-picker style="width: 100%" :placeholder="['开始时间', '结束时间']"  :show-time="{
format: 'HH:mm:ss',  defaultValue: [moment('00:00:00', 'HH:mm:ss'),moment('23:59:59', 'HH:mm:ss')]}" v-model="queryParam.createdTime"  value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"   @change="onChangecreatedTime"/>
                    </a-form-item>
                </a-col>
                      <!--年月日时分秒-->
            <!--时间范围-->
                <a-col :md="8" :sm="24">
                    <a-form-item label="更新时间">
                        <a-range-picker style="width: 100%" :placeholder="['开始时间', '结束时间']"  :show-time="{
format: 'HH:mm:ss',  defaultValue: [moment('00:00:00', 'HH:mm:ss'),moment('23:59:59', 'HH:mm:ss')]}" v-model="queryParam.updatedTime"  value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"   @change="onChangeupdatedTime"/>
                    </a-form-item>
                </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="创建者名称">
                  <a-input v-model="queryParam.createdUserName" allow-clear placeholder="请输入创建者名称"/>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="修改者名称">
                  <a-input v-model="queryParam.updatedUserName" allow-clear placeholder="请输入修改者名称"/>
                </a-form-item>
              </a-col>    </template>
            <a-col :md="8" :sm="24" >
              <span class="table-page-search-submitButtons">
                <a-button type="primary" @click="$refs.table.refresh(true)" >查询</a-button>
                <a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
                <a @click="toggleAdvanced" style="margin-left: 8px"> {{ advanced ? '收起' : '展开' }}
                  <a-icon :type="advanced ? 'up' : 'down'"/>
                </a>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </a-card>
    </div>
    <a-card :bordered="false">
        <!-- :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" -->
      <s-table
        ref="table"
        :columns="columns"
        :data="loadData"
        :alert="true"
        @changeTablePage="pageInfo = $event"
        :scroll="{x: true,y:tableHeight}"
        :rowKey="(record) => record.id"
        >
        <template class="table-operator" slot="operator" v-if="hasPerm('WmsControlRuleDetail:add')" >
        <!-- <div ref="actionBar" class="actionBar">
            <a-button type="info" v-if="hasPerm('sysExcelTemplate:importExcel')" icon="upload" @click="$refs.excelForm.index()">
            å¯¼å…¥
          </a-button>
          <a-button type="info" v-if="hasPerm('WmsControlRuleDetail:exportExcel')" icon="download" @click="WmsControlRuleDetailToExcel()">
            å¯¼å‡º
          </a-button>
            <a-button type="primary" v-if="hasPerm('WmsControlRuleDetail:add')" icon="plus" @click="$refs.addForm.add()">新增控制属性规则明细</a-button>
        </div> -->
        </template>
          <span slot="isNotChekscopedSlots" slot-scope="text">
            <div v-if="text===true ">
                <a-tag color="green">是</a-tag>
            </div>
            <div v-else-if="text==false">
                <a-tag color="volcano">否</a-tag>
            </div>
            <div v-else=""></div>
            </span>
          <span slot="isDisabledscopedSlots" slot-scope="text">
            <div v-if="text===true ">
                <a-tag color="green">是</a-tag>
            </div>
            <div v-else-if="text==false">
                <a-tag color="volcano">否</a-tag>
            </div>
            <div v-else=""></div>
            </span>
          <!-- <span slot="action" slot-scope="text, record">
            <a v-if="hasPerm('WmsControlRuleDetail:edit')" @click="$refs.editForm.edit(record)">编辑</a>
          <a-divider type="vertical" v-if="hasPerm('WmsControlRuleDetail:edit') & hasPerm('WmsControlRuleDetail:delete')"/>
          <a-popconfirm v-if="hasPerm('WmsControlRuleDetail:delete')" placement="topRight" title="确认删除?" @confirm="() => WmsControlRuleDetailDelete(record)">
            <a>删除</a>
          </a-popconfirm>
        </span> -->
      </s-table>
      <add-form ref="addForm" @ok="handleOk" />
      <edit-form ref="editForm" @ok="handleOk" />
      <excel-form ref="excelForm" @ok="handleOk" />
    </a-card>
  </div>
</template>
<script>
    import { STable } from '@/components'
    import moment from 'moment'
    import { WmsControlRuleDetailPage, WmsControlRuleDetailDelete, WmsControlRuleDetailToExcel } from '@/api/modular/main/WmsBase/WmsControlRuleDetailManage'
    //自定义table高度
    import setTableHtMixin from '@/mixins/handleTableHt.js'
    import addForm from './addForm.vue'
    import { exportExcel } from '@/utils/exportToExcel'
    import { downloadFile } from '@/utils/util'
    import editForm from './editForm.vue'
    import excelForm from './excelForm.vue'
    export default {
    mixins: [setTableHtMixin],
    components: {
    STable,
    addForm,
    editForm,
    excelForm
    },
    data () {
    return {
    advanced: false, // é«˜çº§æœç´¢ å±•å¼€/关闭
    queryParam: {},
     pageInfo: {
        current: 1,
        pageSize: 10
      },
    columns: [
    {
    title:'序号',
    width: '60px',
    align: 'center',
    customRender: (text, record, index) => `${index + 1 + (this.pageInfo.current - 1) * this.pageInfo.pageSize}`
    },
    {
    title: '控制属性规则ID',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '140px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '140px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'controlRuleId'
    },
    {
    title: '最高库存',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'maxImumqty'
    },
    {
    title: '最低库存',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'minImumqty'
    },
    {
    title: '安全库存',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'safeImumqty'
    },
    {
    title: '最小库龄',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'minStorageAge'
    },
    {
    title: '最大库龄',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'maxStorageAge'
    },
    {
    title: '是否免检',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'isNotChek',
    scopedSlots: { customRender: 'isNotChekscopedSlots' }
    },
    {
    title: '保质期天数',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'shelfLifeDays'
    },
    {
    title: '是否禁用',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'isDisabled',
    scopedSlots: { customRender: 'isDisabledscopedSlots' }
    },
    {
    title: '创建时间',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'createdTime'
    },
    {
    title: '更新时间',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'updatedTime'
    },
    {
    title: '创建者名称',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'createdUserName'
    },
    {
    title: '修改者名称',
    align: 'center',
    customHeaderCell: () => {
    return {
     style: {
    'min-width': '120px'//最小列宽设置
     }
     }
    },
    customCell: () => {
    return {
    style: {
    'min-width': '120px'//最小列宽设置
    }
    }
    },
    sorter: true,
    dataIndex: 'updatedUserName'
    }
    ],
    tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
    // åŠ è½½æ•°æ®æ–¹æ³• å¿…须为 Promise å¯¹è±¡
    loadData: parameter => {
    return WmsControlRuleDetailPage(Object.assign(parameter, this.switchingDate())).then((res) => {
    return res.data
    })
    },
    selectedRowKeys: [],
    selectedRows: []
    }
    },
    created () {
    if (this.hasPerm('WmsControlRuleDetail:edit') || this.hasPerm('WmsControlRuleDetail:delete')) {
    this.columns.push({
    title: '操作',
    width: '150px',
    dataIndex: 'action',
    scopedSlots: { customRender: 'action' }
    })
    }
    const path = this.$route.path
    const columnStr = window.localStorage.getItem(path)
    if(columnStr) {
    var _columns = JSON.parse(columnStr)
    this.columns.forEach(element => {
    var fObj = _columns.find((item, index) => {
    return item.dataIndex === element.dataIndex;
    })
    if(fObj!=undefined && fObj!=null){
    element.checked=fObj.checked;
    }
    });
    }
    const isNotChekOption = this.$options
    this.isNotChekData = isNotChekOption.filters['dictData']('yes_true_false')
    const isDisabledOption = this.$options
    this.isDisabledData = isDisabledOption.filters['dictData']('yes_true_false')
    this.handleTableHt() //设置主表表格高度
    window.addEventListener(
    'resize',
    () => {
    this.handleTableHt() // ç›‘听屏幕大小改变表格高度
    },
    false
    )
    },
    methods: {
    moment,
    /**
    * æŸ¥è¯¢å‚数组装
    */
    switchingDate () {
    const obj = JSON.parse(JSON.stringify(this.queryParam))
    return obj
    },
    WmsControlRuleDetailDelete (record) {
    WmsControlRuleDetailDelete(record).then((res) => {
    if (res.success) {
    this.$message.success('删除成功')
    this.$refs.table.refresh()
    } else {
    this.$message.error('删除失败') // + res.message
    }
    })
    },
    WmsControlRuleDetailToExcel() {
    this.loading = true
    let entozh = {};
    const path = this.$route.path;
    if (window.localStorage.getItem(path)) {
    JSON.parse(window.localStorage.getItem(path)).forEach(item => {
    if (item.dataIndex != 'action' && item.checked) {
    entozh[item.dataIndex] = item.title
    }
    })
    } else { //直接点导出
    this.columns.forEach(item => {
    if (item.dataIndex != 'action') {
    entozh[item.dataIndex] = item.title
    }
    })
    }
    WmsControlRuleDetailPage(Object.assign({ pageSize: 100000, pageIndex: 1 }, this.queryParam)).then((res) => {
    this.loading = false;
    //需要截取日期的字段
    var arrDataCutout = this.columns.filter(v => v.customCutout == true);
    res.data.rows.forEach(item => {
    var arrKeys = Object.keys(item);
    arrKeys.forEach(key => {
    var strFieldDic = key + 'Data';
    //枚举转值
    if (this[strFieldDic] && this[strFieldDic].length > 0) {
    let arrFieldDic = this[strFieldDic].filter(v => String(v.code) == String(item[key]));
    if (arrFieldDic.length > 0) {
    item[key] = arrFieldDic[0]?.name || '没有枚举值';
    }
    }
    // æ—¥æœŸæˆªå–
    if (arrDataCutout.length > 0) {
    arrDataCutout.forEach(itemIn => {
    if (key == itemIn.dataIndex && item[key]) {
    item[key] = item[key].split(" ")[0]
    }
    })
    }
    });
    })
    exportExcel(res.data.rows, entozh, "xlsx", `${this.$route.meta.title}`)
    }).catch((err) => {
    this.loading = false
    this.$message.error('下载错误:获取文件流错误' + err)
    })
    },
    toggleAdvanced () {
    this.advanced = !this.advanced
    this.handleTableHt() //设置主表表格高度
    },
    onChangecreatedTime(date, dateString) {
      this.queryParam.createdTime = dateString
    },
    onChangeupdatedTime(date, dateString) {
      this.queryParam.updatedTime = dateString
    },
    handleOk () {
    this.$refs.table.refresh()
    },
    onSelectChange (selectedRowKeys, selectedRows) {
    this.selectedRowKeys = selectedRowKeys
    this.selectedRows = selectedRows
    }
    }
    }
</script>
<style lang="less">
  .table-operator {
    margin-bottom: 18px;
  }
  button {
    margin-right: 8px;
  }
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/details.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,107 @@
<template>
  <!-- @ok="handleSubmit" -->
  <a-modal
    title="控制属性规则明细"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @cancel="handleCancel"
    @ok="visible=false"
  >
    <a-spin :spinning="confirmLoading">
      <control-rule-detail ref="controlRuleDetail" @ok="handleOk" />
    </a-spin>
  </a-modal>
</template>
<script>
import moment from 'moment'
import { WmsControlRuleEdit } from '@/api/modular/main/WmsBase/WmsControlRuleManage'
import ControlRuleDetail from './detail.vue'
export default {
  components: {
    ControlRuleDetail
  },
  data() {
    return {
      Id: 0,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 15 }
      },
      record: {},
      visible: false,
      confirmLoading: false,
      form: this.$form.createForm(this)
    }
  },
  methods: {
    moment,
    // åˆå§‹åŒ–方法
    edit(record) {
      this.visible = true
      this.Id = record.id
      this.$nextTick(() => {})
      //深度拷贝 ç§»é™¤VUE的监听,防止INDEX页面值变动
      this.record = JSON.parse(JSON.stringify(record))
      this.$nextTick(() => {
        this.form.setFieldsValue({
          id: record.id,
          ruleCode: record.ruleCode,
          ruleName: record.ruleName,
          ruleDesc: record.ruleDesc,
          isDisabled: record.isDisabled
        })
      })
    },
    handleOk(){
      alert("2")
    },
    handleSubmit() {
      const {
        form: { validateFields }
      } = this
      this.confirmLoading = true
      validateFields((errors, values) => {
        if (!errors) {
          for (const key in values) {
            if (values[key] == null) continue
            if (typeof values[key] === 'object') {
              values[key] = JSON.stringify(values[key])
              this.record[key] = values[key]
            } else {
              this.record[key] = values[key]
            }
          }
          WmsControlRuleEdit(this.record)
            .then(res => {
              if (res.success) {
                this.$message.success('编辑成功')
                this.confirmLoading = false
                this.$emit('ok', this.record)
                this.handleCancel()
              } else {
                this.$message.error('编辑失败:' + JSON.stringify(res.message))
              }
            })
            .finally(res => {
              this.confirmLoading = false
            })
        } else {
          this.confirmLoading = false
        }
      })
    },
    handleCancel() {
      this.form.resetFields()
      this.visible = false
    }
  }
}
</script>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/editForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,123 @@
<template>
  <a-modal
    title="编辑控制属性规则"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-form-item label="规则编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input
            placeholder="请输入规则编号"
            v-decorator="['ruleCode', { rules: [{ required: true, message: '请输入规则编号!' }] }]"
          />
        </a-form-item>
        <a-form-item label="规则名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input
            placeholder="请输入规则名称"
            v-decorator="['ruleName', { rules: [{ required: true, message: '请输入规则名称!' }] }]"
          />
        </a-form-item>
        <a-form-item label="规则描述" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入规则描述" v-decorator="['ruleDesc']" />
        </a-form-item>
        <a-form-item label="是否禁用" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-switch
            v-decorator="[
              'isDisabled',
              { rules: [{ required: true, message: '请选择是否禁用!' }], valuePropName: 'checked' }
            ]"
          />
        </a-form-item>
        <a-form-item v-show="false"><a-input v-decorator="['id']"/></a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import moment from 'moment'
import { WmsControlRuleEdit } from '@/api/modular/main/WmsBase/WmsControlRuleManage'
export default {
  data() {
    return {
      Id: 0,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 15 }
      },
      record: {},
      visible: false,
      confirmLoading: false,
      form: this.$form.createForm(this)
    }
  },
  methods: {
    moment,
    // åˆå§‹åŒ–方法
    edit(record) {
      this.visible = true
      this.Id = record.id
      this.$nextTick(() => {})
      //深度拷贝 ç§»é™¤VUE的监听,防止INDEX页面值变动
      this.record = JSON.parse(JSON.stringify(record))
      this.$nextTick(() => {
        this.form.setFieldsValue({
          id: record.id,
          ruleCode: record.ruleCode,
          ruleName: record.ruleName,
          ruleDesc: record.ruleDesc,
          isDisabled: record.isDisabled
        })
      })
    },
    handleSubmit() {
      const {
        form: { validateFields }
      } = this
      this.confirmLoading = true
      validateFields((errors, values) => {
        if (!errors) {
          for (const key in values) {
            if (values[key] == null) continue
            if (typeof values[key] === 'object') {
              values[key] = JSON.stringify(values[key])
              this.record[key] = values[key]
            } else {
              this.record[key] = values[key]
            }
          }
          WmsControlRuleEdit(this.record)
            .then(res => {
              if (res.success) {
                this.$message.success('编辑成功')
                this.confirmLoading = false
                this.$emit('ok', this.record)
                this.handleCancel()
              } else {
                this.$message.error('编辑失败:' + JSON.stringify(res.message))
              }
            })
            .finally(res => {
              this.confirmLoading = false
            })
        } else {
          this.confirmLoading = false
        }
      })
    },
    handleCancel() {
      this.form.resetFields()
      this.visible = false
    }
  }
}
</script>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/excelForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,181 @@
<template>
  <a-modal
    :width="850"
    :destroyOnClose="true"
    :visible="visible"
    :forceRender="true"
    title="批量导入"
    cancelText="取消上传"
    okText="开始上传"
    @cancel="handleCancel"
    @ok="handleSubmit">
    <a-spin :spinning="confirmLoading">
      <a-row :span="24">
        <span>请选择要导入的数据文件(Excel格式)</span>
      </a-row>
      <p></p>
      <a-row>
        <a-col :span="16">
          <a-upload-dragger accept=".xlsx,.xls" :multiple="false" :customRequest="customRequest" @change="handleChange" :beforeUpload="beforeUpload">
            <a-icon style="font-size: 40px;" type="cloud-upload" />
          </a-upload-dragger>
        </a-col>
        <!--<a-col :span="8">
          <span>导入模式:</span>
          <a-select
            style="width: 130px"
            placeholder="请选择导入模式"
            v-model="importExcelType">
            <a-select-option
              v-for="(item,index) in importExcelTypeData"
              :key="index"
              :value="item.code">{{ item.name }}
            </a-select-option>
          </a-select>
        </a-col>-->
      </a-row>
      <a-row :span="24">
        <!--<a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="!detailed">
          ç‚¹å‡»æŸ¥çœ‹æ–‡ä»¶ä¸Šä¼ è¦æ±‚
        </a-button>-->
        <span>【</span>
        <a-button style="width: 90px;text-align: left;" @click="wmsControlRuleDownloadExcelTemplate" type="link">下载导入模板</a-button>,填写并上传
        <span>】</span>
        <a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="detailed">
          æ”¶èµ·
        </a-button>
      </a-row>
      <a-row v-show="detailed" style="background: #fef4e8; height: 30px;" :span="24">
        <a-breadcrumb>
          <a-breadcrumb-item style="line-height: 30px;color: #faad14;margin-left: 18px;">文件上传要求</a-breadcrumb-item>
        </a-breadcrumb>
      </a-row>
      <pre v-show="detailed">
        <div v-html="demandText"></div>
      </pre>
      <a-table v-show="detailed" :columns="columns" :data-source="dataList" :rowKey="(record) => record.processID" :pagination="false"></a-table>
      <pre v-show="detailed">
        <div v-html="columnText"></div>
      </pre>
    </a-spin>
  </a-modal>
</template>
<script>
  import { downloadFile, checkFile, parseExcelFieldText, parseDemandText } from '@/utils/util'
  import { WmsControlRuleImportExcel, WmsControlRuleDownloadExcelTemplate} from '@/api/modular/main/WmsBase/WmsControlRuleManage'
  import { sysExcelTemplateGetColumnList } from '@/api/modular/system/excelTemplateManage'
  export default {
  components: {
  },
  data() {
  return {
  visible: false,
  detailed: false,
  confirmLoading: false,
  fileList: [],
  importExcelTypeData: [],
  importExcelType: '1',
  uploadFile: null,
  columns: [],
  dataList: [],
  demandText:'',
  columnText: ''
  }
  },
  methods: {
  index() {
  this.visible = true;
  this.importExcelTypeData = this.$options.filters['dictData']('import_excel_type')
  this.demandText = parseDemandText("wmsControlRuleDownloadExcelTemplate")
  window.downloadFile = this.wmsControlRuleDownloadExcelTemplate;
  this.getTable();
  },
  showDemand() {
  this.detailed = !this.detailed;
  },
  customRequest(document) {
  this.uploadFile = document
  },
  getTable() {
  sysExcelTemplateGetColumnList({className: "WmsControlRule"}).then(res =>
  {
  if (res.success) {
  this.columns =[];
  this.dataList = [{}];
  res.data.forEach(x => {
  this.columns.push({
  dataIndex: x.columnName,
  key: x.columnName,
  title: x.columnComment
  });
  this.dataList[0][x.columnName] = x.isRequired ? "必填" : "非必填"
  });
  this.columnText = parseExcelFieldText(res.data);
  }
  });
  },
  beforeUpload(fileInfo) {
  let res = checkFile(fileInfo, 1073741824, ['.xlsx', '.xls']);
  if (!res.success) {
  this.$message.warning(res.msg)
  return false
  }
  setTimeout(() => {this.uploadFile.onSuccess(this.uploadFile.file)}, 1000)
  },
  handleChange(fileInfo) {
  if (fileInfo.file.status === 'error') {
  fileInfo.fileList.splice(0, 1)
  }
  if (fileInfo.file.status === 'done') {
  if (fileInfo.fileList.length > 1) {
  fileInfo.fileList.splice(0, 1)
  }
  this.fileList = fileInfo.file
  }
  },
  handleSubmit() {
  this.confirmLoading = true
  const formData = new FormData()
  formData.append('file', this.uploadFile.file)
  WmsControlRuleImportExcel(formData, {importExcelType: this.importExcelType}).then(res => {
  this.$message.success('操作成功')
  this.confirmLoading = false
  this.$emit('ok', [])
  this.handleCancel()
  }).finally((res)=>{this.confirmLoading = false})
  },
  handleCancel() {
  this.visible = false
  this.detailed = false
  },
  wmsControlRuleDownloadExcelTemplate() {
  WmsControlRuleDownloadExcelTemplate({version: "v2"}).then((res) => {
  downloadFile(res);
  }).catch((err) => {
  this.$message.error('下载错误:获取文件流错误' + err)
  })
  }
  }
  }
</script>
<style scoped>
::v-deep .ant-upload.ant-upload-drag {
  position: relative;
  width: 140px;
  height: 135px;
  text-align: center;
  background: #fafafa;
  border: 1px dashed #d9d9d9;
  border-radius: 2px;
  cursor: pointer;
  -webkit-transition: border-color 0.3s;
  transition: border-color 0.3s;
}
::v-deep .ant-btn:focus:not(.ant-btn-primary):not(.ant-btn-danger), .ant-btn:hover:not(.ant-btn-primary):not(.ant-btn-danger) {
  color: #ffc53d;
  border-color: white;
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsControlRule/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,512 @@
<template>
  <!-- æŽ§åˆ¶å±žæ€§è§„则 -->
  <div ref="boxOutWrap" class="boxOutWrap">
    <div ref="boxForm" class="boxForm">
      <a-card :bordered="false" :bodyStyle="tstyle">
        <div class="table-page-search-wrapper" v-if="hasPerm('WmsControlRule:page')">
          <a-form layout="inline">
            <a-row :gutter="48">
              <a-col :md="8" :sm="24">
                <a-form-item label="规则编号">
                  <a-input v-model="queryParam.ruleCode" allow-clear placeholder="请输入规则编号" />
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="规则名称">
                  <a-input v-model="queryParam.ruleName" allow-clear placeholder="请输入规则名称" />
                </a-form-item> </a-col
              ><template v-if="advanced">
                <a-col :md="8" :sm="24">
                  <a-form-item label="规则描述">
                    <a-input v-model="queryParam.ruleDesc" allow-clear placeholder="请输入规则描述" />
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="24">
                  <a-form-item label="是否禁用">
                    <a-select
                      :allowClear="true"
                      style="width: 100%"
                      v-model="queryParam.isDisabled"
                      placeholder="请选择是否禁用"
                    >
                      <a-select-option v-for="(item, index) in isDisabledData" :key="index" :value="item.code">{{
                        item.name
                      }}</a-select-option>
                    </a-select>
                  </a-form-item>
                </a-col>
                <!--年月日时分秒-->
                <!--时间范围-->
                <a-col :md="8" :sm="24">
                  <a-form-item label="创建时间">
                    <a-range-picker
                      style="width: 100%"
                      :placeholder="['开始时间', '结束时间']"
                      :show-time="{
                        format: 'HH:mm:ss',
                        defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')]
                      }"
                      v-model="queryParam.createdTime"
                      value-format="YYYY-MM-DD HH:mm:ss"
                      format="YYYY-MM-DD HH:mm:ss"
                      @change="onChangecreatedTime"
                    />
                  </a-form-item>
                </a-col>
                <!--年月日时分秒-->
                <!--时间范围-->
                <a-col :md="8" :sm="24">
                  <a-form-item label="更新时间">
                    <a-range-picker
                      style="width: 100%"
                      :placeholder="['开始时间', '结束时间']"
                      :show-time="{
                        format: 'HH:mm:ss',
                        defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')]
                      }"
                      v-model="queryParam.updatedTime"
                      value-format="YYYY-MM-DD HH:mm:ss"
                      format="YYYY-MM-DD HH:mm:ss"
                      @change="onChangeupdatedTime"
                    />
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="24">
                  <a-form-item label="创建者名称">
                    <a-input v-model="queryParam.createdUserName" allow-clear placeholder="请输入创建者名称" />
                  </a-form-item>
                </a-col>
                <a-col :md="8" :sm="24">
                  <a-form-item label="修改者名称">
                    <a-input v-model="queryParam.updatedUserName" allow-clear placeholder="请输入修改者名称" />
                  </a-form-item>
                </a-col>
              </template>
              <a-col :md="8" :sm="24">
                <span class="table-page-search-submitButtons">
                  <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
                  <a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
                  <a @click="toggleAdvanced" style="margin-left: 8px">
                    {{ advanced ? '收起' : '展开' }}
                    <a-icon :type="advanced ? 'up' : 'down'" />
                  </a>
                </span>
              </a-col>
            </a-row>
          </a-form>
        </div>
      </a-card>
    </div>
    <a-card :bordered="false">
      <s-table
        ref="table"
        :columns="columns"
        :data="loadData"
        :alert="true"
        @changeTablePage="pageInfo = $event"
        :scroll="{ x: true, y: tableHeight }"
        :rowKey="record => record.id"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
      >
        <template class="table-operator" slot="operator" v-if="hasPerm('WmsControlRule:add')">
          <!-- <div ref="actionBar" class="actionBar">
            <a-button
              type="info"
              v-if="hasPerm('sysExcelTemplate:importExcel')"
              icon="upload"
              @click="$refs.excelForm.index()"
            >
              å¯¼å…¥
            </a-button>
            <a-button
              type="info"
              v-if="hasPerm('WmsControlRule:exportExcel')"
              icon="download"
              @click="WmsControlRuleToExcel()"
            >
              å¯¼å‡º
            </a-button>
            <a-button type="primary" v-if="hasPerm('WmsControlRule:add')" icon="plus" @click="$refs.addForm.add()"
              >新增控制属性规则</a-button
            >
          </div> -->
        </template>
        <span slot="isDisabledscopedSlots" slot-scope="text">
          <div v-if="text === true">
            <a-tag color="green">是</a-tag>
          </div>
          <div v-else-if="text == false">
            <a-tag color="volcano">否</a-tag>
          </div>
          <div v-else=""></div>
        </span>
        <span slot="action" slot-scope="text, record">
          <!-- è‡ªå®šä¹‰ -->
          <a v-if="hasPerm('WmsControlRule:getdetail')" @click="$refs.detailForm.edit(record)">详情</a>
          &nbsp;&nbsp;
          </a-popconfirm>
        </span>
      </s-table>
      <add-form ref="addForm" @ok="handleOk" />
      <edit-form ref="editForm" @ok="handleOk" />
      <excel-form ref="excelForm" @ok="handleOk" />
      <!-- è‡ªå®šä¹‰ -->
      <detail-form ref="detailForm" @ok="handleOk" />
    </a-card>
  </div>
</template>
<script>
import { STable } from '@/components'
import moment from 'moment'
import {
  WmsControlRulePage,
  WmsControlRuleDelete,
  WmsControlRuleToExcel
} from '@/api/modular/main/WmsBase/WmsControlRuleManage'
//自定义table高度
import setTableHtMixin from '@/mixins/handleTableHt.js'
import addForm from './addForm.vue'
import { exportExcel } from '@/utils/exportToExcel'
import { downloadFile } from '@/utils/util'
import editForm from './editForm.vue'
import excelForm from './excelForm.vue'
import detailForm from './details.vue'
export default {
  mixins: [setTableHtMixin],
  components: {
    STable,
    addForm,
    editForm,
    excelForm,
    detailForm
  },
  data() {
    return {
      advanced: false, // é«˜çº§æœç´¢ å±•å¼€/关闭
      queryParam: {},
      pageInfo: {
        current: 1,
        pageSize: 10
      },
      columns: [
        {
          title: '序号',
          width: '60px',
          align: 'center',
          customRender: (text, record, index) => `${index + 1 + (this.pageInfo.current - 1) * this.pageInfo.pageSize}`
        },
        {
          title: '规则编号',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'ruleCode'
        },
        {
          title: '规则名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'ruleName'
        },
        {
          title: '规则描述',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'ruleDesc'
        },
        {
          title: '是否禁用',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'isDisabled',
          scopedSlots: { customRender: 'isDisabledscopedSlots' }
        },
        {
          title: '创建时间',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'createdTime'
        },
        {
          title: '更新时间',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'updatedTime'
        },
        {
          title: '创建者名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'createdUserName'
        },
        {
          title: '修改者名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'updatedUserName'
        }
      ],
      tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
      // åŠ è½½æ•°æ®æ–¹æ³• å¿…须为 Promise å¯¹è±¡
      loadData: parameter => {
        return WmsControlRulePage(Object.assign(parameter, this.switchingDate())).then(res => {
          return res.data
        })
      },
      selectedRowKeys: [],
      selectedRows: []
    }
  },
  created() {
    if (this.hasPerm('WmsControlRule:edit') || this.hasPerm('WmsControlRule:delete')) {
      this.columns.push({
        title: '操作',
        width: '150px',
        dataIndex: 'action',
        scopedSlots: { customRender: 'action' }
      })
    }
    const path = this.$route.path
    const columnStr = window.localStorage.getItem(path)
    if (columnStr) {
      var _columns = JSON.parse(columnStr)
      this.columns.forEach(element => {
        var fObj = _columns.find((item, index) => {
          return item.dataIndex === element.dataIndex
        })
        if (fObj != undefined && fObj != null) {
          element.checked = fObj.checked
        }
      })
    }
    const isDisabledOption = this.$options
    this.isDisabledData = isDisabledOption.filters['dictData']('yes_true_false')
    this.handleTableHt() //设置主表表格高度
    window.addEventListener(
      'resize',
      () => {
        this.handleTableHt() // ç›‘听屏幕大小改变表格高度
      },
      false
    )
  },
  methods: {
    moment,
    /**
     * æŸ¥è¯¢å‚数组装
     */
    switchingDate() {
      const obj = JSON.parse(JSON.stringify(this.queryParam))
      return obj
    },
    WmsControlRuleDelete(record) {
      WmsControlRuleDelete(record).then(res => {
        if (res.success) {
          this.$message.success('删除成功')
          this.$refs.table.refresh()
        } else {
          this.$message.error('删除失败') // + res.message
        }
      })
    },
    WmsControlRuleToExcel() {
      this.loading = true
      let entozh = {}
      const path = this.$route.path
      if (window.localStorage.getItem(path)) {
        JSON.parse(window.localStorage.getItem(path)).forEach(item => {
          if (item.dataIndex != 'action' && item.checked) {
            entozh[item.dataIndex] = item.title
          }
        })
      } else {
        //直接点导出
        this.columns.forEach(item => {
          if (item.dataIndex != 'action') {
            entozh[item.dataIndex] = item.title
          }
        })
      }
      WmsControlRulePage(Object.assign({ pageSize: 100000, pageIndex: 1 }, this.queryParam))
        .then(res => {
          this.loading = false
          //需要截取日期的字段
          var arrDataCutout = this.columns.filter(v => v.customCutout == true)
          res.data.rows.forEach(item => {
            var arrKeys = Object.keys(item)
            arrKeys.forEach(key => {
              var strFieldDic = key + 'Data'
              //枚举转值
              if (this[strFieldDic] && this[strFieldDic].length > 0) {
                let arrFieldDic = this[strFieldDic].filter(v => String(v.code) == String(item[key]))
                if (arrFieldDic.length > 0) {
                  item[key] = arrFieldDic[0]?.name || '没有枚举值'
                }
              }
              // æ—¥æœŸæˆªå–
              if (arrDataCutout.length > 0) {
                arrDataCutout.forEach(itemIn => {
                  if (key == itemIn.dataIndex && item[key]) {
                    item[key] = item[key].split(' ')[0]
                  }
                })
              }
            })
          })
          exportExcel(res.data.rows, entozh, 'xlsx', `${this.$route.meta.title}`)
        })
        .catch(err => {
          this.loading = false
          this.$message.error('下载错误:获取文件流错误' + err)
        })
    },
    toggleAdvanced() {
      this.advanced = !this.advanced
      this.handleTableHt() //设置主表表格高度
    },
    onChangecreatedTime(date, dateString) {
      this.queryParam.createdTime = dateString
    },
    onChangeupdatedTime(date, dateString) {
      this.queryParam.updatedTime = dateString
    },
    handleOk() {
      this.$refs.table.refresh()
    },
    onSelectChange(selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
    }
  }
}
</script>
<style lang="less">
.table-operator {
  margin-bottom: 18px;
}
button {
  margin-right: 8px;
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/addForm.vue
ÎļþÃû´Ó iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormWmsSubstituteGood.vue ÐÞ¸Ä
@@ -1,6 +1,13 @@
<template>
  <!-- æ›¿ä»£å“ç®¡ç† -->
    <a-form :form="form">
  <a-modal
    title="新增替代品管理"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
        <a-form :form="form">
        <a-form-item label="替代编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入替代编号" v-decorator="['substituteCode', {rules: [{required: true, message: '请输入替代编号!'}]}]" />
        </a-form-item>
@@ -23,6 +30,8 @@
          <a-switch v-decorator="['isDisabled',{rules: [{ required: true, message: '请选择是否禁用!' }], valuePropName: 'checked'}]" />
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/addFormWmsSubstituteGood.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,285 @@
<template>
  <!-- æ›¿ä»£å“ç®¡ç† -->
  <div style="background-color: white">
    <!-- <a-spin :spinning="loading"> -->
    <div class="wms-task-management-detail-div">
      <div class="drawer-content">
        <!-- <span style="font-weight:bold;cursor:default;">
          <a style="cursor:default;">{{ row.no }}</a>单据详情
        </span> -->
        <div style="margin-top: 10px;">
          <a-table :columns="columns" :data-source="list" row-key="id" :pagination="false" :scroll="{ x: true }">
            <template slot="index" slot-scope="text, record, index">{{ index + 1 }}</template>
            <span slot="containerStatusscopedSlots" slot-scope="text">
              <a-tag :color="text == '1' ? '#daa520' : text == '2' ? '#cd5c5c' : text == '3' ? '#add8e6' : '#696969'">{{
                'orderdetails_statusenum' | dictType(text)
              }}</a-tag>
            </span>
            <span slot="action" slot-scope="text, record">
              <a-popconfirm v-if="hasPerm('BaseCustomer:delete')" placement="topRight" title="确认删除?"
                @confirm="() => itemDelete(record, index)">
                <a>删除</a>
              </a-popconfirm>
            </span>
          </a-table>
        </div>
      </div>
      <p @click="visible = true">新增行</p>
      <a-modal title="替代品列表" :width="900" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit"
        @cancel="handleCancel">
        <show-list ref="showList" @ok="handleOk" />
        <!-- <a-spin :spinning="confirmLoading"></a-spin> -->
      </a-modal>
    </div>
  </div>
</template>
<script>
import { WmsOrderRukuDetail } from '@/api/modular/main/WmsOrderManage'
import showList from './index.vue'
export default {
  name: 'wmsOrderRukuManagementDetailDrawer',
  emits: ['update:visible'],
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    row: {
      type: Object,
      default: function () {
        return {}
      }
    }
  },
  components: {
    showList
  },
  data() {
    return {
      loading: false,
      containerStatusData: [],
      list: [],
      columns: [
        {
          dataIndex: 'index',
          title: '序号',
          fixed: 'left',
          width: '60',
          scopedSlots: { customRender: 'index' },
          align: 'center'
        },
        {
                    title: '替代编号',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'substituteCode'
                },
                {
                    title: '物料编号',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'materialCode'
                },
                {
                    title: '物料名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'materialName'
                },
                {
                    title: '替代品物料编号',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '140px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '140px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'substituteMaterialCode'
                },
                {
                    title: '替代品物料名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '140px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '140px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'substituteMaterialName'
                },
                {
                    title: '替代次序',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'substituteIndex'
                },
      ],
      // åˆ†é¡µ
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30', '40'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + '共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0,
        size: 'small'
      }
    }
  },
  created() {
    const containerStatusOption = this.$options
    this.containerStatusData = containerStatusOption.filters['dictData']('orderdetails_statusenum')
    this.columns.push({
      title: '操作',
      width: '150px',
      dataIndex: 'action',
      scopedSlots: { customRender: 'action' }
    })
  },
  methods: {
    onClose() {
      this.close()
    },
    close() {
      this.$emit('update:visible', false)
    },
    afterVisibleChange(visible) {
      if (visible) {
        this.initShow()
      } else {
        this.afterClsoe()
      }
    },
    initShow() {
      this.loading = true
      this.getList(() => {
        this.loading = false
      })
    },
    getList(row) {
      let params = { id: row.id }
      WmsOrderRukuDetail(params)
        .then(d => {
          this.list = d.data.rows || []
          this.$emit('update:visible', true)
          // callback && callback(true)
        })
        .catch(() => {
          this.$emit('update:visible', false)
          this.list = []
          // callback && callback(false)
        })
    },
    afterClsoe() {
      this.list = []
    },
    handleOk(param) {
      this.list = param
    },
    handleSubmit() {
      this.visible = false
    },
    handleCancel() {
      this.visible = false
    },
    itemDelete(record, index) {
      this.list.splice(index, 1)
    }
  }
}
</script>
<style lang="less" scoped>
.wms-task-management-detail-div {
  height: 100%;
  overflow: auto;
  .drawer-content {
    padding: 16px;
  }
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/editForm.vue
copy from iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormWmsSubstituteGood.vue copy to iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/editForm.vue
Îļþ´Ó iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormWmsSubstituteGood.vue ¸´ÖÆ
@@ -1,6 +1,13 @@
<template>
  <!-- æ›¿ä»£å“ç®¡ç† -->
    <a-form :form="form">
  <a-modal
    title="编辑替代品管理"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-form-item label="替代编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入替代编号" v-decorator="['substituteCode', {rules: [{required: true, message: '请输入替代编号!'}]}]" />
        </a-form-item>
@@ -22,17 +29,21 @@
        <a-form-item label="是否禁用" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-switch v-decorator="['isDisabled',{rules: [{ required: true, message: '请选择是否禁用!' }], valuePropName: 'checked'}]" />
        </a-form-item>
        <a-form-item v-show="false"><a-input v-decorator="['id']" /></a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
  import moment from 'moment'
import moment from 'moment'
  import {
  WmsSubstituteGoodAdd
  WmsSubstituteGoodEdit
  } from '@/api/modular/main/WmsBase/WmsSubstituteGoodManage'
  export default {
  data () {
  return {
  Id: 0,
  labelCol: {
  xs: { span: 24 },
  sm: { span: 5 }
@@ -41,6 +52,7 @@
  xs: { span: 24 },
  sm: { span: 15 }
  },
  record: {},
        visible: false,
        confirmLoading: false,
        form: this.$form.createForm(this)
@@ -49,41 +61,58 @@
    methods: {
    moment,
      // åˆå§‹åŒ–方法
      add (record) {
        this.visible = true
      edit (record) {
        this.visible = true;
        this.Id = record.id;
        this.$nextTick(() => {
        });
        //深度拷贝 ç§»é™¤VUE的监听,防止INDEX页面值变动
        this.record = JSON.parse(JSON.stringify(record))
        this.$nextTick(() => {
          this.form.setFieldsValue(
            {
              id: record.id,
              substituteCode: record.substituteCode,
              materialCode: record.materialCode,
              materialName: record.materialName,
              substituteMaterialCode: record.substituteMaterialCode,
              substituteMaterialName: record.substituteMaterialName,
              substituteIndex: record.substituteIndex,
              isDisabled: record.isDisabled
            }
          )
        })
      },
      /**
       * æäº¤è¡¨å•
       */
      handleSubmit () {
        const { form: { validateFields } } = this
        this.confirmLoading = true
        validateFields((errors, values) => {
          if (!errors) {
            for (const key in values) {
              if (values[key] == null) continue
              if (typeof (values[key]) === 'object') {
                values[key] = JSON.stringify(values[key])
                 this.record[key] = values[key]
              } else {
                 this.record[key] = values[key]
              }
            }
            WmsSubstituteGoodAdd(values).then((res) => {
            WmsSubstituteGoodEdit(this.record).then((res) => {
              if (res.success) {
                this.$message.success('新增成功')
                this.$message.success('编辑成功')
                this.confirmLoading = false
                this.$emit('ok', values)
                this.$emit('ok', this.record)
                this.handleCancel()
              } else {
                this.$message.error('新增失败:' + JSON.stringify(res.message))
                this.$message.error('编辑失败:' + JSON.stringify(res.message))
              }
            }).finally((res) => {
              this.confirmLoading = false
            })
          } else {
          }else{
            this.confirmLoading = false
          }
        })
          }
        });
      },
      handleCancel () {
        this.form.resetFields()
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/excelForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,181 @@
<template>
  <a-modal
    :width="850"
    :destroyOnClose="true"
    :visible="visible"
    :forceRender="true"
    title="批量导入"
    cancelText="取消上传"
    okText="开始上传"
    @cancel="handleCancel"
    @ok="handleSubmit">
    <a-spin :spinning="confirmLoading">
      <a-row :span="24">
        <span>请选择要导入的数据文件(Excel格式)</span>
      </a-row>
      <p></p>
      <a-row>
        <a-col :span="16">
          <a-upload-dragger accept=".xlsx,.xls" :multiple="false" :customRequest="customRequest" @change="handleChange" :beforeUpload="beforeUpload">
            <a-icon style="font-size: 40px;" type="cloud-upload" />
          </a-upload-dragger>
        </a-col>
        <!--<a-col :span="8">
          <span>导入模式:</span>
          <a-select
            style="width: 130px"
            placeholder="请选择导入模式"
            v-model="importExcelType">
            <a-select-option
              v-for="(item,index) in importExcelTypeData"
              :key="index"
              :value="item.code">{{ item.name }}
            </a-select-option>
          </a-select>
        </a-col>-->
      </a-row>
      <a-row :span="24">
        <!--<a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="!detailed">
          ç‚¹å‡»æŸ¥çœ‹æ–‡ä»¶ä¸Šä¼ è¦æ±‚
        </a-button>-->
        <span>【</span>
        <a-button style="width: 90px;text-align: left;" @click="wmsSubstituteGoodDownloadExcelTemplate" type="link">下载导入模板</a-button>,填写并上传
        <span>】</span>
        <a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="detailed">
          æ”¶èµ·
        </a-button>
      </a-row>
      <a-row v-show="detailed" style="background: #fef4e8; height: 30px;" :span="24">
        <a-breadcrumb>
          <a-breadcrumb-item style="line-height: 30px;color: #faad14;margin-left: 18px;">文件上传要求</a-breadcrumb-item>
        </a-breadcrumb>
      </a-row>
      <pre v-show="detailed">
        <div v-html="demandText"></div>
      </pre>
      <a-table v-show="detailed" :columns="columns" :data-source="dataList" :rowKey="(record) => record.processID" :pagination="false"></a-table>
      <pre v-show="detailed">
        <div v-html="columnText"></div>
      </pre>
    </a-spin>
  </a-modal>
</template>
<script>
  import { downloadFile, checkFile, parseExcelFieldText, parseDemandText } from '@/utils/util'
  import { WmsSubstituteGoodImportExcel, WmsSubstituteGoodDownloadExcelTemplate} from '@/api/modular/main/WmsBase/WmsSubstituteGoodManage'
  import { sysExcelTemplateGetColumnList } from '@/api/modular/system/excelTemplateManage'
  export default {
  components: {
  },
  data() {
  return {
  visible: false,
  detailed: false,
  confirmLoading: false,
  fileList: [],
  importExcelTypeData: [],
  importExcelType: '1',
  uploadFile: null,
  columns: [],
  dataList: [],
  demandText:'',
  columnText: ''
  }
  },
  methods: {
  index() {
  this.visible = true;
  this.importExcelTypeData = this.$options.filters['dictData']('import_excel_type')
  this.demandText = parseDemandText("wmsSubstituteGoodDownloadExcelTemplate")
  window.downloadFile = this.wmsSubstituteGoodDownloadExcelTemplate;
  this.getTable();
  },
  showDemand() {
  this.detailed = !this.detailed;
  },
  customRequest(document) {
  this.uploadFile = document
  },
  getTable() {
  sysExcelTemplateGetColumnList({className: "WmsSubstituteGood"}).then(res =>
  {
  if (res.success) {
  this.columns =[];
  this.dataList = [{}];
  res.data.forEach(x => {
  this.columns.push({
  dataIndex: x.columnName,
  key: x.columnName,
  title: x.columnComment
  });
  this.dataList[0][x.columnName] = x.isRequired ? "必填" : "非必填"
  });
  this.columnText = parseExcelFieldText(res.data);
  }
  });
  },
  beforeUpload(fileInfo) {
  let res = checkFile(fileInfo, 1073741824, ['.xlsx', '.xls']);
  if (!res.success) {
  this.$message.warning(res.msg)
  return false
  }
  setTimeout(() => {this.uploadFile.onSuccess(this.uploadFile.file)}, 1000)
  },
  handleChange(fileInfo) {
  if (fileInfo.file.status === 'error') {
  fileInfo.fileList.splice(0, 1)
  }
  if (fileInfo.file.status === 'done') {
  if (fileInfo.fileList.length > 1) {
  fileInfo.fileList.splice(0, 1)
  }
  this.fileList = fileInfo.file
  }
  },
  handleSubmit() {
  this.confirmLoading = true
  const formData = new FormData()
  formData.append('file', this.uploadFile.file)
  WmsSubstituteGoodImportExcel(formData, {importExcelType: this.importExcelType}).then(res => {
  this.$message.success('操作成功')
  this.confirmLoading = false
  this.$emit('ok', [])
  this.handleCancel()
  }).finally((res)=>{this.confirmLoading = false})
  },
  handleCancel() {
  this.visible = false
  this.detailed = false
  },
  wmsSubstituteGoodDownloadExcelTemplate() {
  WmsSubstituteGoodDownloadExcelTemplate({version: "v2"}).then((res) => {
  downloadFile(res);
  }).catch((err) => {
  this.$message.error('下载错误:获取文件流错误' + err)
  })
  }
  }
  }
</script>
<style scoped>
::v-deep .ant-upload.ant-upload-drag {
  position: relative;
  width: 140px;
  height: 135px;
  text-align: center;
  background: #fafafa;
  border: 1px dashed #d9d9d9;
  border-radius: 2px;
  cursor: pointer;
  -webkit-transition: border-color 0.3s;
  transition: border-color 0.3s;
}
::v-deep .ant-btn:focus:not(.ant-btn-primary):not(.ant-btn-danger), .ant-btn:hover:not(.ant-btn-primary):not(.ant-btn-danger) {
  color: #ffc53d;
  border-color: white;
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/WmsSubstituteGood/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,547 @@
<template>
    <div ref="boxOutWrap" class="boxOutWrap">
        <div ref="boxForm" class="boxForm">
            <a-card :bordered="false" :bodyStyle="tstyle">
                <div class="table-page-search-wrapper" v-if="hasPerm('WmsSubstituteGood:page')">
                    <a-form layout="inline">
                        <a-row :gutter="48">
                            <a-col :md="8" :sm="24">
                                <a-form-item label="替代编号">
                                    <a-input v-model="queryParam.substituteCode" allow-clear placeholder="请输入替代编号" />
                                </a-form-item>
                            </a-col>
                            <a-col :md="8" :sm="24">
                                <a-form-item label="物料编号">
                                    <a-input v-model="queryParam.materialCode" allow-clear placeholder="请输入物料编号" />
                                </a-form-item>
                            </a-col><template v-if="advanced">
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="物料名称">
                                        <a-input v-model="queryParam.materialName" allow-clear placeholder="请输入物料名称" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="替代品物料编号">
                                        <a-input v-model="queryParam.substituteMaterialCode" allow-clear
                                            placeholder="请输入替代品物料编号" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="替代品物料名称">
                                        <a-input v-model="queryParam.substituteMaterialName" allow-clear
                                            placeholder="请输入替代品物料名称" />
                                    </a-form-item>
                                </a-col><a-col :md="8" :sm="24">
                                    <a-form-item label="替代次序">
                                        <a-input-number v-model="queryParam.substituteIndex" style="width: 100%" allow-clear
                                            placeholder="请输入替代次序" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="是否禁用">
                                        <a-select :allowClear="true" style="width: 100%" v-model="queryParam.isDisabled"
                                            placeholder="请选择是否禁用">
                                            <a-select-option v-for="(item, index) in isDisabledData" :key="index"
                                                :value="item.code">{{ item.name }}</a-select-option>
                                        </a-select>
                                    </a-form-item>
                                </a-col>
                                <!--年月日时分秒-->
                                <!--时间范围-->
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="创建时间">
                                        <a-range-picker style="width: 100%" :placeholder="['开始时间', '结束时间']" :show-time="{
                                            format: 'HH:mm:ss', defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')]
                                        }"
                                            v-model="queryParam.createdTime" value-format="YYYY-MM-DD HH:mm:ss"
                                            format="YYYY-MM-DD HH:mm:ss" @change="onChangecreatedTime" />
                                    </a-form-item>
                                </a-col>
                                <!--年月日时分秒-->
                                <!--时间范围-->
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="更新时间">
                                        <a-range-picker style="width: 100%" :placeholder="['开始时间', '结束时间']" :show-time="{
                                            format: 'HH:mm:ss', defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')]
                                        }"
                                            v-model="queryParam.updatedTime" value-format="YYYY-MM-DD HH:mm:ss"
                                            format="YYYY-MM-DD HH:mm:ss" @change="onChangeupdatedTime" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="创建者名称">
                                        <a-input v-model="queryParam.createdUserName" allow-clear placeholder="请输入创建者名称" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="修改者名称">
                                        <a-input v-model="queryParam.updatedUserName" allow-clear placeholder="请输入修改者名称" />
                                    </a-form-item>
                                </a-col> </template>
                            <a-col :md="8" :sm="24">
                                <span class="table-page-search-submitButtons">
                                    <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
                                    <a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
                                    <a @click="toggleAdvanced" style="margin-left: 8px"> {{ advanced ? '收起' : '展开' }}
                                        <a-icon :type="advanced ? 'up' : 'down'" />
                                    </a>
                                </span>
                            </a-col>
                        </a-row>
                    </a-form>
                </div>
            </a-card>
        </div>
        <a-card :bordered="false">
            <s-table ref="table" :columns="columns" :data="loadData" :alert="true" @changeTablePage="pageInfo = $event"
                :scroll="{ x: true, y: tableHeight }" :rowKey="(record) => record.id"
                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
                <!-- <template class="table-operator" slot="operator" v-if="hasPerm('WmsSubstituteGood:add')">
                    <div ref="actionBar" class="actionBar">
                        <a-button type="info" v-if="hasPerm('sysExcelTemplate:importExcel')" icon="upload"
                            @click="$refs.excelForm.index()">
                            å¯¼å…¥
                        </a-button>
                        <a-button type="info" v-if="hasPerm('WmsSubstituteGood:exportExcel')" icon="download"
                            @click="WmsSubstituteGoodToExcel()">
                            å¯¼å‡º
                        </a-button>
                        <a-button type="primary" v-if="hasPerm('WmsSubstituteGood:add')" icon="plus"
                            @click="$refs.addForm.add()">新增替代品管理</a-button>
                    </div>
                </template> -->
                <span slot="isDisabledscopedSlots" slot-scope="text">
                    <div v-if="text === true">
                        <a-tag color="green">是</a-tag>
                    </div>
                    <div v-else-if="text == false">
                        <a-tag color="volcano">否</a-tag>
                    </div>
                    <div v-else=""></div>
                </span>
                <span slot="action" slot-scope="text, record">
                    <a v-if="hasPerm('WmsSubstituteGood:edit')" @click="$refs.editForm.edit(record)">编辑</a>
                    <a-divider type="vertical"
                        v-if="hasPerm('WmsSubstituteGood:edit') & hasPerm('WmsSubstituteGood:delete')" />
                    <a-popconfirm v-if="hasPerm('WmsSubstituteGood:delete')" placement="topRight" title="确认删除?"
                        @confirm="() => WmsSubstituteGoodDelete(record)">
                        <a>删除</a>
                    </a-popconfirm>
                </span>
            </s-table>
            <add-form ref="addForm" @ok="handleOk" />
            <edit-form ref="editForm" @ok="handleOk" />
            <excel-form ref="excelForm" @ok="handleOk" />
        </a-card>
    </div>
</template>
<script>
import { STable } from '@/components'
import moment from 'moment'
import { WmsSubstituteGoodPage, WmsSubstituteGoodDelete, WmsSubstituteGoodToExcel } from '@/api/modular/main/WmsBase/WmsSubstituteGoodManage'
//自定义table高度
import setTableHtMixin from '@/mixins/handleTableHt.js'
import addForm from './addForm.vue'
import { exportExcel } from '@/utils/exportToExcel'
import { downloadFile } from '@/utils/util'
import editForm from './editForm.vue'
import excelForm from './excelForm.vue'
export default {
    mixins: [setTableHtMixin],
    components: {
        STable,
        addForm,
        editForm,
        excelForm
    },
    data() {
        return {
            advanced: false, // é«˜çº§æœç´¢ å±•å¼€/关闭
            queryParam: {},
            pageInfo: {
                current: 1,
                pageSize: 10
            },
            columns: [
                {
                    title: '序号',
                    width: '60px',
                    align: 'center',
                    customRender: (text, record, index) => `${index + 1 + (this.pageInfo.current - 1) * this.pageInfo.pageSize}`
                },
                {
                    title: '替代编号',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'substituteCode'
                },
                {
                    title: '物料编号',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'materialCode'
                },
                {
                    title: '物料名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'materialName'
                },
                {
                    title: '替代品物料编号',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '140px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '140px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'substituteMaterialCode'
                },
                {
                    title: '替代品物料名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '140px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '140px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'substituteMaterialName'
                },
                {
                    title: '替代次序',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'substituteIndex'
                },
                {
                    title: '是否禁用',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'isDisabled',
                    scopedSlots: { customRender: 'isDisabledscopedSlots' }
                },
                {
                    title: '创建时间',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'createdTime'
                },
                {
                    title: '更新时间',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'updatedTime'
                },
                {
                    title: '创建者名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'createdUserName'
                },
                {
                    title: '修改者名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'updatedUserName'
                }
            ],
            tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
            // åŠ è½½æ•°æ®æ–¹æ³• å¿…须为 Promise å¯¹è±¡
            loadData: parameter => {
                return WmsSubstituteGoodPage(Object.assign(parameter, this.switchingDate())).then((res) => {
                    return res.data
                })
            },
            selectedRowKeys: [],
            selectedRows: []
        }
    },
    created() {
        if (this.hasPerm('WmsSubstituteGood:edit') || this.hasPerm('WmsSubstituteGood:delete')) {
            this.columns.push({
                title: '操作',
                width: '150px',
                dataIndex: 'action',
                scopedSlots: { customRender: 'action' }
            })
        }
        const path = this.$route.path
        const columnStr = window.localStorage.getItem(path)
        if (columnStr) {
            var _columns = JSON.parse(columnStr)
            this.columns.forEach(element => {
                var fObj = _columns.find((item, index) => {
                    return item.dataIndex === element.dataIndex;
                })
                if (fObj != undefined && fObj != null) {
                    element.checked = fObj.checked;
                }
            });
        }
        const isDisabledOption = this.$options
        this.isDisabledData = isDisabledOption.filters['dictData']('yes_true_false')
        this.handleTableHt() //设置主表表格高度
        window.addEventListener(
            'resize',
            () => {
                this.handleTableHt() // ç›‘听屏幕大小改变表格高度
            },
            false
        )
    },
    methods: {
        moment,
        /**
        * æŸ¥è¯¢å‚数组装
        */
        switchingDate() {
            const obj = JSON.parse(JSON.stringify(this.queryParam))
            return obj
        },
        WmsSubstituteGoodDelete(record) {
            WmsSubstituteGoodDelete(record).then((res) => {
                if (res.success) {
                    this.$message.success('删除成功')
                    this.$refs.table.refresh()
                } else {
                    this.$message.error('删除失败') // + res.message
                }
            })
        },
        WmsSubstituteGoodToExcel() {
            this.loading = true
            let entozh = {};
            const path = this.$route.path;
            if (window.localStorage.getItem(path)) {
                JSON.parse(window.localStorage.getItem(path)).forEach(item => {
                    if (item.dataIndex != 'action' && item.checked) {
                        entozh[item.dataIndex] = item.title
                    }
                })
            } else { //直接点导出
                this.columns.forEach(item => {
                    if (item.dataIndex != 'action') {
                        entozh[item.dataIndex] = item.title
                    }
                })
            }
            WmsSubstituteGoodPage(Object.assign({ pageSize: 100000, pageIndex: 1 }, this.queryParam)).then((res) => {
                this.loading = false;
                //需要截取日期的字段
                var arrDataCutout = this.columns.filter(v => v.customCutout == true);
                res.data.rows.forEach(item => {
                    var arrKeys = Object.keys(item);
                    arrKeys.forEach(key => {
                        var strFieldDic = key + 'Data';
                        //枚举转值
                        if (this[strFieldDic] && this[strFieldDic].length > 0) {
                            let arrFieldDic = this[strFieldDic].filter(v => String(v.code) == String(item[key]));
                            if (arrFieldDic.length > 0) {
                                item[key] = arrFieldDic[0]?.name || '没有枚举值';
                            }
                        }
                        // æ—¥æœŸæˆªå–
                        if (arrDataCutout.length > 0) {
                            arrDataCutout.forEach(itemIn => {
                                if (key == itemIn.dataIndex && item[key]) {
                                    item[key] = item[key].split(" ")[0]
                                }
                            })
                        }
                    });
                })
                exportExcel(res.data.rows, entozh, "xlsx", `${this.$route.meta.title}`)
            }).catch((err) => {
                this.loading = false
                this.$message.error('下载错误:获取文件流错误' + err)
            })
        },
        toggleAdvanced() {
            this.advanced = !this.advanced
            this.handleTableHt() //设置主表表格高度
        },
        onChangecreatedTime(date, dateString) {
            this.queryParam.createdTime = dateString
        },
        onChangeupdatedTime(date, dateString) {
            this.queryParam.updatedTime = dateString
        },
        handleOk() {
            this.$refs.table.refresh()
        },
        onSelectChange(selectedRowKeys, selectedRows) {
            this.selectedRowKeys = selectedRowKeys
            this.selectedRows = selectedRows
            this.$emit('ok', selectedRows)
        }
    }
}
</script>
<style lang="less">.table-operator {
    margin-bottom: 18px;
}
button {
    margin-right: 8px;
}</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/addForm.vue
ÎļþÃû´Ó iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer.vue ÐÞ¸Ä
@@ -1,6 +1,13 @@
<template>
  <!-- æ–°å¢žå®¢æˆ·æ¡£æ¡ˆ -->
  <a-form :form="form">
  <a-modal
    title="新增客户档案"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
        <a-form :form="form">
        <a-form-item label="客户编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入客户编号" v-decorator="['custCode', {rules: [{required: true, message: '请输入客户编号!'}]}]" />
        </a-form-item>
@@ -44,6 +51,8 @@
          <a-switch v-decorator="['isDisabled', { valuePropName: 'checked' }]" />
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/addFormBaseCustomer.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,205 @@
<template>
  <div style="background-color: white">
    <!-- <a-spin :spinning="loading"> -->
    <div class="wms-task-management-detail-div">
      <div class="drawer-content">
        <!-- <span style="font-weight:bold;cursor:default;">
          <a style="cursor:default;">{{ row.no }}</a>单据详情
        </span> -->
        <div style="margin-top: 10px;">
          <a-table :columns="columns" :data-source="list" row-key="id" :pagination="false" :scroll="{ x: true }">
            <template slot="index" slot-scope="text, record, index">{{ index + 1 }}</template>
            <span slot="containerStatusscopedSlots" slot-scope="text">
              <a-tag :color="text == '1' ? '#daa520' : text == '2' ? '#cd5c5c' : text == '3' ? '#add8e6' : '#696969'">{{
                'orderdetails_statusenum' | dictType(text)
              }}</a-tag>
            </span>
            <span slot="action" slot-scope="text, record">
              <a-popconfirm v-if="hasPerm('BaseCustomer:delete')" placement="topRight" title="确认删除?"
                @confirm="() => itemDelete(record, index)">
                <a>删除</a>
              </a-popconfirm>
            </span>
          </a-table>
        </div>
      </div>
      <p @click="visible = true">新增行</p>
      <a-modal title="客户列表" :width="900" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit"
        @cancel="handleCancel">
        <show-list ref="showList" @ok="handleOk" />
        <!-- <a-spin :spinning="confirmLoading"></a-spin> -->
      </a-modal>
    </div>
  </div>
</template>
<script>
import { WmsOrderRukuDetail } from '@/api/modular/main/WmsOrderManage'
import showList from './index.vue'
export default {
  name: 'wmsOrderRukuManagementDetailDrawer',
  emits: ['update:visible'],
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    row: {
      type: Object,
      default: function () {
        return {}
      }
    }
  },
  components: {
    showList
  },
  data() {
    return {
      loading: false,
      containerStatusData: [],
      list: [],
      columns: [
        {
          dataIndex: 'index',
          title: '序号',
          fixed: 'left',
          width: '60',
          scopedSlots: { customRender: 'index' },
          align: 'center'
        },
        {
          title: '客户编号',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'custCode'
        },
        {
          title: '客户中文名称',
          align: 'center',
          customHeaderCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          customCell: () => {
            return {
              style: {
                'min-width': '120px' //最小列宽设置
              }
            }
          },
          sorter: true,
          dataIndex: 'custChinaName'
        }
      ],
      // åˆ†é¡µ
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30', '40'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + '共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0,
        size: 'small'
      }
    }
  },
  created() {
    const containerStatusOption = this.$options
    this.containerStatusData = containerStatusOption.filters['dictData']('orderdetails_statusenum')
    this.columns.push({
      title: '操作',
      width: '150px',
      dataIndex: 'action',
      scopedSlots: { customRender: 'action' }
    })
  },
  methods: {
    onClose() {
      this.close()
    },
    close() {
      this.$emit('update:visible', false)
    },
    afterVisibleChange(visible) {
      if (visible) {
        this.initShow()
      } else {
        this.afterClsoe()
      }
    },
    initShow() {
      this.loading = true
      this.getList(() => {
        this.loading = false
      })
    },
    getList(row) {
      let params = { id: row.id }
      WmsOrderRukuDetail(params)
        .then(d => {
          this.list = d.data.rows || []
          this.$emit('update:visible', true)
          // callback && callback(true)
        })
        .catch(() => {
          this.$emit('update:visible', false)
          this.list = []
          // callback && callback(false)
        })
    },
    afterClsoe() {
      this.list = []
    },
    handleOk(param) {
      this.list = param
    },
    handleSubmit() {
      this.visible = false
    },
    handleCancel() {
      this.visible = false
    },
    itemDelete(record, index) {
      this.list.splice(index, 1)
    }
  }
}
</script>
<style lang="less" scoped>
.wms-task-management-detail-div {
  height: 100%;
  overflow: auto;
  .drawer-content {
    padding: 16px;
  }
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/editForm.vue
copy from iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer.vue copy to iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/editForm.vue
Îļþ´Ó iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer.vue ¸´ÖÆ
@@ -1,6 +1,13 @@
<template>
  <!-- æ–°å¢žå®¢æˆ·æ¡£æ¡ˆ -->
  <a-form :form="form">
  <a-modal
    title="编辑客户档案"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-form-item label="客户编号" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input placeholder="请输入客户编号" v-decorator="['custCode', {rules: [{required: true, message: '请输入客户编号!'}]}]" />
        </a-form-item>
@@ -43,17 +50,21 @@
        <a-form-item label="是否禁用" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-switch v-decorator="['isDisabled', { valuePropName: 'checked' }]" />
        </a-form-item>
        <a-form-item v-show="false"><a-input v-decorator="['id']" /></a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
  import moment from 'moment'
import moment from 'moment'
  import {
  BaseCustomerAdd
  BaseCustomerEdit
  } from '@/api/modular/main/WmsBase/BaseCustomerManage'
  export default {
  data () {
  return {
  Id: 0,
  labelCol: {
  xs: { span: 24 },
  sm: { span: 5 }
@@ -62,6 +73,7 @@
  xs: { span: 24 },
  sm: { span: 15 }
  },
  record: {},
        visible: false,
        confirmLoading: false,
        form: this.$form.createForm(this)
@@ -70,41 +82,65 @@
    methods: {
    moment,
      // åˆå§‹åŒ–方法
      add (record) {
        this.visible = true
      edit (record) {
        this.visible = true;
        this.Id = record.id;
        this.$nextTick(() => {
        });
        //深度拷贝 ç§»é™¤VUE的监听,防止INDEX页面值变动
        this.record = JSON.parse(JSON.stringify(record))
        this.$nextTick(() => {
          this.form.setFieldsValue(
            {
              id: record.id,
              custCode: record.custCode,
              custChinaName: record.custChinaName,
              custEnglishName: record.custEnglishName,
              mnemonicCode: record.mnemonicCode,
              custType: record.custType,
              custTypeName: record.custTypeName,
              linkMan: record.linkMan,
              phone: record.phone,
              email: record.email,
              zipCode: record.zipCode,
              province: record.province,
              city: record.city,
              address: record.address,
              isDisabled: record.isDisabled
            }
          )
        })
      },
      /**
       * æäº¤è¡¨å•
       */
      handleSubmit () {
        const { form: { validateFields } } = this
        this.confirmLoading = true
        validateFields((errors, values) => {
          if (!errors) {
            for (const key in values) {
              if (values[key] == null) continue
              if (typeof (values[key]) === 'object') {
                values[key] = JSON.stringify(values[key])
                 this.record[key] = values[key]
              } else {
                 this.record[key] = values[key]
              }
            }
            BaseCustomerAdd(values).then((res) => {
            BaseCustomerEdit(this.record).then((res) => {
              if (res.success) {
                this.$message.success('新增成功')
                this.$message.success('编辑成功')
                this.confirmLoading = false
                this.$emit('ok', values)
                this.$emit('ok', this.record)
                this.handleCancel()
              } else {
                this.$message.error('新增失败:' + JSON.stringify(res.message))
                this.$message.error('编辑失败:' + JSON.stringify(res.message))
              }
            }).finally((res) => {
              this.confirmLoading = false
            })
          } else {
          }else{
            this.confirmLoading = false
          }
        })
          }
        });
      },
      handleCancel () {
        this.form.resetFields()
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/excelForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,181 @@
<template>
  <a-modal
    :width="850"
    :destroyOnClose="true"
    :visible="visible"
    :forceRender="true"
    title="批量导入"
    cancelText="取消上传"
    okText="开始上传"
    @cancel="handleCancel"
    @ok="handleSubmit">
    <a-spin :spinning="confirmLoading">
      <a-row :span="24">
        <span>请选择要导入的数据文件(Excel格式)</span>
      </a-row>
      <p></p>
      <a-row>
        <a-col :span="16">
          <a-upload-dragger accept=".xlsx,.xls" :multiple="false" :customRequest="customRequest" @change="handleChange" :beforeUpload="beforeUpload">
            <a-icon style="font-size: 40px;" type="cloud-upload" />
          </a-upload-dragger>
        </a-col>
        <!--<a-col :span="8">
          <span>导入模式:</span>
          <a-select
            style="width: 130px"
            placeholder="请选择导入模式"
            v-model="importExcelType">
            <a-select-option
              v-for="(item,index) in importExcelTypeData"
              :key="index"
              :value="item.code">{{ item.name }}
            </a-select-option>
          </a-select>
        </a-col>-->
      </a-row>
      <a-row :span="24">
        <!--<a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="!detailed">
          ç‚¹å‡»æŸ¥çœ‹æ–‡ä»¶ä¸Šä¼ è¦æ±‚
        </a-button>-->
        <span>【</span>
        <a-button style="width: 90px;text-align: left;" @click="baseCustomerDownloadExcelTemplate" type="link">下载导入模板</a-button>,填写并上传
        <span>】</span>
        <a-button @click="showDemand" style="width: 150px;text-align: left;" type="link" v-show="detailed">
          æ”¶èµ·
        </a-button>
      </a-row>
      <a-row v-show="detailed" style="background: #fef4e8; height: 30px;" :span="24">
        <a-breadcrumb>
          <a-breadcrumb-item style="line-height: 30px;color: #faad14;margin-left: 18px;">文件上传要求</a-breadcrumb-item>
        </a-breadcrumb>
      </a-row>
      <pre v-show="detailed">
        <div v-html="demandText"></div>
      </pre>
      <a-table v-show="detailed" :columns="columns" :data-source="dataList" :rowKey="(record) => record.processID" :pagination="false"></a-table>
      <pre v-show="detailed">
        <div v-html="columnText"></div>
      </pre>
    </a-spin>
  </a-modal>
</template>
<script>
  import { downloadFile, checkFile, parseExcelFieldText, parseDemandText } from '@/utils/util'
  import { BaseCustomerImportExcel, BaseCustomerDownloadExcelTemplate} from '@/api/modular/main/WmsBase/BaseCustomerManage'
  import { sysExcelTemplateGetColumnList } from '@/api/modular/system/excelTemplateManage'
  export default {
  components: {
  },
  data() {
  return {
  visible: false,
  detailed: false,
  confirmLoading: false,
  fileList: [],
  importExcelTypeData: [],
  importExcelType: '1',
  uploadFile: null,
  columns: [],
  dataList: [],
  demandText:'',
  columnText: ''
  }
  },
  methods: {
  index() {
  this.visible = true;
  this.importExcelTypeData = this.$options.filters['dictData']('import_excel_type')
  this.demandText = parseDemandText("baseCustomerDownloadExcelTemplate")
  window.downloadFile = this.baseCustomerDownloadExcelTemplate;
  this.getTable();
  },
  showDemand() {
  this.detailed = !this.detailed;
  },
  customRequest(document) {
  this.uploadFile = document
  },
  getTable() {
  sysExcelTemplateGetColumnList({className: "BaseCustomer"}).then(res =>
  {
  if (res.success) {
  this.columns =[];
  this.dataList = [{}];
  res.data.forEach(x => {
  this.columns.push({
  dataIndex: x.columnName,
  key: x.columnName,
  title: x.columnComment
  });
  this.dataList[0][x.columnName] = x.isRequired ? "必填" : "非必填"
  });
  this.columnText = parseExcelFieldText(res.data);
  }
  });
  },
  beforeUpload(fileInfo) {
  let res = checkFile(fileInfo, 1073741824, ['.xlsx', '.xls']);
  if (!res.success) {
  this.$message.warning(res.msg)
  return false
  }
  setTimeout(() => {this.uploadFile.onSuccess(this.uploadFile.file)}, 1000)
  },
  handleChange(fileInfo) {
  if (fileInfo.file.status === 'error') {
  fileInfo.fileList.splice(0, 1)
  }
  if (fileInfo.file.status === 'done') {
  if (fileInfo.fileList.length > 1) {
  fileInfo.fileList.splice(0, 1)
  }
  this.fileList = fileInfo.file
  }
  },
  handleSubmit() {
  this.confirmLoading = true
  const formData = new FormData()
  formData.append('file', this.uploadFile.file)
  BaseCustomerImportExcel(formData, {importExcelType: this.importExcelType}).then(res => {
  this.$message.success('操作成功')
  this.confirmLoading = false
  this.$emit('ok', [])
  this.handleCancel()
  }).finally((res)=>{this.confirmLoading = false})
  },
  handleCancel() {
  this.visible = false
  this.detailed = false
  },
  baseCustomerDownloadExcelTemplate() {
  BaseCustomerDownloadExcelTemplate({version: "v2"}).then((res) => {
  downloadFile(res);
  }).catch((err) => {
  this.$message.error('下载错误:获取文件流错误' + err)
  })
  }
  }
  }
</script>
<style scoped>
::v-deep .ant-upload.ant-upload-drag {
  position: relative;
  width: 140px;
  height: 135px;
  text-align: center;
  background: #fafafa;
  border: 1px dashed #d9d9d9;
  border-radius: 2px;
  cursor: pointer;
  -webkit-transition: border-color 0.3s;
  transition: border-color 0.3s;
}
::v-deep .ant-btn:focus:not(.ant-btn-primary):not(.ant-btn-danger), .ant-btn:hover:not(.ant-btn-primary):not(.ant-btn-danger) {
  color: #ffc53d;
  border-color: white;
}
</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabItem/addFormBaseCustomer/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,717 @@
<template>
    <div ref="boxOutWrap" class="boxOutWrap">
        <div ref="boxForm" class="boxForm">
            <a-card :bordered="false" :bodyStyle="tstyle">
                <div class="table-page-search-wrapper" v-if="hasPerm('BaseCustomer:page')">
                    <a-form layout="inline">
                        <a-row :gutter="48">
                            <a-col :md="8" :sm="24">
                                <a-form-item label="客户编号">
                                    <a-input v-model="queryParam.custCode" allow-clear placeholder="请输入客户编号" />
                                </a-form-item>
                            </a-col>
                            <a-col :md="8" :sm="24">
                                <a-form-item label="客户中文名称">
                                    <a-input v-model="queryParam.custChinaName" allow-clear placeholder="请输入客户中文名称" />
                                </a-form-item>
                            </a-col><template v-if="advanced">
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="客户英文名称">
                                        <a-input v-model="queryParam.custEnglishName" allow-clear placeholder="请输入客户英文名称" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="助记码">
                                        <a-input v-model="queryParam.mnemonicCode" allow-clear placeholder="请输入助记码" />
                                    </a-form-item>
                                </a-col><a-col :md="8" :sm="24">
                                    <a-form-item label="类型">
                                        <a-input-number v-model="queryParam.custType" style="width: 100%" allow-clear
                                            placeholder="请输入类型" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="类型名称">
                                        <a-input v-model="queryParam.custTypeName" allow-clear placeholder="请输入类型名称" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="联系人">
                                        <a-input v-model="queryParam.linkMan" allow-clear placeholder="请输入联系人" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="电话">
                                        <a-input v-model="queryParam.phone" allow-clear placeholder="请输入电话" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="电子邮件">
                                        <a-input v-model="queryParam.email" allow-clear placeholder="请输入电子邮件" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="邮编">
                                        <a-input v-model="queryParam.zipCode" allow-clear placeholder="请输入邮编" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="省份">
                                        <a-input v-model="queryParam.province" allow-clear placeholder="请输入省份" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="城市">
                                        <a-input v-model="queryParam.city" allow-clear placeholder="请输入城市" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="地址">
                                        <a-input v-model="queryParam.address" allow-clear placeholder="请输入地址" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="是否禁用">
                                        <a-select :allowClear="true" style="width: 100%" v-model="queryParam.isDisabled"
                                            placeholder="请选择是否禁用">
                                            <a-select-option v-for="(item, index) in isDisabledData" :key="index"
                                                :value="item.code">{{ item.name }}</a-select-option>
                                        </a-select>
                                    </a-form-item>
                                </a-col>
                                <!--年月日时分秒-->
                                <!--时间范围-->
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="创建时间">
                                        <a-range-picker style="width: 100%" :placeholder="['开始时间', '结束时间']" :show-time="{
                                            format: 'HH:mm:ss', defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')]
                                        }"
                                            v-model="queryParam.createdTime" value-format="YYYY-MM-DD HH:mm:ss"
                                            format="YYYY-MM-DD HH:mm:ss" @change="onChangecreatedTime" />
                                    </a-form-item>
                                </a-col>
                                <!--年月日时分秒-->
                                <!--时间范围-->
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="更新时间">
                                        <a-range-picker style="width: 100%" :placeholder="['开始时间', '结束时间']" :show-time="{
                                            format: 'HH:mm:ss', defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')]
                                        }"
                                            v-model="queryParam.updatedTime" value-format="YYYY-MM-DD HH:mm:ss"
                                            format="YYYY-MM-DD HH:mm:ss" @change="onChangeupdatedTime" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="创建者名称">
                                        <a-input v-model="queryParam.createdUserName" allow-clear placeholder="请输入创建者名称" />
                                    </a-form-item>
                                </a-col>
                                <a-col :md="8" :sm="24">
                                    <a-form-item label="修改者名称">
                                        <a-input v-model="queryParam.updatedUserName" allow-clear placeholder="请输入修改者名称" />
                                    </a-form-item>
                                </a-col> </template>
                            <a-col :md="8" :sm="24">
                                <span class="table-page-search-submitButtons">
                                    <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
                                    <a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
                                    <a @click="toggleAdvanced" style="margin-left: 8px"> {{ advanced ? '收起' : '展开' }}
                                        <a-icon :type="advanced ? 'up' : 'down'" />
                                    </a>
                                </span>
                            </a-col>
                        </a-row>
                    </a-form>
                </div>
            </a-card>
        </div>
        <a-card :bordered="false">
            <s-table ref="table" :columns="columns" :data="loadData" :alert="true" @changeTablePage="pageInfo = $event"
                :scroll="{ x: true, y: tableHeight }" :rowKey="(record) => record.id"
                :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
                <template class="table-operator" slot="operator" v-if="hasPerm('BaseCustomer:add')">
                    <!-- <div ref="actionBar" class="actionBar">
            <a-button type="info" v-if="hasPerm('sysExcelTemplate:importExcel')" icon="upload" @click="$refs.excelForm.index()">
            å¯¼å…¥
          </a-button>
          <a-button type="info" v-if="hasPerm('BaseCustomer:exportExcel')" icon="download" @click="BaseCustomerToExcel()">
            å¯¼å‡º
          </a-button>
            <a-button type="primary" v-if="hasPerm('BaseCustomer:add')" icon="plus" @click="$refs.addForm.add()">新增客户档案</a-button>
        </div> -->
                </template>
                <span slot="isDisabledscopedSlots" slot-scope="text">
                    <div v-if="text === true">
                        <a-tag color="green">是</a-tag>
                    </div>
                    <div v-else-if="text == false">
                        <a-tag color="volcano">否</a-tag>
                    </div>
                    <div v-else=""></div>
                </span>
                <span slot="action" slot-scope="text, record">
                    <a v-if="hasPerm('BaseCustomer:edit')" @click="$refs.editForm.edit(record)">编辑</a>
                    <a-divider type="vertical" v-if="hasPerm('BaseCustomer:edit') & hasPerm('BaseCustomer:delete')" />
                    <a-popconfirm v-if="hasPerm('BaseCustomer:delete')" placement="topRight" title="确认删除?"
                        @confirm="() => BaseCustomerDelete(record)">
                        <a>删除</a>
                    </a-popconfirm>
                </span>
            </s-table>
            <add-form ref="addForm" @ok="handleOk" />
            <edit-form ref="editForm" @ok="handleOk" />
            <excel-form ref="excelForm" @ok="handleOk" />
        </a-card>
    </div>
</template>
<script>
import { STable } from '@/components'
import moment from 'moment'
import { BaseCustomerPage, BaseCustomerDelete, BaseCustomerToExcel } from '@/api/modular/main/WmsBase/BaseCustomerManage'
//自定义table高度
import setTableHtMixin from '@/mixins/handleTableHt.js'
import addForm from './addForm.vue'
import { exportExcel } from '@/utils/exportToExcel'
import { downloadFile } from '@/utils/util'
import editForm from './editForm.vue'
import excelForm from './excelForm.vue'
export default {
    mixins: [setTableHtMixin],
    components: {
        STable,
        addForm,
        editForm,
        excelForm
    },
    data() {
        return {
            advanced: false, // é«˜çº§æœç´¢ å±•å¼€/关闭
            queryParam: {},
            pageInfo: {
                current: 1,
                pageSize: 10
            },
            columns: [
                {
                    title: '序号',
                    width: '60px',
                    align: 'center',
                    customRender: (text, record, index) => `${index + 1 + (this.pageInfo.current - 1) * this.pageInfo.pageSize}`
                },
                {
                    title: '客户编号',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'custCode'
                },
                {
                    title: '客户中文名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'custChinaName'
                },
                {
                    title: '客户英文名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'custEnglishName'
                },
                {
                    title: '助记码',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'mnemonicCode'
                },
                {
                    title: '类型',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '80px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '80px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'custType'
                },
                {
                    title: '类型名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'custTypeName'
                },
                {
                    title: '联系人',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'linkMan'
                },
                {
                    title: '电话',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'phone'
                },
                {
                    title: '电子邮件',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'email'
                },
                {
                    title: '邮编',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'zipCode'
                },
                {
                    title: '省份',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'province'
                },
                {
                    title: '城市',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'city'
                },
                {
                    title: '地址',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'address'
                },
                {
                    title: '是否禁用',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'isDisabled',
                    scopedSlots: { customRender: 'isDisabledscopedSlots' }
                },
                {
                    title: '创建时间',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'createdTime'
                },
                {
                    title: '更新时间',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'updatedTime'
                },
                {
                    title: '创建者名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'createdUserName'
                },
                {
                    title: '修改者名称',
                    align: 'center',
                    customHeaderCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    customCell: () => {
                        return {
                            style: {
                                'min-width': '120px'//最小列宽设置
                            }
                        }
                    },
                    sorter: true,
                    dataIndex: 'updatedUserName'
                }
            ],
            tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
            // åŠ è½½æ•°æ®æ–¹æ³• å¿…须为 Promise å¯¹è±¡
            loadData: parameter => {
                return BaseCustomerPage(Object.assign(parameter, this.switchingDate())).then((res) => {
                    return res.data
                })
            },
            selectedRowKeys: [],
            selectedRows: []
        }
    },
    created() {
        if (this.hasPerm('BaseCustomer:edit') || this.hasPerm('BaseCustomer:delete')) {
            this.columns.push({
                title: '操作',
                width: '150px',
                dataIndex: 'action',
                scopedSlots: { customRender: 'action' }
            })
        }
        const path = this.$route.path
        const columnStr = window.localStorage.getItem(path)
        if (columnStr) {
            var _columns = JSON.parse(columnStr)
            this.columns.forEach(element => {
                var fObj = _columns.find((item, index) => {
                    return item.dataIndex === element.dataIndex;
                })
                if (fObj != undefined && fObj != null) {
                    element.checked = fObj.checked;
                }
            });
        }
        const isDisabledOption = this.$options
        this.isDisabledData = isDisabledOption.filters['dictData']('yes_true_false')
        this.handleTableHt() //设置主表表格高度
        window.addEventListener(
            'resize',
            () => {
                this.handleTableHt() // ç›‘听屏幕大小改变表格高度
            },
            false
        )
    },
    methods: {
        moment,
        /**
        * æŸ¥è¯¢å‚数组装
        */
        switchingDate() {
            const obj = JSON.parse(JSON.stringify(this.queryParam))
            return obj
        },
        BaseCustomerDelete(record) {
            BaseCustomerDelete(record).then((res) => {
                if (res.success) {
                    this.$message.success('删除成功')
                    this.$refs.table.refresh()
                } else {
                    this.$message.error('删除失败') // + res.message
                }
            })
        },
        BaseCustomerToExcel() {
            this.loading = true
            let entozh = {};
            const path = this.$route.path;
            if (window.localStorage.getItem(path)) {
                JSON.parse(window.localStorage.getItem(path)).forEach(item => {
                    if (item.dataIndex != 'action' && item.checked) {
                        entozh[item.dataIndex] = item.title
                    }
                })
            } else { //直接点导出
                this.columns.forEach(item => {
                    if (item.dataIndex != 'action') {
                        entozh[item.dataIndex] = item.title
                    }
                })
            }
            BaseCustomerPage(Object.assign({ pageSize: 100000, pageIndex: 1 }, this.queryParam)).then((res) => {
                this.loading = false;
                //需要截取日期的字段
                var arrDataCutout = this.columns.filter(v => v.customCutout == true);
                res.data.rows.forEach(item => {
                    var arrKeys = Object.keys(item);
                    arrKeys.forEach(key => {
                        var strFieldDic = key + 'Data';
                        //枚举转值
                        if (this[strFieldDic] && this[strFieldDic].length > 0) {
                            let arrFieldDic = this[strFieldDic].filter(v => String(v.code) == String(item[key]));
                            if (arrFieldDic.length > 0) {
                                item[key] = arrFieldDic[0]?.name || '没有枚举值';
                            }
                        }
                        // æ—¥æœŸæˆªå–
                        if (arrDataCutout.length > 0) {
                            arrDataCutout.forEach(itemIn => {
                                if (key == itemIn.dataIndex && item[key]) {
                                    item[key] = item[key].split(" ")[0]
                                }
                            })
                        }
                    });
                })
                exportExcel(res.data.rows, entozh, "xlsx", `${this.$route.meta.title}`)
            }).catch((err) => {
                this.loading = false
                this.$message.error('下载错误:获取文件流错误' + err)
            })
        },
        toggleAdvanced() {
            this.advanced = !this.advanced
            this.handleTableHt() //设置主表表格高度
        },
        onChangecreatedTime(date, dateString) {
            this.queryParam.createdTime = dateString
        },
        onChangeupdatedTime(date, dateString) {
            this.queryParam.updatedTime = dateString
        },
        handleOk() {
            this.$refs.table.refresh()
        },
        onSelectChange(selectedRowKeys, selectedRows) {
            this.selectedRowKeys = selectedRowKeys
            this.selectedRows = selectedRows
            this.$emit('ok', selectedRows)
        }
    }
}
</script>
<style lang="less">
.table-operator {
    margin-bottom: 18px;
}
button {
    margin-right: 8px;
}</style>
iWare_RawMaterialWarehouse_Web/src/views/main/WmsMaterial/addForm.vue
ÎļþÒÑɾ³ý
iWare_RawMaterialWarehouse_Web/src/views/main/WmsMaterial/editForm.vue
ÎļþÒÑɾ³ý
iWare_RawMaterialWarehouse_Web/src/views/main/WmsMaterial/index.vue
ÎļþÒÑɾ³ý
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/Dto/WmsContainerPackagingInput.cs
@@ -127,32 +127,38 @@
        /// <summary>
        /// å®¹å™¨ç±»åž‹ID
        /// </summary>
        public virtual long? ContainerTypeId { get; set; }
        [Required(ErrorMessage = "容器类型ID不能为空")]
        public virtual long ContainerTypeId { get; set; }
        
        /// <summary>
        /// å®¹å™¨ç±»åž‹åç§°
        /// </summary>
        [Required(ErrorMessage = "容器类型名称不能为空")]
        public virtual string ContainerTypeName { get; set; }
        
        /// <summary>
        /// ç‰©æ–™ç±»åž‹ID
        /// </summary>
        public virtual long? MaterialTypeId { get; set; }
        [Required(ErrorMessage = "物料类型ID不能为空")]
        public virtual long MaterialTypeId { get; set; }
        
        /// <summary>
        /// ç‰©æ–™ç±»åž‹ç¼–号
        /// </summary>
        [Required(ErrorMessage = "物料类型编号不能为空")]
        public virtual string MaterialTypeCode { get; set; }
        
        /// <summary>
        /// ç‰©æ–™ç±»åž‹åç§°
        /// </summary>
        [Required(ErrorMessage = "物料类型名称不能为空")]
        public virtual string MaterialTypeName { get; set; }
        
        /// <summary>
        /// ç‰©æ–™å®¹å™¨å®¹é‡
        /// </summary>
        public virtual decimal? BoxQty { get; set; }
        [Required(ErrorMessage = "物料容器容量不能为空")]
        public virtual decimal BoxQty { get; set; }
        
    }
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/Dto/WmsContainerPackagingOutput.cs
@@ -11,7 +11,7 @@
        /// <summary>
        /// å®¹å™¨ç±»åž‹ID
        /// </summary>
        public long? ContainerTypeId { get; set; }
        public long ContainerTypeId { get; set; }
        
        /// <summary>
        /// å®¹å™¨ç±»åž‹åç§°
@@ -21,7 +21,7 @@
        /// <summary>
        /// ç‰©æ–™ç±»åž‹ID
        /// </summary>
        public long? MaterialTypeId { get; set; }
        public long MaterialTypeId { get; set; }
        
        /// <summary>
        /// ç‰©æ–™ç±»åž‹ç¼–号
@@ -36,7 +36,7 @@
        /// <summary>
        /// ç‰©æ–™å®¹å™¨å®¹é‡
        /// </summary>
        public decimal? BoxQty { get; set; }
        public decimal BoxQty { get; set; }
        
        /// <summary>
        /// Id主键
iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/WmsBase/WmsContainerPackaging/WmsContainerPackagingService.cs
@@ -253,6 +253,12 @@
                          
                          
                          #region éªŒè¯
                          if (string.IsNullOrEmpty(_ContainerTypeId))
                          {
                            throw Oops.Oh($"第{index}行[容器类型ID]{_ContainerTypeId}不能为空!");
                          }
                          if(!string.IsNullOrEmpty(_ContainerTypeId))
                          {
                              if (!long.TryParse(_ContainerTypeId, out long outContainerTypeId)&&!string.IsNullOrEmpty(_ContainerTypeId))
@@ -269,10 +275,22 @@
                              }
                          
                          }
                          if (string.IsNullOrEmpty(_ContainerTypeName))
                          {
                            throw Oops.Oh($"第{index}行[容器类型名称]{_ContainerTypeName}不能为空!");
                          }
                          if(!string.IsNullOrEmpty(_ContainerTypeName))
                          {
                                addItem.ContainerTypeName = (string)_ContainerTypeName;
                           }
                          if (string.IsNullOrEmpty(_MaterialTypeId))
                          {
                            throw Oops.Oh($"第{index}行[物料类型ID]{_MaterialTypeId}不能为空!");
                          }
                          if(!string.IsNullOrEmpty(_MaterialTypeId))
                          {
                              if (!long.TryParse(_MaterialTypeId, out long outMaterialTypeId)&&!string.IsNullOrEmpty(_MaterialTypeId))
@@ -289,14 +307,32 @@
                              }
                          
                          }
                          if (string.IsNullOrEmpty(_MaterialTypeCode))
                          {
                            throw Oops.Oh($"第{index}行[物料类型编号]{_MaterialTypeCode}不能为空!");
                          }
                          if(!string.IsNullOrEmpty(_MaterialTypeCode))
                          {
                                addItem.MaterialTypeCode = (string)_MaterialTypeCode;
                           }
                          if (string.IsNullOrEmpty(_MaterialTypeName))
                          {
                            throw Oops.Oh($"第{index}行[物料类型名称]{_MaterialTypeName}不能为空!");
                          }
                          if(!string.IsNullOrEmpty(_MaterialTypeName))
                          {
                                addItem.MaterialTypeName = (string)_MaterialTypeName;
                           }
                          if (string.IsNullOrEmpty(_BoxQty))
                          {
                            throw Oops.Oh($"第{index}行[物料容器容量]{_BoxQty}不能为空!");
                          }
                          if(!string.IsNullOrEmpty(_BoxQty))
                          {
                              if (!decimal.TryParse(_BoxQty, out decimal outBoxQty)&&!string.IsNullOrEmpty(_BoxQty))
@@ -369,13 +405,29 @@
           
           
           bool isExist = false;
           if (!isEdit)//新增
           {
                   //数据是否存在重复
                   isExist = await _wmsContainerPackagingRep.AnyAsync(u =>
                                   u.ContainerTypeId.Equals(input.ContainerTypeId)
                   ,false);
          }
           else//编辑
          {
          
                
                 //当前编辑数据以外是否存在重复
                  isExist = await _wmsContainerPackagingRep.AnyAsync(u =>
                                    u.Id != input.Id
                                    &&u.ContainerTypeId.Equals(input.ContainerTypeId)
                    ,false);
               }
               
        
            //没有配置联合主键,不需要验重
            if (isExist) throw Oops.Oh(ErrorCode.E0001);
       }
        
        /// <summary>
@@ -386,10 +438,42 @@
        private async Task CheckExisitForImport(List<WmsContainerPackaging> inputs)
        { 
            //根据联合主键验证表格中中是否已存在相同数据  
                 if (inputs?.Count <= 0)
                 {
                     throw Oops.Oh($"导入数据不能为空");
                 }
                 //数据是否重复
                 var existExcelItem = inputs.GroupBy(g => new {
                                               g.ContainerTypeId
                                               })
                                               .Where(g => g.Count() > 1)
                                               .Select(s => new {
                                               s.Key.ContainerTypeId
                                               }).FirstOrDefault();
                 if (existExcelItem != null)
                 {
                   var wmsContainerPackaging = existExcelItem.Adapt<WmsContainerPackaging>();
                   var item= existExcelItem.Adapt<WmsContainerPackaging>();
                   throw Oops.Oh($"导入的表格中,容器类型ID[{item.ContainerTypeId}]已存在");
                 }
                      
    //根据联合主键验证数据库中是否已存在相同数据
                 var existDBItem = await _wmsContainerPackagingRep.DetachedEntities.FirstOrDefaultAsync(w=>
                                                                         inputs.Select(s=>""
                                                                           +s.ContainerTypeId
                                                                        )
                                                                        .Contains(""
                                                                         +w.ContainerTypeId
                  ));
                  if (existDBItem != null)
                 {
                   var wmsContainerPackaging = existExcelItem.Adapt<WmsContainerPackaging>();
                   var item= existExcelItem.Adapt<WmsContainerPackaging>();
                   throw Oops.Oh($"系统中,容器类型ID[{item.ContainerTypeId}]已存在");
                 }
        }
        #endregion
iWare_RawMaterialWarehouse_Wms/Admin.NET.Web.Entry/wwwroot/ExcelTemplateFile/WmsContainerPackagingImport.xlsx
Binary files differ