zhouxingyu 2 semanas atrás
pai
commit
8ef499f019
1 arquivos alterados com 34 adições e 15 exclusões
  1. 34 15
      src/views/lg/ProdPlan/ProdPlanList.vue

+ 34 - 15
src/views/lg/ProdPlan/ProdPlanList.vue

@@ -58,7 +58,6 @@
         :columns="columns"
         :dataSource="dataSource"
         :pagination="ipagination"
-        :loading="loading"
         :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
         class="j-table-force-nowrap"
         @change="handleTableChange">
@@ -70,7 +69,7 @@
           <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">
+        <template slot="fileSlot" slot-scope="text, record" >
           <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
           <a-button
             v-else
@@ -80,14 +79,14 @@
             size="small"
             @click="downloadFile(text)">
             下载
-            <span v-if="text" style="color: #13CE66;">({{text ? "已解析" : "未解析"}})</span>
-            <span v-else style="color: #E6A23C;">({{text ? "已解析" : "未解析"}})</span>
+            <span v-if="record.analysisState" style="color: #13CE66;">(已解析)</span>
+            <span v-else style="color: #E6A23C;">(未解析)</span>
           </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" />
@@ -99,16 +98,16 @@
           </a-popconfirm>
 
           <a-divider type="vertical" />
-          <a @click="handleAnalysis(record.id)" >解析</a>
+          <a-button type="link" size="small" @click="handleAnalysis(record.id)" :loading="analysisLoading">解析</a-button>
 
           <a-divider type="vertical" />
-          <a @click="handleReport(record.id)">生成报告</a>
+          <a-button type="link" size="small" @click="handleReport(record)">生成报告</a-button>
 
           <a-divider type="vertical" />
-          <a @click="handleEmal(record.id)">
+          <a-button type="link" size="small" @click="handleEmal(record.id)" :loading="emailLoading">
             <span v-if="record.sendState === 1">重新发送</span>
             <span v-else>发送邮件</span>
-          </a>
+          </a-button>
         </span>
 
       </a-table>
@@ -135,6 +134,8 @@
     data () {
       return {
         description: '生产计划管理页面',
+        analysisLoading: false,
+        emailLoading: false,
         // 表头
         columns: [
           {
@@ -165,8 +166,21 @@
             title:'发件状态',
             align:"center",
             dataIndex: 'sendState',
-            customRender:function (text) {
-              return text === 1 ? "已发送" : "未发送"
+            customRender: (t, r, index, column) => {
+              let that = this;
+              const child = that.$createElement('span', {
+                style: {
+                  color: t ? "#13CE66" : "#E6A23C"
+                },
+                domProps: {
+                  innerHTML: t ? "已发送" : "未发送"
+                }
+              })
+              const obj = {
+                children: child,
+                attrs: {}
+              }
+              return obj;
             }
           },
           {
@@ -230,7 +244,10 @@
       },
       handleAnalysis: function (id) {
         var that = this;
+        that.analysisLoading = true;
         getAction(that.url.analysis, {id: id}).then((res) => {
+          that.analysisLoading = false;
+          this.searchQuery()
           if (res.success) {
             that.$message.success(res.message);
           } else {
@@ -238,15 +255,15 @@
           }
         });
       },
-      handleReport(id){
-        let fileName = "导出文件"
+      handleReport(record){
+        let fileName = "生产异常报告"
         let pie = this.pieChart.getDataURL({
             type: 'png',
             pixelRatio: 2, // 设置像素比,提高清晰度
             backgroundColor: '#fff' // 设置背景色
           }).replace(/^data:image\/\w+;base64,/, '')
 
-        downFile(this.url.report,{id: id,pie:pie},"POST").then((data)=>{
+        downFile(this.url.report,{id: record.id,pie:pie},"POST").then((data)=>{
           if (!data) {
             this.$message.warning("文件下载失败")
             return
@@ -260,7 +277,7 @@
             let link = document.createElement('a')
             link.style.display = 'none'
             link.href = url
-            link.setAttribute('download', fileName+'.xlsx')
+            link.setAttribute('download', record.planDate + fileName +'.xlsx')
             document.body.appendChild(link)
             link.click()
             document.body.removeChild(link); //下载完成移除元素
@@ -270,12 +287,14 @@
       },
       handleEmal: function (id) {
         var that = this;
+        that.emailLoading = true;
         let pie = that.pieChart.getDataURL({
             type: 'png',
             pixelRatio: 2, // 设置像素比,提高清晰度
             backgroundColor: '#fff' // 设置背景色
           }).replace(/^data:image\/\w+;base64,/, '')
         postAction(that.url.email, {id: id,pie:pie}).then((res) => {
+          that.emailLoading = false;
           this.searchQuery();
           if (res.success) {
             that.$message.success(res.message);