Przeglądaj źródła

家庭成员接口对接

rongxin_prod
QI_YUJIE 1 rok temu
rodzic
commit
c8487b4e0b
2 zmienionych plików z 135 dodań i 7 usunięć
  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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -44,13 +44,13 @@
<template #right> <template #right>
<div class="operation"> <div class="operation">
<!-- delete 删除 edit编辑 view查看 list榜单 --> <!-- delete 删除 edit编辑 view查看 list榜单 -->
<div class="opera_btn edit">
<div class="opera_btn edit" @click="householdDivision(item, index)">
<p>分户</p> <p>分户</p>
</div> </div>
<div class="opera_btn view">
<div class="opera_btn view" @click="householdTransfer(item)">
<p>移户</p> <p>移户</p>
</div> </div>
<div class="opera_btn list">
<div class="opera_btn list" @click="houseHolder(item)">
<p>设为<br/>户主</p> <p>设为<br/>户主</p>
</div> </div>
<div class="opera_btn delete" @click="deleteFamilyMember(item.id, index)"> <div class="opera_btn delete" @click="deleteFamilyMember(item.id, index)">
@@ -62,14 +62,29 @@
<!-- getDetail不加(), 第一个参数默认传递的是event,getDetail加(), 需要手动传递$event --> <!-- getDetail不加(), 第一个参数默认传递的是event,getDetail加(), 需要手动传递$event -->
<p class="btn" @click="goDetail()">新增</p> <p class="btn" @click="goDetail()">新增</p>
</div> </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> </div>
</template> </template>
<script> <script>
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import contractorHeader from "./contractorHeader"; 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 { export default {
name: "contractedVillageContractor", name: "contractedVillageContractor",
@@ -78,12 +93,15 @@
}, },
data() { data() {
return { return {
// 家庭成员列表
familyList: [],
familyList: [], // 家庭成员列表
contractorList: [], // 承包方列表
showContractorPopup: false, // 控制承包方信息弹出层的显示和隐藏
transferMemberId: null // 转出的成员ID
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getContractorList();
}, },
methods: { methods: {
getList(){ getList(){
@@ -91,6 +109,11 @@
this.familyList = response.rows; this.familyList = response.rows;
}); });
}, },
getContractorList() {
listCbf({deptId: this.$route.params.deptId}).then(response => {
this.contractorList = response.rows;
});
},
skip(name) { skip(name) {
this.$router.push({ this.$router.push({
name: name, name: name,
@@ -128,6 +151,87 @@
}).catch(() => { }).catch(() => {
// on cancel // 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
});
} }
}, },
}; };


Ładowanie…
Anuluj
Zapisz