cuilei
2025-05-28 84275ee8a44b1813585651230cfcb9fff0db1074
工具管理-工具出库:新增方式出库页面
已添加1个文件
已修改5个文件
516 ■■■■ 文件已修改
src/views/tms/modules/outBound/JSelectOutboundToolModal.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/modules/outBound/OutboundDetailSelectList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/modules/outBound/OutboundListRight.vue 188 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/modules/outBound/OutboundModal.vue 312 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/modules/outBound/OutboundOrderModal.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/modules/outBound/OutboundOrderSelectList.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tms/modules/outBound/JSelectOutboundToolModal.vue
@@ -170,7 +170,15 @@
        this.loading = false
      })
    },
    showModal(oldSelectRow) {
    showModal(oldSelectRow, classifyId) {
      this.oldSelectRow = oldSelectRow
      this.visible = true
      this.queryParam.quantity = 0
      this.queryParam.classifyId = classifyId
      this.queryParam.excludeIds = oldSelectRow
      this.loadData(1)
    },
    showOrderModal(oldSelectRow) {
      this.oldSelectRow = oldSelectRow
      this.visible = true
      this.queryParam.quantity = 0
src/views/tms/modules/outBound/OutboundDetailSelectList.vue
@@ -157,7 +157,7 @@
        ],
        url: {
          list: "/tms/outboundOrder/listOutboundDetailByMainId",
          outbound: "/tms/outboundOrder/outBound",
          outbound: "/tms/outboundOrder/outBoundByApply",
          delete: "/tms/outboundOrder/deleteOutboundDetail",
          deleteBatch: "/tms/outboundOrder/deleteBatchOutboundDetail",
          exportXlsUrl: "/tms/outboundOrder/exportOutboundDetail",
src/views/tms/modules/outBound/OutboundListRight.vue
@@ -75,6 +75,7 @@
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:'radio'}"
        :customRow="handleRowClick"
        class="j-table-force-nowrap"
        @change="handleTableChange">
@@ -129,14 +130,9 @@
      </a-tab-pane>
    </a-tabs>
    <outbound-modal ref="outboundModal" @ok="selectListOK"></outbound-modal>
    <OutboundOrderSelectList ref="outboundOrderSelectList" @ok="selectListOK"></OutboundOrderSelectList>
    <base-tools-modal ref="modalForm" @ok="modalFormOk" :nodeSelected="nodeSelected"></base-tools-modal>
    <para-hole-tools-modal ref="paraHoleToolsModal" @ok="modalFormOk" :nodeSelected="nodeSelected"></para-hole-tools-modal>
    <para-threading-tool-modal ref="paraThreadingToolModal"></para-threading-tool-modal>
    <para-mill-tool-modal ref="paraMillToolModal"></para-mill-tool-modal>
    <para-turning-tools-modal ref="paraTurningToolsModal"></para-turning-tools-modal>
    <para-blade-modal ref="paraBladeModal"></para-blade-modal>
    <para-common-tool-modal ref="paraCommonToolModal"></para-common-tool-modal>
  </a-card>
</template>
@@ -148,14 +144,8 @@
  import BaseToolsModal from '../baseTools/BaseToolsModal'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import { getAction, postAction, deleteAction, requestPut } from '@api/manage'
  import OutboundModal from './OutboundModal'
  import OutboundOrderSelectList from './OutboundOrderSelectList'
  import ParaHoleToolsModal from '../baseTools/ParaHoleToolsModal'
  import ParaMillToolModal from '../baseTools/ParaMillToolModal'
  import ParaThreadingToolModal from '../baseTools/ParaThreadingToolModal'
  import ParaTurningToolsModal from '../baseTools/ParaTurningToolsModal'
  import ToolsConfigPropertyModal from '../baseTools/ToolsConfigPropertyModal'
  import ParaCommonToolModal from '../baseTools/ParaCommonToolModal'
  import ParaBladeModal from '../baseTools/ParaBladeModal'
  import ParaHoleToolsList from '../baseTools/ParaHoleToolsList'
  import ToolsConfigPropertyList from '../baseTools/ToolsConfigPropertyList'
  import ParaMillToolList from '../baseTools/ParaMillToolList'
@@ -168,16 +158,10 @@
    name: 'OutboundListRight',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      OutboundModal,
      OutboundOrderSelectList,
      BaseToolsModal,
      Tooltip,
      ParaHoleToolsModal,
      ParaMillToolModal,
      ParaThreadingToolModal,
      ParaTurningToolsModal,
      ToolsConfigPropertyModal,
      ParaCommonToolModal,
      ParaBladeModal,
      ParaHoleToolsList,
      ToolsConfigPropertyList,
      ParaMillToolList,
@@ -188,7 +172,19 @@
    },
    data () {
      return {
        description: '工具信息管理页面',
        description: '工具出库页面',
        /* åˆ†é¡µå‚æ•° */
        ipagination:{
          current: 1,
          pageSize: 5,
          pageSizeOptions: ['5', '10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " å…±" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        // è¡¨å¤´
        columns: [
          {
@@ -261,14 +257,14 @@
            align:"center",
            dataIndex: 'createTime'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
          // {
          //   title: '操作',
          //   dataIndex: 'action',
          //   align:"center",
          //   fixed:"right",
          //   width:147,
          //   scopedSlots: { customRender: 'action' }
          // }
        ],
        url: {
          list: "/tms/outStoreDetail/list",
@@ -299,6 +295,7 @@
      this.nodeType = (data.type == undefined ? 0 : data.type);
      this.paraTypeFlag = (data.entity == undefined ? 0 : data.entity.paraTypeFlag)
      this.nodeSelected = data;
      this.queryParam.classifyId = data.key
      this.loadData()
      this.clearPara()
    })
@@ -312,37 +309,25 @@
      selectOutboundOrder() {
        this.$refs.outboundOrderSelectList.openSelect();
      },
      handleRowClick(record) {
        return {
          on: {
            click: () => {
              console.log(record)
              this.onSelectChange(record.id.split(","), [record]);
            }
          }
        }
      },
      handleAdd(entity) {
        if (!this.nodeSelected ) {
          this.$message.warning('请先选择一个工具分类');
          return;
        }
        // æ‰“开新增模态框,并传递当前选中的节点
        if(this.paraTypeFlag === "1"){
          this.$refs.paraCommonToolModal.add(this.nodeSelected);
          this.$refs.paraCommonToolModal.title = "新增通用参数类型工具";
          this.$refs.paraCommonToolModal.disableSubmit = false;
        }else if(this.paraTypeFlag === "2"){
          this.$refs.paraHoleToolsModal.add(this.nodeSelected);
          this.$refs.paraHoleToolsModal.title = "新增孔加工工具";
          this.$refs.paraHoleToolsModal.disableSubmit = false;
        }else if(this.paraTypeFlag === "3"){
          this.$refs.paraThreadingToolModal.add(this.nodeSelected);
          this.$refs.paraThreadingToolModal.title = "新增螺纹工具";
          this.$refs.paraThreadingToolModal.disableSubmit = false;
        }else if(this.paraTypeFlag === "4"){
          this.$refs.paraMillToolModal.add(this.nodeSelected);
          this.$refs.paraMillToolModal.title = "新增铣削工具";
          this.$refs.paraMillToolModal.disableSubmit = false;
        }else if(this.paraTypeFlag === "5"){
          this.$refs.paraTurningToolsModal.add(this.nodeSelected);
          this.$refs.paraTurningToolsModal.title = "新增车削工具";
          this.$refs.paraTurningToolsModal.disableSubmit = false;
        }else if(this.paraTypeFlag === "6"){
          this.$refs.paraBladeModal.add(this.nodeSelected);
          this.$refs.paraBladeModal.title = "新增刀片";
          this.$refs.paraBladeModal.disableSubmit = false;
        }
        this.$refs.outboundModal.add(this.nodeSelected);
        this.$refs.outboundModal.title = "新增工具出库";
        this.$refs.outboundModal.disableSubmit = false;
      },
      handleDelete(id) {
        deleteAction(this.url.delete, {id: id}).then((res) => {
@@ -364,10 +349,12 @@
        this.loadData(); // åˆ·æ–°è¡¨æ ¼æ•°æ®
        this.$bus.$emit('queryTreeData') //刷新左侧树
      },
      onSelectChange(selectedRowKeys) {
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows;
        const toolCode = this.selectionRows[0].toolCode
        //通过id查询管理参数和参数数据
        getAction(this.url.queryParaByToolCode, { toolCode: this.selectedRowKeys[0],paraTypeFlag:this.paraTypeFlag}).then((res) => {
        getAction(this.url.queryParaByToolCode, { toolCode: toolCode,paraTypeFlag:this.paraTypeFlag}).then((res) => {
          if (res.success) {
            if(this.paraTypeFlag === "1"){
              this.$refs.paraCommonToolList.getPara(res.result);
@@ -386,7 +373,7 @@
            this.$message.warning(res.message);
          }
        })
        getAction(this.url.queryByToolCode, { toolCode: this.selectedRowKeys[0]}).then((res) => {
        getAction(this.url.queryByToolCode, { toolCode: toolCode}).then((res) => {
          if (res.success) {
            this.$refs.toolsConfigPropertyList.getPara(res.result);
          } else {
@@ -405,93 +392,6 @@
        if (selectedRecord) {
          this.handleEdit(selectedRecord);
        }
      },
      //编辑
      handleEdit(record) {
        if(record.paramaTableName === "1"){
              this.$refs.paraCommonToolModal.edit(record);
              this.$refs.paraCommonToolModal.title = "编辑";
              this.$refs.paraCommonToolModal.disableSubmit = false;
            }else if(record.paramaTableName === "2"){
              this.$refs.paraHoleToolsModal.edit(record);
              this.$refs.paraHoleToolsModal.title = "编辑";
              this.$refs.paraHoleToolsModal.disableSubmit = false;
            }else if(record.paramaTableName === "3"){
              this.$refs.paraThreadingToolModal.edit(record);
              this.$refs.paraThreadingToolModal.title = "编辑";
              this.$refs.paraThreadingToolModal.disableSubmit = false;
            }else if(record.paramaTableName === "4"){
              this.$refs.paraMillToolModal.edit(record);
              this.$refs.paraMillToolModal.title = "编辑";
              this.$refs.paraMillToolModal.disableSubmit = false;
            }else if(record.paramaTableName === "5"){
              this.$refs.paraTurningToolsModal.edit(record);
              this.$refs.paraTurningToolsModal.title = "编辑";
              this.$refs.paraTurningToolsModal.disableSubmit = false;
            }else if(record.paramaTableName === "6"){
              this.$refs.paraBladeModal.edit(record);
              this.$refs.paraBladeModal.title = "编辑";
              this.$refs.paraBladeModal.disableSubmit = false;
            }
      },
      //详情
      handleDetail:function(record){
        if(record.paramaTableName === "1"){
              this.$refs.paraCommonToolModal.edit(record);
              this.$refs.paraCommonToolModal.title="详情";
              this.$refs.paraCommonToolModal.disableSubmit = true;
              this.$refs.paraCommonToolModal.disSeach = true;
              if(this.$refs.paraCommonToolModal.removeValidate) {
                this.$refs.paraCommonToolModal.removeValidate()
              }
            }else if(record.paramaTableName === "2"){
              this.$refs.paraHoleToolsModal.edit(record);
              this.$refs.paraHoleToolsModal.title="详情";
              this.$refs.paraHoleToolsModal.disableSubmit = true;
              this.$refs.paraHoleToolsModal.disSeach = true;
              if(this.$refs.paraHoleToolsModal.removeValidate) {
                this.$refs.paraHoleToolsModal.removeValidate()
              }
            }else if(record.paramaTableName === "3"){
               this.$refs.paraThreadingToolModal.edit(record);
              this.$refs.paraThreadingToolModal.title="详情";
              this.$refs.paraThreadingToolModal.disableSubmit = true;
              this.$refs.paraThreadingToolModal.disSeach = true;
              if(this.$refs.paraThreadingToolModal.removeValidate) {
                this.$refs.paraThreadingToolModal.removeValidate()
              }
            }else if(record.paramaTableName === "4"){
               this.$refs.paraMillToolModal.edit(record);
              this.$refs.paraMillToolModal.title="详情";
              this.$refs.paraMillToolModal.disableSubmit = true;
              this.$refs.paraMillToolModal.disSeach = true;
              if(this.$refs.paraMillToolModal.removeValidate) {
                this.$refs.paraMillToolModal.removeValidate()
              }
            }else if(record.paramaTableName === "5"){
               this.$refs.paraTurningToolsModal.edit(record);
              this.$refs.paraTurningToolsModal.title="详情";
              this.$refs.paraTurningToolsModal.disableSubmit = true;
              this.$refs.paraTurningToolsModal.disSeach = true;
              if(this.$refs.paraTurningToolsModal.removeValidate) {
                this.$refs.paraTurningToolsModal.removeValidate()
              }
            }else if(record.paramaTableName === "6"){
               this.$refs.paraBladeModal.edit(record);
              this.$refs.paraBladeModal.title="详情";
              this.$refs.paraBladeModal.disableSubmit = true;
              this.$refs.paraBladeModal.disSeach = true;
              if(this.$refs.paraBladeModal.removeValidate) {
                this.$refs.paraBladeModal.removeValidate()
              }
            }
    },
      //禁用状态样式
      tableRowClass(record, index) {
        if (record.status != "1") {
          return "frozenRowClass";
        }
        return "";
      },
      onClearSelected() {
        this.selectedKeys = [];
src/views/tms/modules/outBound/OutboundModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,312 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validatorRules">
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="classifyNum" label="工具分类编码">
              <a-input placeholder="请输入工具分类编码" v-model="model.classifyNum" :disabled="true" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="classifyName" label="工具分类名称">
              <a-input placeholder="请输入工具分类名称" v-model="model.classifyName" :disabled="true" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item label="出库类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="outStorehouseType">
              <j-dict-select-tag :disabled="disableSubmit" @change="handleTypeChange" type="list" v-model="model.outStorehouseType" dictCode="out_storehouse_type" placeholder="请选择出库类型" />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
    <a-button v-show="selectBorrowTool" type="primary" :style="{ marginBottom: '8px' }" @click="selectOutBoundTool">选择出库工具</a-button>
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      :scroll="{x:true}"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      :rowSelection="null"
      @change="handleTableChange">
      <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index">
        <div :key="col.dataIndex">
          <a-input-number
            v-if="col.dataIndex === 'outboundQuantity'"
            :disabled="record.quantity <= 1"
            :value="text"
            @change="(e) => handleChange(e, record.key, col, index)"
            :min="1"
          />
        </div>
      </template>
      <span slot="action" v-if="disableSubmit === false" slot-scope="text, record, index">
        <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record, index)">
          <a>删除</a>
        </a-popconfirm>
      </span>
    </a-table>
    <template slot="footer" v-if="disableSubmit === false">
      <a-button :style="{ marginRight: '8px' }" @click="handleCancel">关闭</a-button>
      <a-button @click="handleOk" :disabled="isDisabled" type="primary">出库</a-button>
    </template>
    <j-select-outbound-tool-modal ref="selectOutBoundToolModal"></j-select-outbound-tool-modal>
  </j-modal>
</template>
<script>
import { validateDuplicateValue } from '@/utils/util'
import OutboundDetailList from '../../OutboundDetailList.vue'
import JSelectOutboundToolModal from './JSelectOutboundToolModal.vue'
import { postAction } from '../../../../api/manage'
import title from 'ant-design-vue/lib/skeleton/Title'
export default {
  name: "OutboundOrderModal",
  components: {
    OutboundDetailList,
    JSelectOutboundToolModal
  },
  data () {
    return {
      title: '',
      width:1200,
      visible: false,
      disableSubmit: false,
      isDisabled: false,
      addShow: true,
      selectBorrowTool: false,
      model:{
      },
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      //表格参数
      ipagination: {
        current: 1,
        pageSize: 10,
        total: 0,
      },
      dataSource: [],
      loading: false,
      // è¡¨å¤´
      columns: [
        {
          title: '#',
          dataIndex: '',
          key:'rowIndex',
          width:60,
          align:"center",
          customRender:function (t,r,index) {
            return parseInt(index)+1;
          }
        },
        {
          title:'工具编码',
          align:"center",
          dataIndex: 'toolNum'
        },
        {
          title:'工具编号',
          align:"center",
          dataIndex: 'toolId'
        },
        {
          title:'可用库存',
          align:"center",
          dataIndex: 'quantity'
        },
        {
          title:'出库数量',
          align:"center",
          dataIndex: 'outboundQuantity',
          scopedSlots: { customRender: 'outboundQuantity' },
        },
        {
          title:'出库仓库',
          align:"center",
          dataIndex: 'warehouseName'
        },
        {
          title:'出库库位',
          align:"center",
          dataIndex: 'outboundLocation'
        },
        // {
        //   title:'出库状态;1.未出库;2.部分出库;3.出库完成',
        //   align:"center",
        //   dataIndex: 'status'
        // },
        {
          title: '操作',
          dataIndex: 'action',
          align:"center",
          fixed:"right",
          width:147,
          scopedSlots: { customRender: 'action' },
        }
      ],
      confirmLoading: false,
      validatorRules: {
        outStorehouseType: [
          { required: true, message: '请选择出库类型!'},
        ]
      },
      url: {
        outbound: "/tms/outboundOrder/outBoundByAdd",
        list: "/tms/outboundOrder/listOutboundDetailByMainId",
        add: "/tms/outboundOrder/addTotal",
        edit: "/tms/outboundOrder/editTotal",
      },
      classifyId: ''
    }
  },
  created () {
    //备份model原始值
    this.modelDefault = JSON.parse(JSON.stringify(this.model));
  },
  mounted() {
    this.$bus.$on('selectionRows', (data) => {
      for (let i = 0; i < data.length; i++) {
        this.dataSource.push({
          id: data[i].id,
          toolCode:data[i].toolCode,
          toolNum:data[i].toolNum,
          toolId: data[i].toolId,
          quantity: data[i].quantity,
          outboundQuantity: data[i].quantity,
          storageLocation: data[i].warehouseId,
          warehouseName: data[i].warehouseName,
          outboundLocation: data[i].positionCode
        })
      }
      this.ipagination.total = this.dataSource.length
    })
  },
  methods: {
    handleTypeChange(value) {
      if (value === '1') {
        this.selectBorrowTool = true
      }
      if (value === '2') {
        this.selectBorrowTool = false
      }
      if (value === '3') {
        this.selectBorrowTool = false
      }
      if (value === '4') {
        this.selectBorrowTool = false
      }
    },
    handleDelete(record, index) {
      this.dataSource.splice(index, 1)
    },
    handleChange(value, key, column, index) {
      console.log(value, key, column, index)
      const temp = [...this.dataSource]
      const target = temp.filter(item => key === item.key)[index];
      if (target) {
        target[column.dataIndex] = value
        this.dataSource = temp
        if(column.dataIndex === 'outboundQuantity'){
          if(target['quantity']<value){
            this.$message.error('出库数量不能大于可用库存!')
            this.isDisabled = true
          }else{
            this.isDisabled = false
          }
        }
        this.dataSource = temp
      }
    },
    selectOutBoundTool() {
      console.log(this.dataSource)
      let ids = this.dataSource.map(item => item.id).join(',')
      this.$refs.selectOutBoundToolModal.showModal(ids, this.classifyId)
    },
    add (nodeSelected) {
      this.addShow = false
      this.classifyId = nodeSelected.key
      this.model.classifyNum = nodeSelected.entity.classifyId
      this.model.classifyName = nodeSelected.entity.typeName
      this.dataSource = []
      this.visible = true;
    },
    close () {
      this.$emit('close');
      this.addShow = true
      this.visible = false;
      this.$refs.form.clearValidate();
    },
    handleTableChange(pagination, filters, sorter) {
      this.ipagination = pagination
    },
    handleOk () {
      // è§¦å‘表单验证
      this.$refs.form.validate(valid => {
        if (valid) {
          if (this.dataSource == null || this.dataSource.length === 0) {
            this.$message.warning('请选择出库工具!');
            return
          }
          const params = this.dataSource.map(item => {
            return {
              toolLedgerDetailId: item.id,
              toolCode: item.toolCode,
              toolId: item.toolId,
              outboundQuantity: item.outboundQuantity,
              outStorehouseType: this.model.outStorehouseType,
              storageLocation: item.storageLocation
            }
          })
          console.log(params)
          this.confirmLoading = true;
          postAction(this.url.outbound, params).then((res)=>{
            if(res.success){
              this.$message.success(res.message)
              this.$emit("ok")
            } else {
              this.$message.warning(res.message)
            }
          }).finally(() => {
            this.confirmLoading = false;
            this.close();
          })
        }else{
          return false
        }
      })
    },
    handleCancel () {
      this.close()
    },
  }
}
</script>
src/views/tms/modules/outBound/OutboundOrderModal.vue
@@ -305,7 +305,7 @@
        if (this.title === '编辑') {
         ids = this.dataSource.map(item => item.toolLedgerDetailId).join(',')
        }
        this.$refs.selectOutBoundToolModal.showModal(ids)
        this.$refs.selectOutBoundToolModal.showOrderModal(ids)
      },
      add () {
        this.addShow = false
src/views/tms/modules/outBound/OutboundOrderSelectList.vue
@@ -171,7 +171,7 @@
        ],
        url: {
          list: "/tms/outboundOrder/list",
          outbound: "/tms/outboundOrder/outBound",
          outbound: "/tms/outboundOrder/outBoundByApply",
          delete: "/tms/outboundOrder/delete",
          submit: "/tms/outboundOrder/submit",
          deleteBatch: "/tms/outboundOrder/deleteBatch",