master
xy 2 years ago
parent 5ccf6a63ae
commit d531e6f014

@ -6,7 +6,7 @@
<img src="../../../assets/logo-mini.png?v=1" class="sidebar-logo">
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img src="../../../assets/logo-mini.png?v=1" class="sidebar-logo">
<!-- <img src="../../../assets/logo-mini.png?v=1" class="sidebar-logo">-->
<img src="../../../assets/logo.png?v=2" class="sidebar-name-logo" />
</router-link>
</transition>
@ -36,7 +36,7 @@
transition: opacity 1.5s;
}
.sidebar-name-logo {
width: 150px;
width: 94%;
object-fit: contain;
}

@ -89,3 +89,7 @@
text-align: right;
}
}
.el-menu-item,.el-submenu__title,.el-table,.el-descriptions,.v-table .el-table__header th {
font-size: 15px!important;
}

@ -79,7 +79,7 @@
}
}
.el-submenu .is-active{
background-color: $menuHover !important;
// background-color: $menuHover !important;
}

@ -0,0 +1,826 @@
<script>
import { save, show, index, destroy, imports } from "@/api/system/baseForm";
import { CreateDialog } from "@/utils/createDialog"
import { deepCopy } from "@/utils";
import { resolveFormInfo } from '@/utils/createTable'
export default {
components: {
},
props: {
tableName: String,
},
render(h) {
const _this = this;
let dialog = new CreateDialog(this,[
],{}, false)
return (
<div>
<el-card style="margin-top: 20px;">
<div slot="header" style="display: flex;align-items: center;">
<i class="el-icon-back"
style="padding-right: 20px;font-size: 20px;font-weight: 600;cursor: pointer;"
on={{
['click']: _ => {
this.$router.go(-1)
}
}}></i>
<p>{ (() => {
let title = new Map([
['add', '新增资产处置'],
['editor', '资产处置编辑']
])
return title.get(this.type)
})() }</p>
</div>
{/* 资产信息 */}
<div style="margin-bottom: 10px;">
<div style="display: flex;margin-bottom: 10px;align-items: center;">
<p style="font-weight: 700;line-height: 2;">资产信息</p>
<div style="margin-left: auto;">
<Button type="primary"
shape="circle"
on={{
['click']: _ => {
this.landDialog = true;
}
}}>选择土地</Button>
<Button type="primary"
shape="circle"
on={{
['click']: _ => {
this.houseDialog = true;
}
}}>选择房产</Button>
</div>
</div>
<xy-table
row-key={
row => {
row._relation_id ? row._relation_id : (row.hasOwnProperty('land_id') ? 'house_' + row.id : 'land_' + row.id)
}
}
ref="assetsTable"
list={this.nowAssets}
height="300"
isHandlerKey={false}
is-page={false}
table-item={
[
{
"prop": "name",
"label": "地块名称",
"width": 0,
"fixed": "left",
"align": "left"
},
{
"prop": "zuoluo",
"label": "坐落",
"width": 0,
"align": "left"
},
{
"prop": "dengjimianji",
"label": "登记面积",
"width": 0,
"align": "center"
},
{
"prop": "_chuzhimianji",
"label": "处置面积",
"width": 160,
customFn: row => {
return (
<el-input-number controls={false} precision={2} vModel={row._chuzhimianji} size="small"></el-input-number>
)
}
},
{
prop: "operate",
label: "操作",
width: 160,
customFn: row => {
return (
<div style="display: flex;">
<Button type="error"
size="small"
ghost={true}
on={{
['click']: _ => {
this.$confirm("确定删除?").then(_ => {
if (row.hasOwnProperty("land_id")) {
this.$refs["houseLinkTable"]?.toggleRowSelection(
this.$refs["houseLinkTable"].getListData().find(i => i.id === row.id)
,false)
} else {
this.$refs["landLinkTable"]?.toggleRowSelection(
this.$refs["landLinkTable"].getListData().find(i => i.id === row.id)
,false)
}
if (row._relation_id) {
destroy({ table_name: "asset_handles_to_assets", id: row._relation_id },false).then(_ => {
this.nowAssets.splice(this.nowAssets.findIndex(j => j._relation_id === row._relation_id),1)
})
}
})
}
}}>删除</Button>
</div>
)
}
}
]
}></xy-table>
</div>
{
dialog.render()
}
</el-card>
<el-drawer title="土地列表"
visible={this.landDialog}
size="64%"
on={{
['update:visible']: (val) => this.landDialog = val,
}}>
<div style="padding: 0 10px;">
<div>
<Input vModel={this.landSelect.keyword} style="width: 300px;" placeholder="请填写关键词"/>
<Button type="primary"
style="margin-left: 10px;"
on={{
['click']: _ => {
this.$refs['landLinkTable'].getTableData(true)
}
}}>搜索</Button>
</div>
<xy-table
isHandlerKey={false}
height="600"
ref="landLinkTable"
table-item={
[
{
type: "selection",
width: 56,
align: "center",
reserveSelection: true,
fixed: "left",
},
{
"prop": "id",
"width": 60,
"label": "序号"
},
{
"prop": "tudiquanshuren",
"label": "土地权属人",
"width": 0,
"align": "left"
},
{
"prop": "area",
"label": "区域",
"width": 0,
"align": "center"
},
{
"prop": "name",
"label": "地块名称",
"width": 0,
"align": "left",
"fixed": "left"
},
{
"prop": "tudizhenghao",
"label": "土地证号",
"width": 0,
"align": "left"
},
{
"prop": "zuoluo",
"label": "坐落",
"width": 0,
"align": "left"
},
{
"prop": "zichanweizhi",
"label": "资产位置",
"width": 0,
"align": "center"
},
{
"prop": "quanliren",
"label": "证载“权利人”",
"width": 0,
"align": "left"
},
{
"prop": "gongyouqingkuang",
"label": "共有情况",
"width": 0,
"align": "center"
},
{
"prop": "shiyongnianxian",
"label": "使用年限(年)",
"width": 0,
"align": "center"
},
{
"prop": "xianzhuang",
"label": "现状",
"width": 0,
"align": "center"
},
{
"prop": "yongtu",
"label": "用途",
"width": 0,
"align": "left"
},
{
"prop": "shiyongquanleixing",
"label": "使用权类型",
"width": 0,
"align": "center"
},
{
"prop": "lingzhengriqi",
"label": "领证日期",
"width": 0,
"align": "center"
},
{
"prop": "zhongzhiriqi",
"label": "终止日期",
"width": 0,
"align": "center"
},
{
"prop": "dengjimianji",
"label": "登记面积",
"width": 0,
"align": "center"
},
{
"prop": "shijimianji",
"label": "实际面积",
"width": 0,
"align": "center"
},
{
"label": "不符情况",
"width": 0
},
{
"prop": "bufuyuanyin",
"label": "不符原因",
"width": 0,
"align": "center"
},
{
"prop": "ruzhangshijian",
"label": "入账时间",
"width": 0,
"align": "center"
},
{
"prop": "zhangmianyuanzhi",
"label": "账面原值",
"width": 0,
"align": "center"
},
{
"prop": "tudidengji",
"label": "土地等级",
"width": 0,
"align": "center"
},
{
"prop": "tudishuidanjia",
"label": "土地税单价",
"width": 0,
"align": "center"
},
{
"prop": "tudishui",
"label": "土地税",
"width": 0,
"align": "center"
},
{
"prop": "tudishuijiaonazhuti",
"label": "土地税缴纳主体",
"width": 0,
"align": "center"
},
{
"prop": "jiaoshuijine",
"label": "缴税金额",
"width": 0,
"align": "center"
}
]
}
action={this.index}
req-opt={this.landSelect}
on={{
['loaded']: _ => {
this.$nextTick(() => {
this.$refs['landLinkTable'].getListData()?.filter(item => this.nowAssets?.find(j => j.id === item.id && !j.hasOwnProperty('land_id')))?.forEach(item => {
this.$refs['landLinkTable'].toggleRowSelection(item, true)
})
})
},
['select']: (selection, row) => {
if (selection.find(i => i.id === row.id)) {
this.nowAssets.push({
id: row.id,
name: row.name,
zuoluo: row.zuoluo,
zichanweizhi: row.zichanweizhi,
dengjimianji: row.dengjimianji,
_chuzhimianji: 0,
_relation_id: "",
})
} else {
let index = this.nowAssets.findIndex(i => i.id === row.id && !i.hasOwnProperty('land_id') )
let temp = this.nowAssets.splice(index, 1)
if (temp._relation_id) {
destroy({
table_name: "asset_handles_to_assets",
id: temp._relation_id
},false)
}
}
}
}}
></xy-table>
</div>
</el-drawer>
<el-drawer title="房产列表"
visible={this.houseDialog}
size="64%"
on={{
['update:visible']: (val) => this.houseDialog = val,
}}>
<div style="padding: 0 10px;">
<div>
<Input vModel={this.houseSelect.keyword} style="width: 300px;" placeholder="请填写关键词"/>
<Button type="primary"
style="margin-left: 10px;"
on={{
['click']: _ => {
this.$refs['houseLinkTable'].getTableData(true)
}
}}>搜索</Button>
</div>
<xy-table
isHandlerKey={false}
height="600"
ref="houseLinkTable"
table-item={
[
{
type: "selection",
width: 56,
align: "center",
reserveSelection: true,
fixed: "left"
},
{
"prop": "id",
"width": 60,
"label": "序号"
},
{
"prop": "quanshuren",
"label": "权属人",
"width": 0,
"align": "center"
},
{
"prop": "area",
"label": "区域",
"width": 0,
"align": "center"
},
{
"prop": "name",
"label": "地块名称",
"width": 0,
"fixed": "left",
"align": "left"
},
{
"prop": "quanzhenghao",
"label": "权证号",
"width": 0,
"align": "center"
},
{
"prop": "zuoluo",
"label": "坐落",
"width": 0,
"align": "left"
},
{
"prop": "zichanweizhi",
"label": "房产位置",
"width": 0,
"align": "center"
},
{
"prop": "quanliren",
"label": "证载“权利人”",
"width": 0,
"align": "center"
},
{
"prop": "yongtu",
"label": "用途",
"width": 0,
"align": "left"
},
{
"prop": "zhuangtai",
"label": "现状",
"width": 0,
"align": "left"
},
{
"prop": "dengjishijian",
"label": "登记时间",
"width": 0,
"align": "center"
},
{
"prop": "dengjimianji",
"label": "登记面积",
"width": 0,
"align": "center"
},
{
"prop": "shijimianji",
"label": "实际面积",
"width": 0,
"align": "center"
},
{
"prop": "bufuyuanyin",
"label": "不符情况",
"width": 0,
"align": "center"
},
{
"prop": "ruzhangshijian",
"label": "入账时间",
"width": 0,
"align": "center"
},
{
"prop": "zhangmianyuanzhi",
"label": "账面原值",
"width": 0,
"align": "center"
},
{
"prop": "guanliantudizhengquanzheng",
"label": "关联土地证权证",
"width": 0,
"align": "center"
},
{
"prop": "shiyongzhuangtai",
"label": "使用状态",
"width": 0,
"align": "center"
}
]
}
action={this.index}
req-opt={this.houseSelect}
on={{
['loaded']: _ => {
this.$nextTick(() => {
this.$refs['houseLinkTable'].getListData()?.filter(item => this.nowAssets?.find(j => j.id === item.id && j.hasOwnProperty('land_id')))?.forEach(item => {
this.$refs['houseLinkTable'].toggleRowSelection(item, true)
})
})
},
['select']: (selection, row) => {
if (selection.find(i => i.id === row.id)) {
this.nowAssets.push({
id: row.id,
name: row.name,
zuoluo: row.zuoluo,
zichanweizhi: row.zichanweizhi,
dengjimianji: row.dengjimianji,
_chuzhimianji: 0,
_relation_id: "",
land_id: row.land_id
})
} else {
let index = this.nowAssets.findIndex(i => i.id === row.id && i.hasOwnProperty('land_id') )
let temp = this.nowAssets.splice(index, 1)
if (temp._relation_id) {
destroy({
table_name: "asset_handles_to_assets",
id: temp._relation_id
},false)
}
}
}
}}
></xy-table>
</div>
</el-drawer>
</div>
)
},
data() {
return {
nowAssets: [],
houseDialog: false,
landDialog: false,
leasePlans: [],
landSelect: {
table_name: "lands",
keyword: ""
},
houseSelect: {
table_name: "houses",
keyword: ""
},
columns: 1,
row: {},
formInfo: [],
id: "",
type: "add",
form: {},
originalForm: {},
rules: {},
file: {},
};
},
methods: {
index,
setRow (row) {
this.row = row
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["elForm"].clearValidate();
},
setType(type = "add") {
let types = ["add", "editor"];
if (types.includes(type)) {
this.type = type;
} else {
console.warn("Unknown type: " + type);
}
},
setId(id) {
if (typeof id == "number") {
this.id = id;
} else {
console.error("error typeof id: " + typeof id);
}
},
async getDetail() {
const res = await show({ id: this.id, table_name: 'asset_handles' });
this.$integrateData(this.form, res);
this.formInfo.forEach((i) => {
if (i.edit_input === "file") {
}
if (i.edit_input === "files") {
this.file[i.field] = res[`${i.field}_upload_details`]
}
});
this.form = Object.assign({}, this.form);
this.originalForm = deepCopy(res);
this.originalForm?.asset_handles_to_assets?.forEach(item => {
if (item.land_id) {
let land = item.lands;
if (land) {
this.nowAssets.push({
id: land.id,
name: land.name,
zuoluo: land.zuoluo,
zichanweizhi: land.zichanweizhi,
dengjimianji: land.dengjimianji,
_chuzhimianji: item.chuzhimianji||0,
_relation_id: item.id,
});
}
} else {
let house = item.house;
if (house) {
this.nowAssets.push({
id: house.id,
name: house.name,
zuoluo: house.zuoluo,
zichanweizhi: house.zichanweizhi,
dengjimianji: house.dengjimianji,
_chuzhimianji: item.chuzhimianji||0,
_relation_id: item.id,
land_id: house.land_id,
});
}
}
})
},
submit() {
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
}
if (this.type === "editor") {
Object.defineProperty(this.form, "id", {
value: this.id,
enumerable: true,
configurable: true,
writable: true,
});
}
// 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;
save(Object.assign(this.form, { table_name: 'asset_handles' })).then(res => {
Promise.all(this.originalForm.id_asset_handles_to_assets_handles_id_relation?.map(i => destroy({
id: i.id,
table_name: "asset_handles_to_assets"
},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 : "",
chuzhimianji: item._chuzhimianji,
let_id: res.id
}));
if (leaseToAssetsData && leaseToAssetsData.length > 0) {
imports({
table_name: "asset_handles_to_assets",
data: leaseToAssetsData
},false)
}
this.$Message.success({
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
});
this.$emit("refresh");
this.$router.back();
})
},
},
computed: {
},
watch: {
formInfo: {
handler: function (newVal) {
this.form = {};
this.rules = {};
this.file = {};
newVal.forEach((i) => {
if (i.field) {
this.form[i.field] = "";
if (
i.validation instanceof Array &&
i.validation.length > 0 &&
!!i.validation.find((i) => i === "required")
) {
this.rules[i.field] = [
{ required: true, message: `请填写${i.name}` },
];
}
if (i.edit_input === "files") {
this.form[i.field] = [];
}
if (i.edit_input === "files" || i.edit_input === "file") {
this.file[i.field] = [];
}
if (i.edit_input === "checkbox") {
this.form[i.field] = [];
}
if (i._relations) {
this.form[i._relations?.link_with_name] = [];
}
}
});
this.columns = newVal.length > 11 ? '2' : '1'
},
//immediate: true,
},
dialogVisible(val) {
if (val) {
document.documentElement.style.setProperty(
"--column-num",
this.columns
);
if (this.type === "editor" || this.type === "change") {
this.$nextTick(() => this.getDetail());
}
} else {
this.id = "";
this.type = "";
this.init();
this.$refs["elForm"].clearValidate();
delete this.form.id;
for (let key in this.file) {
this.file[key] = [];
}
this.$refs['landLinkTable'].clearSelection();
this.$refs['houseLinkTable'].clearSelection();
}
},
},
created() {
this.id = this.$route.query.id;
this.type = this.$route.query.type;
resolveFormInfo(27).then(res => {
this.formInfo = res;
if (this.type === "editor" || this.type === "change") {
this.$nextTick(() => this.getDetail());
}
})
},
mounted() {
},
beforeDestroy() {
this.id = "";
this.type = "";
this.init();
this.$refs["elForm"].clearValidate();
delete this.form.id;
for (let key in this.file) {
this.file[key] = [];
}
}
};
</script>
<style>
:root {
--column-num: 2;
}
</style>
<style scoped lang="scss">
.uploaded-a {
color: red;
text-decoration: none;
transition: all 0.2s;
}
.uploaded-a:hover {
color: red;
text-decoration: underline;
}
.form-body {
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(var(--column-num), 1fr);
}
::v-deep .el-input-number input {
text-align: right;
}
</style>

@ -47,7 +47,6 @@
</div>
<el-descriptions
border
size="small"
:column="2"
:label-style="{ 'font-weight': '600' }"
>
@ -110,7 +109,7 @@
<!-- </template>-->
<!-- </template>-->
<!-- </el-card>-->
<el-card id="detail-link-land" v-if="/\/house/g.test($route.path)">
<el-card id="detail-link-land" v-if="/\/house/g.test($route.path) && (detail.land_id_lands_id_relation && detail.land_id_lands_id_relation.length > 0)">
<div class="el-descriptions__header el-descriptions__title">
<p>关联土地</p>
@ -122,7 +121,6 @@
<el-descriptions
v-if="detail.land_id_lands_id_relation"
border
size="small"
:column="2"
:label-style="{ 'font-weight': '600' }"
>
@ -134,7 +132,7 @@
</el-descriptions>
<el-empty v-else description="暂无关联土地"></el-empty>
</el-card>
<el-card id="detail-link-houses" v-if="/\/land/g.test($route.path)">
<el-card id="detail-link-houses" v-if="/\/land/g.test($route.path) && detail.id_houses_land_id_relation">
<div class="el-descriptions__header el-descriptions__title">
关联房产
</div>
@ -649,6 +647,7 @@ export default {
prop: "operate",
label: "查看",
align: 'center',
fixed: "right",
customFn: row => (
<div>
<Button type="primary"

@ -0,0 +1,674 @@
<template>
<div>
<!-- 查询配置 -->
<div>
<div ref="lxHeader">
<LxHeader
:icon="$route.meta.icon"
:text="$route.meta.title"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
>
<div slot="content"></div>
<slot>
<header-content :auths="auths_auth_mixin">
<template #search>
<div style="display: flex">
<Select
v-model="select.filter[0].key"
style="width: 100px"
placeholder="搜索条目"
>
<Option
v-for="item in form"
:key="item.id"
:value="item.field"
>{{ item.name }}</Option
>
</Select>
<Select
v-model="select.filter[0].op"
style="width: 100px; margin-left: 10px"
placeholder="搜索条件"
>
<Option
v-for="item in op"
:key="item.value"
:value="item.value"
>{{ item.label }}</Option
>
</Select>
<template
v-if="
select.filter[0].op !== 'range' &&
!columnArrTest(select.filter[0].key)
"
>
<Input
v-model="select.filter[0].value"
style="width: 150px; margin-left: 10px"
placeholder="请填写关键词"
/>
</template>
<template
v-else-if="
select.filter[0].op !== 'range' &&
columnArrTest(select.filter[0].key)
"
>
<Select
v-model="select.filter[0].value"
style="width: 150px; margin-left: 10px"
placeholder="请选择关键词"
>
<Option
v-for="item in getColumnParams(select.filter[0].key)"
:key="item.id"
:value="getColumnField(select.filter[0].key)._relations ? item[getColumnField(select.filter[0].key)._relations.foreign_key] : item.value"
>{{
item.key || item.value || item.name || item.no || item.mingcheng || item.id
}}</Option
>
</Select>
</template>
<template v-else>
<Input
:value="select.filter[0].value.split(',')[0]"
style="width: 150px; margin-left: 10px"
placeholder="范围开始关键词"
@input="(e) => inputStartHandler(e, select.filter[0])"
/>
<span
style="
margin-left: 10px;
display: flex;
align-items: center;
"
></span
>
<Input
:value="select.filter[0].value.split(',')[1]"
style="width: 150px; margin-left: 10px"
placeholder="范围结束关键词"
@input="(e) => inputEndHandler(e, select.filter[0])"
/>
</template>
<Button
style="margin-left: 10px"
type="primary"
@click="$refs['xyTable'].getTableData(true)"
>查询</Button
>
<xy-selectors
style="margin-left: 10px"
@reset="reset"
@search="$refs['xyTable'].getTableData(true)"
>
<template>
<div class="select">
<div
class="select__item"
v-for="(item, index) in select.filter"
:key="`${item.value}-${index}`"
>
<p>条件{{ index + 1 }}</p>
<Select
v-model="item.key"
style="width: 100px"
placeholder="搜索条目"
>
<Option
v-for="item in form"
:key="item.id"
:value="item.field"
>{{ item.name }}</Option
>
</Select>
<Select
v-model="item.op"
style="width: 100px; margin-left: 10px"
placeholder="搜索条件"
>
<Option
v-for="item in op"
:key="item.value"
:value="item.value"
>{{ item.label }}</Option
>
</Select>
<template
v-if="
item.op !== 'range' && !columnArrTest(item.key)
"
>
<Input
v-model="item.value"
style="width: 150px; margin-left: 10px"
placeholder="请填写关键词"
/>
</template>
<template
v-else-if="
item.op !== 'range' && columnArrTest(item.key)
"
>
<Select
v-model="item.value"
style="width: 150px; margin-left: 10px"
placeholder="请选择关键词"
>
<Option
v-for="item in getColumnParams(item.key)"
:key="item.id"
:value="getColumnField(item.key)._relations ? item[getColumnField(item.key)._relations.foreign_key] : item.value"
>{{
item.key || item.value || item.name || item.no || item.mingcheng || item.id
}}</Option
>
</Select>
</template>
<template v-else>
<Input
:value="item.value.split(',')[0]"
style="width: 150px; margin-left: 10px"
placeholder="范围开始关键词"
@input="(e) => inputStartHandler(e, item)"
/>
<span style="margin-left: 10px"></span>
<Input
:value="item.value.split(',')[1]"
style="width: 150px; margin-left: 10px"
placeholder="范围结束关键词"
@input="(e) => inputEndHandler(e, item)"
/>
</template>
<el-button
v-if="index !== 0"
size="small"
type="danger"
icon="el-icon-delete"
circle
style="margin-left: 10px"
@click="select.filter.splice(index, 1)"
></el-button>
</div>
</div>
<div class="add-btn">
<el-button
size="small"
type="primary"
icon="el-icon-plus"
circle
@click="
select.filter.push({ key: '', op: '', value: '' })
"
></el-button>
<span>新增一条</span>
</div>
</template>
</xy-selectors>
</div>
</template>
<template #create>
<Button
type="primary"
@click="
$router.push('/assets/handle?type=add')
"
>新增</Button
>
</template>
<template #import>
<Button type="primary" @click="$refs['imports'].show()"
>导入</Button
>
</template>
<template #export>
<Button
type="primary"
@click="exportExcel(new Date().getTime().toString())"
>导出</Button
>
</template>
</header-content>
</slot>
</LxHeader>
</div>
</div>
<xy-table
:btn-width="300"
:auths="auths_auth_mixin"
:delay-req="true"
:destroy-action="destroy"
ref="xyTable"
:border="true"
:action="index"
:req-opt="select"
:destroy-req-opt="select"
:table-item="table"
@detail="
(row) => {
$router.push({
path: '/handleDetail/' + row.id
})
}
"
@editor="
(row) => {
$router.push('/assets/handle?id='+row.id+'&type=editor')
}
"
@loaded="adjustAlignment"
>
</xy-table>
<drawer
:table-name="customForm.tableName"
:form-info="form"
ref="drawer"
></drawer>
<imports
:table-name="customForm.tableName"
:form-info="form"
ref="imports"
@refresh="$refs['xyTable'].getTableData()"
></imports>
</div>
</template>
<script>
import { index as fieldIndex } from "@/api/system/customFormField";
import { authMixin } from "@/mixin/authMixin";
import { index, destroy } from "@/api/system/baseForm";
import { op } from "@/const/op";
import { download } from "@/utils/downloadRequest";
import { getparameter } from "@/api/system/dictionary";
import { show } from "@/api/system/customForm";
import * as XLSX from "xlsx";
import { saveAs } from "file-saver";
import { listdept } from "@/api/system/department"
import LxHeader from "@/components/LxHeader/index.vue";
import headerContent from "@/components/LxHeader/XyContent.vue";
import drawer from "@/views/component/drawer.vue";
import imports from "@/views/component/imports.vue";
export default {
name: 'tableList',
components: {
LxHeader,
headerContent,
drawer,
imports,
},
mixins: [authMixin],
provide: {
formStore: () => this.form,
},
data() {
return {
firstAdjustTable: true,
op,
select: {
table_name: "",
filter: [
{
key: "",
op: "",
value: "",
},
],
},
form: [],
table: [],
customForm: {
customFormId: "",
tableName: "",
},
};
},
methods: {
index,
destroy,
download,
reset() {
this.select.filter.splice(1);
this.select.filter[0] = {
key: "",
op: "",
value: "",
};
},
async exportExcel(sheetName) {
const res = await index(
Object.assign(this.select, { page: 1, page_size: 9999 })
);
if (res.data) {
let headers = this.form.map((i) => {
return {
key: i.field,
title: i.name,
};
});
const data = res.data.map((row) =>
headers.map((header) => row[header.key])
);
data.unshift(headers.map((header) => header.title));
const wb = XLSX.utils.book_new();
const ws = XLSX.utils.aoa_to_sheet(data);
XLSX.utils.book_append_sheet(wb, ws, sheetName);
const wbout = XLSX.write(wb, {
bookType: "xlsx",
bookSST: true,
type: "array",
});
saveAs(
new Blob([wbout], { type: "application/octet-stream" }),
`${sheetName}.xlsx`
);
}
},
//target
inputStartHandler(e, target) {
let temp = target?.value.split(",")[1];
target.value = `${e},${temp ? temp : ""}`;
},
inputEndHandler(e, target) {
let temp = target?.value.split(",")[0];
target.value = `${temp ? temp : ""},${e}`;
},
async getFormDetail() {
if (this.$route.meta.params?.custom_form) {
let decode = decodeURIComponent(this.$route.meta.params?.custom_form);
try {
let custom_form = JSON.parse(decode);
this.customForm.customFormId = custom_form.custom_form_id;
this.customForm.tableName = custom_form.table_name;
this.select.table_name = custom_form.table_name;
} catch (err) {
console.warn(err);
}
}
const res = await show({ id: this.customForm.customFormId }, false);
//
//
let baseTable = new Map([
['departments', async () => {
const res = await listdept()
return res
}],
['admins',[]]
])
let { fields, relation } = res;
let fieldRes = fields.sort((a,b) => a.sort - b.sort)
if (
!fields ||
!relation ||
!fields instanceof Array ||
!relation instanceof Array
) {
throw new Error("fields或relation格式错误");
}
console.log(fieldRes)
fieldRes?.forEach((i, index) => {
i._relations = relation.find(
(j) => j.link_table_name.split("_")[1] === i.field
) || relation.find(
(j) => j.local_key === i.field
);
if (i.select_item && typeof i.select_item === "object" && !(i.select_item instanceof Array)) {
let keys = Object.keys(i.select_item)
if (keys.length > 0) {
i._params = keys.map((key) => {
return {
key,
value: /^\d*$/.test(i.select_item[key])
? Number(i.select_item[key])
: i.select_item[key],
};
});
//select,radio
i.edit_input = 'radio'
}
}
if (i.edit_input === 'file' || i.edit_input === 'files') {
return
}
if (i._relations) {
if (baseTable.get(i._relations.link_table_name)) {
baseTable
.get(i._relations.link_table_name)()
.then((res) => {
i._params = res.data;
});
} else {
i._params = i._relations.parameter_id
? getparameter({ id: i._relations.parameter_id }, false).then(
(res) => {
i._params = res.detail;
}
)
: this.index({
table_name: i._relations.link_table_name,
page: 1,
page_size: 9999,
}).then((res) => {
i._params = res.data;
});
}
}
});
this.form = fieldRes || [];
this.form
?.filter((i) => i.list_show)
.forEach((i) => {
let linkOb = {};
if (i.edit_input === "richtext") {
linkOb.customFn = (row) => {
return (
<div
style={{ "max-height": "55px","overflow": "scroll" }}
domPropsInnerHTML={row[i.field]}
></div>
);
};
}
if (
i.select_item &&
typeof i.select_item === "object" &&
!(i.select_item instanceof Array)
) {
let keys = Object.keys(i.select_item);
linkOb.customFn = (row) => {
let paramMap = new Map();
keys.forEach((key) => {
paramMap.set(i.select_item[key], key);
});
return <span>{ paramMap.get(row[i.field]) ? paramMap.get(row[i.field].toString()) : row[i.field] }</span>;
};
}
if (i._relations) {
let { link_relation, foreign_key, link_with_name } = i._relations;
if (link_relation === "newHasOne" || link_relation === "hasOne") {
linkOb.customFn = (row) => {
if (i.edit_input === "file") {
return (
<a
download={row[link_with_name]?.original_name}
href={row[link_with_name]?.url}
>
{row[link_with_name]?.original_name}
</a>
);
} else {
return (
<span>
{row[link_with_name]?.name ||
row[link_with_name]?.no ||
row[link_with_name]?.value}
</span>
);
}
};
}
if (link_relation === "hasMany" || link_relation === "newHasMany") {
linkOb.customFn = (row) => {
if (i.edit_input === "files") {
return (
<div style="display: flex;flex-direction: column;">
{row[link_with_name]?.map((o) => (
<a>
{ o?.original_name || o?.name }
</a>
))}
</div>
)
} else {
return (
<div>
{row[link_with_name]?.map((o) => (
<p>
{o?.name ||
o?.no ||
o?.value ||
o?.biaoti ||
o?.mingcheng}
</p>
))}
</div>
);
}
};
}
}
this.table.push(
Object.assign(
{
prop: i.field,
label: i.name,
width: i.width,
align: 'center',
fixed: i.is_fixed,
},
linkOb
)
);
});
this.table.unshift({
prop: "id",
width: 60,
label: "序号",
formatter: (row, column, cellValue, index) => (this.$refs['xyTable'].selectOpt.page - 1) * this.$refs['xyTable'].selectOpt.page_size + index + 1
})
},
adjustAlignment () {
if (this.firstAdjustTable) {
const data = this.$refs['xyTable'].getListData();
if (data.length < 2) return;
try {
this.form.filter(i => i.list_show).forEach((i) => {
let maxLength = -Infinity;
let minLength = Infinity;
let numberLength = 0;
let temp = 0;
while (temp < data.length) {
maxLength = Math.max(maxLength, data[temp][i.field]?.length??0);
minLength = Math.min(minLength, data[temp][i.field]?.length??0);
numberLength += /^-?[0-9]+(\.[0-9]+)?$/.test(data[temp][i.field]) ? 1 : 0;
temp++;
}
if (numberLength === temp) {
this.table.find(a => a.prop === i.field).align = 'right';
}
else if (Math.abs(maxLength - minLength) > 4) {
this.table.find(a => a.prop === i.field).align = 'left';
}
})
console.log(this.table)
} catch (e) {
console.error(e)
}
this.$nextTick(() => {
this.$refs['xyTable'].doLayout();
this.firstAdjustTable = false;
})
}
}
},
computed: {
columnArrTest() {
return function (field) {
return this.form.find((i) => i.field === field)
? this.form.find((i) => i.field === field).search_input === "checkbox" || this.form.find((i) => i.field === field).search_input === "radio"
: false;
};
},
getColumnField() {
return function (field) {
return this.form.find((i) => i.field === field)
? this.form.find((i) => i.field === field)
: {};
};
},
getColumnParams() {
return function (field) {
return this.form.find((i) => i.field === field)
? this.form.find((i) => i.field === field)._params
: [];
};
}
},
created() {
this.getFormDetail();
},
};
</script>
<style scoped lang="scss">
.select {
&__item {
& > p {
display: inline-block;
width: 80px;
text-align: center;
}
& + div {
margin-top: 6px;
}
}
}
.add-btn {
display: flex;
justify-content: center;
align-items: center;
margin-top: 10px;
& > span {
padding: 0 10px;
}
}
a {
color: red;
text-decoration: none;
transition: all 0.2s;
}
a:hover {
color: red;
text-decoration: underline;
}
</style>

@ -0,0 +1,472 @@
<template>
<div>
<el-page-header
:content="$route.meta.title"
style="
padding: 1em;
font-size: 1em;
background: #fff;
margin: 1.67em 0;
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
border-radius: 5px;
"
@back="$router.back()"
>
</el-page-header>
<el-row :gutter="20">
<el-col :span="24">
<el-card>
<div class="el-descriptions__header el-descriptions__title">
基本信息
</div>
<el-descriptions
border
:column="2"
:label-style="{ 'font-weight': '600' }"
>
<el-descriptions-item
v-for="item in showFields"
:label="item.name"
v-if="!['file', 'picture'].find((j) => j === item.field)"
>
<template v-if="item.edit_input === 'richtext'">
<div v-html="detail[item.field]"></div>
</template>
<template v-else>
{{ contentFormat(item) }}
</template>
</el-descriptions-item
>
</el-descriptions>
</el-card>
<el-card>
<div class="el-descriptions__header el-descriptions__title">
处置资产
</div>
<xy-table size="mini" :height="300" :is-page="false" :list="detail.lets_to_assets || []" :table-item="assetTable"></xy-table>
</el-card>
</el-col>
</el-row>
<el-backtop></el-backtop>
<Modal
:width="76"
transfer
:z-index="6000"
v-model="showModal"
:footer-hide="true"
title="预览"
>
<template>
<iframe
style="width: 100%; height: 57vh"
:src="codeUri"
border="0"
></iframe>
</template>
</Modal>
</div>
</template>
<script>
import { show, index } from "@/api/system/baseForm";
import { show as formShow, index as customFormIndex } from "@/api/system/customForm";
import { getparameter } from "@/api/system/dictionary";
import { listdept } from "@/api/system/department";
import { download } from "@/utils/downloadRequest";
export default {
name: "detail",
data() {
return {
showModal:false,
codeUri: "",
detail: {},
fields: [],
relation: [],
customForm: {
customFormId: "",
tableName: "",
},
allTables: [],
linkTableList: [],
assetTable: [
{
"prop": "name",
"label": "地块名称",
"width": 0,
"fixed": "left",
"align": "left",
customFn: row => {
return (<span>{ row.land_id ? row.lands.name : row.house.name }</span>)
}
},
{
"prop": "zuoluo",
"label": "坐落",
"width": 0,
"align": "left",
customFn: row => {
return (<span>{ row.land_id ? row.lands.name : row.house.name }</span>)
}
},
{
"prop": "dengjimianji",
"label": "登记面积",
"width": 0,
"align": "center",
customFn: row => {
return (<span>{ row.land_id ? row.lands.dengjimianji : row.house.dengjimianji }</span>)
}
},
{
"prop": "chuzhimianji",
"label": "处置面积",
"width": 160,
},
]
};
},
methods: {
open(url) {
this.codeUri = `${process.env.VUE_APP_PREVIEW_API}?url=${encodeURIComponent(
new Buffer(url).toString("base64")
)}`;
this.showModal = true;
},
down(e) {
download(e.url, "get", {}, e.original_name);
},
formatColumn (info) {
let table = [];
//
//
let baseTable = new Map([
['departments', async () => {
const res = await listdept()
return res
}],
['admins',[]]
])
let { fields, relation } = info;
let fieldRes = fields.sort((a,b) => a.sort - b.sort)
if (
!fields ||
!relation ||
!fields instanceof Array ||
!relation instanceof Array
) {
throw new Error("fields或relation格式错误");
}
fieldRes?.forEach((i, index) => {
i._relations = relation.find((j) => j.custom_form_field === i.field);
if (i.select_item && typeof i.select_item === 'object') {
let keys = Object.keys(i.select_item)
i._params = keys.map(key => {
return {
key,
value: i.select_item[key]
}
})
}
if (i.edit_input === 'file' || i.edit_input === 'files') {
return
}
if (i._relations) {
if (baseTable.get(i._relations.link_table_name)) {
baseTable.get(i._relations.link_table_name)().then(res => i._params = res)
} else {
i._params = i._relations.parameter_id
? getparameter({ id: i._relations.parameter_id },false).then((res) => {
i._params = res.detail;
})
: this.index({
table_name: i._relations.link_table_name,
page: 1,
page_size: 9999,
}).then((res) => {
i._params = res.data;
});
}
}
});
fields
?.filter((i) => i.list_show)
.forEach((i) => {
if (i._relations) return
let linkOb = {};
if (i.edit_input === "richtext") {
linkOb.customFn = (row) => {
return (
<div
style={{ "max-height": "55px","overflow": "scroll" }}
domPropsInnerHTML={row[i.field]}
></div>
);
};
}
if (
i.select_item &&
typeof i.select_item === "object" &&
!(i.select_item instanceof Array)
) {
let keys = Object.keys(i.select_item);
linkOb.customFn = (row) => {
let paramMap = new Map();
keys.forEach((key) => {
paramMap.set(i.select_item[key], key);
});
return <span>{paramMap.get(row[i.field]?.toString())}</span>;
};
}
if (i._relations) {
let { link_relation, foreign_key, link_with_name } = i._relations;
if (link_relation === "newHasOne" || link_relation === "hasOne") {
linkOb.customFn = (row) => {
if (i.edit_input === "file") {
return (
<a
download={row[link_with_name]?.original_name}
href={row[link_with_name]?.url}
>
{row[link_with_name]?.original_name}
</a>
);
} else {
return (
<span>
{row[link_with_name]?.name ||
row[link_with_name]?.no ||
row[link_with_name]?.value}
</span>
);
}
};
}
if (link_relation === "hasMany" || link_relation === "newHasMany") {
linkOb.customFn = (row) => {
if (i.edit_input === "files") {
return (
<div style="display: flex;flex-direction: column;">
{row[link_with_name]?.map((o) => (
<a>
{ o?.original_name || o?.name }
</a>
))}
</div>
)
} else {
return (
<div>
{row[link_with_name]?.map((o) => (
<p>
{o?.name ||
o?.no ||
o?.value ||
o?.biaoti ||
o?.mingcheng}
</p>
))}
</div>
);
}
};
}
}
table.push(
Object.assign(
{
prop: i.field,
label: i.name,
width: i.width,
fixed: i.is_fixed,
},
linkOb
)
);
});
table.unshift({
type: "index",
width: 60,
label: "序号",
});
return table;
},
async getFields() {
if (this.$route.meta.params?.custom_form) {
let decode = decodeURIComponent(this.$route.meta.params?.custom_form);
try {
let custom_form = JSON.parse(decode);
this.customForm.customFormId = custom_form.custom_form_id;
this.customForm.tableName = custom_form.table_name;
} catch (err) {
console.warn(err);
}
}
const res = await formShow({ id: this.customForm.customFormId }, false);
this.fields = res.fields.sort((a, b) => a.sort - b.sort);
this.relation = res.relation;
//
//
let baseTable = new Map([
[
"departments",
async () => {
const res = await listdept();
return res;
},
],
["admins", []],
]);
let { fields, relation } = this;
if (
!fields ||
!relation ||
!fields instanceof Array ||
!relation instanceof Array
) {
throw new Error("fields或relation格式错误");
}
fields
.sort((a, b) => a.sort - b.sort)
.forEach((i) => {
i._relations = relation.find(
(j) => j.custom_form_field === i.field
);
if (i.select_item && typeof i.select_item === "object") {
let keys = Object.keys(i.select_item);
i._params = keys.map((key) => {
return {
key,
value: /^\d*$/.test(i.select_item[key])
? Number(i.select_item[key])
: i.select_item[key],
};
});
}
if (i.edit_input === "file" || i.edit_input === "files") {
return;
}
if (i._relations) {
if (baseTable.get(i._relations.link_table_name)) {
baseTable
.get(i._relations.link_table_name)()
.then((res) => {
i._params = res.data;
});
} else {
// i._params = i._relations.parameter_id
// ? getparameter({ id: i._relations.parameter_id }, false).then(
// (res) => {
// i._params = res.detail;
// }
// )
// : this.index({
// table_name: i._relations.link_table_name,
// page: 1,
// page_size: 9999,
// }).then((res) => {
// i._params = res.data;
// });
}
}
});
const detail = await show({
id: this.$route.params.id,
table_name: this.customForm.tableName,
});
this.detail = detail;
},
},
computed: {
showFields () {
return this.fields.filter(field => (!field._relations || field._relations.link_relation === 'hasOne' || field._relations.link_relation === 'newHasOne'))
},
contentFormat() {
return function (i) {
let { _relations } = i;
if (_relations && _relations.link_table_name) {
if (
_relations.link_relation === "hasOne" ||
_relations.link_relation === "newHasOne"
) {
return (
this.detail[_relations.link_with_name]?.original_name ||
this.detail[_relations.link_with_name]?.name ||
this.detail[_relations.link_with_name]?.no ||
this.detail[_relations.link_with_name]?.value ||
this.detail[_relations.link_with_name]?.mingcheng
);
}
return;
}
if (i._params && i._params.length > 0) {
return i._params.find((j) => j.value == this.detail[i.field])?.key;
}
return this.detail[i.field];
};
},
},
created() {
this.getFields().then(_ => {
})
},
};
</script>
<style scoped lang="scss">
::v-deep .el-card {
margin-bottom: 20px;
}
::v-deep .el-empty__image {
width: 120px;
}
a {
color: red;
text-decoration: none;
transition: all 0.2s;
}
a:hover {
color: red;
text-decoration: underline;
}
.el-descriptions__title {
position: relative;
padding-left: 14px;
&::before {
content: '';
width: 4px;
background: linear-gradient(to bottom,rgb(57, 129, 199), rgba(118, 148, 183, 0.7));
position: absolute;
left: 0;
top: 2px;
bottom: 2px;
}
}
</style>

@ -3,7 +3,7 @@
<el-page-header
:content="
$route.meta.title + ' - ' +
(detail.name || detail.mingcheng || detail.no || detail.bianhao || detail[showFields[0].field])
(detail.name || detail.mingcheng || detail.no || detail.bianhao || ' ')
"
style="
padding: 1em;
@ -25,7 +25,6 @@
</div>
<el-descriptions
border
size="small"
:column="2"
:label-style="{ 'font-weight': '600' }"
>
@ -49,7 +48,7 @@
<div class="el-descriptions__header el-descriptions__title">
{{ item.title }}
</div>
<xy-table ref="xyTable" size="mini" :height="300" :is-page="false" :list="item.value" :table-item="item.field"></xy-table>
<xy-table size="mini" :height="300" :is-page="false" :list="item.value" :table-item="item.field"></xy-table>
</el-card>
</el-col>
</el-row>
@ -124,6 +123,7 @@ export default {
getLinkTableList () {
let relationFields = this.fields.filter(field => (field._relations?.link_relation === 'newHasMany' || field._relations?.link_relation === 'hasMany'));
for (let i = 0;i < relationFields.length;i++) {
let item = relationFields[i]
let table_id = this.allTables.find(table => table.table_name === item._relations.link_table_name)?.id
@ -364,10 +364,9 @@ export default {
);
});
table.unshift({
prop: "id",
type: "index",
width: 60,
label: "序号",
formatter: (row, column, cellValue, index) => (this.$refs['xyTable'].selectOpt.page - 1) * this.$refs['xyTable'].selectOpt.page_size + index + 1
});
return table;
@ -468,7 +467,6 @@ export default {
computed: {
showFields () {
console.log(this.fields)
return this.fields.filter(field => (!field._relations || field._relations.link_relation === 'hasOne' || field._relations.link_relation === 'newHasOne'))
},
contentFormat() {

@ -25,7 +25,6 @@
</div>
<el-descriptions
border
size="small"
:column="2"
:label-style="{ 'font-weight': '600' }"
>

@ -652,10 +652,6 @@ export default {
}
}
});
document.documentElement.style.setProperty(
"--column-num",
newVal.length > 8 ? "2" : "1"
);
},
//immediate: true,
},

@ -9,7 +9,6 @@
>
<template>
<el-descriptions
size="medium"
direction="vertical"
:column="3"
:labelStyle="{ 'font-weight': '600', width: '33%' }"

@ -235,7 +235,7 @@
<div ref="infoWindow" id="infoWindow" v-show="isShowInfoWindow">
<el-scrollbar style="height: 260px; width: 100%">
<el-descriptions size="small" border :column="2">
<el-descriptions border :column="2">
<el-descriptions-item v-for="item in form" :label="item.name">
{{ contentFormat(item) }}{{ units.get(item.field) }}
</el-descriptions-item>

@ -3,12 +3,12 @@
<div class="container" ref="appRef">
<dv-loading v-if="loading">Loading...</dv-loading>
<div v-else style="height: 100%;" class="d-flex flex-column">
<dv-decoration-3 style="width:250px;height:30px;position: absolute;bottom: 0;left: 0px;" />
<dv-decoration-3 style="width:250px;height:30px;position: absolute;bottom: 10px;right: 30px;" />
<HeaderComponent></HeaderComponent>
<div class="body d-flex flex-1">
<btns></btns>
<!-- <btns></btns>-->
<div class="left d-flex flex-column">
<dv-border-box-12 style="padding: 14px;" class="flex-1">
<MapComponent v-show="$store.state.bigdata.type === 1"></MapComponent>
@ -114,14 +114,14 @@ export default {
.body {
padding-top: 20px;
padding-left: 13%;
//padding-left: 13%;
.left {
flex-basis: 74%;
}
.right {
flex: 1;
padding-right: 60px;
padding-right: 20px;
div + div {
margin-top: .5rem;

@ -83,12 +83,6 @@ export default {
"width": 0,
"align": "left"
},
{
"prop": "zichanweizhi",
"label": "资产位置",
"width": 0,
"align": "center"
},
{
"prop": "dengjimianji",
"label": "登记面积",
@ -689,7 +683,7 @@ export default {
// })
// this.form.id_lease_plans_lease_id_relation = this.leasePlans;
save(Object.assign(this.form, { table_name: 'lets' })).then(res => {
Promise.all(this.originalForm.id_lets_to_assets_let_id_relation.map(i => destroy({
Promise.all(this.originalForm.id_lets_to_assets_let_id_relation?.map(i => destroy({
id: i.id,
table_name: "lets_to_assets"
},false)))

@ -0,0 +1,472 @@
<template>
<div>
<el-page-header
:content="$route.meta.title"
style="
padding: 1em;
font-size: 1em;
background: #fff;
margin: 1.67em 0;
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
border-radius: 5px;
"
@back="$router.back()"
>
</el-page-header>
<el-row :gutter="20">
<el-col :span="24">
<el-card>
<div class="el-descriptions__header el-descriptions__title">
基本信息
</div>
<el-descriptions
border
:column="2"
:label-style="{ 'font-weight': '600' }"
>
<el-descriptions-item
v-for="item in showFields"
:label="item.name"
v-if="!['file', 'picture'].find((j) => j === item.field)"
>
<template v-if="item.edit_input === 'richtext'">
<div v-html="detail[item.field]"></div>
</template>
<template v-else>
{{ contentFormat(item) }}
</template>
</el-descriptions-item
>
</el-descriptions>
</el-card>
<el-card>
<div class="el-descriptions__header el-descriptions__title">
标的物
</div>
<xy-table size="mini" :height="300" :is-page="false" :list="detail.lets_to_assets || []" :table-item="assetTable"></xy-table>
</el-card>
</el-col>
</el-row>
<el-backtop></el-backtop>
<Modal
:width="76"
transfer
:z-index="6000"
v-model="showModal"
:footer-hide="true"
title="预览"
>
<template>
<iframe
style="width: 100%; height: 57vh"
:src="codeUri"
border="0"
></iframe>
</template>
</Modal>
</div>
</template>
<script>
import { show, index } from "@/api/system/baseForm";
import { show as formShow, index as customFormIndex } from "@/api/system/customForm";
import { getparameter } from "@/api/system/dictionary";
import { listdept } from "@/api/system/department";
import { download } from "@/utils/downloadRequest";
export default {
name: "detail",
data() {
return {
showModal:false,
codeUri: "",
detail: {},
fields: [],
relation: [],
customForm: {
customFormId: "",
tableName: "",
},
allTables: [],
linkTableList: [],
assetTable: [
{
"prop": "name",
"label": "地块名称",
"width": 0,
"fixed": "left",
"align": "left",
customFn: row => {
return (<span>{ row.land_id ? row.lands.name : row.house.name }</span>)
}
},
{
"prop": "zuoluo",
"label": "坐落",
"width": 0,
"align": "left",
customFn: row => {
return (<span>{ row.land_id ? row.lands.name : row.house.name }</span>)
}
},
{
"prop": "dengjimianji",
"label": "登记面积",
"width": 0,
"align": "center",
customFn: row => {
return (<span>{ row.land_id ? row.lands.dengjimianji : row.house.dengjimianji }</span>)
}
},
{
"prop": "chuzumianji",
"label": "出租面积",
"width": 160,
},
]
};
},
methods: {
open(url) {
this.codeUri = `${process.env.VUE_APP_PREVIEW_API}?url=${encodeURIComponent(
new Buffer(url).toString("base64")
)}`;
this.showModal = true;
},
down(e) {
download(e.url, "get", {}, e.original_name);
},
formatColumn (info) {
let table = [];
//
//
let baseTable = new Map([
['departments', async () => {
const res = await listdept()
return res
}],
['admins',[]]
])
let { fields, relation } = info;
let fieldRes = fields.sort((a,b) => a.sort - b.sort)
if (
!fields ||
!relation ||
!fields instanceof Array ||
!relation instanceof Array
) {
throw new Error("fields或relation格式错误");
}
fieldRes?.forEach((i, index) => {
i._relations = relation.find((j) => j.custom_form_field === i.field);
if (i.select_item && typeof i.select_item === 'object') {
let keys = Object.keys(i.select_item)
i._params = keys.map(key => {
return {
key,
value: i.select_item[key]
}
})
}
if (i.edit_input === 'file' || i.edit_input === 'files') {
return
}
if (i._relations) {
if (baseTable.get(i._relations.link_table_name)) {
baseTable.get(i._relations.link_table_name)().then(res => i._params = res)
} else {
i._params = i._relations.parameter_id
? getparameter({ id: i._relations.parameter_id },false).then((res) => {
i._params = res.detail;
})
: this.index({
table_name: i._relations.link_table_name,
page: 1,
page_size: 9999,
}).then((res) => {
i._params = res.data;
});
}
}
});
fields
?.filter((i) => i.list_show)
.forEach((i) => {
if (i._relations) return
let linkOb = {};
if (i.edit_input === "richtext") {
linkOb.customFn = (row) => {
return (
<div
style={{ "max-height": "55px","overflow": "scroll" }}
domPropsInnerHTML={row[i.field]}
></div>
);
};
}
if (
i.select_item &&
typeof i.select_item === "object" &&
!(i.select_item instanceof Array)
) {
let keys = Object.keys(i.select_item);
linkOb.customFn = (row) => {
let paramMap = new Map();
keys.forEach((key) => {
paramMap.set(i.select_item[key], key);
});
return <span>{paramMap.get(row[i.field]?.toString())}</span>;
};
}
if (i._relations) {
let { link_relation, foreign_key, link_with_name } = i._relations;
if (link_relation === "newHasOne" || link_relation === "hasOne") {
linkOb.customFn = (row) => {
if (i.edit_input === "file") {
return (
<a
download={row[link_with_name]?.original_name}
href={row[link_with_name]?.url}
>
{row[link_with_name]?.original_name}
</a>
);
} else {
return (
<span>
{row[link_with_name]?.name ||
row[link_with_name]?.no ||
row[link_with_name]?.value}
</span>
);
}
};
}
if (link_relation === "hasMany" || link_relation === "newHasMany") {
linkOb.customFn = (row) => {
if (i.edit_input === "files") {
return (
<div style="display: flex;flex-direction: column;">
{row[link_with_name]?.map((o) => (
<a>
{ o?.original_name || o?.name }
</a>
))}
</div>
)
} else {
return (
<div>
{row[link_with_name]?.map((o) => (
<p>
{o?.name ||
o?.no ||
o?.value ||
o?.biaoti ||
o?.mingcheng}
</p>
))}
</div>
);
}
};
}
}
table.push(
Object.assign(
{
prop: i.field,
label: i.name,
width: i.width,
fixed: i.is_fixed,
},
linkOb
)
);
});
table.unshift({
type: "index",
width: 60,
label: "序号",
});
return table;
},
async getFields() {
if (this.$route.meta.params?.custom_form) {
let decode = decodeURIComponent(this.$route.meta.params?.custom_form);
try {
let custom_form = JSON.parse(decode);
this.customForm.customFormId = custom_form.custom_form_id;
this.customForm.tableName = custom_form.table_name;
} catch (err) {
console.warn(err);
}
}
const res = await formShow({ id: this.customForm.customFormId }, false);
this.fields = res.fields.sort((a, b) => a.sort - b.sort);
this.relation = res.relation;
//
//
let baseTable = new Map([
[
"departments",
async () => {
const res = await listdept();
return res;
},
],
["admins", []],
]);
let { fields, relation } = this;
if (
!fields ||
!relation ||
!fields instanceof Array ||
!relation instanceof Array
) {
throw new Error("fields或relation格式错误");
}
fields
.sort((a, b) => a.sort - b.sort)
.forEach((i) => {
i._relations = relation.find(
(j) => j.custom_form_field === i.field
);
if (i.select_item && typeof i.select_item === "object") {
let keys = Object.keys(i.select_item);
i._params = keys.map((key) => {
return {
key,
value: /^\d*$/.test(i.select_item[key])
? Number(i.select_item[key])
: i.select_item[key],
};
});
}
if (i.edit_input === "file" || i.edit_input === "files") {
return;
}
if (i._relations) {
if (baseTable.get(i._relations.link_table_name)) {
baseTable
.get(i._relations.link_table_name)()
.then((res) => {
i._params = res.data;
});
} else {
// i._params = i._relations.parameter_id
// ? getparameter({ id: i._relations.parameter_id }, false).then(
// (res) => {
// i._params = res.detail;
// }
// )
// : this.index({
// table_name: i._relations.link_table_name,
// page: 1,
// page_size: 9999,
// }).then((res) => {
// i._params = res.data;
// });
}
}
});
const detail = await show({
id: this.$route.params.id,
table_name: this.customForm.tableName,
});
this.detail = detail;
},
},
computed: {
showFields () {
return this.fields.filter(field => (!field._relations || field._relations.link_relation === 'hasOne' || field._relations.link_relation === 'newHasOne'))
},
contentFormat() {
return function (i) {
let { _relations } = i;
if (_relations && _relations.link_table_name) {
if (
_relations.link_relation === "hasOne" ||
_relations.link_relation === "newHasOne"
) {
return (
this.detail[_relations.link_with_name]?.original_name ||
this.detail[_relations.link_with_name]?.name ||
this.detail[_relations.link_with_name]?.no ||
this.detail[_relations.link_with_name]?.value ||
this.detail[_relations.link_with_name]?.mingcheng
);
}
return;
}
if (i._params && i._params.length > 0) {
return i._params.find((j) => j.value == this.detail[i.field])?.key;
}
return this.detail[i.field];
};
},
},
created() {
this.getFields().then(_ => {
})
},
};
</script>
<style scoped lang="scss">
::v-deep .el-card {
margin-bottom: 20px;
}
::v-deep .el-empty__image {
width: 120px;
}
a {
color: red;
text-decoration: none;
transition: all 0.2s;
}
a:hover {
color: red;
text-decoration: underline;
}
.el-descriptions__title {
position: relative;
padding-left: 14px;
&::before {
content: '';
width: 4px;
background: linear-gradient(to bottom,rgb(57, 129, 199), rgba(118, 148, 183, 0.7));
position: absolute;
left: 0;
top: 2px;
bottom: 2px;
}
}
</style>

@ -121,12 +121,6 @@ export default {
width: 0,
align: "left",
},
{
prop: "zichanweizhi",
label: "资产位置",
width: 0,
align: "center",
},
{
prop: "dengjimianji",
label: "登记面积",
@ -224,9 +218,13 @@ export default {
is-page={false}
list={this.leasePlans}
table-item={[
{
width: 46,
type: "index"
},
{
prop: "zujindiyicidaoweishijian",
label: "租金第一次到位时间",
label: "租金到位时间",
width: 160,
customFn: (row) => {
return (

Loading…
Cancel
Save