Commit 4865541a authored by 仇晓婷's avatar 仇晓婷

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

parents 9dcf529c 0b9ab7d5
......@@ -12,7 +12,9 @@
/>
</slot>
</div>&nbsp;
<Button v-if="high" @click="modalSearch=true" type="text"><Icon type="md-search" />高级</Button>
<Button v-if="high" @click="modalSearch=true" type="text">
<Icon type="md-search" />高级
</Button>
<div class="searchBack">
<slot name="searchBack"></slot>
</div>
......@@ -39,6 +41,7 @@
:data="list"
:height="tableHeight"
:draggable="draggable"
:size="size"
ref="table"
class="tableCommon"
@on-expand="expand"
......@@ -113,10 +116,10 @@
<script>
export default {
name: 'DataGrid',
name: "DataGrid",
data() {
return {
keys: '',
keys: "",
selectItems: [],
footerToolbar: false,
modalSearch: false,
......@@ -135,7 +138,7 @@ export default {
userConfig: null, //用户页面配置信息。,
// userId: 1
userId: this.$store.state.userInfo.userId
}
};
},
props: {
border: {
......@@ -155,7 +158,11 @@ export default {
},
placeholder: {
type: String,
default: '请输入关键字'
default: "请输入关键字"
},
size: {
type: String,
default: "default "
},
height: {
type: Number,
......@@ -195,7 +202,7 @@ export default {
// 当作table使用,直接显示数据
type: Array,
default: function() {
return []
return [];
}
},
columns: {
......@@ -206,23 +213,23 @@ export default {
action: {
//接口地址
type: String,
default: ''
default: ""
},
conditions: {
//查询条件
type: Object,
default: function() {
return {
keys: { op: 'name', value: '', default: true }
}
keys: { op: "name", value: "", default: true }
};
}
},
type: {
type: String,
default: 'table',
default: "table",
validator: function(value) {
// 这个值必须匹配下列字符串中的一个
return ['table', 'card', 'list'].indexOf(value) !== -1
return ["table", "card", "list"].indexOf(value) !== -1;
}
},
span: {
......@@ -231,71 +238,71 @@ export default {
}
},
created() {
this.columns.forEach((u) => {
this.columns.forEach(u => {
if (!u.hide) {
u.hide = false
u.hide = false;
}
})
this.columnsCur = this.$u.clone(this.columns)
});
this.columnsCur = this.$u.clone(this.columns);
},
mounted() {
if (this.data&&this.data.length>0) {
this.list = this.data
return
if (this.data && this.data.length > 0) {
this.list = this.data;
return;
}
this.keys = ''
this.intY()
if (this.lazy==true) {
this.keys = "";
this.intY();
if (this.lazy == true) {
return;
}
this.loadUserConfig()
this.loadUserConfig();
if (this.height === 0) {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight
this.tableHeight = window.screenHeight - this.firstY - 60
})()
}
window.screenHeight = window.innerHeight;
this.tableHeight = window.screenHeight - this.firstY - 60;
})();
};
} else {
this.tableHeight = this.height
this.tableHeight = this.height;
}
//注册拖拽事件。
this.$dragging.$on('dragend', (e) => {
this.$dragging.$on("dragend", e => {
// console.log("dragend",e);
this.saveUserconfig()
})
this.saveUserconfig();
});
},
methods: {
//数据加载
load() {
if (this.height == 0) {
this.tableHeight = window.innerHeight - this.firstY - 60
this.tableHeight = window.innerHeight - this.firstY - 60;
}
if (this.action) {
this.$api.post(this.action, this.search).then((r) => {
this.list = r.result.items
this.search.total = r.result.totalCount
})
this.$api.post(this.action, this.search).then(r => {
this.list = r.result.items;
this.search.total = r.result.totalCount;
});
}
},
columnInit() {
if (this.userConfig) {
var curColumns = []
var config = JSON.parse(this.userConfig.content)
var curColumns = [];
var config = JSON.parse(this.userConfig.content);
// console.warn("2:列比对",config)
if (config.length == this.columnsCur.length) {
config.map((u) => {
var item = this.columnsCur.filter((c) => {
return c.key == u.key
})
config.map(u => {
var item = this.columnsCur.filter(c => {
return c.key == u.key;
});
if (item[0]) {
item[0].hide = u.hide
curColumns.push(item[0])
item[0].hide = u.hide;
curColumns.push(item[0]);
}
})
});
// console.warn("3:初始化列")
this.columnsCur = curColumns
this.columnsCur = curColumns;
}
}
},
......@@ -303,210 +310,209 @@ export default {
var query = {
conditions: [
{
fieldName: 'creatorUserId',
fieldName: "creatorUserId",
fieldValue: this.userId,
conditionalType: 'Equal'
conditionalType: "Equal"
},
{
fieldName: 'component',
fieldValue: 'Grid',
conditionalType: 'Equal'
fieldName: "component",
fieldValue: "Grid",
conditionalType: "Equal"
},
{
fieldName: 'page',
fieldName: "page",
fieldValue: window.location.pathname,
conditionalType: 'Equal'
conditionalType: "Equal"
}
],
pageSize: 1
}
this.$api.post(`${window.systemUrl}/config/list`, query).then((r) => {
};
this.$api.post(`${window.systemUrl}/config/list`, query).then(r => {
if (r.success) {
if (r.result.length == 1) {
this.userConfig = r.result[0]
this.userConfig = r.result[0];
// console.warn("1:加载用户配置")
this.columnInit()
this.columnInit();
}
if (!this.configLoad) {
this.easySearch()
this.easySearch();
}
this.configLoad = true
this.configLoad = true;
}
})
});
},
saveUserconfig() {
let url = `${window.systemUrl}/config/update`
var content = []
this.columnsCur.map((u) => {
let url = `${window.systemUrl}/config/update`;
var content = [];
this.columnsCur.map(u => {
content.push({
key: u.key,
hide: u.hide
})
})
});
});
if (!this.userConfig) {
url = `${window.systemUrl}/config/create`
url = `${window.systemUrl}/config/create`;
var data = {
page: window.location.pathname,
component: 'Grid',
component: "Grid",
key: this.$u.guid(),
content: JSON.stringify(content)
}
this.$api.post(url, data).then((r) => {
this.loadUserConfig()
})
};
this.$api.post(url, data).then(r => {
this.loadUserConfig();
});
} else {
this.userConfig.content = JSON.stringify(content)
this.$api.post(url, this.userConfig)
this.userConfig.content = JSON.stringify(content);
this.$api.post(url, this.userConfig);
}
},
//展开
expand(row, status) {
this.$emit('on-expand', row, status)
this.$emit("on-expand", row, status);
},
//拖拽
onDragDrop(a, b) {
this.$emit('on-drag-drop', a, b)
this.$emit("on-drag-drop", a, b);
},
easySearch() {
if (this.conditions && this.conditions.keys.default) {
//判断没有传入条件的用默认的查询
this.conditions.keys.value = this.keys
this.conditions.keys.value = this.keys;
}
this.reload(this.conditions)
this.reload(this.conditions);
},
undoConfig() {
//列设置恢复初始化
this.columnsCur = this.$u.clone(this.columns)
this.saveUserconfig()
this.columnsCur = this.$u.clone(this.columns);
this.saveUserconfig();
},
complexSearch() {
var search = this.$refs.search.$children.filter((u) => {
return u.condition
})
var search = this.$refs.search.$children.filter(u => {
return u.condition;
});
if (search) {
var conditions = search[0].condition
this.reload(conditions)
var conditions = search[0].condition;
this.reload(conditions);
}
},
reload(conditions) {
var where = []
var where = [];
if (conditions) {
Object.keys(conditions).forEach((u) => {
let v = conditions[u].value
let op = conditions[u].op
Object.keys(conditions).forEach(u => {
let v = conditions[u].value;
let op = conditions[u].op;
if (!this.$u.isNull(v)) {
if (op == 'Range') {
let times = []
v.map((u) => {
if (op == "Range") {
let times = [];
v.map(u => {
if (!this.$u.isNull(u)) {
times.push(this.$u.toTime(u))
times.push(this.$u.toTime(u));
}
})
v = times.join(',')
} else if (op.indexOf('In') > -1) {
v = v.join(',')
});
v = times.join(",");
} else if (op.indexOf("In") > -1) {
v = v.join(",");
}
if (!this.$u.isNull(v)) {
where.push({
fieldName: u,
fieldValue: v,
conditionalType: op
})
});
}
}
})
});
}
this.search.pageIndex = 1
this.search.conditions = where
this.load()
this.search.pageIndex = 1;
this.search.conditions = where;
this.load();
},
pageChange(page) {
this.search.page = page
this.search.pageIndex = page
this.load()
this.search.page = page;
this.search.pageIndex = page;
this.load();
},
pageSizeChange(size) {
this.search.pageSize = size
this.search.pageIndex = 1
this.load()
this.search.pageSize = size;
this.search.pageIndex = 1;
this.load();
},
columnChange(item, i) {
item.hide = !item.hide
this.$set(this.columnsCur, item, i)
this.saveUserconfig()
item.hide = !item.hide;
this.$set(this.columnsCur, item, i);
this.saveUserconfig();
},
selectionChange(items) {
this.$emit('on-selection-change', items)
this.selectItems = items
this.footerToolbar = items.length > 0
this.$emit("on-selection-change", items);
this.selectItems = items;
this.footerToolbar = items.length > 0;
},
onSelect(rows, row) {
this.$emit('on-selection-change', rows, row)
this.$emit("on-selection-change", rows, row);
},
intY() {
if (this.$refs.table != undefined) {
this.firstY = this.$refs.table.$el.getBoundingClientRect().top
this.firstY = this.$refs.table.$el.getBoundingClientRect().top;
}
},
selectAll(status) {
this.$refs.table.selectAll(status)
},
this.$refs.table.selectAll(status);
}
},
computed: {
columnsNow() {
var cols = this.columnsCur.filter((u) => {
var cols = this.columnsCur.filter(u => {
if (u.code) {
u.render = (h, params) => {
let values = u.key
let type = 'text'
let values = u.key;
let type = "text";
if (u.category) {
type = u.category
type = u.category;
}
return h('state', {
return h("state", {
props: {
code: u.code,
type: type,
value: params.row[values] + ''
}
})
value: params.row[values] + ""
}
});
};
}
if (u.type == 'user') {
if (u.type == "user") {
u.render = (h, params) => {
let values = u.key
return h('User', {
let values = u.key;
return h("User", {
props: {
value: params.row[values]
}
})
});
};
}
}
if (u.type == 'date' || u.type == 'dateTime') {
if (u.type == "date" || u.type == "dateTime") {
u.render = (h, params) => {
let values = u.key
return h('DTSpan', {
let values = u.key;
return h("DTSpan", {
props: {
type: u.type,
value: params.row[values]
}
})
}
});
};
}
return !u.hide
})
return cols
return !u.hide;
});
return cols;
}
},
watch:{
"data.length"(){
this.list=this.data;
watch: {
"data.length"() {
this.list = this.data;
},
"height"()
{
this.tableHeight=this.height;
height() {
this.tableHeight = this.height;
}
}
}
};
</script>
<style lang="less" scoped>
......@@ -515,7 +521,6 @@ export default {
// height: 100%;
.tableCommon {
width: 100%;
}
.tip {
display: inline;
......@@ -602,4 +607,5 @@ export default {
color: #249e91;
}
}
</style>
\ No newline at end of file
<template>
<div style="padding: 0;">
<div style="padding: 0;" class="excute">
<DataGrid
style="margin-top: -25px; margin-bottom: -25px;"
:columns="columns"
......@@ -11,16 +11,12 @@
:data="data1"
:page="false"
:height="gridHeight"
:size="size"
></DataGrid>
<Modal v-model="editModal" title="编辑" footer-hide width="800">
<Edit :row="rowData" @on-close="cancel" @on-option-ok="addOk" />
</Modal>
<Modal
v-model="insertlModal"
:title="insertTItle"
@on-ok="insertOk"
@on-cancel="cancel"
>
<Modal v-model="insertlModal" :title="insertTItle" @on-ok="insertOk" @on-cancel="cancel">
<p>确定进行 {{ insertTItle }} 操作?</p>
</Modal>
<Modal v-model="setParsModal" title="工序参数设置" footer-hide width="1000">
......@@ -43,10 +39,10 @@ export default {
name: "list",
components: {
Edit,
Add,
Add
},
props: {
rowId: { type: Number },
rowId: { type: Number }
},
data() {
return {
......@@ -54,8 +50,8 @@ export default {
easySearch: {
keys: {
op: "task_seq",
value: null,
},
value: null
}
},
setParsModal: false,
editModal: false,
......@@ -64,6 +60,7 @@ export default {
rowIndex: null,
curId: 0,
gridHeight: 50,
size: "small",
columns: [
{ key: "id", title: this.l("id"), hide: true, align: "left" },
{ title: " ", width: 130 },
......@@ -80,9 +77,9 @@ export default {
props: {
content:
params.row.important_flag == 1 ? "取消插单" : "进行插单",
placement: "top",
placement: "top"
},
class: "ico",
class: "ico"
},
[
h("Icon", {
......@@ -92,43 +89,43 @@ export default {
? "ios-flag"
: "ios-flag-outline",
size: 20,
color: params.row.important_flag == 1 ? "#2680EB" : "#aaa",
color: params.row.important_flag == 1 ? "#2680EB" : "#aaa"
},
on: {
click: () => this.changeFlag(params.row.id, params.index),
},
}),
click: () => this.changeFlag(params.row.id, params.index)
}
})
]
);
},
}
},
{
key: "task_seq",
title: this.l("task_seq"),
align: "left",
easy: true,
high: true,
high: true
},
{
key: "op_task_pk",
title: this.l("op_task_pk"),
align: "left",
high: true,
hide: true,
hide: true
},
{
key: "task_name",
title: this.l("task_name"),
align: "left",
easy: true,
high: true,
high: true
},
{
key: "part_task_pk",
title: this.l("part_task_pk"),
align: "left",
high: true,
hide: true,
hide: true
},
{
......@@ -136,7 +133,7 @@ export default {
title: this.l("put_into_qty"),
align: "left",
high: true,
hide: true,
hide: true
},
{
key: "plan_start",
......@@ -144,7 +141,7 @@ export default {
align: "center",
high: true,
width: 140,
hide: true,
hide: true
},
{
key: "plan_finish",
......@@ -152,52 +149,52 @@ export default {
align: "center",
high: true,
width: 140,
hide: true,
hide: true
},
{
key: "first_equip",
title: this.l("first_equip"),
align: "left",
easy: true,
high: true,
high: true
},
{
key: "setup_time",
title: this.l("setup_time"),
align: "right",
high: true,
high: true
},
{
key: "run_time",
title: this.l("run_time"),
align: "right",
high: true,
high: true
},
{
key: "outside_time",
title: this.l("outside_time"),
align: "right",
high: true,
high: true
},
{
key: "transport_time",
title: this.l("transport_time"),
align: "right",
high: true,
hide: true,
hide: true
},
{
key: "check_time",
title: this.l("check_time"),
align: "right",
high: true,
hide: true,
hide: true
},
{
key: "efficiency_value",
title: this.l("efficiency_value"),
align: "right",
high: true,
high: true
},
{
key: "machine_rule",
......@@ -205,14 +202,14 @@ export default {
align: "center",
easy: true,
high: true,
width: 140,
width: 140
},
{
key: "singleout",
title: this.l("singleout"),
align: "left",
high: true,
hide: true,
hide: true
},
{
key: "equip_type",
......@@ -220,7 +217,7 @@ export default {
align: "left",
easy: true,
high: true,
hide: true,
hide: true
},
{
key: "first_equip",
......@@ -228,48 +225,48 @@ export default {
align: "left",
easy: true,
high: true,
hide: true,
hide: true
},
{
key: "cal_id",
title: this.l("cal_id"),
align: "left",
easy: true,
high: true,
high: true
},
{
key: "plan_method",
title: this.l("plan_method"),
align: "left",
easy: true,
high: true,
high: true
},
{
key: "over_time",
title: this.l("over_time"),
align: "left",
easy: true,
high: true,
high: true
},
{
key: "isdiscrete",
title: this.l("isdiscrete"),
align: "center",
easy: true,
high: true,
high: true
},
{
key: "discrete_value",
title: this.l("discrete_value"),
align: "right",
high: true,
high: true
},
{
key: "multi_machine",
title: this.l("multi_machine"),
align: "center",
easy: true,
high: true,
high: true
},
{
key: "notes",
......@@ -277,7 +274,7 @@ export default {
align: "left",
easy: true,
high: true,
hide: true,
hide: true
},
{
......@@ -286,7 +283,7 @@ export default {
align: "left",
easy: true,
high: true,
hide: true,
hide: true
},
{
key: "workshopcode",
......@@ -294,21 +291,21 @@ export default {
align: "left",
easy: true,
high: true,
hide: true,
hide: true
},
{
key: "routing_detail_id",
title: this.l("routing_detail_id"),
align: "left",
high: true,
hide: true,
hide: true
},
{
key: "routing_header_id",
title: this.l("routing_header_id"),
align: "left",
high: true,
hide: true,
hide: true
},
{
key: "comb_param",
......@@ -316,14 +313,14 @@ export default {
align: "left",
easy: true,
high: true,
hide: true,
hide: true
},
{
key: "rule_qty",
title: this.l("rule_qty"),
align: "left",
high: true,
hide: true,
hide: true
},
{
title: "操作",
......@@ -337,32 +334,32 @@ export default {
icon: "md-options",
type: "icon",
oprate: "detail",
title: "工序参数设置",
title: "工序参数设置"
},
on: { click: () => this.openParms(params.row) },
on: { click: () => this.openParms(params.row) }
}),
h("op", {
attrs: {
icon: "ios-create",
icon: "md-create",
type: "icon",
title: "編輯工序",
oprate: "edit",
oprate: "edit"
},
on: { click: () => this.edit(params.row) },
on: { click: () => this.edit(params.row) }
}),
h("op", {
attrs: {
icon: "ios-trash",
type: "icon",
title: "删除工序",
oprate: "delete",
msg: "确认要刪除工序吗?",
oprate: "edit",
msg: "确认要刪除工序吗?"
},
on: { click: () => this.remove(params.row, params.index) },
}),
on: { click: () => this.remove(params.row, params.index) }
})
]);
},
},
}
}
],
data1: [],
insertTItle: "插单",
......@@ -372,10 +369,10 @@ export default {
opTaskPk: 0, //工单ID
partTaskPk: 0, //生产计划ID
taskSeq: "", //工序编号
count: 0,//生产计划数量
count: 0 //生产计划数量
},
//设置参数结束
rowData:{},//编辑时传入行数据
rowData: {} //编辑时传入行数据
};
},
mounted() {
......@@ -388,12 +385,12 @@ export default {
//根据点击副组件传过来id进行加载数据
loadData(expendId) {
let params = {
id: expendId,
id: expendId
};
Api.getbyorderid(params).then((res) => {
Api.getbyorderid(params).then(res => {
if (res.success) {
this.gridHeight = 50;
this.gridHeight = (res.result.length + 1) * 51;
this.gridHeight = (res.result.length + 1) * 42;
this.data1 = res.result;
}
});
......@@ -430,7 +427,7 @@ export default {
opTaskPk: row.op_task_pk,
partTaskPk: row.part_task_pk,
taskSeq: row.task_seq,
count: row.put_into_qty,
count: row.put_into_qty
};
this.setParsModal = true;
},
......@@ -450,9 +447,9 @@ export default {
this.selectRoutingDetail = row;
let params = {
partPk: this.selectRoutingDetail.part_task_pk,
detailIdstr: this.selectRoutingDetail.routing_detail_id,
detailIdstr: this.selectRoutingDetail.routing_detail_id
};
Api.removeoptasksimluate(params).then((r) => {
Api.removeoptasksimluate(params).then(r => {
if (r.success) {
this.$Message.success("删除成功");
this.data1.splice(this.rowIndex, 1);
......@@ -477,8 +474,12 @@ export default {
l(key) {
let vkey = "mes_op_task_plan_simulate" + "." + key;
return this.$t(vkey) || key;
},
},
}
}
};
</script>
<style lang="less"></style>
<style lang="less">
.excute table tr th span,.excute table tr td {
font-size: 10px;
}
</style>
......@@ -234,7 +234,8 @@ export default {
attrs: {
icon: "md-options",
type: "icon",
title: "工序参数设置"
title: "工序参数设置",
oprate: "edit",
},
on: { click: () => this.openAddModel(2, params.row) }
}),
......@@ -243,7 +244,7 @@ export default {
icon: "md-return-left",
type: "icon",
title: "移出排产池",
oprate: "delete",
oprate: "edit",
msg: "确认要移出排产吗?"
},
on: { click: () => this.remove(params.row.part_task_pk) }
......@@ -253,7 +254,7 @@ export default {
icon: "md-refresh",
type: "icon",
title: "恢复工序",
oprate: "delete",
oprate: "edit",
msg: "确认要恢复工序吗?"
},
on: { click: () => this.refresh(params.row.part_task_pk) }
......
......@@ -71,7 +71,7 @@ export default {
easySearch: {
keys: {
op:
"mesCode,remark,taskRequire,productCode,productName,drawnNumber,batchNumber,projectNumber",
"mesCode,productCode,productName,drawnNumber,batchNumber,projectNumber",
value: null
}
},
......@@ -235,15 +235,102 @@ export default {
]);
}
}
]
],
treeData: [],
treeInputSearch: "",
ocolumn: [],
treeHeight: "",
tableHeight: "",
ids: [],
orderSearchForm: {
productId: "", //产品id
productName: "", //产品名称
taskType: "", //任务类型
stage: "", //阶段
materialId: "", //材料
quantity: null, //数量
guestName: "", //甲方客户
printSupply: "", //3D打印承制单位
functionaryOffice: "", //厂内责任机关
mainDepartmentId: "", //厂内责任主体部门ID
taskRequire: "", //任务接点要求
putintDocmentCode: "", //甲方投产输入文件编号
technologyDocmentCode: "", //甲方技术输入文件编号
outerDrawnNumber: "", //外部图号/模型号
modelVersion: "", //模型版本
taskCode: "", //甲方任务号
designer: "", //甲方设计人员
officeFunctionary: "", //厂内机关负责人
mainRoutingPeople: "", //厂内主工艺人员
routing_Method: "", //工艺方法
outer_Envelope_Size: "", //包装尺寸
demandStartDate: "", //开始时间
demandFinishDate: "", //完成时间
remark: "", //备注
projectNumber: "", //项目号
batchNumber: "", //批次号
urgencyLevel: null //紧急程度
},
list: [],
data1: [],
selectdata: [],
//以下为手写死数据集:
orderCatList: [], //订单类型下拉
outerCodeList: [], //型号外部代码下拉
missionCodeList: [], //任务号下拉
stageList: [], //阶段下拉
materailList: [], //材料下拉
routingAccessList: [], //工艺方法下拉
drawNumberList: [], //图号下拉
docNameList: [], //文档名称下拉
ownerGustList: [], //甲方客户下拉
mainDeptList: [], //厂内主体部门下拉
taskTypeList: [], //任务类型
statusList: [] //状态类型
};
},
created() {
this.treeHeight = window.innerHeight - 150;
},
mounted() {
console.log(this);
this.initTree();
this.tableHeight = window.innerHeight - 220;
this.$refs.CustomTable.getTableHeight(this.tableHeight);
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 150;
this.tableHeight = window.screenHeight - 220;
this.$refs.CustomTable.getTableHeight(this.tableHeight);
})();
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
computed: {
searchList() {
let nodeList = this.treeData;
var text = this.treeInputSearch;
var newNodeList = [];
function searchTree(nodeLists, value) {
for (let i = 0; i < nodeLists.length; i++) {
if (nodeLists[i].title.indexOf(value) != -1) {
newNodeList.push(nodeLists[i]);
} else if (nodeLists[i].children.length > 0) {
searchTree(nodeLists[i].children, value);
}
}
}
if (text != "") {
searchTree(nodeList, text);
} else {
return nodeList;
}
return newNodeList;
}
},
methods: {
addOk() {
this.$refs.grid.load();
......@@ -290,7 +377,83 @@ export default {
l(key) {
let vkey = "mes_plan" + "." + key;
return this.$t(vkey) || key;
},
//new start
initTree() {
var sumData = [];
this.$http.order.getallselecttree().then(res => {
alert(JSON.stringify(res))
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.treeData = sumData;
this.data1 = JSON.parse(JSON.stringify(sumData));
} else {
this.$Message.error("加载产品树失败!");
}
});
},
selectTreeNode(value) {
if (value.length > 0) {
this.ids = [];
this.getAllIds(value);
if (this.ids.length > 0) {
this.orderSearchForm.productId = this.ids.join(",");
} else {
this.orderSearchForm.productId = "-1";
this.orderSearchForm.productName = "";
}
this.$refs.CustomTable.easySearch(this.orderSearchForm);
}
},
//得到此树节点下所有是产品的productId
getAllIds(trees) {
trees.forEach((data, index) => {
var that = this;
if (data.isProduct) {
this.ids.push(data.productId);
}
if (data.children.length > 0) {
this.getAllIds(data.children);
}
});
},
handleSelect(data) {
if (data.length > 0) {
this.selectdata = [];
this.selectdata = data;
this.list = [];
this.list.push({ label: data[0].title, value: data[0].id });
//this.formValidate.classType=data[0].id;
if (data[0].isProduct == "1") {
this.orderSearchForm.productName = data[0].id;
this.orderSearchForm.productId = data[0].productId;
} else {
this.$Message.error("此节点不是产品,请选择产品节点!");
}
}
},
renderContent(h, { root, node, data }) {
//渲染树的样式
return h(
"span",
{
style: {
color: data.isProduct != "1" ? "#249E91" : "#333", //根据选中状态设置样式
cursor: "pointer"
},
on: {
click: () => {
let arrTree = [];
arrTree.push(data);
this.handleSelect(arrTree); //手动选择树节点
}
}
},
data.title
);
},
}
};
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment