基础分类修改
This commit is contained in:
@@ -7,13 +7,12 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -122,4 +121,12 @@ public class ClassstandardController {
|
||||
return new ResponseEntity<>(ClassstandardService.getType(type_id,level), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getClassName")
|
||||
@Log("获取分类名称下拉框")
|
||||
@ApiOperation("获取分类名称下拉框")
|
||||
public ResponseEntity<Object> getClassName() {
|
||||
return new ResponseEntity<>(ClassstandardService.getClassName(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -124,4 +124,9 @@ public interface ClassstandardService {
|
||||
*/
|
||||
String getAllChildIdStr(String class_idStr);
|
||||
|
||||
/**
|
||||
* 获取分类名称下拉框
|
||||
* @return
|
||||
*/
|
||||
JSONArray getClassName();
|
||||
}
|
||||
|
||||
@@ -3,12 +3,9 @@ package org.nl.wms.basedata.master.service.dto;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
@@ -22,8 +19,6 @@ public class ClassstandardDto implements Serializable {
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long class_id;
|
||||
|
||||
private String base_data_type;
|
||||
|
||||
private String path_code;
|
||||
|
||||
private String class_code;
|
||||
@@ -56,9 +51,9 @@ public class ClassstandardDto implements Serializable {
|
||||
|
||||
private String create_time;
|
||||
|
||||
private String update_id;
|
||||
private String update_optid;
|
||||
|
||||
private String update_name;
|
||||
private String update_optname;
|
||||
|
||||
private String update_time;
|
||||
}
|
||||
|
||||
@@ -11,11 +11,10 @@ import cn.hutool.db.Entity;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -23,10 +22,6 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
|
||||
|
||||
|
||||
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -49,10 +44,10 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
String base_data_type = (String) whereJson.get("base_data_type");
|
||||
String class_code = (String) whereJson.get("class_code");
|
||||
String where = "";
|
||||
if (!StrUtil.isEmpty(base_data_type)) {
|
||||
where = "AND base_data_type = '" + base_data_type + "'";
|
||||
if (!StrUtil.isEmpty(class_code)) {
|
||||
where = "AND class_code = '" + class_code + "'";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "(parent_class_id is null OR parent_class_id = '0') AND is_delete = '0'" + where + "", "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
@@ -105,30 +100,26 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
public void create(ClassstandardDto dto) {
|
||||
String class_code = dto.getClass_code();
|
||||
ClassstandardDto classstandardDto = this.findByCode(class_code);
|
||||
if (classstandardDto != null && classstandardDto.getIs_delete().equals("0") && dto.getBase_data_type().equals(classstandardDto.getBase_data_type())) {
|
||||
if (classstandardDto != null && classstandardDto.getIs_delete().equals("0") ) {
|
||||
throw new BadRequestException("存在相同的基础类别编号");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setClass_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_name(nickName);
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setIs_leaf("1");
|
||||
dto.setClass_level(Math.ceil(dto.getClass_code().length() / 2.0) + "");
|
||||
dto.setSub_count(new BigDecimal(0));
|
||||
dto.setPath_code(dto.getClass_code());
|
||||
dto.setLong_class_code(dto.getClass_code());
|
||||
|
||||
if (StrUtil.equals(dto.getBase_data_type(), "03")) {
|
||||
dto.setIs_modify("0");
|
||||
}
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
@@ -149,7 +140,7 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
|
||||
String class_code = dto.getClass_code();
|
||||
ClassstandardDto classstandardDto = this.findByCode(class_code);
|
||||
if (classstandardDto != null && !dto.getClass_id().equals(classstandardDto.getClass_id()) && classstandardDto.getIs_delete().equals("0") && dto.getBase_data_type().equals(classstandardDto.getBase_data_type())) {
|
||||
if (classstandardDto != null && !dto.getClass_id().equals(classstandardDto.getClass_id()) && classstandardDto.getIs_delete().equals("0") ) {
|
||||
throw new BadRequestException("存在相同的供应商编号");
|
||||
}
|
||||
|
||||
@@ -163,10 +154,10 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_name(nickName);
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
@@ -182,7 +173,7 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
public void deleteAll(Long[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
for (Long class_id : ids) {
|
||||
@@ -192,7 +183,7 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", DateUtil.now());
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
|
||||
JSONArray child_rows = wo.query("parent_class_id = '" + String.valueOf(class_id) + "'").getResultJSONArray(0);
|
||||
@@ -245,15 +236,10 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
|
||||
@Override
|
||||
public JSONArray getSuperior(JSONObject jo, JSONArray ja) {
|
||||
String base_data_type=jo.getString("base_data_type");
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
if (StrUtil.isEmpty(jo.getString("parent_class_id")) || jo.getString("parent_class_id").equals("0")) {
|
||||
JSONArray null_pids = new JSONArray();
|
||||
if (jo.getString("base_data_type").equals(base_data_type)) {
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0' and base_data_type = '"+base_data_type+"'").getResultJSONArray(0);
|
||||
} else {
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0'").getResultJSONArray(0);
|
||||
}
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
for (int m = 0; m < null_pids.size(); m++) {
|
||||
JSONObject null_pid = null_pids.getJSONObject(m);
|
||||
@@ -541,6 +527,21 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getClassName() {
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
// 获取的是父节点
|
||||
JSONArray result = wo.query("(parent_class_id is null OR parent_class_id = '0') AND is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray res = new JSONArray();
|
||||
for (int i=0; i<result.size(); i++) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("label", result.getJSONObject(i).get("class_name"));
|
||||
jsonObject.put("value", result.getJSONObject(i).get("class_code"));
|
||||
res.add(jsonObject);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public void updateSubCnt(Long Id) {
|
||||
if (Id != null && Id != 0) {
|
||||
|
||||
Binary file not shown.
@@ -72,4 +72,11 @@ export function getClassTable(params) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getClass, getClassSuperior, getClassType, getClassTable, getType, queryClassById }
|
||||
export function getClassName() {
|
||||
return request({
|
||||
url: 'api/Classstandard/getClassName',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getClass, getClassSuperior, getClassType, getClassTable, getType, queryClassById, getClassName }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {download, initData} from '@/api/data'
|
||||
import {downloadFile, parseTime} from '@/utils/index'
|
||||
import { download, initData } from '@/api/data'
|
||||
import { downloadFile, parseTime } from '@/utils/index'
|
||||
import Vue from 'vue'
|
||||
|
||||
/**
|
||||
@@ -70,6 +70,7 @@ function CRUD(options) {
|
||||
status: {
|
||||
add: CRUD.STATUS.NORMAL,
|
||||
edit: CRUD.STATUS.NORMAL,
|
||||
view: CRUD.STATUS.NORMAL,
|
||||
// 添加或编辑状态
|
||||
get cu() {
|
||||
if (this.add === CRUD.STATUS.NORMAL && this.edit === CRUD.STATUS.NORMAL) {
|
||||
@@ -83,7 +84,7 @@ function CRUD(options) {
|
||||
},
|
||||
// 标题
|
||||
get title() {
|
||||
return this.add > CRUD.STATUS.NORMAL ? `新增${crud.title}` : this.edit > CRUD.STATUS.NORMAL ? `编辑${crud.title}` : crud.title
|
||||
return this.add > CRUD.STATUS.NORMAL ? `新增${crud.title}` : this.edit > CRUD.STATUS.NORMAL ? `编辑${crud.title}` : this.view > CRUD.STATUS.NORMAL ? `${crud.title}详情` : crud.title
|
||||
}
|
||||
},
|
||||
msg: {
|
||||
@@ -163,14 +164,40 @@ function CRUD(options) {
|
||||
* 格式化数据,保留0位小数
|
||||
*/
|
||||
formatNum0(row, column) {
|
||||
if (!row[column.property]) {
|
||||
return 0
|
||||
}
|
||||
return parseFloat(row[column.property]).toFixed(0)
|
||||
},
|
||||
/**
|
||||
* 格式化数据,保留2位小数
|
||||
*/
|
||||
formatNum2(row, column) {
|
||||
if (!row[column.property]) {
|
||||
return 0
|
||||
}
|
||||
return parseFloat(row[column.property]).toFixed(2)
|
||||
},
|
||||
|
||||
/**
|
||||
* 格式化数据,保留3位小数
|
||||
*/
|
||||
formatNum3(row, column) {
|
||||
if (!row[column.property]) {
|
||||
return 0
|
||||
}
|
||||
return parseFloat(row[column.property]).toFixed(3)
|
||||
},
|
||||
|
||||
/**
|
||||
* 质检格式化数据,保留4位小数
|
||||
*/
|
||||
formatQlNum4(row, column) {
|
||||
if (!row[column.property]) {
|
||||
return ''
|
||||
}
|
||||
return parseFloat(row[column.property]).toFixed(4)
|
||||
},
|
||||
/**
|
||||
* 启动添加
|
||||
*/
|
||||
@@ -184,11 +211,13 @@ function CRUD(options) {
|
||||
callVmHook(crud, CRUD.HOOK.afterToCU, crud.form)
|
||||
},
|
||||
/**
|
||||
* 启动复制新增
|
||||
* @param {*} data 数据项
|
||||
* 启动添加 可携带参数
|
||||
*/
|
||||
toCopy(data) {
|
||||
toAddAndData(data) {
|
||||
crud.resetForm(JSON.parse(JSON.stringify(data)))
|
||||
if (!(callVmHook(crud, CRUD.HOOK.beforeToAdd, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) {
|
||||
return
|
||||
}
|
||||
crud.status.add = CRUD.STATUS.PREPARED
|
||||
callVmHook(crud, CRUD.HOOK.afterToAdd, crud.form)
|
||||
callVmHook(crud, CRUD.HOOK.afterToCU, crud.form)
|
||||
@@ -207,6 +236,17 @@ function CRUD(options) {
|
||||
callVmHook(crud, CRUD.HOOK.afterToEdit, crud.form)
|
||||
callVmHook(crud, CRUD.HOOK.afterToCU, crud.form)
|
||||
},
|
||||
/**
|
||||
* 查询详情
|
||||
* @param {*} data 数据项
|
||||
*/
|
||||
toView(data) {
|
||||
crud.params.optRow = data
|
||||
crud.resetForm(JSON.parse(JSON.stringify(data)))
|
||||
crud.status.view = CRUD.STATUS.PREPARED
|
||||
crud.getDataStatus(crud.getDataId(data)).view = CRUD.STATUS.PREPARED
|
||||
callVmHook(crud, CRUD.HOOK.afterToView, crud.form)
|
||||
},
|
||||
/**
|
||||
* 启动删除
|
||||
* @param {*} data 数据项
|
||||
@@ -225,21 +265,14 @@ function CRUD(options) {
|
||||
crud.getDataStatus(crud.getDataId(data)).delete = CRUD.STATUS.NORMAL
|
||||
callVmHook(crud, CRUD.HOOK.afterDeleteCancel, data)
|
||||
},
|
||||
/**
|
||||
* 查询详情
|
||||
* @param {*} data 数据项
|
||||
*/
|
||||
toView(data) {
|
||||
crud.params.optRow = data
|
||||
crud.resetForm(JSON.parse(JSON.stringify(data)))
|
||||
crud.status.view = CRUD.STATUS.PREPARED
|
||||
crud.getDataStatus(crud.getDataId(data)).view = CRUD.STATUS.PREPARED
|
||||
callVmHook(crud, CRUD.HOOK.afterToView, crud.form)
|
||||
},
|
||||
/**
|
||||
* 取消新增/编辑
|
||||
*/
|
||||
cancelCU() {
|
||||
cancelCU(formName) {
|
||||
if (formName instanceof PointerEvent) {
|
||||
formName = 'form'
|
||||
}
|
||||
|
||||
const addStatus = crud.status.add
|
||||
const editStatus = crud.status.edit
|
||||
const viewStatus = crud.status.view
|
||||
@@ -267,18 +300,21 @@ function CRUD(options) {
|
||||
callVmHook(crud, CRUD.HOOK.afterEditCancel, crud.form)
|
||||
}
|
||||
// 清除表单验证
|
||||
if (crud.findVM('form').$refs['form']) {
|
||||
crud.findVM('form').$refs['form'].clearValidate()
|
||||
if (crud.findVM('form').$refs[formName]) {
|
||||
crud.findVM('form').$refs[formName].clearValidate()
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 提交新增/编辑
|
||||
*/
|
||||
submitCU() {
|
||||
submitCU(formName) {
|
||||
if (formName instanceof PointerEvent) {
|
||||
formName = 'form'
|
||||
}
|
||||
if (!callVmHook(crud, CRUD.HOOK.beforeValidateCU)) {
|
||||
return
|
||||
}
|
||||
crud.findVM('form').$refs['form'].validate(valid => {
|
||||
crud.findVM('form').$refs[formName].validate(valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
@@ -319,7 +355,6 @@ function CRUD(options) {
|
||||
return
|
||||
}
|
||||
crud.status.edit = CRUD.STATUS.PROCESSING
|
||||
debugger
|
||||
crud.crudMethod.edit(crud.form).then(() => {
|
||||
crud.status.edit = CRUD.STATUS.NORMAL
|
||||
crud.getDataStatus(crud.getDataId(crud.form)).edit = CRUD.STATUS.NORMAL
|
||||
@@ -397,7 +432,7 @@ function CRUD(options) {
|
||||
/**
|
||||
* 获取查询参数
|
||||
*/
|
||||
getQueryParams: function () {
|
||||
getQueryParams: function() {
|
||||
// 清除参数无值的情况
|
||||
Object.keys(crud.query).length !== 0 && Object.keys(crud.query).forEach(item => {
|
||||
if (crud.query[item] === null || crud.query[item] === '') crud.query[item] = undefined
|
||||
@@ -465,8 +500,10 @@ function CRUD(options) {
|
||||
}
|
||||
}
|
||||
// add by ghl 2020-10-04 页面重复添加信息时,下拉框的校验会存在,需要找工取消
|
||||
if (crud.findVM('form').$refs['form']) {
|
||||
crud.findVM('form').$refs['form'].clearValidate()
|
||||
let form_ref = 'form'
|
||||
if (crudFrom.form_ref) form_ref = crudFrom.form_ref
|
||||
if (crud.findVM('form').$refs[form_ref]) {
|
||||
crud.findVM('form').$refs[form_ref].clearValidate()
|
||||
}
|
||||
},
|
||||
/**
|
||||
@@ -892,7 +929,8 @@ CRUD.HOOK = {
|
||||
/** 提交 - 之后 */
|
||||
afterSubmit: 'afterCrudSubmitCU',
|
||||
afterAddError: 'afterCrudAddError',
|
||||
afterEditError: 'afterCrudEditError'
|
||||
afterEditError: 'afterCrudEditError',
|
||||
afterToView: 'afterToView'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,33 +2,49 @@
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<span style="line-height:36px;text-align: center">基础分类:</span>
|
||||
</el-col>
|
||||
<el-col :span="15">
|
||||
<el-select
|
||||
v-model="query.base_data_type"
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.base_data"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<rrOperation />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="分类名称">
|
||||
<el-select
|
||||
v-model="query.class_code"
|
||||
placeholder="请选择分类名称"
|
||||
clearable
|
||||
filterable
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
style="width: 185px;"
|
||||
@change="hand">
|
||||
<el-option
|
||||
v-for="item in classNames"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation :crud="crud" />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="success"
|
||||
icon="el-icon-s-operation"
|
||||
@click="ToExpandall"
|
||||
>
|
||||
全部展开
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
@@ -44,21 +60,6 @@
|
||||
<el-form-item label="分类名称" prop="class_name">
|
||||
<el-input v-model="form.class_name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="基础分类" prop="base_data_type">
|
||||
<el-select
|
||||
v-model="form.base_data_type"
|
||||
placeholder=""
|
||||
@change="dataTypeChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.base_data"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<span style="color: #C0C0C0;margin-left: 10px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="简要描述" prop="class_desc">
|
||||
<el-input v-model="form.class_desc" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
@@ -105,17 +106,20 @@
|
||||
<el-table-column
|
||||
v-permission="['admin','Classstandard:edit','Classstandard:del']"
|
||||
label="操作"
|
||||
width="150px"
|
||||
width="250px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
style="display: inline"
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
:disabled-edit="scope.row.is_modify === '0'"
|
||||
:disabled-dle="scope.row.is_modify === '0'"
|
||||
msg="确定删除吗,如果存在下级节点则一并删除,此操作不能撤销!"
|
||||
/>
|
||||
<el-button slot="right" size="mini" type="text" icon="el-icon-circle-plus-outline" @click="crud.toAddAndData(addSibling(scope.row))">新增同级</el-button>
|
||||
<el-button slot="right" size="mini" type="text" icon="el-icon-circle-plus" @click="crud.toAddAndData(addChildren(scope.row))">新增子级</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -135,7 +139,7 @@ import udOperation from '@crud/UD.operation'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = {
|
||||
let defaultForm = {
|
||||
class_id: null,
|
||||
base_data_type: null,
|
||||
path_code: null,
|
||||
@@ -180,14 +184,12 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
classes: [],
|
||||
classNames: [],
|
||||
permission: {},
|
||||
rules: {
|
||||
class_id: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
base_data_type: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
path_code: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
@@ -218,7 +220,15 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getClassNames() // 获取分类
|
||||
},
|
||||
methods: {
|
||||
getClassNames() {
|
||||
crudClassstandard.getClassName().then((res) => { // 获取分类名称,查询根据分类编码查找对应分支树
|
||||
this.classNames = res
|
||||
})
|
||||
},
|
||||
getClassDatas(tree, treeNode, resolve) {
|
||||
const params = { pid: tree.id }
|
||||
setTimeout(() => {
|
||||
@@ -318,6 +328,72 @@ export default {
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
},
|
||||
clearFrom() {
|
||||
defaultForm = {
|
||||
id: null,
|
||||
class_id: null,
|
||||
base_data_type: null,
|
||||
path_code: null,
|
||||
class_code: null,
|
||||
long_class_code: null,
|
||||
class_name: null,
|
||||
class_desc: null,
|
||||
parent_class_id: null,
|
||||
is_leaf: null,
|
||||
sub_count: null,
|
||||
is_modify: null,
|
||||
is_delete: null,
|
||||
class_level: null,
|
||||
ext_id: null,
|
||||
ext_parent_id: null,
|
||||
create_id: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optid: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
isTop: null
|
||||
}
|
||||
},
|
||||
addSibling(row) {
|
||||
this.clearFrom() // 将默认的表单数据清除
|
||||
defaultForm.id = row.id // 获取分类树的id - 懒加载依赖此id,不可为空
|
||||
defaultForm.class_id = row.class_id
|
||||
defaultForm.parent_class_id = row.parent_class_id // 同级为父类class_id
|
||||
defaultForm.isTop = row.isTop
|
||||
return defaultForm
|
||||
},
|
||||
addChildren(row) {
|
||||
this.clearFrom()
|
||||
defaultForm.id = row.id // 获取分类树的id
|
||||
defaultForm.class_id = row.parent_class_id
|
||||
defaultForm.parent_class_id = row.id // 子级为本身的class_id
|
||||
defaultForm.isTop = row.isTop
|
||||
return defaultForm
|
||||
},
|
||||
// 全部展开 参考:https://www.cnblogs.com/toughy/p/12667805.html
|
||||
ToExpandall() {
|
||||
const els = document.getElementsByClassName('el-table__expand-icon')
|
||||
if (this.crud.data.length !== 0 && els.length !== 0) {
|
||||
for (let j1 = 0; j1 < els.length; j1++) {
|
||||
els[j1].classList.add('dafult')
|
||||
}
|
||||
if (this.$el.getElementsByClassName('el-table__expand-icon--expanded')) {
|
||||
const open = this.$el.getElementsByClassName('el-table__expand-icon--expanded')
|
||||
for (let j = 0; j < open.length; j++) {
|
||||
open[j].classList.remove('dafult')
|
||||
}
|
||||
const dafult = this.$el.getElementsByClassName('dafult')
|
||||
for (let a = 0; a < dafult.length; a++) {
|
||||
debugger
|
||||
dafult[a].click()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user