1 files modified
2 files added
| | |
| | | }) |
| | | } |
| | | |
| | | export const addTwo = (row) => { |
| | | return request({ |
| | | url: '/api/patrol/patrolGroup/addTwo', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | return request({ |
| | | url: '/api/patrol/patrolGroup/submit', |
| | |
| | | id |
| | | } |
| | | }) |
| | | } |
| | | } |
| New file |
| | |
| | | <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, |
| | | addTwo |
| | | } from "@/api/patrol/patrolGroup"; |
| | | |
| | | 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: "type", |
| | | type: "select", |
| | | props: { |
| | | label: "title", |
| | | value: "key", |
| | | }, |
| | | dicUrl: "/api/blade-system/dict-biz/tree?code=subject_max", |
| | | rules: [{ |
| | | required: true, |
| | | message: "请选择类型", |
| | | trigger: "blur", |
| | | }, ], |
| | | span: 24, |
| | | }, |
| | | { |
| | | prop: "id", |
| | | display: false, |
| | | type: 'input', |
| | | }, |
| | | { |
| | | label: "题目名称", |
| | | prop: "name", |
| | | search: true, |
| | | type: "textarea", |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入题目名称", |
| | | trigger: "blur", |
| | | }, ], |
| | | span: 24, |
| | | }, |
| | | { |
| | | label: '选项内容', |
| | | prop: 'patrolGroupItemList', |
| | | type: 'dynamic', |
| | | span: 24, |
| | | children: { |
| | | align: 'center', |
| | | headerAlign: 'center', |
| | | rowAdd: (done) => { |
| | | // this.$message.success('新增回调'); |
| | | done({ |
| | | input: '默认值' |
| | | }); |
| | | }, |
| | | rowDel: (row, done) => { |
| | | if (row.id) { |
| | | row.isDeleted = 1 |
| | | this.deleteList.push(row) |
| | | |
| | | } |
| | | // this.$message.success('删除回调' + JSON.stringify(row)); |
| | | done(); |
| | | }, |
| | | column: [{ |
| | | label: '选项标题', |
| | | prop: 'itemsName', |
| | | type: 'input', |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入选项标题", |
| | | trigger: "blur", |
| | | }, ], |
| | | }, { |
| | | label: '选项类型', |
| | | prop: 'type', |
| | | type: "select", |
| | | props: { |
| | | label: "title", |
| | | value: "key", |
| | | }, |
| | | dicUrl: "/api/blade-system/dict-biz/tree?code=subject", |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入选项类型", |
| | | trigger: "blur", |
| | | }, ], |
| | | }] |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | | formCheckbox: {}, |
| | | |
| | | formJudge: {}, |
| | | formFill: {}, |
| | | deleteList: [], |
| | | |
| | | 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; |
| | | // console.table(this.deleteList) |
| | | row.patrolGroupItemList = row.patrolGroupItemList.concat(this.deleteList) |
| | | addTwo(row).then( |
| | | () => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | that.visible = false; |
| | | that.$refs.form.resetForm(); |
| | | this.$emit('refreshPage'); |
| | | 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> |
| New file |
| | |
| | | /* * @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/patrol/patrolGroup"; |
| | | |
| | | 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: "type", |
| | | search: true, |
| | | type: "select", |
| | | searchSpan: 4, |
| | | dicUrl: "/api/blade-system/dict-biz/tree?code=subject_max", |
| | | props: { |
| | | label: "title", |
| | | value: "key", |
| | | }, |
| | | slot: true, |
| | | width: 96 |
| | | }, { |
| | | label: "题目名称", |
| | | prop: "name", |
| | | searchSpan: 4, |
| | | search: true, |
| | | slot: true |
| | | }, |
| | | { |
| | | 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; |
| | | for (var i = 0; i < this.questionBankData.length; i++) { |
| | | this.questionBankData[i].type = this.questionBankData[i].type.toString() |
| | | for (var j = 0; j < this.questionBankData[i].patrolGroupItemList.length; j++) { |
| | | this.questionBankData[i].patrolGroupItemList[j].type = this.questionBankData[i].patrolGroupItemList[j] |
| | | .type.toString() |
| | | } |
| | | } |
| | | 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> |