Ver Fonte

材料请购单-按钮提示

jingbb há 1 ano atrás
pai
commit
e4b9c4ba85

+ 121 - 35
src/views/production/materialprocurement/materialProcurementList.vue

@@ -103,15 +103,15 @@
       <div class="table-operator">
         <a-button type="danger" size="small" @click='addList'>新增</a-button>
         <a-button  size="small" @click='addEdit'>修改</a-button>
-        <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="delecteList()">
-            <a-button size="small" >删除</a-button>
-        </a-popconfirm>
+        <a-button size="small" @click="delecteList()">删除</a-button>
         <a-button  size="small" @click="examineApprove">审批</a-button>
         <a-button  size="small" @click="abstainExamineApprove">弃审</a-button>
-        <a-button  size="small">导出</a-button>
-        <a-button  size="small">导入</a-button>
+        <a-button size="small" @click="exportList('材料请购单')">导出</a-button>
+        <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl">
+            <a-button  size="small">导入</a-button>
+        </a-upload>
         <a-button  size="small" @click="entireClose">整单关闭</a-button>
-        <a-button  size="small">请购单</a-button>
+        <a-button  size="small" @click="synchronizationData">请购单</a-button>
       </div>
   
       <!-- table区域-begin -->
@@ -289,18 +289,23 @@
               ellipsis: true,
             },
           ],
+          importExcelUrl:'/production/safetyStock/importExcel',
              // ---------workflow  by fhf start -------------
           serviceName: 'assetAllocationService',
           // ---------workflow  by fhf end -------------
           }
         },
         computed: {
+          importExcelUrl: function(){
+              return `${window._CONFIG['domianURL']}/${this.importExcelUrl}`;
+          },
         },
   
       created () {
         this.getTableList()
        },
       methods: {
+        //获取数据
         getTableList(){
           alertModal.loading("执行中,请稍后!")
           getAction('/materialRequisition/madeMaterialRequisition/list',this.queryParam).then(res=>{
@@ -317,6 +322,7 @@
                     }
                 })
         },
+        //查询
         searchQuery(){
           this.queryParam.pageNo=1
           this.getTableList()
@@ -329,15 +335,18 @@
         },
         onSearch(){
         },
+        //重置
         searchReset(){
             this.queryParam={}
             this.orderDate = []
             this.getTableList()
         },
+        //新增
         addList(){
             this.$refs.materialProcurementAdd.visible=true
             this.$refs.materialProcurementAdd.defaultMethod='add'
         },
+        //编辑
         addEdit(){
           if(this.selectedRowKeys.length==0){
             this.$message.warning('请选择数据!')
@@ -351,13 +360,18 @@
             this.$refs.materialProcurementAdd.getMainData(this.selectedRowKeys[0])
           }
         },
+        //审批
         examineApprove(){
           if(this.selectedRowKeys.length==0){
             this.$message.warning('请选择数据!')
           }else{
-            var ids =  this.selectedRowKeys.toString()
-            alertModal.loading("执行中,请稍后!")
-            getAction('/materialRequisition/madeMaterialRequisition/reviewerByIds',{ids:ids}).then(res=>{
+            this.$confirm({
+              title: '确认审批',
+              content: '是否审批选中数据?',
+              onOk:  ()=> {
+                var ids =  this.selectedRowKeys.toString()
+                alertModal.loading("执行中,请稍后!")
+                getAction('/materialRequisition/madeMaterialRequisition/reviewerByIds',{ids:ids}).then(res=>{
                     alertModal.closeLoading();
                     if(res.success){
                       var arr = res.message.split(";");
@@ -378,15 +392,22 @@
                       });
                     }
                 })
+              }
+            })
           }
         },
+        //弃审
         abstainExamineApprove(){
           if(this.selectedRowKeys.length==0){
             this.$message.warning('请选择数据!')
           }else{
-            var ids =  this.selectedRowKeys.toString()
-            alertModal.loading("执行中,请稍后!")
-            getAction('/materialRequisition/madeMaterialRequisition/unReviewerByIds',{ids:ids}).then(res=>{
+            this.$confirm({
+              title: '确认弃审',
+              content: '是否弃审选中数据?',
+              onOk:  ()=> {
+                var ids =  this.selectedRowKeys.toString()
+                alertModal.loading("执行中,请稍后!")
+                getAction('/materialRequisition/madeMaterialRequisition/unReviewerByIds',{ids:ids}).then(res=>{
                     alertModal.closeLoading();
                     if(res.success){
                       var arr = res.message.split(";");
@@ -407,15 +428,22 @@
                       });
                     }
                 })
+              }
+            })
           }
         },
+        //整单关闭
         entireClose(){
           if(this.selectedRowKeys.length==0){
             this.$message.warning('请选择数据!')
           }else{
-            var ids =  this.selectedRowKeys.toString()
-            alertModal.loading("执行中,请稍后!")
-            getAction('/materialRequisition/madeMaterialRequisition/closeOrder',{ids:ids}).then(res=>{
+            this.$confirm({
+              title: '确认整单关闭',
+              content: '是否整单关闭选中数据?',
+              onOk:  ()=> {
+                var ids =  this.selectedRowKeys.toString()
+                alertModal.loading("执行中,请稍后!")
+                getAction('/materialRequisition/madeMaterialRequisition/closeOrder',{ids:ids}).then(res=>{
                     alertModal.closeLoading();
                     if(res.success){
                       var arr = res.message.split(";");
@@ -436,36 +464,53 @@
                       });
                     }
                 })
+              }
+            })
+            
           }
         },
+        //删除
         delecteList(){
           if(this.selectedRowKeys.length==0){
             this.$manage.warning('请选择数据')
           }else if(this.selectedRowKeys.length==1){
-            alertModal.loading("执行中,请稍后!")
-            deleteAction('/materialRequisition/madeMaterialRequisition/delete', {id: this.selectedRowKeys[0]}).then((res) => {
-                  alertModal.closeLoading();
-                  if (res.success) {
-                    this.$message.success('删除成功!');
-                    this.getTableList()
-                  } else {
-                      this.$message.error(res.message);
-                  }
-                });
+            this.$confirm({
+              title: '确认删除',
+              content: '是否删除选中数据?',
+              onOk:  ()=>{
+                  alertModal.loading("执行中,请稍后!")
+                  deleteAction('/materialRequisition/madeMaterialRequisition/delete', {id: this.selectedRowKeys[0]}).then((res) => {
+                      alertModal.closeLoading();
+                      if (res.success) {
+                        this.$message.success('删除成功!');
+                        this.getTableList()
+                      } else {
+                        this.$message.error(res.message);
+                      }
+                  });
+              }
+            })
           }else{
-            var ids =  this.selectedRowKeys.toString()
-            alertModal.loading("执行中,请稍后!")
-            deleteAction('/materialRequisition/madeMaterialRequisition/deleteBatch', {ids: ids}).then((res) => {
-                  alertModal.closeLoading();
-                  if (res.success) {
-                    this.$message.success('删除成功!');
-                    this.getTableList()
-                  } else {
-                      that.$message.error(res.message);
-                  }
+            this.$confirm({
+              title: '确认删除',
+              content: '是否删除选中数据?',
+              onOk:  ()=> {
+                var ids =  this.selectedRowKeys.toString()
+                alertModal.loading("执行中,请稍后!")
+                deleteAction('/materialRequisition/madeMaterialRequisition/deleteBatch', {ids: ids}).then((res) => {
+                    alertModal.closeLoading();
+                    if (res.success) {
+                        this.$message.success('删除成功!');
+                        this.getTableList()
+                    } else {
+                      this.$message.error(res.message);
+                    }
                 });
+              }
+            })
           }
         },
+        //勾选
         onSelectChange(selectedRowKeys, selectionRows) {
           this.selectedRowKeys = selectedRowKeys;
           this.selectedRows = selectionRows;
@@ -475,6 +520,7 @@
             this.queryParam.pageSize = pagination.pageSize
             this.getTableList()
         },
+        //双击
         clickRow(record, index){
           return {
             on: {
@@ -486,6 +532,46 @@
             }
           }       
        },
+       //导出
+       exportList(fileName){
+        this.$confirm({
+          title: '确认导出',
+          content: '是否导出数据?',
+          onOk:  ()=> {
+            alertModal.loading("执行中,请稍后!")
+            downFile('/materialRequisition/madeMaterialRequisition/exportXls', this.queryParam).then(data => {
+              alertModal.closeLoading();
+              if (!data) {
+                this.$message.warning('文件下载失败')
+                return
+              }
+              if (typeof window.navigator.msSaveBlob !== 'undefined') {
+                window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
+              } 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 + '.xlsx')
+                document.body.appendChild(link)
+                link.click()
+                document.body.removeChild(link) // 下载完成移除元素
+                window.URL.revokeObjectURL(url) // 释放掉blob对象
+              }
+           })   
+         }
+        })
+      },
+      //请购单
+      synchronizationData(){
+        this.$confirm({
+          title: '确认请购单',
+          content: '是否点击请购单?',
+          onOk:  ()=> {
+            
+         }
+        })
+      }
     }
 }
   </script>