Browse Source

Merge branch 'master' of http://git.cc-lotus.info/new_train/train-center

lrf402788946 5 years ago
parent
commit
395b1bd0eb

+ 3 - 0
src/views/home.vue

@@ -50,6 +50,7 @@ export default {
     ...count(['query']),
     async search() {
       let res = await this.query();
+
       // 柱状图
       //levelexit:退出;
       //levelqj:请假;
@@ -61,7 +62,9 @@ export default {
 
       //饼形图,哪个学校多少人
       //schstu:学校上报人数;
+
       if (this.$checkRes(res)) this.$set(this, `data`, res.data);
+
       this.loading = false;
     },
   },

+ 84 - 37
src/views/home/iscome.vue

@@ -1,24 +1,29 @@
 <template>
   <div id="iscome">
-    <div id="chartPie" style="height:350px;"></div>
+    <div id="chartPie" style="height:400px;"></div>
   </div>
 </template>
 
 <script>
 import _ from 'lodash';
-import echarts from 'echarts/lib/echarts';
-import 'echarts/lib/chart/pie';
-import 'echarts/lib/component/title';
-import 'echarts/lib/component/legend';
-import 'echarts/lib/component/toolbox';
-import 'echarts/lib/component/markPoint';
-import 'echarts/lib/component/tooltip';
+
+import { Ring } from '@antv/g2plot';
+// import echarts from 'echarts/lib/echarts';
+// import 'echarts/lib/chart/pie';
+// import 'echarts/lib/component/title';
+// import 'echarts/lib/component/legend';
+// import 'echarts/lib/component/toolbox';
+// import 'echarts/lib/component/markPoint';
+// import 'echarts/lib/component/tooltip';
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
   name: 'iscome',
   props: {
     istrain: { type: Number, default: 0 },
     nottrain: { type: Number, default: 0 },
+    // data: { type: [Object, Array], default: () => [] },
+    // axis: { type: Object, default: () => {} },
+    // gid: { type: String, default: `${new Date().getTime()}` },
   },
   components: {},
   data: function() {
@@ -32,38 +37,80 @@ export default {
     });
   },
   methods: {
-    init(type) {
-      this.myPie = echarts.init(document.getElementById('chartPie'));
-      const option = {
-        title: { text: '当前学生参加培训情况' },
-        tooltip: { trigger: 'item', formatter: '{a} <br/>{b} : {c} ({d}%)' },
-        legend: {
-          data: ['已参加培训', '未参加培训'],
+    init() {
+      const data = [
+        {
+          type: '已参加培训',
+          value: this.istrain,
+          itemStyle: { color: '#7cb5ec' },
         },
-        series: [
-          {
-            name: '统计',
-            label: {
-              show: true,
-              position: 'top',
-            },
-            type: 'pie',
-            data: [
-              { name: '已参加培训', value: this.istrain, itemStyle: { color: '#7cb5ec' } },
-              { name: '未参加培训', value: this.nottrain, itemStyle: { color: '#ffa94b' } },
-            ],
-            animationType: 'scale',
-          },
-        ],
-        toolbox: {
-          show: true,
-          feature: {
-            dataView: { readOnly: false },
-            saveAsImage: {},
+        {
+          type: '未参加培训',
+          value: this.nottrain,
+          itemStyle: { color: '#ffa94b' },
+        },
+      ];
+      const ringPlot = new Ring(document.getElementById('chartPie'), {
+        forceFit: true,
+        radius: 0.8,
+        data,
+        angleField: 'value',
+        colorField: 'type',
+        title: {
+          visible: true,
+          text: '当前学生参加培训情况',
+          style: {
+            fontSize: 30,
+            fill: 'black',
           },
         },
-      };
-      this.myPie.setOption(option);
+      });
+      ringPlot.render();
+      // const columnPlot = new Column(document.getElementById('container'), {
+      //   title: {
+      //     visible: true,
+      //     text: '图表标题及描述',
+      //   },
+      //   description: {
+      //     visible: true,
+      //     text: '这是一个关于配置图表标题和描述文本内容的demo',
+      //   },
+      //   data,
+      //   xField: 'year',
+      //   yField: 'value',
+      // });
+
+      //   this.myPie = echarts.init(document.getElementById('chartPie'));
+      //   const option = {
+      //     title: { text: '当前学生参加培训情况' },
+      //     tooltip: { trigger: 'item', formatter: '{a} <br/>{b} : {c} ({d}%)' },
+      //     legend: {
+      //       data: ['已参加培训', '未参加培训'],
+      //     },
+      //     series: [
+      //       {
+      //         name: '统计',
+      //         label: {
+      //           show: true,
+      //           position: 'top',
+      //         },
+      //         type: 'pie',
+      //         data: [
+      //           { name: '已参加培训', value: this.istrain, itemStyle: { color: '#7cb5ec' } },
+      //           { name: '未参加培训', value: this.nottrain, itemStyle: { color: '#ffa94b' } },
+      //         ],
+      //         animationType: 'scale',
+      //       },
+      //     ],
+      //     toolbox: {
+      //       show: true,
+      //       feature: {
+      //         dataView: { readOnly: false },
+      //         saveAsImage: {},
+      //       },
+      //     },
+      //   };
+      //   this.myPie.setOption(option);
     },
   },
   computed: {

+ 80 - 49
src/views/home/leave.vue

@@ -6,14 +6,7 @@
 
 <script>
 import _ from 'lodash';
-import echarts from 'echarts/lib/echarts';
-import 'echarts/lib/chart/line';
-import 'echarts/lib/chart/bar';
-import 'echarts/lib/component/title';
-import 'echarts/lib/component/legend';
-import 'echarts/lib/component/toolbox';
-import 'echarts/lib/component/markPoint';
-import 'echarts/lib/component/tooltip';
+import { Column } from '@antv/g2plot';
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
   name: 'leave',
@@ -34,53 +27,91 @@ export default {
   },
   methods: {
     init() {
-      const option = {
-        title: { text: '请假/退出统计' },
-        tooltip: { trigger: 'axis' },
-        legend: {
-          data: ['请假/退出统计'],
+      const data = [
+        {
+          type: '请假',
+          sales: this.qj,
         },
-        xAxis: {
-          boundaryGap: true,
-          // nameLocation: 'center',
-          data: ['请假', '退出'],
+        {
+          type: '退出',
+          sales: this.exit,
         },
-        yAxis: {},
-        series: [
-          {
-            name: '请假',
-            step: true,
-            label: {
-              show: true,
-              position: 'top',
-            },
-            type: 'bar',
-            data: [this.qj],
-            color: ['#333ceb'],
+      ];
+
+      const columnPlot = new Column(document.getElementById('chartLinebar'), {
+        title: {
+          visible: true,
+          text: '请假/退出统计',
+          style: {
+            fontSize: 30,
+            fill: 'black',
           },
-          {
-            name: '退出',
-            label: {
-              show: true,
-              position: 'top',
-            },
-            type: 'bar',
-            data: [this.exit],
-            color: ['#acaecce'],
+        },
+        forceFit: true,
+        data,
+        padding: 'auto',
+
+        xField: 'type',
+        yField: 'sales',
+        meta: {
+          type: {
+            alias: '类别',
           },
-        ],
-        toolbox: {
-          show: true,
-          feature: {
-            dataView: { readOnly: false },
-            saveAsImage: {},
-            restore: {},
-            // magicType: { type: ['bar'] },
+          sales: {
+            alias: '人数',
           },
         },
-      };
-      this.mychart = echarts.init(document.getElementById('chartLinebar'));
-      this.mychart.setOption(option);
+      });
+
+      columnPlot.render();
+
+      // const option = {
+      //   title: { text: '请假/退出统计' },
+      //   tooltip: { trigger: 'axis' },
+      //   legend: {
+      //     data: ['请假/退出统计'],
+      //   },
+      //   xAxis: {
+      //     boundaryGap: true,
+      //     // nameLocation: 'center',
+      //     data: ['请假', '退出'],
+      //   },
+      //   yAxis: {},
+      //   series: [
+      //     {
+      //       name: '请假',
+      //       step: true,
+      //       label: {
+      //         show: true,
+      //         position: 'top',
+      //       },
+      //       type: 'bar',
+      //       data: [this.qj],
+      //       color: ['#333ceb'],
+      //     },
+      //     {
+      //       name: '退出',
+      //       label: {
+      //         show: true,
+      //         position: 'top',
+      //       },
+      //       type: 'bar',
+      //       data: [this.exit],
+      //       color: ['#acaecce'],
+      //     },
+      //   ],
+      //   toolbox: {
+      //     show: true,
+      //     feature: {
+      //       dataView: { readOnly: false },
+      //       saveAsImage: {},
+      //       restore: {},
+      //       // magicType: { type: ['bar'] },
+      //     },
+      //   },
+      // };
+      // this.mychart = echarts.init(document.getElementById('chartLinebar'));
+      // this.mychart.setOption(option);
     },
   },
   computed: {

+ 52 - 37
src/views/home/school.vue

@@ -1,18 +1,12 @@
 <template>
   <div id="school">
-    <div id="schoolPie" style="height:350px;"></div>
+    <div id="schoolPie" style="height:400px;"></div>
   </div>
 </template>
 
 <script>
 import _ from 'lodash';
-import echarts from 'echarts/lib/echarts';
-import 'echarts/lib/chart/pie';
-import 'echarts/lib/component/title';
-import 'echarts/lib/component/legend';
-import 'echarts/lib/component/toolbox';
-import 'echarts/lib/component/markPoint';
-import 'echarts/lib/component/tooltip';
+import { Ring } from '@antv/g2plot';
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
   name: 'school',
@@ -31,38 +25,59 @@ export default {
     });
   },
   methods: {
-    init(type) {
-      let data = this.school.map(i => {
-        return { name: i.schname, value: i.schnum };
+    init() {
+      let datas = this.school.map(i => {
+        return { type: i.schname, value: i.schnum };
       });
-      this.myPie = echarts.init(document.getElementById('schoolPie'));
-      const option = {
-        title: { text: '学校上报统计' },
-        tooltip: { trigger: 'item', formatter: '{a} <br/>{b} : {c} ({d}%)' },
-        legend: {
-          data: data.map(i => i.name),
-        },
-        series: [
-          {
-            name: '统计',
-            label: {
-              show: true,
-              position: 'top',
-            },
-            type: 'pie',
-            data: data,
-            animationType: 'scale',
-          },
-        ],
-        toolbox: {
-          show: true,
-          feature: {
-            dataView: { readOnly: false },
-            saveAsImage: {},
+
+      console.log(datas);
+
+      const data = datas;
+      const ringPlot = new Ring(document.getElementById('schoolPie'), {
+        forceFit: true,
+        radius: 0.8,
+        data,
+        angleField: 'value',
+        colorField: 'type',
+        title: {
+          visible: true,
+          text: '学校上报统计',
+
+          style: {
+            fontSize: 30,
+            fill: 'black',
           },
         },
-      };
-      this.myPie.setOption(option);
+      });
+      ringPlot.render();
+      // this.myPie = echarts.init(document.getElementById('schoolPie'));
+      // const option = {
+      //   title: { text: '学校上报统计' },
+      //   tooltip: { trigger: 'item', formatter: '{a} <br/>{b} : {c} ({d}%)' },
+      //   legend: {
+      //     data: data.map(i => i.name),
+      //   },
+      //   series: [
+      //     {
+      //       name: '统计',
+      //       label: {
+      //         show: true,
+      //         position: 'top',
+      //       },
+      //       type: 'pie',
+      //       data: data,
+      //       animationType: 'scale',
+      //     },
+      //   ],
+      //   toolbox: {
+      //     show: true,
+      //     feature: {
+      //       dataView: { readOnly: false },
+      //       saveAsImage: {},
+      //     },
+      //   },
+      // };
+      // this.myPie.setOption(option);
     },
   },
   computed: {

+ 23 - 1
src/views/new-plan/arrange/school-num.vue

@@ -15,7 +15,7 @@
           <el-button type="primary" @click="handleSave" size="mini">保存人数安排</el-button>
         </el-col>
       </el-row>
-      <el-table :data="getList()" border stripe size="mini">
+      <el-table :data="getList()" border stripe size="mini" :summary-method="getSummaries" show-summary>
         <el-table-column align="center" label="学校" prop="name"></el-table-column>
         <el-table-column align="center" label="学校代码" prop="code"></el-table-column>
         <el-table-column align="center" label="就业人数">
@@ -210,6 +210,28 @@ export default {
       }
       return total;
     },
+    getSummaries() {
+      let numtotal = 0;
+      let jynumtotal = 0;
+      let cynumtotal = 0;
+      let mznumtotal = 0;
+      for (const _list of this.list) {
+        if (_list.num) {
+          numtotal = numtotal + Number(_list.num);
+        }
+        if (_list.jynum) {
+          jynumtotal = jynumtotal + _list.jynum;
+        }
+        if (_list.cynum) {
+          cynumtotal = cynumtotal + _list.cynum;
+        }
+        if (_list.mznum) {
+          mznumtotal = mznumtotal + _list.mznum;
+        }
+      }
+      let sums = ['合计', 'N/A', jynumtotal, cynumtotal, mznumtotal, numtotal];
+      return sums;
+    },
   },
   watch: {
     defaultOption: {

+ 34 - 1
src/views/student/index.vue

@@ -16,7 +16,19 @@
           <el-button type="primary" @click="search">查询</el-button>
         </el-form-item>
       </el-form>
-      <data-table :fields="fields" :data="list" :opera="opera" @turnClass="toTurnClass" @edit="toEdit" @delete="toDelete"></data-table>
+      <div style="margin: 20px 0 5px 0">
+        <el-button type="danger" size="mini" @click="batchdelete">批量删除</el-button>
+      </div>
+      <data-table
+        :fields="fields"
+        @handleSelect="handleSelect"
+        :select="true"
+        :data="list"
+        :opera="opera"
+        @turnClass="toTurnClass"
+        @edit="toEdit"
+        @delete="toDelete"
+      ></data-table>
     </list-frame>
     <el-dialog :visible.sync="dialog" title="转班" @close="toClose" width="30%">
       <data-form :data="studInfo" :fields="turnFields" :rules="{}" @save="turnSave">
@@ -95,6 +107,7 @@ export default {
     termList: [],
     total: 0,
     selectClassList: [],
+    batchdet: [],
   }),
   created() {
     this.getPlan();
@@ -111,6 +124,26 @@ export default {
         this.$set(this, `total`, res.total);
       }
     },
+    //批量选择
+    handleSelect(data) {
+      //取出data中id 作为一个新集合
+      let idlist = data.map(i => i.id);
+      this.$set(this, `batchdet`, idlist);
+    },
+    //批量删除
+    batchdelete() {
+      if (this.batchdet.length == 0) {
+        this.$message({
+          showClose: true,
+          message: '请选择要批量删除的信息',
+          type: 'warning',
+        });
+      } else {
+        //此处写方法
+        console.log('ccc');
+      }
+    },
+
     toEdit({ data }) {
       this.$router.push({ path: '/student/detail', query: { id: data.id } });
     },

+ 53 - 3
src/views/train-plan/bedroom.vue

@@ -12,6 +12,15 @@
     <detail-frame :title="classInfo.name" :returns="toReturns" v-if="view != 'list'">
       <el-table :data="stuBedroom" size="mini" border stripe>
         <el-table-column align="center" label="寝室号" prop="bedroom"></el-table-column>
+        <el-table-column align="center" label="楼层" prop="floor"></el-table-column>
+
+        <el-table-column prop="state" label="状态" align="center">
+          <template v-slot="scoped">
+            {{ `${scoped.row.status}` === `0` ? '启用' : `${scoped.row.status}` === `1` ? '停用' : '' }}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="男女限制" prop="gender"></el-table-column>
+        <el-table-column align="center" label="人数" prop="number"></el-table-column>
         <el-table-column align="center" label="学生">
           <template v-slot="{ row }">
             <el-row>
@@ -28,7 +37,7 @@
         <template #options="{item,form}">
           <template v-if="item.model == 'bedroom'">
             <template v-for="(i, index) in bedroomList">
-              <el-option :key="index" :label="`${i.code}`" :value="i.code"></el-option>
+              <el-option :key="index" :label="`${i.bedroom}`" :value="i.bedroom"></el-option>
             </template>
           </template>
         </template>
@@ -47,6 +56,7 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: classes } = createNamespacedHelpers('classes');
 const { mapActions: student } = createNamespacedHelpers('student');
 const { mapActions: bedroom } = createNamespacedHelpers('bedroom');
+const { mapActions: util } = createNamespacedHelpers('util');
 export default {
   name: 'bedroom',
   props: {},
@@ -84,7 +94,8 @@ export default {
   methods: {
     ...classes(['query']),
     ...student({ getStudentList: 'query', updateStudent: 'update' }),
-    ...bedroom({ bedroomApart: 'apart', getBedroomList: 'query' }),
+    ...bedroom({ bedroomApart: 'apart', getBedroomList: 'query', classstuList: 'classstuList' }),
+    ...util({ modelFetch: 'fetch' }),
     async search() {
       let termid = _.get(this.defaultOption, 'termid');
       if (!termid) return;
@@ -111,6 +122,26 @@ export default {
           o['list'] = mid[key];
           arr.push(o);
         }
+        let val = await this.getBedroomList({ status: '0', batch: this.classInfo.batch });
+        let bdrooms = [];
+        for (const bdroom of arr) {
+          var ref = val.data.filter(item => item.code == bdroom.bedroom);
+          bdrooms = [...bdrooms, ...ref];
+        }
+        arr.map(item2 => {
+          bdrooms.map(item1 => {
+            if (item2.bedroom == item1.code) {
+              let json = {
+                number: item1.number,
+                gender: item1.gender,
+                floor: item1.floor,
+                status: item1.status,
+              };
+              Object.assign(item2, json);
+              return item2;
+            }
+          });
+        });
         this.$set(this, `stuBedroom`, arr);
       }
     },
@@ -139,11 +170,30 @@ export default {
     async turnBedroom(data) {
       this.$set(this, `form`, data);
       let res = await this.getBedroomList({ status: '0', batch: this.classInfo.batch });
-      if (this.$checkRes(res)) this.$set(this, `bedroomList`, res.data);
+      // var bd1 = res.data.filter(item => item.gender == data.gender);
+      // var bd2 = res.data.filter(item => item.gender == '');
+      // let bdcont = bd1.concat(bd2);
+      var bd3 = this.stuBedroom.filter(item => item.gender == data.gender);
+      var bd2 = this.stuBedroom.filter(item => item.gender == '');
+      let bdcont = bd3.concat(bd2);
+      console.log(bdcont);
+      let r = this.stuBedroom.filter(item1 => {
+        return item1.list.every(item => item.gender == data.gender);
+      });
+      console.log(r);
+      let nums = _.intersection(bdcont, r);
+      console.log(nums);
+
+      this.$set(this, `bedroomList`, nums);
       this.dialog = true;
     },
     //转寝保存
     async turnSave({ data }) {
+      const bedroom = await this.modelFetch({ model: 'bedroom', code: data.bedroom });
+      data.bedroomid = bedroom.data.id;
+      // data.bedroom = bedroom.data.code;
+      console.log(data.bedroomid);
+      console.log(data);
       let res = await this.updateStudent(data);
       if (this.$checkRes(res, `转寝成功`, res.errmsg || `转寝失败`)) {
         this.getSL();