coys 2 anni fa
parent
commit
b1eaf49d19

+ 120 - 110
src/components/upload/index.vue

@@ -1,128 +1,138 @@
 <template>
-  <div>
-    <van-uploader
-      ref="uploader"
-      v-bind="$attrs"
-      v-model="fileList"
-      :before-read="beforeRead"
-      :after-read="afterRead"
-      :max-count="maxCount"
-      @delete="deleteHandler"
-      :max-size="maxSize * 1024 * 1024"
-    />
-  </div>
+    <div>
+        <van-uploader
+          ref="uploader"
+          v-bind="$attrs"
+          v-model="fileList"
+          :before-read="beforeRead"
+          :after-read="afterRead"
+          :max-count="maxCount"
+          @delete="deleteHandler"
+          :max-size="maxSize * 1024*1024"/>
+    </div>
 </template>
 <script>
-import { upload } from '@/api/public'
-import ImageCompressor from 'js-image-compressor'
-import config from '@/config/index'
+import {upload} from "@/api/public";
+import ImageCompressor from "js-image-compressor";
+import config from '@/config/index';
 export default {
-  props: {
-    value: {
-      type: Array
+    props:{
+      value:{
+        type: Array,
+      },
+      //最大上传数量
+      maxCount:{
+        type: Number,
+        default: 6,
+      },
+      //文件大小,单位MB
+      maxSize:{
+        type: Number,
+        default: 5,
+      },
+
     },
-    //最大上传数量
-    maxCount: {
-      type: Number,
-      default: 6
+    data() {
+      return {
+        fileList:[],
+        //上传之后的图片列表,双向绑定之后覆盖fileList
+        imageList:[]
+      };
     },
-    //文件大小,单位MB
-    maxSize: {
-      type: Number,
-      default: 5
-    }
-  },
-  data() {
-    return {
-      fileList: [],
-      //上传之后的图片列表,双向绑定之后覆盖fileList
-      imageList: []
-    }
-  },
 
-  mounted() {},
-  watch: {
-    value: {
-      handler(val) {
-        this.fileList = val.map(v => {
-          console.log(window.origin, ' window.origin ')
-          let imgUrl = process.env.NODE_ENV === 'development' ? config.baseUrl + v.imgPath : window.origin + v.imgPath
-          return {
-            name: v.name,
-            url: imgUrl,
-            path: v.imgPath
-          }
-        })
-      },
-      deep: true,
-      immediate: true
-    }
-  },
-  methods: {
-    //上传前压缩
-    beforeRead(file) {
-      console.log(file, '图片压缩前')
-      return new Promise((resolve, reject) => {
-        new ImageCompressor({
-          file,
-          quality: 0.6,
-          success: result => {
-            //this.$toast('图片压缩成功')
-            console.log(result, '图片压缩后')
-            let imgFile = new File([result], result.name, {
-              width: result.width,
-              height: result.height,
-              type: result.type
-            })
-            console.log(imgFile, '后')
-            resolve(imgFile)
-          },
-          error: e => {
-            console.log('imageError:' + e)
-            this.$toast('图片压缩失败')
-            reject(e)
-          }
-        })
-      })
+    mounted() {
+
     },
-    //上传到服务器
-    afterRead(fileObj) {
-      let formData = new FormData()
-      formData.append('file', fileObj.file)
-      upload(formData, 'image')
-        .then(res => {
+    watch:{
+      value:{
+        handler(val){
+          this.imageList= this.fileList = val.map(v=>{
+          
+            let imgUrl =
+              process.env.NODE_ENV === "development"
+                ?  config.baseUrl + v.imgPath||v.path
+                : window.origin + v.imgPath||v.path;
+            return {
+              name: v.name,
+              url:  imgUrl,
+              path:v.imgPath||v.path,
+            }
+          })
+          
+        },
+        deep:true,
+        immediate:true
+      }
+    },
+    methods: {
+      //上传前压缩
+      beforeRead(file){
+        console.log(file,'图片压缩前')
+        return new Promise((resolve, reject) => {
+            new ImageCompressor({
+              file,
+              quality: 0.6,
+              success: (result) => {
+                //this.$toast('图片压缩成功')
+                console.log(result,'图片压缩后')
+                let imgFile = new File([result], result.name, {
+                  width: result.width,
+                  height: result.height,
+                  type: result.type,
+                });
+                console.log(imgFile,'后')
+                resolve(imgFile);
+              },
+              error: (e) => {
+                console.log('imageError:'+e);
+                this.$toast('图片压缩失败')
+                reject(e);
+              },
+             });
+        });
+      },
+      //上传到服务器
+      afterRead(fileObj){
+        let formData = new FormData();
+        formData.append("file", fileObj.file);
+        upload(formData, "image").then((res) => {
           /*上传成功*/
           let imgUrl =
-            process.env.NODE_ENV === 'development' ? config.baseUrl + res.data.url : window.origin + res.data.url
-          this.deleteHandler()
-          // this.$emit("input",this.imageList);
-        })
-        .catch(err => {
+            process.env.NODE_ENV === "development"
+              ?  config.baseUrl + res.data.url
+              : window.origin + res.data.url;
+         
+          this.imageList.push({ name: res.data.name, url: imgUrl,path:res.data.url});
+          this.$emit('input',this.imageList)
+          
+        }).catch((err) => {
           /*上传失败*/
-          console.log(this.fileList, 'this.fileList')
+          
           this.$toast.fail('上传失败')
+        });
+      },
+      //删除
+      deleteHandler(){
+        let imageList=JSON.parse(JSON.stringify(this.fileList))
+        imageList.forEach(item=>{
+          item.imgPath=item.path
+          item.path=item.imgPath
+          
         })
+        
+        this.$emit('input',imageList)
+      }
     },
-    //删除
-    deleteHandler() {
-      this.imageList = this.fileList
-      this.imageList.forEach(item => {
-        item.imgPath = item.path
-        delete item.path
-      })
-      this.$emit('input',this.imageList)
+    model:{
+      prop:'value',
+      event:'input'
     }
-  },
-  model: {
-    prop: 'value',
-    event: 'input'
-  }
-}
+};
 </script>
 <style lang="scss" scoped>
-.upload-text {
-  font-size: 18px;
-  color: #999;
-  margin-top: 5px;
-}
+  .upload-text{
+    font-size: 18px;
+    color: #999;
+    margin-top: 5px;
+  }
 </style>

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

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

+ 3 - 1
src/views/menu/monitoringCall/components/taskInfo.vue

@@ -130,7 +130,9 @@ export default {
     },
     //复选框选中变化
     checkHandler(val, item) {
-     
+      if(val){
+        item.isChecked=true
+      }
       if (val&&item.situation=='0') {
         item.abnormalIllustrate = ''
       }

+ 2 - 2
src/views/menu/monitoringCall/index.vue

@@ -15,7 +15,7 @@
           :disabled="showStatus"
           label="状态"
           placeholder=""
-          @click="showStatus = true" />
+          @click="showStatus = true" ><van-icon name="arrow-down" slot="button" /></van-field>
         <van-popup v-model="showStatus" round position="bottom">
           <van-picker
             title="调阅状态"
@@ -36,7 +36,7 @@
           label="月份"
           placeholder=""
           @click="showDate = true"
-        />
+        ><van-icon name="arrow-down" slot="button" /></van-field>
         <van-popup v-model="showDate" round position="bottom">
           <van-datetime-picker
             v-model="presentDate"

+ 4 - 1
src/views/menu/training/components/addTraining.vue

@@ -272,6 +272,7 @@ export default {
     },
     //上传附件成功
     listHandler(list) {
+      console.log(list,'mmmm');
       this.form.imageList = list || []
     },
     //表单提交前校验
@@ -354,8 +355,10 @@ export default {
     submitHandlerConfirm(type) {
       let obj = JSON.parse(JSON.stringify(this.form))
 
-      obj.imageList = obj.imageList.map(item => item.imgPath).join(',')
+      obj.imageList = obj.imageList.map(item => item.path).join(',')
+      console.log(obj.imageList);
       obj.taskUserList = []
+      debugger
       obj.taskUserList.push(...this.userPeopleList, ...this.lackPeopleList)
 
       edittrainingInfo({

+ 16 - 14
src/views/menu/training/index.vue

@@ -12,14 +12,14 @@
         <van-col span="12"
           ><van-field
             v-model="fieldValue"
-            
             label-width="3em"
             clearable
             :disabled="showStatus"
             label="状态"
             placeholder=""
             @click="showStatus = true"
-          ><van-icon name="arrow-down" slot="button"/></van-field>
+            ><van-icon name="arrow-down" slot="button"
+          /></van-field>
           <van-popup v-model="showStatus" round position="bottom">
             <van-picker
               title="状态"
@@ -59,7 +59,6 @@
         <van-col span="24"
           ><van-field
             v-model="typeName"
-            
             label-width="3em"
             clearable
             label="类型"
@@ -67,9 +66,8 @@
             placeholder=""
             @click="typeStatus = true"
           >
-        
-          <van-icon name="arrow-down" slot="button"/>
-        </van-field>
+            <van-icon name="arrow-down" slot="button" />
+          </van-field>
           <van-popup v-model="typeStatus" round position="bottom">
             <van-picker
               title="类型"
@@ -132,7 +130,13 @@
       </van-list>
     </div>
     <!-- 卡片弹框 -->
-    <van-dialog v-model="conditionShow" title="签名情况" show-confirm-button  confirm-button-text="关闭" @closed="beforeClose">
+    <van-dialog
+      v-model="conditionShow"
+      title="签名情况"
+      show-confirm-button
+      confirm-button-text="关闭"
+      @closed="beforeClose"
+    >
       <div class="conditionCls">
         <div class="title">已签名人员({{ participationList.num }}人):</div>
         <div class="people">{{ participationList.list }}</div>
@@ -247,11 +251,10 @@ export default {
     },
     //判断是否展示签名按钮
     isSignature(list) {
-      
       let falg = false
       let timefalg = false
       //value1 当前登陆用户ID
-      //任务处于待记录状态,且任务在规定完成时间范围内,登录人所在机构和角色与任务培训角色、培训机构一致才显示
+      //当前时间再时间范围内且签名是待签名状态且签名列表存在当前登录人未签名的情况才可以进行签名
       if (list.startDate && list.endDate && list.status == 1) {
         let date = new Date().getTime()
         let startDate = Date.parse(new Date(list.startDate))
@@ -264,8 +267,7 @@ export default {
       }
       list.userList?.forEach(item => {
         console.log(this.value1, 'sss')
-        if (this.value1 == item.userId && item.sign === 0) {
-          console.log(list.id, 'fff')
+        if (this.value1 == item.userId && item.sign === 0 && item.type == 1) {
           falg = true
         }
       })
@@ -276,14 +278,14 @@ export default {
     },
     //判断是否展示登记按钮
     isSign(list) {
-      
       let falg = false
       let timefalg = false
       //value1 当前登陆用户ID
       let date = new Date().getTime()
       let startDate = Date.parse(new Date(list.startDate))
       let endDate = Date.parse(new Date(list.endDate))
-      //当前时间再时间范围内且签名是待签名状态且签名列表存在当前登录人未签名的情况才可以进行签名
+      //任务处于待记录状态,且任务在规定完成时间范围内,登录人所在机构和角色与任务培训角色、培训机构一致才显示
+
       if (list.startDate && list.endDate && list.status == 0) {
         if (date >= startDate && date <= endDate) {
           timefalg = true
@@ -479,7 +481,7 @@ export default {
     },
     //关闭弹框
     beforeClose() {
-      console.log('sssssssss');
+      console.log('sssssssss')
       ;(this.participationList = {
         list: [], // 参与人员
         num: 0 //人数