feat(cms):
CuttingReceiveDetailList.vue刀具领用功能中新增领用单提交功能
CuttingReceiveList.vue 刀具领用 提交按钮的前端样式和刀具领用归还按钮的前端样式
已修改4个文件
2433 ■■■■ 文件已修改
src/views/cms/CuttingInboundList.vue 799 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/cms/CuttingReceiveDetailList.vue 259 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/cms/CuttingReceiveList.vue 622 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/cms/modules/CuttingReceiveModal.vue 753 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/cms/CuttingInboundList.vue
@@ -1,123 +1,126 @@
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="入库单状态">
              <j-search-select-tag
                  placeholder="请选择入库单状态"
                  v-model="queryParam.orderStatus"
                  dict="order_status"
                />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
              <a-form-item label="入库人">
                <j-search-select-tag
                  placeholder="请选择入库人"
                  v-model="queryParam.receiver"
                  dict="sys_user,realname,id,del_flag!=1"
                />
              </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="确认人">
              <j-search-select-tag
                v-model="queryParam.confirmer"
                placeholder="请选择确认人"
                dict="sys_user,realname,id,del_flag!=1"
              />
            </a-form-item>
          </a-col>
<!--          <a-col :md="6" :sm="8">-->
<!--            <a-form-item label="入库时间">-->
<!--              <j-date-->
<!--                v-model="queryParam.receiveTime"-->
<!--                type="date"-->
<!--                value-format="YYYY-MM-DD"-->
<!--              />-->
<!--            </a-form-item>-->
<!--          </a-col>-->
          <a-col
            :md="6"
            :sm="8"
          >
   <a-card :bordered="false">
      <!-- 查询区域 -->
      <div class="table-page-search-wrapper">
         <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">
               <a-col :md="6" :sm="8">
                  <a-form-item label="入库单状态">
                     <j-search-select-tag
                        placeholder="请选择入库单状态"
                        v-model="queryParam.orderStatus"
                        dict="order_status"
                     />
                  </a-form-item>
               </a-col>
               <a-col :md="6" :sm="8">
                  <a-form-item label="入库人">
                     <j-search-select-tag
                        placeholder="请选择入库人"
                        v-model="queryParam.receiver"
                        dict="sys_user,realname,id,del_flag!=1"
                     />
                  </a-form-item>
               </a-col>
               <a-col :md="6" :sm="8">
                  <a-form-item label="确认人">
                     <j-search-select-tag
                        v-model="queryParam.confirmer"
                        placeholder="请选择确认人"
                        dict="sys_user,realname,id,del_flag!=1"
                     />
                  </a-form-item>
               </a-col>
               <!--          <a-col :md="6" :sm="8">-->
               <!--            <a-form-item label="入库时间">-->
               <!--              <j-date-->
               <!--                v-model="queryParam.receiveTime"-->
               <!--                type="date"-->
               <!--                value-format="YYYY-MM-DD"-->
               <!--              />-->
               <!--            </a-form-item>-->
               <!--          </a-col>-->
               <a-col
                  :md="6"
                  :sm="8"
               >
            <span
              style="float: left;overflow: hidden;"
              class="table-page-search-submitButtons"
               style="float: left;overflow: hidden;"
               class="table-page-search-submitButtons"
            >
              <a-button
                type="primary"
                @click="searchQuery"
                icon="search"
                 type="primary"
                 @click="searchQuery"
                 icon="search"
              >查询</a-button>
              <a-button
                type="primary"
                @click="searchReset"
                icon="reload"
                style="margin-left: 8px"
                 type="primary"
                 @click="searchReset"
                 icon="reload"
                 style="margin-left: 8px"
              >重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
               </a-col>
            </a-row>
         </a-form>
      </div>
      <!-- 查询区域-END -->
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新刀入库</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('刀具入库单')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      <!-- 操作按钮区域 -->
      <div class="table-operator">
         <a-button @click="handleAdd" type="primary" icon="plus">新刀入库</a-button>
         <a-button type="primary" icon="download" @click="handleExportXls('刀具入库单')">导出</a-button>
         <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
                   @change="handleImportExcel">
            <a-button type="primary" icon="import">导入</a-button>
         </a-upload>
      </div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :customRow="customRow"
        @change="handleTableChange">
      <!-- table区域-begin -->
      <div>
         <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
            <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
            style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
            <a style="margin-left: 24px" @click="onClearSelected">清空</a>
         </div>
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>
         <a-table
            ref="table"
            size="middle"
            :scroll="{x:true}"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            class="j-table-force-nowrap"
            :customRow="customRow"
            @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)" :disabled="record.orderStatus == '2'">编辑</a>
            <template slot="htmlSlot" slot-scope="text">
               <div v-html="text"></div>
            </template>
            <template slot="imgSlot" slot-scope="text,record">
               <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
               <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
                    style="max-width:80px;font-size: 12px;font-style: italic;" />
            </template>
            <template slot="fileSlot" slot-scope="text">
               <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
               <a-button
                  v-else
                  :ghost="true"
                  type="primary"
                  icon="download"
                  size="small"
                  @click="downloadFile(text)">
                  下载
               </a-button>
            </template>
            <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)" :disabled="record.orderStatus === '2'">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
@@ -125,11 +128,11 @@
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
<!--              <a-menu-item v-if="record.orderStatus != '2'">-->
<!--                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
<!--                  <a>删除</a>-->
<!--                </a-popconfirm>-->
<!--              </a-menu-item>-->
               <!--              <a-menu-item v-if="record.orderStatus != '2'">-->
               <!--                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
               <!--                  <a>删除</a>-->
               <!--                </a-popconfirm>-->
               <!--              </a-menu-item>-->
              <a-menu-item v-if="record.orderStatus != '2'">
                  <a @click="handleSubmit(record.id)" :disabled="record.orderStatus == '3'">提交</a>
              </a-menu-item>
@@ -142,328 +145,325 @@
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="刀具入库明细" key="1">
        <cutting-inbound-detail-list ref="cuttingInbounDetailList"></cutting-inbound-detail-list>
      </a-tab-pane>
    </a-tabs>
    <cutting-inbound-modal ref="modalForm" @ok="modalFormOk"></cutting-inbound-modal>
  </a-card>
         </a-table>
      </div>
      <a-tabs defaultActiveKey="1">
         <a-tab-pane tab="刀具入库明细" key="1">
            <cutting-inbound-detail-list ref="cuttingInbounDetailList"></cutting-inbound-detail-list>
         </a-tab-pane>
      </a-tabs>
      <cutting-inbound-modal ref="modalForm" @ok="modalFormOk"></cutting-inbound-modal>
   </a-card>
</template>
<script>
  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import CuttingInboundModal from './modules/CuttingInboundModal'
  import CuttingInboundDetailList from './CuttingInboundDetailList'
  import { downFile, httpAction } from '@api/manage'
  import Vue from 'vue'
  import { ACCESS_TOKEN } from '@/store/mutation-types'
  import store from '@/store'
  import { Modal } from 'ant-design-vue';
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CuttingInboundModal from './modules/CuttingInboundModal'
import CuttingInboundDetailList from './CuttingInboundDetailList'
import { downFile, httpAction } from '@api/manage'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import store from '@/store'
import { Modal } from 'ant-design-vue'
  export default {
    name: 'CuttingInboundList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
export default {
   name: 'CuttingInboundList',
   mixins: [JeecgListMixin, mixinDevice],
   components: {
      CuttingInboundModal,
      CuttingInboundDetailList
    },
    data () {
   },
   data() {
      return {
        description: '刀具入库单管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
         description: '刀具入库单管理页面',
         // 表头
         columns: [
            {
               title: '#',
               dataIndex: '',
               key: 'rowIndex',
               width: 60,
               align: 'center',
               customRender: function(t, r, index) {
                  return parseInt(index) + 1
               }
            },
            {
               title: '入库人',
               align: 'center',
               dataIndex: 'receiver_dictText'
            },
            {
               title: '入库时间',
               align: 'center',
               dataIndex: 'receiveTime',
               customRender: function(text) {
                  return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
               }
            },
            {
               title: '入库说明',
               align: 'center',
               dataIndex: 'receiveComment'
            },
            {
               title: '确认人',
               align: 'center',
               dataIndex: 'confirmer_dictText'
            },
            {
               title: '确认时间',
               align: 'center',
               dataIndex: 'confirmTime',
               customRender: function(text) {
                  return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
               }
            },
            {
               title: '确认意见',
               align: 'center',
               dataIndex: 'confirmComment'
            },
            {
               title: '入库单状态',
               align: 'center',
               dataIndex: 'orderStatus_dictText'
            },
            {
               title: '操作',
               dataIndex: 'action',
               align: 'center',
               fixed: 'right',
               width: 147,
               scopedSlots: { customRender: 'action' }
            }
          },
          {
            title:'入库人',
            align:"center",
            dataIndex: 'receiver_dictText'
          },
          {
            title:'入库时间',
            align:"center",
            dataIndex: 'receiveTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'入库说明',
            align:"center",
            dataIndex: 'receiveComment'
          },
          {
            title:'确认人',
            align:"center",
            dataIndex: 'confirmer_dictText'
          },
          {
            title:'确认时间',
            align:"center",
            dataIndex: 'confirmTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'确认意见',
            align:"center",
            dataIndex: 'confirmComment'
          },
          {
            title:'入库单状态',
            align:"center",
            dataIndex: 'orderStatus_dictText',
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/cms/cuttingInbound/list",
          delete: "/cms/cuttingInbound/delete",
          deleteBatch: "/cms/cuttingInbound/deleteBatch",
          exportXlsUrl: "/cms/cuttingInbound/exportXls",
          importExcelUrl: "cms/cuttingInbound/importExcel",
          submit: "/cms/cuttingInbound/submit",
        },
        dictOptions:{},
        superFieldList:[],
         ],
         url: {
            list: '/cms/cuttingInbound/list',
            delete: '/cms/cuttingInbound/delete',
            deleteBatch: '/cms/cuttingInbound/deleteBatch',
            exportXlsUrl: '/cms/cuttingInbound/exportXls',
            importExcelUrl: 'cms/cuttingInbound/importExcel',
            submit: '/cms/cuttingInbound/submit'
         },
         dictOptions: {},
         superFieldList: []
      }
    },
    created() {
      this.getSuperFieldList();
   },
   created() {
      this.getSuperFieldList()
      // 添加字典数据加载
      this.initDictConfig();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      this.initDictConfig()
   },
   computed: {
      importExcelUrl: function() {
         return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
   },
   methods: {
      searchQuery() {
        this.loadData(1);
         this.loadData(1)
      },
      searchReset() {
        this.queryParam = {}
        this.$refs.cuttingInbounDetailList.dataSource = []
        this.loadData(1);
         this.queryParam = {}
         this.$refs.cuttingInbounDetailList.dataSource = []
         this.loadData(1)
      },
      handleEdit: function (record) {
        this.$refs.modalForm.edit(record)
        this.$refs.modalForm.title = '编辑'
        this.$refs.modalForm.disableSubmit = false
      handleEdit: function(record) {
         this.$refs.modalForm.edit(record)
         this.$refs.modalForm.title = '编辑'
         this.$refs.modalForm.disableSubmit = false
      },
      handleAdd() {
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '新增'
        this.$refs.modalForm.disableSubmit = false
         this.$refs.modalForm.add()
         this.$refs.modalForm.title = '新增'
         this.$refs.modalForm.disableSubmit = false
      },
      handleDetail:function(record){
        this.$refs.modalForm.edit(record);
        this.$refs.modalForm.title="详情";
        this.$refs.modalForm.disableSubmit = true;
      handleDetail: function(record) {
         this.$refs.modalForm.edit(record)
         this.$refs.modalForm.title = '详情'
         this.$refs.modalForm.disableSubmit = true
      },
      // 自定义行点击事件
      customRow(record) {
        return {
          on: {
            click: (e) => {
              //将当前选中的记录传到子页面
              this.$bus.$emit('getToolingStorageData', record)
              //点击当前行变色
              let oldList = document.querySelectorAll('.checked-td-of-add-table')
              if (oldList) {
                for (let j = 0; j < oldList.length; j++) {
                  oldList[j].classList.remove('checked-td-of-add-table')
                }
              }
              let children = e.target.parentNode.children
              for (let i = 0; i < children.length; i++) {
                children[i].classList.add('checked-td-of-add-table')
              }
            },
          },
        }
         return {
            on: {
               click: (e) => {
                  //将当前选中的记录传到子页面
                  this.$bus.$emit('getToolingStorageData', record)
                  //点击当前行变色
                  let oldList = document.querySelectorAll('.checked-td-of-add-table')
                  if (oldList) {
                     for (let j = 0; j < oldList.length; j++) {
                        oldList[j].classList.remove('checked-td-of-add-table')
                     }
                  }
                  let children = e.target.parentNode.children
                  for (let i = 0; i < children.length; i++) {
                     children[i].classList.add('checked-td-of-add-table')
                  }
               }
            }
         }
      },
      handleExportXls(fileName){
        if(!fileName || typeof fileName != "string"){
          fileName = "导出文件"
        }
        let param = this.getQueryParams();
        if(this.selectedRowKeys && this.selectedRowKeys.length>0){
          param['selections'] = this.selectedRowKeys.join(",")
        }
        console.log("导出参数",param)
        downFile(this.url.exportXlsUrl,param).then((data)=>{
          if (!data) {
            // this.$message.warning("文件下载失败")
            this.$notification.warning({
              message:'消息',
              description:"文件下载失败"
            });
            return
          }
          if (typeof window.navigator.msSaveBlob !== 'undefined') {
            window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
          }else{
            let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
            let link = document.createElement('a')
            link.style.display = 'none'
            link.href = url
            link.setAttribute('download', fileName+'.xls')
            document.body.appendChild(link)
            link.click()
            document.body.removeChild(link); //下载完成移除元素
            window.URL.revokeObjectURL(url); //释放掉blob对象
          }
        })
      handleExportXls(fileName) {
         if (!fileName || typeof fileName != 'string') {
            fileName = '导出文件'
         }
         let param = this.getQueryParams()
         if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
            param['selections'] = this.selectedRowKeys.join(',')
         }
         console.log('导出参数', param)
         downFile(this.url.exportXlsUrl, param).then((data) => {
            if (!data) {
               // this.$message.warning("文件下载失败")
               this.$notification.warning({
                  message: '消息',
                  description: '文件下载失败'
               })
               return
            }
            if (typeof window.navigator.msSaveBlob !== 'undefined') {
               window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
            } else {
               let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
               let link = document.createElement('a')
               link.style.display = 'none'
               link.href = url
               link.setAttribute('download', fileName + '.xls')
               document.body.appendChild(link)
               link.click()
               document.body.removeChild(link) //下载完成移除元素
               window.URL.revokeObjectURL(url) //释放掉blob对象
            }
         })
      },
      /* 导入 */
      handleImportExcel(info){
        this.loading = true;
        if (info.file.status !== 'uploading') {
          console.log(info.file, info.fileList);
        }
        if (info.file.status === 'done') {
          this.loading = false;
          if (info.file.response.success) {
            // this.$message.success(`${info.file.name} 文件上传成功`);
            if (info.file.response.code === 201) {
              let { message, result: { msg, fileUrl, fileName } } = info.file.response
              let href = window._CONFIG['domianURL'] + fileUrl
              this.$warning({
                title: message,
                content: (<div>
                    <span>{msg}</span><br/>
                    <span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
                  </div>
                )
              })
            } else {
              // this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
              this.$notification.success({
                message:'消息',
                description:info.file.response.message || `${info.file.name} 文件上传成功`
              });
            }
            this.loadData()
          } else {
            // this.$message.error(`${info.file.name} ${info.file.response.message}.`);
            this.$notification.error({
              message:'消息',
              description:`${info.file.name} ${info.file.response.message}.`
            });
          }
        } else if (info.file.status === 'error') {
          this.loading = false;
          if (info.file.response.status === 500) {
            let data = info.file.response
            const token = Vue.ls.get(ACCESS_TOKEN)
            if (token && data.message.includes("Token失效")) {
              this.$error({
                title: '登录已过期',
                content: '很抱歉,登录已过期,请重新登录',
                okText: '重新登录',
                mask: false,
                onOk: () => {
                  store.dispatch('Logout').then(() => {
                    Vue.ls.remove(ACCESS_TOKEN)
                    window.location.reload();
      handleImportExcel(info) {
         this.loading = true
         if (info.file.status !== 'uploading') {
            console.log(info.file, info.fileList)
         }
         if (info.file.status === 'done') {
            this.loading = false
            if (info.file.response.success) {
               // this.$message.success(`${info.file.name} 文件上传成功`);
               if (info.file.response.code === 201) {
                  let { message, result: { msg, fileUrl, fileName } } = info.file.response
                  let href = window._CONFIG['domianURL'] + fileUrl
                  this.$warning({
                     title: message,
                     content: (<div>
                           <span>{msg}</span><br />
                           <span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
                        </div>
                     )
                  })
                }
              })
               } else {
                  // this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
                  this.$notification.success({
                     message: '消息',
                     description: info.file.response.message || `${info.file.name} 文件上传成功`
                  })
               }
               this.loadData()
            } else {
               // this.$message.error(`${info.file.name} ${info.file.response.message}.`);
               this.$notification.error({
                  message: '消息',
                  description: `${info.file.name} ${info.file.response.message}.`
               })
            }
          } else {
            // this.$message.error(`文件上传失败: ${info.file.msg} `);
            this.$notification.error({
              message:'消息',
              description:`文件上传失败: ${info.file.msg} `
            });
          }
        }
         } else if (info.file.status === 'error') {
            this.loading = false
            if (info.file.response.status === 500) {
               let data = info.file.response
               const token = Vue.ls.get(ACCESS_TOKEN)
               if (token && data.message.includes('Token失效')) {
                  this.$error({
                     title: '登录已过期',
                     content: '很抱歉,登录已过期,请重新登录',
                     okText: '重新登录',
                     mask: false,
                     onOk: () => {
                        store.dispatch('Logout').then(() => {
                           Vue.ls.remove(ACCESS_TOKEN)
                           window.location.reload()
                        })
                     }
                  })
               }
            } else {
               // this.$message.error(`文件上传失败: ${info.file.msg} `);
               this.$notification.error({
                  message: '消息',
                  description: `文件上传失败: ${info.file.msg} `
               })
            }
         }
      },
      /**
       *  单据提交
       */
      //  单据提交
      handleSubmit: function(id) {
        if (!this.url.submit) {
          this.$message.error('请设置url.submit属性!')
          return
        }
        let targetId = id; // 从参数获取ID
        // 如果没有通过参数传递ID,则检查选中的记录
        if (!targetId) {
          if (this.selectedRowKeys.length != 1) {
            this.$message.warning('请选择一条记录!')
         if (!this.url.submit) {
            this.$message.error('请设置url.submit属性!')
            return
          } else {
            targetId = this.selectedRowKeys[0]
          }
        }
         }
        // 将参数作为查询参数附加到URL上
        let httpurl = this.url.submit + '?orderId=' + encodeURIComponent(targetId)
        let method = 'get'
        var params = {}  // 清空params,因为参数已经在URL中传递
         let targetId = id // 从参数获取ID
         // 如果没有通过参数传递ID,则检查选中的记录
         if (!targetId) {
            if (this.selectedRowKeys.length != 1) {
               this.$message.warning('请选择一条记录!')
               return
            } else {
               targetId = this.selectedRowKeys[0]
            }
         }
        const that = this
         // 将参数作为查询参数附加到URL上
         let httpurl = this.url.submit + '?orderId=' + encodeURIComponent(targetId)
         let method = 'get'
         var params = {}  // 清空params,因为参数已经在URL中传递
        this.$confirm({
          title: '确认提交!',
          // content: '正在提交数据,请耐心等待...',
          okText: '确认',
          cancelText: '取消',
          onOk() {
            // 显示加载提示
            const hide = that.$message.loading('正在提交数据,请耐心等待...', 0);
         const that = this
            // 发送请求
            return httpAction(httpurl, params, method).then((res) => {
              hide(); // 隐藏加载提示
              if (res.success) {
                that.$message.success(res.message)
                that.loadData()
              } else {
                that.$message.warning(res.message)
              }
            }).catch(error => {
              hide(); // 隐藏加载提示
              that.$message.error('提交失败: ' + error.message)
            }).finally(() => {
              that.loading = false
            })
          }
        })
      },
         this.$confirm({
            title: '确认提交!',
            // content: '正在提交数据,请耐心等待...',
            okText: '确认',
            cancelText: '取消',
            onOk() {
               // 显示加载提示
               const hide = that.$message.loading('正在提交数据,请耐心等待...', 0)
               // 发送请求
               return httpAction(httpurl, params, method).then((res) => {
                  hide() // 隐藏加载提示
                  if (res.success) {
                     that.$message.success(res.message)
                     that.loadData()
                  } else {
                     that.$message.warning(res.message)
                  }
               }).catch(error => {
                  hide() // 隐藏加载提示
                  that.$message.error('提交失败: ' + error.message)
               }).finally(() => {
                  that.loading = false
               })
            }
         })
      }
      // /**
      //  *  单据提交(支持实时进度更新)
@@ -614,10 +614,9 @@
      //   })
      // },
    }
  }
   }
}
</script>
<style scoped>
  @import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>
src/views/cms/CuttingReceiveDetailList.vue
@@ -1,46 +1,48 @@
<template>
  <a-card :bordered="false">
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
   <a-card :bordered="false">
      <!-- table区域-begin -->
      <div>
         <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
            <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
            style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
            <a style="margin-left: 24px" @click="onClearSelected">清空</a>
         </div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">
         <a-table
            ref="table"
            size="middle"
            :scroll="{x:true}"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            class="j-table-force-nowrap"
            @change="handleTableChange">
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>
            <template slot="htmlSlot" slot-scope="text">
               <div v-html="text"></div>
            </template>
            <template slot="imgSlot" slot-scope="text,record">
               <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
               <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
                    style="max-width:80px;font-size: 12px;font-style: italic;" />
            </template>
            <template slot="fileSlot" slot-scope="text">
               <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
               <a-button
                  v-else
                  :ghost="true"
                  type="primary"
                  icon="download"
                  size="small"
                  @click="downloadFile(text)">
                  下载
               </a-button>
            </template>
        <span slot="action" slot-scope="text, record">
            <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
@@ -59,104 +61,109 @@
          </a-dropdown>
        </span>
      </a-table>
    </div>
         </a-table>
      </div>
    <cutting-receive-detail-modal ref="modalForm" @ok="modalFormOk"></cutting-receive-detail-modal>
  </a-card>
      <cutting-receive-detail-modal ref="modalForm" @ok="modalFormOk"></cutting-receive-detail-modal>
   </a-card>
</template>
<script>
  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  export default {
    name: 'CuttingReceiveDetailList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
    },
    data () {
export default {
   name: 'CuttingReceiveDetailList',
   mixins: [JeecgListMixin, mixinDevice],
   components: {},
   data() {
      return {
        description: '领用单明细管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
         description: '领用单明细管理页面',
         // 表头
         columns: [
            {
               title: '#',
               dataIndex: '',
               key: 'rowIndex',
               width: 60,
               align: 'center',
               customRender: function(t, r, index) {
                  return parseInt(index) + 1
               }
            },
            {
               title: '刀具编码',
               align: 'center',
               dataIndex: 'cuttingCode'
            },
            {
               title: '刀具名称',
               align: 'center',
               dataIndex: 'cuttingName'
            },
            {
               title: '刀具条码',
               align: 'center',
               dataIndex: 'cuttingBarcode'
            },
            {
               title: '工件材质',
               align: 'center',
               dataIndex: 'workpieceMaterial'
            },
            {
               title: '使用寿命',
               align: 'center',
               dataIndex: 'usedLife'
            }
          },
          {
            title:'刀具编码',
            align:"center",
            dataIndex: 'cuttingCode'
          },
          {
            title:'刀具名称',
            align:"center",
            dataIndex: 'cuttingName'
          },
          {
            title:'工件材质',
            align:"center",
            dataIndex: 'workpieceMaterial'
          },
          {
            title:'使用寿命',
            align:"center",
            dataIndex: 'usedLife'
          },
        ],
        url: {
          list: "/cms/cuttingReceive/detailList",
          delete: "/cms/cuttingReceiveDetail/delete",
          deleteBatch: "/cms/cuttingReceiveDetail/deleteBatch",
          exportXlsUrl: "/cms/cuttingReceiveDetail/exportXls",
          importExcelUrl: "cms/cuttingReceiveDetail/importExcel",
         ],
         url: {
            list: '/cms/cuttingReceive/detailList',
            delete: '/cms/cuttingReceiveDetail/delete',
            deleteBatch: '/cms/cuttingReceiveDetail/deleteBatch',
            exportXlsUrl: '/cms/cuttingReceiveDetail/exportXls',
            importExcelUrl: 'cms/cuttingReceiveDetail/importExcel'
        },
        dictOptions:{},
        superFieldList:[],
        disableMixinCreated:true
         },
         dictOptions: {},
         superFieldList: [],
         disableMixinCreated: true
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'orderId',text:'领用单ID'})
        fieldList.push({type:'string',value:'cuttingId',text:'刀具ID'})
        fieldList.push({type:'string',value:'cuttingCode',text:'刀具编码'})  // 添加这一行
        fieldList.push({type:'string',value:'cuttingName',text:'刀具名称'})  // 添加这一行
        fieldList.push({type:'string',value:'inventoryId',text:'库存ID'})
        fieldList.push({type:'string',value:'workpieceMaterial',text:'工件材质'})
        fieldList.push({type:'int',value:'usedLife',text:'使用寿命'})
        this.superFieldList = fieldList
   },
   created() {
      this.getSuperFieldList()
   },
   computed: {
      importExcelUrl: function() {
         return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
     mounted() {
    this.$bus.$on('getToolingStorageData', (data) => {
      this.queryParam.orderId = data.id;
      this.searchQuery();
    })
  }
  }
   },
   methods: {
      initDictConfig() {
      },
      getSuperFieldList() {
         let fieldList = []
         fieldList.push({ type: 'string', value: 'orderId', text: '领用单ID' })
         fieldList.push({ type: 'string', value: 'cuttingId', text: '刀具ID' })
         fieldList.push({ type: 'string', value: 'cuttingCode', text: '刀具编码' })  // 添加这一行
         fieldList.push({ type: 'string', value: 'cuttingName', text: '刀具名称' })  // 添加这一行
         fieldList.push({ type: 'string', value: 'cuttingBarcode', text: '刀具条码' })  // 添加这一行
         fieldList.push({ type: 'string', value: 'inventoryId', text: '库存ID' })
         fieldList.push({ type: 'string', value: 'workpieceMaterial', text: '工件材质' })
         fieldList.push({ type: 'int', value: 'usedLife', text: '使用寿命' })
         this.superFieldList = fieldList
      }
   },
   mounted() {
      this.$bus.$on('getToolingStorageData', (data) => {
         this.queryParam.orderId = data.id
         this.searchQuery()
      })
   }
}
</script>
<style scoped>
  @import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>
src/views/cms/CuttingReceiveList.vue
@@ -1,108 +1,126 @@
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="领用单状态">
              <j-search-select-tag
                placeholder="请选择领用单状态"
                v-model="queryParam.orderStatus"
                dict="order_status"
              />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="领用人">
              <j-search-select-tag
                placeholder="请选择领用人"
                v-model="queryParam.receiver"
                dict="sys_user,realname,id,del_flag!=1"
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="6"
            :sm="8"
          >
   <a-card :bordered="false">
      <!-- 查询区域 -->
      <div class="table-page-search-wrapper">
         <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">
               <a-col :md="6" :sm="8">
                  <a-form-item label="领用单状态">
                     <j-search-select-tag
                        placeholder="请选择领用单状态"
                        v-model="queryParam.orderStatus"
                        dict="order_status"
                     />
                  </a-form-item>
               </a-col>
               <a-col :md="6" :sm="8">
                  <a-form-item label="领用人">
                     <j-search-select-tag
                        placeholder="请选择领用人"
                        v-model="queryParam.receiver"
                        dict="sys_user,realname,id,del_flag!=1"
                     />
                  </a-form-item>
               </a-col>
               <a-col
                  :md="6"
                  :sm="8"
               >
            <span
              style="float: left;overflow: hidden;"
              class="table-page-search-submitButtons"
               style="float: left;overflow: hidden;"
               class="table-page-search-submitButtons"
            >
              <a-button
                type="primary"
                @click="searchQuery"
                icon="search"
                 type="primary"
                 @click="searchQuery"
                 icon="search"
              >查询</a-button>
              <a-button
                type="primary"
                @click="searchReset"
                icon="reload"
                style="margin-left: 8px"
                 type="primary"
                 @click="searchReset"
                 icon="reload"
                 style="margin-left: 8px"
              >重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
               </a-col>
            </a-row>
         </a-form>
      </div>
      <!-- 查询区域-END -->
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <!-- <a-button type="primary" icon="download" @click="handleExportXls('刀具领用单')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload> -->
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
        style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      <!-- 操作按钮区域 -->
      <div class="table-operator">
         <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
         <!-- <a-button type="primary" icon="download" @click="handleExportXls('刀具领用单')">导出</a-button>
         <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
           <a-button type="primary" icon="import">导入</a-button>
         </a-upload> -->
      </div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :customRow="customRow"
        @change="handleTableChange">
      <!-- table区域-begin -->
      <div>
         <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
            <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
            style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
            <a style="margin-left: 24px" @click="onClearSelected">清空</a>
         </div>
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
               style="max-width:80px;font-size: 12px;font-style: italic;" />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>
         <a-table
            ref="table"
            size="middle"
            :scroll="{x:true}"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            class="j-table-force-nowrap"
            :customRow="customRow"
            @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
            <template slot="htmlSlot" slot-scope="text">
               <div v-html="text"></div>
            </template>
            <template slot="imgSlot" slot-scope="text,record">
               <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
               <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
                    style="max-width:80px;font-size: 12px;font-style: italic;" />
            </template>
            <template slot="fileSlot" slot-scope="text">
               <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
               <a-button
                  v-else
                  :ghost="true"
                  type="primary"
                  icon="download"
                  size="small"
                  @click="downloadFile(text)">
                  下载
               </a-button>
            </template>
            <!--        <span slot="action" slot-scope="text, record">-->
            <!--          <a @click="handleEdit(record)">编辑</a>-->
            <!--          <a-divider type="vertical" />-->
            <!--          <a-dropdown>-->
            <!--            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>-->
            <!--            <a-menu slot="overlay">-->
            <!--              <a-menu-item>-->
            <!--                <a @click="handleDetail(record)">详情</a>-->
            <!--              </a-menu-item>-->
            <!--              <a-menu-item>-->
            <!--                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
            <!--                  <a>删除</a>-->
            <!--                </a-popconfirm>-->
            <!--              </a-menu-item>-->
            <!--            </a-menu>-->
            <!--          </a-dropdown>-->
            <!--        </span>-->
            <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)" :disabled="record.orderStatus === '2'">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
@@ -110,24 +128,35 @@
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
               <!--              <a-menu-item v-if="record.orderStatus != '2'">-->
               <!--                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">-->
               <!--                  <a>删除</a>-->
               <!--                </a-popconfirm>-->
               <!--              </a-menu-item>-->
              <a-menu-item v-if="record.orderStatus !== '2'">
                  <a @click="handleSubmit(record.id)" :disabled="record.orderStatus === '3'">提交</a>
              </a-menu-item>
              <a-menu-item v-if="record.orderStatus !== '2'">
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
               <a-menu-item v-if="record.orderStatus === '2'">
                  <a @click="handleBack(record.id)">归还</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="刀具领用明细" key="1">
        <cutting-receive-detail-list ref="cuttingReceiveDetailList"></cutting-receive-detail-list>
      </a-tab-pane>
    </a-tabs>
    <cutting-receive-modal ref="modalForm" @ok="modalFormOk"></cutting-receive-modal>
  </a-card>
         </a-table>
      </div>
      <a-tabs defaultActiveKey="1">
         <a-tab-pane tab="刀具领用明细" key="1">
            <cutting-receive-detail-list ref="cuttingReceiveDetailList"></cutting-receive-detail-list>
         </a-tab-pane>
      </a-tabs>
      <cutting-receive-modal ref="modalForm" @ok="modalFormOk"></cutting-receive-modal>
   </a-card>
</template>
<script>
@@ -137,178 +166,235 @@
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CuttingReceiveModal from './modules/CuttingReceiveModal'
import CuttingReceiveDetailList from './CuttingReceiveDetailList'
import { httpAction } from '@api/manage'
export default {
  name: 'CuttingReceiveList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    CuttingReceiveModal,
    CuttingReceiveDetailList
  },
  data() {
    return {
      description: '刀具领用单管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '领用人',
          align: 'center',
          dataIndex: 'receiver_dictText'
        },
        {
          title: '领用时间',
          align: 'center',
          dataIndex: 'receiveTime',
          customRender: function(text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '领用说明',
          align: 'center',
          dataIndex: 'receiveComment'
        },
        {
          title: '确认人',
          align: 'center',
          dataIndex: 'confirmer_dictText'
        },
        {
          title: '确认时间',
          align: 'center',
          dataIndex: 'confirmTime',
          customRender: function(text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '确认意见',
          align: 'center',
          dataIndex: 'confirmComment'
        },
        {
          title: '是否会归还',
          align: 'center',
          dataIndex: 'returnFlag'
        },
        {
          title: '归还时间',
          align: 'center',
          dataIndex: 'returnTime',
          customRender: function(text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '归还说明',
          align: 'center',
          dataIndex: 'returnComment'
        },
        {
          title: '归还确认人',
          align: 'center',
          dataIndex: 'returnConfirmer_dictText'
        },
        {
          title: '归还确认时间',
          align: 'center',
          dataIndex: 'returnConfirmTime',
          customRender: function(text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '归还确认意见',
          align: 'center',
          dataIndex: 'returnConfirmComment'
        },
        {
          title: '领用单状态',
          align: 'center',
          dataIndex: 'orderStatus'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/cms/cuttingReceive/list',
        delete: '/cms/cuttingReceive/delete',
        deleteBatch: '/cms/cuttingReceive/deleteBatch',
        exportXlsUrl: '/cms/cuttingReceive/exportXls',
        importExcelUrl: 'cms/cuttingReceive/importExcel'
      },
      dictOptions: {},
      superFieldList: []
    }
  },
  created() {
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    searchReset() {
      this.queryParam = {}
      this.$refs.cuttingReceiveDetailList.dataSource = []
      this.loadData(1)
    },
    handleEdit: function(record) {
      this.$refs.modalForm.edit(record)
      this.$refs.modalForm.title = '编辑'
      this.$refs.modalForm.disableSubmit = false
    },
    handleAdd() {
      this.$refs.modalForm.add()
      this.$refs.modalForm.title = '新增'
      this.$refs.modalForm.disableSubmit = false
    },
    handleDetail: function(record) {
      this.$refs.modalForm.edit(record)
      this.$refs.modalForm.title = '详情'
      this.$refs.modalForm.disableSubmit = true
    },
    customRow(record) {
   name: 'CuttingReceiveList',
   mixins: [JeecgListMixin, mixinDevice],
   components: {
      CuttingReceiveModal,
      CuttingReceiveDetailList
   },
   data() {
      return {
        on: {
          click: (e) => {
            //将当前选中的记录传到子页面
            this.$bus.$emit('getToolingStorageData', record)
            //点击当前行变色
            let oldList = document.querySelectorAll('.checked-td-of-add-table')
            if (oldList) {
              for (let j = 0; j < oldList.length; j++) {
                oldList[j].classList.remove('checked-td-of-add-table')
              }
         description: '刀具领用单管理页面',
         // 表头
         columns: [
            {
               title: '#',
               dataIndex: '',
               key: 'rowIndex',
               width: 60,
               align: 'center',
               customRender: function(t, r, index) {
                  return parseInt(index) + 1
               }
            },
            {
               title: '领用人',
               align: 'center',
               dataIndex: 'receiver_dictText'
            },
            {
               title: '领用时间',
               align: 'center',
               dataIndex: 'receiveTime',
               customRender: function(text) {
                  return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
               }
            },
            {
               title: '领用说明',
               align: 'center',
               dataIndex: 'receiveComment'
            },
            {
               title: '确认人',
               align: 'center',
               dataIndex: 'confirmer_dictText'
            },
            {
               title: '确认时间',
               align: 'center',
               dataIndex: 'confirmTime',
               customRender: function(text) {
                  return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
               }
            },
            {
               title: '确认意见',
               align: 'center',
               dataIndex: 'confirmComment'
            },
            {
               title: '是否会归还',
               align: 'center',
               dataIndex: 'returnFlag'
            },
            {
               title: '归还时间',
               align: 'center',
               dataIndex: 'returnTime',
               customRender: function(text) {
                  return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
               }
            },
            {
               title: '归还说明',
               align: 'center',
               dataIndex: 'returnComment'
            },
            {
               title: '归还确认人',
               align: 'center',
               dataIndex: 'returnConfirmer_dictText'
            },
            {
               title: '归还确认时间',
               align: 'center',
               dataIndex: 'returnConfirmTime',
               customRender: function(text) {
                  return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
               }
            },
            {
               title: '归还确认意见',
               align: 'center',
               dataIndex: 'returnConfirmComment'
            },
            {
               title: '领用单状态',
               align: 'center',
               dataIndex: 'orderStatus_dictText'
            },
            {
               title: '操作',
               dataIndex: 'action',
               align: 'center',
               fixed: 'right',
               width: 147,
               scopedSlots: { customRender: 'action' }
            }
            let children = e.target.parentNode.children
            for (let i = 0; i < children.length; i++) {
              children[i].classList.add('checked-td-of-add-table')
            }
          }
        }
         ],
         url: {
            list: '/cms/cuttingReceive/list',
            delete: '/cms/cuttingReceive/delete',
            deleteBatch: '/cms/cuttingReceive/deleteBatch',
            exportXlsUrl: '/cms/cuttingReceive/exportXls',
            importExcelUrl: 'cms/cuttingReceive/importExcel',
            submit: '/cms/cuttingReceive/submit'
         },
         dictOptions: {},
         superFieldList: []
      }
    }
  }
   },
   created() {
      this.getSuperFieldList()
   },
   computed: {
      importExcelUrl: function() {
         return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
   },
   methods: {
      searchReset() {
         this.queryParam = {}
         this.$refs.cuttingReceiveDetailList.dataSource = []
         this.loadData(1)
      },
      handleEdit: function(record) {
         this.$refs.modalForm.edit(record)
         this.$refs.modalForm.title = '编辑'
         this.$refs.modalForm.disableSubmit = false
      },
      handleAdd() {
         this.$refs.modalForm.add()
         this.$refs.modalForm.title = '新增'
         this.$refs.modalForm.disableSubmit = false
      },
      handleDetail: function(record) {
         this.$refs.modalForm.edit(record)
         this.$refs.modalForm.title = '详情'
         this.$refs.modalForm.disableSubmit = true
      },
      customRow(record) {
         return {
            on: {
               click: (e) => {
                  //将当前选中的记录传到子页面
                  this.$bus.$emit('getToolingStorageData', record)
                  //点击当前行变色
                  let oldList = document.querySelectorAll('.checked-td-of-add-table')
                  if (oldList) {
                     for (let j = 0; j < oldList.length; j++) {
                        oldList[j].classList.remove('checked-td-of-add-table')
                     }
                  }
                  let children = e.target.parentNode.children
                  for (let i = 0; i < children.length; i++) {
                     children[i].classList.add('checked-td-of-add-table')
                  }
               }
            }
         }
      },
      /**
       *  单据提交
       */
      handleSubmit: function(id) {
         if (!this.url.submit) {
            this.$message.error('请设置url.submit属性!')
            return
         }
         let targetId = id // 从参数获取ID
         // 如果没有通过参数传递ID,则检查选中的记录
         if (!targetId) {
            if (this.selectedRowKeys.length != 1) {
               this.$message.warning('请选择一条记录!')
               return
            } else {
               targetId = this.selectedRowKeys[0]
            }
         }
         // 将参数作为查询参数附加到URL上
         let httpurl = this.url.submit + '?orderId=' + encodeURIComponent(targetId)
         let method = 'get'
         var params = {}  // 清空params,因为参数已经在URL中传递
         const that = this
         this.$confirm({
            title: '确认提交!',
            // content: '正在提交数据,请耐心等待...',
            okText: '确认',
            cancelText: '取消',
            onOk() {
               // 显示加载提示
               const hide = that.$message.loading('正在提交数据,请耐心等待...', 0)
               // 发送请求
               return httpAction(httpurl, params, method).then((res) => {
                  hide() // 隐藏加载提示
                  if (res.success) {
                     that.$message.success(res.message)
                     that.loadData()
                  } else {
                     that.$message.warning(res.message)
                  }
               }).catch(error => {
                  hide() // 隐藏加载提示
                  that.$message.error('提交失败: ' + error.message)
               }).finally(() => {
                  that.loading = false
               })
            }
         })
      },
      //TODO:刀具归还 handleBack
   }
}
</script>
<style scoped>
src/views/cms/modules/CuttingReceiveModal.vue
@@ -1,165 +1,165 @@
<template>
  <a-modal :title="title" :visible="visible" :fullScreen="true" :width="1200" @ok="handleOk" @cancel="handleCancel">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row style="width: 100%">
          <a-col :span="24 / 2">
            <a-form-item label="领用人" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-search-select-tag
                :disabled="disableSubmit"
                placeholder="请选择领用人"
                v-decorator="['receiver', { rules: [{ required: true, message: '请选择领用人' }] }]"
                dict="sys_user,realname,id,del_flag=0"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24 / 2">
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="领用日期">
              <a-date-picker
                :disabled="disableSubmit"
                style="width: 100%"
                v-decorator="['receiveTime', validatorRules.receiveTime]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row style="width: 100%">
          <a-col :span="24">
            <a-form-item label="领用说明" :labelCol="{span:3}" :wrapperCol="{span:21}">
              <a-textarea :disabled="disableSubmit" placeholder="请输入领用说明"
                          v-decorator="['receiveComment', validatorRules.receiveComment]" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row style="width: 100%">
          <a-col :span="24 / 2">
            <a-form-item label="确认人" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-search-select-tag
                :disabled="disableSubmit"
                placeholder="请选择确认人"
                v-decorator="['confirmer', { rules: [{ required: false, message: '请选择确认人' }] }]"
                dict="sys_user,realname,id,del_flag=0"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24 / 2">
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="确认日期">
              <a-date-picker
                :disabled="disableSubmit"
                style="width: 100%"
                v-decorator="['confirmTime', validatorRules.confirmTime]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row style="width: 100%">
          <a-col :span="24">
            <a-form-item label="确认意见" :labelCol="{span:3}" :wrapperCol="{span:21}">
              <a-textarea :disabled="disableSubmit" placeholder="请输入确认意见"
                          v-decorator="['confirmComment', validatorRules.confirmComment]" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row style="width: 100%">
          <a-col :span="24 / 2">
            <a-form-item label="是否会归还" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" placeholder="请输入是否会归还"
                       v-decorator="['returnFlag', validatorRules.returnFlag]"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="24 / 2">
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="归还日期">
              <a-date-picker
                :disabled="disableSubmit"
                style="width: 100%"
                v-decorator="['returnTime', validatorRules.returnTime]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row style="width: 100%">
          <a-col :span="24">
            <a-form-item label="归还说明" :labelCol="{span:3}" :wrapperCol="{span:21}">
              <a-textarea :disabled="disableSubmit" placeholder="请输入归还说明"
                          v-decorator="['returnComment', validatorRules.returnComment]" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row style="width: 100%">
          <a-col :span="24 / 2">
            <a-form-item label="归还确认人" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-search-select-tag
                :disabled="disableSubmit"
                placeholder="请选择归还确认人"
                v-decorator="['returnConfirmer', { rules: [{ required: false, message: '请选择归还确认人' }] }]"
                dict="sys_user,realname,id,del_flag=0"
              />
            </a-form-item>
          </a-col>
          <a-col :span="24 / 2">
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="归还确认日期">
              <a-date-picker
                :disabled="disableSubmit"
                style="width: 100%"
                v-decorator="['returnConfirmTime', validatorRules.returnConfirmTime]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row style="width: 100%">
          <a-col :span="24">
            <a-form-item label="归还确认意见" :labelCol="{span:3}" :wrapperCol="{span:21}">
              <a-textarea :disabled="disableSubmit" placeholder="请输入归还确认意见"
                          v-decorator="['returnConfirmComment', validatorRules.returnConfirmComment]" />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()">选择刀具</a-button>
    <a-table
      ref="table"
      bordered
      size="middle"
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
    >
      <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index" >
        <div :key="col.dataIndex">
          <a-input
            :value="text"
            :disabled="disableSubmit"
            v-if="col.dataIndex === 'workpieceMaterial'"
            @change="(e)=>handleChange(e.target.value, record.key, col, index)"
          />
          <a-input-number
            v-if="col.dataIndex === 'usedLife'"
            :value="text"
            @change="(e) => handleChange(e, record.key, col, index)"
            :min="1"
          />
        </div>
      </template>
      <span slot="action" slot-scope="text, record, index">
   <a-modal :title="title" :visible="visible" :fullScreen="true" :width="1200" @ok="handleOk" @cancel="handleCancel">
      <a-spin :spinning="confirmLoading">
         <a-form :form="form">
            <a-row style="width: 100%">
               <a-col :span="24 / 2">
                  <a-form-item label="领用人" :labelCol="labelCol" :wrapperCol="wrapperCol">
                     <j-search-select-tag
                        :disabled="disableSubmit"
                        placeholder="请选择领用人"
                        v-decorator="['receiver', { rules: [{ required: true, message: '请选择领用人' }] }]"
                        dict="sys_user,realname,id,del_flag=0"
                     />
                  </a-form-item>
               </a-col>
               <a-col :span="24 / 2">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="领用日期">
                     <a-date-picker
                        :disabled="disableSubmit"
                        style="width: 100%"
                        v-decorator="['receiveTime', validatorRules.receiveTime]"
                     />
                  </a-form-item>
               </a-col>
            </a-row>
            <a-row style="width: 100%">
               <a-col :span="24">
                  <a-form-item label="领用说明" :labelCol="{span:3}" :wrapperCol="{span:21}">
                     <a-textarea :disabled="disableSubmit" placeholder="请输入领用说明"
                                 v-decorator="['receiveComment', validatorRules.receiveComment]" />
                  </a-form-item>
               </a-col>
            </a-row>
            <a-row style="width: 100%">
               <a-col :span="24 / 2">
                  <a-form-item label="确认人" :labelCol="labelCol" :wrapperCol="wrapperCol">
                     <j-search-select-tag
                        :disabled="disableSubmit"
                        placeholder="请选择确认人"
                        v-decorator="['confirmer', { rules: [{ required: false, message: '请选择确认人' }] }]"
                        dict="sys_user,realname,id,del_flag=0"
                     />
                  </a-form-item>
               </a-col>
               <a-col :span="24 / 2">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="确认日期">
                     <a-date-picker
                        :disabled="disableSubmit"
                        style="width: 100%"
                        v-decorator="['confirmTime', validatorRules.confirmTime]"
                     />
                  </a-form-item>
               </a-col>
            </a-row>
            <a-row style="width: 100%">
               <a-col :span="24">
                  <a-form-item label="确认意见" :labelCol="{span:3}" :wrapperCol="{span:21}">
                     <a-textarea :disabled="disableSubmit" placeholder="请输入确认意见"
                                 v-decorator="['confirmComment', validatorRules.confirmComment]" />
                  </a-form-item>
               </a-col>
            </a-row>
            <a-row style="width: 100%">
               <a-col :span="24 / 2">
                  <a-form-item label="是否会归还" :labelCol="labelCol" :wrapperCol="wrapperCol">
                     <a-input :disabled="disableSubmit" placeholder="请输入是否会归还"
                              v-decorator="['returnFlag', validatorRules.returnFlag]"></a-input>
                  </a-form-item>
               </a-col>
               <a-col :span="24 / 2">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="归还日期">
                     <a-date-picker
                        :disabled="disableSubmit"
                        style="width: 100%"
                        v-decorator="['returnTime', validatorRules.returnTime]"
                     />
                  </a-form-item>
               </a-col>
            </a-row>
            <a-row style="width: 100%">
               <a-col :span="24">
                  <a-form-item label="归还说明" :labelCol="{span:3}" :wrapperCol="{span:21}">
                     <a-textarea :disabled="disableSubmit" placeholder="请输入归还说明"
                                 v-decorator="['returnComment', validatorRules.returnComment]" />
                  </a-form-item>
               </a-col>
            </a-row>
            <a-row style="width: 100%">
               <a-col :span="24 / 2">
                  <a-form-item label="归还确认人" :labelCol="labelCol" :wrapperCol="wrapperCol">
                     <j-search-select-tag
                        :disabled="disableSubmit"
                        placeholder="请选择归还确认人"
                        v-decorator="['returnConfirmer', { rules: [{ required: false, message: '请选择归还确认人' }] }]"
                        dict="sys_user,realname,id,del_flag=0"
                     />
                  </a-form-item>
               </a-col>
               <a-col :span="24 / 2">
                  <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="归还确认日期">
                     <a-date-picker
                        :disabled="disableSubmit"
                        style="width: 100%"
                        v-decorator="['returnConfirmTime', validatorRules.returnConfirmTime]"
                     />
                  </a-form-item>
               </a-col>
            </a-row>
            <a-row style="width: 100%">
               <a-col :span="24">
                  <a-form-item label="归还确认意见" :labelCol="{span:3}" :wrapperCol="{span:21}">
                     <a-textarea :disabled="disableSubmit" placeholder="请输入归还确认意见"
                                 v-decorator="['returnConfirmComment', validatorRules.returnConfirmComment]" />
                  </a-form-item>
               </a-col>
            </a-row>
         </a-form>
      </a-spin>
      <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()">选择库存刀具</a-button>
      <a-table
         ref="table"
         bordered
         size="middle"
         rowKey="id"
         :columns="columns"
         :dataSource="dataSource"
         :pagination="ipagination"
         :loading="loading"
      >
         <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index">
            <div :key="col.dataIndex">
               <a-input
                  :value="text"
                  :disabled="disableSubmit"
                  v-if="col.dataIndex === 'workpieceMaterial'"
                  @change="(e)=>handleChange(e.target.value, record.key, col, index)"
               />
               <a-input-number
                  v-if="col.dataIndex === 'usedLife'"
                  :value="text"
                  @change="(e) => handleChange(e, record.key, col, index)"
                  :min="1"
               />
            </div>
         </template>
         <span slot="action" 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" type="primary">提交</a-button>
    </template>
      </a-table>
      <template slot="footer" v-if="disableSubmit == false">
         <a-button :style="{ marginRight: '8px' }" @click="handleCancel">关闭</a-button>
         <a-button @click="handleOk" type="primary">提交</a-button>
      </template>
    <template slot="footer" v-if="disableSubmit == true">
      <a-button :style="{ marginRight: '8px' }" @click="handleCancel">关闭</a-button>
    </template>
    <j-select-inventory-modal ref="inventoryModalForm" @ok="modalFormOk"></j-select-inventory-modal>
<!--    <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk"></j-select-tooling-modal>-->
  </a-modal>
      <template slot="footer" v-if="disableSubmit == true">
         <a-button :style="{ marginRight: '8px' }" @click="handleCancel">关闭</a-button>
      </template>
      <j-select-inventory-modal ref="inventoryModalForm" @ok="modalFormOk"></j-select-inventory-modal>
      <!--    <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk"></j-select-tooling-modal>-->
   </a-modal>
</template>
<script>
@@ -176,229 +176,226 @@
import JSelectInventoryModal from '@views/cms/modules/JSelectInventoryModal.vue'
export default {
  name: 'CuttingInboundModal',
  components: {
    JSelectToolingModal,
    JSelectInventoryModal,
    JMultiSelectTag,
    JDictSelectTag,
    store,
    moment
  },
  data() {
    return {
      /* 分页参数 */
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      title: '新增',
      visible: false,
      selectedRowKeys: {},
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 }
      },
      confirmLoading: false,
      loading: false,
      form: this.$form.createForm(this),
      dataSource: [],
      param: {},
      validatorRules: {},
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '刀具编码',
          align: 'center',
          dataIndex: 'cuttingCode',
          width: 150
        },
        {
          title: '刀具名称',
          align: 'center',
          dataIndex: 'cuttingName'
        },
        {
          title: '工件材质',
          align: 'center',
          dataIndex: 'workpieceMaterial',
          scopedSlots: { customRender: 'workpieceMaterial' }
        },
        {
          title: '使用寿命',
          align: 'center',
          dataIndex: 'usedLife',
          scopedSlots: { customRender: 'usedLife' }
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        add: '/cms/cuttingReceive/add',
        detailList: '/cms/cuttingReceive/detailList'
      },
      orderId: '',
      disableSubmit: false
    }
  },
  methods: {
    modalFormOk() {
    },
    getQueryParams() {
      this.param.pageNo = this.ipagination.current
      this.param.pageSize = this.ipagination.pageSize
      return filterObj(this.param)
    },
    add() {
      let receiver = store.getters.userInfo.id
      let receiveTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
      this.edit({ receiver: receiver, receiveTime: receiveTime })
    },
    edit(record) {
      record.receiver = store.getters.userInfo.id
      record.receiveTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
      this.form.resetFields()
      this.model = Object.assign({}, record)
      this.visible = true
      this.disableSubmit = false
      if (record.id) {
        this.orderId = record.id
        this.detailList(this.orderId)
   name: 'CuttingInboundModal',
   components: {
      JSelectToolingModal,
      JSelectInventoryModal,
      JMultiSelectTag,
      JDictSelectTag,
      store,
      moment
   },
   data() {
      return {
         /* 分页参数 */
         ipagination: {
            current: 1,
            pageSize: 10,
            pageSizeOptions: ['10', '20', '30'],
            showTotal: (total, range) => {
               return range[0] + '-' + range[1] + ' 共' + total + '条'
            },
            showQuickJumper: true,
            showSizeChanger: true,
            total: 0
         },
         title: '新增',
         visible: false,
         selectedRowKeys: {},
         model: {},
         labelCol: {
            xs: { span: 24 },
            sm: { span: 6 }
         },
         wrapperCol: {
            xs: { span: 24 },
            sm: { span: 18 }
         },
         confirmLoading: false,
         loading: false,
         form: this.$form.createForm(this),
         dataSource: [],
         param: {},
         validatorRules: {},
         columns: [
            {
               title: '#',
               dataIndex: '',
               key: 'rowIndex',
               width: 50,
               align: 'center',
               customRender: function(t, r, index) {
                  return parseInt(index) + 1
               }
            },
            {
               title: '刀具编码',
               align: 'center',
               dataIndex: 'cuttingCode',
               width: 150
            },
            {
               title: '刀具名称',
               align: 'center',
               dataIndex: 'cuttingName'
            },
            {
               title: '工件材质',
               align: 'center',
               dataIndex: 'workpieceMaterial',
               scopedSlots: { customRender: 'workpieceMaterial' }
            },
            {
               title: '使用寿命',
               align: 'center',
               dataIndex: 'usedLife',
               scopedSlots: { customRender: 'usedLife' }
            },
            {
               title: '操作',
               align: 'center',
               dataIndex: 'action',
               scopedSlots: { customRender: 'action' }
            }
         ],
         url: {
            add: '/cms/cuttingReceive/add',
            detailList: '/cms/cuttingReceive/detailList'
         },
         orderId: '',
         disableSubmit: false
      }
      this.$nextTick(() => {
        this.form.setFieldsValue(
          pick(this.model, 'receiver', 'receiveTime', 'receiveComment', 'confirmer', 'confirmTime', 'confirmComment'
            , 'returnFlag', 'returnTime', 'returnComment', 'returnConfirmer', 'returnConfirmTime', 'returnConfirmComment')
        )
   },
   methods: {
      modalFormOk() {
      },
      getQueryParams() {
         this.param.pageNo = this.ipagination.current
         this.param.pageSize = this.ipagination.pageSize
         return filterObj(this.param)
      },
      add() {
         let receiver = store.getters.userInfo.id
         let receiveTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
         this.edit({ receiver: receiver, receiveTime: receiveTime })
      },
      edit(record) {
         record.receiver = store.getters.userInfo.id
         record.receiveTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
         this.form.resetFields()
         this.model = Object.assign({}, record)
         this.visible = true
         this.disableSubmit = false
         if (record.id) {
            this.orderId = record.id
            this.detailList(this.orderId)
         }
         this.$nextTick(() => {
            this.form.setFieldsValue(
               pick(this.model, 'receiver', 'receiveTime', 'receiveComment', 'confirmer', 'confirmTime', 'confirmComment'
                  , 'returnFlag', 'returnTime', 'returnComment', 'returnConfirmer', 'returnConfirmTime', 'returnConfirmComment')
            )
         })
      },
      handleDelete(record, index) {
         this.dataSource.splice(index, 1)
      },
      handleChange(value, key, column, index) {
         //let t = (this.ipaginationm.current - 1) * this.ipaginationm.pageSize + index
         const temp = [...this.dataSource]
         const target = temp.filter((item) => key === item.key)[index]
         if (target) {
            target[column.dataIndex] = value
            this.dataSource = temp
         }
      },
      selectTooling: function() {
         let ids = []
         for (let i = 0; i < this.dataSource.length; i++) {
            ids.push(this.dataSource[i].inventoryId)
            console.log('当前数据源:', this.dataSource)
         }
         // this.$refs.toolingModalForm.showModal(ids)
         // this.$refs.toolingModalForm.title = '选择刀具'
         // this.$refs.toolingModalForm.disableSubmit = false
         this.$refs.inventoryModalForm.showModal(ids)
         this.$refs.inventoryModalForm.title = '选择库存刀具'
         this.$refs.inventoryModalForm.disableSubmit = false
      },
      detailList(orderId) {
         this.param.orderId = orderId
         getAction(this.url.detailList, this.getQueryParams()).then((res) => {
            if (res.success) {
               this.dataSource = res.result
            }
         })
      },
      filterOption(input, option) {
         return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      },
      handleOk() {
         if (this.dataSource.length == 0) {
            this.$message.error('请先选择入库刀具')
            return
         }
         const that = this
         // 触发表单验证
         this.form.validateFields((err, values) => {
            if (!err) {
               that.confirmLoading = true
               let formData = Object.assign(this.model, values)
               formData.detailData = this.dataSource
               // 确保 detailData 包含 inventoryId
               formData.detailData = this.dataSource.map(item => ({
                  ...item,
                  // 确保 inventoryId 被正确传递
                  inventoryId: item.inventoryId
               }))
               postAction(that.url.add, formData)
                  .then((res) => {
                     if (res.success) {
                        that.$message.success('领用成功')
                        that.$emit('ok', new Date())
                     } else {
                        that.$message.warning(res.message)
                     }
                  })
                  .finally(() => {
                     that.confirmLoading = false
                     that.close()
                  })
            }
         })
      },
      handleCancel() {
         this.close()
      },
      close() {
         this.$emit('close')
         this.dataSource = []
         this.visible = false
         this.disableSubmit = false
      }
   },
   mounted() {
      this.$bus.$on('selectionRows', (data) => {
         console.log('接收到的选择数据:', data)
         //getCurrSelected 事件 接收组件传递的参数
         for (let i = 0; i < data.length; i++) {
            this.dataSource.push({
               inventoryId: data[i].id,
               cuttingCode: data[i].cuttingCode,
               cuttingName: data[i].cuttingName,
               cuttingId: data[i].cuttingId
            })
         }
         console.log('更新后的数据源:', this.dataSource)
      })
    },
    handleDelete(record, index) {
      this.dataSource.splice(index, 1)
    },
    handleChange(value, key, column, index) {
      //let t = (this.ipaginationm.current - 1) * this.ipaginationm.pageSize + index
      const temp = [...this.dataSource]
      const target = temp.filter((item) => key === item.key)[index]
      if (target) {
        target[column.dataIndex] = value
        this.dataSource = temp
      }
    },
    selectTooling: function() {
      let ids = []
      for (let i = 0; i < this.dataSource.length; i++) {
        ids.push(this.dataSource[i].inventoryId)
        console.log('当前数据源:', this.dataSource)
      }
      // this.$refs.toolingModalForm.showModal(ids)
      // this.$refs.toolingModalForm.title = '选择刀具'
      // this.$refs.toolingModalForm.disableSubmit = false
      this.$refs.inventoryModalForm.showModal(ids)
      this.$refs.inventoryModalForm.title = '选择刀具'
      this.$refs.inventoryModalForm.disableSubmit = false
    },
    detailList(orderId) {
      this.param.orderId = orderId
      getAction(this.url.detailList, this.getQueryParams()).then((res) => {
        if (res.success) {
          this.dataSource = res.result
        }
      })
    },
    filterOption(input, option) {
      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
    },
    handleOk() {
      if (this.dataSource.length == 0) {
        this.$message.error('请先选择入库刀具')
        return
      }
      const that = this
      // 触发表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true
          let formData = Object.assign(this.model, values)
          formData.detailData = this.dataSource
          // 添加更新库存状态的逻辑
          const inventoryIds = this.dataSource.map(item => item.inventoryId)
          const updateInventoryStatus = inventoryIds.length > 0 ?
            //需要写一个更新库存状态的接口在后端(还没写25/9/9)
            postAction('/cms/inventory/updateStatus', {
              ids: inventoryIds,
              status: '待出库' //设为待出库
            }) : Promise.resolve()
          updateInventoryStatus.then(() => {
            return postAction(that.url.add, formData)
          }).then((res) => {
                if (res.success) {
                  that.$message.success('领用成功')
                  that.$emit('ok', new Date())
                } else {
                  that.$message.warning(res.message)
                }
              }).catch((error) => {
                that.$message.error('操作失败: ' + error.message)
              }).finally(() => {
                that.confirmLoading = false
                that.close()
              })
        }
      })
    },
    handleCancel() {
      this.close()
    },
    close() {
      this.$emit('close')
      this.dataSource = []
      this.visible = false
      this.disableSubmit = false
    }
  },
  mounted() {
    this.$bus.$on('selectionRows', (data) => {
      console.log('接收到的选择数据:', data)
      //getCurrSelected 事件 接收组件传递的参数
      for (let i = 0; i < data.length; i++) {
        this.dataSource.push({
          inventoryId: data[i].id,
          cuttingCode: data[i].cuttingCode,
          cuttingName: data[i].cuttingName,
          cuttingId: data[i].cuttingId
        })
      }
      console.log('更新后的数据源:', this.dataSource)
    })
  }
   }
}
</script>