From 8f8205ef1e42ee7c94aa018946fb6fba994aeb33 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 03 十二月 2024 19:24:32 +0800
Subject: [PATCH] ll
---
admin/src/views/contract/components/contractEdit.vue | 213 ++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 169 insertions(+), 44 deletions(-)
diff --git a/admin/src/views/contract/components/contractEdit.vue b/admin/src/views/contract/components/contractEdit.vue
index d98469e..e7c7356 100644
--- a/admin/src/views/contract/components/contractEdit.vue
+++ b/admin/src/views/contract/components/contractEdit.vue
@@ -1,9 +1,15 @@
<template>
- <GlobalWindow width="100%" :title="title" :visible.sync="visible" :confirm-working="isWorking" @close="close"
- @confirm="confirm">
- <div class="tabs">
- <div class="tab" :class="{ active: activeTabs === 0 }" @click="tabsClick(0)">1銆佸熀鏈俊鎭�</div>
- <div class="tab" :class="{ active: activeTabs === 1 }" @click="tabsClick(1)">2銆佽垂鐢ㄦ潯娆�</div>
+ <GlobalWindow
+ width="100%"
+ :title="title"
+ :withFooter="false"
+ :visible.sync="visible"
+ :confirm-working="isWorking"
+ @confirm="confirm"
+ @close="close">
+ <div class="tabs fixed">
+ <div class="tab" :class="{ active: activeTabs === 0 }">1銆佸熀鏈俊鎭�</div>
+ <div class="tab" :class="{ active: activeTabs === 1 }">2銆佽垂鐢ㄦ潯娆�</div>
</div>
<div v-show="activeTabs === 0">
<div class="main">
@@ -25,16 +31,16 @@
</el-select>
</el-form-item>
<el-form-item label="鍚堝悓绛捐鏃ユ湡" prop="signDate">
- <el-date-picker type="date" v-model="form.signDate" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
+ <el-date-picker type="date" v-model="form.signDate" value-format="yyyy-MM-dd" :clearable="false" placeholder="璇烽�夋嫨" />
</el-form-item>
<el-form-item label="鍚堝悓寮�濮嬫棩鏈�" prop="startDate">
- <el-date-picker type="date" v-model="form.startDate" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
+ <el-date-picker type="date" v-model="form.startDate" @change="getHouseData" :clearable="false" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
</el-form-item>
<el-form-item label="鍚堝悓缁撴潫鏃ユ湡" prop="endDate">
- <el-date-picker type="date" v-model="form.endDate" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
+ <el-date-picker type="date" v-model="form.endDate" @change="getHouseData" :clearable="false" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
</el-form-item>
<el-form-item label="褰掑睘椤圭洰" prop="projectId">
- <el-select v-model="form.projectId" placeholder="璇烽�夋嫨">
+ <el-select v-model="form.projectId" @change="getHouseTree" placeholder="璇烽�夋嫨">
<el-option v-for="(item, index) in projectList" :key="index" :value="item.id" :label="item.name"></el-option>
</el-select>
</el-form-item>
@@ -57,8 +63,11 @@
<el-input v-model="form.renterName" readonly placeholder="璇风偣鍑婚�夋嫨绉熷" />
</div>
</el-form-item>
- <el-form-item label="鑱旂郴浜�" prop="memberName">
- <el-input v-model="form.memberName" readonly placeholder="璇风偣鍑婚�夋嫨绉熷" />
+ <el-form-item label="鑱旂郴浜�" prop="memberId">
+ <el-select v-model="form.memberId" placeholder="璇烽�夋嫨">
+ <el-option v-for="(item, index) in contactsList" :key="index" :value="item.id" :label="item.name"></el-option>
+ </el-select>
+<!-- <el-input v-model="form.memberName" readonly placeholder="璇风偣鍑婚�夋嫨绉熷" />-->
</el-form-item>
</div>
</el-form>
@@ -126,13 +135,13 @@
<el-button type="text" size="medium" @click="addZl">澧炲姞</el-button>
</div>
<div class="list">
- <template v-for="(item, index) in form.zlDetailList" :key="index">
+ <div v-for="(item, index) in form.zlDetailList" :key="index">
<el-form-item label="璧峰鏃ユ湡" prop="time">
<el-date-picker type="daterange" v-model="item.time" @change="getDate1($event, index)" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
</el-form-item>
<el-form-item label="鍚堝悓鍗曚环" prop="price">
- <el-input placeholder="璇疯緭鍏�" v-model="item.price">
- <el-select v-model="item.circleType" slot="append" placeholder="璇烽�夋嫨">
+ <el-input placeholder="璇疯緭鍏�" v-model="item.price" class="input-with-select">
+ <el-select v-model="item.circleType" style="width: 150px;" slot="append" placeholder="璇烽�夋嫨">
<el-option v-for="(item, index) in unitOps" :key="index" :value="item.value" :label="item.name"></el-option>
</el-select>
</el-input>
@@ -143,7 +152,7 @@
<el-link :underline="false" type="danger" @click="deleZl(index)" style="margin-left: 20px; flex-shrink: 0;">鍒犻櫎</el-link>
</div>
</el-form-item>
- </template>
+ </div>
</div>
</el-form>
</div>
@@ -173,11 +182,15 @@
</template>
</el-table-column>
<el-table-column prop="planPayDate" label="浠樻鏃�" align="center" show-overflow-tooltip />
- <el-table-column prop="receivableFee" label="搴旀敹" align="center" show-overflow-tooltip />
+ <el-table-column label="搴旀敹" align="center" show-overflow-tooltip>
+ <template slot-scope="{row}">
+ {{row.receivableFee}}鍏�
+ </template>
+ </el-table-column>
</el-table>
<div class="total">
<span>鎬昏</span>
- <div>璐圭敤搴旀敹鎬昏锛歿{zlPrice}}锛屾娂閲戝簲鏀舵�昏锛歿{form.zlDeposit}}</div>
+ <div>璐圭敤搴旀敹鎬昏锛歿{zlPrice}}鍏冿紝鎶奸噾搴旀敹鎬昏锛歿{form.zlDeposit}}鍏�</div>
</div>
</div>
<!-- 鐗╀笟鏉℃ -->
@@ -205,13 +218,13 @@
<el-button type="text" size="medium" @click="addWy">澧炲姞</el-button>
</div>
<div class="list">
- <template v-for="(item, index) in form.wyDetailList" :key="index">
+ <div v-for="(item, index) in form.wyDetailList" :key="index">
<el-form-item label="璧峰鏃ユ湡" prop="time">
<el-date-picker type="daterange" v-model="item.time" @change="getDate2($event, index)" value-format="yyyy-MM-dd" placeholder="璇烽�夋嫨" />
</el-form-item>
<el-form-item label="鍚堝悓鍗曚环" prop="price">
<el-input placeholder="璇疯緭鍏�" v-model="item.price">
- <el-select v-model="item.circleType" slot="append" placeholder="璇烽�夋嫨">
+ <el-select v-model="item.circleType" style="width: 150px;" slot="append" placeholder="璇烽�夋嫨">
<el-option v-for="(item, index) in unitOps" :key="index" :value="item.value" :label="item.name"></el-option>
</el-select>
</el-input>
@@ -222,7 +235,7 @@
<el-link :underline="false" type="danger" @click="deleWy(index)" style="margin-left: 20px; flex-shrink: 0;">鍒犻櫎</el-link>
</div>
</el-form-item>
- </template>
+ </div>
</div>
</el-form>
</div>
@@ -252,13 +265,24 @@
</template>
</el-table-column>
<el-table-column prop="planPayDate" label="浠樻鏃�" align="center" show-overflow-tooltip />
- <el-table-column prop="receivableFee" label="搴旀敹" align="center" show-overflow-tooltip />
+ <el-table-column prop="receivableFee" label="搴旀敹" align="center" show-overflow-tooltip>
+ <template slot-scope="{row}">
+ {{row.receivableFee}}鍏�
+ </template>
+ </el-table-column>
</el-table>
<div class="total">
<span>鎬昏</span>
- <div>璐圭敤搴旀敹鎬昏锛歿{wyPrice}}锛屾娂閲戝簲鏀舵�昏锛歿{form.wyDeposit}}</div>
+ <div>璐圭敤搴旀敹鎬昏锛歿{wyPrice}}鍏冿紝鎶奸噾搴旀敹鎬昏锛歿{form.wyDeposit}}鍏�</div>
</div>
</div>
+ </div>
+ <div class="window__footer" style="position: sticky; bottom: 0; left: 0; z-index: 9; background: #ffffff;">
+ <slot name="footer">
+ <el-button @click="confirm" :loading="confirmWorking" type="primary">{{activeTabs === 0 ? '涓嬩竴姝�' : '鎻愪氦'}}</el-button>
+ <slot name="btns" />
+ <el-button @click="close">{{activeTabs === 0 ? '杩斿洖' : '涓婁竴姝�'}}</el-button>
+ </slot>
</div>
<!-- 閫夋嫨绉熷 -->
<MemberSearch ref="MemberSearchRef" @select="getTenant" />
@@ -271,6 +295,7 @@
import MemberSearch from '@/components/common/MemberSearch'
import { rules } from './config'
import { create, getBillList } from '@/api/contract'
+import { ywList } from '@/api/customer'
import { getUserList } from '@/api/system/user'
import { getProjectList, tree } from '@/api/project/ywProject'
import { companyList } from '@/api/company'
@@ -312,6 +337,7 @@
zlDate: [],
zlDetailList: [
{
+ circleType: 0,
startDate: '',
endDate: '',
time: [],
@@ -327,6 +353,7 @@
wyDate: [],
wyDetailList: [
{
+ circleType: 0,
startDate: '',
endDate: '',
time: [],
@@ -344,6 +371,8 @@
wyList: [],
rules,
+
+ contactsList: [],
loadingInstance: null,
uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadBatch',
@@ -384,20 +413,61 @@
open (title, target) {
this.title = title
this.ids = []
+ this.houseList = []
this.getUser()
this.getProject()
this.getCompany()
- this.getHouseTree()
this.visible = true
this.$nextTick(() => {
+ this.$refs.form.resetFields()
for (const key in this.form) {
if (['roomIds', 'fileList', 'wyDate', 'zlDate'].includes(key)) {
this.form[key] = []
} else {
- this.form[key] = target[key]
+ this.form[key] = ''
}
}
+ this.form.zlDetailList = [
+ {
+ circleType: 0,
+ startDate: this.form.startDate,
+ endDate: this.form.endDate,
+ time: [this.form.startDate, this.form.endDate],
+ price: '',
+ advanceDays: ''
+ }
+ ]
+ this.form.wyDetailList = [
+ {
+ circleType: 0,
+ startDate: this.form.startDate,
+ endDate: this.form.endDate,
+ time: [this.form.startDate, this.form.endDate],
+ price: '',
+ advanceDays: ''
+ }
+ ]
+ this.wyList = []
+ this.zlList = []
+ this.form.userId = this.userInfo.id
+ this.form.signDate = this.getDayTime()
+ this.form.startDate = this.getDayTime()
+ this.form.endDate = this.getDayTime(1)
+ // this.getHouseTree()
})
+ },
+ // 鑾峰彇鑱旂郴浜�
+ getYwList () {
+ ywList({
+ customerId: this.form.renterId
+ }).then(res => {
+ this.contactsList = res
+ })
+ },
+ getHouseData () {
+ if (this.form.startDate && this.form.endDate) {
+ this.getHouseTree()
+ }
},
changeType (e) {
if (e === 0 || e === 2) {
@@ -406,11 +476,48 @@
this.cactiveTabs = 1
}
},
- confirm () {
- this.$refs.form.validate((valid) => {
- if (!valid) {
- return
+ getDayTime (num) {
+ const today = new Date();
+ const year = today.getFullYear();
+ const month = today.getMonth() + 1; // 鏈堜唤鏄粠 0 寮�濮嬬殑锛屽洜姝ら渶瑕佸姞 1
+ const day = today.getDate();
+ if (!num) {
+ return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
+ } else {
+ return `${year + 1}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
+ }
+ },
+ clearData () {
+ this.form.zlDetailList = [
+ {
+ circleType: 0,
+ startDate: this.form.startDate,
+ endDate: this.form.endDate,
+ time: [this.form.startDate, this.form.endDate],
+ price: '',
+ advanceDays: ''
}
+ ]
+ this.form.wyDetailList = [
+ {
+ circleType: 0,
+ startDate: this.form.startDate,
+ endDate: this.form.endDate,
+ time: [this.form.startDate, this.form.endDate],
+ price: '',
+ advanceDays: ''
+ }
+ ]
+ },
+ confirm () {
+ if (this.activeTabs === 0) {
+ this.$refs.form.validate((valid) => {
+ if (!valid) return
+ if (this.form.roomIds.length === 0) return this.$message.warning('璇烽�夋嫨鎴挎簮锛�')
+ this.clearData()
+ this.activeTabs = 1
+ })
+ } else if (this.activeTabs === 1) {
if (this.form.type === 0) {
this.$refs.paramCostRef.validate((valid1) => {
if (!valid1) {
@@ -438,7 +545,7 @@
this.submit()
})
}
- })
+ }
},
submit () {
// 璋冪敤鏂板缓鎺ュ彛
@@ -471,7 +578,11 @@
this.form.roomIds = arr.filter(item => item !== undefined);
},
getHouseTree () {
- tree({})
+ tree({
+ startDate: this.form.startDate,
+ endDate: this.form.endDate,
+ projectId: this.form.projectId
+ })
.then(res => {
res.forEach(item => {
item.disabled = true
@@ -490,30 +601,30 @@
}
},
generateZL () {
- getBillList({ ...this.form })
+ getBillList({ ...this.form, billType: 0 })
.then(res => {
let zlPrice = 0
let arr = []
res.forEach(item => {
if (item.costType === 0) {
zlPrice += item.receivableFee
- arr.push(item)
}
+ arr.push(item)
})
this.zlPrice = zlPrice
this.zlList = arr
})
},
generateWY () {
- getBillList({ ...this.form })
+ getBillList({ ...this.form, billType: 1 })
.then(res => {
let zlPrice = 0
let arr = []
res.forEach(item => {
if (item.costType === 1) {
zlPrice += item.receivableFee
- arr.push(item)
}
+ arr.push(item)
})
this.wyPrice = zlPrice
this.wyList = arr
@@ -521,18 +632,20 @@
},
addZl () {
this.form.zlDetailList.push({
- startDate: '',
- endDate: '',
- time: [],
+ circleType: 0,
+ startDate: this.form.startDate,
+ endDate: this.form.endDate,
+ time: [this.form.startDate, this.form.endDate],
price: '',
advanceDays: ''
})
},
addWy () {
this.form.wyDetailList.push({
- startDate: '',
- endDate: '',
- time: [],
+ circleType: 0,
+ startDate: this.form.startDate,
+ endDate: this.form.endDate,
+ time: [this.form.startDate, this.form.endDate],
price: '',
advanceDays: ''
})
@@ -556,8 +669,9 @@
getTenant (row) {
this.form.renterId = row.id
this.form.renterName = row.name
- this.form.memberId = row.memberId
- this.form.memberName = row.memberName
+ this.form.memberId = ''
+ this.form.memberName = ''
+ this.getYwList()
},
dele (imgaddr) {
this.form.fileList.forEach((item, index) => {
@@ -582,6 +696,7 @@
companyList({ type: 2 })
.then(res => {
this.comparyList = res
+ this.form.companyId = res[0].id
})
},
tabsClick (val) {
@@ -631,7 +746,11 @@
this.form.fileList.push({ ...item, fileurl: item.imgaddr, name: item.originname, userName: this.userInfo.realname, createTime: this.getDay() })
},
close () {
- this.$emit('close')
+ if (this.activeTabs === 0) {
+ this.$emit('close')
+ } else {
+ this.activeTabs = 0
+ }
}
}
}
@@ -639,7 +758,13 @@
<style lang="scss" scoped>
@import '@/assets/style/variables.scss';
-
+.fixed {
+ background: #ffffff;
+ position: sticky;
+ top: 0;
+ left: 0;
+ z-index: 999;
+}
.tabs {
border-bottom: 1px solid #DFE2E8;
display: flex;
--
Gitblit v1.9.3