You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

615 lines
17 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<script>
import { CreateDialog } from "@/utils/createDialog";
import { save, index } from '@/api/system/baseForm'
export default {
data() {
return {
leaseId: "",
columns: 1,
row: {},
formInfo: [
{
field: "year",
name: "年份选择",
form_show: 1,
},
{
field: "nianxian",
name: "年限信息",
edit_input: "text",
form_show: 1,
},
// {
// field: "wenjianleixing",
// name: "文件类型",
// edit_input: "radio",
// form_show: 1,
// _params: [
// {
// label: "土地",
// value: "土地"
// },
// {
// label: "房产",
// value: "房产"
// },
// {
// label: "其他",
// value: "其他"
// }
// ]
// },
{
field: "tag",
name: "标签",
edit_input: "radio",
form_show: 1,
_params: [
{
label: "工程类",
value: "工程类"
},
{
label: "资产类",
value: "资产类"
}
]
},
{
field: "file",
name: "附件",
edit_input: "files",
form_show: 1
}
],
id: "",
type: "add",
form: {},
originalForm: {},
rules: {},
file: {},
dialogVisible: false,
landSelect: {
table_name: "lands",
keyword: ""
},
houseSelect: {
table_name: "houses",
keyword: ""
},
landDialog: false,
houseDialog: false,
rowPick: {}
}
},
methods: {
index,
show () {
this.dialogVisible = true;
},
hidden () {
this.dialogVisible = false;
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["elForm"].clearValidate();
},
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,
});
}
Promise.all(this.file['file'].map(i => save({
table_name: 'asset_file_files',
[this.rowPick.hasOwnProperty('land_id') ? 'house_id' : 'land_id']: this.rowPick.id,
file_id: i?.response?.id,
name: i?.response?.name,
original_name: i?.response?.original_name,
url: i?.response?.url,
...this.form
}))).then(res => {
this.$Message.success({
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
});
this.$emit("refresh");
this.hidden();
})
},
},
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 === "show") {
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] = [];
}
}
},
},
created() {
},
render(h) {
let _this = this;
let formRender = new CreateDialog(this, [
{
show: true,
sort: 1,
label: "关联资产",
render: h('div',[
h('Button',{
props: {
type: 'primary'
},
on: {
click: _ => {
_this.houseDialog = true;
}
}
},'房产选择'),
h('Button',{
props: {
type: 'primary'
},
on: {
click: _ => {
_this.landDialog = true;
}
}
},'土地选择'),
h('br'),
h('Tag',{
props: {
color: 'primary',
closable: true
},
style: {
display: _this.rowPick.id ? 'inline-block' : 'none'
},
on: {
['on-close']: _ => {
_this.rowPick = {}
}
}
},_this.rowPick.name)
]),
},
{
show: true,
key: "year",
label: "年份选择",
render: h('el-date-picker',{
props: {
value: _this.form['year'],
type: "year",
valueFormat: "yyyy"
},
style: {
width: "100%"
},
on: {
["input"]:e => {
_this.form['year'] = e;
_this.form = Object.assign({}, _this.form)
}
}
})
}
],{ width: "640px" })
return (
<div>
{
formRender.render()
}
<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
ref="landLinkTable"
table-item={
[
{
"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": "m²",
"width": 0,
"align": "center"
},
{
"prop": "shijimianji",
"label": "m²",
"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"
}
]
}
isHandlerKey={false}
action={this.index}
req-opt={this.landSelect}
on={{
['row-click']: ({ row }) => this.rowPick = row
}}
></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
ref="houseLinkTable"
table-item={
[
{
"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": "m²",
"width": 0,
"align": "center"
},
{
"prop": "shijimianji",
"label": "m²",
"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"
}
]
}
isHandlerKey={false}
action={this.index}
req-opt={this.houseSelect}
on={{
['row-click']: ({ row }) => {
this.rowPick = row
console.log(this.rowPick)
}
}}
></xy-table>
</div>
</el-drawer>
</div>
)
}
}
</script>
<style scoped lang="scss">
::v-deep .el-table__body tr.current-row > td.el-table__cell {
background: $primaryColor;
color: #fff;
}
</style>