qq %!s(int64=3) %!d(string=hai) anos
pai
achega
0052e2c532
Modificáronse 1 ficheiros con 108 adicións e 69 borrados
  1. 108 69
      src/components/customer/push_err.vue

+ 108 - 69
src/components/customer/push_err.vue

@@ -51,10 +51,15 @@
             placeholder="请选择"
             style="width: 150px; margin-left: 5px"
           >
-            <el-option v-for="item,i in sour_list" :key="i+'j'" :label='item.name' :value="item.id"></el-option>
+            <el-option
+              v-for="(item, i) in sour_list"
+              :key="i + 'j'"
+              :label="item.name"
+              :value="item.id"
+            ></el-option>
           </el-select>
           <el-button @click="search">搜索</el-button>
-          <div class="promotion" @click="is_show=true">
+          <div class="promotion" @click="is_show = true,s_push=[],params.tid='',source=''">
             <span class="el-icon-s-promotion"></span> 推送错题
           </div>
         </div>
@@ -107,9 +112,9 @@
     </div>
     <!-- 推送错题 -->
     <div class="fit" v-show="is_show">
-       <div>
-          <div class="tit">错题推送</div>
-           <div class="form_box">
+      <div>
+        <div class="tit">错题推送</div>
+        <div class="form_box">
           <div>
             <span>班级</span>
             <el-select
@@ -136,44 +141,51 @@
               style="width: 100px"
               @change="sourceList"
             >
-                       <el-option value="exam" label="考试"></el-option>
-            <el-option value="work" label="作业"></el-option>
+              <el-option value="exam" label="考试"></el-option>
+              <el-option value="work" label="作业"></el-option>
             </el-select>
             <el-select
-              v-model="params.ly2"
+              v-model="params.tid"
               clearable
               placeholder="请选择"
               style="width: 220px; margin-left: 5px"
             >
-              <el-option v-for="item,i in sour_list" :key="i+'j'" :label='item.name' :value="item.id"></el-option>
+              <el-option
+                v-for="(item, i) in sour_list"
+                :key="i + 'j'"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
             </el-select>
           </div>
           <div>
             <span>学生</span>
             <div class="transfer_box">
-               <el-transfer
-    filterable
-    :filter-method="filterMethod"
-    filter-placeholder="请输入"
-    v-model="value"
-    :data="data">
-  </el-transfer>
+              <el-transfer
+                filterable
+                filter-placeholder="请输入"
+                :titles="['全选', '全选']"
+                v-model="value"
+                :data="data"
+                @change="handleChange"
+              >
+              </el-transfer>
             </div>
           </div>
-          <div>
+          <div style="margin-top: 40px">
             <span>备注</span>
             <el-input
               style="width: 325px"
-              v-model="params.l"
+              v-model="remark"
               placeholder="请输入"
             ></el-input>
           </div>
         </div>
-         <div class="btn">
-          <el-button @click="is_show = false">取消</el-button>
-          <el-button type="primary" @click="is_show = false">确认</el-button>
+        <div class="btn">
+          <el-button @click="is_show = false,params.tid='',source=''">取消</el-button>
+          <el-button type="primary" @click="sure_push">确认</el-button>
         </div>
-       </div>
+      </div>
     </div>
     <!-- <foot></foot> -->
   </div>
@@ -182,7 +194,7 @@
 import topNav from "@/components/assembly/topnav";
 import topHead from "@/components/assembly/head";
 import foot from "@/components/assembly/foot";
-import { searchClass, classes ,tasks} from "@/util/api";
+import { searchClass, classes, tasks,clsErrPost } from "@/util/api";
 export default {
   data() {
     return {
@@ -190,19 +202,18 @@ export default {
         page: 1,
         size: 10,
         cid: "",
-        tid:'',
+        tid: "",
       },
-        source: "", //来源
+      source: "", //来源
       sour_list: [],
-      is_show:false,
+      is_show: false,
       tableData: [],
       classL: [],
       total: 0,
-      value:'',
-      filterMethod(query, item) {
-          return item.pinyin.indexOf(query) > -1;
-        },
-      data:[],
+      value:[],
+      data: [],
+      s_push:[],
+      remark:'',
     };
   },
   created() {
@@ -213,28 +224,57 @@ export default {
         that.classL = res.data;
         that.params.cid = res.total > 0 ? res.data[0].id : "";
         that.getList();
-        searchClass({cid:that.params.cid}).then(res=>{
-          if(res.errcode==0){
+        searchClass({ cid: that.params.cid }).then((res) => {
+          if (res.errcode == 0) {
             var l = [];
-            res.data.forEach(item => {
+            res.data.forEach((item) => {
               var obj = {};
               obj.key = item.id;
               obj.label = item.name;
-              l.push(obj)
+              obj.label = item.name;
+              l.push(obj);
             });
             that.data = l;
-            console.log(that.data)
+            console.log(that.data);
           }
-        })
+        });
       }
     });
   },
   methods: {
+    //创建错题推送
+    sure_push(){
+      if(! this.s_push.length > 0 ){
+        this.$message.warning('请选择需要推送的学生');
+        return
+      }
+      if(! this.params.tid){
+        this.$message.warning('请选择来源');
+        return
+      }
+      var p = {};
+      p.cid = this.params.cid;
+      p.task_id = this.params.tid;
+      p.stu_ids = this.s_push;
+      this.remark?p.remark = this.remark:'';
+      clsErrPost(p).then(res=>{
+        if(res.errcode == 0){
+            this.is_show = false;
+            this.params.tid='';
+        }else{
+          this.$message.warning(res.mess);
+        }
+      })
+    },
+    //推送学生
+    handleChange(value, direction, movedKeys) {
+        this.s_push = movedKeys
+      },
     //来源
     sourceList(val) {
       var that = this,
         obj = {};
-      this.params.tid='';
+      this.params.tid = "";
       obj.mtype = val;
       tasks(obj).then((res) => {
         if (res.errcode == 0) {
@@ -248,12 +288,6 @@ export default {
       this.params.cid = i;
       this.getList();
     },
-    //重置
-    reset() {
-      this.params.page = 1;
-      this.params.cid = "";
-      this.getList();
-    },
     //搜索
     search() {
       this.params.page = 1;
@@ -270,22 +304,22 @@ export default {
     // },
     //获取列表
     getList() {
-      // const load = this.$loading({
-      //   lock: true,
-      //   text: "Loading",
-      //   spinner: "el-icon-loading",
-      //   background: "rgba(0, 0, 0, 0.7)",
-      // });
-      // var that = this;
-      // var obj = JSON.parse(JSON.stringify(this.params));
-      // searchClass(obj).then((res) => {
-        // if (res.errcode == 0) {
-        //   that.tableData = res.data;
-        //   that.total = res.total;
-        //   //关闭loading
-        //   load.close();
-        // }
-      // });
+      const load = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      var that = this;
+      var obj = JSON.parse(JSON.stringify(this.params));
+      searchClass(obj).then((res) => {
+      if (res.errcode == 0) {
+        that.tableData = res.data;
+        that.total = res.total;
+        //关闭loading
+        load.close();
+      }
+      });
     },
     jump(url) {
       this.$router.push(url);
@@ -466,6 +500,9 @@ export default {
 }
 </style>
 <style>
+.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label{
+  font-size: 14px;
+}
 .screen1 .el-select {
   width: 120px;
 }
@@ -485,30 +522,32 @@ export default {
   height: 276px;
   margin: 0 auto 40px auto;
 }
-.transfer_box .el-transfer{
+.transfer_box .el-transfer {
   display: flex;
   justify-content: space-between;
   width: 325px;
 }
-.transfer_box .el-input__prefix{
+.transfer_box .el-input__prefix {
   left: 2px;
 }
-.transfer_box .el-transfer-panel__filter{
+.transfer_box .el-transfer-panel__filter {
   margin: 10px;
 }
-.transfer_box .el-input--prefix .el-input__inner{
+.transfer_box .el-input--prefix .el-input__inner {
   padding-left: 30px;
 }
-.transfer_box .el-transfer-panel__filter .el-input__inner{
+.transfer_box .el-transfer-panel__filter .el-input__inner {
   height: 30px;
 }
-.transfer_box .el-transfer-panel{
+.transfer_box .el-transfer-panel {
   width: 155px;
 }
-.transfer_box .el-transfer__buttons{
+.transfer_box .el-transfer__buttons {
   position: absolute;
+  bottom: 130px;
+  left: 205px;
 }
-.transfer_box .el-transfer__buttons{
-  display: none;
+.transfer_box .el-button {
+  padding: 0;
 }
 </style>