|
|
|
|
@ -81,7 +81,6 @@ export default {
|
|
|
|
|
<el-row gutter={10}>
|
|
|
|
|
<el-col
|
|
|
|
|
span={12}
|
|
|
|
|
style={{ display: this.isShowOldData ? "block" : "none" }}
|
|
|
|
|
>
|
|
|
|
|
<el-card style="margin-top: 20px;">
|
|
|
|
|
<div slot="header" style="display: flex;align-items: center;">
|
|
|
|
|
@ -104,15 +103,10 @@ export default {
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<xy-table
|
|
|
|
|
row-key={(row) => {
|
|
|
|
|
row._relation_id
|
|
|
|
|
? row._relation_id
|
|
|
|
|
: row.hasOwnProperty("land_id")
|
|
|
|
|
? "house_" + row.id
|
|
|
|
|
: "land_" + row.id;
|
|
|
|
|
}}
|
|
|
|
|
row-style={({ row }) => {
|
|
|
|
|
return this.originalForm.id_leases_to_assets_lease_id_relation?.find(j => ((j.land_id === row.land_id) || (j.house_id === row.house_id))) ? '' : { 'background': 'rgba(0,255,0,0.06)' }
|
|
|
|
|
if (!this.originalForm.id_hisleases_to_assets_hislease_id_relation?.find(j => ((j.land_id === row.land_id && row.land_id) || (j.house_id === row.house_id && row.house_id)))) {
|
|
|
|
|
return { 'background': 'rgba(0,255,0,0.06)' }
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
list={this.oldLease.id_leases_to_assets_lease_id_relation}
|
|
|
|
|
height="300"
|
|
|
|
|
@ -178,7 +172,7 @@ export default {
|
|
|
|
|
customFn: row => (
|
|
|
|
|
<span style={{
|
|
|
|
|
color: (() => {
|
|
|
|
|
return row.chuzumianji === this.originalForm?.id_leases_to_assets_lease_id_relation?.find(j => (j.land_id === row.land_id) || (j.house_id === row.house_id))?.chuzumianji ? '' : 'red'
|
|
|
|
|
return row.chuzumianji === this.originalForm?.id_hisleases_to_assets_hislease_id_relation?.find(j => (j.land_id === row.land_id) || (j.house_id === row.house_id))?.chuzumianji ? '' : 'red'
|
|
|
|
|
})()
|
|
|
|
|
}}>{ row.chuzumianji }</span>
|
|
|
|
|
)
|
|
|
|
|
@ -196,7 +190,7 @@ export default {
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div style="display: grid;grid-gap: 10px;grid-template-columns: repeat(3, 1fr);">
|
|
|
|
|
{this.oldLeasePlans.map((leasePlan, index) => (
|
|
|
|
|
{this.oldLease?.id_lease_plans_lease_id_relation?.map((leasePlan, index) => (
|
|
|
|
|
<Card padding={10}>
|
|
|
|
|
<div
|
|
|
|
|
slot="title"
|
|
|
|
|
@ -260,14 +254,7 @@ export default {
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<xy-table
|
|
|
|
|
row-key={(row) => {
|
|
|
|
|
row._relation_id
|
|
|
|
|
? row._relation_id
|
|
|
|
|
: row.hasOwnProperty("land_id")
|
|
|
|
|
? "house_" + row.id
|
|
|
|
|
: "land_" + row.id;
|
|
|
|
|
}}
|
|
|
|
|
list={this.originalForm.id_leases_to_assets_lease_id_relation}
|
|
|
|
|
list={this.originalForm.id_hisleases_to_assets_hislease_id_relation}
|
|
|
|
|
row-style={({ row }) => {
|
|
|
|
|
return this.oldLease.id_leases_to_assets_lease_id_relation?.find(j => ((j.land_id === row.land_id) || (j.house_id === row.house_id))) ? '' : { 'background': 'rgba(255,0,0,0.06)' }
|
|
|
|
|
}}
|
|
|
|
|
@ -343,7 +330,7 @@ export default {
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div style="display: grid;grid-gap: 10px;grid-template-columns: repeat(3, 1fr);">
|
|
|
|
|
{this.leasePlans.map((leasePlan, index) => (
|
|
|
|
|
{this.originalForm?.id_hislease_plans_hislease_id_relation?.map((leasePlan, index) => (
|
|
|
|
|
<Card padding={10}>
|
|
|
|
|
<div
|
|
|
|
|
slot="title"
|
|
|
|
|
@ -365,6 +352,7 @@ export default {
|
|
|
|
|
<el-date-picker
|
|
|
|
|
style="width: 100%;"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
disabled={true}
|
|
|
|
|
vModel={leasePlan.zujindiyicidaoweishijian}
|
|
|
|
|
></el-date-picker>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
@ -372,6 +360,7 @@ export default {
|
|
|
|
|
<el-input-number
|
|
|
|
|
controls={false}
|
|
|
|
|
precision={2}
|
|
|
|
|
disabled={true}
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
vModel={leasePlan.yingshou}
|
|
|
|
|
></el-input-number>
|
|
|
|
|
@ -489,12 +478,11 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.form = Object.assign({}, this.form);
|
|
|
|
|
this.leasePlans = res.id_lease_plans_lease_id_relation;
|
|
|
|
|
this.originalForm = deepCopy(res);
|
|
|
|
|
|
|
|
|
|
if (this.originalForm.original_lease_id) {
|
|
|
|
|
if (res.original_lease_id) {
|
|
|
|
|
const oldLease = await show({
|
|
|
|
|
id: this.originalForm.original_lease_id,
|
|
|
|
|
id: res.original_lease_id,
|
|
|
|
|
table_name: "leases"
|
|
|
|
|
})
|
|
|
|
|
this.oldLease = oldLease;
|
|
|
|
|
@ -509,100 +497,6 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
|
if (this.type === "add") {
|
|
|
|
|
if (this.form.hasOwnProperty("id")) {
|
|
|
|
|
delete this.form.id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.type === "editor" || this.type === "change") {
|
|
|
|
|
Object.defineProperty(this.form, "id", {
|
|
|
|
|
value: this.id,
|
|
|
|
|
enumerable: true,
|
|
|
|
|
configurable: true,
|
|
|
|
|
writable: true,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.form.let_id = this.$route.params.letId;
|
|
|
|
|
save(Object.assign(this.form, { table_name: "leases" })).then((res) => {
|
|
|
|
|
if (this.type !== "add") {
|
|
|
|
|
Promise.all([
|
|
|
|
|
...this.originalForm.id_leases_to_assets_lease_id_relation?.map(
|
|
|
|
|
(i) =>
|
|
|
|
|
destroy(
|
|
|
|
|
{
|
|
|
|
|
id: i.id,
|
|
|
|
|
table_name: "leases_to_assets",
|
|
|
|
|
},
|
|
|
|
|
false
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
...this.originalForm.id_lease_plans_lease_id_relation?.map((i) =>
|
|
|
|
|
destroy(
|
|
|
|
|
{
|
|
|
|
|
id: i.id,
|
|
|
|
|
table_name: "lease_plans",
|
|
|
|
|
},
|
|
|
|
|
false
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
let leaseToAssetsData = this.nowAssets.map((item) => ({
|
|
|
|
|
id: item._relation_id,
|
|
|
|
|
land_id: !item.hasOwnProperty("land_id") ? item.id : "",
|
|
|
|
|
house_id: item.hasOwnProperty("land_id") ? item.id : "",
|
|
|
|
|
chuzumianji: item._chuzumianji,
|
|
|
|
|
lease_id: res.id,
|
|
|
|
|
}));
|
|
|
|
|
if (leaseToAssetsData && leaseToAssetsData.length > 0) {
|
|
|
|
|
imports(
|
|
|
|
|
{
|
|
|
|
|
table_name: "leases_to_assets",
|
|
|
|
|
data: leaseToAssetsData,
|
|
|
|
|
},
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
let leasePlansData = this.leasePlans.map((item) => ({
|
|
|
|
|
...item,
|
|
|
|
|
lease_id: res.id,
|
|
|
|
|
}));
|
|
|
|
|
if (leasePlansData && leasePlansData.length > 0) {
|
|
|
|
|
imports({
|
|
|
|
|
table_name: "lease_plans",
|
|
|
|
|
data: leasePlansData,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//变更保存日志
|
|
|
|
|
if (this.type === "change") {
|
|
|
|
|
let logData = deepCopy(this.originalForm)
|
|
|
|
|
logData.original_lease_id = logData.id;
|
|
|
|
|
delete logData.id;
|
|
|
|
|
for (let key in logData) {
|
|
|
|
|
if (/_relation/g.test(key)) {
|
|
|
|
|
logData[key].forEach(item => {
|
|
|
|
|
delete item.id;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
save(
|
|
|
|
|
{
|
|
|
|
|
...logData,
|
|
|
|
|
table_name: "leases_histories",
|
|
|
|
|
biangengshijian: this.$moment().format("YYYY-MM-DD HH:mm:ss")
|
|
|
|
|
},
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
this.$Message.success({
|
|
|
|
|
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
|
|
|
|
|
});
|
|
|
|
|
this.$emit("refresh");
|
|
|
|
|
this.$router.push("/lease");
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
computed: {},
|
|
|
|
|
watch: {
|
|
|
|
|
@ -633,7 +527,6 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
console.log(this.$refs['oldElForm'])
|
|
|
|
|
this.$refs['oldElForm'].validate()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|