coys 2 年 前
コミット
dd1835caa6

+ 9 - 0
src/api/public.js

@@ -81,6 +81,15 @@ export function getDict(type){
     }
   })
 }
+//通过组织机构ID获取人员
+export function getOrgPeople(orgId){
+  return request({
+    url: `/system/user/getByOrgId/${orgId}`,
+    method: 'get',
+    
+  })
+}
+
 //
 // // 获取验证码
 // export function getCodeImg() {

+ 12 - 3
src/api/training.js

@@ -3,12 +3,21 @@ import request from '@/utils/request'
 
 
 // 获取任务列表
-export function gettrainingList(data) {
+export function gettrainingList(query) {
   return request({
     url: '/core/eduTask/list',
     
-    method: 'post',
-    data
+    method: 'get',
+    params:query
+  })
+}
+//获取任务登记详情
+export function gettrainingInfo(query) {
+  return request({
+    url: `/core/eduTask/${query}`,
+    
+    method: 'get',
+    
   })
 }
 

+ 59 - 14
src/components/checkPeople/index.vue

@@ -10,7 +10,7 @@
       placeholder="请选择人员"
       @click="show = true"
     />
-    <van-action-sheet v-model="show" position="bottom" title="选择人员">
+    <van-action-sheet class="bigsheetbox" v-model="show" position="bottom" title="选择人员">
       <van-row>
         <van-col span="24"
           ><van-field
@@ -52,32 +52,36 @@
         </van-col>
       </van-row>
 
-      
-
       <van-row>
         <van-col span="24">
           <van-checkbox-group v-model="result">
             <van-cell-group>
               <van-cell
-                v-for="(item, index) in peopleList"
+                v-for="(item) in peopleListCpoy"
                 clickable
-                :key="item"
-                :title="`复选框 ${item}`"
-                @click="toggle(index)"
+                :key="item.id"
+                :title="`${item.name}`"
+                
               >
                 <template #right-icon>
-                  <van-checkbox :name="item" ref="checkboxes" />
+                  <van-checkbox :name="item.id" ref="checkboxes" />
                 </template>
               </van-cell>
             </van-cell-group>
           </van-checkbox-group>
         </van-col>
       </van-row>
+      <van-row class="bottomdiv">
+        <van-col span="24">
+          <van-button class="btns" size="small" type="info" @click="submitHandler">确认</van-button>
+        </van-col>
+      </van-row>
     </van-action-sheet>
   </div>
 </template>
 <script>
 import { deptTreeList } from '@/api/toConsult.js'
+import { getOrgPeople } from '@/api/public.js'
 
 export default {
   name: 'SocAppIndex',
@@ -107,8 +111,9 @@ export default {
       loading: false,
       options: [], //机构列表
       result: [], //人员ID集合
-      searchVal:'',//搜索值
-      peopleList: ['a', 'b'], //人员列表
+      searchVal: '', //搜索值
+      peopleList: [], //人员列表
+      peopleListCpoy: [], //人员列表2
       orgName: '', //机构名称
       peoples: '' //人员列表
     }
@@ -123,6 +128,14 @@ export default {
     closeDialog() {
       this.showcascader = false
       this.orgName = this.value1
+      getOrgPeople(this.cascaderValue).then(res=>{
+        
+        let { code, data, msg } = res
+        if (code == 200) {
+          this.peopleList= data
+          this.peopleListCpoy= JSON.parse(JSON.stringify(this.peopleList))
+        }
+      })
     },
     //级联选择当前任意层级触发
     changeCascader(val) {
@@ -142,11 +155,32 @@ export default {
         }
       })
     },
-    onSearch(val){
-        console.log(val);
+    onSearch(val) {
+      console.log(val)
+     this.peopleListCpoy= this.peopleList.filter(item=>{
+        if(item.name.indexOf(val)!=-1){
+          return item
+        }
+      })
     },
-    onCancel(){
-
+    onCancel() {
+      this.searchVal=''
+      this.peopleListCpoy= this.peopleList
+    },
+    submitHandler(){
+      let list=[]
+      this.peopleListCpoy.filter(item=>{
+        this.result.forEach(r=>{
+          if(r==item.id){
+            list.push(item)
+          }
+        })
+      })
+      this.show=false
+      this.peoples=list.map(item=>item.name).join(',')
+      
+      // 抛出已选择人员信息
+      this.$emit('userList',list)
     }
   }
 }
@@ -155,6 +189,17 @@ export default {
 .van-action-sheet {
   min-height: 90%;
 }
+.btns {
+  width: 100%;
+}
+.bottomdiv {
+  width: 100%;
+  bottom: 0%;
+  position: fixed;
+}
+.bigsheetbox{
+  height: calc(100vh - 100px);
+}
 .line {
   width: 100%;
   height: 3px;

+ 18 - 0
src/utils/date.js

@@ -0,0 +1,18 @@
+export function newDateMonth(time) {
+  var date = new Date(time)
+  var y = date.getFullYear()
+  var m = date.getMonth() + 1
+  m = m < 10 ? '0' + m : m
+  var d = date.getDate()
+  d = d < 10 ? '0' + d : d
+  return y + '-' + m
+}
+export function newDateDay(time) {
+  var date = new Date(time)
+  var y = date.getFullYear()
+  var m = date.getMonth() + 1
+  m = m < 10 ? '0' + m : m
+  var d = date.getDate()
+  d = d < 10 ? '0' + d : d
+  return y + '-' + m+'-'+d
+}

+ 55 - 14
src/views/menu/training/components/addTraining.vue

@@ -4,18 +4,18 @@
     <van-form @submit="onSubmit" class="bigbox">
       <div class="mainItem">
         <div>标题</div>
-        <div>抚琴路支行</div>
+        <div>{{trainingData?.title}}</div>
       </div>
       <div class="mainItem">
         <div>单位名称</div>
-        <div>抚琴路支行</div>
+        <div>{{trainingData?.orgName}}</div>
       </div>
       <van-field
         readonly
         clickable
         required
         name="picker"
-        :value="form.value"
+        :value="form.typeText"
         label="培训类型"
         :rules="[{ required: true, message: '培训类型不能为空' }]"
         placeholder="请选择培训类型"
@@ -58,8 +58,8 @@
       <van-field
         required
         :rules="[{ required: true, message: '培训内容不能为空' }]"
-        v-model="username"
-        name="username"
+        v-model="form.content"
+        name="content"
         label="培训内容"
         type="textarea"
         row="2"
@@ -69,8 +69,8 @@
       <van-field
         required
         :rules="[{ required: true, message: '总结不能为空' }]"
-        v-model="username"
-        name="username"
+        v-model="form.note"
+        name="note"
         label="总结"
         type="textarea"
         row="3"
@@ -79,9 +79,9 @@
 
       <!-- 参与人员 -->
       <!-- 必填 -->
-      <CheckPeople></CheckPeople>
+      <CheckPeople @userList="userListHandler"></CheckPeople>
       <!-- 缺席人员 -->
-      <CheckPeople :inpitLabel="'缺席人员'"></CheckPeople>
+      <CheckPeople @userList="lackUserListHandler" :inpitLabel="'缺席人员'"></CheckPeople>
       <!-- 上传 -->
       <van-field readonly clickable name="uploader" label="上传图片">
         <template #input>
@@ -99,6 +99,8 @@
 import NavBar from '@/components/NavBar'
 import CheckPeople from '@/components/checkPeople/index.vue'
 import Upload from '@/components/upload/index.vue'
+import { gettrainingInfo } from '@/api/training.js'
+import { newDateDay } from '@/utils/date.js'
 import { Dialog } from 'vant'
 export default {
   name: 'SocAppAddTraining',
@@ -112,17 +114,32 @@ export default {
       username: '',
       password: '',
       form: {
-        value: '',
+        typeText: '',//培训类型
+        type: '',//培训value
+        content:'',//培训内容
+        note:'',//培训总结
+        taskUserList:[],//人员数组
         startDate: '', //开始时间
         endDate: '' //开始时间
       },
+      trainingData:{
+
+      },
       showPicker: false, //培训类型显示隐藏
       showStartDate: false, //开始时间显示隐藏
       showEndDate: false, //结束时间显示隐藏
       columns: ['每月安全培训教育', '专项安全培训教育']
     }
   },
-
+  created(){
+    //获取详情信息
+    gettrainingInfo(this.$route.params.id).then(res=>{
+      let { code, data, msg } = res
+        if (code == 200) {
+          this.trainingData= data
+        }
+    })
+  },
   mounted() {},
 
   methods: {
@@ -141,18 +158,42 @@ export default {
     },
     //培训类型确认
     onConfirm(val) {
-      this.form.value = val //培训类型赋值
+      this.form.typeText = val //培训类型赋值
+     
+      switch (val) {
+        case '每月安全培训教育':
+          this.form.type = '0'
+
+          break
+        case '专项安全培训教育':
+          this.form.type = '1'
+          break
+      }
       this.showPicker = false
     },
     //开始时间确认
     onConfirmDate(val) {
-      this.form.startDate = val
+      this.form.startDate = newDateDay(val)
+      
       this.showStartDate = false
     },
     //结束时间
     onConfirmEndDate(val) {
-      this.form.endDate = val
+      this.form.endDate = newDateDay(val)
       this.showEndDate = false
+    },
+    userListHandler(list){
+      list.forEach(item => {
+        item.type=1
+      });
+      this.taskUserList.concat(list)
+    },
+    lackUserListHandler(list){
+      list.forEach(item => {
+        item.type=2
+      });
+      this.taskUserList.concat(list)
+
     }
   }
 }

+ 94 - 67
src/views/menu/training/index.vue

@@ -28,7 +28,7 @@
     <van-row>
       <van-col span="12"
         ><van-field
-          v-model="statusValue"
+          v-model="fieldValue"
           is-link
           label-width="3em"
           clearable
@@ -36,7 +36,7 @@
           placeholder=""
           @click="showStatus = true"
         />
-        <van-popup v-model="typeStatus" round position="bottom">
+        <van-popup v-model="showStatus" round position="bottom">
           <van-picker
             title="状态"
             show-toolbar
@@ -71,7 +71,7 @@
     <van-row>
       <van-col span="18"
         ><van-field
-          v-model="typeValue"
+          v-model="typeName"
           is-link
           label-width="3em"
           clearable
@@ -84,7 +84,7 @@
             title="类型"
             show-toolbar
             :columns="typeColumns"
-            @confirm="onConfirm"
+            @confirm="onConfirmHandler"
             @cancel="onCancel"
             @change="onChange"
             :close-on-click-overlay="false"
@@ -97,61 +97,57 @@
       </van-col>
     </van-row>
     <!-- //卡片内容区域 -->
-    <van-panel title="每月例行培训学习" class="card" status="状态">
+    <van-panel :title="item.title" v-for="item in taskList" :key="item.id" class="card" status="状态">
       <template #header>
         <div class="titleClass">
-          <div class="title">每月例行培训学习</div>
+          <div class="title">{{ item.title }}</div>
           <div>
-            <van-button plain type="info" size="mini" @click="trainSign">培训登记</van-button>
-            <van-button plain type="info"  size="mini" @click="signature">签名</van-button>
+            <van-button plain type="info" v-if="item.status == 0" size="mini" @click="trainSign(item.id)"
+              >培训登记</van-button
+            >
+            <van-button plain type="info" v-if="item.status == 1" size="mini" @click="signature(item.id)"
+              >签名</van-button
+            >
           </div>
         </div>
       </template>
       <div class="mainItem">
         <div>单位名称</div>
-        <div>抚琴路支行</div>
+        <div>{{ item.orgName }}</div>
       </div>
       <div class="mainItem">
         <div>培训状态</div>
-        <div>待记录</div>
+        <div>{{ item.statusText }}</div>
       </div>
       <div class="mainItem">
         <div>培训类型</div>
-        <div>每月安全培训教育</div>
+        <div>{{ item.typeText }}</div>
       </div>
       <div class="mainItem">
         <div>培训时间</div>
-        <div>2023-05-01 18:33:12</div>
+        <div>{{ item.startDate }}</div>
       </div>
       <div class="mainItem">
         <div>签名情况</div>
-        <div class="condition" @click="signatureCondition">10/10</div>
+        <div class="condition" @click="signatureCondition">{{ item.signNums }}</div>
       </div>
     </van-panel>
     <!-- 卡片弹框 -->
     <van-dialog v-model="conditionShow" title="签名情况" show-cancel-button>
-        <div class="conditionCls">
-            <div class="title">
-                已签名人员(5人):
-            </div>
-            <div class="people">
-                张三,张三张三张三张三
-            </div>
-            <div class="title">
-                未签名人员(5人):
-            </div>
-            <div class="people">
-                张三,张三张三张三张三
-            </div>
-        </div>
+      <div class="conditionCls">
+        <div class="title">已签名人员(5人):</div>
+        <div class="people">张三,张三张三张三张三</div>
+        <div class="title">未签名人员(5人):</div>
+        <div class="people">张三,张三张三张三张三</div>
+      </div>
     </van-dialog>
   </div>
 </template>
 <script>
 import NavBar from '@/components/NavBar'
 import { Col, Row, Cascader, Dialog, DatetimePicker, Icon, Picker } from 'vant'
-import {  gettrainingList,  } from '@/api/training.js'
-import {  deptTreeList,  } from '@/api/toConsult.js'
+import { gettrainingList } from '@/api/training.js'
+import { deptTreeList } from '@/api/toConsult.js'
 import { Toast } from 'vant'
 export default {
   data() {
@@ -166,11 +162,14 @@ export default {
         value: 'id',
         children: 'children'
       },
+      taskList: [], //列表数据
       typeValue: '', //类型值
-      statusValue: '', //状态值
+      typeName: '', //类型名称
+      fieldValue: '', //状态值
       typeStatus: false, //类型显示隐藏
       showStatus: false, //状态显示隐藏
       showDate: false, //月份显示隐藏
+      fieldValue: '', //状态名称
       columns: ['待记录', '待签名', '已完成'], //状态数组
       typeColumns: ['每月安全培训教育', '专项安全培训教育'], //类型数组
       currentDate: '', //月份值
@@ -220,11 +219,13 @@ export default {
   methods: {
     //清空查询条件
     clearSearch() {
+      this.fieldValue = ''
       this.statusValue = ''
       this.cascaderValue = ''
       this.currentDate = ''
       this.typeValue = ''
-     
+      this.typeName = ''
+
       this.selectListAppHandler()
     },
 
@@ -240,25 +241,38 @@ export default {
       this.selectListAppHandler()
     },
     selectListAppHandler() {
+      let obj = {
+        isAppSelect: 1
+      }
+      
+      if (this.statusValue) {
+        obj.status = this.statusValue
+      }
+      if (this.cascaderValue) {
+        obj.orgId = this.cascaderValue
+      }
+      if (this.currentDate) {
+        obj.date = this.currentDate + '-01'
+      }
+      if (this.typeValue) {
+        obj.type = this.typeValue
+      }
+      
+      
       //获取任务列表
-      gettrainingList({
-        status: this.statusValue || null,
-        orgId: this.cascaderValue || null,
-        date: this.currentDate || null,
-        type: this.typeValue || null,
-      }).then(res => {
-        let { code, data, msg } = res
+      gettrainingList(obj).then(res => {
+        let { code, rows, msg } = res
         if (code == 200) {
-          this.taskList = data
+          this.taskList = rows
         }
       })
     },
 
     //关闭弹框事件
     closeDialog() {
-      this.show = false
       this.selectListAppHandler()
-      this.orgName=this.value1
+      this.show = false
+      this.orgName = this.value1
     },
     // 开始调阅事件
     startMonitorHandler(taskId) {
@@ -288,28 +302,42 @@ export default {
       this.fieldValue = value
 
       switch (value) {
-        case '待调阅':
-          this.str = '0'
+        case '待记录':
+          this.statusValue = '0'
 
           break
-        case '调阅中':
-          this.str = '1'
+        case '待签名':
+          this.statusValue = '1'
           break
 
-        case '已调阅':
-          this.str = '2'
+        case '已完成':
+          this.statusValue = '2'
           break
+      }
+      this.selectListAppHandler()
+      this.showStatus = false
+    },
+    //类型确认框
+    onConfirmHandler(value, index) {
+      this.typeName = value
+
+      switch (value) {
+        case '每月安全培训教育':
+          this.typeValue = '0'
 
-        case '已超期':
-          this.str = '3'
+          break
+        case '专项安全培训教育':
+          this.typeValue = '1'
           break
       }
+      console.log(this.typeValue)
       this.typeStatus = false
       this.selectListAppHandler()
     },
     //月份选中触发
     onDateConfirm() {
       this.currentDate = this.newDate(this.currentDate)
+
       this.showDate = false
       this.selectListAppHandler()
     },
@@ -321,19 +349,19 @@ export default {
       m = m < 10 ? '0' + m : m
       var d = date.getDate()
       d = d < 10 ? '0' + d : d
-      return y + '-' + m + '-' + d
+      return y + '-' + m
     },
     //查看签名情况
     signatureCondition() {
-        this.conditionShow=true
+      this.conditionShow = true
     },
     //培训登记跳转
-    trainSign(){
-        this.$router.push('/Addtraining/'+'1111')
+    trainSign(id) {
+      this.$router.push('/Addtraining/' + id)
     },
     //签名
-    signature(){
-        this.$router.push('/personnelSignature/'+'1111')
+    signature() {
+      this.$router.push('/personnelSignature/' + '1111')
     },
     onChange(picker, value, index) {},
     onCancel() {
@@ -382,17 +410,16 @@ export default {
     text-decoration: underline;
   }
 }
-.conditionCls{
-    .title{
-        color: #1989fa;
-        margin-left: 30px;
-        // margin-top: 30px;
-    }
-    .people{
-        margin-left: 80px;
-        margin-bottom: 30px;
-        margin-top: 30px
-    }
+.conditionCls {
+  .title {
+    color: #1989fa;
+    margin-left: 30px;
+    // margin-top: 30px;
+  }
+  .people {
+    margin-left: 80px;
+    margin-bottom: 30px;
+    margin-top: 30px;
+  }
 }
-
 </style>