From 6ff48bb128d7fc2e92ed5b3367a9545178a47b73 Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Tue, 20 Feb 2024 14:50:05 +0800
Subject: [PATCH] 公司管理保存只提示一次,底部切换tab保存数据
---
src/views/property/companyManage.vue | 460 ++++++++++++++++++++++++++++----------------------------
1 files changed, 231 insertions(+), 229 deletions(-)
diff --git a/src/views/property/companyManage.vue b/src/views/property/companyManage.vue
index ae77edd..a5f339b 100644
--- a/src/views/property/companyManage.vue
+++ b/src/views/property/companyManage.vue
@@ -1,265 +1,267 @@
<!-- 物业公司管理 -->
<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>
+ <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>
- </div>
- <div class="submit-btn">
- <el-button type="primary" @click="handleSubmit">保存</el-button>
- </div>
- </basic-container>
+ <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 {
+import {
getList
- } from "@/api/subjectChoices/subjectChoices"
- import {
+} from "@/api/subjectChoices/subjectChoices"
+import {
getDetailByDeptId
- } from "@/api/property/companyManage.js"
- import {
+} from "@/api/property/companyManage.js"
+import {
update,
- } from "@/api/property/propertyCompany"
- import {
+} 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'
+} 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,
+ }]
},
- cascader: ['city'],
- }, {
- labelWidth: 60,
- label: '城市',
- prop: 'city',
- type: 'select',
- span: 8,
- dicUrl: `/api/blade-system/region/select?code={{key}}`,
- props: {
- label: 'name',
- value: 'code'
+ wyForm: {},
+ activeName: 'info1',
+ questionBankData: [],
+ page: {
+ pageSize: 20,
+ currentPage: 1,
},
- 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()
+ 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: "操作成功!",
+ // 获取基本信息
+ initBasicInfo () {
+ getDetailByDeptId().then(res => {
+ this.wyForm = res.data.data
+ this.questionBankOnLoad(this.page)
})
- 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()
- },
+ 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.saveQuestionBank()
+ this.questionBankOnLoad(this.page, param)
+ },
+
+ // 保存按钮
+ handleSubmit () {
+ // 保存基本信息
+ this.saveBasicInfo()
+ // 保持考试信息
+ this.saveQuestionBank()
+ },
}
- }
+}
</script>
<style lang="scss" scoped>
- :deep(.answer) {
+:deep(.answer) {
.topic-item {
- margin-bottom: 20px;
+ margin-bottom: 20px;
- .topic-title {
- margin-bottom: 10px;
- }
-
- .topic-options {
- display: flex;
-
- .el-radio {
- margin-bottom: 10px;
+ .topic-title {
+ margin-bottom: 10px;
}
- .input-num-item {
- display: flex;
- margin-right: 20px;
-
- .num-name {
+ .topic-options {
display: flex;
- align-items: center;
- margin-right: 6px;
- }
- }
- }
- }
- }
- .submit-btn {
+ .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>
\ No newline at end of file
--
Gitblit v1.9.3