From abc491af29bbd192fe8f153ec44dcc2057ada409 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Wed, 20 Sep 2023 17:32:13 +0800 Subject: [PATCH] 2023-9-20 --- src/components/XyTable/index.vue | 82 ++++++- src/views/assets/component/addHistory.vue | 41 ++++ src/views/assets/component/addLand.vue | 1 + src/views/assets/component/addLease.vue | 280 ++++++++++++++++++++++ src/views/assets/history.vue | 30 ++- src/views/assets/house.vue | 43 ++++ src/views/assets/land.vue | 49 +++- src/views/assets/lease.vue | 147 ++++++++++++ src/views/component/dialog.vue | 4 +- 9 files changed, 656 insertions(+), 21 deletions(-) create mode 100644 src/views/assets/component/addLease.vue create mode 100644 src/views/assets/lease.vue diff --git a/src/components/XyTable/index.vue b/src/components/XyTable/index.vue index 78d5717..a862340 100644 --- a/src/components/XyTable/index.vue +++ b/src/components/XyTable/index.vue @@ -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", + { + 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() + }) + } + } + }}> + + 更多 + + + + { + (() => { + let dom = []; + if (this.auths.indexOf('edit') !== -1) { + dom.push(编辑) + } + if (this.auths.indexOf('delete') !== -1) { + dom.push(删除) + } + return dom; + })() + } + + + ) btns.set( "detail", - {_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; + })() } ); return { dom, flag }; diff --git a/src/views/assets/component/addHistory.vue b/src/views/assets/component/addHistory.vue index 71937a3..2cb1adc 100644 --- a/src/views/assets/component/addHistory.vue +++ b/src/views/assets/component/addHistory.vue @@ -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" ? "新增" : "编辑"}成功`, diff --git a/src/views/assets/component/addLand.vue b/src/views/assets/component/addLand.vue index 4f31e4b..b6589ce 100644 --- a/src/views/assets/component/addLand.vue +++ b/src/views/assets/component/addLand.vue @@ -95,6 +95,7 @@ export default { type: "warning", message: "当前房产已有绑定土地", }); + this.$refs["houseTable"].setCurrentRow(); return; } this.form["ruzhangshijian"] = row.ruzhangshijian; diff --git a/src/views/assets/component/addLease.vue b/src/views/assets/component/addLease.vue new file mode 100644 index 0000000..a1d4ba5 --- /dev/null +++ b/src/views/assets/component/addLease.vue @@ -0,0 +1,280 @@ + + + + diff --git a/src/views/assets/history.vue b/src/views/assets/history.vue index ae14484..444788e 100644 --- a/src/views/assets/history.vue +++ b/src/views/assets/history.vue @@ -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 @@ > - + @@ -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(); } }, }, diff --git a/src/views/assets/house.vue b/src/views/assets/house.vue index 04d7f78..df5d613 100644 --- a/src/views/assets/house.vue +++ b/src/views/assets/house.vue @@ -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 @@ } " > +