李靖 4 months ago
commit 2b2e40c336

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

Loading…
Cancel
Save