linwei
2024-01-18 c01bdb2ed46f249a44b478c5f7210dae274daadc
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 = {