|
|
|
|
@ -45,7 +45,7 @@ import XLSX from "xlsx-js-style";
|
|
|
|
|
// import * as XLSX from "xlsx";
|
|
|
|
|
import { saveAs } from "file-saver";
|
|
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
|
|
import { imports } from "@/api/system/baseForm";
|
|
|
|
|
import { imports, index } from '@/api/system/baseForm'
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
formInfo: {
|
|
|
|
|
@ -56,16 +56,45 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
assets: {
|
|
|
|
|
lands: [],
|
|
|
|
|
houses: []
|
|
|
|
|
},
|
|
|
|
|
action: `${process.env.VUE_APP_BASE_API}api/admin/base-form/excel-show`,
|
|
|
|
|
dialogVisible: false,
|
|
|
|
|
headers: [],
|
|
|
|
|
|
|
|
|
|
tableList: [],
|
|
|
|
|
table: [],
|
|
|
|
|
fileUrl: '/租赁模版.xlsx',
|
|
|
|
|
fileUrl: './租赁模版.xlsx',
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
console.log(345, this.assets)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getToken,
|
|
|
|
|
show() {
|
|
|
|
|
this.dialogVisible = true;
|
|
|
|
|
@ -115,6 +144,7 @@ export default {
|
|
|
|
|
let linkTableName = new Map([
|
|
|
|
|
['标的类型', 'biaodileixing'],
|
|
|
|
|
['租赁标的', 'name'],
|
|
|
|
|
['详细位置', 'xiangxiweizhi'],
|
|
|
|
|
['租赁面积(m²)', 'chuzumianji']
|
|
|
|
|
])
|
|
|
|
|
let formatData = []
|
|
|
|
|
@ -137,6 +167,13 @@ export default {
|
|
|
|
|
if (merges.find(j => index > j.rs && index <= j.re)) {
|
|
|
|
|
Array.from(linkTableName.keys()).forEach((header, index1) => {
|
|
|
|
|
link[linkTableName.get(header)] = row[index1]
|
|
|
|
|
if (header === '租赁标的') {
|
|
|
|
|
if (this.assets.lands.find(i => i.name === row[index1])) {
|
|
|
|
|
link.land_id = this.assets.lands.find(i => i.name === row[index1]).id
|
|
|
|
|
} else if (this.assets.houses.find(i => i.name === row[index1])) {
|
|
|
|
|
link.house_id = this.assets.lands.find(i => i.name === row[index1]).id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
formatData[merges.find(j => index >= j.rs && index <= j.re).rs]["id_leases_to_assets_lease_id_relation"].push(link)
|
|
|
|
|
index++
|
|
|
|
|
@ -144,6 +181,13 @@ export default {
|
|
|
|
|
headers.forEach((header, index1) => {
|
|
|
|
|
if (Array.from(linkTableName.keys()).indexOf(header) !== -1) {
|
|
|
|
|
link[linkTableName.get(header)] = row[index1] instanceof Date ? this.$moment(row[index1]).format('YYYY-MM-DD') : row[index1]
|
|
|
|
|
if (header === '租赁标的') {
|
|
|
|
|
if (this.assets.lands.find(i => i.name === row[index1])) {
|
|
|
|
|
link.land_id = this.assets.lands.find(i => i.name === row[index1]).id
|
|
|
|
|
} else if (this.assets.houses.find(i => i.name === row[index1])) {
|
|
|
|
|
link.house_id = this.assets.lands.find(i => i.name === row[index1]).id
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
let field = this.formInfo.find(j => j.name === header)
|
|
|
|
|
if (field) {
|
|
|
|
|
@ -241,6 +285,9 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getAssets()
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|