zpj 1 yıl önce
ebeveyn
işleme
46f14d60f8

+ 3 - 0
src/api/signContract.js

@@ -13,3 +13,6 @@ export const signContract = (data) => request(commonUrl + 'contract', 'post', {
 export const signFirm = (data) => request(commonUrl + 'firm', 'post', { ...data })
 // 获取人员列表
 export const signMember = (data) => request(commonUrl + 'member', 'post', { ...data })
+
+// 下载已签署合同
+export const signDownload = (data) => request(commonUrl + 'download', 'post', { ...data })

+ 3 - 2
src/views/admin/sign/add.vue

@@ -112,7 +112,7 @@
         }
         this.isAJAX = true;
         let list = this.texts.reduce((acc,item)=>{
-          acc[item.name] = item.val
+          acc[item.key] = item.val
           return acc
         },{});
 
@@ -141,7 +141,8 @@
         let textsList = e.texts;
         textsList.forEach((v)=>{
           let obj = {
-            name:v,
+            name:v.name,
+            key:v.key,
             val:'',
           }
           this.texts.push(obj)

+ 23 - 2
src/views/admin/sign/list.vue

@@ -28,6 +28,12 @@
                 <el-tag v-else type="danger">{{scope.row.status_str}}</el-tag>
               </template>
             </el-table-column>
+
+            <el-table-column fixed='right' prop="" label="下载" width="300">
+              <template slot-scope="scope">
+                <el-button v-if="scope.row.status == 2" type="success" icon="el-icon-circle-plus-outline" @click="download(scope.row)">下载</el-button>
+              </template>
+            </el-table-column>
         </el-table>
       </div>
 
@@ -47,7 +53,7 @@
 </template>
 
 <script>
-  import {signList} from '@/api/signContract.js'
+  import {signList,signDownload} from '@/api/signContract.js'
   export default {
     data(){
       return{
@@ -57,6 +63,7 @@
           search:'',
         },
         total:0,
+        isAJAX:false,
       }
     },
     mounted(){
@@ -83,7 +90,21 @@
       add(item){
         this.$router.push({path:'/sign/add'})
       },
-
+      download(item){
+        if(this.isAJAX){
+          return
+        }
+        this.isAJAX = true;
+        signDownload({contract_id:item.contract_id}).then((res)=>{
+          this.isAJAX = false;
+          if(res.code == 1){
+            this.$message.success(res.msg);
+            window.open(res.data.files[0].downloadUrl)
+          }else{
+            this.$message.error(res.msg);
+          }
+        })
+      },
     },
   }
 </script>

+ 19 - 12
src/views/admin/template/add-edit.vue

@@ -58,12 +58,19 @@
           <el-button class="mb-20" type="success" icon="el-icon-circle-plus-outline" @click="add(2)">添加合同可替换变量词</el-button>
 
           <div class="align-items-center mb-20" v-for="(item,i) in textList" :key="i">
-            <div class="fs-16">合同可替换变量词:</div>
+            <el-input
+              class="input-w-264 mr-10"
+              placeholder="请输入变量词标题"
+              prefix-icon="el-icon-edit"
+              v-model="item.name"
+              >
+            </el-input>
+            <div class="fs-16">:</div>
             <el-input
               class="input-w-264 mr-10"
               placeholder="请输入合同可替换变量词"
               prefix-icon="el-icon-edit"
-              v-model="item.val"
+              v-model="item.key"
               >
             </el-input>
             <el-button type="danger" icon="el-icon-delete" @click="del(2,item,i)">删除</el-button>
@@ -145,10 +152,11 @@
               })
             }
             if(this.fromData.texts.length > 0){
-              this.fromData.texts.forEach((v)=>{
-                let obj = {val:v};
-                this.textList.push(obj)
-              })
+              // this.fromData.texts.forEach((v)=>{
+              //   let obj = {val:v};
+              //   this.textList.push(obj)
+              // })
+              this.textList = this.fromData.texts
             }
             this.fileList = [];
             let obj = {
@@ -175,11 +183,10 @@
         this.signList.forEach((v)=>{
           this.fromData.sign_party.push(v.val)
         })
-        this.textList.forEach((v)=>{
-          this.fromData.texts.push(v.val)
-        })
-
-
+        // this.textList.forEach((v)=>{
+        //   this.fromData.texts.push(v.val)
+        // })
+        this.fromData.texts = this.textList;
 
         contractSave(this.fromData).then((res)=>{
           this.isAJAX = false
@@ -197,7 +204,7 @@
           let obj = {val:""};
           this.signList.push(obj);
         }else{
-          let obj = {val:""};
+          let obj = {name:"",key:""};
           this.textList.push(obj);
         }
       },