linwei
2024-02-19 ea6275a4cbcd75120ec22c664859c4dcb3c4d6ba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!-- 物业公司管理 -->
<template>
  <basic-container>
    <div class="basic-info">
      <avue-form :option="wyOption" v-model="wyForm"></avue-form>
    </div>
    <div class="detail-container">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="基础信息" name="info1"></el-tab-pane>
        <el-tab-pane label="经营信息" name="info2"></el-tab-pane>
        <el-tab-pane label="纳税信息" name="info3"></el-tab-pane>
        <el-tab-pane label="党建信息" name="info4"></el-tab-pane>
        <el-tab-pane label="企业良好行为" name="info5"></el-tab-pane>
        <el-tab-pane label="项目良好行为" name="info6"></el-tab-pane>
        <el-tab-pane label="违法违规行为惩戒" name="info7"></el-tab-pane>
      </el-tabs>
      <div class="answer">
        <div class="topic-item" v-for="(item, index) in questionBankData" :key="index">
          <div class="topic-title">
            {{ index + 1 }} .{{ item.subjectName }}
          </div>
 
          <div class="topic-options" v-if="item.choicesType == 0">
            <el-radio-group v-model="item.chooseId">
              <el-radio :label="item1.id" v-for="(item1, index1) in item.subjectOptionList"
                :key="index1">{{ item1.optionName }}</el-radio>
            </el-radio-group>
          </div>
 
          <div class="topic-options" v-if="item.choicesType == 3">
            <div class="input-num-item" v-for="(item1, index1) in item.subjectOptionList" :key="index1">
              <div class="num-name">{{ item1.optionName }}:</div>
              <el-input-number v-model="item1.numbers" @change="handleChange" :min="0" :max="25"
                :label="item1.optionName"></el-input-number>
            </div>
          </div>
        </div>
 
      </div>
    </div>
    <div class="submit-btn">
      <el-button type="primary" @click="handleSubmit">保存</el-button>
    </div>
  </basic-container>
</template>
 
<script>
  import {
    getList
  } from "@/api/subjectChoices/subjectChoices"
  import {
    getDetailByDeptId
  } from "@/api/property/companyManage.js"
  import {
    update,
  } from "@/api/property/propertyCompany"
  import {
    save
  } from "@/api/answerRecord/answerRecord"
  export default {
    data() {
      return {
        wyOption: {
          submitBtn: false,
          emptyBtn: false,
          column: [{
            label: "物业公司名称",
            labelWidth: 120,
            type: 'input',
            prop: "name",
            span: 24,
            // offset: 2,
          }, {
            labelWidth: 120,
            label: '省份',
            prop: 'province',
            type: 'select',
            span: 8,
            dicUrl: `/api/blade-system/region/select?code=100000`,
            props: {
              label: 'name',
              value: 'code'
            },
            cascader: ['city'],
          }, {
            labelWidth: 60,
            label: '城市',
            prop: 'city',
            type: 'select',
            span: 8,
            dicUrl: `/api/blade-system/region/select?code={{key}}`,
            props: {
              label: 'name',
              value: 'code'
            },
            cascader: ['area'],
          }, {
            labelWidth: 60,
            label: '地区',
            prop: 'area',
            type: 'select',
            span: 8,
            dicUrl: `/api/blade-system/region/select?code={{key}}`,
            props: {
              label: 'name',
              value: 'code'
            }
          }, {
            label: "地址",
            labelWidth: 120,
            type: 'input',
            prop: "address",
            span: 24,
            // offset: 2,
          }, {
            label: "社会信用代码",
            labelWidth: 120,
            type: 'input',
            prop: "socialCreditCode",
            span: 24,
            // offset: 2,
          }, {
            label: "简介",
            labelWidth: 120,
            component: "AvueUeditor",
            prop: "remark",
            span: 24,
            // offset: 2,
          }]
        },
        wyForm: {},
        activeName: 'info1',
        questionBankData: [],
        page: {
          pageSize: 20,
          currentPage: 1,
        },
      }
    },
    watch: {},
 
    created() {
      this.initBasicInfo()
    },
 
    methods: {
      // 获取基本信息
      initBasicInfo() {
        getDetailByDeptId().then(res => {
          this.wyForm = res.data.data
          this.questionBankOnLoad(this.page)
        })
      },
 
      // 保存基本信息
      saveBasicInfo() {
        update(this.wyForm).then(
          () => {
            this.$message({
              type: "success",
              message: "操作成功!",
            })
            this.initBasicInfo()
          },
          (error) => {
            window.console.log(error)
            loading()
          }
        )
      },
 
      // 获取题目
      questionBankOnLoad(page, params = {
        subclassName: '基础信息',
        propertyId: this.wyForm.id
      }) {
        getList(
          page.currentPage,
          page.pageSize,
          params
        ).then(res => {
          const data = res.data.data
          this.page.total = data.total
          this.questionBankData = data.records
          this.questionBankData.forEach(item => {
            item.propertyId = this.wyForm.id
          })
        })
      },
 
      // 保持题目
      saveQuestionBank() {
        save(this.questionBankData).then(
          () => {
            this.$message({
              type: "success",
              message: "操作成功!",
            })
            // this.questionBankOnLoad(this.page, param = {
            //   subclassName: this.activeName,
            //   propertyId: this.wyForm.id
            // })
          },
          (error) => {
            window.console.log(error)
          }
        )
      },
 
      // 点击tab切换
      handleClick(tab) {
        let param = {
          subclassName: tab.label,
          propertyId: this.wyForm.id
        }
        this.questionBankOnLoad(this.page, param)
      },
 
      // 保存按钮
      handleSubmit() {
        // 保存基本信息
        this.saveBasicInfo()
        // 保持考试信息
        this.saveQuestionBank()
      },
    }
  }
</script>
 
<style lang="scss" scoped>
  :deep(.answer) {
    .topic-item {
      margin-bottom: 20px;
 
      .topic-title {
        margin-bottom: 10px;
      }
 
      .topic-options {
        display: flex;
 
        .el-radio {
          margin-bottom: 10px;
        }
 
        .input-num-item {
          display: flex;
          margin-right: 20px;
 
          .num-name {
            display: flex;
            align-items: center;
            margin-right: 6px;
          }
        }
      }
    }
  }
 
  .submit-btn {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
  }
</style>