master
xy 2 years ago
parent 63947b70ce
commit abc491af29

@ -147,6 +147,10 @@ export default {
return { width: "100%", marginBottom: "20px" };
},
},
btnToMore: {
type: Boolean,
default: false
},
btnWidth: {
type: Number,
default: 220,
@ -576,6 +580,58 @@ export default {
let _this = this;
if (_this.auths?.length > 0) {
let btns = new Map();
btns.set(
"more",
<el-dropdown size="small" type="primary" placement="bottom" on={{
['command']:command => {
if (command === 'edit') {
this.editorClick(scope.row)
}
if (command === 'delete') {
let that = this
this.$confirm("确认删除吗?",{
beforeClose(action,instance,done){
if (action === 'confirm') {
that.deleteClick(scope.row);
done();
} else {
done();
}
}
}).then(res => {
this.$message({
type: 'success',
message: '删除成功'
})
this.load()
})
}
}
}}>
<i-button
type="default"
size="small"
style="margin-left: 6px;"
>
更多
</i-button>
<el-dropdown-menu slot="dropdown">
{
(() => {
let dom = [];
if (this.auths.indexOf('edit') !== -1) {
dom.push(<el-dropdown-item command="edit">编辑</el-dropdown-item>)
}
if (this.auths.indexOf('delete') !== -1) {
dom.push(<el-dropdown-item command="delete">删除</el-dropdown-item>)
}
return dom;
})()
}
</el-dropdown-menu>
</el-dropdown>
)
btns.set(
"detail",
<i-button
@ -672,17 +728,25 @@ export default {
"flex-wrap": "wrap",
}}
>
{_this.auths.map((item, index) => {
if (_this.$scopedSlots[item]) {
flag = index;
return _this.$scopedSlots[item](scope, item, index);
} else {
if (btns.get(item)) {
{ (() => {
let dom = [];
_this.auths.forEach((item, index) => {
if (this.btnToMore && ['edit','delete'].find(j => j === item)) return
if (_this.$scopedSlots[item]) {
flag = index;
return btns.get(item);
dom.push(_this.$scopedSlots[item](scope, item, index));
} else {
if (btns.get(item)) {
flag = index;
dom.push(btns.get(item));
}
}
}
})}
})
this.btnToMore? dom.push(btns.get('more')) : ''
return dom;
})() }
</div>
);
return { dom, flag };

@ -135,7 +135,48 @@ export default {
writable: true,
});
}
let promiseAll = []
this.formInfo.forEach((info) => {
if (
info._relations?.link_relation === "newHasMany" ||
info._relations?.link_relation === "hasMany"
) {
if (this.originalForm[info._relations.link_with_name]) {
this.originalForm[info._relations.link_with_name].map((i) => {
promiseAll.push(
destroy({
id: i.id,
table_name: info._relations.link_table_name,
})
);
});
}
}
if (
info._relations?.link_relation === "newHasMany" ||
info._relations?.link_relation === "hasMany"
) {
if (info.edit_input === "files") {
this.form[info._relations.link_with_name] = this.file[
info.field
]?.map((i) => {
let copyRelation = i?.response ? deepCopy(i?.response) : "";
//TODO:
if (/:\/\/:\/\//g.test(copyRelation?.url)) {
copyRelation.url.replace(/:\/\/:\/\//g,'://')
}
delete copyRelation.id;
return {
file_id: i?.response?.id,
...copyRelation,
};
});
}
}
})
delete this.form['tupian']
save(Object.assign(this.form, { table_name: 'his_evolutions' })).then(res => {
this.$Message.success({
content: `${this.type === "add" ? "新增" : "编辑"}成功`,

@ -95,6 +95,7 @@ export default {
type: "warning",
message: "当前房产已有绑定土地",
});
this.$refs["houseTable"].setCurrentRow();
return;
}
this.form["ruzhangshijian"] = row.ruzhangshijian;

@ -0,0 +1,280 @@
<script>
import { save, show, index, destroy } from "@/api/system/baseForm";
import { CreateDialog } from "@/utils/createDialog"
import { deepCopy } from "@/utils";
import { resolveFormInfo } from '@/utils/createTable'
export default {
props: {
tableName: String,
},
render(h) {
let dialog = new CreateDialog(this,[
],{
width: "650px"
})
return dialog.render()
},
data() {
return {
columns: 1,
row: {},
formInfo: [],
id: "",
type: "add",
dialogVisible: false,
form: {},
originalForm: {},
rules: {},
file: {},
};
},
methods: {
setForm(key = [], value = []) {
if (key instanceof Array) {
key.forEach((key, index) => {
this.form[key] = value[index] ?? "";
});
}
if (typeof key === "string") {
this.form[key] = value;
}
if (!key) {
this.init();
}
},
setRow (row) {
this.row = row
console.log(row)
this.setForm(['dikuaimingcheng','leixing','chuzufang',],[row.name,row.hasOwnProperty('id_house_properties_land_id_relation') ? 1 : 2,row.quanliren])
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["elForm"].clearValidate();
},
show() {
this.dialogVisible = true;
},
hidden() {
this.dialogVisible = false;
},
setType(type = "add") {
let types = ["add", "editor", "show"];
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: 'leases' });
this.$integrateData(this.form, res);
this.formInfo.forEach((i) => {
if (i && (i.edit_input === "file" || i.edit_input === "files")) {
res[i._relations.link_with_name]
? (this.file[i.field] =
res[i._relations.link_with_name] instanceof Array
? res[i._relations.link_with_name].map((i) => {
return {
name: i?.name,
url: i?.url,
response: i,
};
})
: [
{
name: res[i._relations.link_with_name]?.name,
url: res[i._relations.link_with_name]?.url,
response: res[i._relations.link_with_name],
},
])
: (this.file[i.field] = []);
}
this.form = Object.assign({}, this.form);
this.originalForm = deepCopy(res);
});
},
submit() {
if (/\/house/g.test(this.$route.path)) {
this.form['house_id'] = this.row.id
}
if (/\/land/g.test(this.$route.path)) {
this.form['land_id'] = this.row.id
}
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,
});
}
let promiseAll = []
this.formInfo.forEach((info) => {
if (
info._relations?.link_relation === "newHasMany" ||
info._relations?.link_relation === "hasMany"
) {
if (this.originalForm[info._relations.link_with_name]) {
this.originalForm[info._relations.link_with_name].map((i) => {
promiseAll.push(
destroy({
id: i.id,
table_name: info._relations.link_table_name,
})
);
});
}
}
if (
info._relations?.link_relation === "newHasMany" ||
info._relations?.link_relation === "hasMany"
) {
if (info.edit_input === "files") {
this.form[info._relations.link_with_name] = this.file[
info.field
]?.map((i) => {
let copyRelation = i?.response ? deepCopy(i?.response) : "";
//TODO:
if (/:\/\/:\/\//g.test(copyRelation?.url)) {
copyRelation.url.replace(/:\/\/:\/\//g,'://')
}
delete copyRelation.id;
return {
file_id: i?.response?.id,
...copyRelation,
};
});
}
}
})
delete this.form['tupian']
save(Object.assign(this.form, { table_name: 'leases' })).then(res => {
this.$Message.success({
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
});
this.$emit("refresh");
this.hidden();
})
},
},
computed: {
title () {
if (this.type === 'add') return '新增'
if (this.type === 'editor') return '编辑'
if (this.type === 'show') return '查看'
}
},
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() {
resolveFormInfo(15).then(res => this.formInfo = res)
}
};
</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);
}
</style>

@ -18,7 +18,7 @@
:height="360"
:is-page="false"
ref="xyTable"
:list="row.id_his_evolutions_land_id_relation || []"
:list="list"
:table-item="table"
@delete="destroy"
@editor="
@ -32,7 +32,7 @@
></xy-table>
</Modal>
<addHistory ref="addHistory"></addHistory>
<addHistory ref="addHistory" @refresh="getList"></addHistory>
</div>
</template>
@ -50,6 +50,7 @@ export default {
isShow: false,
row: {},
list: [],
table: [
{
prop: "mianjitiaozheng",
@ -88,18 +89,35 @@ export default {
this.select.filter[0].value = id;
}
},
destroy (row) {
destroy({
async destroy (row) {
await destroy({
id: row.id,
table_name: 'his_evolutions'
})
}
await this.getList()
},
async getList () {
const res = await index({
table_name: 'his_evolutions',
page: 1,
page_size: 9999,
filter: [
{
key: /\/land/g.test(this.$route.path) ? 'land_id' : 'house_id',
op: 'eq',
value: this.row.id
}
]
})
this.list = res.data;
},
},
computed: {},
watch: {
isShow(newVal) {
if (newVal) {
this.$refs["xyTable"].getTableData(true);
this.getList();
}
},
},

@ -271,6 +271,7 @@
:req-opt="select"
:destroy-req-opt="select"
:table-item="table"
:btn-to-more="true"
@detail="
(row) => {
$router.push({
@ -289,6 +290,14 @@
}
"
>
<template #leave="{ row }">
<Button
size="small"
type="primary"
@click="toLeave(row)"
>租凭登记</Button
>
</template>
<template #assetsHistory="{ row }">
<Button size="small" type="primary" @click="toHistory(row)"
>历史沿革</Button
@ -313,6 +322,7 @@
>
</add>
<addHistory ref="addHistory"></addHistory>
<lease ref="lease"></lease>
<!-- <imports-->
<!-- :table-name="customForm.tableName"-->
<!-- :form-info="form"-->
@ -340,6 +350,7 @@ import add from "./component/addHouse.vue";
import LxHeader from "@/components/LxHeader/index.vue";
import headerContent from "@/components/LxHeader/XyContent.vue";
import addHistory from "@/views/assets/component/addHistory.vue";
import lease from '@/views/assets/lease.vue'
// import drawer from "@/views/component/drawer.vue";
// import imports from "./imports.vue";
// import atlas from "@/views/assets/atlas.vue";
@ -347,6 +358,7 @@ import addHistory from "@/views/assets/component/addHistory.vue";
export default {
name: "tableList",
components: {
lease,
LxHeader,
add,
headerContent,
@ -607,6 +619,33 @@ export default {
"wuyedanwei",
];
switch (i.field) {
case "shiyongzhuangtai":
this.table.push({
label: i.name,
width: i.width,
customFn:row => {
return (
<span>{
(() => {
let res = '无';
for (let i = 0;i < row.id_leases_house_id_relation.length;i++) {
let nowDate = this.$moment(new Date())
let startDate = this.$moment(new Date(row.id_leases_house_id_relation[i]?.zulinkaishiqixian))
let endDate = this.$moment(new Date(row.id_leases_house_id_relation[i]?.zulinjieshuqixian))
if (nowDate.isBetween(startDate,endDate)) {
res = "租凭给"+row.id_leases_house_id_relation[i]?.chengzufang
break;
}
}
return res;
})()
}</span>
)
}
})
break;
case "bufuqingkuang":
this.table.push({
label: i.name,
@ -693,6 +732,10 @@ export default {
this.$refs["addHistory"].setRow(row);
this.$refs["addHistory"].show();
},
toLeave (row) {
this.$refs['lease'].setRow(row);
this.$refs['lease'].show();
}
},
computed: {

@ -247,6 +247,7 @@
:req-opt="select"
:destroy-req-opt="select"
:table-item="table"
:btn-to-more="true"
@detail="
(row) => {
$router.push({
@ -265,6 +266,15 @@
}
"
>
<template #leave="{ row }">
<Button
size="small"
type="primary"
@click="toLeave(row)"
>租凭登记</Button
>
</template>
<template #assetsHistory="{ row }">
<Button
size="small"
@ -292,7 +302,7 @@
>
</add>
<history ref="history"></history>
<addHistory ref="addHistory"></addHistory>
<lease ref="lease"></lease>
<!-- <drawer-->
<!-- :table-name="customForm.tableName"-->
<!-- :form-info="form"-->
@ -324,8 +334,8 @@ import { listdept } from "@/api/system/department"
import add from "./component/addLand.vue";
import LxHeader from "@/components/LxHeader/index.vue";
import headerContent from "@/components/LxHeader/XyContent.vue";
import addHistory from '@/views/assets/component/addHistory.vue';
import history from '@/views/assets/history.vue';
import lease from '@/views/assets/lease.vue';
// import drawer from "@/views/component/drawer.vue";
// import imports from "./imports.vue";
// import atlas from "@/views/assets/atlas.vue";
@ -333,11 +343,11 @@ import history from '@/views/assets/history.vue';
export default {
name: 'tableList',
components: {
addHistory,
LxHeader,
add,
headerContent,
history
history,
lease
// drawer,
// imports,
@ -588,6 +598,33 @@ export default {
let alignLeft = ['dikuaimingcheng','chengjiandanwei','jianshedanwei','wuyedanwei']
switch (i.field) {
case "shiyongzhuangtai":
this.table.push({
label: i.name,
width: i.width,
customFn:row => {
return (
<span>{
(() => {
let res = '无';
for (let i = 0;i < row.id_leases_land_id_relation.length;i++) {
let nowDate = this.$moment(new Date())
let startDate = this.$moment(new Date(row.id_leases_land_id_relation[i]?.zulinkaishiqixian))
let endDate = this.$moment(new Date(row.id_leases_land_id_relation[i]?.zulinjieshuqixian))
if (nowDate.isBetween(startDate,endDate)) {
res = "租凭给"+row.id_leases_land_id_relation[i]?.chengzufang
break;
}
}
return res;
})()
}</span>
)
}
})
break;
case "fangchanzhuangtai":
this.table.push({
label: i.name,
@ -695,6 +732,10 @@ export default {
// }
// this.$refs['addHistory'].setRow(row);
// this.$refs['addHistory'].show();
},
toLeave (row) {
this.$refs['lease'].setRow(row);
this.$refs['lease'].show();
}
},

@ -0,0 +1,147 @@
<template>
<div>
<Modal title="租凭台账" footer-hide :width="64" v-model="isShow">
<Button
type="primary"
style="margin-bottom: 10px"
@click="
$refs['addLease'].setRow(row),
$refs['addLease'].setType('add'),
$refs['addLease'].show()
"
>新增记录</Button
>
<xy-table
:btn-width="120"
style="width: 100%"
:auths="['delete', 'edit']"
:height="360"
:is-page="false"
ref="xyTable"
:list="list"
:table-item="table"
@delete="destroy"
@editor="
(row1) => {
$refs['addLease'].setId(row1.id),
$refs['addLease'].setType('editor');
$refs['addLease'].setRow(row);
$refs['addLease'].show();
}
"
></xy-table>
</Modal>
<addLease ref="addLease" @refresh="getList"></addLease>
</div>
</template>
<script>
import { index, destroy } from "@/api/system/baseForm";
import addLease from "@/views/assets/component/addLease.vue";
export default {
components: {
addLease,
},
data() {
return {
id: "",
isShow: false,
row: {},
list: [],
table: [
{
prop: 'leixing',
label: '类型',
width: 80,
formatter:(data, row, value) => {
let map = new Map([
[1,'土地'],
[2,'房产']
])
return map.get(value)
}
},
{
label: '承租方',
prop: 'chengzufang',
},
{
label: '租凭面积',
prop: 'zupingmianji'
},
{
label: '租赁期限起止',
width: 200,
customFn:row => {
return (
<div>
<span>{ this.$moment(new Date(row.zulinkaishiqixian)).format('YYYY.MM.DD') }</span>
<span> - </span>
<span>{ this.$moment(new Date(row.zulinjieshuqixian)).format('YYYY.MM.DD') }</span>
</div>
)
}
},
{
label: '用途',
prop: 'yongtu',
width: 160
}
],
};
},
methods: {
setRow(row) {
this.row = row;
},
show() {
this.isShow = true;
},
hide() {
this.isShow = false;
},
setId(id) {
if (typeof id === "number") {
this.id = id;
this.select.filter[0].value = id;
}
},
async destroy (row) {
await destroy({
id: row.id,
table_name: 'leases'
})
await this.getList()
},
async getList () {
const res = await index({
table_name: 'leases',
page: 1,
page_size: 9999,
filter: [
{
key: /\/land/g.test(this.$route.path) ? 'land_id' : 'house_id',
op: 'eq',
value: this.row.id
}
]
})
this.list = res.data;
},
},
computed: {},
watch: {
isShow(newVal) {
if (newVal) {
this.getList();
}
},
},
};
</script>
<style scoped lang="scss"></style>

@ -389,14 +389,14 @@ export default {
res[i._relations.link_with_name] instanceof Array
? res[i._relations.link_with_name].map((i) => {
return {
name: i?.name,
name: i?.original_name || i?.name,
url: i?.url,
response: i,
};
})
: [
{
name: res[i._relations.link_with_name]?.name,
name: res[i._relations.link_with_name]?.original_name || res[i._relations.link_with_name]?.name,
url: res[i._relations.link_with_name]?.url,
response: res[i._relations.link_with_name],
},

Loading…
Cancel
Save