From 367f240ac309c455aee521f1e6cfdd0e4fddd96e Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Tue, 14 Feb 2023 17:29:49 +0800 Subject: [PATCH] 2023-2-14 --- src/api/unifiedRecruitment/recruit.js | 11 +- src/components/XyTable/index.vue | 9 +- src/const/index.js | 6 +- src/utils/auth.js | 2 +- .../component/addRecruit.vue | 237 +++++++++++++-- .../component/addRecruit1.vue | 287 ------------------ .../component/importRecruitInfo.vue | 99 ++++++ .../unifiedRecruitment/component/setting.vue | 6 +- src/views/unifiedRecruitment/recruit.vue | 79 ++++- .../yearScore/component/addYearScore.vue | 47 +-- src/views/yearScore/yearScore.vue | 2 +- 11 files changed, 435 insertions(+), 350 deletions(-) delete mode 100644 src/views/unifiedRecruitment/component/addRecruit1.vue create mode 100644 src/views/unifiedRecruitment/component/importRecruitInfo.vue diff --git a/src/api/unifiedRecruitment/recruit.js b/src/api/unifiedRecruitment/recruit.js index 6879616..53ed26b 100644 --- a/src/api/unifiedRecruitment/recruit.js +++ b/src/api/unifiedRecruitment/recruit.js @@ -1,6 +1,6 @@ import request from "@/utils/request"; import { download } from "@/utils/downloadRequest"; - +import qs from "qs"; export function index(params,isLoading = true){ return request({ url:"/api/admin/recruit/index", @@ -23,8 +23,11 @@ export function save(data,isLoading = true){ return request({ url:"/api/admin/recruit/save", method:"post", - data, - isLoading + data:qs.stringify(data), + isLoading, + headers:{ + 'Content-Type':'application/x-www-form-urlencoded' + } }) } @@ -47,7 +50,7 @@ export function imports(data,isLoading = true){ } export async function exports(params){ - await download('/api/admin/recruit/export','get',params,`统招生管理-${params.year}`) + await download('/api/admin/recruit/export','get',params,`统招生管理-${params.year}.xlsx`) } diff --git a/src/components/XyTable/index.vue b/src/components/XyTable/index.vue index 4728026..9251311 100644 --- a/src/components/XyTable/index.vue +++ b/src/components/XyTable/index.vue @@ -256,6 +256,8 @@ export default { this.loading = false; }); break; + default: + return; } }, getByStrkey(obj, str) { @@ -610,6 +612,11 @@ export default { }); }, }, + watch:{ + tableItem(newVal){ + this.checkTable = newVal.map((item) => item?.prop) + } + }, created() { this.getTableData(); }, @@ -685,7 +692,7 @@ export default { ["expand-change"]: this.expandChange, }} > - {this.tableFormat.map((item, index) => { + {this.tableItem.map((item, index) => { if ($scopedSlots[item.prop]) { return $scopedSlots[item.prop](item, index); } diff --git a/src/const/index.js b/src/const/index.js index ecc7c9b..77f44b0 100644 --- a/src/const/index.js +++ b/src/const/index.js @@ -20,13 +20,11 @@ const data = { "templateType":[ { id: 1, - value: "文本", - type:"text" + value: "文本" }, { id:2, - value:"年份", - type:"year" + value:"年份" } ] } diff --git a/src/utils/auth.js b/src/utils/auth.js index 74ba1ab..3992224 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -1,6 +1,6 @@ import Cookies from 'js-cookie' -const TokenKey = 'sishitongtang_token' +const TokenKey = 'wsxy_token' export function getToken() { return Cookies.get(TokenKey) diff --git a/src/views/unifiedRecruitment/component/addRecruit.vue b/src/views/unifiedRecruitment/component/addRecruit.vue index 45e1dff..20049dd 100644 --- a/src/views/unifiedRecruitment/component/addRecruit.vue +++ b/src/views/unifiedRecruitment/component/addRecruit.vue @@ -12,11 +12,169 @@ export default { loading={true} on={{ ["on-visible-change"]: (e) => this.$emit("update:isShow", e), + ["on-ok"]: (e) => { + this.$refs['oriElForm'].validate().then(res => { + if (res){ + let fileds = [] + for(let key in this.form){ + let temp = {} + temp[key] = this.form[key] + fileds.push(temp) + } + this.$refs['elForm'].validate().then(res => { + Object.defineProperty(this.originalForm,'fileds',{ + enumerable:true, + writable:true, + configurable:false, + value:fileds + }) + + save(this.originalForm).then(res => { + this.$message({ + type:'success', + message:res.msg + }) + this.$emit("refresh") + this.$emit("update:isShow", false) + }) + }) + } + }) + }, }} > - { - this.getTable() - } + + + + { + this.getTemplate(); + }, + }} + > + + + + + + + {this.province_ids.map((item) => { + return ( + + ); + })} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {this.formInfo.map((item) => { + return ( + + + {(() => { + switch (item.type) { + case 1: + return ( + { + this.$forceUpdate(); + }, + }} + > + ); + case 2: + return ( + { + this.$forceUpdate(); + }, + }} + > + ); + } + })()} + + + ); + })} + ); }, @@ -25,16 +183,53 @@ export default { type: Boolean, default: false, }, + province_ids: Array, }, data() { + let idcardValidate = (rule, value, callback) => { + let IDRe18 = + /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; + let IDre15 = + /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/; + if (IDre15.test(value) || IDRe18.test(value)) { + callback(); + } else { + callback(new Error("身份证格式错误")); + } + }; return { type: "", + //自定义 + formInfo: [], form: {}, + rules: {}, + //固定 originalForm: { - year: `${2022}`, + year: `${new Date().getFullYear()}`, + province_id: "", + name: "", + idcard: "", + candidate_no: "", + allow_no: "", + }, + originalRules: { + year: [{ required: true, message: "请选择年份", trigger: "blur" }], + province_id: [ + { required: true, message: "请选择省份", trigger: "blur" }, + ], + name: [{ required: true, message: "请填写姓名", trigger: "blur" }], + idcard: [ + { required: true, message: "请填写身份证号", trigger: "blur" }, + { validator: idcardValidate, trigger: "blur" }, + ], + candidate_no: [ + { required: true, message: "请填写考生号", trigger: "blur" }, + ], + allow_no: [ + { required: true, message: "请填写准考证号", trigger: "blur" }, + ], }, - slots: {}, }; }, methods: { @@ -47,22 +242,30 @@ export default { ); if (res?.fileds) { res?.fileds.forEach((item) => { - this.form[item.en] = ""; + Object.defineProperty(this.form, item.en, { + value: "", + writable: true, + enumerable: true, + configurable: false, + }); + //this.form[item.en] = ""; + this.rules[item.en] = { + validator: (rule, value, callback) => { + if (!this.form[item.en]) { + callback(new Error("未填写")); + } else { + callback(); + } + }, + trigger: "blur", + required: true, + }; }); } - this.$forceUpdate() + this.formInfo = res?.fileds ?? []; + this.$forceUpdate(); }, - - getTable(){ - let temp = []; - for(let key in this.form){ - temp.push( - - ) - } - return temp - } }, watch: { async isShow(newVal) { diff --git a/src/views/unifiedRecruitment/component/addRecruit1.vue b/src/views/unifiedRecruitment/component/addRecruit1.vue deleted file mode 100644 index f021c2f..0000000 --- a/src/views/unifiedRecruitment/component/addRecruit1.vue +++ /dev/null @@ -1,287 +0,0 @@ - - - - - diff --git a/src/views/unifiedRecruitment/component/importRecruitInfo.vue b/src/views/unifiedRecruitment/component/importRecruitInfo.vue new file mode 100644 index 0000000..b54d56a --- /dev/null +++ b/src/views/unifiedRecruitment/component/importRecruitInfo.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/src/views/unifiedRecruitment/component/setting.vue b/src/views/unifiedRecruitment/component/setting.vue index 1fe1d77..a59d6fa 100644 --- a/src/views/unifiedRecruitment/component/setting.vue +++ b/src/views/unifiedRecruitment/component/setting.vue @@ -4,7 +4,6 @@ title="模板设置" width="80" :value="isShow" - :loading="true" @on-ok="submit" @on-visible-change="(e) => $emit('update:isShow', e)" > @@ -139,10 +138,9 @@ export default { customFn: (row) => { return ( ); }, @@ -191,7 +189,7 @@ export default { width="160" value={$index === this.popIndex} > -

这是一段内容这是一段内容确定删除吗?

+

确定删除该列吗?

取消 diff --git a/src/views/unifiedRecruitment/recruit.vue b/src/views/unifiedRecruitment/recruit.vue index 3dc19f7..4a817d0 100644 --- a/src/views/unifiedRecruitment/recruit.vue +++ b/src/views/unifiedRecruitment/recruit.vue @@ -27,9 +27,7 @@ size="small" placeholder="关键词搜索" > - +
+ + @@ -46,8 +52,7 @@ + + diff --git a/src/views/yearScore/component/addYearScore.vue b/src/views/yearScore/component/addYearScore.vue index c7b6e39..0d90808 100644 --- a/src/views/yearScore/component/addYearScore.vue +++ b/src/views/yearScore/component/addYearScore.vue @@ -19,7 +19,7 @@ 省份 :
- +
@@ -42,15 +42,18 @@
- 点击上传 -
只能上传jpg/png文件,且不超过500kb
+ style="width: 300px;" + ref="upload" + multiple + :on-success="successHandle" + :before-upload="uploadBefore" + accept="application/x-rar-compressed,application/zip,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf" + :action="action" + :file-list="fileList" + :auto-upload="false"> + 选取文件 + 开始上传 +
支持文件格式:.rar .zip .doc .docx .pdf
单个文件不能超过500kb
@@ -77,7 +80,7 @@ id: '', type: '', action: process.env.VUE_APP_UPLOAD_API, - + fileList:[], form: { year: "", @@ -98,23 +101,16 @@ } }, methods: { - provinceChange(e){ - console.log(e) - }, //上传 - uploadFail(err) { - console.log(err) - }, - uploadSuccess(response) { - console.log(response) - this.form.avatar = response.id + successHandle(response, file, fileList){ + this.fileList = fileList }, uploadBefore(file) { console.log(file) - if ((file.size / 1000) > 2024) { + if ((file.size / 1000) > 500) { this.$message({ type: 'warning', - message: '上传图片大小超过2M!' + message: '上传图片大小超过500kb!' }) return false } @@ -126,6 +122,12 @@ }, submit() { + this.form.file_ids = this.fileList.map(item => { + return { + ids:item?.response?.id + } + }) + if(this.type === 'add'){ if(this.form.hasOwnProperty('id')){ delete this.form.id @@ -155,6 +157,7 @@ } else { this.id = '' this.type = '' + this.fileList = [] this.$refs['dialog'].reset() delete this.form.id } diff --git a/src/views/yearScore/yearScore.vue b/src/views/yearScore/yearScore.vue index 59ee86f..aee0d3c 100644 --- a/src/views/yearScore/yearScore.vue +++ b/src/views/yearScore/yearScore.vue @@ -4,7 +4,7 @@