feat(cms):
CuttingReceiveDetailList.vue刀具领用功能中新增领用单提交功能
CuttingReceiveList.vue 刀具领用 提交按钮的前端样式和刀具领用归还按钮的前端样式
已修改4个文件
311 ■■■■■ 文件已修改
src/views/cms/CuttingInboundList.vue 131 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/cms/CuttingReceiveDetailList.vue 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/cms/CuttingReceiveList.vue 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/cms/modules/CuttingReceiveModal.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/cms/CuttingInboundList.vue
@@ -70,7 +70,8 @@
    <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-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
                   @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
    </div>
@@ -78,7 +79,8 @@
    <!-- 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>项
            <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>
@@ -101,7 +103,8 @@
        </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;"/>
               <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>
@@ -117,7 +120,7 @@
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)" :disabled="record.orderStatus == '2'">编辑</a>
          <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>
@@ -154,8 +157,6 @@
</template>
<script>
  import '@/assets/less/TableExpand.less'
@@ -167,7 +168,7 @@
  import Vue from 'vue'
  import { ACCESS_TOKEN } from '@/store/mutation-types'
  import store from '@/store'
  import { Modal } from 'ant-design-vue';
import { Modal } from 'ant-design-vue'
  export default {
    name: 'CuttingInboundList',
@@ -186,91 +187,91 @@
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
               align: 'center',
            customRender:function (t,r,index) {
              return parseInt(index)+1;
                  return parseInt(index) + 1
            }
          },
          {
            title:'入库人',
            align:"center",
               align: 'center',
            dataIndex: 'receiver_dictText'
          },
          {
            title:'入库时间',
            align:"center",
               align: 'center',
            dataIndex: 'receiveTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
                  return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
            }
          },
          {
            title:'入库说明',
            align:"center",
               align: 'center',
            dataIndex: 'receiveComment'
          },
          {
            title:'确认人',
            align:"center",
               align: 'center',
            dataIndex: 'confirmer_dictText'
          },
          {
            title:'确认时间',
            align:"center",
               align: 'center',
            dataIndex: 'confirmTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
                  return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
            }
          },
          {
            title:'确认意见',
            align:"center",
               align: 'center',
            dataIndex: 'confirmComment'
          },
          {
            title:'入库单状态',
            align:"center",
            dataIndex: 'orderStatus_dictText',
               align: 'center',
               dataIndex: 'orderStatus_dictText'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
               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",
            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:[],
         superFieldList: []
      }
    },
    created() {
      this.getSuperFieldList();
      this.getSuperFieldList()
      // 添加字典数据加载
      this.initDictConfig();
      this.initDictConfig()
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
         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.loadData(1)
      },
      handleEdit: function (record) {
        this.$refs.modalForm.edit(record)
@@ -283,9 +284,9 @@
        this.$refs.modalForm.disableSubmit = false
      },
      handleDetail:function(record){
        this.$refs.modalForm.edit(record);
        this.$refs.modalForm.title="详情";
        this.$refs.modalForm.disableSubmit = true;
         this.$refs.modalForm.edit(record)
         this.$refs.modalForm.title = '详情'
         this.$refs.modalForm.disableSubmit = true
      },
      // 自定义行点击事件
@@ -306,27 +307,27 @@
              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 = "导出文件"
         if (!fileName || typeof fileName != 'string') {
            fileName = '导出文件'
        }
        let param = this.getQueryParams();
         let param = this.getQueryParams()
        if(this.selectedRowKeys && this.selectedRowKeys.length>0){
          param['selections'] = this.selectedRowKeys.join(",")
            param['selections'] = this.selectedRowKeys.join(',')
        }
        console.log("导出参数",param)
         console.log('导出参数', param)
        downFile(this.url.exportXlsUrl,param).then((data)=>{
          if (!data) {
            // this.$message.warning("文件下载失败")
            this.$notification.warning({
              message:'消息',
              description:"文件下载失败"
            });
                  description: '文件下载失败'
               })
            return
          }
          if (typeof window.navigator.msSaveBlob !== 'undefined') {
@@ -339,20 +340,20 @@
            link.setAttribute('download', fileName+'.xls')
            document.body.appendChild(link)
            link.click()
            document.body.removeChild(link); //下载完成移除元素
            window.URL.revokeObjectURL(url); //释放掉blob对象
               document.body.removeChild(link) //下载完成移除元素
               window.URL.revokeObjectURL(url) //释放掉blob对象
          }
        })
      },
      /* 导入 */
      handleImportExcel(info){
        this.loading = true;
         this.loading = true
        if (info.file.status !== 'uploading') {
          console.log(info.file, info.fileList);
            console.log(info.file, info.fileList)
        }
        if (info.file.status === 'done') {
          this.loading = false;
            this.loading = false
          if (info.file.response.success) {
            // this.$message.success(`${info.file.name} 文件上传成功`);
            if (info.file.response.code === 201) {
@@ -371,7 +372,7 @@
              this.$notification.success({
                message:'消息',
                description:info.file.response.message || `${info.file.name} 文件上传成功`
              });
                  })
            }
            this.loadData()
          } else {
@@ -379,14 +380,14 @@
            this.$notification.error({
              message:'消息',
              description:`${info.file.name} ${info.file.response.message}.`
            });
               })
          }
        } else if (info.file.status === 'error') {
          this.loading = false;
            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失效")) {
               if (token && data.message.includes('Token失效')) {
              this.$error({
                title: '登录已过期',
                content: '很抱歉,登录已过期,请重新登录',
@@ -395,7 +396,7 @@
                onOk: () => {
                  store.dispatch('Logout').then(() => {
                    Vue.ls.remove(ACCESS_TOKEN)
                    window.location.reload();
                           window.location.reload()
                  })
                }
              })
@@ -405,21 +406,20 @@
            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
         let targetId = id // 从参数获取ID
        // 如果没有通过参数传递ID,则检查选中的记录
        if (!targetId) {
          if (this.selectedRowKeys.length != 1) {
@@ -444,11 +444,11 @@
          cancelText: '取消',
          onOk() {
            // 显示加载提示
            const hide = that.$message.loading('正在提交数据,请耐心等待...', 0);
               const hide = that.$message.loading('正在提交数据,请耐心等待...', 0)
            // 发送请求
            return httpAction(httpurl, params, method).then((res) => {
              hide(); // 隐藏加载提示
                  hide() // 隐藏加载提示
              if (res.success) {
                that.$message.success(res.message)
                that.loadData()
@@ -456,14 +456,14 @@
                that.$message.warning(res.message)
              }
            }).catch(error => {
              hide(); // 隐藏加载提示
                  hide() // 隐藏加载提示
              that.$message.error('提交失败: ' + error.message)
            }).finally(() => {
              that.loading = false
            })
          }
        })
      },
      }
      // /**
      //  *  单据提交(支持实时进度更新)
@@ -613,7 +613,6 @@
      //     }
      //   })
      // },
    }
  }
src/views/cms/CuttingReceiveDetailList.vue
@@ -3,7 +3,8 @@
    <!-- 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>项
            <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>
@@ -25,7 +26,8 @@
        </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;"/>
               <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>
@@ -75,8 +77,7 @@
  export default {
    name: 'CuttingReceiveDetailList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
    },
   components: {},
    data () {
      return {
        description: '领用单明细管理页面',
@@ -87,38 +88,43 @@
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
               align: 'center',
            customRender:function (t,r,index) {
              return parseInt(index)+1;
                  return parseInt(index) + 1
            }
          },
          {
            title:'刀具编码',
            align:"center",
               align: 'center',
            dataIndex: 'cuttingCode'
          },
          {
            title:'刀具名称',
            align:"center",
               align: 'center',
            dataIndex: 'cuttingName'
          },
          {
               title: '刀具条码',
               align: 'center',
               dataIndex: 'cuttingBarcode'
            },
            {
            title:'工件材质',
            align:"center",
               align: 'center',
            dataIndex: 'workpieceMaterial'
          },
          {
            title:'使用寿命',
            align:"center",
               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",
            list: '/cms/cuttingReceive/detailList',
            delete: '/cms/cuttingReceiveDetail/delete',
            deleteBatch: '/cms/cuttingReceiveDetail/deleteBatch',
            exportXlsUrl: '/cms/cuttingReceiveDetail/exportXls',
            importExcelUrl: 'cms/cuttingReceiveDetail/importExcel'
        },
        dictOptions:{},
@@ -127,22 +133,23 @@
      }
    },
    created() {
    this.getSuperFieldList();
      this.getSuperFieldList()
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
         return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
         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:'使用寿命'})
@@ -151,8 +158,8 @@
    },
     mounted() {
    this.$bus.$on('getToolingStorageData', (data) => {
      this.queryParam.orderId = data.id;
      this.searchQuery();
         this.queryParam.orderId = data.id
         this.searchQuery()
    })
  }
  }
src/views/cms/CuttingReceiveList.vue
@@ -100,9 +100,27 @@
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
            <!--        <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,10 +128,21 @@
              <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>
@@ -137,6 +166,7 @@
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CuttingReceiveModal from './modules/CuttingReceiveModal'
import CuttingReceiveDetailList from './CuttingReceiveDetailList'
import { httpAction } from '@api/manage'
export default {
  name: 'CuttingReceiveList',
@@ -235,7 +265,7 @@
        {
          title: '领用单状态',
          align: 'center',
          dataIndex: 'orderStatus'
               dataIndex: 'orderStatus_dictText'
        },
        {
          title: '操作',
@@ -251,8 +281,8 @@
        delete: '/cms/cuttingReceive/delete',
        deleteBatch: '/cms/cuttingReceive/deleteBatch',
        exportXlsUrl: '/cms/cuttingReceive/exportXls',
        importExcelUrl: 'cms/cuttingReceive/importExcel'
            importExcelUrl: 'cms/cuttingReceive/importExcel',
            submit: '/cms/cuttingReceive/submit'
      },
      dictOptions: {},
      superFieldList: []
@@ -307,7 +337,63 @@
          }
        }
      }
      },
      /**
       *  单据提交
       */
      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>
src/views/cms/modules/CuttingReceiveModal.vue
@@ -116,7 +116,7 @@
        </a-row>
      </a-form>
    </a-spin>
    <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()">选择刀具</a-button>
      <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()">选择库存刀具</a-button>
    <a-table
      ref="table"
      bordered
@@ -253,8 +253,8 @@
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
               dataIndex: 'action',
          scopedSlots: { customRender: 'action' }
        }
      ],
@@ -321,7 +321,7 @@
      // this.$refs.toolingModalForm.disableSubmit = false
      this.$refs.inventoryModalForm.showModal(ids)
      this.$refs.inventoryModalForm.title = '选择刀具'
         this.$refs.inventoryModalForm.title = '选择库存刀具'
      this.$refs.inventoryModalForm.disableSubmit = false
    },
@@ -349,26 +349,23 @@
          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) => {
               // 确保 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)
                }
              }).catch((error) => {
                that.$message.error('操作失败: ' + error.message)
              }).finally(() => {
                  })
                  .finally(() => {
                that.confirmLoading = false
                that.close()
              })