浏览代码

家庭成员接口对接

rongxin_prod
QI_YUJIE 1年前
父节点
当前提交
c8487b4e0b
共有 2 个文件被更改,包括 135 次插入7 次删除
  1. +24
    -0
      src/api/contracted/cbfjtcy.js
  2. +111
    -7
      src/views/contracted/village/contractor/contractorFamily.vue

+ 24
- 0
src/api/contracted/cbfjtcy.js 查看文件

@@ -43,4 +43,28 @@ export function deleteJtcy(id) {
});
}

// 家庭成员分户
export function divisionJtcy(id) {
return request({
url: '/service/jtcy/division/' + id,
method: 'get'
});
}

// 家庭成员移户
export function transferJtcy(params) {
return request({
url: '/service/jtcy/transfer',
method: 'get',
params: params
});
}

// 家庭成员设为户主
export function setHouseholder(id) {
return request({
url: '/service/jtcy/householder/' + id,
method: 'get'
});
}


+ 111
- 7
src/views/contracted/village/contractor/contractorFamily.vue 查看文件

@@ -44,13 +44,13 @@
<template #right>
<div class="operation">
<!-- delete 删除 edit编辑 view查看 list榜单 -->
<div class="opera_btn edit">
<div class="opera_btn edit" @click="householdDivision(item, index)">
<p>分户</p>
</div>
<div class="opera_btn view">
<div class="opera_btn view" @click="householdTransfer(item)">
<p>移户</p>
</div>
<div class="opera_btn list">
<div class="opera_btn list" @click="houseHolder(item)">
<p>设为<br/>户主</p>
</div>
<div class="opera_btn delete" @click="deleteFamilyMember(item.id, index)">
@@ -62,14 +62,29 @@
<!-- getDetail不加(), 第一个参数默认传递的是event,getDetail加(), 需要手动传递$event -->
<p class="btn" @click="goDetail()">新增</p>
</div>

<van-popup v-model="showContractorPopup" position="bottom">
<van-picker
title="请选择新户主"
show-toolbar
:columns="contractorList"
@confirm="onConfirmContractorOptions"
@cancel="showContractorPopup = false"
>
<template #option="option">
<div style="display: flex; flex-direction: column; align-items: center;">
<div>{{option.cbfmc}}-{{option.cbfbm}}</div>
</div>
</template>
</van-picker>
</van-popup>

</div>
</template>
<script>
import Cookies from "js-cookie";
import contractorHeader from "./contractorHeader";
import { listJtcy, deleteJtcy } from "@/api/contracted/cbfjtcy";
import { listJtcy, deleteJtcy, divisionJtcy, transferJtcy, setHouseholder } from "@/api/contracted/cbfjtcy";
import { listCbf } from "@/api/contracted/cbf";

export default {
name: "contractedVillageContractor",
@@ -78,12 +93,15 @@
},
data() {
return {
// 家庭成员列表
familyList: [],
familyList: [], // 家庭成员列表
contractorList: [], // 承包方列表
showContractorPopup: false, // 控制承包方信息弹出层的显示和隐藏
transferMemberId: null // 转出的成员ID
};
},
created() {
this.getList();
this.getContractorList();
},
methods: {
getList(){
@@ -91,6 +109,11 @@
this.familyList = response.rows;
});
},
getContractorList() {
listCbf({deptId: this.$route.params.deptId}).then(response => {
this.contractorList = response.rows;
});
},
skip(name) {
this.$router.push({
name: name,
@@ -128,6 +151,87 @@
}).catch(() => {
// on cancel
});
},
householdDivision(item, index) {
if (item.yhzgx === '户主') {
this.$toast.fail('该成员身份为户主,不能分户');
return false;
}
this.$dialog.confirm({
message: '是否确认将该成员新分一户并设为户主?',
}).then(() => {
// on confirm
divisionJtcy(item.id).then(res => {
if (res.code == 200) {
this.$toast({
icon: 'success',
message: '分户成功',
duration: "1000",
onClose: () => {
this.familyList.splice(index, 1);
}
});
}
});
}).catch(() => {
// on cancel
});
},
householdTransfer(item) {
if (item.yhzgx === '户主') {
this.$toast.fail('该成员身份为户主,不能移户');
return false;
}
this.transferMemberId = item.id;
this.showContractorPopup = true;
},
onConfirmContractorOptions(value) {
this.$dialog.confirm({
message: '是否确认将该成员移到' + value.cbfmc + '户内?',
}).then(() => {
// on confirm
this.showContractorPopup = false;
transferJtcy({id: this.transferMemberId, cbfbm: value.cbfbm}).then(response => {
if (response.code == 200) {
this.$toast({
icon: 'success',
message: '移户成功',
duration:"1000",
onClose: () => {
const index = this.familyList.findIndex(item => item.id === this.transferMemberId);
this.familyList.splice(index, 1);
}
});
}
});
}).catch(() => {
// on cancel
});
},
houseHolder(item) {
if (item.yhzgx === '户主') {
this.$toast.fail('该成员身份为户主,无需设置');
return false;
}
this.$dialog.confirm({
message: '是否确认将该成员设为户主?',
}).then(() => {
// on confirm
setHouseholder(item.id).then(res => {
if (res.code == 200) {
this.$toast({
icon: 'success',
message: '设置户主成功',
duration: "1000",
onClose: () => {
this.getList();
}
});
}
});
}).catch(() => {
// on cancel
});
}
},
};


正在加载...
取消
保存