2024-06-04 基础信息-班组-优化列显示+分页问题

yangwl
A0010407 5 months ago
parent 22d6ffe8f8
commit 44ac5e0ae2

@ -1,6 +1,13 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="班组编码" prop="teamCode">
<el-input
v-model="queryParams.teamCode"
@ -18,8 +25,16 @@
/>
</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-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>
@ -32,7 +47,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['wms:team:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -43,7 +59,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['wms:team:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -54,7 +71,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['wms:team:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -64,12 +82,20 @@
size="mini"
@click="handleExport"
v-hasPermi="['wms:team:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="teamList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="teamList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<!-- 序号 -->
<el-table-column
@ -77,17 +103,36 @@
width="90"
align="center"
:index="indexMethod"
label="序号">
label="序号"
>
</el-table-column>
<el-table-column label="班组编码" align="center" prop="teamCode" />
<el-table-column label="班组名称" align="center" prop="teamDesc" />
<el-table-column prop="teamType" label="班组类别" align="center" >
<el-table-column
label="班组编码"
align="center"
prop="teamCode"
width="150"
/>
<el-table-column
label="班组名称"
align="center"
prop="teamDesc"
width="180"
/>
<el-table-column prop="teamType" label="班组类别" align="center">
<template slot-scope="scope">
{{ scope.row.teamType == "team_type1" ? "生产班组" : "检验班组" }}
</template>
</el-table-column>
<el-table-column label="所属产线" align="center" prop="productionLineCode" />
<el-table-column label="班组负责人" align="center" prop="teamLeaderName" />
<el-table-column
label="所属产线"
align="center"
prop="productionLineCode"
/>
<el-table-column
label="班组负责人"
align="center"
prop="teamLeaderName"
/>
<!-- <el-table-column label="班组组成人员" align="center" prop="teamMembers" /> -->
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createDate" />
@ -96,7 +141,11 @@
{{ scope.row.active == 1 ? "是" : "否" }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
@ -104,20 +153,22 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['wms:team:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['wms:team:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@ -125,24 +176,33 @@
/>
<!-- 添加或修改班组对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-dialog
:title="title"
:visible.sync="open"
width="1000px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-row :gutter="10" class="mb8">
<el-col :span="12">
<el-form-item label="班组编码" prop="teamCode" style="width:450px">
<el-form-item label="班组编码" prop="teamCode" style="width: 450px">
<el-input v-model="form.teamCode" placeholder="请输入班组编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组名称" prop="teamDesc" style="width:450px">
<el-form-item label="班组名称" prop="teamDesc" style="width: 450px">
<el-input v-model="form.teamDesc" placeholder="请输入班组" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="12">
<el-form-item label="班组类型" prop="teamType" >
<el-select v-model="form.teamType" placeholder="请选择班组" style="width:340px">
<el-form-item label="班组类型" prop="teamType">
<el-select
v-model="form.teamType"
placeholder="请选择班组"
style="width: 340px"
>
<el-option
v-for="dict in dict.type.team_type"
:key="dict.value"
@ -154,71 +214,138 @@
</el-col>
<el-col :span="12">
<el-form-item label="是否启用" prop="active">
<el-select v-model="form.active" placeholder="请选择是否启用" @change="$forceUpdate()" clearable style="width:340px">
<el-option v-for="item in options" :key="item.active" :label="item.label" :value="item.active"></el-option>
<el-select
v-model="form.active"
placeholder="请选择是否启用"
@change="$forceUpdate()"
clearable
style="width: 340px"
>
<el-option
v-for="item in options"
:key="item.active"
:label="item.label"
:value="item.active"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="12">
<el-form-item label="工厂编码" prop="siteCode" style="width:450px">
<el-input v-model="form.siteCode" placeholder="请输入工厂编码"/>
<el-form-item label="工厂编码" prop="siteCode" style="width: 450px">
<el-input v-model="form.siteCode" placeholder="请输入工厂编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属产线" prop="productionLineCode" style="width:450px">
<el-input v-model="form.productionLineCode" placeholder="请输入所属产线" />
<el-form-item
label="所属产线"
prop="productionLineCode"
style="width: 450px"
>
<el-input
v-model="form.productionLineCode"
placeholder="请输入所属产线"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="12">
<el-form-item label="班组长编码" prop="teamLeaderCode" style="width:450px">
<el-input v-model="form.teamLeaderCode" placeholder="请输入班组长编码" />
<el-form-item
label="班组长编码"
prop="teamLeaderCode"
style="width: 450px"
>
<el-input
v-model="form.teamLeaderCode"
placeholder="请输入班组长编码"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="定编岗位数量" prop="planPostQuantity" style="width:450px">
<el-input v-model="form.planPostQuantity" placeholder="请输入定编岗位数量" />
<el-form-item
label="定编岗位数量"
prop="planPostQuantity"
style="width: 450px"
>
<el-input
v-model="form.planPostQuantity"
placeholder="请输入定编岗位数量"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="12">
<el-form-item label="已分配岗位数量" prop="actualPostQuantity" style="width:450px">
<el-input v-model="form.actualPostQuantity" placeholder="请输入已分配岗位数量"/>
<el-form-item
label="已分配岗位数量"
prop="actualPostQuantity"
style="width: 450px"
>
<el-input
v-model="form.actualPostQuantity"
placeholder="请输入已分配岗位数量"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组属性" prop="teamProperties" style="width:450px">
<el-input v-model="form.teamProperties" placeholder="请输入班组属性"/>
<el-form-item
label="班组属性"
prop="teamProperties"
style="width: 450px"
>
<el-input
v-model="form.teamProperties"
placeholder="请输入班组属性"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="12">
<el-form-item label="应出勤人数" prop="attendanceQuantity" style="width:450px">
<el-input v-model="form.attendanceQuantity" placeholder="请输入应出勤人数"/>
<el-form-item
label="应出勤人数"
prop="attendanceQuantity"
style="width: 450px"
>
<el-input
v-model="form.attendanceQuantity"
placeholder="请输入应出勤人数"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="已分配人数" prop="assignedQuantity" style="width:450px">
<el-input v-model="form.assignedQuantity" placeholder="请输入已分配人数" />
<el-form-item
label="已分配人数"
prop="assignedQuantity"
style="width: 450px"
>
<el-input
v-model="form.assignedQuantity"
placeholder="请输入已分配人数"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="班组负责人" prop="teamLeaderName" style="width:450px">
<el-input v-model="form.teamLeaderName" placeholder="请输入班组负责人名字" />
<el-form-item
label="班组负责人"
prop="teamLeaderName"
style="width: 450px"
>
<el-input
v-model="form.teamLeaderName"
placeholder="请输入班组负责人名字"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-divider></el-divider>
<el-card>
<div style="text-align: center" >
<div style="text-align: center">
<template>
<el-transfer
filterable
@ -242,11 +369,19 @@
</template>
<script>
import { listTeam, getTeam, delTeam, addTeam, updateTeam ,listTeamMembers,getRightList} from "@/api/wms/team";
import {
listTeam,
getTeam,
delTeam,
addTeam,
updateTeam,
listTeamMembers,
getRightList,
} from "@/api/wms/team";
export default {
name: "Team",
dicts: ['sys_normal_disable', 'team_type'],
dicts: ["sys_normal_disable", "team_type"],
data() {
return {
//
@ -263,7 +398,7 @@ export default {
total: 0,
//
teamList: [],
teamMembersList:[],
teamMembersList: [],
//
leftList: [],
// key
@ -297,29 +432,36 @@ export default {
salaryType: null,
teamProperties: null,
attendanceQuantity: null,
assignedQuantity: null
assignedQuantity: null,
},
options: [{
teamQueryParams: {
pageNum: 1,
pageSize: 10,
},
options: [
{
active: "1",
label: '是'
}, {
label: "是",
},
{
active: "0",
label: '否'
}],
label: "否",
},
],
//
form: {},
//
rules: {
teamCode: [
{ required: true, message: "班组编码不能为空", trigger: "blur" }
{ required: true, message: "班组编码不能为空", trigger: "blur" },
],
teamDesc: [
{ required: true, message: "班组名称不能为空", trigger: "blur" }
{ required: true, message: "班组名称不能为空", trigger: "blur" },
],
active: [
{ required: true, message: "是否启用不能为空", trigger: "blur" }
{ required: true, message: "是否启用不能为空", trigger: "blur" },
],
}
},
};
},
@ -335,21 +477,20 @@ export default {
},
getTeamMembers() {
//
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10000;
listTeamMembers(this.queryParams).then(response => {
console.log(response.rows);
for(let i in response.rows){
this.teamQueryParams.pageNum = 1;
this.teamQueryParams.pageSize = 10000;
listTeamMembers(this.teamQueryParams).then((response) => {
for (let i in response.rows) {
// 穿
this.leftList.push({
key: response.rows[i].userId,
label: response.rows[i].teamUserName
})
}
for(let i in response.selected){
this.rightList.push(response.selected[i].key);
this.form.rightData = this.rightList;
label: response.rows[i].teamUserName,
});
}
// for (let i in response.selected) {
// this.rightList.push(response.selected[i].key);
// this.form.rightData = this.rightList;
// }
this.loading = false;
});
},
@ -357,7 +498,7 @@ export default {
/** 查询班组列表 */
getList() {
this.loading = true;
listTeam(this.queryParams).then(response => {
listTeam(this.queryParams).then((response) => {
this.teamList = response.rows;
this.total = response.total;
this.loading = false;
@ -395,7 +536,7 @@ export default {
salaryType: null,
teamProperties: null,
attendanceQuantity: null,
assignedQuantity: null
assignedQuantity: null,
};
this.resetForm("form");
},
@ -414,9 +555,9 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.teamId)
this.single = selection.length!==1
this.multiple = !selection.length
this.ids = selection.map((item) => item.teamId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
@ -431,38 +572,32 @@ export default {
handleUpdate(row) {
this.rightList = [];
this.reset();
const teamId = row.teamId || this.ids
console.log('this.leftList',this.leftList);
getTeam(teamId).then(response => {
const teamId = row.teamId || this.ids;
getTeam(teamId).then((response) => {
this.form = response.data;
for(let i in response.data.selectedData){
for (let i in response.data.selectedData) {
// 穿
this.rightList.push(
response.data.selectedData[i].userId
)
};
console.log('response.data.selectedData',response.data.selectedData);
})
this.open = true;
this.rightList.push(response.data.selectedData[i].userId);
}
});
this.title = "修改班组";
this.open = true;
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.teamId != null) {
this.form.rightData = this.rightList;
updateTeam(this.form).then(response => {
console.log("打印1",this.rightList,"打印2",this.form.rightData);
updateTeam(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.rightData = this.rightList;
addTeam(this.form).then(response => {
console.log("打印1",this.rightList,"打印2",this.form.rightData);
addTeam(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@ -475,30 +610,38 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const teamIds = row.teamId || this.ids;
this.$modal.confirm('是否确认删除班组编号为"' + teamIds + '"的数据项?').then(function() {
this.$modal
.confirm('是否确认删除班组编号为"' + teamIds + '"的数据项?')
.then(function () {
return delTeam(teamIds);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/team/export', {
...this.queryParams
}, `team_${new Date().getTime()}.xlsx`)
}
}
this.download(
"wms/team/export",
{
...this.queryParams,
},
`team_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<style>
.el-transfer-panel{
.el-transfer-panel {
width: 320px;
height: 400px;
}
.el-transfer-panel__list.is-filterable{
}
.el-transfer-panel__list.is-filterable {
height: 300px;
}
}
</style>

Loading…
Cancel
Save