Files
cmanager/src/views/tenant/mission/Table/ExpiredMission.vue

329 lines
8.8 KiB
Vue
Raw Normal View History

2024-02-02 15:04:47 +08:00
<template>
<div>
<avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="obj" @row-del="rowDel"
@row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen" :page.sync="page"
@current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
2024-02-02 15:04:47 +08:00
<!--自定义列-->
<template slot="missionTitle" slot-scope="{ row }">
<el-tooltip effect="dark" :content="row.missionTitle" placement="top">
<div style="color: black">
<b>{{ row.missionTitle | ellipsis }}</b>
</div>
</el-tooltip>
</template>
<!-- 开始日期 -->
<template slot="stime" slot-scope="{row}">
<span>{{ format(row.stime) }}</span>
2024-02-02 15:04:47 +08:00
</template>
<!-- 完成日期 -->
<template slot="etime" slot-scope="{row}">
<span>{{ format(row.etime) }}</span>
2024-02-02 15:04:47 +08:00
</template>
<template slot="signUpCount" slot-scope="{ row }">
<div style="color: #409eff">
<b>{{ row.signUpCount }}</b>
</div>
</template>
<template slot="takeOnCount" slot-scope="{ row }">
<div style="color: #409eff">
<b>{{ row.takeOnCount }}</b>
</div>
</template>
<template slot="missionDate" slot-scope="{ row }">
<div>{{ format(row.stime) }}{{ format(row.etime) }}</div>
</template>
<!--/-->
<!--自定义操作栏-->
<div slot="menu" slot-scope="{size,type,row}">
<!-- <el-button
icon="el-icon-view"
:size="size"
:type="type"
@click="rowView(row);"
v-show="vaildData(permission.tenant_mission_view,false)"
>查看</el-button>-->
<el-button icon="el-icon-check" :size="size" :type="type" @click="rowCopy(row, 'copy')"
v-show="vaildData(permission.tenant_mission_add, false)">复制</el-button>
<el-button icon="el-icon-delete" :size="size" :type="type" @click="$refs.crud.rowDel(row)"
v-show="vaildData(permission.tenant_mission_delete, false)">删除</el-button>
2024-02-02 15:04:47 +08:00
</div>
<!--/-->
<!--自定义按钮-->
<template slot="menuLeft">
<el-button type="warning" plain icon="el-icon-plus" size="small" @click="rowCopy('', 'add')"
v-show="vaildData(permission.tenant_mission_add, false)">发布任务</el-button>
2024-02-02 15:04:47 +08:00
</template>
<!--/-->
</avue-crud>
<copy-mission ref="copy" @back="backIndex" v-show="false"></copy-mission>
<!--查看dialog-->
<mission-view :visible.sync="viewDrawer" :model="view"></mission-view>
<!--/dialog-->
</div>
</template>
<script>
import { getExpiredList, remove, detail } from "@/api/tenant/mission";
import CopyMission from "../Dialog/CopyMission";
import SkillSelect from "../Dialog/Skill";
import missionView from "./missionView.vue";
import SelectMap from "@/components/map/selectLocation";
import { mapGetters } from "vuex";
import { dateFormat } from "@/util/date";
import saveButton from "./saveButton";
export default {
comments: {},
filters: {
ellipsis(value) {
2024-02-02 15:04:47 +08:00
if (!value) return "";
if (value.length > 15) {
return value.slice(0, 14) + "...";
}
return value;
},
},
data() {
2024-02-02 15:04:47 +08:00
return {
viewDrawer: false,
view: {},
loading: false,
isCanEdit: false,
selectedSkills: [],
tradeData: [],
page: {
pageSize: 20,
currentPage: 1,
total: 0,
},
query: {},
data: [],
obj: {},
wageUnitCategory: [
{
value: 0,
label: "元/人·次",
},
{
value: 1,
label: "元/人·时",
},
{
value: 2,
label: "元/人·天",
},
{
value: 3,
label: "元/人·周",
},
{
value: 4,
label: "元/人·月",
},
{
value: 5,
label: "元/人·个",
},
{
value: 6,
label: "元/人·件",
},
],
};
},
components: {
CopyMission,
SkillSelect,
SelectMap,
missionView,
saveButton,
},
created() { },
2024-02-02 15:04:47 +08:00
computed: {
...mapGetters(["permission"]),
option() {
2024-02-02 15:04:47 +08:00
return {
height: "auto",
calcHeight: 40,
align: "center",
menuAlign: "center",
tip: false,
addBtn: false,
viewBtn: false,
editBtn: false,
delBtn: false,
excelBtn: false,
columnBtn: false,
searchBtn: false,
searchShow: false,
labelWidth: 100,
border: true,
index: false,
selection: false,
dialogType: "drawer",
dialogWidth: "60%",
dialogClickModal: false,
column: [
{
2024-04-23 22:51:03 +08:00
label: "零工岗位名称",
2024-02-02 15:04:47 +08:00
prop: "missionTitle",
display: false,
slot: true,
2024-02-02 15:04:47 +08:00
},
{
label: "任务编码",
prop: "missionNo",
display: false,
},
{
2024-03-29 09:39:01 +08:00
label: "发布时间",
2024-02-02 15:04:47 +08:00
prop: "stime",
display: false,
width: 130,
slot: true,
2024-02-02 15:04:47 +08:00
},
{
label: "完成日期",
2024-02-02 15:04:47 +08:00
prop: "etime",
display: false,
width: 130,
slot: true,
2024-02-02 15:04:47 +08:00
},
2024-03-29 09:39:01 +08:00
{
label: "招聘人数",
prop: "peopleNum",
slot: true,
display: false,
width: 110,
},
2024-02-02 15:04:47 +08:00
{
2024-02-16 15:02:17 +08:00
label: "申请人数",
2024-02-02 15:04:47 +08:00
prop: "signUpCount",
slot: true,
display: false,
width: 110,
2024-02-02 15:04:47 +08:00
},
{
label: "录用人数",
prop: "takeOnCount",
slot: true,
display: false,
width: 110,
2024-03-29 09:39:01 +08:00
}
2024-02-02 15:04:47 +08:00
],
};
},
},
methods: {
format(date) {
2024-02-02 15:04:47 +08:00
if (date) {
return dateFormat(new Date(date), "yyyy/MM/dd");
}
},
/*查看*/
rowView(row) {
2024-02-02 15:04:47 +08:00
detail(row.missionNo).then((res) => {
this.viewDrawer = true;
this.view = res;
});
},
/*打开新建 复制*/
rowCopy(row, type) {
2024-02-02 15:04:47 +08:00
this.$refs.copy.onLoad(row, type);
this.$nextTick(() => {
2024-02-02 15:04:47 +08:00
this.$refs.copy.resetFields();//等弹窗里的form表单的dom渲染完在执行this.$refs.staffForm.resetFields(),去除验证
})
},
/*删除任务*/
rowDel(row) {
2024-02-02 15:04:47 +08:00
const h = this.$createElement;
this.$confirm(
h("div", null, [
h("p", { style: "font-size: 16px" }, "您确定要删除此任务吗? "),
h("p", { style: "color: red" }, "一旦删除则无法找回"),
]),
{
type: "warning",
showClose: false,
showCancelButton: true,
confirmButtonText: "确定",
cancelButtonText: "取消",
beforeClose: (action, instance, done) => {
if (action === "confirm") {
instance.confirmButtonLoading = true;
instance.cancelButtonLoading = true;
instance.closeOnPressEscape = false;
instance.closeOnClickModal = false;
setTimeout(() => {
done();
setTimeout(() => {
instance.confirmButtonLoading = false;
instance.cancelButtonLoading = false;
}, 300);
}, 1000);
} else {
done();
}
},
}
)
.then(() => {
remove(row.id).then(
() => {
this.$message({
type: "success",
message: "操作成功!",
});
this.onLoad(this.page, this.query);
},
(error) => {
window.console.log(error);
}
);
})
.catch(() => {
// this.$message({
// type: 'info',
// message: '已取消'
// });
});
},
currentChange(currentPage) {
2024-02-02 15:04:47 +08:00
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
2024-02-02 15:04:47 +08:00
this.page.pageSize = pageSize;
},
/*刷新本页 带搜索参数*/
refreshChange() {
2024-02-02 15:04:47 +08:00
this.onLoad(this.page, this.query);
},
/*加载数据*/
onLoad(page, params = {}) {
2024-02-02 15:04:47 +08:00
this.loading = true;
getExpiredList(
page.currentPage,
page.pageSize,
Object.assign(this.query, params)
).then((res) => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
});
},
/*返回首页*/
backIndex() {
2024-02-02 15:04:47 +08:00
this.$emit("refresh");
},
},
};
</script>
<style scoped>
.el-col,
.el-form-item {
margin-bottom: 0px;
}
2024-02-16 15:02:17 +08:00
</style>