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 @@
      //     }
      //   })
      // },
    }
  }