新增零工人员管理、零工人员登录

This commit is contained in:
18500206848
2024-04-17 12:09:18 +08:00
parent 2af2fef129
commit 229714a236
5 changed files with 1200 additions and 6 deletions

View File

@@ -0,0 +1,146 @@
<template>
<!-- 新建分组模板 -->
<el-dialog
:title="title"
append-to-body
:visible.sync="box"
:close-on-click-modal="false"
:close-on-press-escape="false"
@closed="closed"
width="555px"
>
<el-form
:model="form"
@submit.native.prevent
:rules="rules"
ref="groups"
label-position="right"
label-width="100px"
>
<el-form-item label="分组名称" prop="groupName">
<el-input v-model="form.groupName" placeholder="请输入 分组名称" size="small" :disabled="loading" maxlength="40" show-word-limit></el-input>
</el-form-item>
</el-form>
<div slot="footer" style="text-align:right">
<el-button
type="primary"
size="mini"
icon="el-icon-check"
@click="handleSubmit"
:loading="loading"
>提交</el-button>
<el-button size="mini" icon="el-icon-circle-close" @click=" box = false" :loading="loading">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { addDept, updateDept } from "@/api/tenant/talents";
export default {
data() {
return {
type: "",
title: "",
groupId: "",
loading: false,
box: false,
form: {
groupName: "",
},
rules: {
groupName: [
{
required: true,
whitespace: true,
message: "请填写分组名称",
trigger: "blur",
},
],
},
};
},
watch: {},
computed: {},
methods: {
closed() {
this.form = {
groupName: "",
};
if (this.$refs.groups) {
this.$refs.groups.resetFields();
}
this.loading = false;
},
openDialog(type, data) {
this.type = type;
if (this.type === "add") {
this.title = "新建分组";
this.box = true;
} else if (this.type === "edit") {
this.title = "编辑分组";
this.groupId = data.id;
this.form.groupName = data.groupName;
this.box = true;
}
},
handleSubmit() {
if(this.form.groupName){
this.$refs.groups.validate(valid=>{
if(valid){
if (this.type === "add") {
//提交新建分组接口
this.loading = true;
addDept({
groupName: this.form.groupName,
}).then(
() => {
this.$message({
type: "success",
message: "操作成功!",
});
this.box = false;
this.$emit("refresh");
this.loading = false;
},
(error) => {
window.console.log(error);
this.loading = false;
}
);
} else if (this.type == "edit") {
//提交编辑分组接口
this.loading = true;
updateDept({
id: this.groupId,
groupName: this.form.groupName,
}).then(
() => {
this.$message({
type: "success",
message: "操作成功!",
});
this.box = false;
this.$emit("refresh");
this.loading = false;
},
(error) => {
window.console.log(error);
this.loading = false;
}
);
}
}
else{
this.$message.error('请输入分组名称');
}
})
}
},
},
};
</script>
<style>
</style>

View File

@@ -0,0 +1,110 @@
<template>
<!-- 转移分组模板 -->
<el-dialog
:title="title"
append-to-body
:visible.sync="box"
:close-on-click-modal="false"
:close-on-press-escape="false"
@closed="closed"
width="555px"
>
<avue-form ref="groups" :option="option" v-model="form" @submit="handleSubmit">
<template slot="menuForm" slot-scope="{disabled}">
<!-- <el-button type="primary" icon="el-icon-check" @click="copy" :disabled="formLoading">提交</el-button> -->
<el-button icon="el-icon-circle-close" @click="box = false" :loading="disabled">取消</el-button>
</template>
</avue-form>
</el-dialog>
</template>
<script>
import { transferDept } from "@/api/tenant/talents";
export default {
props: {
ids: String,
},
data() {
return {
title: "",
groupId: "",
box: false,
form: {},
option: {
menuPosition: "right",
menuBtn: true,
submitBtn: true,
emptyBtn: false,
column: [
{
label: "所属分组",
prop: "groupId",
type: "tree",
span: 24,
display: true,
dicUrl: `/api/jobslink-api/tenant/talents/group/listAll?groupType=0`,
dicMethod: "get",
dicFormatter: (res) => {
return res.data.list; //返回字典的层级结构
},
props: {
label: "groupName",
value: "id",
},
rules: [
{
required: true,
whitespace: true,
message: "请选择分组",
trigger: "change",
},
],
placeholder: "请选择分组",
},
],
},
};
},
computed: {},
methods: {
closed() {
this.form = {};
if (this.$refs.groups) {
this.$refs.groups.init();
this.$refs.groups.clearValidate();
this.$refs.groups.resetForm();
}
},
openDialog() {
this.title = "转移分组";
this.box = true;
if (this.$refs.groups) {
this.$refs.groups.init();
this.$refs.groups.clearValidate();
this.$refs.groups.resetForm();
}
},
handleSubmit(form, done) {
//提交转移分组接口
transferDept(this.form.groupId, this.ids).then(
() => {
this.box = false;
this.$message({
type: "success",
message: "操作成功!",
});
this.$emit("refresh");
done();
},
(error) => {
window.console.log(error);
done();
}
);
},
},
};
</script>
<style>
</style>