123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485 |
- <template>
- <div>
- <LinkTitlesCustom :currentPaths="['机构管理 ', '中心列表', '考点设置']" />
- <section class="content">
- <div class="box box-info">
- <div class="box-body">
- <!-- 表单 -->
- <ecs-form-search :model="formSearch">
- <el-row>
- <el-form-item label="学习中心">
- <el-input v-model="orgName" disabled />
- </el-form-item>
- <el-form-item label="考点代码">
- <el-input
- placeholder="请输入考点代码"
- v-model="formSearch.code"
- />
- </el-form-item>
- <el-form-item label="考点名称">
- <el-input
- placeholder="请输入考点名称"
- v-model="formSearch.name"
- />
- </el-form-item>
- <el-form-item>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-search"
- @click="searchForm"
- >
- 查询
- </el-button>
- <el-button size="small" @click="resetSearchForm">
- 重置
- </el-button>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- @click="insert"
- >
- 新增
- </el-button>
- <el-button size="small" type="info" @click="back">
- 退回
- </el-button>
- </el-form-item>
- </el-row>
- </ecs-form-search>
- <!-- 添加考点信息弹出框 -->
- <el-dialog
- title="考点信息"
- width="400px"
- :visible.sync="examSiteDialog"
- >
- <el-form
- :inline="true"
- inline-message
- :model="examSiteForm"
- ref="examSiteForm"
- :rules="rules"
- label-position="right"
- label-width="90px"
- >
- <el-row>
- <el-form-item label="学习中心" label-width="120px" prop="code">
- <el-input
- class="pull_length"
- v-model="orgName"
- auto-complete="off"
- placeholder="中心代码"
- disabled
- />
- </el-form-item>
- </el-row>
- <el-row>
- <el-form-item label="考点代码" label-width="120px" prop="code">
- <el-input
- class="pull_length"
- v-model="examSiteForm.code"
- auto-complete="off"
- placeholder="考点代码"
- :readonly="null != examSiteForm.id"
- />
- </el-form-item>
- </el-row>
- <el-row>
- <el-form-item label="考点名称" label-width="120px" prop="name">
- <el-input
- class="pull_length"
- v-model="examSiteForm.name"
- auto-complete="off"
- placeholder="考点名称"
- />
- </el-form-item>
- </el-row>
- <el-row>
- <el-form-item label="负责人" label-width="120px">
- <el-input
- class="pull_length"
- v-model="examSiteForm.contacts"
- auto-complete="off"
- placeholder="负责人"
- />
- </el-form-item>
- </el-row>
- <el-row>
- <el-form-item label="联系方式" label-width="120px">
- <el-input
- class="pull_length"
- v-model="examSiteForm.telephone"
- auto-complete="off"
- placeholder="联系方式"
- />
- </el-form-item>
- </el-row>
- <el-row>
- <el-form-item label="备注" label-width="120px">
- <el-input
- class="pull_length"
- v-model="examSiteForm.remark"
- auto-complete="off"
- placeholder="备注"
- />
- </el-form-item>
- </el-row>
- <el-row class="d-flex justify-content-center">
- <el-button type="primary" @click="submitForm">保 存</el-button>
- <el-button @click="examSiteDialog = false">取 消</el-button>
- </el-row>
- </el-form>
- </el-dialog>
- <span>批量操作:</span>
- <el-button
- size="small"
- type="danger"
- icon="el-icon-delete"
- @click="deleteByIds"
- >
- 删除
- </el-button>
- <div style="width: 100%;margin-bottom: 10px;"></div>
- <!-- 页面列表 -->
- <el-table
- :data="tableData"
- border
- resizable
- stripe
- @selection-change="selectChange"
- >
- <el-table-column type="selection" width="35" />
- <el-table-column prop="id" width="80" label="ID" />
- <el-table-column prop="code" label="考点代码" />
- <el-table-column prop="name" label="考点名称" />
- <el-table-column prop="contacts" width="100" label="负责人" />
- <el-table-column prop="telephone" width="100" label="联系方式" />
- <el-table-column prop="remark" width="120" label="备注" />
- <el-table-column prop="updateTime" width="180" label="更新时间" />
- <el-table-column label="操作" width="180">
- <div slot-scope="scope">
- <el-button
- size="mini"
- type="primary"
- icon="el-icon-edit"
- @click="edit(scope.row)"
- >
- 编辑
- </el-button>
- <el-button
- size="mini"
- type="danger"
- @click="deleteById(scope.row)"
- icon="el-icon-delete"
- >
- 删除
- </el-button>
- </div>
- </el-table-column>
- </el-table>
- <div class="page pull-right">
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-size="pageSize"
- :page-sizes="[10, 20, 50, 100]"
- @size-change="handleSizeChange"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- />
- </div>
- </div>
- </div>
- </section>
- </div>
- </template>
- <script>
- import { CORE_API } from "@/constants/constants.js";
- import { mapState } from "vuex";
- import LinkTitlesCustom from "@/components/LinkTitlesCustom.vue";
- export default {
- name: "ExamSite",
- data() {
- return {
- orgId: null,
- formSearch: {
- code: "",
- name: "",
- orgId: ""
- },
- examSiteForm: {
- id: null,
- name: "",
- code: "",
- contacts: "",
- telephone: "",
- orgId: "",
- remark: ""
- },
- examSiteDialog: false,
- selectedExamSiteIds: [],
- loading: true,
- tableData: [],
- currentPage: 1,
- pageSize: 10,
- total: 10,
- orgName: "",
- rules: {
- code: [{ required: true, message: "请输入代码", trigger: "blur" }],
- name: [{ required: true, message: "请输入名称", trigger: "blur" }],
- contacts: [
- { required: false, message: "请输入负责人", trigger: "blur" }
- ],
- telphone: [
- { required: false, message: "请输入联系方式", trigger: "blur" }
- ]
- }
- };
- },
- computed: {
- ...mapState({ user: state => state.user }),
- examSiteIds() {
- var examSiteIds = "";
- for (let examSiteId of this.selectedExamSiteIds) {
- if (!examSiteIds) {
- examSiteIds += examSiteId;
- } else {
- examSiteIds += "," + examSiteId;
- }
- }
- return examSiteIds;
- }
- },
- methods: {
- back() {
- this.$router.back();
- },
- resetSearchForm() {
- this.formSearch.code = "";
- this.formSearch.name = "";
- },
- handleCurrentChange(val) {
- this.currentPage = val;
- this.searchForm();
- },
- handleSizeChange(val) {
- this.pageSize = val;
- this.searchForm();
- },
- //查询
- searchForm() {
- this.loading = true;
- var param = new URLSearchParams(this.formSearch);
- var url =
- CORE_API +
- "/examSite/examSitePage/" +
- (this.currentPage - 1) +
- "/" +
- this.pageSize +
- "?" +
- param;
- this.$http.get(url).then(response => {
- this.tableData = response.data.content;
- this.total = response.data.totalElements;
- this.loading = false;
- });
- },
- selectChange(row) {
- this.selectedExamSiteIds = [];
- row.forEach(element => {
- this.selectedExamSiteIds.push(element.id);
- });
- console.log(this.selectedExamSiteIds);
- },
- //重置
- resetForm() {
- this.$refs.examSiteForm.resetFields();
- },
- //提交
- submitForm() {
- this.$refs.examSiteForm.validate(valid => {
- if (valid) {
- var url = CORE_API + "/examSite";
- if (this.examSiteForm.id) {
- this.$http.put(url, this.examSiteForm).then(
- () => {
- this.$notify({
- type: "success",
- message: "修改成功!"
- });
- this.searchForm();
- this.resetForm();
- this.examSiteDialog = false;
- },
- response => {
- if (response.status == 500) {
- this.$notify({
- showClose: true,
- message: response.data.desc,
- type: "error"
- });
- }
- }
- );
- } else {
- this.$http.post(url, this.examSiteForm).then(
- () => {
- this.$notify({
- type: "success",
- message: "新增成功!"
- });
- this.searchForm();
- this.resetForm();
- this.examSiteDialog = false;
- },
- response => {
- if (response.status == 500) {
- this.$notify({
- showClose: true,
- message: response.data.desc,
- type: "error"
- });
- }
- }
- );
- }
- } else {
- console.log("error submit!");
- return false;
- }
- });
- },
- //新增
- insert() {
- this.examSiteForm.id = null;
- this.examSiteForm.code = null;
- this.examSiteForm.name = null;
- this.examSiteForm.orgId = this.orgId;
- this.examSiteForm.telephone = null;
- this.examSiteForm.contacts = null;
- this.examSiteForm.remark = null;
- this.examSiteDialog = true;
- },
- //修改
- edit(row) {
- this.examSiteForm.id = row.id;
- this.examSiteForm.code = row.code;
- this.examSiteForm.name = row.name;
- this.examSiteForm.orgId = row.orgId;
- this.examSiteForm.telephone = row.telephone;
- this.examSiteForm.contacts = row.contacts;
- this.examSiteForm.remark = row.remark;
- this.examSiteDialog = true;
- },
- //删除单个数据
- deleteById(row) {
- this.$confirm("是否删除该考点?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- var url = CORE_API + "/examSite/" + row.id;
- this.$http
- .delete(url)
- .then(() => {
- this.$notify({
- type: "success",
- message: "删除成功!"
- });
- this.searchForm();
- })
- .catch(response => {
- if (response.status == 500) {
- this.$notify({
- showClose: true,
- message: response.data.desc,
- type: "error"
- });
- }
- });
- });
- },
- //删除多条数据
- deleteByIds() {
- if (this.selectedExamSiteIds.length === 0) {
- this.$notify({
- type: "warning",
- message: "请选择要删除的考点"
- });
- } else {
- this.$confirm("是否删除这些考点?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "error"
- }).then(() => {
- var url = CORE_API + "/examSite/" + this.examSiteIds;
- this.$http
- .delete(url)
- .then(() => {
- this.$notify({
- type: "success",
- message: "删除成功!"
- });
- this.searchForm();
- })
- .catch(response => {
- if (response.status == 500) {
- this.$notify({
- showClose: true,
- message: response.data.desc,
- type: "error"
- });
- }
- });
- });
- }
- },
- init() {
- var url = CORE_API + "/org/subOrg/" + this.orgId;
- this.$http
- .get(url)
- .then(response => {
- this.orgName = response.data.name;
- this.searchForm();
- })
- .catch(response => {
- if (response.status == 500) {
- this.$notify({
- showClose: true,
- message: response.data.desc,
- type: "error"
- });
- }
- });
- }
- },
- created() {
- this.orgId = this.$route.params.orgId;
- this.formSearch.orgId = this.$route.params.orgId;
- this.init();
- },
- components: {
- LinkTitlesCustom
- }
- };
- </script>
- <style scoped>
- .page {
- margin-top: 10px;
- }
- .el-upload {
- width: 80px;
- }
- </style>
|