Browse Source

系统中期支付接口对接

duy 1 year ago
parent
commit
455c2a6689
2 changed files with 305 additions and 130 deletions
  1. 72 0
      src/api/measure/interimPay.js
  2. 233 130
      src/views/measure/interimPay.vue

+ 72 - 0
src/api/measure/interimPay.js

@@ -0,0 +1,72 @@
+import request from '@/router/axios';
+//系统中期支付项分页
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-meter/mid/pay/item/system/page',
+    method: 'post',
+    data: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+//系统中期支付项列表
+export const getAllList = (row) => {
+  return request({
+    url: '/api/blade-meter/mid/pay/item/system/list',
+    method: 'post',
+    params: row
+  })
+}
+export const remove = (id) => {
+  return request({
+    url: '/api//blade-meter/mid/pay/item/system/remove',
+    method: 'get',
+    params: {
+      id,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/blade-meter/mid/pay/item/system/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/blade-meter/mid/pay/item/system/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+      url: '/api/blade-meter/mid/pay/item/system/detail',
+      method: 'get',
+      params: {
+          id
+      }
+  })
+}
+//添加汇总项
+export const addPay = (row) => {
+  return request({
+    url: '/api/blade-meter/mid/pay/item/bind/submit',
+    method: 'post',
+    params: row
+  })
+}
+//删除汇总项
+export const removePay = (row) => {
+  return request({
+    url: '/api/blade-meter/mid/pay/item/bind/remove',
+    method: 'post',
+    params: row
+  })
+}

+ 233 - 130
src/views/measure/interimPay.vue

@@ -5,11 +5,17 @@
       <div class="boxnei" style="display: flex; flex-direction: column">
         <avue-crud :data="data"
         ref="crud"
-             :option="option"
-             :page.sync="page"
-             v-model="form"
-        
-              @on-load="onLoad">
+            :option="option"
+            :page.sync="page"
+            v-model="form"
+            @current-change="currentChange"
+            @size-change="sizeChange"
+            @row-del="rowDel"
+            @row-update="rowUpdate"
+            @row-save="rowSave"
+            @on-load="onLoad"
+            @row-click="rowClick1"
+            >
               <template slot="menuLeft">
                 <span style="font-weight: bold;"> 系统中期支付项列表</span>
                
@@ -20,11 +26,11 @@
 
          <!-- 合同公式 -->
         <template
-            slot-scope="{type}"
+        slot-scope="{type}"
             slot="key11Form"
           >
             <div class="flexStar">
-              <el-input :disabled="true" v-model="form.key11" style="width: 70%;margin-right: 10px;"></el-input>
+              <el-input :disabled="true" v-model="form.contractFormulaIds" style="width: 70%;margin-right: 10px;"></el-input>
                 <el-link type="primary" @click="handleaddFormula">添加公式</el-link>
                 <el-link type="primary" class="marleft10">删除公式</el-link>
             </div>
@@ -34,7 +40,7 @@
             slot="key12Form"
           >
             <div class="flexStar">
-              <el-input :disabled="true" v-model="form.key12" style="width: 70%;margin-right: 10px;"></el-input>
+              <el-input :disabled="true" v-model="form.updateFormulaIds" style="width: 70%;margin-right: 10px;"></el-input>
                 <el-link type="primary" @click="handleaddFormula">添加公式</el-link>
                 <el-link type="primary" class="marleft10">删除公式</el-link>
             </div>
@@ -44,7 +50,7 @@
             slot="key13Form"
           >
             <div class="flexStar">
-              <el-input :disabled="true" v-model="form.key13" style="width: 70%;margin-right: 10px;"></el-input>
+              <el-input :disabled="true" v-model="form.currentFormulaIds" style="width: 70%;margin-right: 10px;"></el-input>
                 <el-link type="primary" @click="handleaddFormula">添加公式</el-link>
                 <el-link type="primary" class="marleft10">删除公式</el-link>
             </div>
@@ -104,27 +110,27 @@
               <tbody>
                 <tr>
                   <td class="tit" width="20%">支付项编号:</td>
-                  <td id="code">100章</td>
+                  <td id="code">{{ curRow.payNumber||'' }}</td>
                   <td class="tit" width="20%">支付项名称:</td>
-                  <td id="itemName">100章</td>
+                  <td id="itemName">{{ curRow.payName||'' }}</td>
               </tr>
               <tr>
                   <td class="tit" width="20%">支付项类型:</td>
-                  <td id="itemType">100章</td>
+                  <td id="itemType">{{ curRow.payType||'' }}</td>
                   <td class="tit" width="20%">是否为扣款项:</td>
-                  <td id="negative">否</td>
+                  <td id="negative">{{ curRow.isDeduct===1?'是':''||'' }}</td>
               </tr>
               <tr>
                   <td class="tit" width="20%">是否合计项:</td>
-                  <td id="sumItem">否</td>
+                  <td id="sumItem">{{ curRow.isTotalTerms===1?'是':''||'' }}</td>
                   <td class="tit" width="20%">是否显示百分比:</td>
-                  <td id="showPercent">是</td>
+                  <td id="showPercent">{{ curRow.isShowPercent===1?'':'否'||'' }}</td>
               </tr>
               <tr>
                   <td class="tit" width="20%">是否手动输入:</td>
-                  <td id="useHand">否</td>
+                  <td id="useHand">{{ curRow.isManualInput===1?'是':''||'' }}</td>
                   <td class="tit" width="20%">排序号:</td>
-                  <td id="orderNum">1</td>
+                  <td id="orderNum">{{ curRow.sort||'' }}</td>
               </tr>
               <tr>
                   <td class="tit" width="20%">合同计算公式名称:</td>
@@ -140,14 +146,14 @@
               </tr>
               <tr>
                   <td class="tit" width="10%">备注:</td>
-                  <td colspan="3" id="remark"></td>
+                  <td colspan="3" id="remark">{{ curRow.remarks||'' }}</td>
               </tr>
           </tbody></table>
 
       </form>
     
       <div class="totalbox">
-        <avue-crud :data="totaldata" :option="totaloption" >
+        <avue-crud :data="totaldata" :option="totaloption" @row-del="rowDel1" >
           <template slot="menuLeft">
             <span style="font-weight: bold;margin-right: 5px;">汇总项</span>
               <el-link type="primary" size="small"
@@ -167,18 +173,21 @@
       :before-close="handleTatolClose">
         <avue-crud :data="tadddata"
         :option="taddoption"
+        @selection-change="selectionChange"
+        
          >
         
       </avue-crud>
       <span slot="footer" class="dialog-footer">
         <el-button @click="tatoldialogVisible = false">取 消</el-button>
-        <el-button type="primary" @click="tatoldialogVisible = false">确 定</el-button>
+        <el-button type="primary" @click="rowSave1">确 定</el-button>
       </span>
     </el-dialog>
    </div>
   </template>
   
   <script >
+  import { getList,update,remove,add,getDetail,addPay,removePay,getAllList } from "@/api/measure/interimPay.js";
   export default {
   data () {
     return {
@@ -186,6 +195,7 @@
         pageSize: 20,
         pagerCount: 5
       },
+      query:{},
       form:{},
       data: [],
       option: {
@@ -206,12 +216,12 @@
           { span: 24,
             labelWidth: 130,
             label: '支付项编号',
-            prop: 'key1'
+            prop: 'payNumber'
           },
           { span: 24,
             labelWidth: 130,
             label: '支付项名称',
-            prop: 'key2',
+            prop: 'payName',
             rules: [{
               required: true,
               message: "请输入名称",
@@ -221,7 +231,7 @@
           { span: 24,
             labelWidth: 130,
             label: '支付项类型',
-            prop: 'key3',
+            prop: 'payType',
             type: "select",
             dicUrl: "/api/blade-system/dict-biz/dictionary?code=table_template_type",
               props: {
@@ -241,6 +251,9 @@
             prop: 'key11',
             disabled:true,
             hide: true, 
+            // formslot: true,
+            // slot: true
+
             
           },
           { span: 24,
@@ -260,7 +273,7 @@
           { span: 24,
             labelWidth: 130,
             label: '是否为扣款项',
-            prop: 'key4',
+            prop: 'isDeduct',
             type: "select",
             
             dicData: [
@@ -278,7 +291,7 @@
           { span: 24,
             labelWidth: 130,
             label: '是否加粗',
-            prop: 'key21',
+            prop: 'isBoldText',
             type: "select",
             hide: true, 
             dicData: [
@@ -297,7 +310,7 @@
             labelWidth: 130,
             label: '是否手动输入',
             hide: true, 
-            prop: 'key22',
+            prop: 'isManualInput',
             type: "select",
             dicData: [
                 {
@@ -315,7 +328,7 @@
             labelWidth: 130,
             label: '是否显示百分比',
             hide: true, 
-            prop: 'key22',
+            prop: 'isShowPercent',
             type: "select",
             dicData: [
                 {
@@ -334,7 +347,7 @@
             hide: true, 
             span:24,
             label: '是否合计项',
-            prop: 'key5',
+            prop: 'isTotalTerms',
             type: "select",
             dicData: [
                 {
@@ -351,7 +364,7 @@
             labelWidth: 130,
             span:24,
             label: '支付适用类型',
-            prop: 'key6',
+            prop: 'payApplicableType',
             type: "select",
             dicData: [
                 {
@@ -368,20 +381,21 @@
             hide: true, 
             labelWidth: 130,
             label: '排序号',
-            prop: 'key7',
+            prop: 'sort',
        
           },
           { span: 24,
             hide: true, 
             labelWidth: 130,
             label: '备注',
-            prop: 'key8',
+            prop: 'remarks',
             type: "textarea",
       
           },
         ],
         
       },
+      curRow:{},
       addFormuladialog:false,
       forpage: {
         pageSize: 20,
@@ -432,49 +446,9 @@
           label: '监理服务'
         }, 
       ],
-      totaldata: [
-          {
-            ids:1,
-            name:'200',
-            sex:'200章',
-            key3:'否',
-            key4:'否',
-            key5:'承包商'
-          },{
-            ids:1,
-            name:'200',
-            sex:'200章',
-            key3:'否',
-            key4:'否',
-            key5:'承包商'
-          },
-            {
-            ids:1,
-            name:'200',
-            sex:'200章',
-            key3:'否',
-            key4:'否',
-            key5:'承包商'
-          },     {
-            ids:1,
-            name:'200',
-            sex:'200章',
-            key3:'否',
-            key4:'否',
-            key5:'承包商'
-          },
-          
-            {
-            ids:1,
-            name:'200',
-            sex:'200章',
-            key3:'否',
-            key4:'否',
-            key5:'承包商'
-          },
-        ],
+      totaldata: [],
       totaloption:{
-          rowKey:'ids',
+          rowKey:'id',
           refreshBtn:false,
           columnBtn:false,
           editBtn:false,
@@ -488,30 +462,48 @@
           column:[
              {
               label:'支付项编号',
-              prop:'name'
+              prop:'payNumber'
             }, {
               label:'支付项名称',
-              prop:'sex'
+              prop:'payName'
             },
             {
               label:'支付项类型',
-              prop:'key3'
+              prop:'payType',
+              type: "select",
+              dicUrl: "/api/blade-system/dict-biz/dictionary?code=table_template_type",
+                props: {
+                  label: "dictValue",
+                  value: "dictKey"
+                },
+              dataType: "number",
             },
             {
               label:'合同计算公式',
-              prop:'key3'
+              prop:'contractFormulaIds'
             },
             {
               label:'变更计算公式',
-              prop:'key4'
+              prop:'updateFormulaIds'
             },
             {
               label:'本期计算公式',
-              prop:'key5'
+              prop:'currentFormulaIds'
             },
             {
               label:'是否为扣款项',
-              prop:'key5',
+              prop:'isDeduct',
+              type: "select",
+              dicData: [
+                {
+                  label: "否",
+                  value: 0
+                },
+                {
+                  label: "是",
+                  value: 1
+                }
+              ],
           
             },
           ],
@@ -572,80 +564,129 @@
         column:[
              {
               label:'支付项编号',
-              prop:'name'
+              prop:'payNumber'
             }, {
               label:'支付项名称',
-              prop:'sex'
+              prop:'payName'
             },
             {
               label:'支付项类型',
-              prop:'key3'
+              prop:'payType',
+              type: "select",
+              dicUrl: "/api/blade-system/dict-biz/dictionary?code=table_template_type",
+                props: {
+                  label: "dictValue",
+                  value: "dictKey"
+                },
+              dataType: "number",
             },
             {
               label:'合同计算公式',
-              prop:'key3'
+              prop:'contractFormulaIds'
             },
             {
               label:'变更计算公式',
-              prop:'key4'
+              prop:'updateFormulaIds'
             },
             {
               label:'本期计算公式',
-              prop:'key5'
+              prop:'currentFormulaIds'
             },
             {
               label:'是否为扣款项',
-              prop:'key5'
+              prop:'isDeduct',
+              type: "select",
+              dicData: [
+                {
+                  label: "否",
+                  value: 0
+                },
+                {
+                  label: "是",
+                  value: 1
+                }
+              ],
+              
+              
+
             },
           ],
       },
+      selectList:[],
     }
   },
   methods: {
-    onLoad (page) {
+    onLoad (page, params = {}) {
      
-      this.page.total = 40
-      //模拟分页
-      if (this.page.currentPage === 1) {
-        this.data = [
-          {
-            key1: 100,
-            key2: '100章',
-            key3: 2,
-            key4: '否',
-            key5: '否',
-            key6: '承包商',
-          },    {
-            key1: 200,
-            key2: '200章',
-            key3: 1,
-            key4: '否',
-            key5: '否',
-            key6: '承包商',
-          },
-        ]
-      } else if (this.page.currentPage == 2) {
-        this.data = [
-          {
-            key1: 100,
-            key2: 1,
-            key3: '100章',
-            key4: '否',
-            key5: '否',
-            key6: '承包商',
-          },    {
-            key1: 200,
-            key2: 2,
-            key3: '200章',
-            key4: '否',
-            key5: '否',
-            key6: '承包商',
-          },
-        ]
-      }
+      this.loading = true;
+      getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.data = data.records;
+        this.loading = false;
+        if(this.data.length>0){
+          this.rowClick1( this.data[0])
+        }
+       
+      });
     },
-    //添加中期支付项
-
+    currentChange (currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange (pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    rowSave (row, done, loading) {
+      add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+    },
+    rowUpdate (row, index, done, loading) {
+      update(row).then(() => {
+        this.onLoad(this.page);
+        this.$message({
+          type: "success",
+          message: "操作成功!"
+        });
+        done();
+      }, error => {
+        loading();
+        console.log(error);
+      });
+    },
+    //删除中期支付项
+    rowDel (row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+        });
+    },
+    rowClick1(row){
+      getDetail(row.id).then((res) => {
+          this.curRow = Object.assign({}, res.data.data);
+          this.totaldata=this.curRow.summaryItemList
+     })
+    },
+  
     handleAdd() {
       this.$refs.crud.rowAdd();
   },
@@ -681,10 +722,72 @@
     addTotal(){
       console.log('xin');
       this.tatoldialogVisible=true
+      //type=0(未被引用),type=1(已引用),type=空(全部)
+      getAllList({type:0}).then((res)=>{
+        this.tadddata=res.data.data
+      })
     },
     handleTatolClose(){
       this.tatoldialogVisible=false
-    }
+    },
+    //删除汇总项
+    rowDel1 (row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return removePay({
+            id:this.curRow.id,
+            bindId:row.id
+          });
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          getDetail(this.curRow.id).then((res) => {
+              this.curRow = Object.assign({}, res.data.data);
+              this.totaldata=this.curRow.summaryItemList
+        })
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+        });
+    },
+    selectionChange(list){
+      this.selectList=list
+    },
+    ids(arr) {
+        let ids = [];
+        arr.forEach(ele => {
+          ids.push(ele.id);
+
+        });
+        return ids.join(",");
+      },
+    //增加汇总项
+    rowSave1 (row, done, loading) {
+      addPay({
+        bindIds:this.ids(this.selectList),
+        id:this.curRow.id
+      }).then(() => {
+          this.onLoad(this.page);
+          getDetail(this.curRow.id).then((res) => {
+              this.curRow = Object.assign({}, res.data.data);
+              this.totaldata=this.curRow.summaryItemList
+        })
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+        this.tatoldialogVisible=false
+    },
 }
 }
   </script>