临时调班
This commit is contained in:
parent
0db4935ab9
commit
005f9d6f7c
|
@ -9,6 +9,14 @@ export function listUser(query) {
|
|||
params: query
|
||||
})
|
||||
}
|
||||
// 查询包含调班的用户列表
|
||||
export function listUserWithShift(query) {
|
||||
return request({
|
||||
url: '/system/user/shiftList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询用户列表ByIds
|
||||
export function listUserByIds(userIds) {
|
||||
|
|
53
src/api/yh/shift.js
Normal file
53
src/api/yh/shift.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询调班列表
|
||||
export function listShift(query) {
|
||||
return request({
|
||||
url: '/yh/shift/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询调到本部门的列表
|
||||
export function listTargetShift(query) {
|
||||
return request({
|
||||
url: '/yh/shift/targetList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询调班详细
|
||||
export function getShift(shiftId) {
|
||||
return request({
|
||||
url: '/yh/shift/' + shiftId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增调班
|
||||
export function addShift(data) {
|
||||
return request({
|
||||
url: '/yh/shift',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改调班
|
||||
export function updateShift(data) {
|
||||
return request({
|
||||
url: '/yh/shift',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除调班
|
||||
export function delShift(shiftId) {
|
||||
return request({
|
||||
url: '/yh/shift/' + shiftId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -8,7 +8,9 @@
|
|||
ref="check"
|
||||
:multiple="multiple"
|
||||
:init-select="initSelect"
|
||||
:list-api="listApi"
|
||||
v-on="$listeners"
|
||||
:query="query"
|
||||
/>
|
||||
|
||||
<template #footer>
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
ref="check"
|
||||
:multiple="multiple"
|
||||
:init-select="initSelect"
|
||||
:list-api="listApi"
|
||||
v-on="$listeners"
|
||||
:query="query"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -26,6 +28,7 @@ import Price from "@/views/yh/price/index.vue";
|
|||
import BooleanTag from "@/components/BooleanTag/index.vue";
|
||||
import {$showColumns} from "@/utils/mixins";
|
||||
import UserCheck from "@/components/Business/User/UserCheck.vue";
|
||||
import {listUser} from "@/api/system/user";
|
||||
|
||||
|
||||
export default {
|
||||
|
@ -55,6 +58,10 @@ export default {
|
|||
type: Array,
|
||||
default: null,
|
||||
},
|
||||
listApi: {
|
||||
type: Function,
|
||||
default: listUser
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visible: {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
disable-transitions
|
||||
:closable="!disabled"
|
||||
@close="onCloseSelected(index)"
|
||||
>{{item.name}}</el-tag>
|
||||
>{{item[showProp]}}</el-tag>
|
||||
<el-tag style="cursor: not-allowed" size="small" type="info" v-if="disabled">+</el-tag>
|
||||
<el-tag style="cursor: pointer" size="small" @click="openDialog" type="success" v-else>+</el-tag>
|
||||
</template>
|
||||
|
|
58
src/components/StartEndDatePicker/index.vue
Normal file
58
src/components/StartEndDatePicker/index.vue
Normal file
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="datetimerange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:picker-options="pickerOptions"
|
||||
:clearable="false"
|
||||
v-on="$listeners"
|
||||
:style="{width: width}"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
/>
|
||||
</template>
|
||||
<script >
|
||||
import {DatePickerOptions} from "@/utils/constants";
|
||||
|
||||
export default {
|
||||
name: "StartEndDatePicker",
|
||||
props: {
|
||||
startDate: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
endDate: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
pickerOptions: {
|
||||
type: Object,
|
||||
default: DatePickerOptions.DEFAULT
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "100%"
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dateRange: {
|
||||
get() {
|
||||
if (this.startDate == null || this.endDate == null) {
|
||||
return []
|
||||
}
|
||||
return [this.startDate, this.endDate];
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:startDate', val[0]);
|
||||
this.$emit('update:endDate', val[1])
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
|
@ -1,4 +1,6 @@
|
|||
// 视图
|
||||
import {getLastDate, getLastDateTimeEnd, getLastDateTimeStart, getLastMonth, getLastMonthTimeEnd} from "@/utils/index";
|
||||
|
||||
export const views = {
|
||||
}
|
||||
|
||||
|
@ -110,3 +112,64 @@ export const OperLogBizType = {
|
|||
MATERIAL: "4", // 物料
|
||||
UNIT: "5", // 单位
|
||||
}
|
||||
|
||||
// 日期选择器快捷选项
|
||||
export const DatePickerOptions = {
|
||||
// 默认
|
||||
DEFAULT: {
|
||||
shortcuts: [{
|
||||
text: '最近一周',
|
||||
onClick(picker) {
|
||||
const end = getLastDate(0);
|
||||
const start = getLastDate(6);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近一个月',
|
||||
onClick(picker) {
|
||||
const end = getLastDate(0);
|
||||
const start = getLastMonth(1);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近三个月',
|
||||
onClick(picker) {
|
||||
const end = getLastDate(0);
|
||||
const start = getLastMonth(3);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}]
|
||||
},
|
||||
// 未来
|
||||
FUTURE: {
|
||||
shortcuts: [{
|
||||
text: '明天',
|
||||
onClick(picker) {
|
||||
const end = getLastDateTimeEnd(-1);
|
||||
const start = getLastDateTimeStart(-1);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
},{
|
||||
text: '未来一周',
|
||||
onClick(picker) {
|
||||
const end = getLastDateTimeEnd(-6);
|
||||
const start = getLastDateTimeStart(0);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '未来一个月',
|
||||
onClick(picker) {
|
||||
const end = getLastMonthTimeEnd(-1);
|
||||
const start = getLastDateTimeStart(0);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '未来三个月',
|
||||
onClick(picker) {
|
||||
const end = getLastMonthTimeEnd(-3);
|
||||
const start = getLastDateTimeStart(0);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -466,6 +466,22 @@ export function getLastMonth(n) {
|
|||
return date;
|
||||
}
|
||||
|
||||
export function getLastMonthTimeEndStr(n) {
|
||||
let date = getLastMonth(n)
|
||||
return parseTime(date, "{y}-{m}-{d} 23:59:59");
|
||||
}
|
||||
export function getLastMonthTimeEnd(n) {
|
||||
return new Date(getLastMonthTimeEndStr(n));
|
||||
}
|
||||
|
||||
export function getLastMonthTimeStartStr(n) {
|
||||
let date = getLastMonth(n)
|
||||
return parseTime(date, "{y}-{m}-{d} 00:00:00");
|
||||
}
|
||||
export function getLastMonthTimeStart(n) {
|
||||
return new Date(getLastMonthTimeStartStr(n))
|
||||
}
|
||||
|
||||
// 获取前n月的日期字符串
|
||||
export function getLastMonthDateStr(n) {
|
||||
let date = getLastMonth(n);
|
||||
|
|
|
@ -128,7 +128,13 @@
|
|||
</el-table>
|
||||
|
||||
<!--编辑明细-->
|
||||
<report-product-row-edit :row="row" :visible.sync="showMore" :rules="rules" @submit="onSubmitRow"/>
|
||||
<report-product-row-edit
|
||||
:row="row"
|
||||
:visible.sync="showMore"
|
||||
:rules="rules"
|
||||
:user-query="userQuery"
|
||||
@submit="onSubmitRow"
|
||||
/>
|
||||
|
||||
<!--工序选择-->
|
||||
<price-drawer
|
||||
|
@ -142,6 +148,7 @@
|
|||
<user-product-batch-dialog
|
||||
:show.sync="showUserProductBatchDialog"
|
||||
@submit="onSubmitUserProductBatch"
|
||||
:user-query="userQuery"
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
@ -208,6 +215,13 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
// 用户查询条件
|
||||
userQuery() {
|
||||
return {
|
||||
shiftDate: this.form.reportDate,
|
||||
targetDeptId: this.form.deptId
|
||||
}
|
||||
},
|
||||
// 获取属性名
|
||||
getProp() {
|
||||
return (index, prop) => {
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
:price="form.pricePrice"
|
||||
:price-unit="form.priceUnit"
|
||||
:rules="rules.userProdList"
|
||||
:user-query="userQuery"
|
||||
/>
|
||||
|
||||
<div class="edit-title">关联订单</div>
|
||||
|
@ -94,6 +95,11 @@ export default {
|
|||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
// 用户查询条件
|
||||
userQuery: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<el-table-column label="员工" align="center">
|
||||
<template slot-scope="d">
|
||||
<form-col table label-width="0" :prop="`userProdList[${d.$index}].userId`" :rules="rules.userId">
|
||||
<user-input v-model="d.row.userId" open-type="dialog"/>
|
||||
<user-input v-model="d.row.userId" open-type="dialog" :list-api="listUserWithShift" :query="userQuery"/>
|
||||
</form-col>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -49,7 +49,9 @@
|
|||
<user-drawer
|
||||
multiple
|
||||
:show.sync="showUserDialog"
|
||||
:list-api="listUserWithShift"
|
||||
@select="onSelectUsers"
|
||||
:query="userQuery"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -62,6 +64,7 @@ import UserDialog from "@/components/Business/User/UserDialog.vue";
|
|||
import UserInput from "@/components/Business/User/UserInput.vue";
|
||||
import {calcMulDecimal} from "@/utils/money";
|
||||
import UserDrawer from "@/components/Business/User/UserDrawer.vue";
|
||||
import {listUserWithShift} from "@/api/system/user";
|
||||
|
||||
export default {
|
||||
name: "ReportProductUserListEdit",
|
||||
|
@ -86,6 +89,10 @@ export default {
|
|||
rules: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
userQuery: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -101,6 +108,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
listUserWithShift,
|
||||
// 添加用户产量
|
||||
handleAddUserProduct() {
|
||||
this.showUserDialog = true;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</template>
|
||||
<template slot-scope="d">
|
||||
<form-col table label-width="0">
|
||||
<user-input v-model="d.row.userId"/>
|
||||
<user-input v-model="d.row.userId" :list-api="listUserWithShift" :query="userQuery"/>
|
||||
</form-col>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -58,6 +58,8 @@
|
|||
<user-dialog
|
||||
:show.sync="showUserDialog"
|
||||
multiple
|
||||
:query="userQuery"
|
||||
:list-api="listUserWithShift"
|
||||
@select="onSelectUsers"
|
||||
/>
|
||||
|
||||
|
@ -74,15 +76,22 @@ import UserInput from "@/components/Business/User/UserInput.vue";
|
|||
import UserDialog from "@/components/Business/User/UserDialog.vue";
|
||||
import {isEmpty} from "@/utils";
|
||||
import {IncomeMode} from "@/utils/constants";
|
||||
import UserDrawer from "@/components/Business/User/UserDrawer.vue";
|
||||
import {listUserWithShift} from "@/api/system/user";
|
||||
|
||||
export default {
|
||||
name: "UserProductBatchDialog",
|
||||
components: {UserDialog, UserInput, FormCol},
|
||||
components: {UserDrawer, UserDialog, UserInput, FormCol},
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 用户查询条件
|
||||
userQuery: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
IncomeMode() {
|
||||
|
@ -106,6 +115,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
listUserWithShift,
|
||||
onSubmit() {
|
||||
this.$emit('submit', this.form);
|
||||
},
|
||||
|
|
389
src/views/yh/shift/index.vue
Normal file
389
src/views/yh/shift/index.vue
Normal file
|
@ -0,0 +1,389 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="目标部门" prop="targetDeptId">
|
||||
<dept-tree-select v-model="queryParams.targetDeptId" class="small-tree-select" @change="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="调班用户" prop="userName">
|
||||
<el-input
|
||||
v-model="queryParams.userName"
|
||||
placeholder="请输入调班用户名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="调班时间" prop="shiftTimeRange">
|
||||
<el-date-picker
|
||||
v-model="queryParams.shiftTimeRange"
|
||||
type="datetimerange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建部门" prop="deptId">
|
||||
<dept-tree-select v-model="queryParams.deptId" class="small-tree-select" @change="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="queryParams.remark"
|
||||
placeholder="请输入备注"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-has-permi="['yh:shift:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-has-permi="['yh:shift:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-has-permi="['yh:shift:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="shiftList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<template v-for="column of showColumns">
|
||||
<el-table-column
|
||||
:key="column.key"
|
||||
:label="column.label"
|
||||
:prop="column.key"
|
||||
:align="column.align"
|
||||
:min-width="column.minWidth"
|
||||
:sort-orders="orderSorts"
|
||||
:sortable="column.sortable"
|
||||
:show-overflow-tooltip="column.overflow"
|
||||
:width="column.width"
|
||||
>
|
||||
<template slot-scope="d">
|
||||
<template v-if="column.key === 'shiftId'">
|
||||
{{d.row[column.key]}}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'userIds'">
|
||||
<el-tag type="primary" size="mini" v-for="item of d.row.userList" :key="d.row.userId" style="margin-right: 4px">
|
||||
{{item.nickName | dv}}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'shiftTime'">
|
||||
起始:{{d.row.shiftTimeStart | dv}}<br/>
|
||||
结束:{{d.row.shiftTimeEnd | dv}}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'createBy'">
|
||||
{{d.row.createBy | dv}}<br/>
|
||||
{{d.row.createTime | dv}}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'updateBy'">
|
||||
{{d.row.updateBy | dv}}<br/>
|
||||
{{d.row.updateTime | dv}}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{d.row[column.key] | dv}}
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-has-permi="['yh:shift:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-has-permi="['yh:shift:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改调班对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<form-col :span="span" label="调班用户" prop="userIds">
|
||||
<user-input v-model="form.userIds" multiple/>
|
||||
</form-col>
|
||||
<form-col :span="span" label="目标部门" prop="targetDeptId">
|
||||
<dept-tree-select v-model="form.targetDeptId" width="100%"/>
|
||||
</form-col>
|
||||
<form-col :span="span" label="调班时间" prop="shiftTimeStart">
|
||||
<start-end-date-picker
|
||||
:start-date.sync="form.shiftTimeStart"
|
||||
:end-date.sync="form.shiftTimeEnd"
|
||||
:picker-options="DatePickerOptions.FUTURE"
|
||||
/>
|
||||
</form-col>
|
||||
<form-col :span="span" label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</form-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listShift, getShift, delShift, addShift, updateShift } from "@/api/yh/shift";
|
||||
import { $showColumns } from '@/utils/mixins';
|
||||
import FormCol from "@/components/FormCol/index.vue";
|
||||
import DeptTreeSelect from "@/components/Business/Dept/DeptTreeSelect.vue";
|
||||
import UserInput from "@/components/Business/User/UserInput.vue";
|
||||
import DateRangePicker from "@/components/DateRangePicker/index.vue";
|
||||
import StartEndDatePicker from "@/components/StartEndDatePicker/index.vue";
|
||||
import {DatePickerOptions} from "@/utils/constants";
|
||||
|
||||
// 默认排序字段
|
||||
const defaultSort = {
|
||||
prop: "createTime",
|
||||
order: "descending"
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "Shift",
|
||||
computed: {
|
||||
DatePickerOptions() {
|
||||
return DatePickerOptions
|
||||
}
|
||||
},
|
||||
mixins: [$showColumns],
|
||||
components: {StartEndDatePicker, DateRangePicker, UserInput, DeptTreeSelect, FormCol},
|
||||
data() {
|
||||
return {
|
||||
span: 24,
|
||||
// 字段列表
|
||||
columns: [
|
||||
{key: 'shiftId', visible: true, label: '编号', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
||||
{key: 'userIds', visible: true, label: '调班用户', minWidth: null, sortable: true, overflow: false, align: 'center', width: "400"},
|
||||
{key: 'shiftTime', visible: true, label: '调班时间', minWidth: null, sortable: false, overflow: false, align: 'center', width: "220"},
|
||||
{key: 'targetDeptName', visible: true, label: '目标部门', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'remark', visible: true, label: '备注', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'createBy', visible: true, label: '创建人', minWidth: null, sortable: false, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'deptName', visible: true, label: '创建部门', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'updateBy', visible: true, label: '更新人', minWidth: null, sortable: false, overflow: false, align: 'center', width: "100"},
|
||||
],
|
||||
// 排序方式
|
||||
orderSorts: ['ascending', 'descending', null],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 调班表格数据
|
||||
shiftList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
defaultSort,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
orderByColumn: defaultSort.prop,
|
||||
isAsc: defaultSort.order,
|
||||
shiftId: null,
|
||||
targetDeptId: null,
|
||||
createId: null,
|
||||
updateId: null,
|
||||
deptId: null,
|
||||
remark: null,
|
||||
shiftTimeRange: []
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
userIds: [
|
||||
{ required: true, message: "调班用户ID列表,逗号隔开不能为空", trigger: "blur" }
|
||||
],
|
||||
shiftTimeStart: [
|
||||
{ required: true, message: "调班时间不能为空", trigger: "blur" }
|
||||
],
|
||||
shiftTimeEnd: [
|
||||
{ required: true, message: "调班时间不能为空", trigger: "blur" }
|
||||
],
|
||||
targetDeptId: [
|
||||
{ required: true, message: "目标部门ID不能为空", trigger: "blur" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 当排序按钮被点击时触发 **/
|
||||
onSortChange(column) {
|
||||
if (column.order == null) {
|
||||
this.queryParams.orderByColumn = defaultSort.prop;
|
||||
this.queryParams.isAsc = defaultSort.order;
|
||||
} else {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
/** 查询调班列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listShift(this.queryParams).then(response => {
|
||||
this.shiftList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
shiftId: null,
|
||||
userIds: [],
|
||||
shiftTimeStart: null,
|
||||
shiftTimeEnd: null,
|
||||
targetDeptId: null,
|
||||
createTime: null,
|
||||
createId: null,
|
||||
updateTime: null,
|
||||
updateId: null,
|
||||
deptId: null,
|
||||
remark: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.shiftId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加调班";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const shiftId = row.shiftId || this.ids
|
||||
getShift(shiftId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改调班";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.shiftId != null) {
|
||||
updateShift(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addShift(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const shiftIds = row.shiftId || this.ids;
|
||||
this.$modal.confirm('是否确认删除调班编号为"' + shiftIds + '"的数据项?').then(function() {
|
||||
return delShift(shiftIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('yh/shift/export', {
|
||||
...this.queryParams
|
||||
}, `shift_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user