Compare commits

..

No commits in common. "969a5303a87518898a00e24a75e899b15720a4e2" and "50517c42443c3bef87d452786f4d3f916233903f" have entirely different histories.

10 changed files with 382 additions and 929 deletions

View File

@ -5,7 +5,7 @@ ENV = 'development'
VUE_APP_TITLE = 芋道管理系统 VUE_APP_TITLE = 芋道管理系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
VUE_APP_BASE_API = 'http://192.168.0.33:48080' VUE_APP_BASE_API = 'http://192.168.1.8:48080'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -43,14 +43,6 @@ export function getGroupClassesPage(query) {
}) })
} }
// 获取班组code
export function getCode() {
return request({
url: '/base/group-classes/getCode',
method: 'get'
})
}
// 导出班次基础信息 Excel // 导出班次基础信息 Excel
export function exportGroupClassesExcel(query) { export function exportGroupClassesExcel(query) {
return request({ return request({

View File

@ -43,10 +43,12 @@ export function getGroupTeamPage(query) {
}) })
} }
// 获取班组code // 导出班组基础信息 Excel
export function getCode() { export function exportGroupTeamExcel(query) {
return request({ return request({
url: '/base/group-team/getCode', url: '/base/group-team/export-excel',
method: 'get' method: 'get',
params: query,
responseType: 'blob'
}) })
} }

View File

@ -49,9 +49,6 @@ Vue.prototype.DICT_TYPE = DICT_TYPE;
Vue.prototype.handleTree = handleTree; Vue.prototype.handleTree = handleTree;
Vue.prototype.addBeginAndEndTime = addBeginAndEndTime; Vue.prototype.addBeginAndEndTime = addBeginAndEndTime;
Vue.prototype.divide = divide; Vue.prototype.divide = divide;
Vue.prototype.tableHeight = function(n) {
return window.innerHeight - n
}
// 全局组件挂载 // 全局组件挂载
Vue.component('DictTag', DictTag); Vue.component('DictTag', DictTag);

View File

@ -1,181 +0,0 @@
<template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="班次名称" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="编码" prop="code">
<el-input v-model="form.code" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="生效时间" prop="enableTime">
<el-date-picker
v-model="form.enableTime"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="失效时间" prop="disableTime">
<el-date-picker
v-model="form.disableTime"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="班次开始时间" prop="startTime">
<el-time-picker
v-model="form.startTime"
format='HH:mm'
value-format='HH:mm'
style="width: 100%;"
@change="timeFun"
>
</el-time-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班次结束时间" prop="endTime">
<el-time-picker
v-model="form.endTime"
format='HH:mm'
value-format='HH:mm'
style="width: 100%;"
@change="timeFun"
>
</el-time-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否跨天" prop="daySpan">
<el-select v-model="form.daySpan" placeholder="请选择" disabled style="width: 100%;">
<el-option label="否" :value= '0' ></el-option>
<el-option label="是" :value= '1' ></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getGroupClasses, updateGroupClasses, createGroupClasses, getCode } from '@/api/base/groupClasses'
export default {
name: 'groupClassAdd',
data() {
return {
form: {
id: '',
name: '',
code: '',
enableTime: '',
disableTime: '',
startTime: '',
endTime: '',
daySpan: '',
remark: ''
},
isEdit: false, //
rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
enableTime: [{ required: true, message: '请选择班次开始时间', trigger: 'change' }],
code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
startTime: [{ required: true, message: '请输入生效时间', trigger: 'change' }],
endTime: [{ required: true, message: '请选择班次结束时间', trigger: 'change' }]
}
}
},
methods: {
init(id) {
if (id) {
this.isEdit = true
this.form.id = id
getGroupClasses(id).then((res) => {
if (res.code === 0) {
this.form = res.data
}
})
} else {
this.isEdit = false
this.form.id = ''
getCode().then((res) => {
this.form.code = res.data
})
}
},
timeFun() {
if (this.form.startTime && this.form.endTime) {
if (this.form.startTime > this.form.endTime) {
this.form.daySpan = 1
} else {
this.form.daySpan = 0
}
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
let obj = {}
if (this.form.disableTime) {
obj = this.form
} else {
obj.id = this.form.id
obj.name = this.form.name
obj.code = this.form.code
obj.enableTime = this.form.enableTime
obj.startTime = this.form.startTime
obj.endTime = this.form.endTime
obj.daySpan = this.form.daySpan
obj.remark = this.form.remark
}
if (this.isEdit) {
//
updateGroupClasses({ ...obj }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createGroupClasses({ ...obj }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.$refs.form.resetFields()
this.isEdit = false
}
}
}
</script>

View File

@ -2,243 +2,242 @@
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
:formConfigs="formConfig" <el-form-item label="班次名称" prop="name">
ref="searchBarForm" <el-input v-model="queryParams.name" placeholder="请输入班次名称" clearable @keyup.enter.native="handleQuery"/>
@headBtnClick="buttonClick" </el-form-item>
/> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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-hasPermi="['base:group-classes:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:group-classes:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 --> <!-- 列表 -->
<base-table <el-table v-loading="loading" :data="list">
:page="queryParams.pageNo" <el-table-column label="ID" align="center" prop="id" />
:limit="queryParams.pageSize" <el-table-column label="班次编码" align="center" prop="code" />
:table-props="tableProps" <el-table-column label="班次名称" align="center" prop="name" />
:table-data="list" <el-table-column label="开始时间" align="center" prop="startTime" />
:max-height="tableH" <el-table-column label="结束时间" align="center" prop="endTime" />
> <el-table-column label="是否跨天" align="center" prop="daySpan" />
<method-btn <el-table-column label="生效时间" align="center" prop="enableTime" width="180">
v-if="tableBtn.length" <template v-slot="scope">
slot="handleBtn" <span>{{ parseTime(scope.row.enableTime) }}</span>
:width="120" </template>
label="操作" </el-table-column>
:method-list="tableBtn" <el-table-column label="失效时间" align="center" prop="disableTime" width="180">
@clickBtn="handleClick" <template v-slot="scope">
/> <span>{{ parseTime(scope.row.disableTime) }}</span>
</base-table> </template>
<pagination </el-table-column>
:page.sync="queryParams.pageNo" <el-table-column label="创建时间" align="center" prop="createTime" width="180">
:limit.sync="queryParams.pageSize" <template v-slot="scope">
:total="total" <span>{{ parseTime(scope.row.createTime) }}</span>
@pagination="getList" </template>
/> </el-table-column>
<!-- 新增 --> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<base-dialog <template v-slot="scope">
:dialogTitle="addOrEditTitle" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
:dialogVisible="centervisible" v-hasPermi="['base:group-classes:update']">修改</el-button>
@cancel="handleCancel" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
@confirm="handleConfirm" v-hasPermi="['base:group-classes:delete']">删除</el-button>
:before-close="handleCancel" </template>
width='70%' </el-table-column>
> </el-table>
<group-class-add ref="classList" @successSubmit="successSubmit" /> <!-- 分页组件 -->
</base-dialog> <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="班次编码" prop="code">
<el-input v-model="form.code" placeholder="请输入班次编码" />
</el-form-item>
<el-form-item label="班次名称" prop="name">
<el-input v-model="form.name" placeholder="请输入班次名称" />
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<el-date-picker clearable v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择开始时间" />
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择结束时间" />
</el-form-item>
<el-form-item label="是否跨天" prop="daySpan">
<el-input v-model="form.daySpan" placeholder="请输入是否跨天" />
</el-form-item>
<el-form-item label="生效时间" prop="enableTime">
<el-date-picker clearable v-model="form.enableTime" type="date" value-format="timestamp" placeholder="选择生效时间" />
</el-form-item>
<el-form-item label="失效时间" prop="disableTime">
<el-date-picker clearable v-model="form.disableTime" type="date" value-format="timestamp" placeholder="选择失效时间" />
</el-form-item>
</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> </div>
</template> </template>
<script> <script>
import { getGroupClassesPage, deleteGroupClasses, updateGroupClasses } from "@/api/base/groupClasses"; import { createGroupClasses, updateGroupClasses, deleteGroupClasses, getGroupClasses, getGroupClassesPage, exportGroupClassesExcel } from "@/api/base/groupClasses";
import GroupClassAdd from './components/groupClassAdd.vue'
import { formatDate } from '@/utils'
const tableProps = [
{
prop: 'enableTimeStr',
label: '生效时段',
minWidth: 300
},
{
prop: 'name',
label: '班次名称'
},
{
prop: 'timeStr',
label: '班次时间'
},
{
prop: 'code',
label: '班次编码',
minWidth: 200
},
{
prop: 'status',
label: '班次状态'
},
{
prop: 'remark',
label: '备注'
}
]
const tableBtn = [
{
type: 'edit',
btnName: '编辑'
},
{
type: 'cancel',
btnName: '作废'
},
{
type: 'delete',
btnName: '删除'
}
]
export default { export default {
name: "GroupClass", name: "GroupClasses",
components: { GroupClassAdd }, components: {
},
data() { data() {
return { return {
formConfig: [ //
{ loading: true,
type: 'input', //
label: '班次名称', exportLoading: false,
placeholder: '班次名称', //
param: 'name' showSearch: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:group-classes:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn,
tableH: this.tableHeight(275),
// //
total: 0, total: 0,
// //
list: [], list: [],
// //
addOrEditTitle: "", title: "",
// //
centervisible: false, open: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 10,
name: null name: null,
},
//
form: {},
//
rules: {
startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }],
endTime: [{ required: true, message: "结束时间不能为空", trigger: "blur" }],
enableTime: [{ required: true, message: "生效时间不能为空", trigger: "blur" }],
} }
}; };
}, },
created() { created() {
window.addEventListener('resize', () => { this.getList();
this.tableH = this.tableHeight(275)
})
this.getList()
}, },
methods: { methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.classList.init()
})
}
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
getGroupClassesPage(this.queryParams).then(res => { this.loading = true;
if (res.code === 0 && res.data.list.length > 0) { //
res.data.list.map(item => { getGroupClassesPage(this.queryParams).then(response => {
item.enableTimeStr = formatDate(item.enableTime) + '至' + (item.disableTime ? formatDate(item.disableTime) : '永久') this.list = response.data.list;
item.timeStr = item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5) this.total = response.data.total;
item.status = item.status === true ? '可用' : '不可用' this.loading = false;
})
this.list = res.data.list;
this.total = res.data.total;
} else {
this.list = []
this.total = 0
}
}); });
}, },
handleClick(val) { /** 取消按钮 */
switch (val.type) { cancel() {
case 'edit': this.open = false;
this.addOrEditTitle = '编辑' this.reset();
this.$nextTick(() => {
this.$refs.classList.init(val.data.id)
})
this.centervisible = true
break
case 'cancel':
this.discard(val.data)
break
default:
this.handleDelete(val.data)
}
}, },
handleCancel() { /** 表单重置 */
this.$refs.classList.formClear() reset() {
this.centervisible = false this.form = {
this.addOrEditTitle = '' id: undefined,
code: undefined,
name: undefined,
startTime: undefined,
endTime: undefined,
daySpan: undefined,
enableTime: undefined,
disableTime: undefined,
};
this.resetForm("form");
}, },
handleConfirm() { /** 搜索按钮操作 */
this.$refs.classList.submitForm() handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
}, },
successSubmit() { /** 重置按钮操作 */
this.handleCancel() resetQuery() {
this.getList() this.resetForm("queryForm");
this.handleQuery();
}, },
discard(row) { /** 新增按钮操作 */
let obj = {} handleAdd() {
obj.id = row.id this.reset();
obj.startTime = row.startTime this.open = true;
obj.endTime = row.endTime this.title = "添加班次基础信息";
obj.enableTime = row.enableTime },
obj.disableTime = Date.parse(new Date()) /** 修改按钮操作 */
this.$modal.confirm('是否确认作废班次名称为"' + row.name + '"的数据项?').then(function() { handleUpdate(row) {
return updateGroupClasses({ ...obj }) this.reset();
}).then(() => { const id = row.id;
getGroupClasses(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改班次基础信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateGroupClasses(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createGroupClasses(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList(); this.getList();
this.$modal.msgSuccess("操作成功"); });
}).catch(() => {}); });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
if (row.status) { const id = row.id;
let _this = this this.$modal.confirm('是否确认删除班次基础信息编号为"' + id + '"的数据项?').then(function() {
_this.$modal.confirm('删除的班次"' + row.name + '"可能会影响交接班计划,请点取消再次确认!').then(function() { return deleteGroupClasses(id);
return _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() { }).then(() => {
return deleteGroupClasses(row.id); this.getList();
}).then(() => { this.$modal.msgSuccess("删除成功");
_this.getList(); }).catch(() => {});
_this.$modal.msgSuccess("删除成功"); },
}).catch(() => {}); /** 导出按钮操作 */
}) handleExport() {
} else { //
_this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() { let params = {...this.queryParams};
return deleteGroupClasses(row.id); params.pageNo = undefined;
}).then(() => { params.pageSize = undefined;
_this.getList(); this.$modal.confirm('是否确认导出所有班次基础信息数据项?').then(() => {
_this.$modal.msgSuccess("删除成功"); this.exportLoading = true;
}).catch(() => {}); return exportGroupClassesExcel(params);
} }).then(response => {
this.$download.excel(response, '班次基础信息.xls');
this.exportLoading = false;
}).catch(() => {});
} }
} }
}; };

View File

@ -1,84 +0,0 @@
<template>
<el-form ref="form" :rules="rules" label-width="80px" :model="form">
<el-form-item label="班组名称" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="班组编码" prop="code">
<el-input v-model="form.code" disabled></el-input>
</el-form-item>
<el-form-item label="班组人数" prop="num">
<el-input v-model="form.num"></el-input>
</el-form-item>
<el-form-item label="班组组长" prop="leaderName">
<el-input v-model="form.leaderName"></el-input>
</el-form-item>
</el-form>
</template>
<script>
import { getGroupTeam, updateGroupTeam, createGroupTeam, getCode } from '@/api/base/groupTeam'
export default {
name: 'groupTeamAdd',
data() {
return {
form: {
id: '',
name: '',
code: '',
num: null,
leaderName: ''
},
isEdit: false, //
rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }]
}
}
},
methods: {
init(id) {
if (id) {
this.isEdit = true
this.form.id = id
getGroupTeam( id ).then((res) => {
if (res.code === 0) {
this.form = res.data
}
})
} else {
this.isEdit = false
this.form.id = ''
getCode().then((res) => {
this.form.code = res.data
})
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.isEdit) {
//
updateGroupTeam({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
createGroupTeam({ ...this.form }).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
}
} else {
return false
}
})
},
formClear() {
this.$refs.form.resetFields()
this.isEdit = false
}
}
}
</script>

View File

@ -1,40 +0,0 @@
<template>
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
state: false,
payload: {}
}
},
computed: {
readonly() {
return !!this.injectData.readonly
}
},
mounted() {
this.mapToState()
},
methods: {
mapToState() {
if (this.injectData.prop === 'enabled') {
this.state = this.injectData.enabled === 1 ? true : false
}
},
changeHandler() {
this.payload.id = this.injectData.id
this.payload.enabled = this.state ? '1' : '0'
this.$emit('emitData', this.payload)
}
}
}
</script>

View File

@ -2,220 +2,221 @@
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
:formConfigs="formConfig" <el-form-item label="班组编码" prop="code">
ref="searchBarForm" <el-input v-model="queryParams.code" placeholder="请输入班组编码" clearable @keyup.enter.native="handleQuery"/>
@headBtnClick="buttonClick" </el-form-item>
/> <el-form-item label="班组名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入班组名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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-hasPermi="['base:group-team:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:group-team:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 --> <!-- 列表 -->
<base-table <el-table v-loading="loading" :data="list">
:page="queryParams.pageNo" <el-table-column label="ID" align="center" prop="id" />
:limit="queryParams.pageSize" <el-table-column label="班组编码" align="center" prop="code" />
:table-props="tableProps" <el-table-column label="班组名称" align="center" prop="name" />
:table-data="list" <el-table-column label="班组人数" align="center" prop="num" />
:max-height="tableH" <el-table-column label="组长名字" align="center" prop="leaderName" />
@emitFun="handleTableEvents" <el-table-column label="启用状态:0 、停用1、启用" align="center" prop="enabled" />
> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<method-btn <template v-slot="scope">
v-if="tableBtn.length" <span>{{ parseTime(scope.row.createTime) }}</span>
slot="handleBtn" </template>
:width="80" </el-table-column>
label="操作" <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
:method-list="tableBtn" <template v-slot="scope">
@clickBtn="handleClick" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
/> v-hasPermi="['base:group-team:update']">修改</el-button>
</base-table> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
<pagination v-hasPermi="['base:group-team:delete']">删除</el-button>
:page.sync="queryParams.pageNo" </template>
:limit.sync="queryParams.pageSize" </el-table-column>
:total="total" </el-table>
@pagination="getList" <!-- 分页组件 -->
/> <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
<!-- 新增 --> @pagination="getList"/>
<base-dialog
:dialogTitle="addOrEditTitle" <!-- 对话框(添加 / 修改) -->
:dialogVisible="centervisible" <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
@cancel="handleCancel" <el-form ref="form" :model="form" :rules="rules" label-width="80px">
@confirm="handleConfirm" <el-form-item label="班组编码" prop="code">
:before-close="handleCancel" <el-input v-model="form.code" placeholder="请输入班组编码" />
> </el-form-item>
<group-team-add ref="groupList" @successSubmit="successSubmit" /> <el-form-item label="班组名称" prop="name">
</base-dialog> <el-input v-model="form.name" placeholder="请输入班组名称" />
</el-form-item>
<el-form-item label="班组人数" prop="num">
<el-input v-model="form.num" placeholder="请输入班组人数" />
</el-form-item>
<el-form-item label="组长名字" prop="leaderName">
<el-input v-model="form.leaderName" placeholder="请输入组长名字" />
</el-form-item>
</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> </div>
</template> </template>
<script> <script>
import { getGroupTeamPage, deleteGroupTeam, updateGroupTeam } from "@/api/base/groupTeam"; import { createGroupTeam, updateGroupTeam, deleteGroupTeam, getGroupTeam, getGroupTeamPage, exportGroupTeamExcel } from "@/api/base/groupTeam";
import { parseTime } from '@/utils/ruoyi'
import GroupTeamAdd from './components/groupTeamAdd.vue'
import StatusBtn from './components/statusBtn.vue'
const tableProps = [
{
prop: 'createTime',
label: '创建时间',
filter: parseTime,
minWidth: 150
},
{
prop: 'name',
label: '班组名称'
},
{
prop: 'code',
label: '班组编码',
minWidth: 220
},
{
prop: 'num',
label: '班组人数'
},
{
prop: 'leaderName',
label: '班组组长'
},
{
prop: 'enabled',
label: '班组状态',
subcomponent: StatusBtn
}
]
const tableBtn = [
{
type: 'edit',
btnName: '编辑'
},
{
type: 'delete',
btnName: '删除'
}
]
export default { export default {
name: "GroupTeam", name: "GroupTeam",
components: { GroupTeamAdd }, components: {
},
data() { data() {
return { return {
formConfig: [ //
{ loading: true,
type: 'input', //
label: '名称', exportLoading: false,
placeholder: '名称', //
param: 'name' showSearch: true,
},
{
type: 'input',
label: '编码',
placeholder: '编码',
param: 'code'
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
},
{
type: 'separate'
},
{
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
tableProps,
tableBtn,
tableH: this.tableHeight(275),
// //
total: 0, total: 0,
// //
list: [], list: [],
// //
addOrEditTitle: "", title: "",
// //
centervisible: false, open: false,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 20, pageSize: 10,
code: null,
name: null, name: null,
code: null },
//
form: {},
//
rules: {
} }
}; };
}, },
created() { created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(275)
})
this.getList(); this.getList();
}, },
methods: { methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name
this.queryParams.code = val.code
this.getList()
break
default:
this.addOrEditTitle = '新增'
this.centervisible = true
this.$nextTick(() => {
this.$refs.groupList.init()
})
}
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true;
//
getGroupTeamPage(this.queryParams).then(response => { getGroupTeamPage(this.queryParams).then(response => {
this.list = response.data.list; this.list = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false;
}); });
}, },
handleClick(val) { /** 取消按钮 */
switch (val.type) { cancel() {
case 'edit': this.open = false;
this.addOrEditTitle = '编辑' this.reset();
this.$nextTick(() => {
this.$refs.groupList.init(val.data.id)
})
this.centervisible = true
break
default:
this.handleDelete(val.data)
}
}, },
// /** 表单重置 */
handleTableEvents(data) { reset() {
updateGroupTeam({ ...data }).then((res) => { this.form = {
if (res.code === 0) { id: undefined,
this.$modal.msgSuccess("操作成功"); code: undefined,
name: undefined,
num: undefined,
leaderName: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加班组基础信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getGroupTeam(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改班组基础信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
} }
}) //
}, if (this.form.id != null) {
handleCancel() { updateGroupTeam(this.form).then(response => {
this.$refs.groupList.formClear() this.$modal.msgSuccess("修改成功");
this.centervisible = false this.open = false;
this.addOrEditTitle = '' this.getList();
}, });
handleConfirm() { return;
this.$refs.groupList.submitForm() }
}, //
successSubmit() { createGroupTeam(this.form).then(response => {
this.handleCancel() this.$modal.msgSuccess("新增成功");
this.getList() this.open = false;
this.getList();
});
});
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal.confirm('是否确认删除班组名称为"' + row.name + '"的数据项?').then(function() { const id = row.id;
return deleteGroupTeam(row.id); this.$modal.confirm('是否确认删除班组基础信息编号为"' + id + '"的数据项?').then(function() {
return deleteGroupTeam(id);
}).then(() => { }).then(() => {
this.queryParams.pageNo = 1;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有班组基础信息数据项?').then(() => {
this.exportLoading = true;
return exportGroupTeamExcel(params);
}).then(response => {
this.$download.excel(response, '班组基础信息.xls');
this.exportLoading = false;
}).catch(() => {});
} }
} }
}; };

View File

@ -1,233 +0,0 @@
<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="startDay">
<el-input v-model="queryParams.startDay" placeholder="请输入上班日期" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @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-hasPermi="['base:group-team-scheduling:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['base:group-team-scheduling:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="班组ID" align="center" prop="teamId" />
<el-table-column label="班次id" align="center" prop="classesId" />
<el-table-column label="上班日期" align="center" prop="startDay" />
<el-table-column label="上班时间" align="center" prop="startTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.startTime) }}</span>
</template>
</el-table-column>
<el-table-column label="下班时间" align="center" prop="endTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['base:group-team-scheduling:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:group-team-scheduling:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="班组ID" prop="teamId">
<el-input v-model="form.teamId" placeholder="请输入班组ID" />
</el-form-item>
<el-form-item label="班次id" prop="classesId">
<el-input v-model="form.classesId" placeholder="请输入班次id" />
</el-form-item>
<el-form-item label="上班日期" prop="startDay">
<el-input v-model="form.startDay" placeholder="请输入上班日期" />
</el-form-item>
<el-form-item label="上班时间" prop="startTime">
<el-date-picker clearable v-model="form.startTime" type="date" value-format="timestamp" placeholder="选择上班时间" />
</el-form-item>
<el-form-item label="下班时间" prop="endTime">
<el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择下班时间" />
</el-form-item>
</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 { createGroupTeamScheduling, updateGroupTeamScheduling, deleteGroupTeamScheduling, getGroupTeamScheduling, getGroupTeamSchedulingPage, exportGroupTeamSchedulingExcel } from "@/api/base/groupTeamScheduling";
export default {
name: "GroupTeamScheduling",
components: {
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
startDay: [],
},
//
form: {},
//
rules: {
teamId: [{ required: true, message: "班组ID不能为空", trigger: "blur" }],
classesId: [{ required: true, message: "班次id不能为空", trigger: "blur" }],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getGroupTeamSchedulingPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
teamId: undefined,
classesId: undefined,
startDay: undefined,
startTime: undefined,
endTime: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加排班信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getGroupTeamScheduling(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改排班信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateGroupTeamScheduling(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createGroupTeamScheduling(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除排班信息编号为"' + id + '"的数据项?').then(function() {
return deleteGroupTeamScheduling(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有排班信息数据项?').then(() => {
this.exportLoading = true;
return exportGroupTeamSchedulingExcel(params);
}).then(response => {
this.$download.excel(response, '排班信息.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>