master
xy 11 months ago
parent 3b618bbf4e
commit d6c943fabd

@ -111,9 +111,44 @@ export default {
customFn: (row) =>
row.id ? (
<span>{row.name}</span>
) : (
<el-input vModel={row._name} size="small"></el-input>
),
) : (<el-autocomplete
vModel={row._name}
size="small"
clearable={true}
value-key="name"
scopedSlots={{
default: ({ item }) => {
return `${item.hasOwnProperty('land_id') ? '房产' : '土地'}-${item.name}`
}
}}
fetch-suggestions={
(qs,cb) => {
const assets = [...this.assets.lands,...this.assets.houses];
let results = qs ? assets.filter(asset => {
let text = asset.name + asset.zuoluo
return text?.toLowerCase()?.indexOf(qs.toLowerCase()) !== -1
}) : assets;
// callback
cb(results);
}
}
on={{
select: item => {
if (item.hasOwnProperty('land_id')) {
row.id = item.id
row.land_id = item.land_id
} else {
row.id = item.id
}
},
change: e => {
if (!e.trim()) {
row.id = ''
delete row.land_id
}
}
}}>
</el-autocomplete>),
},
{
prop: "type",
@ -135,7 +170,7 @@ export default {
{
prop: "zuoluo",
label: "坐落",
width: 160,
width: 220,
align: "left",
customFn: (row) =>
row.id ? (
@ -147,7 +182,7 @@ export default {
{
prop: "xiangxiweizhi",
label: "详细位置",
width: 180,
width: 220,
customFn: (row) => {
return (
<el-input
@ -192,7 +227,8 @@ export default {
{
prop: "operate",
label: "操作",
minWidth: 160,
minWidth: 120,
fixed: "right",
customFn: (row) => {
return (
<div style="display: flex;">
@ -626,6 +662,10 @@ export default {
},
data() {
return {
assets: {
lands: [],
houses: []
},
wxAreas: new Map(),
nowAssets: [],
houseDialog: false,
@ -654,6 +694,30 @@ export default {
};
},
methods: {
getAssets() {
Promise.all([
index({
table_name: "houses",
page: 1,
page_size: 999,
filter: [],
is_more_auth: 1
},false),
index({
table_name: "lands",
page: 1,
page_size: 999,
filter: [],
is_more_auth: 1
})
]).then(res => {
const [houses,lands] = res;
this.assets = {
lands: lands.data,
houses: houses.data
}
})
},
async getWxAreas () {
try {
const res = await customFormFieldShow({ id: 120 })
@ -724,6 +788,7 @@ export default {
name: land.name,
zuoluo: land.zuoluo,
shijimianji: land.shijimianji,
let_id: item.let_id,
_chuzumianji: item.chuzumianji,
_name: item.name,
_biaodileixing: item.biaodileixing,
@ -741,6 +806,7 @@ export default {
name: house.name,
zuoluo: house.zuoluo,
shijimianji: house.shijimianji,
let_id: item.let_id,
_name: item.name,
_zuoluo: item.zuoluo,
_biaodileixing: item.biaodileixing,
@ -757,6 +823,7 @@ export default {
name: item.name,
zuoluo: item.zuoluo,
shijimianji: item.shijimianji,
let_id: item.let_id,
_name: item.name,
_zuoluo: item.zuoluo,
_biaodileixing: item.biaodileixing,
@ -784,35 +851,40 @@ export default {
});
}
// this.form.id_leases_to_assets_lease_id_relation = [];
// this.selectedHouses?.forEach(i => {
// this.form.id_leases_to_assets_lease_id_relation.push({
// house_id: i.id,
// lease_id: this.id,
// chuzumianji: i._chuzumianji
// })
// })
// this.selectedLands?.forEach(i => {
// this.form.id_leases_to_assets_lease_id_relation.push({
// land_id: i.id,
// lease_id: this.id,
// chuzumianji: i._chuzumianji
// })
// })
// this.form.id_lease_plans_lease_id_relation = this.leasePlans;
if (this.type !== "add") {
this.form['id_lets_to_assets_let_id_relation'] = this.nowAssets.map((item) => ({
id: item._relation_id,
land_id: !item.hasOwnProperty("land_id") ? item.id : "",
house_id: item.hasOwnProperty("land_id") ? item.id : "",
name: item._name,
zuoluo: item._zuoluo,
xiangxiweizhi: item._xiangxiweizhi,
biaodileixing: item._relation_i
? item.hasOwnProperty("land_id")
? "房产"
: "土地"
: item._biaodileixing,
shijimianji: item._shijimianji,
chuzumianji: item._chuzumianji,
let_id: item.let_id,
}))
}
save(Object.assign(this.form, { table_name: "lets" })).then((res) => {
if (!!this.$route.query.leaseId) {
save({ table_name: 'leases', id: this.$route.query.leaseId, let_id: res.id })
}
if (this.type !== "add") {
Promise.all(
this.originalForm.id_lets_to_assets_let_id_relation?.map((i) =>
destroy(
{
id: i.id,
table_name: "lets_to_assets",
},
false
)
)
);
// Promise.all(
// this.originalForm.id_lets_to_assets_let_id_relation?.map((i) =>
// destroy(
// {
// id: i.id,
// table_name: "lets_to_assets",
// },
// false
// )
// )
// );
}
let leaseToAssetsData = this.nowAssets.map((item) => ({
id: item._relation_id,
@ -909,6 +981,7 @@ export default {
},
},
created() {
this.getAssets()
this.getWxAreas()
this.id = this.$route.query.letId;
this.type = this.$route.query.type;
@ -917,6 +990,69 @@ export default {
if (this.type === "editor" || this.type === "change") {
this.$nextTick(() => this.getDetail());
} else {
if (!!this.$route.query.leaseId) {
show({ id: this.$route.query.leaseId, table_name: "leases" }).then(
(leaseDetail) => {
leaseDetail?.id_leases_to_assets_lease_id_relation?.forEach((item) => {
if (item.land_id) {
let land = leaseDetail.land.find(j => j.id === item.land_id);
if (land) {
this.nowAssets.push({
id: land.id,
name: land.name,
zuoluo: land.zuoluo,
zichanweizhi: land.zichanweizhi,
shijimianji: land.shijimianji,
_name: land.name,
_zuoluo: land.zuoluo,
_shijimianji: land._shijimianji,
_xiangxiweizhi: item.xiangxiweizhi,
_chuzumianji: item.chuzumianji || 0,
ORIGINAL_DATA: land,
_relation_id: item.id,
});
}
} else if (item.house_id) {
let house = leaseDetail.houses.find(j => j.id === item.house_id);
if (house) {
this.nowAssets.push({
id: house.id,
name: house.name,
zuoluo: house.zuoluo,
zichanweizhi: house.zichanweizhi,
shijimianji: house.shijimianji,
_name: house.name,
_zuoluo: house.zuoluo,
_shijimianji: house._shijimianji,
_xiangxiweizhi: item.xiangxiweizhi,
_chuzumianji: item.chuzumianji || 0,
_relation_id: item.id,
ORIGINAL_DATA: house,
land_id: house.land_id,
});
}
} else {
this.nowAssets.push({
id: "",
biaodileixing: item.biaodileixing,
name: item.name,
zuoluo: item.zuoluo,
zichanweizhi: item.zichanweizhi,
shijimianji: item.shijimianji,
_name: item.name,
_zuoluo: item.zuoluo,
_biaodileixing: item.biaodileixing,
_shijimianji: item.shijimianji,
_xiangxiweizhi: item.xiangxiweizhi,
_chuzumianji: item.chuzumianji || 0,
_relation_id: item.id,
});
}
});
}
);
}
}
});
},

@ -243,7 +243,7 @@
</div>
<xy-table
:btn-width="350"
:btn-width="300"
:row-style="rowStyle"
:auths="auths_auth_mixin"
:delay-req="true"
@ -255,6 +255,7 @@
:destroy-req-opt="select"
:table-item="table"
:btn-to-more="true"
:more-auths="['contractChange','edit','delete']"
@detail="
(row) => {
$router.push({
@ -269,6 +270,9 @@
"
@loaded="adjustAlignment"
>
<template #sign="{ row }">
<Button type="primary" size="small" @click="$router.push('/addlet'+'?leaseId='+row.id+(row.let_id ? ('&type=editor&letId=' + row.let_id) : '&type=add'))">招租管理</Button>
</template>
<template #rentCollection="{ row }">
<template>
<Button size="small" type="warning" @click="$refs['payList'].setLeaseId(row.id),$refs['payList'].show()"></Button>
@ -280,7 +284,7 @@
</template>
</template>
<template #contractChange="{ row }">
<Button size="small" type="primary" @click="$router.push('/sign/'+row.let_id+'?type=change&leaseId='+row.id)"></Button>
<a size="small" type="primary" @click="$router.push('/sign/'+row.let_id+'?type=change&leaseId='+row.id)"></a>
</template>
</xy-table>
@ -659,6 +663,73 @@ export default {
)
);
});
this.table.unshift( {
label: "资产",
prop: 'assets',
width: 300,
align: 'left',
customFn: row => {
let tags = row.id_leases_to_assets_lease_id_relation?.slice(0,1)?.map(i => {
let asset = i.house_id ? row.houses.find(j => j.id === i.house_id) : row.land.find(j => j.id === i.land_id)
return (<Tag color="success" style="background: rgb(65, 100, 227) !important;">{(i.land_id ? '【土地】' : '【房产】')+(asset?.name || i.name || " ")}</Tag>)
})
return (
<div>
{
tags.slice(0, 1)
}
<el-popover title="资产" width={600}>
<el-link slot="reference"
type="primary"
style={{
"word-break": "keep-all",
display: tags.length > 0 ? "inline" : "none",
}}>更多</el-link>
<div slot="default">
<Table size="small"
data={row.id_leases_to_assets_lease_id_relation}
columns={[
{
title: '资产名称',
key: 'name',
width: 180,
render: (h, { row: myRow }) => {
let asset = myRow.house_id ? row.houses.find(j => j.id === myRow.house_id) : row.land.find(j => j.id === myRow.land_id)
return h('span', (asset?.name || myRow.name || " "))
}
},
{
title: '坐落',
key: 'zuoluo',
minWidth: 200,
render: (h, { row: myRow }) => {
let asset = myRow.house_id ? row.houses.find(j => j.id === myRow.house_id) : row.land.find(j => j.id === myRow.land_id)
return h('span', (asset?.zuoluo || myRow.zuoluo || " "))
}
},
{
title: '详细位置',
key: 'xiangxiweizhi',
minWidth: 200
},
{
title: '出租面积',
key: 'chuzumianji',
width: 180,
render: (h, { row: myRow }) => {
let asset = myRow.house_id ? row.houses.find(j => j.id === myRow.house_id) : row.land.find(j => j.id === myRow.land_id)
return h('span', (asset?.chuzumianji || myRow.chuzumianji || " "))
}
},
]}>
</Table>
</div>
</el-popover>
</div>
)
}
})
this.table.unshift({
prop: "",
width: 60,

@ -209,13 +209,13 @@ export default {
{
prop: "zuoluo",
label: "坐落",
width: 160,
width: 220,
align: "left",
},
{
prop: "xiangxiweizhi",
label: "详细位置",
width: 180,
width: 220,
align: "left",
},
{
@ -392,7 +392,7 @@ export default {
align: "left",
customFn: row => (
row.id ?
(<span>{ row.name }</span>) :
(<span>{ row._name }</span>) :
(<el-autocomplete
vModel={row._name}
size="small"
@ -406,7 +406,10 @@ export default {
fetch-suggestions={
(qs,cb) => {
const assets = [...this.assets.lands,...this.assets.houses];
let results = qs ? assets.filter(asset => asset.name?.toLowerCase()?.indexOf(qs.toLowerCase()) === 0) : assets;
let results = qs ? assets.filter(asset => {
let text = asset.name + asset.zuoluo
return text?.toLowerCase()?.indexOf(qs.toLowerCase()) !== -1
}) : assets;
// callback
cb(results);
}
@ -414,15 +417,16 @@ export default {
on={{
select: item => {
if (item.hasOwnProperty('land_id')) {
row.house_id = item.id
row.id = item.id
row.land_id = item.land_id
} else {
row.land_id = item.id
row.id = item.id
}
},
change: e => {
if (!e.trim()) {
row.land_id = ''
row.house_id = ''
row.id = ''
delete row.land_id
}
}
}}>
@ -443,7 +447,7 @@ export default {
{
prop: "zuoluo",
label: "坐落",
width: 160,
width: 220,
align: "left",
customFn: row => (
row.id ?
@ -454,7 +458,7 @@ export default {
{
prop: "xiangxiweizhi",
label: "详细位置",
width: 180,
width: 220,
customFn: (row) => {
return (
<el-input
@ -493,7 +497,7 @@ export default {
{
prop: "operate",
label: "操作",
minWidth: 160,
minWidth: 120,
fixed: "right",
customFn: (row) => {
return (
@ -713,7 +717,7 @@ export default {
{
prop: "zuoluo",
label: "坐落",
width: 160,
width: 220,
align: "left",
customFn: row => {
let findId = row.land_id || row.house_id;
@ -725,7 +729,7 @@ export default {
{
prop: "xiangxiweizhi",
label: "详细位置",
width: 180,
width: 220,
align: "left"
},
{

Loading…
Cancel
Save