From 67e04d39f0dada85f2fa7a855058d7424c3faf35 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Tue, 16 Jan 2024 17:16:37 +0800
Subject: [PATCH] 物业评分

---
 src/api/subjectChoices/subjectChoices.js       |   49 +++
 src/api/subjectOption/subjectOption.js         |   50 +++
 src/views/exam/addsubject.vue                  |  243 ++++++++++++++++
 src/views/property/components/propertyEdit.vue |  206 +++++++++++++
 src/views/exam/subject.vue                     |  340 ++++++++++++++++++++++
 5 files changed, 888 insertions(+), 0 deletions(-)

diff --git a/src/api/subjectChoices/subjectChoices.js b/src/api/subjectChoices/subjectChoices.js
new file mode 100644
index 0000000..39b830a
--- /dev/null
+++ b/src/api/subjectChoices/subjectChoices.js
@@ -0,0 +1,49 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-subjectChoices/subjectChoices/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/blade-subjectChoices/subjectChoices/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/blade-subjectChoices/subjectChoices/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/blade-subjectChoices/subjectChoices/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/blade-subjectChoices/subjectChoices/submit',
+    method: 'post',
+    data: row
+  })
+}
\ No newline at end of file
diff --git a/src/api/subjectOption/subjectOption.js b/src/api/subjectOption/subjectOption.js
new file mode 100644
index 0000000..73965be
--- /dev/null
+++ b/src/api/subjectOption/subjectOption.js
@@ -0,0 +1,50 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-subjectOption/subjectOption/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/blade-subjectOption/subjectOption/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/blade-subjectOption/subjectOption/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/blade-subjectOption/subjectOption/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/blade-subjectOption/subjectOption/submit',
+    method: 'post',
+    data: row
+  })
+}
+
diff --git a/src/views/exam/addsubject.vue b/src/views/exam/addsubject.vue
new file mode 100644
index 0000000..47bb23a
--- /dev/null
+++ b/src/views/exam/addsubject.vue
@@ -0,0 +1,243 @@
+<template>
+  <el-dialog :title="this.id ? '修改' : '新增'" width="60%" modal-append-to-body="false" append-to-body="true"
+    :close-on-click-model="true" :visible.sync="visible" @close="closeDialog">
+    <avue-form ref="form" :option="option" v-model="form" @submit="submit"></avue-form>
+  </el-dialog>
+</template>
+
+<script>
+  import {
+    getList,
+    add
+  } from "@/api/subjectChoices/subjectChoices";
+
+  export default {
+    name: "add",
+    data() {
+      return {
+        inputs: {
+          input1: 1,
+        },
+        editFlag: false,
+        optionContentAId: null,
+        optionContentBId: null,
+        optionContentCId: null,
+        optionContentDId: null,
+        optionContentEId: null,
+        arrContent: ["1"],
+        list: [{
+            data: 1,
+          },
+          {
+            data: 1,
+          },
+          {
+            data: 1,
+          },
+        ],
+        visible: false,
+        choicesType: "0",
+        loading: false,
+        form: {},
+        option: {
+          height: "auto",
+          calcHeight: 80,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 6,
+          border: true, //liu
+          stripe: true,
+          align: "center",
+          index: true,
+          selection: true,
+          viewBtn: true,
+          defaultExpandAll: true,
+          dialogClickModal: false,
+          column: [{
+              label: "类型",
+              prop: "choicesType",
+              slot: true,
+              type: "select",
+              dicData: [{
+                  label: "单选题",
+                  value: "0",
+                },
+                {
+                  label: "多选题",
+                  value: "1",
+                },
+                {
+                  label: "填空题",
+                  value: "3",
+                },
+              ],
+              rules: [{
+                required: true,
+                message: "请选择类型",
+                trigger: "blur",
+              }, ],
+              span: 24,
+            },
+            {
+              label: "题目名称",
+              prop: "subjectName",
+              search: true,
+              type: "textarea",
+              rules: [{
+                required: true,
+                message: "请输入题目名称",
+                trigger: "blur",
+              }, ],
+              span: 24,
+            }, {
+              label: '选项分值',
+              prop: 'score',
+              type: 'input',
+            },
+            {
+              label: "题目大题",
+              prop: "categoryName",
+              slot: true,
+              width: 96
+            },
+            {
+              label: "题目小题",
+              prop: "subclassName",
+              slot: true,
+              width: 96
+            },
+            {
+              label: '选项内容',
+              prop: 'subjectOptionList',
+              type: 'dynamic',
+              span: 24,
+              children: {
+                column: [{
+                  label: '选项标题',
+                  prop: 'optionName',
+                  type: 'input',
+                }, {
+                  label: '选项分值',
+                  prop: 'score',
+                  type: 'input',
+                }, {
+                  label: '选项公式',
+                  prop: 'formula',
+                  type: 'input',
+                }]
+              }
+            },
+          ],
+        },
+        formCheckbox: {},
+
+        formJudge: {},
+        formFill: {},
+
+        data: [{
+          discussContent: '',
+          optionContent: ''
+        }, {
+          discussContent: '',
+          optionContent: ''
+        }],
+      };
+    },
+    computed: {
+      // ...mapState({
+      //   userInfo: (state) => state.user.userInfo,
+      // }),
+    },
+    mounted() {},
+    methods: {
+      add() {
+        this.editFlag = true
+      },
+
+      edit(row) {
+        this.disCussFrom = row
+        this.editFlag = true
+      },
+      //初始化
+      inits(row) {
+        // var formula = "2 + 3 * (4 - 1)"; // 要转换的字符串表达式
+        // var result = eval(formula); // 调用eval()函数进行计算
+        // console.log(result); // 输出结果:9
+        console.table(row); // 输出结果为 "2"
+        // this.id = id || 0;
+        this.visible = true;
+        this.form = row
+        // this.list = [{
+        //   data: 1
+        // }];
+        // if (this.id) {
+        //   //查询题目信息
+        //   this.getSubjectInfo(id);
+        // }
+      },
+
+      //加一行
+      addRows() {
+        //获取已有行的数据
+        // debugger;
+        if (this.index == 6) {
+          return;
+        }
+        this.index++;
+        this.list.push({
+          data: this.index,
+        });
+        this.inputs[`input${this.index + 1}`] = "";
+      },
+      //减一行
+      deleteRows(index) {
+        if (this.index == 1) {
+          return;
+        }
+        this.index--;
+        this.list.splice(index, 1);
+      },
+      //单选题提交(新增)数据
+      submit(row, done, loading) {
+        var that = this;
+        add(row).then(
+          () => {
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            });
+            that.visible = false;
+            that.$refs.form.resetForm();
+            done();
+          },
+          (error) => {
+            window.console.log(error);
+            loading();
+          }
+        );
+      },
+      //关闭窗口清除数据
+      closeDialog() {
+        this.$refs.form.resetForm();
+      },
+    },
+  };
+</script>
+<style scoped>
+  .optionContent-suffix {
+    margin-top: 5px;
+  }
+
+  .optionContent-suffix span {
+    margin-left: -20px;
+  }
+
+  .optionContent-suffix .optionContent-input {
+    width: 90%;
+    margin-left: 10px;
+  }
+
+  .optionContent-suffix .optionContent-botton {
+    margin-left: 10px;
+  }
+</style>
\ No newline at end of file
diff --git a/src/views/exam/subject.vue b/src/views/exam/subject.vue
new file mode 100644
index 0000000..4f77aaa
--- /dev/null
+++ b/src/views/exam/subject.vue
@@ -0,0 +1,340 @@
+/* * @Author: Morpheus * @Date: 2021-07-05 16:31:54 * @Last Modified by: liu *
+@Last Modified time: 2021-11-23 14:14:38 * menu-name 题库查询 */
+<template>
+  <basic-container :class="">
+    <avue-crud class="company-box tablesss" :option="questionBankOption" :search.sync="questionBankSearch"
+      :table-loading="questionBankLoading" :data="questionBankData" ref="questionBankCrud" :page.sync="questionBankPage"
+      @selection-change="questionBankSelectionChange" @search-change="questionBankSearchChange"
+      @search-reset="questionBankSearchReset" @current-change="questionBankCurrentChange"
+      @size-change="questionBankSizeChange" @row-del="questionBankHandleDel" @on-load="questionBankOnLoad">
+      <template slot="menuLeft">
+        <el-button type="primary" size="small" icon="el-icon-plus" @click="questionBankHandleAdd">新 增
+        </el-button>
+      </template>
+
+      <template slot-scope="{ row }" slot="menu">
+        <el-button type="text" size="mini" icon="el-icon-edit" @click="questionBankHandleEdit(row)">编辑
+        </el-button>
+        <el-button type="text" size="mini" icon="el-icon-delete" @click="questionBankHandleDel(row)">删除
+        </el-button>
+      </template>
+    </avue-crud>
+
+    <el-dialog title="题库导入" append-to-body :visible.sync="excelBox" width="555px">
+      <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
+        <template slot="excelTemplate">
+          <el-button type="primary" @click="handleTemplate">
+            点击下载<i class="el-icon-download el-icon--right"></i>
+          </el-button>
+        </template>
+      </avue-form>
+    </el-dialog>
+    <addsubject ref="addsubject" v-on:refreshPage="refreshPage"></addsubject>
+  </basic-container>
+</template>
+
+<script>
+  import {
+    getList,
+    remove
+  } from "@/api/subjectChoices/subjectChoices";
+
+  import addsubject from "./addsubject.vue";
+  // import {
+  //   mapGetters,
+  //   mapState
+  // } from "vuex";
+  import Qs from "qs";
+  import {
+    getToken
+  } from "@/util/auth";
+  export default {
+    components: {
+      addsubject
+    },
+    data() {
+      return {
+        excelBox: false,
+        excelForm: {},
+        excelOption: {
+          submitBtn: false,
+          emptyBtn: false,
+          column: [{
+              label: "模板上传",
+              prop: "excelFile",
+              type: "upload",
+              drag: true,
+              loadText: "模板上传中,请稍等",
+              span: 24,
+              propsHttp: {
+                res: "data"
+              },
+              tip: "请上传 .xls,.xlsx 标准格式文件",
+              action: "/api/examSubjectChoices/import-examSubject"
+            },
+            {
+              label: "模板下载",
+              prop: "excelTemplate",
+              formslot: true,
+              span: 24
+            }
+          ]
+        },
+        questionBankOption: {
+          // 操作栏多余按钮去除
+          delBtn: false,
+          editBtn: false,
+          addBtn: false,
+          selection: true,
+          menu: true,
+          // 导出按钮
+          excelBtn: true,
+          excelBtnText: "题库导出",
+          // title: '题库',
+          align: "center",
+          height: "auto",
+          calcHeight: 80,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 4,
+          index: true,
+          indexLabel: "序号",
+          viewBtn: true,
+          //dialogType: 'drawer',
+          dialogClickModal: false,
+          // 操作栏宽度
+          menuWidth: 226,
+          // ...this.$store.state.control.clearOtherBut,
+          // ...this.$store.state.control.searchOpen,
+          column: [{
+              label: "题目类型",
+              prop: "choicesType",
+              search: true,
+              type: "select",
+              searchSpan: 4,
+              dicData: [{
+                  label: "单选题",
+                  value: 0
+                },
+                {
+                  label: "多选题",
+                  value: 1
+                },
+                {
+                  label: "实操题",
+                  value: 3
+                }
+              ],
+              slot: true,
+              width: 96
+            }, {
+              label: "题目名称",
+              prop: "subjectName",
+              searchSpan: 4,
+              search: true,
+              slot: true
+            },
+            {
+              label: "题目分值",
+              prop: "score",
+              slot: true,
+              width: 96
+            },
+            {
+              label: "大类",
+              prop: "categoryName",
+              slot: true,
+              search: true,
+              width: 96
+            }, {
+              label: "细类",
+              prop: "subclassName",
+              slot: true,
+              search: true,
+              width: 96
+            },
+            {
+              label: "创建时间",
+              prop: "createDate",
+              slot: true,
+              width: 130
+            },
+            {
+              label: "修改人",
+              prop: "modifier",
+              slot: true,
+              width: 96
+            },
+            {
+              label: "修改时间",
+              prop: "modifyDate",
+              slot: true,
+              width: 130
+            }
+          ]
+        },
+        questionBankSearch: {},
+        questionBankLoading: true,
+        questionBankData: [],
+        questionBankPage: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 16,
+          // ...this.$store.state.control.changePageSize
+        },
+        questionBankQuery: {},
+        questionBankSelectionList: []
+      };
+    },
+    mounted() {
+      this.$store.commit("setWindowSizeHeightAdd");
+    },
+    computed: {
+      // ...mapGetters(["userInfo", "permission"]),
+      permissionList() {
+        return {
+          // addBtn: this.vaildData(this.permission.subject_add, false),
+          // viewBtn: this.vaildData(this.permission.subject_view, false),
+          // delBtn: this.vaildData(this.permission.subject_delete, false),
+          // editBtn: this.vaildData(this.permission.subject_edit, false),
+          // excelBtn: this.vaildData(this.permission.subject_report, false)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.questionBankSelectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    methods: {
+      //触发页面刷新
+      refreshPage() {
+        this.questionBankOnLoad(this.questionBankPage);
+      },
+      questionBankHandleAdd() {
+        this.$refs.addsubject.inits();
+      },
+      questionBankHandleEdit(row) {
+        this.$refs.addsubject.inits(row);
+      },
+      questionBankOnLoad(page, params = {}) {
+        params = this.questionBankSearch;
+        this.questionBankLoading = false;
+        getList(
+          page.currentPage,
+          page.pageSize,
+          Object.assign(params, this.query)
+        ).then(res => {
+          const data = res.data.data;
+          this.questionBankPage.total = data.total;
+          this.questionBankData = data.records;
+          this.questionBankLoading = false;
+          this.$store.commit("setWindowSizeHeightAdd");
+          this.questionBankSelectionClear();
+        });
+      },
+      questionBankSelectionClear() {
+        this.questionBankSelectionList = [];
+        this.$refs.questionBankCrud.toggleSelection();
+      },
+      questionBankSelectionChange(list) {
+        this.questionBankSelectionList = list;
+      },
+      questionBankSearchChange(params, done) {
+        this.questionBankQuery = params;
+        this.questionBankPage.currentPage = 1;
+        this.questionBankOnLoad(this.questionBankPage, params);
+        done();
+      },
+      questionBankSearchReset() {
+        this.questionBankQuery = {};
+        this.questionBankOnLoad(this.questionBankPage);
+      },
+      questionBankCurrentChange(currentPage) {
+        this.questionBankPage.currentPage = currentPage;
+      },
+      questionBankSizeChange(pageSize) {
+        this.questionBankPage.pageSize = pageSize;
+      },
+
+      questionBankHandleDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.questionBankOnLoad(this.questionBankPage);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+
+      questionBankHandleDelete() {
+        if (this.questionBankSelectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.questionBankOnLoad(this.questionBankPage);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.questionBankCrud.toggleSelection();
+          });
+      },
+
+      //导出数据
+      handleExport() {
+        this.$confirm("是否导出清册数据?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          window.open(
+            `/api/apply/export-apply?examId=${this.$route.query.id}&${
+            this.website.tokenHeader
+          }=${getToken()}`
+          );
+        });
+      },
+      handleImport() {
+        this.excelBox = true;
+      },
+      handleTemplate() {
+        window.open(
+          `/api/examSubjectChoices/export-template?${
+          this.website.tokenHeader
+        }=${getToken()}`
+        );
+      },
+      uploadAfter(res, done, loading, column) {
+        window.console.log(column);
+        this.excelBox = false;
+        this.refreshChange();
+        done();
+      },
+      refreshChange() {
+        this.questionBankOnLoad(this.page, this.query);
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>
\ No newline at end of file
diff --git a/src/views/property/components/propertyEdit.vue b/src/views/property/components/propertyEdit.vue
new file mode 100644
index 0000000..3c66d15
--- /dev/null
+++ b/src/views/property/components/propertyEdit.vue
@@ -0,0 +1,206 @@
+<template>
+
+  <el-dialog title="" append-to-body :visible.sync="infoVisible" top="10vh" width="70%">
+    <el-tabs v-model="activeName" @tab-click="handleClick">
+      <el-tab-pane label="基础信息" name="first"></el-tab-pane>
+      <el-tab-pane label="基础信息" name="second"></el-tab-pane>
+      <el-tab-pane label="良好行为信息" name="third"></el-tab-pane>
+      <el-tab-pane label="不良行为信息" name="fourth"></el-tab-pane>
+    </el-tabs>
+
+
+    <avue-form :option="option" v-model="first" v-if="activeName == 'first'"></avue-form>
+
+    <!-- <avue-form :option="option" v-model="second" v-if="activeName == 'second'"></avue-form> -->
+    <div>
+
+      <div v-for="(item, index) in questionBankData" :key="index">
+        <div>
+          {{ item.subjectName }}
+        </div>
+        <div v-for="(item1, index1) in item.subjectOptionList" :key="index1">
+          <!-- <div>
+            {{ item1.optionName }}
+          </div> -->
+          <el-radio-group>
+            <el-radio :label="item1.id">{{item1.optionName}}</el-radio>
+          </el-radio-group>
+
+        </div>
+      </div>
+
+    </div>
+
+
+  </el-dialog>
+
+</template>
+<script>
+  import {
+    getList,
+    remove
+  } from "@/api/subjectChoices/subjectChoices";
+  export default {
+    data() {
+      return {
+        activeName: 'first',
+        infoVisible: false,
+        page: {
+          pageSize: 20,
+          currentPage: 1,
+        },
+        questionBankData: [],
+        query: {},
+        option: {
+          labelWidth: 120,
+          searchLabelWidth: 96,
+          searchShow: true,
+          searchMenuSpan: 3,
+          menuWidth: 280,
+
+          height: "auto",
+          calcHeight: 54,
+          dialogWidth: 1150,
+          tip: false,
+          border: true,
+          //stripe:true,
+          index: true,
+          viewBtn: true,
+          selection: true,
+          dialogClickModal: false,
+          column: [{
+              overHidden: true,
+              label: "物业公司名称",
+              prop: "name",
+              searchSpan: 5,
+              searchLabelWidth: 124,
+              search: true,
+              span: 18,
+              row: true,
+              width: 260,
+              rules: [{
+                required: true,
+                message: "请输入物业公司名称",
+                trigger: "blur",
+              }, ],
+            },
+            {
+              label: '省份',
+              prop: 'province',
+              type: 'select',
+              props: {
+                label: 'name',
+                value: 'code'
+              },
+              hide: true,
+              span: 6,
+              cascader: ['city'],
+              dicUrl: `/api/blade-system/region/select`,
+              rules: [{
+                required: true,
+                message: '请选择省份',
+                trigger: 'blur'
+              }]
+            },
+            {
+              label: '城市',
+              prop: 'city',
+              type: 'select',
+              span: 6,
+              labelWidth: 60,
+              cascader: ['area'],
+              props: {
+                label: 'name',
+                value: 'code'
+              },
+              hide: true,
+              dicUrl: `/api/blade-system/region/select?code={{key}}`,
+              rules: [{
+                required: true,
+                message: '请选择城市',
+                trigger: 'blur'
+              }]
+            },
+            {
+              label: '地区',
+              prop: 'area',
+              type: 'select',
+              span: 6,
+              labelWidth: 60,
+              props: {
+                label: 'name',
+                value: 'code'
+              },
+              hide: true,
+              dicUrl: `/api/blade-system/region/select?code={{key}}`,
+              rules: [{
+                required: true,
+                message: '请选择地区',
+                trigger: 'blur'
+              }]
+            },
+            {
+              overHidden: true,
+              label: "地址",
+              prop: "address",
+              span: 18,
+              row: true,
+            },
+            {
+              label: "社会信用代码",
+              prop: "socialCreditCode",
+            },
+
+            {
+              label: "简介",
+              prop: "remark",
+              component: "AvueUeditor",
+              options: {
+                action: "/api/blade-resource/oss/endpoint/put-file-attach",
+                props: {
+                  res: "data",
+                  url: "link",
+                },
+              },
+              hide: true,
+              minRows: 6,
+              span: 24,
+            },
+          ],
+        },
+      };
+    },
+    methods: {
+
+      questionBankOnLoad(page, params = {}) {
+        // params = {}
+        // this.questionBankLoading = false;
+        getList(
+          page.currentPage,
+          page.pageSize,
+          Object.assign(params, this.query)
+        ).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.questionBankData = data.records;
+          // this.questionBankLoading = false;
+        });
+      },
+
+      init(row) {
+        this.infoVisible = true
+      },
+
+      handleClick(tab, event) {
+        console.log(tab, event);
+        let param = {
+          categoryName: tab.label
+        }
+        this.questionBankOnLoad(this.page, param)
+      }
+    }
+  };
+</script>
+
+<style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3