coys vor 2 Jahren
Ursprung
Commit
4818e494a3

+ 17 - 0
src/api/training.js

@@ -21,6 +21,15 @@ export function gettrainingInfo(query) {
   })
 }
 //编辑任务登记
+export function signtrainingInfo(data) {
+  return request({
+    url: `/core/eduTask/sign`,
+    
+    method: 'post',
+    data
+  })
+}
+//任务签名
 export function edittrainingInfo(data) {
   return request({
     url: `/core/eduTask`,
@@ -29,6 +38,14 @@ export function edittrainingInfo(data) {
     data
   })
 }
+//获取签名情况
+export function getsignUserList(id) {
+  return request({
+    url: `/core/eduTask/signUserList/${id}`,
+    method: 'get',
+    
+  })
+}
 
 //新增调阅接口NFC||图片接口
 export function registration(data) {

+ 5 - 1
src/components/checkPeople/index.vue

@@ -5,7 +5,7 @@
       clickable
       name="datetimePicker"
       :value="peoples"
-      required
+      :required="isRequired"
       :label="inpitLabel"
       placeholder="请选择人员"
       @click="show = true"
@@ -86,6 +86,10 @@ import { getOrgPeople } from '@/api/public.js'
 export default {
   name: 'SocAppIndex',
   props: {
+    isRequired:{//是否必填
+      type:Boolean,
+      default:false
+    },
     inpitLabel: {
       type: String,
       default: '参与人员'

+ 1 - 0
src/components/upload/index.vue

@@ -98,6 +98,7 @@ export default {
         console.log(fileObj,'flie');
         let formData = new FormData();
         formData.append("file", fileObj.file);
+        
         upload(formData, "image").then((res) => {
           console.log( config,'222')
           /*上传成功*/

+ 16 - 3
src/components/writingPad/index.vue

@@ -10,6 +10,12 @@
       :lineColor="lineColor"
       :bgColor.sync="bgColor"
     />
+    <van-row>
+      <van-col span="24" class="btnGroup">
+        <van-button type="info" @click="handleReset">清除</van-button>
+        <van-button type="info" @click="handleGenerate">确定</van-button>
+      </van-col>
+    </van-row>
   </div>
 </template>
 <script>
@@ -40,14 +46,21 @@ export default {
         .generate()
         .then(res => {
           this.resultImg = res
-          this.$emit('resultImg',res)
+          
+          this.$emit('resultImg', res)
         })
         .catch(err => {
-            Dialog({message:'不能签名为空白'}) // 画布没有签字时会执行这里 'Not Signned'
+          Dialog({ message: '不能签名为空白' }) // 画布没有签字时会执行这里 'Not Signned'
         })
     }
   }
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.btnGroup {
+  display: flex;
+  margin-top: 20px;
+  justify-content: space-around;
+}
+</style>

+ 1 - 1
src/config/env.development.js

@@ -2,7 +2,7 @@
 module.exports = {
   title: 'soc-app-dev',
   baseUrl: 'http://localhost:9018', // 项目地址
-  baseApi: '/jwx', // 本地api请求地址,注意:如果你使用了代理,请设置成'/'
+  baseApi: '/yuanjingchao', // 本地api请求地址,注意:如果你使用了代理,请设置成'/'
   APPID: 'xxx',
   APPSECRET: 'xxx',
   $cdn: 'https://www.sunniejs.cn/static'  //静态资源

+ 4 - 4
src/views/menu/monitoringCall/components/consultInfo.vue

@@ -20,7 +20,7 @@
       </div>
 
       <!-- 底部按钮 -->
-      <div class="bottomClass">
+      <div class="bottomClass" v-if="this.$route.params.id.split('_')[1]!=2">
         <van-row>
           <van-col span="24">
             <van-button type="info" @click="addInfoHandler">添加调阅记录</van-button>
@@ -65,7 +65,7 @@ export default {
   methods: {
     //项目初始化获取数据
     init() {
-      registrationList({ taskId: this.$route.params.id }).then(res => {
+      registrationList({ taskId: this.$route.params.id.split('_')[0] }).then(res => {
         let { code, data, msg } = res
         if (code == 200) {
           this.taskData = data
@@ -74,12 +74,12 @@ export default {
     },
     addInfoHandler() {
       console.log(this.taskData)
-      this.$router.push('/addInfo/' + this.$route.params.id + '_' + this.taskData.id + '_add')
+      this.$router.push('/addInfo/' + this.$route.params.id.split('_')[0] + '_' + this.taskData.id + '_add')
     },
     //结束调阅
     endMontor() {
       let startDate = JSON.parse(JSON.stringify(this.taskData.taskStartTime))
-      console.log(startDate)
+      
       startDate = Date.parse(new Date(startDate))
       let endDate = Date.parse(new Date())
       if (endDate - startDate <= 3600000) {

+ 152 - 67
src/views/menu/monitoringCall/index.vue

@@ -3,7 +3,15 @@
     <NavBar />
     <van-row>
       <van-col span="24"
-        ><van-field v-model="value1" is-link  label-width="3em"  clearable  label="机构" placeholder="" @click="show = true" />
+        ><van-field
+          v-model="value1"
+          is-link
+          label-width="3em"
+          clearable
+          label="机构"
+          placeholder=""
+          @click="show = true"
+        />
         <van-popup v-model="show" round position="bottom" :close-on-click-overlay="false">
           <van-cascader
             v-model="cascaderValue"
@@ -19,7 +27,13 @@
     </van-row>
     <van-row>
       <van-col span="9"
-        ><van-field v-model="fieldValue" label-width="3em" clearable  label="状态" placeholder="" @click="showStatus = true" />
+        ><van-field
+          v-model="fieldValue"
+          label-width="3em"
+          clearable
+          label="状态"
+          placeholder=""
+          @click="showStatus = true" />
         <van-popup v-model="showStatus" round position="bottom">
           <van-picker
             title="调阅状态"
@@ -32,9 +46,22 @@
           /> </van-popup
       ></van-col>
       <van-col span="9">
-        <van-field v-model="currentDate" clearable label-width="3em"  label="月份" placeholder="" @click="showDate = true" />
+        <van-field
+          v-model="currentDate"
+          clearable
+          label-width="3em"
+          label="月份"
+          placeholder=""
+          @click="showDate = true"
+        />
         <van-popup v-model="showDate" round position="bottom">
-          <van-datetime-picker v-model="currentDate" @cancel="onCancel" @confirm="onDateConfirm"  type="year-month" title="月份" />
+          <van-datetime-picker
+            v-model="currentDate"
+            @cancel="onCancel"
+            @confirm="onDateConfirm"
+            type="year-month"
+            title="月份"
+          />
         </van-popup>
       </van-col>
       <van-col span="6" class="btnf_box">
@@ -43,20 +70,32 @@
     </van-row>
     <!-- 调阅列表 -->
     <div class="bigbox">
-    <div class="topBox" @click="endMonitorHandler(item.status, item.id)" v-for="item in taskList" :key="item.id">
-      <div class="sonLeftBox">
-        <!-- 待调阅按钮 -->
-        <p>
-          <span :class="monitor[item.status]">{{ item.status | statusFilter }}</span>
-        </p>
-        <h3 class="title">{{ item.taskName }}</h3>
-        <p class="time">开始时间:{{ item.planStartTime }}</p>
-        <p class="time">结束时间:{{ item.planEndTime }}</p>
-      </div>
-      <div class="startMonitor" v-if="item.status == 0" @click="startMonitorHandler(item.id)">开始调阅</div>
-      <div class="endMonitor" v-else @click="lookInfoHandler(item.id)"><van-icon name="arrow" /></div>
+      <van-panel :title="item.title" v-for="item in taskList" :key="item.id" class="card" status="状态">
+        <template #header>
+          <div class="titleClass">
+            <div class="title">
+              {{ item.taskName }} <span :class="monitor[item.status]">{{ item.status | statusFilter }}</span>
+            </div>
+            <div>
+              <van-button type="info" size="small" v-if="item.status == 0" @click="startMonitorHandler(item.id)"
+                >开始调阅</van-button
+              >
+              <van-button type="info" size="small" v-else @click="lookInfoHandler(item.id, item.status)"
+                ><van-icon name="arrow"
+              /></van-button>
+            </div>
+          </div>
+        </template>
+        <div class="mainItem">
+          <div>开始时间:</div>
+          <div class="date">{{ item.planStartTime }}</div>
+        </div>
+        <div class="mainItem">
+          <div>结束时间:</div>
+          <div class="date">{{ item.planEndTime }}</div>
+        </div>
+      </van-panel>
     </div>
-  </div>
 
     <!-- 扫描弹框 -->
     <van-dialog v-model="showDialog" title="" width="" :showConfirmButton="false">
@@ -92,7 +131,7 @@ export default {
     return {
       str: '',
       fieldValue: '',
-      monitor: ['monitor', 'monitored', 'monitoring', 'ccc'], //状态样式
+      monitor: ['monitor', 'monitored', 'monitoring'], //状态样式
       value1: '', //输入框model
       currentDate: '',
       cascaderValue: '',
@@ -151,12 +190,12 @@ export default {
   },
   methods: {
     //清空查询条件
-    clearSearch(){
-      this.str=''
-      this.cascaderValue=''
-      this.value1=''
-      this.currentDate=''
-      this.fieldValue=''
+    clearSearch() {
+      this.str = ''
+      this.cascaderValue = ''
+      this.value1 = ''
+      this.currentDate = ''
+      this.fieldValue = ''
       this.selectListAppHandler()
     },
 
@@ -170,20 +209,19 @@ export default {
         }
       })
       this.selectListAppHandler()
-
     },
-    selectListAppHandler(){
+    selectListAppHandler() {
       //获取任务列表
       selectListApp({
-          status: this.str||'',
-          orgId: this.cascaderValue||'',
-          moth: this.currentDate||''
-        }).then(res => {
-          let { code, data, msg } = res
-          if (code == 200) {
-            this.taskList = data
-          }
-        })
+        status: this.str || '',
+        orgId: this.cascaderValue || '',
+        moth: this.currentDate || ''
+      }).then(res => {
+        let { code, data, msg } = res
+        if (code == 200) {
+          this.taskList = data
+        }
+      })
     },
 
     //扫描NFC
@@ -225,17 +263,17 @@ export default {
       this.taskId = taskId
       this.showDialog = true
     },
-    //已调阅事件
-    endMonitorHandler(status, taskId) {
-      // 0待调阅,1调阅中,2已调阅,3已超期
-      //跳转详情
-      if (status <= 1) return
-      this.$router.push('/consultInfo/' + taskId)
-    },
+    // //已调阅事件
+    // endMonitorHandler(status, taskId) {
+    //   // 0待调阅,1调阅中,2已调阅,3已超期
+    //   //跳转详情
+    //   if (status <= 1) return
+    //   this.$router.push('/consultInfo/' + taskId+'_d')
+    // },
     //查看调阅详情
-    lookInfoHandler(taskId) {
+    lookInfoHandler(taskId, status) {
       this.taskId = taskId
-      this.$router.push('/consultInfo/' + taskId)
+      this.$router.push('/consultInfo/' + taskId + '_' + status)
     },
     //级联选择当前任意层级触发
     changeCascader(val) {
@@ -272,26 +310,26 @@ export default {
       this.selectListAppHandler()
     },
     //月份选中触发
-    onDateConfirm(){
-      this.currentDate=this.newDate(this.currentDate)
+    onDateConfirm() {
+      this.currentDate = this.newDate(this.currentDate)
       this.showDate = false
       this.selectListAppHandler()
     },
     //日期转换
     newDate(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
+      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
     },
     onChange(picker, value, index) {},
     onCancel() {
-      this.show=false
-      this.showStatus=false
-      this.showDate=false
+      this.show = false
+      this.showStatus = false
+      this.showDate = false
     }
   }
 }
@@ -305,26 +343,41 @@ export default {
   .sonLeftBox {
     padding: 10px;
     flex: 1;
-    background-color: #f5f5f9;
+    background-color: #fff;
   }
 }
 .monitor {
   color: white;
-  padding: 10px;
+  padding-left: 10px;
+  padding-right: 10px;
+  font-size: 20px;
+  bottom: 5%;
+  right: 2%;
+  position: absolute;
   border-radius: 10px;
   background-color: #8cb585;
 }
 .monitored {
   color: white;
-  padding: 10px;
+  padding-left: 10px;
+  padding-right: 10px;
+  bottom: 5%;
+  right: 2%;
+  position: absolute;
+  font-size: 20px;
   border-radius: 10px;
-  background-color:#da0000;
+  background-color: #da0000;
 }
 .monitoring {
   color: white;
-  padding: 10px;
+  padding-left: 10px;
+  padding-right: 10px;
+  bottom: 5%;
+  right: 2%;
+  position: absolute;
+  font-size: 20px;
   border-radius: 10px;
-  background-color:#25da0b;
+  background-color: #25da0b;
 }
 .title {
   margin: 10px;
@@ -376,7 +429,7 @@ export default {
     }
   }
 }
-.btnf_box{
+.btnf_box {
   background-color: #fff;
 }
 .van-dialog {
@@ -390,14 +443,46 @@ export default {
     height: 50px;
   }
 }
-.btn{
+.btn {
   float: right;
-  margin-top:24px;
+  margin-top: 24px;
   margin-right: 20px;
   box-sizing: border-box;
 }
-.bigbox{
-  height:calc(100vh - 300px);
+.bigbox {
+  height: calc(100vh - 300px);
   background-color: #fff;
 }
+.card {
+  margin: 20px;
+  margin-bottom: 0px;
+  box-shadow: 0 8px 12px #ebedf0;
+}
+.titleClass {
+  display: flex;
+  align-items: center;
+  height: 100%;
+  padding: 20px;
+  border-bottom: 1px solid #ccc;
+
+  .title {
+    font-size: 30px;
+    font-weight: bold;
+    flex: 1;
+    line-height: 50px;
+  }
+}
+.mainItem {
+  display: flex;
+  font-size: 28px;
+  padding: 20px;
+  justify-content: revert;
+  .date {
+    margin-left: 30px;
+  }
+  .condition {
+    color: #1989fa;
+    text-decoration: underline;
+  }
+}
 </style>

+ 101 - 66
src/views/menu/training/components/addTraining.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
     <NavBar />
-    <van-form  class="bigbox" ref="form" >
+    <van-form class="bigbox" ref="form">
       <div class="mainItem">
         <div>标题</div>
-        <div>{{trainingData?.title}}</div>
+        <div>{{ trainingData?.title }}</div>
       </div>
       <div class="mainItem">
         <div>单位名称</div>
-        <div>{{trainingData?.orgName}}</div>
+        <div>{{ trainingData?.orgName }}</div>
       </div>
       <van-field
         readonly
@@ -79,18 +79,18 @@
 
       <!-- 参与人员 -->
       <!-- 必填 -->
-      <CheckPeople @userList="userListHandler"></CheckPeople>
+      <CheckPeople :isRequired="true" @userList="userListHandler"></CheckPeople>
       <!-- 缺席人员 -->
       <CheckPeople @userList="lackUserListHandler" :inpitLabel="'缺席人员'"></CheckPeople>
       <!-- 上传 -->
       <van-field readonly clickable name="uploader" label="上传图片">
         <template #input>
-          <Upload @input="listHandler"></Upload>
+          <Upload v-model="form.imageList"></Upload>
         </template>
       </van-field>
       <div class="btns">
-        <van-button type="info" >保存</van-button>
-        <van-button type="info"  @click="submitHandler">提交</van-button>
+        <van-button type="info" @click="submitHandler(1)">保存</van-button>
+        <van-button type="info" @click="submitHandler(2)">提交</van-button>
       </div>
     </van-form>
   </div>
@@ -99,7 +99,7 @@
 import NavBar from '@/components/NavBar'
 import CheckPeople from '@/components/checkPeople/index.vue'
 import Upload from '@/components/upload/index.vue'
-import { gettrainingInfo,edittrainingInfo } from '@/api/training.js'
+import { gettrainingInfo, edittrainingInfo } from '@/api/training.js'
 import { newDateTime } from '@/utils/date.js'
 import { Dialog, Toast } from 'vant'
 export default {
@@ -111,36 +111,42 @@ export default {
   },
   data() {
     return {
+      falg: false, //校验是否通过
       username: '',
       password: '',
       form: {
-        typeText: '',//培训类型
-        type: '',//培训value
-        content:'',//培训内容
-        note:'',//培训总结
-        taskUserList:[],//人员数组
-        imageList:[],//图片数组
+        typeText: '', //培训类型
+        type: '', //培训value
+        content: '', //培训内容
+        note: '', //培训总结
+        taskUserList: [], //人员数组
+        imageList: [], //图片数组
         trainingStartDateTime: '', //开始时间
-        trainingEndDateTime: '' //开始时间
+        trainingEndDateTime: '' //结束时间
       },
-      trainingData:{
-
-      },
-      userPeopleList:[],//参与人员数组
-      lackPeopleList:[],//缺席人员数组
+      trainingData: {},
+      userPeopleList: [], //参与人员数组
+      lackPeopleList: [], //缺席人员数组
       showPicker: false, //培训类型显示隐藏
       showStartDate: false, //开始时间显示隐藏
       showEndDate: false, //结束时间显示隐藏
       columns: ['每月安全培训教育', '专项安全培训教育']
     }
   },
-  created(){
+  created() {
     //获取详情信息
-    gettrainingInfo(this.$route.params.id).then(res=>{
+    gettrainingInfo(this.$route.params.id).then(res => {
       let { code, data, msg } = res
-        if (code == 200) {
-          this.trainingData= data
+      if (code == 200) {
+        this.trainingData = data
+        if(!data.taskUserList){
+          data.taskUserList=[]
+        }
+        if(!data.imageList){
+          data.imageList=[]
         }
+        Object.assign(this.form, data)
+      }
     })
   },
   mounted() {},
@@ -162,7 +168,7 @@ export default {
     //培训类型确认
     onConfirm(val) {
       this.form.typeText = val //培训类型赋值
-     
+
       switch (val) {
         case '每月安全培训教育':
           this.form.type = '0'
@@ -177,7 +183,7 @@ export default {
     //开始时间确认
     onConfirmDate(val) {
       this.form.trainingStartDateTime = newDateTime(val)
-      
+
       this.showStartDate = false
     },
     //结束时间
@@ -185,63 +191,92 @@ export default {
       this.form.trainingEndDateTime = newDateTime(val)
       this.showEndDate = false
     },
-    userListHandler(list){
+    userListHandler(list) {
       list.forEach(item => {
-        item.type=1,
-        item.userId=item.id
-        item.userName=item.username
+        ;(item.type = 1), (item.userId = item.id)
+        item.userName = item.username
         delete item.username
-      });
-      
-      this.userPeopleList=(list)
+      })
+
+      this.userPeopleList = list
     },
-    lackUserListHandler(list){
+    lackUserListHandler(list) {
       list.forEach(item => {
-        item.type=2
-        item.userId=item.id,
-        item.userName=item.username
+        item.type = 2
+        ;(item.userId = item.id), (item.userName = item.username)
         delete item.username
-      });
-      
-      this.lackPeopleList=(list)
+      })
 
+      this.lackPeopleList = list
     },
     //上传附件成功
-    listHandler(list){
-      
-      console.log(list,'ssss');
-      this.form.imageList.push(list)
+    listHandler(list) {},
+    //表单提交前校验
+    beforSubmitV() {
+      this.falg = false
+      let startDate = JSON.parse(JSON.stringify(this.form.trainingStartDateTime))
+      startDate = Date.parse(new Date(startDate))
+
+      let endDate = JSON.parse(JSON.stringify(this.form.trainingEndDateTime))
+      endDate = Date.parse(new Date(endDate))
+      if(startDate>endDate){
+        Toast('开始时间不能大于结束时间')
+        this.falg = true
+        return
+      }
+
+      if (this.form.imageList.length==0) {
+        Toast('上传图片不能为空')
+        this.falg = true
+        return
+      }
+      if (this.userPeopleList.length==0) {
+        Toast('参与人员不能为空!')
+        this.falg = true
+        return
+      }
     },
-   
-    //表单提交
-    submitHandler(){
-      this.$refs.form.validate().then(()=>{
-        Dialog.confirm({
+    //表单提交校验
+    submitHandler(type) {
+      Dialog.confirm({
         title: '',
-        message: '是否提交培训数据?'
+        message: `是否${type === 2 ? '提交' : '保存'}培训数据?`
       })
         .then(() => {
-          let obj=JSON.parse(JSON.stringify(this.form))
-          obj.imageList=obj.imageList.join(',')
-          // obj.trainingStartDateTime=obj.trainingStartDateTime+' 00:00:00'
-          obj.taskUserList.push(...this.userPeopleList,...this.lackPeopleList)
-          edittrainingInfo({
-            id:this.trainingData.id,
-            type:this.trainingData.type,
-            submitType:2,
-            ...obj
-          }).then(res=>{
-            let { code ,msg}=res
-            Toast('登记成功')
-            this.$router.push('/training')
-          })
+          this.beforSubmitV()//校验
+          if (!this.falg) {//校验通过触发
+            
+            if (type === 1) {
+              //type 1保存2提交
+              this.submitHandlerConfirm(type)
+            } else {
+              this.$refs.form.validate().then(() => {
+                this.submitHandlerConfirm(type)
+              })
+            }
+          }
         })
         .catch(() => {
           // on cancel
         })
+    },
+    // 表单提交
+    submitHandlerConfirm(type) {
+      let obj = JSON.parse(JSON.stringify(this.form))
+      obj.imageList = obj.imageList.map(item => item.url).join(',')
+
+      obj.taskUserList.push(...this.userPeopleList, ...this.lackPeopleList)
+      edittrainingInfo({
+        id: this.trainingData.id,
+        type: this.trainingData.type,
+        submitType: type,
+        submitType: 2,
+        ...obj
+      }).then(res => {
+        let { code, msg } = res
+        Toast('登记成功')
+        this.$router.push('/training')
       })
-      
-      
     }
   }
 }

+ 74 - 34
src/views/menu/training/components/personnelSignature.vue

@@ -4,68 +4,68 @@
 
     <div class="mainItem">
       <div>标题</div>
-      <div>{{trainingData}}</div>
+      <div>{{ trainingData?.title }}</div>
     </div>
     <div class="mainItem">
       <div>单位名称</div>
-      <div>抚琴路支行</div>
+      <div>{{ trainingData?.orgName }}</div>
     </div>
     <div class="mainItem">
       <div>培训类型</div>
-      <div>抚琴路支行</div>
+      <div>{{ trainingData?.typeText }}</div>
     </div>
     <div class="mainItem">
       <div>培训开始时间</div>
-      <div>抚琴路支行</div>
+      <div>{{ trainingData?.trainingStartDateTime }}</div>
     </div>
     <div class="mainItem">
       <div>培训结束时间</div>
-      <div>抚琴路支行</div>
+      <div>{{ trainingData?.trainingEndDateTime }}</div>
     </div>
     <div class="mainItem">
       <div>主持人</div>
-      <div>抚琴路支行</div>
+      <div>{{ trainingData?.hostName }}</div>
     </div>
     <div class="mainItem">
       <div>培训内容</div>
-      <div>抚琴路支行</div>
+      <div>{{ trainingData?.content }}</div>
     </div>
     <div class="mainItem">
       <div>总结</div>
-      <div>抚琴路支行</div>
+      <div>{{ trainingData?.note }}</div>
     </div>
     <div class="mainItem">
       <div>参与人员</div>
-      <div>抚琴路支行</div>
+      <div>{{ taskUserList }}</div>
     </div>
     <div class="mainItem">
       <div>缺席人员</div>
-      <div>抚琴路支行</div>
+      <div>{{ qsUserList }}</div>
     </div>
     <div class="mainItem">
       <div>上传图片</div>
+      <van-image width="100" v-for="item in imgList" :key="item" height="100" :src="item" />
+    </div>
+    <div class="mainItem" v-if="this.$route.params.id.split('_')[1]==='info'">
+      <div>参与人员签名图片</div>
+      <van-image width="100" v-for="item in signUserList" :key="item" height="100" :src="item.signImage" />
     </div>
     <van-row>
       <van-col span="24" class="btns">
-        <van-button type="info" class="btn" @click="signatureHandler">签名</van-button>
+        <van-button type="info" class="btn" v-if="this.$route.params.id.split('_')[1]==='edit'" @click="signatureHandler">签名</van-button>
       </van-col>
     </van-row>
     <van-action-sheet v-model="show" title="签属名字" class="sheet">
       <writingPad ref="esign" @resultImg="resultImg"></writingPad>
-      <van-row>
-        <van-col span="24" class="btnGroup">
-          <van-button type="info" @click="clearHandler">清除</van-button>
-          <van-button type="info" @click="submitHandler">确定</van-button>
-        </van-col>
-      </van-row>
     </van-action-sheet>
   </div>
 </template>
 <script>
 import NavBar from '@/components/NavBar'
 import writingPad from '@/components/writingPad/index.vue'
-import { gettrainingInfo } from '@/api/training.js'
-
+import { gettrainingInfo,signtrainingInfo } from '@/api/training.js'
+import { upload } from '@/api/public'
+import config from '@/config/index';
 export default {
   name: 'SocAppAddTraining',
   components: {
@@ -75,16 +75,34 @@ export default {
   data() {
     return {
       show: false,
-      trainingData:{},//详情数据
+      taskUserList: [], //参与人员
+      qsUserList: [], //缺席人员
+      imgList: [], //图片数组
+      signUserList: [], //参与人员签名数组
+      trainingData: {} //详情数据
     }
   },
-  created(){
-     //获取详情信息
-     gettrainingInfo(this.$route.params.id).then(res=>{
+  created() {
+    //获取详情信息
+    gettrainingInfo(this.$route.params.id.split('_')[0]).then(res => {
       let { code, data, msg } = res
-        if (code == 200) {
-          this.trainingData= data
-        }
+      if (code == 200) {
+        this.trainingData = data
+        this.trainingData?.taskUserList?.map(item => {
+          if (item.type == 1) {
+            this.taskUserList.push(item.userName)
+          }
+        })
+        this.taskUserList = this.taskUserList.join(',')
+        this.trainingData?.taskUserList?.map(item => {
+          if (item.type == 2) {
+            this.qsUserList.push(item.userName)
+          }
+        })
+        this.qsUserList = this.qsUserList.join(',')
+        this.signUserList=data.taskUserList
+        this.imgList = this.trainingData.imageList.split(',')
+      }
     })
   },
   mounted() {},
@@ -97,10 +115,28 @@ export default {
       this.$refs.esign.handleReset()
     },
     submitHandler() {
-      this.$refs.esign.handleGenerate()
+      console.log(this.file)
     },
+    //上传签名图到服务器
     resultImg(img) {
-      console.log(this.base64ToBlob(img));
+      let obj = this.base64ToBlob(img)
+      let formData = new FormData()
+      
+      obj.name = '签名.jpg'
+      formData.append('file', this.base64ToBlob(img))
+      
+      upload(formData, 'image')
+        .then(res => {
+          console.log(process.env.NODE_ENV);
+          /*上传成功*/
+          let imgUrl = process.env.NODE_ENV === 'development' ? config.baseUrl + res.data.url : window.origin + res.data.url
+         this.submitSign(imgUrl)
+          
+          // this.$emit("imgUrl", res.data.url);
+        })
+        .catch(err => {
+          /*上传失败*/
+        })
     },
     //base64转Blob
     base64ToBlob(base64, type) {
@@ -111,7 +147,16 @@ export default {
         u8arr[n] = bstr.charCodeAt(n)
       }
       // return new Blob([u8arr], { type: type || '' })
-      return new Blob([u8arr], { type: type || '' })
+      return new Blob([u8arr], { type: type || 'image/jpeg' })
+    },
+    //提交到后端数据
+    submitSign(url){
+      signtrainingInfo({
+        id:this.trainingData.id,
+        signImage:url,
+      }).then(res=>{
+        this.$router.push('/training')
+      })
     }
   }
 }
@@ -134,9 +179,4 @@ export default {
 .sheet {
   height: 60%;
 }
-.btnGroup {
-  display: flex;
-  margin-top: 20px;
-  justify-content: space-around;
-}
 </style>

+ 42 - 12
src/views/menu/training/index.vue

@@ -97,7 +97,7 @@
       </van-col>
     </van-row>
     <!-- //卡片内容区域 -->
-    <van-panel :title="item.title" v-for="item in taskList" :key="item.id" class="card" status="状态">
+    <van-panel :title="item.title" @click="goInfo(item.id)" v-for="item in taskList" :key="item.id" class="card" status="状态">
       <template #header>
         <div class="titleClass">
           <div class="title">{{ item.title }}</div>
@@ -129,16 +129,16 @@
       </div>
       <div class="mainItem">
         <div>签名情况</div>
-        <div class="condition" @click="signatureCondition">{{ item.signNums }}</div>
+        <div class="condition" @click="signatureCondition(item.id)">{{ 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 class="title">已签名人员({{participationList.num}}人):</div>
+        <div class="people">{{ participationList.list }}</div>
+        <div class="title">未签名人员({{absenceList.num}}人):</div>
+        <div class="people">{{ absenceList.list }}</div>
       </div>
     </van-dialog>
   </div>
@@ -146,12 +146,22 @@
 <script>
 import NavBar from '@/components/NavBar'
 import { Col, Row, Cascader, Dialog, DatetimePicker, Icon, Picker } from 'vant'
-import { gettrainingList } from '@/api/training.js'
+import { gettrainingList, getsignUserList } from '@/api/training.js'
 import { deptTreeList } from '@/api/toConsult.js'
 import { Toast } from 'vant'
 export default {
   data() {
     return {
+      participationList: {
+        list: [], // 参与人员
+        num: 0 //人数
+      },
+      absenceList: {
+        
+          list: [],
+          num: 0
+        
+      }, // 缺席人员
       orgName: '', //机构名称
       orgId: '', //机构ID
       show: false, //机构弹框显示隐藏
@@ -225,6 +235,7 @@ export default {
       this.currentDate = ''
       this.typeValue = ''
       this.typeName = ''
+      this.orgName = ''
 
       this.selectListAppHandler()
     },
@@ -244,7 +255,7 @@ export default {
       let obj = {
         isAppSelect: 1
       }
-      
+
       if (this.statusValue) {
         obj.status = this.statusValue
       }
@@ -257,8 +268,7 @@ export default {
       if (this.typeValue) {
         obj.type = this.typeValue
       }
-      
-      
+
       //获取任务列表
       gettrainingList(obj).then(res => {
         let { code, rows, msg } = res
@@ -352,8 +362,23 @@ export default {
       return y + '-' + m
     },
     //查看签名情况
-    signatureCondition() {
+    signatureCondition(id) {
       this.conditionShow = true
+      getsignUserList(id).then(res => {
+        console.log(res, 'ssss')
+        let { meg, code, data } = res
+        data.map(item => {
+          if (item.type === 2) {
+            this.absenceList.push(item.userName)
+            this.absenceList.num++
+          } else {
+            this.participationList.list.push(item.userName)
+            this.participationList.num++
+          }
+        })
+        this.absenceList.list = this.absenceList.list.join(',')
+        this.participationList.list = this.participationList.list.join(',')
+      })
     },
     //培训登记跳转
     trainSign(id) {
@@ -361,13 +386,18 @@ export default {
     },
     //签名
     signature(id) {
-      this.$router.push('/personnelSignature/' + id)
+      this.$router.push('/personnelSignature/' + id+'_edit')
+    },
+    //跳转详情
+    goInfo(id) {
+      this.$router.push('/personnelSignature/' + id+'_info')
     },
     onChange(picker, value, index) {},
     onCancel() {
       this.show = false
       this.typeStatus = false
       this.showDate = false
+      this.showStatus = false
     }
   }
 }