sunlupeng 2 éve
szülő
commit
2491f3e5a3
3 módosított fájl, 108 hozzáadás és 8 törlés
  1. 10 0
      src/api/allApi.js
  2. 97 7
      src/views/HomeView/EarnPoints.vue
  3. 1 1
      vue.config.js

+ 10 - 0
src/api/allApi.js

@@ -99,6 +99,16 @@ export function uploadTrain(data) {
     data
   })
 }
+//培训修改
+export function editTrain(data) {
+  return request({
+    url: '/mall-train/user/edit',
+    method: 'post',
+    data
+  })
+}
+
+
 
 // 客户表彰列表
 export function citeList(query) {

+ 97 - 7
src/views/HomeView/EarnPoints.vue

@@ -108,7 +108,7 @@
           </div>
         </el-tab-pane>
         <el-tab-pane label="培训列表" name="fourth">
-          <el-button size="small" type="primary" @click="dialogVisibleTrain = true">上传培训</el-button>
+          <el-button size="small" type="primary" @click="handleClickCreate()">上传培训</el-button>
           <el-table size="small" :data="dataListTrain" border style="margin-top: 20px;width: 960px">
             <el-table-column align="center" type="index" width="50" label="序号"></el-table-column>
             <el-table-column align="center" prop="title" min-width="100" label="培训主题">
@@ -119,6 +119,20 @@
             </el-table-column>
             <el-table-column align="center" prop="lecturerName" min-width="150" label="培训讲师">
             </el-table-column>
+            <el-table-column align="center" min-width="100" label="参加人员">
+              <template slot-scope="props">
+                <el-popover trigger="hover">
+                  <el-table :data="props.row.trainees" border size="mini">
+                    <el-table-column min-width="200" align="center" prop="deptName" label="部门"></el-table-column>
+                    <el-table-column min-width="100" align="center" prop="userName" label="姓名"></el-table-column>
+                    <el-table-column min-width="100" align="center" prop="employeNo" label="员工号"></el-table-column>
+                  </el-table>
+                  <span style="color: #1e80ff;cursor: pointer;" slot="reference">
+                    {{ props.row.trainees[0].userName }}
+                  </span>
+                </el-popover>
+              </template>
+            </el-table-column>
             <el-table-column min-width="100" align="center" label="培训描述">
               <template slot-scope="props">
                 <el-popover width="400" trigger="hover" :content="props.row.content">
@@ -126,13 +140,46 @@
                 </el-popover>
               </template>
             </el-table-column>
+            <el-table-column align="center" min-width="200" label="培训材料">
+              <template slot-scope="props">
+                <div v-for="(item, index) in props.row.materialFiles" :key="index">
+                  <a style="color: #1e80ff;" target="_blank" :href="item.url">{{ item.oldName }}</a>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" min-width="200" label="签到表照片">
+              <template slot-scope="props">
+                <div v-for="(item, index) in props.row.signPhotoFiles" :key="index">
+                  <a style="color: #1e80ff;" target="_blank" :href="item.url">{{ item.oldName }}</a>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" min-width="200" label="现场照片">
+              <template slot-scope="props">
+                <div v-for="(item, index) in props.row.sitePhotoFiles" :key="index">
+                  <a style="color: #1e80ff;" target="_blank" :href="item.url">{{ item.oldName }}</a>
+                </div>
+              </template>
+            </el-table-column>
             <el-table-column min-width="150" align="center" prop="createTime" label="上传时间"></el-table-column>
-            <el-table-column min-width="100" align="center" label="状态" prop="statusName">
+            <el-table-column min-width="100" align="center" label="状态">
+              <template slot-scope="props">
+                <el-popover trigger="hover">
+                  <el-table :data="props.row.trainLogs" border size="mini">
+                    <el-table-column min-width="120" align="center" prop="auditor" label="处理人"></el-table-column>
+                    <el-table-column min-width="160" align="center" prop="comment" label="处理结果"></el-table-column>
+                    <!-- <el-table-column min-width="120" align="center" prop="statusName" label="状态"></el-table-column> -->
+                    <el-table-column min-width="180" align="center" prop="createTime" label="处理时间"></el-table-column>
+                  </el-table>
+                  <span style="color: #1e80ff;cursor: pointer;" slot="reference">{{ props.row.statusName }}</span>
+                </el-popover>
+              </template>
             </el-table-column>
-            <el-table-column align="center" label="操作" width="160px" class-name="small-padding fixed-width">
+            
+            <el-table-column fixed="right" align="center" label="操作" width="160px" class-name="small-padding fixed-width">
               <template slot-scope="scope">
                 <el-button type="primary" size="small" @click="handleClickView(scope.row, 'view')">查看</el-button>
-                <el-button type="success" size="small" @click="handleClickView(scope.row, 'edit')">修改</el-button>
+                <el-button v-if="scope.row.status=='21' || scope.row.status=='31'" type="success" size="small" @click="handleClickView(scope.row, 'edit')">修改</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -272,7 +319,7 @@
   </div>
 </template>
 <script scoped>
-import { certificatePage, certificateUpload, notice, certificatType, dictList, allUserList, citeList, uploadCite, trainList, uploadTrain } from "@/api/allApi";
+import { certificatePage, certificateUpload, notice, certificatType, dictList, allUserList, citeList, uploadCite, trainList, uploadTrain,editTrain } from "@/api/allApi";
 import { handleTree } from '@/utils/index'
 export default {
   data() {
@@ -367,6 +414,7 @@ export default {
       },
       dialogStatus:'',
       textMap: {
+        create: "上传培训",
         edit: "修改",
         view: "详情",
       },
@@ -382,7 +430,32 @@ export default {
     this.getIntegralNotice();
   },
   methods: {
+    handleClickCreate(){
+      this.dialogVisibleTrain = true;
+      this.dialogStatus = 'create';
+      this.dataFormTrain =  {
+        title: '',
+        startTime: '',
+        endTime: '',
+        lecturer: '',
+        traineeIds: [],
+        materialFiles: [],
+        materials: [],
+        signPhotoFiles: [],
+        signPhotos: [],
+        sitePhotoFiles: [],
+        sitePhotos: [],
+        content: '',
+      };
+    },
     handleClickView(row, val) {
+      if(row.trainees && row.trainees.length>0){
+        let traineeIds = [];
+        for (let i in row.trainees) {
+          traineeIds.push(row.trainees[i].loginId);
+        }
+        row.traineeIds = traineeIds;
+      }
       this.dataFormTrain = Object.assign({}, row);
       if (row.materialFiles) {
         let files = row.materialFiles;
@@ -745,7 +818,8 @@ export default {
     submitFormTrain() {
       this.$refs['dataFormTrain'].validate((valid) => {
         if (valid) {
-          uploadTrain(this.dataFormTrain)
+          if(this.dialogStatus=='create'){
+            uploadTrain(this.dataFormTrain)
             .then((response) => {
               this.dialogVisibleTrain = false;
               this.$notify({
@@ -754,11 +828,26 @@ export default {
                 type: "success",
                 duration: 2000,
               });
-              this.dataFormTrain.materials = [];
               this.listQueryTrain.page = 1;
               this.getDataListTrain();
             })
             .catch(() => { });
+          }
+          if(this.dialogStatus=='edit'){
+            editTrain(this.dataFormTrain)
+            .then((response) => {
+              this.dialogVisibleTrain = false;
+              this.$notify({
+                title: "成功",
+                message: "培训修改成功",
+                type: "success",
+                duration: 2000,
+              });
+              this.listQueryTrain.page = 1;
+              this.getDataListTrain();
+            })
+            .catch(() => { });
+          }
         } else {
           return false;
         }
@@ -766,6 +855,7 @@ export default {
     },
     getDataListTrain() {
       trainList(this.listQueryCite).then(response => {
+        debugger
         this.dataListTrain = response.data.data.items;
         this.totalTrain = response.data.data.total;
       })

+ 1 - 1
vue.config.js

@@ -14,7 +14,7 @@ const cdn = {
 };
 module.exports = defineConfig({
   devServer:{
-    host: '192.168.100.73',
+    host: '192.168.100.205',
     open:true
   },
   transpileDependencies: true,