Browse Source

修改班组添加操作

fix_bug_pro20231227
caoyizhong 2 years ago
parent
commit
9aa102af6d
  1. 11
      src/api/basicdata/basicdataTeamGroup.js
  2. 10
      src/api/basicdata/basicdataWarehouse.js
  3. 9
      src/api/system/user.js
  4. 6
      src/option/basicdata/basicdataTeamGroup.js
  5. 20
      src/option/basicdata/basicdataTeamStaff.js
  6. 224
      src/views/basicdata/team/basicdataTeamGroup.vue
  7. 213
      src/views/basicdata/team/basicdataTeamStaff.vue

11
src/api/basicdata/basicdataTeamGroup.js

@ -11,6 +11,17 @@ export const getList = (current, size, params) => {
}
})
}
export const getTeamGroupList = (current, size, params) => {
return request({
url: '/api/logpm-basicdata/basicdataTeamGroup/list',
method: 'get',
params: {
...params,
current,
size,
}
})
}
export const getListTeam = (current, size, params) => {
return request({

10
src/api/basicdata/basicdataWarehouse.js

@ -29,6 +29,16 @@ export const getListCopy = (current, size, params) => {
})
}
export const getDeptWarehouse = (params) => { //查询部门下的仓库
return request({
url: '/api/logpm-basicdata/warehouse/deptWarehouse',
method: 'get',
params: {
...params,
}
})
}
export const getListBinName = (current, size, params) => {
return request({
url: '/api/logpm-basicdata/warehouse/list',

9
src/api/system/user.js

@ -71,6 +71,15 @@ export const getUser = id => {
},
});
};
export const getUserDetail = id => {
return request({
url: '/blade-system/user/detail',
method: 'get',
params: {
id,
},
});
};
export const getUserPlatform = id => {
return request({

6
src/option/basicdata/basicdataTeamGroup.js

@ -94,15 +94,15 @@ export default {
},
{
label: "仓库",
prop: "belongTo",
prop: "warehouseName",
},
{
label: "班组类型",
prop: "groupType",
prop: "groupTypeName",
},
{
label: "归属部门",
prop: "department",
prop: "departmentName",
search: true,
},
]

20
src/option/basicdata/basicdataTeamStaff.js

@ -88,21 +88,25 @@ export default {
display: false,
hide: true,
},
{
label: "班组ID",
prop: "teamGroupId",
},
{
label: "姓名",
prop: "name",
},
// {
// label: "工号",
// prop: "jobNumber",
// },
{
label: "班组名称",
prop: "teamGroupName",
},
{
label: "工号",
prop: "jobNumber",
label: "所属部门名称",
prop: "departmentName",
},
{
label: "员工表ID",
prop: "staffId",
label: "仓库名称",
prop: "warehouseName",
},
]
}

224
src/views/basicdata/team/basicdataTeamGroup.vue

@ -4,8 +4,11 @@
<el-row :hidden="!search" style="padding:6px 18px">
<!-- 查询模块 -->
<el-form :inline="true" :model="query">
<el-form-item label="归属部门:">
<el-input v-model="query.department" placeholder="请输入归属部门"></el-input>
<el-form-item label="仓库名称:">
<el-input v-model="query.warehouseName" placeholder="请输入仓库名称"></el-input>
</el-form-item>
<el-form-item label="班组名称:">
<el-input v-model="query.groupName" placeholder="请输入班组名称"></el-input>
</el-form-item>
<!-- 查询按钮 -->
<el-form-item>
@ -77,24 +80,41 @@
<!-- 表单模块 -->
<el-dialog :title="title"
v-model="box"
width="50%"
width="40%"
:before-close="beforeClose"
append-to-body>
<el-form :disabled="view" ref="form" :model="form" label-width="80px">
<el-form :disabled="view" ref="form" :model="form" :rules="rules" label-width="80px">
<!-- 表单字段 -->
<!-- <el-form-item label="归属部门" prop="department">-->
<!-- <el-select v-model="form.department" clearable placeholder="请选择归属部门" @change="clickDept($event)">-->
<!-- <el-option-->
<!-- v-for="item in departmentData"-->
<!-- :key="item.id"-->
<!-- :label="item.deptName"-->
<!-- :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="组名" prop="groupName">
<el-input v-model="form.groupName" placeholder="请输入组名"/>
</el-form-item>
<el-form-item label="仓库" prop="belongTo">
<el-input v-model="form.belongTo" placeholder="请输入仓库"/>
</el-form-item>
<el-form-item label="班组类型" prop="groupType">
<el-input v-model="form.groupType" placeholder="请输入班组类型"/>
<!-- <el-input v-model="form.belongTo" placeholder="请输入仓库"/>-->
<el-select v-model="form.belongTo" clearable placeholder="请选择仓库" style="width: 80%" @change="clickWarehouse($event)">
<el-option
v-for="item in warehouseList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="归属部门" prop="department">
<el-select v-model="form.department" clearable placeholder="请选择归属部门">
<el-form-item label="班组类型" prop="groupTypes">
<!-- <el-input v-model="form.groupType" placeholder="请输入班组类型"/>-->
<el-select v-model="form.groupTypes" multiple clearable placeholder="请选择班组类型" style="width: 80%">
<el-option
v-for="item in departmentData"
v-for="item in teamType"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey">
@ -105,7 +125,7 @@
<!-- 表单按钮 -->
<template #footer>
<span v-if="!view" class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit"> </el-button>
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit('form')"> </el-button>
<el-button icon="el-icon-circle-close" @click="box = false"> </el-button>
</span>
</template>
@ -118,6 +138,11 @@
import { getList, getDetail, add, update, remove } from "@/api/basicdata/basicdataTeamGroup";
import option from "@/option/basicdata/basicdataTeamGroup";
import { mapGetters } from "vuex";
import { getDictionaryBiz } from '@/api/system/dict';
import { getListUser } from '@/api/distribution/distributionStockup';
import { getDept,getLazyList } from '@/api/system/dept';
import { getDeptWarehouse } from '@/api/basicdata/basicdataWarehouse';
import { getUserDetail } from '@/api/system/user';
export default {
data () {
@ -143,12 +168,31 @@ export default {
},
//
form: {},
groupType: [],
//
selectionList: [],
teamType: [], //
departmentData: [], //
warehouseList: [],
//
option: option,
//
data: [],
rules: {
groupName: [
{ required: true, message: '请输入班组名称', trigger: 'blur' },
],
groupTypes: [
{ required: true, message: '请选择班组类型', trigger: 'change' }
],
department: [
{ required: true, message: '请选择班组', trigger: 'change' }
],
belongTo: [
{ required: true, message: '请选择仓库', trigger: 'change' }
],
}
}
},
mounted () {
@ -166,8 +210,35 @@ export default {
}
},
methods: {
//
clickWarehouse(row){
// console.log("",row);
let a = this.warehouseList.find(i => i.id == row);
if(!!a){
this.form.warehouseName = a.name;
this.form.belongTo = a.id;
}
},
//
clickDept(row){
// console.log("",row);
let a = this.departmentData.find(i => i.id == row);
if(!!a){
this.form.departmentName = a.deptName;
this.form.department = a.id;
}
},
init () {
this.height = this.setPx(document.body.clientHeight - 340);
getDictionaryBiz('team_type').then(res => {
this.teamType = res.data.data;
// this.checkcColumnList("typeServerName", this.columnList).checkarr=res.data.data.map(item=>{
// item.value=item.dictKey
// item.label=item.dictValue
// return item
// });
});
},
searchHide () {
this.search = !this.search;
@ -180,45 +251,106 @@ export default {
this.page.currentPage = 1;
this.onLoad(this.page);
},
handleSubmit () {
if (!this.form.id) {
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
handleSubmit (formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (!this.form.id) {
console.log(">><><<>",this.form);
this.form.groupType = this.form.groupTypes.join(',');
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
console.log("修改《《《《",this.form);
this.form.groupType = this.form.groupTypes.join(',');
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
}else {
console.log('error submit!!');
return false;
}
});
},
handleAdd () {
this.title = '新增'
this.form = {}
this.box = true
this.box = true;
//
this.getWarehouseList();
},
async getWarehouseList(){
let userDept = await getListUser();
console.log("<><><>",userDept.data.data);
let sole = await getUserDetail(userDept.data.data.userId);
console.log(",....t=用户信息s",sole);
if(sole.data.data.roleName == '管理员'){
// let dept = await getDept();
let parentId = 0;
let lis = await getLazyList(parentId);
console.log("全部部门",lis);
this.departmentData = lis.data.data;
//
let deptW = await getDeptWarehouse({tenantId: userDept.data.data.tenantId});
console.log("仓库数据",deptW.data.data);
this.warehouseList = deptW.data.data;
}else{
//
let dept = await getDept(userDept.data.data.deptId);
console.log("<><><>",dept.data.data);
// let a = {
// id:dept.data.data.id,
// deptName: dept.data.data.deptName
// }
/* this.departmentData = [];
this.form.department = a.id;
this.form.departmentName = a.deptName;
this.departmentData.push(a);*/
const da = dept.data.data;
if(!!da.parentId && da.parentId != '0'){
//
let deptW = await getDeptWarehouse({department: da.id});
this.warehouseList = deptW.data.data;
console.log("123123123123",deptW);
}
}
},
handleEdit (row) {
async handleEdit (row) {
//
await this.getWarehouseList();
this.title = '编辑'
this.box = true
getDetail(row.id).then(res => {
console.log("编码》》》",res.data.data.groupType);
this.form = res.data.data;
this.form.groupTypes = this.form.groupType.split(",");
console.log("<><><>",this.form);
});
},
handleView (row) {
this.title = '查看'
this.view = true;
this.box = true;
//
this.getWarehouseList();
getDetail(row.id).then(res => {
this.form = res.data.data;
this.form.groupTypes = this.form.groupType.split(",");
});
},
handleDelete () {
@ -286,6 +418,30 @@ export default {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
// this.data = this.data.forEach(e =>{
// let a = e.groupType.split(',');
// let f = null;
// a.map((i,index) =>{
// let s = this.teamType.find( l => l.dictKey == i);
// if(!!f){
// f += s.dictValue + a.length == index ? null : " | ";
// }else{
// f = s.dictValue+ a.length > 0 ? " | " : null;
// }
// })
// i.groupTypeName = f;
// });
this.data.forEach(e => {
let a = e.groupType.split(',');
let f = a.map((i, index) => {
let s = this.teamType.find(l => l.dictKey === i);
return s ? s.dictValue : '';
}).filter(Boolean).join(' | ');
e.groupTypeName = f;
});
this.loading = false;
this.selectionClear();
});

213
src/views/basicdata/team/basicdataTeamStaff.vue

@ -4,6 +4,13 @@
<el-row :hidden="!search" style="padding:6px 18px">
<!-- 查询模块 -->
<el-form :inline="true" :model="query">
<el-form-item label="仓库名称:">
<el-input v-model="query.warehouseName" placeholder="请输入仓库名称"></el-input>
</el-form-item>
<el-form-item label="班组名称:">
<el-input v-model="query.teamGroupName" placeholder="请输入班组名称"></el-input>
</el-form-item>
<!-- 查询按钮 -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="searchChange"> </el-button>
@ -35,7 +42,7 @@
:border="option.border">
<el-table-column type="selection" v-if="option.selection" width="55" align="center"></el-table-column>
<el-table-column type="expand" v-if="option.expand" align="center"></el-table-column>
<el-table-column v-if="option.index" label="#" type="index" width="50" align="center">
<el-table-column v-if="option.index" label="序号" type="index" width="70" align="center">
</el-table-column>
<template v-for="(item,index) in option.column">
<!-- table字段 -->
@ -74,28 +81,51 @@
<!-- 表单模块 -->
<el-dialog :title="title"
v-model="box"
width="50%"
width="40%"
:before-close="beforeClose"
append-to-body>
<el-form :disabled="view" ref="form" :model="form" label-width="80px">
<el-form :disabled="view" ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item label="仓库" prop="warehouseId">
<!-- <el-input v-model="form.staffId" placeholder="请输入员工表ID"/>-->
<el-select v-model="form.warehouseId" clearable placeholder="请选择仓库" @change="clickDept($event)" style="width: 80%">
<el-option
v-for="item in warehouseList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<!-- 表单字段 -->
<el-form-item label="班组ID" prop="teamGroupId">
<el-input v-model="form.teamGroupId" placeholder="请输入班组ID"/>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入姓名"/>
</el-form-item>
<el-form-item label="工号" prop="jobNumber">
<el-input v-model="form.jobNumber" placeholder="请输入工号"/>
<el-form-item label="班组" prop="teamGroupId">
<!-- <el-input v-model="form.teamGroupId" placeholder="请输入班组ID"/>-->
<el-select v-model="form.teamGroupId" clearable placeholder="请选择班组" @change="clickTeamGroup($event,1)" style="width: 80%">
<el-option
v-for="item in teamGroupList"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="员工表ID" prop="staffId">
<el-input v-model="form.staffId" placeholder="请输入员工表ID"/>
<el-form-item label="人员" prop="staffId">
<!-- <el-input v-model="form.staffId" placeholder="请输入姓名"/>-->
<el-select v-model="form.staffId" clearable placeholder="请选择人员" @change="clickTeamGroup($event,2)" style="width: 80%">
<el-option
v-for="item in staffList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<!-- 表单按钮 -->
<template #footer>
<span v-if="!view" class="dialog-footer">
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit"> </el-button>
<el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit('form')"> </el-button>
<el-button icon="el-icon-circle-close" @click="box = false"> </el-button>
</span>
</template>
@ -108,6 +138,12 @@
import { getList, getDetail, add, update, remove } from "@/api/basicdata/basicdataTeamStaff";
import option from "@/option/basicdata/basicdataTeamStaff";
import { mapGetters } from "vuex";
import { getListUser } from '@/api/distribution/distributionStockup';
import { getUserDetail } from '@/api/system/user';
import { getDept, getLazyList } from '@/api/system/dept';
import { getDeptWarehouse } from '@/api/basicdata/basicdataWarehouse';
import { getTeamGroupList } from '@/api/basicdata/basicdataTeamGroup';
import { getListOwn } from '@/api/system/user';
export default {
data () {
@ -135,10 +171,26 @@ export default {
form: {},
//
selectionList: [],
warehouseList: [],
teamGroupList: [],
staffList: [],
//
option: option,
//
data: [],
deptId: '',
warehouId: '',
rules: {
warehouseId: [
{ required: true, message: '请选择仓库', trigger: 'change' }
],
teamGroupId: [
{ required: true, message: '请选择班组', trigger: 'change' }
],
staffId: [
{ required: true, message: '请选择人员', trigger: 'change' }
],
}
}
},
mounted () {
@ -156,6 +208,47 @@ export default {
}
},
methods: {
//
async clickDept(row){
// console.log("",row);
if(this.form.warehouId != row){
let id = "";
if(!!this.form.id){
id = this.form.id;
}
this.form = {};
this.form.id = !!id ? id : null;
}
let a = this.warehouseList.find(i => i.id == row);
if(!!a){
this.form.warehouseName = a.name;
this.form.warehouseId = a.id;
this.warehouId = a.id;
//
let sd = await getTeamGroupList(this.page.currentPage,this.page.pageSize,{belongTo: a.id});
this.teamGroupList = sd.data.data.records;
//
let user = await getListOwn({deptId:this.deptId});
this.staffList = user.data.data;
}
},
//
clickTeamGroup(row,num){
switch (num){
case 1:
//
let a = this.teamGroupList.find(i => i.id == row);
console.log("aa",a);
this.form.teamGroupName = a.groupName ;
break;
case 2:
//
let b = this.staffList.find(i => i.id == row);
this.form.name = b.name ;
console.log("bb",b);
break;
}
},
init () {
this.height = this.setPx(document.body.clientHeight - 340);
},
@ -170,45 +263,87 @@ export default {
this.page.currentPage = 1;
this.onLoad(this.page);
},
handleSubmit () {
if (!this.form.id) {
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
handleSubmit (formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (!this.form.id) {
console.log("添加",this.form);
add(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
} else {
console.log("修改",this.form);
update(this.form).then(() => {
this.box = false;
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
})
}
}
})
},
handleAdd () {
this.title = '新增'
this.form = {}
this.box = true
this.box = true;
this.getWarehouseList();
},
async getWarehouseList(){
let userDept = await getListUser();
this.deptId = userDept.data.data.deptId;
let sole = await getUserDetail(userDept.data.data.userId);
if(sole.data.data.roleName == '管理员'){
let deptW = await getDeptWarehouse({tenantId: userDept.data.data.tenantId});
this.warehouseList = deptW.data.data;
}else{
//
let dept = await getDept(this.deptId);
const da = dept.data.data;
if(!!da.parentId && da.parentId != '0'){
//
let deptW = await getDeptWarehouse({department: da.id});
this.warehouseList = deptW.data.data;
}
}
},
handleEdit (row) {
async handleEdit (row) {
await this.getWarehouseList();
this.title = '编辑'
this.box = true
getDetail(row.id).then(res => {
getDetail(row.id).then(async res => {
this.form = res.data.data;
console.log("返回数据。。。",this.form);
//
let sd = await getTeamGroupList(this.page.currentPage,this.page.pageSize,{belongTo: res.data.data.warehouseId});
this.teamGroupList = sd.data.data.records;
//
let user = await getListOwn({deptId:this.deptId});
this.staffList = user.data.data;
});
},
handleView (row) {
async handleView (row) {
await this.getWarehouseList();
this.title = '查看'
this.view = true;
this.box = true;
getDetail(row.id).then(res => {
getDetail(row.id).then(async res => {
this.form = res.data.data;
//
let sd = await getTeamGroupList(this.page.currentPage,this.page.pageSize,{belongTo: res.data.data.warehouseId});
this.teamGroupList = sd.data.data.records;
//
let user = await getListOwn({deptId:this.deptId});
this.staffList = user.data.data;
});
},
handleDelete () {

Loading…
Cancel
Save