7ebf2524 by yangwei

代码合并

1 parent b4f32752
<template>
<div class="lpbContent-wrap" ref="lpbContentWrap">
<div class="lpbContent" ref="lpbContent" :style="{ 'height': 'calc(100% - '+ lpbContentHeight +'px)'}">
<div
class="lpbContent"
ref="lpbContent"
:style="{ height: 'calc(100% - ' + lpbContentHeight + 'px)' }"
>
<!-- 纵向倒序排列 逻辑幢位于独立幢单元和独立层户的上方 -->
<div class="ch-zdy-wrap">
<!-- 幢单元 -->
<zdy-cpn v-if="lpbData.zdys.length" :zdys="lpbData.zdys" :onlyShow="onlyShow" />
<zdy-cpn
v-if="lpbData.zdys.length"
:zdys="lpbData.zdys"
:onlyShow="onlyShow"
/>
<!-- 独立层户 -->
<ch-cpn v-if="lpbData.cs.length" :ch="lpbData.cs" :onlyShow="onlyShow" />
<ch-cpn
v-if="lpbData.cs.length"
:ch="lpbData.cs"
:onlyShow="onlyShow"
/>
</div>
<!-- 逻辑幢 -->
<ljzs-cpn v-if="lpbData.ljzs.length" :ljzs="lpbData.ljzs" :onlyShow="onlyShow" />
<ljzs-cpn
v-if="lpbData.ljzs.length"
:ljzs="lpbData.ljzs"
:onlyShow="onlyShow"
/>
</div>
<!-- 自然幢名称 -->
<p class="lpb-xmmc" v-if="onlyShow" style="border-bottom: 1px solid #e6e6e6">{{ lpbData.xmmc }}</p>
<p class="lpb-xmmc" v-else :style="{ 'border-bottom':'1px solid #e6e6e6'}">
<p
class="lpb-xmmc"
v-if="onlyShow"
style="border-bottom: 1px solid #e6e6e6"
>
{{ lpbData.xmmc }}
</p>
<p
class="lpb-xmmc"
v-else
:style="{ 'border-bottom': '1px solid #e6e6e6' }"
>
<el-checkbox @change="zdySelectAll($event)">{{
lpbData.xmmc
}}</el-checkbox>
</p>
<el-button type="primary" class="save-btn" v-if="!onlyShow && showSave" @click="saveLpb">选择确认</el-button>
<el-button type="primary" class="save-btn" v-if="!onlyShow && !showSave" @click="submitForm" :loading="loading">发起申请</el-button>
<el-button
type="primary"
class="save-btn"
v-if="!onlyShow && showSave"
@click="saveLpb"
>选择确认</el-button
>
<el-button
type="primary"
class="save-btn"
v-if="!onlyShow && !showSave"
@click="submitForm"
:loading="loading"
>发起申请</el-button
>
<!-- 右键菜单 -->
<ul
v-show="lpbChVisible"
:style="{ left: lpbChLeft + 'px', top: lpbChTop + 'px' }"
class="contextmenu">
class="contextmenu"
>
<li @click="menuClick">菜单一</li>
<li @click="menuClick">菜单二</li>
</ul>
</div>
</template>
<script>
import { getLpb } from "@/api/lpcx.js";
import chCpn from "./ch.vue";
import zdyCpn from "./zdys.vue";
import ljzsCpn from "./ljzs.vue";
import { startBusinessFlow, choiceBdcdy, againAddSldy } from "@/api/workFlow.js";
import jump from "../../ywbl/ywsq/components/mixin/jump";
import store from '@/store/index.js'
import { ywPopupCacel } from "@/utils/popup.js";
export default {
import { getLpb } from "@/api/lpcx.js";
import chCpn from "./ch.vue";
import zdyCpn from "./zdys.vue";
import ljzsCpn from "./ljzs.vue";
import {
startBusinessFlow,
choiceBdcdy,
againAddSldy,
} from "@/api/workFlow.js";
import jump from "../../ywbl/ywsq/components/mixin/jump";
import store from "@/store/index.js";
import { ywPopupCacel } from "@/utils/popup.js";
export default {
mixins: [jump],
provide () {
provide() {
return {
openMenu: this.openMenu,
selectAll: this.selectAllObj,
changeChoosedObj: this.changeChoosedObj,
clearChangeChoosedObj: this.clearChangeChoosedObj,
getBsmList: this.getBsmList
getBsmList: this.getBsmList,
};
},
name: "",
......@@ -79,42 +123,10 @@
},
sqywInfo: {
type: Object,
default: () => { }
},
name: "",
components: { chCpn, zdyCpn, ljzsCpn },
props: {
zrzbsm: {
type: String,
default: "",
},
lpbParent: {
type: String,
default: "isLpb",
},
isHb: {
type: Boolean,
default: true,
},
onlyShow: {
type: Boolean,
default: true,
},
showSave: {
type: Boolean,
default: false,
default: () => {},
},
scyclx: {
type: Number,
default: 0,
},
sqywInfo: {
type: Object,
default: () => { }
},
isJump: { type: Boolean, default: false },
},
data () {
data() {
return {
lpbData: {
ljzs: [],
......@@ -133,61 +145,89 @@
// 改变户选中状态
changeChoosedObj: {
bsms: [],
color: ''
color: "",
},
// 选中户bsm合集
bsmList: [],
loading: false,
};
},
mounted () {
this.scyclx ? this.getLpb(this.zrzbsm, this.scyclx) : this.getLpb(this.zrzbsm);
mounted() {
this.scyclx
? this.getLpb(this.zrzbsm, this.scyclx)
: this.getLpb(this.zrzbsm);
window.lpbContent = this;
},
methods: {
/**
* @description: 获取当前楼盘表选中户信息
* @param {Array} bsmList
* @author: renchao
*/
getBsmList(bsmList, compFlag) {
// 根据本次传入的组件标识删除之前对应组件标识存入hbsmList的数据
this.bsmList = this.bsmList.filter((i) => i.flag != compFlag);
// 合并本次数据
this.bsmList = this.bsmList.concat([
...new Map(bsmList.map((item) => [item.bdcdyh, item])).values(),
]);
// })
},
/**
* @description: 保存当前楼盘表
* @author: renchao
*/
saveLpb () {
saveLpb() {
if (this.bsmList.length == 0) {
this.$message.error("请至少选择一条数据");
return;
}
this.loading = true;
store.dispatch("user/reMenuRefresh", false);
againAddSldy({
bsmSqyw: this.sqywInfo.bsmSqyw,
bsmSlsq: this.sqywInfo.bsmSlsq,
bdcdysz: this.bsmList,
sjlx: "houses"
}).then((res) => {
this.loading = false
sjlx: "houses",
})
.then((res) => {
this.loading = false;
if (res.code == 200) {
this.$message({
showClose: true,
message: '添加成功',
type: 'success'
})
message: "添加成功",
type: "success",
});
if (!this.isJump) {
this.jump(res.result, this.sqywInfo.djywbm)
} else {
store.dispatch('user/refreshPage', true);
this.jump(res.result, this.sqywInfo.djywbm);
}
store.dispatch("user/refreshPage", true);
//this.close();
this.$popupCacel();
} else {
if (res.result && res.result.length > 0) {
this.$popup("申请错误明细", "components/ywdialog", { width: '36%', formData: { result: res.result } })
this.$popup("申请错误明细", "components/ywdialog", {
width: "36%",
formData: { result: res.result },
});
} else {
if (res.result && res.result.length > 0) {
this.$popup("申请错误明细", "components/ywdialog", { width: '36%', formData: { result: res.result } })
this.$popup("申请错误明细", "components/ywdialog", {
width: "36%",
formData: { result: res.result },
});
} else {
this.$popup("申请错误明细", "components/ywdialog", { width: '36%', formData: { message: res.message } })
this.$popup("申请错误明细", "components/ywdialog", {
width: "36%",
formData: { message: res.message },
});
}
}
}
}).catch(() => {
this.loading = false
})
.catch(() => {
this.loading = false;
});
// todo 调用保存接口 传入参数待定
//console.log(this.bsmList,'this.bsmList');
// 保存成功后关闭弹框
......@@ -200,7 +240,7 @@
* @param {*} color
* @author: renchao
*/
changeChoosed (bsms, color) {
changeChoosed(bsms, color) {
this.changeChoosedObj.bsms = bsms;
this.changeChoosedObj.color = color;
},
......@@ -208,7 +248,7 @@
* @description: clearChangeChoosedObj
* @author: renchao
*/
clearChangeChoosedObj () {
clearChangeChoosedObj() {
this.changeChoosedObj.bsms = [];
},
//全选户
......@@ -217,7 +257,7 @@
* @param {*} val
* @author: renchao
*/
zdySelectAll (val) {
zdySelectAll(val) {
this.selectAllObj.selectAll = val;
},
//获取楼盘表数据
......@@ -228,7 +268,7 @@
* @param {*} actual
* @author: renchao
*/
getLpb (zrzbsm, scyclx, actual) {
getLpb(zrzbsm, scyclx, actual) {
if (!zrzbsm) {
this.$message({
message: "暂无楼盘表",
......@@ -239,8 +279,11 @@
if (res.code == 200) {
if (scyclx) {
if (res.result.syclx == "1") {
res.result.lpb.ljzs = res.result.lpb.ljzs.sort(this.compare("place"));
this.lpbData = res.result.lpb == null ? this.lpbData : res.result.lpb;
res.result.lpb.ljzs = res.result.lpb.ljzs.sort(
this.compare("place")
);
this.lpbData =
res.result.lpb == null ? this.lpbData : res.result.lpb;
}
} else {
this.$message({
......@@ -256,7 +299,6 @@
}
});
}
},
//户右键点击事件
/**
......@@ -266,7 +308,7 @@
* @param {*} type
* @author: renchao
*/
openMenu (e, item, type) {
openMenu(e, item, type) {
this.lpbChLeft = e.pageX - 96;
this.lpbChTop = e.pageY - 23;
// this.lpbChVisible = true;
......@@ -276,7 +318,7 @@
* @description: 关闭户右键菜单
* @author: renchao
*/
closeMenu () {
closeMenu() {
this.lpbChVisible = false;
},
//右键菜单点击
......@@ -284,7 +326,7 @@
* @description: 右键菜单点击
* @author: renchao
*/
menuClick () {
menuClick() {
this.closeMenu();
},
/**
......@@ -292,7 +334,7 @@
* @param {*} property
* @author: renchao
*/
compare (property) {
compare(property) {
return function (a, b) {
var value1 = a[property];
var value2 = b[property];
......@@ -303,7 +345,7 @@
* @description: submitForm
* @author: renchao
*/
submitForm () {
submitForm() {
if (this.bsmList.length == 0) {
this.$message.error("请至少选择一条数据");
return;
......@@ -312,60 +354,68 @@
startBusinessFlow({
bsmSqyw: this.sqywInfo.bsmSqyw,
bdcdysz: this.bsmList,
}).then((res) => {
this.loading = false
})
.then((res) => {
this.loading = false;
if (res.code == 200) {
this.$message({
showClose: true,
message: '发起申请成功',
type: 'success'
})
message: "发起申请成功",
type: "success",
});
if (!this.isJump) {
this.jump(res.result, this.sqywInfo.djywbm)
this.jump(res.result, this.sqywInfo.djywbm);
} else {
store.dispatch('user/refreshPage', true);
store.dispatch("user/refreshPage", true);
}
this.close()
this.close();
} else {
if (res.result && res.result.length > 0) {
this.$popup("申请错误明细", "components/ywdialog", { width: '36%', formData: { result: res.result } })
this.$popup("申请错误明细", "components/ywdialog", {
width: "36%",
formData: { result: res.result },
});
} else {
this.$popup("申请错误明细", "components/ywdialog", { width: '36%', formData: { message: res.message } })
this.$popup("申请错误明细", "components/ywdialog", {
width: "36%",
formData: { message: res.message },
});
}
}
}).catch(() => {
this.loading = false
})
.catch(() => {
this.loading = false;
});
},
/**
* @description: close
* @param {*} val
* @author: renchao
*/
close () {
ywPopupCacel()
close() {
ywPopupCacel();
},
},
computed: {
lpbContentHeight () {
return this.onlyShow ? 32 : 76
lpbContentHeight() {
return this.onlyShow ? 32 : 76;
// return 76
}
},
},
watch: {
//户右键菜单显示时,监听到鼠标点击时关闭户右键菜单
lpbChVisible (value) {
lpbChVisible(value) {
if (value) {
document.body.addEventListener("click", this.closeMenu);
} else {
document.body.removeEventListener("click", this.closeMenu);
}
}
},
};
},
};
</script>
<style scoped lang="scss">
.lpbContent-wrap {
.lpbContent-wrap {
width: 100%;
height: 100%;
overflow: hidden;
......@@ -437,5 +487,5 @@
background: #ffffff;
}
}
}
}
</style>
......