Browse Source

同海 导出 以及分页bug

qinbai 3 năm trước cách đây
mục cha
commit
f783f33ca6

+ 52 - 34
src/page/index/top/top-notice.vue

@@ -4,12 +4,9 @@
               trigger="click">
 
     <el-tabs v-model="activeName">
-      <el-tab-pane label="邮件(1)"
-                   name="first"></el-tab-pane>
-      <el-tab-pane label="消息(2)"
-                   name="second"></el-tab-pane>
-      <el-tab-pane label="通知"
-                   name="third"></el-tab-pane>
+      <el-tab-pane label="消息"
+                   name="first">
+      </el-tab-pane>
     </el-tabs>
     <el-scrollbar style="height:300px">
       <avue-notice :data="data"
@@ -17,7 +14,7 @@
                    @page-change="pageChange"></avue-notice>
     </el-scrollbar>
     <div slot="reference">
-      <el-badge is-dot>
+      <el-badge  :value="badge">
         <i class="el-icon-bell"></i>
       </el-badge>
     </div>
@@ -25,31 +22,6 @@
 </template>
 
 <script>
-let list = [{
-  img: '/img/bg/vip1.png',
-  title: '史蒂夫·乔布斯 关注了你',
-  subtitle: '05-08 15:08',
-  tag: '已经开始',
-  status: 0
-}, {
-  img: '/img/bg/vip2.png',
-  title: '斯蒂夫·沃兹尼亚克 关注了你',
-  subtitle: '05-08 15:08',
-  tag: '未开始',
-  status: 1
-}, {
-  img: '/img/bg/vip3.png',
-  title: '蒂姆·库克 关注了你',
-  subtitle: '05-08 15:08',
-  status: 3,
-  tag: '有错误'
-}, {
-  img: '/img/bg/vip4.png',
-  title: '比尔·费尔南德斯 关注了你',
-  subtitle: '05-08 15:08',
-  status: 4,
-  tag: '已完成'
-}];
 export default {
   name: "top-notice",
   data () {
@@ -64,13 +36,59 @@ export default {
           status: 'status'
         },
       },
-      data: list,
+      data: [],
+      path:"ws://192.168.1.151:8104/websocket?user=1",
+      socket:"",
+      badge:''
     }
   },
   created () {
-
+    // this.webSocket();
+  },
+  mounted() {
+     this.init();
   },
   methods: {
+    //初始化
+    init(){
+      if(typeof(WebSocket) === "undefined"){
+        alert("您的浏览器不支持socket")
+      }else{
+        // 实例化socket
+        this.socket = new WebSocket(this.path)
+        // 监听socket连接
+        this.socket.onopen = this.open
+        // 监听socket错误信息
+        this.socket.onerror = this.error
+        // 监听socket消息
+        this.socket.onmessage = this.getMessage
+      }
+    },
+    open() {
+      console.log("socket连接成功")
+      console.log()
+    },
+    error() {
+      console.log("连接错误")
+    },
+    getMessage(msg){
+      console.log(msg.data)
+
+      // let msgData =  JSON.stringify(msg.data);
+      // console.log(msgData)
+      // if(msg.data.unRead){
+      //   this.badge = msg.data.unReadNum
+      // }else{
+      //   this.badge = ''
+      // }
+    },
+    send() {
+      // this.socket.send(params)
+    },
+    close() {
+      console.log("socket已经关闭")
+    },
+
     pageChange (page, done) {
       setTimeout(() => {
         this.$message.success('页码' + page)

+ 2 - 7
src/views/workManagement/main-items/configuration/mainList.json

@@ -21,12 +21,6 @@
   "menuWidth": 120,
   "column": [
     {
-      "label": "客户名称",
-      "prop": "corpId",
-      "search": true,
-      "hide": true
-    },
-    {
       "label": "项目名称",
       "prop": "cname",
       "search": true,
@@ -36,7 +30,8 @@
     },
     {
       "label": "客户名称",
-      "prop": "corpNames",
+      "prop": "corpId",
+      "search": true,
       "index": 4,
       "width": 180,
       "overHidden": true

+ 40 - 28
src/views/workManagement/main-items/list.vue

@@ -11,6 +11,7 @@
       :summary-method="summaryMethod"
       @row-del="rowDel"
       @search-change="searchChange"
+      @current-change="currentChange"
       @refresh-change="refreshChange"
       @on-load="getList"
       @saveColumn="saveColumn"
@@ -21,6 +22,9 @@
           :configuration="configuration"
         ></select-component>
       </template>
+      <template slot-scope="scope" slot="corpId">
+        {{ scope.row.corpNames }}
+      </template>
       <template slot="corpAttnSearch">
         <el-select v-model="search.corpAttn"
                    remote
@@ -43,9 +47,10 @@
                    @click="addMainItems">新 单
         </el-button>
         <el-button size="small"
+                   icon="el-icon-printer"
                    type="info"
                    @click.stop="openReport()"
-          >导出报表
+          >报表
         </el-button>
       </template>
       <template slot-scope="scope" slot="menu">
@@ -65,10 +70,6 @@
         >删除
         </el-button>
       </template>
-      <report-dialog
-        :switchDialog="switchDialog"
-        @onClose="onClose()"
-      ></report-dialog>
     </avue-crud>
   </basic-container>
   <detail-page
@@ -92,7 +93,6 @@
 export default {
   data() {
     return {
-      switchDialog:false,
       loading: false,
       data: [],
       options:[],
@@ -150,29 +150,46 @@ export default {
         this.options = res.data.data
       })
     },
-    //打印
+    //报表
     openReport() {
-      this.switchDialog =! this.switchDialog;
+      let  searchParams = Object.assign({},this.search);
+      let param = this.paramsAdjustment(searchParams)
+      getList(1, 10000,param).then(res =>{
+        const fileData = this.deepClone(res.data.data.records)
+        fileData.map(item =>{
+          item.corpId = item.corpNames
+        })
+        this.$Export.excel({
+          title: "主营项目",
+          columns: option.column,
+          data: fileData,
+        });
+      })
     },
+
     //关闭打印
     onClose(val) {
       this.switchDialog = val;
     },
-    //flag:0 判断是主营项目还是结算
-    getList(page,params = {}) {
+    paramsAdjustment(params){
+      params = Object.assign({},this.search);
+      if (params.createTime &&  params.createTime.length !=0) {  //发货
+        params.createStartDate = params.createTime[0]+ " " + "00:00:00";
+        params.createEndDate = params.createTime[1] + " " + "23:59:59";
+        this.$delete(params,'createTime')
+      }
       params.flag = 0;
+      return params
+    },
+    //flag:0 判断是主营项目还是结算
+    getList(page,params) {
+      params = this.paramsAdjustment(params)
       this.loading = true;
-      if(params){
-        if (params.createTime &&  params.createTime.length !=0) {  //发货
-          params.createStartDate = params.createTime[0]+ " " + "00:00:00";
-          params.createEndDate = params.createTime[1] + " " + "23:59:59";
-          this.$delete(params,'createTime')
-        }
-      }
       getList(page.currentPage, page.pageSize,params).then(res =>{
         this.data = res.data.data.records
         this.page.total = res.data.data.total
-        this.loading = false
+      }).finally(()=>{
+        this.loading = false;
       })
     },
     //新单打开
@@ -195,6 +212,10 @@ export default {
       this.getList(this.page, params);
       done();
     },
+    currentChange(val) {
+      this.page.currentPage = val;
+      this.getList(this.page);
+    },
     refreshChange(params) {
       this.getList(this.page,params);
     },
@@ -261,16 +282,7 @@ export default {
     goBack() {
       this.detailData=this.$options.data().detailData
       this.show = true;
-
-      let params = Object.assign({}, this.search)
-
-      if (params.createTime &&  params.createTime.length !=0) {  //发货
-        params.createStartDate = params.createTime[0]+ " " + "00:00:00";
-        params.createEndDate = params.createTime[1] + " " + "23:59:59";
-        this.$delete(params,'createTime')
-      }
-
-      this.getList(this.page,params)
+      this.getList(this.page, this.search)
     },
   }
 };

+ 2 - 9
src/views/workManagement/receipt/configuration/settleAccounts.json

@@ -49,18 +49,11 @@
     },
     {
       "label": "客户名称",
-      "prop": "corpNames",
-      "overHidden": true,
-      "index": 4,
-      "width": 180
-    },
-    {
-      "label": "客户名称",
       "prop": "corpId",
-      "hide": true,
+      "overHidden": true,
       "search": true,
       "index": 4,
-      "width": 120
+      "width": 180
     },
     {
       "label": "合同金额",

+ 11 - 21
src/views/workManagement/receipt/configuration/statisticalList.json

@@ -40,24 +40,6 @@
   ],
   "column": [
     {
-      "label": "客户名称",
-      "search": true,
-      "hide": true,
-      "prop": "cornId"
-    },
-    {
-      "label": "任务部门",
-      "search": true,
-      "hide": true,
-      "type":"tree",
-      "dicUrl": "/api/blade-system/dept/tree?tenantId=096359",
-      "props": {
-        "label": "title",
-        "value": "value"
-      },
-      "prop": "deptid"
-    },
-    {
       "label": "服务项目",
       "prop": "pname",
       "search": true,
@@ -128,8 +110,9 @@
     },
     {
       "label": "客户名称",
-      "prop": "cornName",
+      "search": true,
       "overHidden": true,
+      "prop": "cornId",
       "index": 2,
       "width": 180
     },
@@ -163,10 +146,17 @@
     },
     {
       "label": "任务部门",
-      "prop": "deptName",
+      "search": true,
+      "type":"tree",
+      "dicUrl": "/api/blade-system/dept/tree?tenantId=096359",
+      "props": {
+        "label": "title",
+        "value": "value"
+      },
       "index": 9,
       "overHidden": true,
-      "width": 120
+      "width": 120,
+      "prop": "deptid"
     },
     {
       "label": "账户名称",

+ 35 - 21
src/views/workManagement/receipt/settleAccounts.vue

@@ -22,6 +22,9 @@
           :configuration="configuration"
         ></select-component>
       </template>
+      <template slot-scope="scope" slot="corpId">
+        {{ scope.row.corpNames }}
+      </template>
       <template slot="corpAttnSearch">
         <el-select v-model="search.corpAttn"
                    remote
@@ -42,7 +45,7 @@
           icon="el-icon-printer"
           size="small"
           type="primary"
-          @click.stop=""
+          @click.stop="downFile"
         >报 表
         </el-button>
       </template>
@@ -122,6 +125,22 @@
       // option.height = window.innerHeight - 340 ;
     },
     methods: {
+      downFile(){
+        let  searchParams = Object.assign({},this.search);
+        let param = this.paramsAdjustment(searchParams)
+
+        getList(1, 10000,param).then(res =>{
+          const fileData = this.deepClone(res.data.data.records)
+          fileData.map(item =>{
+            item.corpId = item.corpNames
+          })
+          this.$Export.excel({
+            title: "结算",
+            columns: option.column,
+            data: fileData,
+          });
+        })
+      },
       //远程模糊
       remoteMethod(query){
         let params = {
@@ -131,19 +150,23 @@
           this.options = res.data.data
         })
       },
-      getList(page,params={}) {
-        this.loading = true;
-        params.flag = 1;
-        if(params){
-          if (params.createTime &&  params.createTime.length !=0) {  //发货
-            params.createStartDate = params.createTime[0]+ " " + "00:00:00";
-            params.createEndDate = params.createTime[1] + " " + "23:59:59";
-            this.$delete(params,'createTime')
-          }
+      paramsAdjustment(params){
+        params = Object.assign({},this.search);
+        if (params.createTime &&  params.createTime.length !=0) {  //发货
+          params.createStartDate = params.createTime[0]+ " " + "00:00:00";
+          params.createEndDate = params.createTime[1] + " " + "23:59:59";
+          this.$delete(params,'createTime')
         }
+        params.flag = 1;
+        return params
+      },
+      getList(page,params) {
+        params =  this.paramsAdjustment(params)
+        this.loading = true;
         getList(page.currentPage, page.pageSize,params).then(res =>{
           this.data = res.data.data.records
           this.page.total = res.data.data.total
+        }).finally(()=>{
           this.loading = false
         })
       },
@@ -165,7 +188,7 @@
       },
       currentChange(val) {
         this.page.currentPage = val;
-        this.getList();
+        this.getList(this.page);
       },
       refreshChange() {
         this.getList(this.page);
@@ -191,16 +214,7 @@
       goBack() {
         this.detailData=this.$options.data().detailData
         this.show = true;
-
-        let params = Object.assign({}, this.search)
-
-        if (params.createTime &&  params.createTime.length !=0) {  //发货
-          params.createStartDate = params.createTime[0]+ " " + "00:00:00";
-          params.createEndDate = params.createTime[1] + " " + "23:59:59";
-          this.$delete(params,'createTime')
-        }
-
-        this.getList(this.page,params)
+        this.getList(this.page,this.search)
       },
     }
   };

+ 45 - 8
src/views/workManagement/receipt/statisticalList.vue

@@ -19,7 +19,7 @@
           icon="el-icon-printer"
           size="small"
           type="primary"
-          @click.stop="openReport()"
+          @click.stop="downFile"
         >报 表
         </el-button>
       </template>
@@ -29,6 +29,12 @@
           :configuration="configuration"
         ></select-component>
       </template>
+      <template slot-scope="scope" slot="cornId">
+        {{ scope.row.cornName }}
+      </template>
+      <template slot-scope="scope" slot="deptid">
+        {{ scope.row.deptName }}
+      </template>
       <template slot="userNameSearch">
         <el-select v-model="search.userName"
                    remote
@@ -102,6 +108,31 @@
       // option.height = window.innerHeight - 320 ;
     },
     methods: {
+      downFile(){
+        let  searchParams = Object.assign({},this.search);
+        let param = this.paramsAdjustment(searchParams)
+        getFlowList(1, 10000,param).then(res =>{
+          const fileData = this.deepClone(res.data.data.records)
+          fileData.map(item =>{
+            item.cornId = item.cornName
+            item.deptid = item.deptName
+            item.status = item.strStatus
+            if(item.projectType == 0){
+              item.projectType = "正常"
+            }else if(item.projectType == 1){
+              item.projectType = "追加"
+            }else if(item.projectType == 2){
+              item.projectType = "退款"
+            }
+          })
+
+          this.$Export.excel({
+            title: "统计列表",
+            columns: option.column,
+            data: fileData,
+          });
+        })
+      },
       rowDel() {
 
       },
@@ -150,26 +181,32 @@
       selectionChange() {
         console.log('1')
       },
-      currentChange() {
-        console.log('1')
+      currentChange(val) {
+        this.page.currentPage = val;
+        // this.onLoad(this.page,this.search)
       },
       sizeChange() {
         console.log('1')
       },
       refreshChange() {
-        console.log('1')
+        this.onLoad(this.page)
       },
-      onLoad(page, params = {}) {
-        if (params.payTime != undefined) {  //结算
+      paramsAdjustment(params){
+        params = Object.assign({},this.search);
+        if (params.payTime &&  params.payTime.length !=0) { //结算
           params.payStartTime = params.payTime[0]+ " " + "00:00:00";
           params.payEndTime = params.payTime[1] + " " + "23:59:59";
           this.$delete(params,'payTime')
         }
         if(!params.status && params.status!==0){
-            params.status = "0,1,2,3,4,5,6";
+          params.status = "0,1,2,3,4,5,6";
         }
+        return params
+      },
+      onLoad(page, params) {
+       let param = this.paramsAdjustment(params)
         this.loading = true
-        getFlowList(page.currentPage, page.pageSize,params).then(res =>{
+        getFlowList(page.currentPage, page.pageSize,param).then(res =>{
           this.dataList = res.data.data.records
           this.page.total = res.data.data.total
         }).finally(()=>{

+ 18 - 9
src/views/workManagement/task/configuration/mainList.json

@@ -45,7 +45,7 @@
       "type": "select",
       "dicData": [
         {
-          "label": "已核",
+          "label": "已核",
           "value": "1"
         },
         {
@@ -64,19 +64,28 @@
       "type": "select",
       "overHidden": true,
       "searchOrder": 5,
-      "width": 120
-    },
-    {
-      "label": "客户名称",
-      "overHidden": true,
-      "prop": "cornName",
-      "width": 220
+      "width": 120,
+      "dicData": [
+        {
+          "label": "已审核",
+          "value": "1"
+        },
+        {
+          "label": "正在结算",
+          "value": "4"
+        },
+        {
+          "label": "结算完成",
+          "value": "5"
+        }
+      ]
     },
     {
       "label": "客户名称",
-      "hide": true,
       "search": true,
       "prop": "cornId",
+      "overHidden": true,
+      "width": 180,
       "searchOrder": 1
     },
     {

+ 39 - 14
src/views/workManagement/task/index.vue

@@ -20,12 +20,15 @@
           :configuration="configuration"
         ></select-component>
       </template>
+      <template slot-scope="scope" slot="cornId">
+        {{ scope.row.cornName }}
+      </template>
       <template slot="menuLeft">
         <el-button
           icon="el-icon-printer"
           size="small"
           type="primary"
-          @click.stop="openReport()"
+          @click.stop="downFile"
         >报 表
         </el-button>
       </template>
@@ -75,9 +78,9 @@
         parentId:0,
         dataList: [],
         page: {
-          pageSize: 10,
-          pagerCount: 5,
+          currentPage: 1,
           total: 0,
+          pageSize: 10
         },
         query:{}
       }
@@ -89,6 +92,23 @@
       // option.height = window.innerHeight - 350 ;
     },
     methods: {
+      downFile(){
+        let searchParams = Object.assign({},this.search);
+        let param = this.paramsAdjustment(searchParams)
+        getFlowList(1, 10000,param).then(res =>{
+          const fileData = this.deepClone(res.data.data.records)
+          fileData.map(item =>{
+            item.cornId = item.cornName
+          })
+          const fileColumn = this.deepClone(option.column)
+          fileColumn.shift();
+          this.$Export.excel({
+            title: "任务",
+            columns: fileColumn,
+            data: fileData,
+          });
+        })
+      },
       //完工
       completion(row){
         this.$confirm("确认将此任务完工?", {
@@ -120,30 +140,35 @@
       selectionChange() {
         console.log('1')
       },
-      currentChange() {
-        console.log('1')
+      currentChange(val) {
+        this.page.currentPage = val
+        this.onLoad(this.page)
       },
       sizeChange() {
         console.log('1')
       },
       refreshChange() {
-        console.log('1')
+        this.onLoad(this.page)
       },
-      onLoad(page, params = {}) {
+      paramsAdjustment(params){
+        params = Object.assign({},this.search);
+        if (params.beginTime &&  params.beginTime.length !=0) {  //发货
+          params.beginStartTime = params.beginTime[0]+ " " + "00:00:00";
+          params.beginEndTime = params.beginTime[1] + " " + "23:59:59";
+          this.$delete(params,'beginTime')
+        }
         if(!params.status){
           params.status = "1,4,5";
         }
-        if(params){
-          if (params.beginTime != undefined) {  //发货
-            params.beginStartTime = params.beginTime[0]+ " " + "00:00:00";
-            params.beginEndTime = params.beginTime[1] + " " + "23:59:59";
-            this.$delete(params,'beginTime')
-          }
-        }
+        return params
+      },
+      onLoad(page, params = {}) {
+        params =  this.paramsAdjustment(params)
         this.loading = true
         getFlowList(page.currentPage, page.pageSize,params).then(res =>{
           this.dataList = res.data.data.records
           this.page.total = res.data.data.total
+        }).finally(()=>{
           this.loading = false
         })
       },