sunlupeng hai 1 ano
pai
achega
21219e25aa
Modificáronse 2 ficheiros con 71 adicións e 4 borrados
  1. 10 0
      src/api/allApi.js
  2. 61 4
      src/views/HomeView/EarnPoints.vue

+ 10 - 0
src/api/allApi.js

@@ -119,6 +119,16 @@ export function citeList(query) {
   })
 }
 
+
+//表彰修改
+export function editCite(data) {
+  return request({
+    url: '/customer/commend/user/edit',
+    method: 'post',
+    data
+  })
+}
+
 //客户表彰上传
 export function uploadCite(data) {
   return request({

+ 61 - 4
src/views/HomeView/EarnPoints.vue

@@ -98,6 +98,12 @@
               </template>
             </el-table-column>
             <el-table-column min-width="120" align="center" prop="createTime" label="上传时间"></el-table-column>
+            <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="handleClickViewCite(scope.row, 'view')">查看</el-button>
+                <el-button v-if="scope.row.status=='12' || scope.row.status=='22'" type="success" size="small" @click="handleClickViewCite(scope.row, 'edit')">修改</el-button>
+              </template>
+            </el-table-column>
           </el-table>
           <!-- 分页 -->
           <div class="myPage">
@@ -219,7 +225,7 @@
         <el-button size="small" type="primary" @click="submitForm">确 定</el-button>
       </span>
     </el-dialog>
-    <el-dialog title="上传表彰" :visible.sync="dialogVisibleCite" width="40%">
+    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogVisibleCite" width="40%">
       <el-form :rules="rulesCite" ref="dataFormCite" :model="dataFormCite" label-width="100px">
         <el-form-item label="表彰类型:" prop="type">
           <el-select clearable size="small" style="width: 95%;" v-model="dataFormCite.type" placeholder="请选择表彰类型">
@@ -253,7 +259,7 @@
         </el-form-item>
 
       </el-form>
-      <span slot="footer" class="dialog-footer">
+      <span v-if="dialogStatus!='view'" slot="footer" class="dialog-footer">
         <el-button size="small" type="primary" @click="submitFormCite">确 定</el-button>
       </span>
     </el-dialog>
@@ -319,7 +325,7 @@
   </div>
 </template>
 <script scoped>
-import { certificatePage, certificateUpload, notice, certificatType, dictList, allUserList, citeList, uploadCite, trainList, uploadTrain,editTrain } from "@/api/allApi";
+import { certificatePage, certificateUpload, notice, certificatType, dictList, allUserList, citeList, uploadCite, editCite, trainList, uploadTrain,editTrain } from "@/api/allApi";
 import { handleTree } from '@/utils/index'
 export default {
   data() {
@@ -448,6 +454,32 @@ export default {
         content: '',
       };
     },
+    handleClickViewCite(row, val) {
+      if(row.groupUsers && row.groupUsers.length>0){
+        let groupIds = [];
+        for (let i in row.groupUsers) {
+          groupIds.push(row.groupUsers[i].loginId);
+        }
+        row.groupIds = groupIds;
+      }
+      this.dataFormCite = Object.assign({}, row);
+      if (row.files) {
+        let files = row.files;
+        this.dataFormCite.files = [];
+        for (let i in files) {
+          let url = files[i].url;
+          let name = files[i].oldName;
+
+          this.dataFormCite.files.push({
+            name: name,
+            url: url,
+            response: { error: "0", data: { url: url } },
+          });
+        }
+      }
+      this.dialogVisibleCite = true;
+      this.dialogStatus = val;
+    },
     handleClickView(row, val) {
       if(row.trainees && row.trainees.length>0){
         let traineeIds = [];
@@ -681,7 +713,13 @@ export default {
     submitFormCite() {
       this.$refs['dataFormCite'].validate((valid) => {
         if (valid) {
-          uploadCite(this.dataFormCite)
+          
+        } else {
+          return false;
+        }
+        if (valid) {
+          if(this.dialogStatus=='create'){
+            uploadCite(this.dataFormCite)
             .then((response) => {
               this.dialogVisibleCite = false;
               this.$notify({
@@ -697,6 +735,25 @@ export default {
               this.getDataListCite();
             })
             .catch(() => { });
+          }
+          if(this.dialogStatus=='edit'){
+            editCite(this.dataFormCite)
+            .then((response) => {
+              this.dialogVisibleCite = false;
+              this.$notify({
+                title: "成功",
+                message: "表彰修改成功",
+                type: "success",
+                duration: 2000,
+              });
+              this.dataFormCite.type = [];
+              this.dataFormCite.fileIds = '';
+              this.dataFormCite.files = [];
+              this.listQueryCite.page = 1;
+              this.getDataListCite();
+            })
+            .catch(() => { });
+          }
         } else {
           return false;
         }