You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

245 lines
7.1 KiB
Vue

<template>
<diV>
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
size="mini"
:disabled="multiple"
@click="handleDisBindTeam"
>删除</el-button>
</el-col>
</el-row>
<el-table :data="noticeGroupList" v-loading="loading" @selection-change="handleSelChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column label="班组编码" align="center" prop="groupCode" />
<el-table-column label="班组名称" align="center" prop="groupName" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="teamClose">关 闭</el-button>
</div>
</el-dialog>
<el-dialog :title="teamTitle" :visible.sync="teamOpen" width="1000px" append-to-body>
<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"
placeholder="请输入班组编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="班组名称" prop="teamDesc">
<el-input
v-model="queryParams.teamDesc"
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-table :data="teamList" v-loading="teamLoading" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" align="center" width="50"/>
<el-table-column label="班组编码" align="center" prop="teamCode" />
<el-table-column label="班组名称" align="center" prop="teamDesc" />
<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="createBy" />
<el-table-column label="创建时间" align="center" prop="createDate" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleBindTeam">提 交</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</diV>
</template>
<script>
import { listTeam,} from "@/api/wms/team";
import { getNoticeGroup,delNoticeGroup,teamBind,} from "@/api/system/noticeGroup";
export default {
name:"teamBind",
props: {
noticeId: Number,
},
data() {
return {
// 遮罩层
loading: true,
teamLoading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
groupCodes:[],
groupNames:[],
teamOpen: false,
// 总条数
total: 0,
// 公告表格数据
noticeGroupList: [],
teamList: [],
// 弹出层标题
title: "班组绑定",
teamTitle: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
teamCode:null,
teamDesc:null,
pageNum: 1,
pageSize: 10,
noticeId: null,
createBy: null
},
};
},
created() {
this.getTeamList();
},
methods: {
// 查询绑定列表
getList() {
this.loading = true;
getNoticeGroup(this.noticeId).then(response => {
this.noticeGroupList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 班组列表
getTeamList(){
listTeam().then(response => {
this.teamList = response.rows;
});
},
cancel() {
this.teamOpen = false;
},
teamClose() {
this.$emit('cancel');
//this.reset();
},
// 多选框选中数据
handleSelChange(selection) {
this.groupCodes = selection.map(item => item.groupCode)
this.single = selection.length!=1
this.multiple = !selection.length
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.teamCode)
this.groupNames = selection.map(item => item.teamDesc)
this.single = selection.length!=1
this.multiple = !selection.length
},
// 新增
handleAdd() {
this.teamLoading = true;
listTeam(this.queryParams).then(response => {
this.teamList = response.rows;
this.total = response.total;
this.teamOpen = true;
this.teamTitle = "添加班组";
this.teamLoading = false;
});
},
handleQuery() {
this.queryParams.pageNum = 1;
this.teamLoading = true;
listTeam(this.queryParams).then(response => {
this.teamList = response.rows;
this.total = response.total;
this.teamLoading = false;
});
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 提交绑定
handleBindTeam() {
const groupCodes = this.ids
const groupNames = this.groupNames
const noticeId = this.noticeId
const data = {
noticeId,
groupCodes,
groupNames
}
if (this.noticeId != undefined) {
teamBind(data).then(response => {
if(response.code == 200) {
this.$modal.msgSuccess("绑定成功");
}
this.teamOpen = false;
this.getList();
});
}
},
// 删除绑定
handleDisBindTeam() {
const groupCodes = this.groupCodes;
const noticeId = this.noticeId;
const data = {
noticeId,
groupCodes
}
this.$modal.confirm('是否确认删除班组编码为"' + groupCodes + '"的数据项?').then(function() {
return delNoticeGroup(data);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
},
};
</script>
<style scoped>
.mb8 {
margin-bottom: 8px;
}
</style>