Quellcode durchsuchen

Merge branch 'master' of http://101.43.129.26:10880/psychological_camera/cpdm_manage

root vor 1 Monat
Ursprung
Commit
5e3a14acd5

+ 1 - 0
src/components/ComparePlanUser.vue

@@ -789,6 +789,7 @@ export default {
     flex: 1;
     display: flex;
     justify-content: space-between;
+    flex-direction: column;
     .compare_plan_time {
       margin-top: 6px;
       color: #999999;

+ 1 - 1
src/components/PlanReport.vue

@@ -696,6 +696,6 @@ export default {
 
 .chart_wrap {
   flex: 1;
-  height: 450px;
+  // height: 450px;
 }
 </style>

+ 24 - 2
src/utils/http.js

@@ -17,8 +17,8 @@ import { router } from "@/router";
 // axios.defaults.baseURL = 'https://child.hhnao.com:8070';
 // axios.defaults.baseURL = 'https://child.hhnao.com:8070';
 //https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx01d1a44906973cf2&redirect_uri=http%3A%2F%2F192.168.18.51%3A8085&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect
-export const basePath='http://10.113.248.4:8089'
-// export const basePath = "http://43.143.198.30:8089";
+// export const basePath='http://10.113.248.4:8089'
+export const basePath = "http://43.143.198.30:8089";
 // const base_url = 'http://43.143.198.30:8089/'
 // const base_url = 'http://10.113.248.4:8090/'
 // export const basePath='http://43.143.198.30:8086'
@@ -177,6 +177,28 @@ const http = {
       sCallBack(res);
     });
   },
+  postDown: (url, data, sCallBack) => {
+    if (data) {
+      if (isMI) {
+        data = Encrypt(JSON.stringify(data));
+      } else {
+        // data = JSON.stringify(data);
+        // data = data;
+      }
+    }
+    axios({
+      method: "post",
+      url: url,
+      responseType: "blob",
+      params: data,
+      headers: {
+        // Accept: "application/octet-stream",
+        "Content-Disposition": "attachment",
+      },
+    }).then((res) => {
+      sCallBack(res);
+    });
+  },
   post: (url, data, sucessCallBack, errCallBack) => {
     if (data) {
       if (isMI) {

+ 261 - 4
src/views/manage/channelManagement/channelManagement.vue

@@ -51,7 +51,7 @@
       </el-row>
       <div class="table-content">
         <el-table
-        height="100%"
+          height="100%"
           :data="tableData"
           :row-style="{ height: '0px' }"
           :cell-style="{ padding: '5px' }"
@@ -67,9 +67,9 @@
             width=""
           >
           </el-table-column>
-          <el-table-column prop="createTime" label="创建时间" align="center" width="">
+          <el-table-column prop="createTime" label="创建时间" :show-overflow-tooltip="true" align="center" width="">
           </el-table-column>
-          <el-table-column prop="planEndTime" label="结束时间" align="center" width="">
+          <el-table-column prop="planEndTime" label="结束时间" :show-overflow-tooltip="true" align="center" width="">
           </el-table-column>
           <el-table-column
             prop="planOrgName"
@@ -90,14 +90,19 @@
             width=""
           >
           </el-table-column>
-          <el-table-column label="操作" width="auto" align="center">
+          <el-table-column label="操作" width="300px" align="center">
             <template slot-scope="scope">
               <div class="detail_button_out" v-if="scope.row.planStatus == '3'">
                 <div class="detail_button" @click="addUser(scope.row)">
                   <img src="../../../assets/img/table/search.png" />
                   <span> 完成及得分情况</span>
                 </div>
+                <div  v-if="scope.row.enable == '1'" class="detail_button" @click="downloadButton(scope.row)">
+                  <img src="../../../assets/img/table/search.png" />
+                  <span> 下载报告</span>
+                </div>
               </div>
+
               <!-- <el-popconfirm
                 v-if="scope.row.state != 0"
                 title="确定删除吗?"
@@ -147,6 +152,92 @@
       </el-pagination> -->
     </div>
     <PlanReport ref="register" @search="searchTarget" />
+    <!-- 弹出框---选择问题需要下载的组织架构 -->
+    <el-dialog
+      title=""
+      :visible.sync="downloadVisible"
+      width="40%"
+      :before-close="handleClose"
+      center
+    >
+      <div slot="title">
+        <p style="text-align: center; margin-bottom: 20px; font-weight: 700">报告下载</p>
+        <el-form :inline="true" class="demo-form-inline" style="margin-top: 20px">
+          <el-form-item label="选择下载范围">
+            <el-select v-model="dimensionality" placeholder="请选择下载范围">
+              <el-option
+                v-for="item in dimensionalityOption"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+
+        <!-- <el-form :inline="true" v-show="dimensionality=='0'" class="demo-form-inline" style="margin-top: 20px">
+          <el-form-item label="选择院">
+            <el-select multiple v-model="orgName" placeholder="请选择院">
+              <el-option
+                v-for="item in orgList"
+                :key="item.id"
+                :label="item.orgName"
+                :value="item.orgNo"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-form> -->
+        <el-form
+          :inline="true"
+          v-show="dimensionality == '1'"
+          class="demo-form-inline"
+          style="margin-top: 20px"
+        >
+          <el-form-item label="选择届">
+            <el-select v-model="grade" placeholder="请选择届">
+              <el-option
+                v-for="item in gradeList"
+                :key="item.id"
+                :label="item"
+                :value="item"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+
+        <el-form
+          :inline="true"
+          v-show="dimensionality == '2'"
+          class="demo-form-inline"
+          style="margin-top: 20px"
+        >
+          <el-form-item label="选择班级">
+            <el-select multiple v-model="orgName" placeholder="请选择班级">
+              <el-option
+                v-for="item in orgList"
+                :key="item.id"
+                :label="item.orgName"
+                :value="item.orgNo"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-form>
+        <el-button v-show="dimensionality == '0'" @click="downloadFun">
+          全院下载
+        </el-button>
+        <el-button v-show="dimensionality == '1'" @click="downloadFun">
+          下载已选年级
+        </el-button>
+        <el-button v-show="dimensionality == '2'" @click="downloadFun">
+          下载已选班级
+        </el-button>
+        <el-button v-show="dimensionality == '2'" @click="downloadAllFun">
+          下载全部班级
+        </el-button>
+      </div>
+
+      <span slot="footer" class="dialog-footer"> </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -228,6 +319,25 @@ export default {
         { name: "进行中", id: "2" },
         { name: "已完成", id: "3" },
       ],
+      //下载报告标志
+      downloadVisible: false,
+      //当前下载的计划需要点击需要下
+      //组织架构列表
+      orgList: [],
+      //组织编号name
+      orgName: [],
+      //下载报告  测试计划ID
+      planId: "",
+      dimensionality: 0,
+      dimensionalityOption: [
+        { id: 0, name: "学院" },
+        { id: 1, name: "年级" },
+        { id: 2, name: "班级" },
+      ],
+      //院的编号
+      courtNum: "",
+      grade: "",
+      gradeList: [],
     };
   },
   created() {},
@@ -242,6 +352,150 @@ export default {
     this.searchTarget();
   },
   methods: {
+    handleClose() {
+      this.downloadVisible=false;
+    },
+    //根据计划查询院
+    queryCourt() {
+      this.$http.get(`/planOrg/findPlanParentOrg?planId=${this.planId}`, {}, (res) => {
+        if (res && res.code == 200) {
+          this.courtNum = res.data[0].orgNo;
+          // this.orgName = [res.data[0].orgNo];
+          // this.orgList = res.data;
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    //根据计划下班级
+    queryGrade() {
+      this.$http.get(`/planOrg/findPlanGrade?planId=${this.planId}`, {}, (res) => {
+        if (res && res.code == 200) {
+          this.grade = res.data[0];
+          this.gradeList = res.data;
+          // this.orgName = [res.data[0].orgNo];
+          // this.orgList = res.data;
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    //下载报告
+    downloadFun() {
+      //判断当前选择是院还是届--还是班级
+      let params = {};
+      if (this.dimensionality == 0) {
+        //调用接口
+        params = {
+          planId: this.planId,
+          orgNo: this.courtNum,
+          flag: 0,
+        };
+      } else if (this.dimensionality == 1) {
+        //调用班级接口
+        params = {
+          planId: this.planId,
+          orgNo: this.courtNum,
+          flag: 1,
+          grade: this.grade,
+        };
+      } else if (this.dimensionality == 2) {
+        if (this.orgName.length == 0) {
+          this.$message.error("请选择班级");
+          return;
+        }
+        params = {
+          planId: this.planId,
+          orgNo: this.courtNum,
+          flag: 2,
+          classIds: this.orgName,
+        };
+      }
+      this.$http.post(`/plan/generate/report`, params, (res) => {
+        if (res && res.code == 200) {
+          debugger;
+          // this.grade = res.data[0];
+          // this.gradeList = res.data;
+          // this.orgName = [res.data[0].orgNo];
+          // this.orgList = res.data;
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+      //开始调用下载报告接口
+      // this.$http.postDown(`/plan/generate/report`,params, (res) => {
+      //   debugger;
+      //   if (res && res.code == 200) {
+      //     // this.orgName = [res.data[0].orgNo];
+      //     const { data, headers } = res;
+      //     const fileName = headers["content-disposition"].replace(
+      //       /\w+;filename=(.*)/,
+      //       "$1"
+      //     );
+      //     // 此处当返回json文件时需要先对data进行JSON.stringify处理,其他类型文件不用做处理
+      //     //const blob = new Blob([JSON.stringify(data)], ...)
+      //     const blob = new Blob([data], { type: headers["content-type"] });
+      //     let dom = document.createElement("a");
+      //     let url = window.URL.createObjectURL(blob);
+      //     dom.href = url;
+      //     dom.download = decodeURI(fileName);
+      //     dom.style.display = "none";
+      //     document.body.appendChild(dom);
+      //     dom.click();
+      //     dom.parentNode.removeChild(dom);
+      //     window.URL.revokeObjectURL(url);
+      //   } else {
+      //     this.$message.error(res.msg);
+      //   }
+      // });
+    },
+    //下载全部班级
+    downloadAllFun() {
+      //下载全部班级
+      //循环班级列表拿到
+      let params = {};
+      let orgNameList = [];
+      for (let i = 0; i < this.orgList.length; i++) {
+        orgNameList.push(this.orgList[i].orgNo);
+      }
+      params = {
+        planId: this.planId,
+        orgNo: this.courtNum,
+        flag: 2,
+        classIds: orgNameList,
+      };
+      debugger;
+      this.$http.post(`/plan/generate/report`, params, (res) => {
+        if (res && res.code == 200) {
+          debugger;
+          // this.grade = res.data[0];
+          // this.gradeList = res.data;
+          // this.orgName = [res.data[0].orgNo];
+          // this.orgList = res.data;
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    //组织架构选择--
+    getOrgList() {
+      this.$http.get(`/planOrg/findAllByPlanId?planId=${this.planId}`, {}, (res) => {
+        if (res && res.code == 200) {
+          // this.orgName = [res.data[0].orgNo];
+          this.orgList = res.data;
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    //下载标志
+    downloadButton(row) {
+      this.planId = row.id;
+      this.downloadVisible = true;
+      this.getOrgList();
+      this.queryCourt();
+      this.queryGrade();
+    },
     forMaPlan(val) {
       if (val.planStatus == "1") {
         return "未开始";
@@ -488,7 +742,10 @@ export default {
       this.$http.get(url, {}, (res) => {
         console.log(res);
         if (res && res.code == 200) {
+          console.log('----------');
           console.log(res.data.content);
+
+   
           this.tableData = res.data.content;
           this.total = res.data.totalElements;
         } else {