rev:部门树修改

This commit is contained in:
2023-09-05 10:50:35 +08:00
parent e65153e68e
commit a4f0e49a3c
11 changed files with 185 additions and 165 deletions

View File

@@ -25,6 +25,7 @@ import org.nl.wms.device_manage.repair.service.dto.DevicerepairmstDto;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
import org.nl.wms.system_manage.service.dept.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -48,6 +49,9 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
// private final StorattrService storattrService;
// private final SparePartOutServiceImpl sparePartOutService;
@Autowired
private ISysDeptService deptService;
@Autowired
private IStIvtBsrealstorattrService storattrService; // 仓库服务
@@ -1097,7 +1101,6 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
@Override
public Map<String, Object> query5(Map whereJson, Pageable page) {
// DeptService deptService = SpringContextHolder.getBean(DeptService.class);
String device_code = MapUtil.getStr(whereJson, "device_code");
String repair_code = MapUtil.getStr(whereJson, "repair_code");
@@ -1128,8 +1131,8 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
// 归属部门
String dept_id = MapUtil.getStr(whereJson, "dept_id");
if (!StrUtil.isEmpty(dept_id)) {
// String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
// map.put("deptIds", deptIds);
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
map.put("deptIds", deptIds);
}
JSONObject json = WQL.getWO("EM_BI_DEVICEREPAIR_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC");
return json;

View File

@@ -21,6 +21,7 @@ import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.device_manage.repair.service.DevicerepairrequestService;
import org.nl.wms.device_manage.repair.service.dto.DevicerepairrequestDto;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
import org.nl.wms.system_manage.service.dept.ISysDeptService;
import org.nl.wms.system_manage.service.user.ISysUserService;
import org.nl.wms.system_manage.service.user.dao.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +47,9 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic
@Autowired
private ISysUserService iSysUserService;
@Autowired
private ISysDeptService deptService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
@@ -78,8 +82,6 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic
@Override
public Map<String, Object> query2(Map whereJson, Pageable page) {
// DeptService deptService = SpringContextHolder.getBean(DeptService.class);
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
String device_code = MapUtil.getStr(whereJson, "device_code");
String request_code = MapUtil.getStr(whereJson, "request_code");
@@ -107,14 +109,14 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic
// 归属部门
String dept_id = MapUtil.getStr(whereJson, "dept_id");
if (!StrUtil.isEmpty(dept_id)) {
// String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
// map.put("deptIds", deptIds);
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
map.put("deptIds", deptIds);
}
// 归属部门
String use_groupid = MapUtil.getStr(whereJson, "use_groupid");
if (!StrUtil.isEmpty(use_groupid)) {
// String use_groupidIds = deptService.getChildIdStr(Long.parseLong(use_groupid));
// map.put("use_groupid", use_groupidIds);
String use_groupidIds = deptService.getChildIdStr(Long.parseLong(use_groupid));
map.put("use_groupid", use_groupidIds);
}
JSONObject json = WQL.getWO("EM_BI_DEVICEREPAIRREQUEST_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.create_time DESC");
return json;
@@ -151,8 +153,6 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic
@Override
@Transactional(rollbackFor = Exception.class)
public void create(DevicerepairrequestDto dto) {
// DeptService deptService = SpringContextHolder.getBean(DeptService.class);
WQLObject fileTab = WQLObject.getWQLObject("EM_BI_EquipmentFile");
WQLObject userTab = WQLObject.getWQLObject("sys_user");

View File

@@ -20,6 +20,8 @@ import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.device_manage.upkeep.service.DevicemaintenancemstService;
import org.nl.wms.device_manage.upkeep.service.dto.DevicemaintenancemstDto;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
import org.nl.wms.system_manage.service.dept.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -40,6 +42,9 @@ import java.util.Map;
public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstService {
private final ClassstandardService classstandardService;
@Autowired
private ISysDeptService deptService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
@@ -552,7 +557,6 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ
@Override
public Map<String, Object> query4(Map whereJson, Pageable page) {
// DeptService deptService = SpringContextHolder.getBean(DeptService.class);
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
String device_code = MapUtil.getStr(whereJson, "device_code");
@@ -582,8 +586,8 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ
// 归属部门
String dept_id = MapUtil.getStr(whereJson, "dept_id");
if (!StrUtil.isEmpty(dept_id)) {
// String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
// map.put("deptIds", deptIds);
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
map.put("deptIds", deptIds);
}
JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCE_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC");
return json;
@@ -591,7 +595,6 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ
@Override
public Map<String, Object> query5(Map whereJson, Pageable page) {
// DeptService deptService = SpringContextHolder.getBean(DeptService.class);
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
String device_code = MapUtil.getStr(whereJson, "device_code");
@@ -623,8 +626,8 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ
// 归属部门
String dept_id = MapUtil.getStr(whereJson, "dept_id");
if (!StrUtil.isEmpty(dept_id)) {
// String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
// map.put("deptIds", deptIds);
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
map.put("deptIds", deptIds);
}
JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCE_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "input_time DESC");
return json;

View File

@@ -20,6 +20,8 @@ import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.device_manage.upkeep.service.DevicemaintenanceplanmstService;
import org.nl.wms.device_manage.upkeep.service.dto.DevicemaintenanceplanmstDto;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
import org.nl.wms.system_manage.service.dept.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -39,7 +41,9 @@ import java.util.Map;
@Slf4j
public class DevicemaintenanceplanmstServiceImpl implements DevicemaintenanceplanmstService {
private final ClassstandardService classstandardService;
// private final DeptService deptService;
@Autowired
private ISysDeptService deptService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
@@ -247,7 +251,6 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla
@Override
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> queryDevice(Map whereJson, Pageable page) {
// DeptService deptService = SpringContextHolder.getBean(DeptService.class);
String device_code = MapUtil.getStr(whereJson, "device_code");
// 查询设备档案
HashMap<String, String> map = new HashMap<>();
@@ -256,14 +259,14 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla
String dept_id = MapUtil.getStr(whereJson, "dept_id");
if (!StrUtil.isEmpty(dept_id)) {
// String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
// map.put("deptIds", deptIds);
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
map.put("deptIds", deptIds);
}
String use_id = MapUtil.getStr(whereJson, "use_id");
if (!StrUtil.isEmpty(use_id)) {
// String useIds = deptService.getChildIdStr(Long.parseLong(use_id));
// map.put("useIds", useIds);
String useIds = deptService.getChildIdStr(Long.parseLong(use_id));
map.put("useIds", useIds);
}
JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCEPLAN_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.update_time DESC");
@@ -272,7 +275,6 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla
@Override
public Map<String, Object> queryDevice2(Map whereJson, Pageable page) {
// DeptService deptService = SpringContextHolder.getBean(DeptService.class);
String device_code = MapUtil.getStr(whereJson, "device_code");
// 查询设备档案
HashMap<String, String> map = new HashMap<>();
@@ -281,14 +283,14 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla
String dept_id = MapUtil.getStr(whereJson, "dept_id");
if (!StrUtil.isEmpty(dept_id)) {
// String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
// map.put("deptIds", deptIds);
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
map.put("deptIds", deptIds);
}
String use_id = MapUtil.getStr(whereJson, "use_id");
if (!StrUtil.isEmpty(use_id)) {
// String useIds = deptService.getChildIdStr(Long.parseLong(use_id));
// map.put("useIds", useIds);
String useIds = deptService.getChildIdStr(Long.parseLong(use_id));
map.put("useIds", useIds);
}
// 如果班组为空 则默认当前用户部门

View File

@@ -15,10 +15,11 @@ import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.masterdata_manage.em.service.EquipmentfileService;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
import org.nl.wms.system_manage.service.dept.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -31,12 +32,15 @@ import java.util.*;
@RequiredArgsConstructor
@Slf4j
public class EquipmentfileServiceImpl implements EquipmentfileService {
private final ClassstandardService classstandardService;
@Autowired
private ISysDeptService deptService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
HashMap<String, String> map = new HashMap<>(whereJson);
// DeptService deptService = SpringContextHolder.getBean(DeptService.class);
map.put("flag", "1");
String device_code = map.get("device_code");
if (StrUtil.isNotEmpty(device_code)) {
@@ -53,8 +57,8 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
}
String use_deptid = map.get("use_deptid");
if (!StrUtil.isEmpty(use_deptid)) {
// String deptIds = deptService.getChildIdStr(Long.parseLong(use_deptid));
// map.put("deptIds", deptIds);
String deptIds = deptService.getChildIdStr(Long.parseLong(use_deptid));
map.put("deptIds", deptIds);
}
String begin_time = map.get("begin_time");
if (StrUtil.isNotEmpty(begin_time)) {
@@ -71,7 +75,6 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
@Override
public JSONArray query(Map whereJson) {
HashMap<String, String> map = new HashMap<>(whereJson);
// DeptService deptService = SpringContextHolder.getBean(DeptService.class);
map.put("flag", "11");
String device_code = map.get("device_code");
if (StrUtil.isNotEmpty(device_code)) {
@@ -88,8 +91,8 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
}
String use_deptid = map.get("use_deptid");
if (!StrUtil.isEmpty(use_deptid)) {
// String deptIds = deptService.getChildIdStr(Long.parseLong(use_deptid));
// map.put("deptIds", deptIds);
String deptIds = deptService.getChildIdStr(Long.parseLong(use_deptid));
map.put("deptIds", deptIds);
}
String begin_time = map.get("begin_time");
if (StrUtil.isNotEmpty(begin_time)) {
@@ -108,8 +111,6 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
// JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
// Long deptId = currentUser.getDeptId();
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 工艺路线主表
WQLObject EM_BI_DeviceLifeCycle = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 工艺路线主表
@@ -149,8 +150,6 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
// JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
// Long deptId = currentUser.getDeptId();
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 工艺路线主表
String device_code = whereJson.getString("device_code");
String devicerecord_id = whereJson.getString("devicerecord_id");

View File

@@ -67,4 +67,20 @@ public interface ISysDeptService extends IService<SysDept> {
void createDept(SysDept dept);
/**
* 获取当前节点的所有子类节点集合数据
*
* @param dept_id
* @return
*/
Set<Long> getChildIdSet(Long dept_id);
/**
* 获取当前节点的所有子类节点集合串,用于拼接SQLin
*
* @param dept_id
* @return
*/
String getChildIdStr(Long dept_id);
}

View File

@@ -1,6 +1,9 @@
package org.nl.wms.system_manage.service.dept.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.db.Db;
import cn.hutool.db.Entity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -10,6 +13,7 @@ import org.nl.common.utils.CopyUtil;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.system_manage.service.dept.ISysDeptService;
import org.nl.wms.system_manage.service.dept.dao.SysDept;
import org.nl.wms.system_manage.service.dept.dao.mapper.SysDeptMapper;
@@ -22,6 +26,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.*;
import java.util.stream.Collectors;
@@ -183,4 +189,44 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
sysDeptMapper.updateSubCount(dept.getPid());
}
}
@Override
public Set<Long> getChildIdSet(Long pid) {
String sql = "select dept_id from (\n" +
" select t1.dept_id,\n" +
" if(find_in_set(pid, @pids) > 0, @pids := concat(@pids, ',', dept_id), 0) as ischild\n" +
" from (\n" +
" select dept_id,pid from sys_dept t where t.is_used = 1\n" +
" ) t1,\n" +
" (select @pids :=" + pid + ") t2\n" +
" ) t3 where ischild != 0";
Set<Long> set = new HashSet<>();
//添加本级
set.add(pid);
//添加子节点
try {
List<Entity> list = Db.use((DataSource) SpringContextHolder.getBean("dataSource")).query(sql);
list.forEach(item -> {
set.add(item.getLong("dept_id"));
});
} catch (SQLException e) {
e.printStackTrace();
}
return set;
}
@Override
public String getChildIdStr(Long dept_id) {
Set<Long> set = this.getChildIdSet(dept_id);
StringBuilder sb = new StringBuilder();
set.forEach(item -> {
sb.append(",'" + item + "'");
});
String str = sb.toString();
if (StrUtil.isNotEmpty(str)) {
str = "(" + str.substring(1) + ")";
}
return str;
}
}

View File

@@ -11,7 +11,7 @@
<label slot="label">设备档案编码:</label>
<el-input v-model.trim="form.devicerecord_code" disabled placeholder="系统生成" style="width: 210px" />
</el-form-item>
<!-- <el-form-item label="设备状态" prop="status">
<el-form-item label="设备状态" prop="status">
<el-select
v-model="form.status"
placeholder="设备状态"
@@ -26,7 +26,7 @@
:value="item.value"
/>
</el-select>
</el-form-item>-->
</el-form-item>
<el-form-item label="设备编码" prop="device_code">
<label slot="label">设备编码:</label>
<el-input v-model.trim="form.device_code" clearable style="width: 210px" />
@@ -78,7 +78,7 @@
@select="typeChange"
/>
</el-form-item>
<!-- <el-form-item label="生产用途" prop="is_produceuse">
<el-form-item label="生产用途" prop="is_produceuse">
<el-select
v-model="form.is_produceuse"
placeholder="生产用途"
@@ -92,26 +92,18 @@
:value="item.value"
/>
</el-select>
</el-form-item>-->
</el-form-item>
<el-form-item label="使用部门" prop="use_deptid">
<treeselect
v-model="form.use_deptid"
:options="depts"
:load-options="loadDepts"
:normalizer="normalizer"
style="width: 210px"
placeholder="使用部门"
/>
</el-form-item>
<el-form-item label="使用班组" prop="use_groupid">
<treeselect
v-model="form.use_groupid"
:options="depts"
:load-options="loadDepts"
style="width: 210px"
placeholder="使用班组"
/>
</el-form-item>
<!-- <el-form-item label="设备属性" prop="device_type">
<el-form-item label="设备属性" prop="device_type">
<el-select
v-model="form.device_type"
placeholder="设备属性"
@@ -125,8 +117,8 @@
:value="item.value"
/>
</el-select>
</el-form-item>-->
<!-- <el-form-item label="设备等级" prop="device_level">
</el-form-item>
<el-form-item label="设备等级" prop="device_level">
<el-select
v-model="form.device_level"
placeholder="设备等级"
@@ -140,7 +132,7 @@
:value="item.value"
/>
</el-select>
</el-form-item>-->
</el-form-item>
<el-form-item label="内部自编号" prop="extend_code">
<label slot="label">内部自编号:</label>
<el-input v-model.trim="form.extend_code" clearable style="width: 210px" />
@@ -163,6 +155,7 @@
:options="depts"
:load-options="loadDepts"
style="width: 210px"
:normalizer="normalizer"
placeholder="选择部门"
/>
</el-form-item>
@@ -260,7 +253,7 @@ import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
import equipmentfile from '@/views/wms/device_manage/deviceFile/equipmentfile/equipmentfile'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
// import { getDepts, getDeptSuperior } from '@/api/system/dept'
import crudDept from '@/views/system/dept/dept'
// import crudDevicebom from '@/api/wms/basedata/em/devicebom'
const defaultForm = {
@@ -313,7 +306,7 @@ export default {
default: false
}
},
// dicts: ['device_type', 'is_produceuse', 'device_status', 'device_level'],
dicts: ['device_type', 'is_produceuse', 'device_status', 'device_level'],
data() {
return {
dialogVisible: false,
@@ -360,6 +353,14 @@ export default {
crudWorkProcedure.downSelect().then(res => {
this.workProcedureList = res
})
const param = {
'materOpt_code': '23'
}
crudMaterialbase.getMaterOptType(param).then(res => {
this.class_idStr = res.class_idStr
this.queryClassId()
})
this.deptTree()
},
methods: {
close() {
@@ -395,23 +396,6 @@ export default {
})
}
},
getSubTypes(id) {
crudClassstandard.getClassSuperior2(id).then(res => {
const date = res.content
this.buildClass(date)
this.classes = date
})
},
buildClass(classes) {
classes.forEach(data => {
if (data.children) {
this.buildClass(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
},
queryClassId() {
const param = {
'class_idStr': this.class_idStr
@@ -440,56 +424,40 @@ export default {
})
}
},
getSupDepts(deptId) {
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
},
// 获取弹窗内部门数据
// 获取部门
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
crudDept.getDeptvo({ is_used: true, pid: parentNode.dept_id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
obj.children = null
return obj
})
setTimeout(() => {
callback()
}, 200)
}, 100)
})
}
},
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
deptTree() {
setTimeout(() => {
crudDept.getDeptTree().then(res => {
this.depts = res.content
})
})
}, 100)
},
normalizer(node) {
return {
id: node.dept_id,
label: node.name,
children: node.children
}
},
typeChange(old) {
debugger
this.form.device_bom_id = ''
/*this.form.device_bom_id = ''
equipmentfile.queryBomList({ material_type_id: old.class_id }).then(res => {
this.bomlist = res
})
})*/
},
[CRUD.HOOK.beforeSubmit]() {
}

View File

@@ -16,6 +16,7 @@
v-model="query.use_deptid"
:options="depts"
:load-options="loadDepts"
:normalizer="normalizer"
clearable
style="width: 200px"
placeholder="选择部门"
@@ -287,6 +288,7 @@ import crudWorkProcedure from '@/api/wms/basedata/pdm/workProcedure'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
// import { getDepts } from '@/api/system/dept'
import crudDept, { getDeptTree } from '@/views/system/dept/dept'
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
import { download } from '@/api/data'
@@ -346,7 +348,7 @@ export default {
this.class_idStr = res.class_idStr
this.queryClassId()
})
// this.getDepts()
this.deptTree()
},
methods: {
canUd(row) {
@@ -394,32 +396,36 @@ export default {
})
}
},
// 获取弹窗内部门数据
// 获取部门
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
crudDept.getDeptvo({ is_used: true, pid: parentNode.dept_id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
obj.children = null
return obj
})
setTimeout(() => {
callback()
}, 200)
}, 100)
})
}
},
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
deptTree() {
setTimeout(() => {
crudDept.getDeptTree().then(res => {
this.depts = res.content
})
})
}, 100)
},
normalizer(node) {
return {
id: node.dept_id,
label: node.name,
children: node.children
}
},
mySelectionChange(rows) {
this.buttonChange(rows)
},

View File

@@ -20,15 +20,6 @@
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="使用班组">
<treeselect
v-model="query.dept_id"
:load-options="loadDepts"
:options="depts"
style="width: 200px;"
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="设备">
<el-input
v-model="query.device_code"

View File

@@ -24,15 +24,7 @@
<treeselect
v-model="query.dept_id"
:load-options="loadDepts"
:options="depts"
style="width: 200px;"
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="使用班组">
<treeselect
v-model="query.use_groupid"
:load-options="loadDepts"
:normalizer="normalizer"
:options="depts"
style="width: 200px;"
placeholder="请选择"
@@ -217,6 +209,7 @@ import DeviceDialog from '@/views/wms/device_manage/repair/devicevprs/DeviceDial
import FaultDialog from '@/views/wms/device_manage/repair/devicevprs/FaultDialog'
// import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { mapGetters } from 'vuex'
import crudDept from '@/views/system/dept/dept'
const defaultForm = { material_type_id: null, product_person_name: null, device_faultclass_name: null, device_code: null, request_id: null, request_code: null, devicerecord_id: null, fault_time: null, device_faultclass_id: null, fault_desc: null, fault_level: null, remark: null, status: null, create_id: null, create_name: null, create_time: null, is_passed: null, process_id: null, process_name: null, process_time: null, finish_id: null, finish_name: null, finish_time: null, is_delete: null, sysdeptid: null, syscompanyid: null }
export default {
@@ -291,7 +284,7 @@ export default {
this.crud.toQuery()
this.queryClassId()
})
this.getDepts()
this.deptTree()
this.query.use_groupid = this.user.dept.id
this.getSupDepts(this.user.dept.id)
this.crud.toQuery()
@@ -397,37 +390,30 @@ export default {
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
crudDept.getDeptvo({ is_used: true, pid: parentNode.dept_id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
obj.children = null
return obj
})
setTimeout(() => {
callback()
}, 200)
}, 100)
})
}
},
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
deptTree() {
setTimeout(() => {
crudDept.getDeptTree().then(res => {
this.depts = res.content
})
})
}, 100)
},
getSupDepts(deptId) {
debugger
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
normalizer(node) {
return {
id: node.dept_id,
label: node.name,
children: node.children
}
},
buildDepts(depts) {
depts.forEach(data => {