123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- <template>
- <div id="baseAddPaper">
- <div class="boxWidth">
- <el-form
- label-position="right"
- label-width="120px"
- :model="listDataIns"
- :rules="rules"
- ref="listDataIns"
- >
- <el-form-item label="适用业务层级" :required="true">
- <el-select
- disabled
- v-model="eduType"
- placeholder="请选择教育类型"
- @change="changeEduType"
- >
- <el-option
- v-for="(item, index) in eduTypeOptions"
- :key="index"
- :label="item.educationName"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <el-select
- disabled
- v-model="courType"
- placeholder="请选择业务层次"
- @change="changecourseType"
- >
- <el-option
- v-for="(item, index) in newCourTypeOptions"
- :key="index"
- :label="item.projectName + '-' + item.businessName"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <el-popover
- ref="popovers"
- placement="bottom"
- trigger="click"
- @show="showHandle"
- @hide="hideHandle"
- :disabled="courType && newSujectOption.length ? false : true"
- >
- <el-radio-group v-model="sujectApis" class="dis_flexbox">
- <el-radio
- disabled
- v-for="(item, index) in newSujectOption"
- :label="item.newId"
- :key="index"
- >{{ item.subjectName }}</el-radio
- >
- </el-radio-group>
- <div style="display: block; text-align: center; margin-top: 10px">
- <el-button
- size="mini"
- type="primary"
- @click="submitSujectArray"
- v-if="false"
- >确定</el-button
- >
- </div>
- <el-button
- disabled
- slot="reference"
- style="margin-left: 12px"
- @click="getMessage"
- >请选择科目</el-button
- >
- </el-popover>
- </el-form-item>
- <el-form-item label="">
- <!-- <span v-if="Object.keys(newSujectApis).length == 0"
- >未选项目类型</span
- > -->
- <div
- v-if="Object.keys(newSujectApis).length !== 0"
- style="display: flex"
- >
- <div class="listBoxStys">
- {{
- newSujectApis.educationName +
- " - " +
- newSujectApis.projectName +
- " - " +
- newSujectApis.businessName +
- " - " +
- newSujectApis.subjectName
- }}
- <i
- class="el-icon-error closeIcons"
- @click="closeType"
- v-if="false"
- ></i>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="试卷类型" prop="examPaperId">
- <el-select
- v-model="listDataIns.examPaperId"
- placeholder="请选择试卷类型"
- >
- <el-option
- v-for="item in paperexam"
- :key="item.paperId"
- :label="item.paperName"
- :value="item.paperId"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="地域(省)" prop="provinceId">
- <el-select
- v-model="listDataIns.provinceId"
- placeholder="请选择省"
- @change="changeCity"
- >
- <el-option
- v-for="item in areas"
- :key="item.areaId"
- :label="item.areaName"
- :value="item.areaId"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="地域(市)"
- prop="cityId"
- v-if="listDataIns.provinceId"
- >
- <el-select v-model="listDataIns.cityId" placeholder="请选择市">
- <el-option
- v-for="item in optionsCity"
- :key="item.areaId"
- :label="item.areaName"
- :value="item.areaId"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="年份" prop="year">
- <el-date-picker
- v-model="listDataIns.year"
- type="year"
- value-format="yyyy"
- placeholder="请选择年份"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item label="标题前缀" prop="prefixName">
- <el-input v-model="listDataIns.prefixName"></el-input>
- </el-form-item>
- <el-form-item label="试卷名称" prop="examName">
- <el-input v-model="listDataIns.examName"></el-input>
- </el-form-item>
- <el-form-item label="是否发布" prop="publishStatus">
- <el-radio-group v-model="listDataIns.publishStatus">
- <el-radio :label="1">是</el-radio>
- <el-radio :label="0">否</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item>
- <el-button @click="backPage">取消</el-button>
- <el-button
- type="primary"
- @click="submitIns('listDataIns')"
- :disabled="!noStudent"
- >确定</el-button
- >
- </el-form-item>
- </el-form>
- </div>
- </div>
- </template>
- <script>
- import tableList from "@/components/tableList";
- import { mapGetters } from "vuex";
- export default {
- components: { tableList },
- data() {
- return {
- listDataIns: {
- publishStatus: 1,
- year: "",
- }, // 弹窗数据
- eduTypeOptions: [], //教育类型数据
- projectTypeOptions: [], //项目类型数据
- courTypeOptions: [], //业务层次数据
- newCourTypeOptions: [], //当前业务层次数据
- sujectOption: [], //科目数据
- newSujectOption: [], //当前科目数据数据
- eduType: "", //当前选中教育类型
- courType: "", //当前选中业务层次
- newSujectApis: {},
- sujectApis: "", //当前存在的科目 例如'19-2'
- optionsCity: [],
- noStudent: true,
- //表单验证
- rules: {
- examPaperId: [
- {
- required: true,
- message: "请选择试卷类型",
- trigger: ["change", "blur"],
- },
- ],
- examName: [
- { required: true, message: "请输入试卷名称", trigger: "blur" },
- ],
- publishStatus: [
- { required: true, message: "请选择是否发布", trigger: "change" },
- ],
- },
- };
- },
- computed: {
- ...mapGetters(["paperexam", "areas"]),
- },
- mounted() {
- this.$modal.loading("正在导入数据,请稍后...");
- this.$api
- .gradecheckGoodsChange({ examId: this.$route.query.id })
- .then((res) => {
- console.log(res.data);
- if (res.data > 0) {
- this.noStudent = false;
- }
- });
- this.getDict();
- // this.search();
- },
- // watch: {
- // "listDataIns.provinceId": {
- // handler(newVal, oldVal) {
- // this.changeCity(newVal);
- // },
- // // 立即处理 进入页面就触发
- // immediate: true,
- // },
- // },
- methods: {
- getMessage() {
- if (!this.courType) {
- this.$message.warning("请先选择业务层级");
- } else if (!this.newSujectOption.length) {
- this.$message.warning("该业务层级暂无关联科目");
- }
- },
- search() {
- this.$api.obtainbankexam(this.$route.query.id).then((res) => {
- res.data.year = res.data.year + "";
- this.listDataIns = res.data;
- if (res.data.provinceId) {
- this.changeCity(res.data.provinceId, true);
- }
- });
- this.$api
- .inquirebankexamListbusiness({ type: 2, majorId: this.$route.query.id })
- .then((res) => {
- this.eduType = res.rows[0].educationTypeId;
- this.changeEduType();
- this.courType = res.rows[0].businessId;
- this.changecourseType();
- this.newSujectApis = res.rows[0];
- this.sujectApis =
- res.rows[0].businessId + "-" + res.rows[0].subjectId;
- })
- .finally(() => {
- this.$modal.closeLoading();
- });
- },
- changeCity(newVal, dray = false) {
- if (!dray) {
- this.listDataIns.cityId = "";
- }
- this.optionsCity = this.cityList.filter((item) => {
- return item.parentId === newVal;
- });
- },
- changeTypes() {
- var self = this;
- if (!this.sujectApis) {
- self.newSujectApis = {};
- return;
- }
- this.courTypeOptions.map((items) => {
- if (items.id === this.sujectApis.split("-").map(Number)[0]) {
- var obj = {
- type: 2,
- educationTypeId: items.educationId,
- educationName: items.educationName,
- projectId: items.projectId,
- projectName: items.projectName,
- businessId: items.id,
- businessName: items.businessName,
- };
- self.sujectOption.map((i) => {
- if (
- i.id === self.sujectApis.split("-").map(Number)[1] &&
- i.courseArrays.indexOf(items.projectId) !== -1
- ) {
- obj.subjectName = i.subjectName;
- obj.subjectId = i.id;
- }
- });
- self.newSujectApis = obj;
- }
- });
- },
- submitSujectArray() {
- this.changeTypes();
- this.$refs.popovers.doClose();
- },
- showHandle() {
- this.sujectApis = "";
- this.newSujectOption.map((item) => {
- item.newId = this.courType + "-" + item.id;
- if (item.newId === this.sujectApis) {
- console.log("成功");
- }
- });
- this.sujectApis =
- this.newSujectApis.businessId + "-" + this.newSujectApis.subjectId;
- },
- hideHandle() {},
- getDict() {
- new Promise((resolve, reject) => {
- this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
- this.eduTypeOptions = res.rows;
- });
- this.$api.inquireCourseProjectType({ status: 1 }).then((res) => {
- this.projectTypeOptions = res.rows;
- });
- this.$api
- .inquireapplyCityList({ areaType: 2, status: 1 })
- .then((res) => {
- this.cityList = res.rows;
- });
- this.$api.inquirebusinessList({ status: 1 }).then((res) => {
- this.courTypeOptions = res.rows;
- this.newCourTypeOptions = res.rows;
- });
- this.$api.inquireCourseSubject({ status: 1 }).then((res) => {
- res.rows.map((item, index) => {
- var array = [];
- item.courseProjectTypes.map((items, indexs) => {
- array.push(items.id);
- });
- item.courseArrays = array;
- });
- this.sujectOption = res.rows;
- resolve();
- });
- }).then((res) => {
- this.search();
- });
- },
- changeEduType() {
- if (!(this.courType === undefined || this.courType === "")) {
- this.courType = "";
- }
- var arrays = [];
- this.courTypeOptions.map((item) => {
- if (item.educationId === this.eduType) {
- arrays.push(item);
- }
- });
- this.newCourTypeOptions = arrays;
- },
- changecourseType() {
- this.newCourTypeOptions.map((item, index) => {
- if (item.id === this.courType) {
- this.eduType = item.educationId;
- var array = [];
- this.sujectOption.map((items, indexs) => {
- if (items.courseArrays.indexOf(item.projectId) !== -1) {
- array.push(items);
- }
- });
- this.newSujectOption = array;
- }
- });
- var arrays = [];
- this.courTypeOptions.map((item) => {
- if (item.educationId === this.eduType) {
- arrays.push(item);
- }
- });
- this.newCourTypeOptions = arrays;
- this.$refs.popovers.doClose();
- },
- submitIns(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- if (JSON.stringify(this.newSujectApis) === "{}") {
- this.$message.error("请选择适用业务层级");
- return;
- }
- this.rulesTableSumbit();
- } else {
- return false;
- }
- });
- },
- async rulesTableSumbit() {
- var data1 = {
- examId: this.listDataIns.examId,
- examPaperId: this.listDataIns.examPaperId,
- examName: this.listDataIns.examName,
- publishStatus: this.listDataIns.publishStatus,
- prefixName: this.listDataIns.prefixName,
- businessList: [this.newSujectApis],
- provinceId: this.listDataIns.provinceId,
- cityId: this.listDataIns.cityId,
- year: this.listDataIns.year,
- };
- this.$api.editbankexam(data1).then((res) => {
- this.$message.success("修改成功");
- setTimeout(() => {
- this.$store.dispatch("tagsView/exitView", this.$route).then((res) => {
- this.$router.push({
- path: "testPaperManagement",
- });
- });
- }, 500);
- });
- },
- backPage() {
- this.$store.dispatch("tagsView/delView", this.$route).then((res) => {
- this.$router.push({
- path: "testPaperManagement",
- });
- });
- },
- closeType() {
- this.sujectApis = "";
- this.changeTypes();
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .dis_flexbox {
- display: flex;
- flex-direction: column;
- }
- .boxWidth {
- width: 700px;
- }
- .numInputs {
- width: 150px;
- }
- .checkboxSty {
- max-height: 210px;
- overflow: auto;
- display: flex;
- flex-direction: column;
- }
- .listBoxStys {
- flex-shrink: 0;
- padding: 0px 10px;
- border-radius: 8px;
- border: 1px solid #eee;
- margin-right: 10px;
- margin-bottom: 6px;
- }
- .closeIcons {
- color: red;
- cursor: pointer;
- margin-left: 6px;
- }
- .ach {
- display: flex;
- align-items: center;
- overflow: hidden;
- }
- .clh {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- }
- .imgBoxins {
- width: 375px;
- height: 220px;
- text-align: center;
- img {
- height: 100%;
- }
- }
- .iconStsz {
- font-size: 40px;
- color: #67c23a;
- cursor: pointer;
- }
- .BusBoxs {
- min-height: 100px;
- border: 1px solid #a4a4a4;
- margin-bottom: 10px;
- border-radius: 8px;
- max-height: 280px;
- padding: 10px;
- overflow-y: auto;
- .fot_Le {
- border-radius: 12px;
- border: 1px solid yellowgreen;
- padding: 0px 10px;
- height: 30px;
- line-height: 30px;
- text-align: center;
- float: left;
- margin-right: 6px;
- margin-bottom: 6px;
- .icon_clear {
- margin-left: 2px;
- font-size: 15px;
- color: #f56c6c;
- cursor: pointer;
- }
- }
- }
- .marg_play {
- display: flex;
- margin-bottom: 15px;
- .spans {
- text-align: right;
- width: 80px;
- }
- }
- /deep/.el-button {
- border-radius: 8px;
- }
- /deep/.el-dialog {
- border-radius: 8px;
- .el-dialog__header {
- padding: 0;
- .hearders {
- height: 40px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0px 18px 0px 20px;
- border-bottom: 1px solid #e2e2e2;
- .leftTitle {
- font-size: 14px;
- font-weight: bold;
- color: #2f4378;
- }
- .rightBoxs {
- display: flex;
- align-items: center;
- img {
- width: 14px;
- height: 14px;
- margin-left: 13px;
- cursor: pointer;
- }
- }
- }
- }
- .el-dialog__footer {
- padding: 0;
- .dialog-footer {
- padding: 0px 40px;
- height: 70px;
- border-top: 1px solid #e2e2e2;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- }
- .centerStys {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-top: 18px;
- }
- .dis_fos {
- align-items: flex-end;
- display: flex;
- justify-content: space-between;
- }
- .margin_bs {
- margin-bottom: 6px;
- }
- </style>
|