فهرست منبع

Merge remote-tracking branch 'origin/bianww' into bianww

bianww 2 سال پیش
والد
کامیت
861a3cef55
2فایلهای تغییر یافته به همراه192 افزوده شده و 161 حذف شده
  1. 55 35
      src/pages/main/demandDevelop/index.vue
  2. 137 126
      src/pages/main/demandDevelop/ywStanding.vue

+ 55 - 35
src/pages/main/demandDevelop/index.vue

@@ -9,12 +9,14 @@
           @click="dialogCheck(3)"
           >添加</el-button
         >
-        <el-button
-          style="float: right; margin-top: 10px; margin-right: 20px"
-          type="primary"
-          @click="getStanding"
-          >台账</el-button
-        >
+          <el-button
+              v-if="standingAuth"
+              style="float: right; margin-top: 10px; margin-right: 20px"
+              type="primary"
+              @click="getStanding"
+          >台账
+          </el-button
+          >
       </div>
       <div class="tabbox">
         <el-table
@@ -506,8 +508,9 @@ export default {
           }
       }
     return {
-      rules: {
-        demandName: [
+        standingAuth: false,
+        rules: {
+            demandName: [
           {
             required: true,
             trigger: "blur",
@@ -1250,32 +1253,38 @@ export default {
         }
       );
     },
-    // 注销
-    delDetails(id){
-        this.$confirm('确认删除?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-        }).then(() => {
-            this.$http({
-                url: "/market/mkOnlineChannel/delDetailsById",
-                method: "post",
-                headers: {
-                    "Content-Type": "application/json",
-                },
-                data: {
-                    data: id,
-                },
-            }).then((res) => {
-                console.log(res)
-            });
-        }).catch(() => {
-            this.$message({
-                type: 'info',
-                message: '取消删除'
-            });
-        });
-    },
+      // 注销
+      delDetails(id){
+          this.$confirm('确认注销吗?', '提示', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+          }).then(() => {
+              this.$http({
+                  url: "/market/mkOnlineChannel/delDetailsByWoNo",
+                  method: "post",
+                  headers: {
+                      "Content-Type": "application/json",
+                  },
+                  data: id,
+              }).then(({ data }) => {
+                  console.log("res======================================")
+                  console.log(data)
+                  console.log(data.result)
+                  if (data && data.result === 0) {
+                      this.$message.success(data.desc);
+                      this.handleInit();
+                  } else {
+                      this.$message.error("操作失败");
+                  }
+              });
+          }).catch(() => {
+              this.$message({
+                  type: 'info',
+                  message: '取消注销'
+              });
+          });
+      },
     // 查看详情接口封装
     queryDetails(id) {
       this.$http({
@@ -2015,6 +2024,17 @@ export default {
         this.carryChannelopt = res.data;
       });
     },
+      ywStandingAuth(){
+          this.$http({
+              url: "/market/mkOnlineChannel/ywStandingAuth",
+              method: "post",
+              headers: {
+                  "Content-Type": "application/json",
+              },
+          }).then((res) => {
+             this.standingAuth =  res.data.body;
+          });
+      }
   },
   mounted() {
     // 调用初始化接口
@@ -2024,7 +2044,7 @@ export default {
     this.getTermianl();
     this.getsaleChnl();
   },
-  created() {},
+  created() { this.ywStandingAuth()},
 };
 </script>
 <style scoped lang="scss">

+ 137 - 126
src/pages/main/demandDevelop/ywStanding.vue

@@ -4,37 +4,20 @@
       <toolList @iconCli="iconCli" :tooltit="tooltit"></toolList>
       <div class="search">
         <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
-        <el-button
-          class="btn-check"
-          size="medium"
-          type="primary"
-          @click="outlist"
-          >导出
-        </el-button>
-      </div>
-      <div class="tabbox">
+        <div>
+            <el-button class="btn-check"  size="medium" type="primary"  @click="outlist">导出
+            </el-button>
+            <myUpload style="display:inline-block;" :fileInfo="fileInfo" @onSuccess="onSuccess"
+                      :fileList="fileInfo.fileList"></myUpload>
+        </div>
+        </div>
+        <div class="tabbox">
         <el-table
-          height="calc(100% - 40px)"
-          class="com-table"
-          ref="multipleTable"
-          :data="tableData"
-          tooltip-effect="dark"
-          size="small"
-          border
-          style="width: 100%"
+            height="calc(100% - 40px)" class="com-table" ref="multipleTable" :data="tableData"
+            tooltip-effect="dark" size="small" border style="width: 100%" v-loading="loading"
         >
-          <el-table-column prop="demandName" label="需求名称">
-          </el-table-column>
-          <el-table-column prop="groupName" label="提出部门/地市">
+          <el-table-column width="150" v-for="item in tableHead"  :prop=item.prop :label=item.label>
           </el-table-column>
-          <el-table-column prop="busiStartTime" label="时间段">
-            <template slot-scope="scope">
-              {{ scope.row.busiStartTime + "~" + scope.row.busiEndTime }}
-            </template>
-          </el-table-column>
-          <el-table-column prop="status" label="状态"> </el-table-column>
-          <el-table-column prop="support" label="支撑方"> </el-table-column>
-          <el-table-column prop="workload" label="工作量"> </el-table-column>
         </el-table>
         <el-pagination
           class="pageBox"
@@ -51,38 +34,53 @@
 <script>
 import mySearch from "../../../components/search.vue";
 import toolList from "../../../components/toolList.vue";
+import myUpload from '../../../components/upload';
+
 
 export default {
   components: {
-    mySearch,
-    toolList,
+      mySearch,
+      toolList,
+      myUpload
   },
   data() {
     return {
-      searchList: [
-        {
-          type: "input",
-          tit: "需求名称",
-          value: "",
-          width: "23%",
-        },
-        {
-          type: "input",
-          tit: "部门或地市",
-          value: "",
-          width: "23%",
+        // tableHead: [{prop: 'demandNo', label: '需求编号'},{prop: 'groupName', label: '提出部门'}],
+        fileInfo: {
+            type: 'btn',
+            typename: '导入',
+            btntype: 'primary',
+            limit: 1,
+            url: '/market/mkOnlineChannel/importLedgerList',
+            fileList: [],
+            typexz:"xlsx"
         },
+        loading:false,
+        tableHead:[],
+        searchList: [
+            // {
+            //   type: "input",
+        //   tit: "需求名称",
+        //   value: "",
+        //   width: "23%",
+        // },
+        // {
+        //   type: "input",
+        //   tit: "部门或地市",
+        //   value: "",
+        //   width: "23%",
+        // },
         {
           type: "date",
           tit: "开始时间",
           value: "",
-          width: "23%",
+          width: "46%",
         },
         {
           type: "date",
           tit: "结束时间",
           value: "",
-          width: "23%",
+          width: "46%",
         },
       ],
       tooltit: "线上业务需求台账",
@@ -107,20 +105,36 @@ export default {
     };
   },
   methods: {
+      headerStyleFun({rowIndex}){
+          if (rowIndex === 0){
+              return "font-size:14px;font-weight:bold;color:black;"
+          }
+      },
+      onSuccess(file){
+          this.searchInfo([this.searchList[0].value], 1);
+      },
     //搜索数据
     searchInfo(v) {
       this.params = {};
-      v[0] ? (this.params.demandName = v[0]) : "";
-      v[1] ? (this.params.deptOrCity = v[1]) : "";
-      v[2]
-        ? (this.params.startTime = this.$formatDate(v[2], "YYYY-MM-DD"))
+      // v[0] ? (this.params.demandName = v[0]) : "";
+      // v[1] ? (this.params.deptOrCity = v[1]) : "";
+      v[0]
+        ? (this.params.startTime = this.$formatDate(v[0], "YYYY-MM-DD"))
         : "";
-      v[3] ? (this.params.endTime = this.$formatDate(v[3], "YYYY-MM-DD")) : "";
-      this.handleInit();
+      v[1] ? (this.params.endTime = this.$formatDate(v[1], "YYYY-MM-DD")) : "";
+        if ((new Date(this.params.startTime)).getTime() > (new Date(this.params.endTime)).getTime()){
+            this.$message.error(
+                "开始时间不能大于结束时间"
+            );
+            return
+        }
+        this.getTableHeadlist();
+        this.handleInit();
     },
     // 初始化列表
     handleInit() {
-      this.$http({
+        this.loading=true;
+        this.$http({
         url: "/market/mkOnlineChannel/ledgerList",
         method: "post",
         headers: {
@@ -137,59 +151,38 @@ export default {
             body: { data, count },
           },
         }) => {
-          this.total = count;
-          this.tableData = data;
-          this.total = count;
+            this.loading = false;
+            this.total = count;
+            this.tableData = data;
+            this.total = count;
         }
       );
     },
+      //获取表头数据
+      getTableHeadlist() {
+          this.$http({
+              url: "/market/mkOnlineChannel/getTableHeadlist",
+              method: "post",
+              headers: {
+                  "Content-Type": "application/json",
+              },
+              data: {
+                  ...this.params,
+                  page: this.page,
+                  pageSize: this.pageSize,
+              },
+          }).then(({ data: { body } }) => {
+              this.tableHead = body;
+          });
+      },
     outlist() {
-      // let data = {
-      //   colStr:
-      //     "demandName,deptName,busiStartTime,busiEndTime,factoryName,workLoad",
-      //   fileName: "台账.xlsx",
-      //   tital: [
-      //     [
-      //       {
-      //         colNum: "0",
-      //         colSpan: "0",
-      //         rowSpan: "1",
-      //         val: "需求名称",
-      //       },
-      //       {
-      //         colNum: "1",
-      //         colSpan: "0",
-      //         rowSpan: "1",
-      //         val: "提出部门",
-      //       },
-      //       {
-      //         colNum: "2",
-      //         colSpan: "0",
-      //         rowSpan: "1",
-      //         val: "开始时间",
-      //       },
-      //       {
-      //         colNum: "3",
-      //         colSpan: "0",
-      //         rowSpan: "1",
-      //         val: "结束时间",
-      //       },
-      //       {
-      //         colNum: "4",
-      //         colSpan: "0",
-      //         rowSpan: "1",
-      //         val: "支撑方",
-      //       },
-      //       {
-      //         colNum: "5",
-      //         colSpan: "0",
-      //         rowSpan: "1",
-      //         val: "工作量",
-      //       },
-      //     ],
-      //   ],
-      // };
-      // // data.tital = JSON.stringify(data.tital)
+        var date = new Date()
+        var year = date.getFullYear()
+        var month = date.getMonth() + 1 < 10 ?
+            '0' + (date.getMonth() + 1) : date.getMonth()+ 1
+        var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
+        var nowDate=year+month+day
+
       this.$http({
         url: "/market/mkOnlineChannel/exportLedger",
         method: "post",
@@ -197,7 +190,11 @@ export default {
           "Content-Type": "application/json",
         },
         responseType: "blob",
-        data: this.params,
+          data: {
+              ...this.params,
+              page: this.page,
+              pageSize: this.pageSize,
+          }
       }).then((response) => {
         if (window.navigator && window.navigator.msSaveOrOpenBlob) {
           let blob = new Blob([response.data], {
@@ -205,7 +202,7 @@ export default {
           });
           window.navigator.msSaveOrOpenBlob(
             blob,
-            new Date().getTime() + ".xlsx"
+            "线上业务需求台账-"+nowDate + ".xlsx"
           );
         } else {
           /* 火狐谷歌的文件下载方式 */
@@ -213,7 +210,7 @@ export default {
           var downloadElement = document.createElement("a");
           var href = window.URL.createObjectURL(blob);
           downloadElement.href = href;
-          downloadElement.download = new Date().getTime() + ".xlsx";
+          downloadElement.download = "线上业务需求台账-"+nowDate + ".xlsx";
           document.body.appendChild(downloadElement);
           downloadElement.click();
           document.body.removeChild(downloadElement);
@@ -221,41 +218,54 @@ export default {
         }
       });
     },
+      inlist(){
+          this.$http({
+              url: "/market/mkOnlineChannel/importLedger",
+              method: "post",
+              headers: {
+                  "Content-Type": "application/json",
+              },
+              data: this.params,
+          }).then((res) => {
+              res.data;
+          });
+      },
     // 分页
     currchange(v) {
       this.page = v;
-      this.handleInit();
+        this.getTableHeadlist();
+        this.handleInit();
     },
 
     //获取列表
-    getList(v, n) {
-      v.sts = 1;
-      this.pageSize = n;
-      let _this = this;
-      this.$http({
-        url: "/market/cChannelDemand/queryPage",
-        method: "post",
-        headers: {
-          "Content-Type": "application/json",
-          page: '{"pageNo":"' + n + '","pageSize":"10"}',
-        },
-        data: v,
-      }).then((res) => {
-        this.tableData = res.data.data;
-        this.total = res.data.totalRecord;
-      });
-    },
+    // getList(v, n) {
+    //   v.sts = 1;
+    //   this.pageSize = n;
+    //   let _this = this;
+    //   this.$http({
+    //     url: "/market/cChannelDemand/queryPage",
+    //     method: "post",
+    //     headers: {
+    //       "Content-Type": "application/json",
+    //       page: '{"pageNo":"' + n + '","pageSize":"10"}',
+    //     },
+    //     data: v,
+    //   }).then((res) => {
+    //     this.tableData = res.data.data;
+    //     this.total = res.data.totalRecord;
+    //   });
+    // },
 
     //功能栏
     iconCli(v) {
       if (v === 1) {
-        this.handleInit();
+          this.getTableHeadlist();
+          this.handleInit();
       }
       if (v === 2) {
         this.fullscreen = !this.fullscreen;
       }
     },
-    // =======================
 
     getUser() {
       this.userInfo = JSON.parse(window.sessionStorage.userInfo);
@@ -268,9 +278,10 @@ export default {
     },
   },
   mounted() {
-    // this.getList({}, 1);
-    this.handleInit();
-    this.getUser();
+      // this.getList({}, 1);
+      this.getTableHeadlist();
+      this.handleInit();
+      this.getUser();
   },
   created() {},
 };