From 5b98b8b9d95713c20874632a7924e7507202b175 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 03 十二月 2024 19:14:09 +0800
Subject: [PATCH] 开发

---
 admin/src/views/contract/components/contractEdit.vue |   88 +++++++++++++++++++++++++++++++++----------
 1 files changed, 67 insertions(+), 21 deletions(-)

diff --git a/admin/src/views/contract/components/contractEdit.vue b/admin/src/views/contract/components/contractEdit.vue
index fd529c4..ba9a693 100644
--- a/admin/src/views/contract/components/contractEdit.vue
+++ b/admin/src/views/contract/components/contractEdit.vue
@@ -1,6 +1,4 @@
 <template>
-<!--  :text="activeTabs === 0 ? '涓嬩竴姝�' : '鎻愪氦'"-->
-<!--  :backText="activeTabs === 0 ? '杩斿洖' : '涓婁竴姝�'"-->
   <GlobalWindow
     width="100%"
     :title="title"
@@ -42,7 +40,7 @@
                 <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>
@@ -65,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>
@@ -294,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'
@@ -335,6 +337,7 @@
         zlDate: [],
         zlDetailList: [
           {
+            circleType: 0,
             startDate: '',
             endDate: '',
             time: [],
@@ -350,6 +353,7 @@
         wyDate: [],
         wyDetailList: [
           {
+            circleType: 0,
             startDate: '',
             endDate: '',
             time: [],
@@ -367,6 +371,8 @@
       wyList: [],
       
       rules,
+  
+      contactsList: [],
 
       loadingInstance: null,
       uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadBatch',
@@ -407,6 +413,7 @@
     open (title, target) {
       this.title = title
       this.ids = []
+      this.houseList = []
       this.getUser()
       this.getProject()
       this.getCompany()
@@ -422,18 +429,20 @@
         }
         this.form.zlDetailList = [
           {
-            startDate: '',
-            endDate: '',
-            time: [],
+            circleType: 0,
+            startDate: this.form.startDate,
+            endDate: this.form.endDate,
+            time: [this.form.startDate, this.form.endDate],
             price: '',
             advanceDays: ''
           }
         ]
         this.form.wyDetailList = [
           {
-            startDate: '',
-            endDate: '',
-            time: [],
+            circleType: 0,
+            startDate: this.form.startDate,
+            endDate: this.form.endDate,
+            time: [this.form.startDate, this.form.endDate],
             price: '',
             advanceDays: ''
           }
@@ -444,7 +453,15 @@
         this.form.signDate = this.getDayTime()
         this.form.startDate = this.getDayTime()
         this.form.endDate = this.getDayTime(1)
-        this.getHouseTree()
+        // this.getHouseTree()
+      })
+    },
+    // 鑾峰彇鑱旂郴浜�
+    getYwList () {
+      ywList({
+        customerId: this.form.renterId
+      }).then(res => {
+        this.contactsList = res
       })
     },
     getHouseData () {
@@ -470,10 +487,34 @@
         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) {
@@ -539,7 +580,8 @@
     getHouseTree () {
       tree({
         startDate: this.form.startDate,
-        endDate: this.form.endDate
+        endDate: this.form.endDate,
+        projectId: this.form.projectId
       })
         .then(res => {
           res.forEach(item => {
@@ -590,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: ''
       })
@@ -625,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) => {
@@ -718,6 +763,7 @@
   position: sticky;
   top: 0;
   left: 0;
+  z-index: 999;
 }
 .tabs {
   border-bottom: 1px solid #DFE2E8;

--
Gitblit v1.9.3