flat: 添加校验等

This commit is contained in:
Apcallover
2024-06-05 21:24:49 +08:00
parent f3b4787c2d
commit e551396f83
6 changed files with 44 additions and 4 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
.DS_Store .DS_Store
node_modules node_modules
/dist /dist
/manage
/tests/e2e/videos/ /tests/e2e/videos/
/tests/e2e/screenshots/ /tests/e2e/screenshots/

View File

@@ -118,8 +118,20 @@ const initFormValue = {
groupName: "", groupName: "",
sort: 0, sort: 0,
} }
const checkAtturbute = {
name: '',
serveLabels: [],
policyIds: [],
talentsGroupId: [],
}
const AtturbuteMessage = {
name: '请输入服务名称',
serveLabels: '请选择服务场景',
policyIds: '请选择政策指南',
talentsGroupId: '请输入重点人群',
}
const initServeForm = { const initServeForm = {
companyName: '', // companyName: '',
name: '', name: '',
serveLabels: [], serveLabels: [],
policyIds: [], policyIds: [],
@@ -220,6 +232,18 @@ export default {
}, },
async handleSubmit() { async handleSubmit() {
if (this.selectServer.id) { if (this.selectServer.id) {
const keys = Object.keys(checkAtturbute)
for (let i = 0; i < keys.length; i++) {
if (Array.isArray(checkAtturbute[keys[i]])) {
if (!this.serveForm[keys[i]].length) {
return this.$message.warning(AtturbuteMessage[keys[i]]);
}
} else {
if (!this.serveForm[keys[i]]) {
return this.$message.warning(AtturbuteMessage[keys[i]]);
}
}
}
let copyForm = deepClone(this.serveForm) let copyForm = deepClone(this.serveForm)
let serve = { let serve = {
...this.selectServer, ...this.selectServer,
@@ -297,6 +321,18 @@ export default {
changeCard(data) { changeCard(data) {
// 校验 // 校验
if (this.selectServer.id) { if (this.selectServer.id) {
const keys = Object.keys(checkAtturbute)
for (let i = 0; i < keys.length; i++) {
if (Array.isArray(checkAtturbute[keys[i]])) {
if (!this.serveForm[keys[i]].length) {
return this.$message.warning(AtturbuteMessage[keys[i]]);
}
} else {
if (!this.serveForm[keys[i]]) {
return this.$message.warning(AtturbuteMessage[keys[i]]);
}
}
}
let copyForm = deepClone(this.serveForm) let copyForm = deepClone(this.serveForm)
let serve = { let serve = {
...this.selectServer, ...this.selectServer,

View File

@@ -65,13 +65,13 @@
icon="el-icon-document" icon="el-icon-document"
size="small" size="small"
@click="matchWorkStation(row)" @click="matchWorkStation(row)"
>匹配任务/岗位 >查看匹配岗位
</el-button> </el-button>
<el-button type="text" <el-button type="text"
icon="el-icon-document" icon="el-icon-document"
size="small" size="small"
@click="matchPolicy(row)" @click="matchPolicy(row)"
>匹配政策 >查看匹配政策
</el-button> </el-button>
<el-button type="text" <el-button type="text"
icon="el-icon-document" icon="el-icon-document"

View File

@@ -705,6 +705,7 @@ export default {
return talentsEliminate(params); return talentsEliminate(params);
}) })
.then(() => { .then(() => {
this.initDept();
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
this.dialogFlag = false this.dialogFlag = false
this.$message.success('操作成功'); this.$message.success('操作成功');

View File

@@ -733,6 +733,7 @@ export default {
return talentsApproval(params); return talentsApproval(params);
}) })
.then(() => { .then(() => {
this.initDept();
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
this.dialogFlag = false this.dialogFlag = false
this.$message.success('操作成功'); this.$message.success('操作成功');
@@ -760,6 +761,7 @@ export default {
return talentsApproval(params); return talentsApproval(params);
}) })
.then(() => { .then(() => {
this.initDept();
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
this.dialogFlag = false this.dialogFlag = false
this.$message.success('操作成功'); this.$message.success('操作成功');

View File

@@ -414,7 +414,7 @@ export default {
onLoad(page, params = {}) { onLoad(page, params = {}) {
const {releaseTimeRange} = params; const {releaseTimeRange} = params;
let paramsed = { let paramsed = {
currentPage: page.currentPage, current: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
...this.query ...this.query
}; };