From c01bdb2ed46f249a44b478c5f7210dae274daadc Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Thu, 18 Jan 2024 17:45:58 +0800
Subject: [PATCH] 物业评价

---
 src/views/property/propertyCompany.vue         |    8 +-
 src/api/answerRecord/answerRecord.js           |   49 ++++++++++++++++
 src/views/property/components/propertyEdit.vue |   92 ++++++++++++++++++++++--------
 3 files changed, 119 insertions(+), 30 deletions(-)

diff --git a/src/api/answerRecord/answerRecord.js b/src/api/answerRecord/answerRecord.js
new file mode 100644
index 0000000..c81970b
--- /dev/null
+++ b/src/api/answerRecord/answerRecord.js
@@ -0,0 +1,49 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-answerRecord/answerRecord/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/blade-answerRecord/answerRecord/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/blade-answerRecord/answerRecord/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const save = (row) => {
+  return request({
+    url: '/api/blade-answerRecord/answerRecord/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/blade-answerRecord/answerRecord/submit',
+    method: 'post',
+    data: row
+  })
+}
\ No newline at end of file
diff --git a/src/views/property/components/propertyEdit.vue b/src/views/property/components/propertyEdit.vue
index 4aa57a3..44d3b6e 100644
--- a/src/views/property/components/propertyEdit.vue
+++ b/src/views/property/components/propertyEdit.vue
@@ -1,6 +1,6 @@
 <template>
 
-  <el-dialog title="" append-to-body :visible.sync="infoVisible" top="10vh" width="70%">
+  <el-dialog title="" append-to-body :visible.sync="infoVisible" top="10vh" width="70%" :before-close="handleClose">
     <el-tabs v-model="activeName" @tab-click="handleClick">
       <!-- <el-tab-pane label="物业信息" name="first"></el-tab-pane> -->
       <el-tab-pane label="基础信息" name="info1"></el-tab-pane>
@@ -22,28 +22,37 @@
         <div>
           {{index+1}} .{{ item.subjectName }}
         </div>
-        <div v-for="(item1, index1) in item.subjectOptionList" :key="index1">
-          <!-- <div>
+        <!-- <div v-for="(item1, index1) in item.subjectOptionList" :key="index1"> -->
+        <!-- <div>
             {{ item1.optionName }}
           </div> -->
-          <el-radio-group v-model="item1.ids" v-if="item.choicesType == 0">
-            <el-radio :label="item1.id">{{item1.optionName}}</el-radio>
-          </el-radio-group>
+        <!-- <el-radio-group v-model="item.ids" v-if="item.choicesType == 0"> -->
 
-          <div v-if="item.choicesType == 3">
-            <div>{{item1.optionName}}</div>
+        <div v-if="item.choicesType == 0">
+          <div v-for="(item1, index1) in item.subjectOptionList" :key="index1">
+            <el-radio v-model="item1.ids" :label="item1.id">{{item1.optionName}}-----------{{item1.score}}</el-radio>
+          </div>
+        </div>
+
+        <!-- </el-radio-group> -->
+
+        <div v-if="item.choicesType == 3">
+          <!-- <div>{{item1.optionName}}</div> -->
+          <div v-for="(item1, index1) in item.subjectOptionList" :key="index1">
             <el-input-number v-model="item1.numbers" @change="handleChange" :min="0" :max="25"
               :label="item1.optionName"></el-input-number>
-            <!-- <el-input v-model="item1.numbers" type="number" :placeholder="item1.optionName"></el-input> -->
           </div>
 
+          <!-- <el-input v-model="item1.numbers" type="number" :placeholder="item1.optionName"></el-input> -->
         </div>
+
+        <!-- </div> -->
       </div>
 
     </div>
 
     <div slot="footer" class="dialog-footer">
-      <el-button @click="payInfoVisible = false">取 消</el-button>
+      <el-button @click="infoVisible = false">取 消</el-button>
       <el-button type="primary" @click="submit">提 交</el-button>
     </div>
 
@@ -56,6 +65,10 @@
     getList,
     remove
   } from "@/api/subjectChoices/subjectChoices";
+
+  import {
+    save
+  } from "@/api/answerRecord/answerRecord";
   import {
     add
   } from "@/api/property/propertyCompany"
@@ -65,6 +78,7 @@
   export default {
     data() {
       return {
+        property: {},
         activeName: 'info1',
         infoVisible: false,
         page: {
@@ -196,6 +210,29 @@
       ...mapGetters(["permission", "userInfo"]),
     },
     methods: {
+
+      handleClose() {
+        this.infoVisible = false
+        // this.$refs.DisCussFrom && this.$refs.DisCussFrom.resetForm()
+      },
+
+      submit() {
+        console.log("============>", this.questionBankData)
+        save(this.questionBankData).then(
+          () => {
+            // this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            done()
+          },
+          (error) => {
+            window.console.log(error)
+            loading()
+          }
+        )
+      },
       handleChange(value) {
         console.log(value);
       },
@@ -230,7 +267,9 @@
           const data = res.data.data;
           this.page.total = data.total;
           this.questionBankData = data.records;
-          // this.questionBankLoading = false;
+          this.questionBankData.forEach(item => {
+            item.propertyId = this.property.id
+          })
         });
       },
 
@@ -239,25 +278,26 @@
         let param = {
           subclassName: '基础信息'
         }
+        this.property = row
         this.questionBankOnLoad(this.page, param)
       },
 
       handleClick(tab, event) {
-        this.$confirm("确定将选择数据删除?", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning",
-          })
-          .then(() => {
-            return remove(row.id)
-          })
-          .then(() => {
-            this.onLoad(this.page)
-            this.$message({
-              type: "success",
-              message: "操作成功!",
-            })
-          })
+        // this.$confirm("确定将选择数据删除?", {
+        //     confirmButtonText: "确定",
+        //     cancelButtonText: "取消",
+        //     type: "warning",
+        //   })
+        //   .then(() => {
+        //     return remove(row.id)
+        //   })
+        //   .then(() => {
+        //     this.onLoad(this.page)
+        //     this.$message({
+        //       type: "success",
+        //       message: "操作成功!",
+        //     })
+        //   })
         // console.log(tab, event);
         console.log('============>', JSON.stringify(this.questionBankData))
         let param = {
diff --git a/src/views/property/propertyCompany.vue b/src/views/property/propertyCompany.vue
index d8c5ac5..3583278 100644
--- a/src/views/property/propertyCompany.vue
+++ b/src/views/property/propertyCompany.vue
@@ -18,8 +18,8 @@
           @click="openPayConfig(row)">商户配置
         </el-button>
 
-        <!-- <el-button :size="size" icon="el-icon-circle-plus-outline" type="text" @click="addProperty()">物业评定
-        </el-button> -->
+        <el-button :size="size" icon="el-icon-circle-plus-outline" type="text" @click="addProperty(row)">物业评定
+        </el-button>
       </template>
     </avue-crud>
 
@@ -350,8 +350,8 @@
     methods: {
 
 
-      addProperty() {
-        this.$refs.propertyEdit.init();
+      addProperty(row) {
+        this.$refs.propertyEdit.init(row);
       },
 
       aliSubmit(form, done) {

--
Gitblit v1.9.3