Commit 2e96f4bc authored by renjintao's avatar renjintao

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

parents f8aed324 c4b7b181
......@@ -110,6 +110,7 @@ export default {
code: 0,
status: 0,
codeRuleId: this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
},
disabled: false,
codeList: [],
......
......@@ -108,6 +108,7 @@ export default {
upId: 0,
code: 0,
codeRuleId: this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
},
arr: [],
disabled: false,
......
<template>
<div class="classification">
<div class="classification">
<Layout>
<Sider width="300" v-if="showMenu">
<div class="p-list">
......@@ -10,14 +10,26 @@
<Icon type="ios-arrow-down"></Icon>
</a>
<DropdownMenu slot="list">
<DropdownItem v-for="item in cityList" :key="item.id" :name="item.id">{{ item.name }}</DropdownItem>
<DropdownItem
v-for="item in cityList"
:key="item.id"
:name="item.id"
>{{ item.name }}</DropdownItem>
</DropdownMenu>
</Dropdown>
<div class="fr mr10 mt10">
<ButtonGroup class="fr" size="small">
<Button icon="md-add" title="新增顶级" @click="addNew"></Button>
<Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button>
<Button icon="md-refresh" title="刷新" @click="loadTree(model8)"></Button>
<Button
:icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'"
@click="toggle"
title="展开/合并"
></Button>
<Button
icon="md-refresh"
title="刷新"
@click="loadTree(model8,nodeInfo.codeRuleType)"
></Button>
<Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup>
</div>
......@@ -28,7 +40,13 @@
<div class="fg">
<div class="tree">
<Tree :data="data" ref="tree" @on-select-change="change" :render="renderContent"></Tree>
<Dropdown transfer ref="contentMenu" style="display: none;" trigger="click" placement="right-start">
<Dropdown
transfer
ref="contentMenu"
style="display: none;"
trigger="click"
placement="right-start"
>
<DropdownMenu slot="list" ref="ppp" style="min-width: 80px;">
<DropdownItem @click.native="add">
<a>添加</a>
......@@ -55,9 +73,16 @@
</Content>
</Layout>
<Modal v-model="modal" :title="title" width="1500" footer-hide :mask-closable="false">
<component :is="detail" :eid="curId" :nodeInfo="nodeInfo" @on-close="cancel" @on-ok="ok" ref="chlidren" />
<component
:is="detail"
:eid="curId"
:nodeInfo="nodeInfo"
@on-close="cancel"
@on-ok="ok"
ref="chlidren"
/>
</Modal>
</div>
</div>
</template>
<script>
......@@ -66,7 +91,7 @@ import MasterData from "./masterData.vue";
import Api from "./api";
export default {
components: {
MasterData
MasterData,
},
name: "classification",
data() {
......@@ -74,7 +99,7 @@ export default {
model8: "",
root: {
id: 0,
ids: []
ids: [],
},
downName: "请选择类型",
cityList: [],
......@@ -82,20 +107,18 @@ export default {
expand: false,
list: [],
nodeInfo: {
codeRuleId: ""
codeRuleId: "",
codeRuleType: "",
},
modal: false,
title: "新增",
curId: 0,
detail: null,
showMenu: true,
dataList: []
dataList: [],
};
},
async fetch({
store,
params
}) {
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
......@@ -106,26 +129,27 @@ export default {
clickItem(val) {
this.nodeInfo.codeRuleId = val;
this.model8 = val;
this.loadTree(this.nodeInfo.codeRuleId);
this.cityList.forEach(e => {
this.cityList.forEach((e) => {
if (val == e.id) {
this.downName = e.name;
this.nodeInfo.codeRuleType = e.type;
}
});
this.model8 = val;
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
},
listSlecet() {
let data = {
conditions: [],
sortBy: "id",
isDesc: false
isDesc: false,
};
Api.pagedSlecet(data).then(r => {
Api.pagedSlecet(data).then((r) => {
this.cityList = r.result.items;
this.downName = this.cityList[0].name;
this.model8 = this.cityList[0].id;
this.nodeInfo.codeRuleId = this.cityList[0].id;
this.loadTree(this.nodeInfo.codeRuleId);
this.nodeInfo.codeRuleType = this.cityList[0].type;
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
});
},
......@@ -134,7 +158,7 @@ export default {
this.showMenu = true;
},
ok(row) {
this.loadTree(this.nodeInfo.codeRuleId);
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
this.modal = false;
this.curId = 0;
// if (row) {
......@@ -186,16 +210,19 @@ export default {
title: "删除",
content: "<p>您确定要删除吗?</p>",
onOk: () => {
Api.delete(this.nodeInfo.id).then(r => {
Api.delete(this.nodeInfo.id).then((r) => {
if (r.success) {
this.loadTree(this.nodeInfo.codeRuleId);
this.loadTree(
this.nodeInfo.codeRuleId,
this.nodeInfo.codeRuleType
);
this.$Message.success("删除成功");
}
});
},
onCancel: () => {
this.$Message.success("取消删除");
}
},
});
}
},
......@@ -203,32 +230,29 @@ export default {
this.curId = 0;
this.modal = false;
},
renderContent(h, {
root,
node,
data
}) {
renderContent(h, { root, node, data }) {
return h(
"span", {
"span",
{
on: {
click: () => {
this.handleSelect(data); //手动选择树节点
},
//右键点击事件
contextmenu: e => {
contextmenu: (e) => {
e.preventDefault();
this.$refs.contentMenu.$refs.reference = event.target;
this.$refs.contentMenu.currentVisible = !this.$refs.contentMenu
.currentVisible;
this.nodeInfo = data;
}
}
},
},
},
data.title +
"(" +
(data.totalMaterialCount == undefined ?
"0" :
data.totalMaterialCount) +
(data.totalMaterialCount == undefined
? "0"
: data.totalMaterialCount) +
")"
);
},
......@@ -258,21 +282,28 @@ export default {
// this.$refs.dataTable.dataColumns = tableData;
// }
},
loadTree(id) {
loadTree(id, codeRuleType) {
let data = {
conditions: [{
conditions: [
{
fieldName: "codeRuleId",
fieldValue: id,
conditionalType: "Equal"
}],
conditionalType: "Equal",
},
{
fieldName: "codeRuleType",
fieldValue: codeRuleType,
conditionalType: "Equal",
},
],
sortBy: "code",
isDesc: false
isDesc: false,
};
Api.list(data).then(r => {
Api.list(data).then((r) => {
var data = this.$u.toTree(
r.result,
0,
u => {
(u) => {
u.title = u.code + u.name;
u.value = u.id;
u.expand = true;
......@@ -298,7 +329,7 @@ export default {
addId(b.children);
function addId(data) {
data.map(u => {
data.map((u) => {
ids.push(u.id);
if (u.children) {
addId(u.children);
......@@ -312,7 +343,7 @@ export default {
},
hide() {
this.showMenu = false;
}
},
},
computed: {
data() {
......@@ -322,7 +353,7 @@ export default {
search(this.keys, items);
function search(keys, data) {
data.map(u => {
data.map((u) => {
if (keys.length < u.title) {
u.expand = expand;
result.push(u);
......@@ -337,8 +368,8 @@ export default {
});
}
return result;
}
}
},
},
};
</script>
......
......@@ -52,7 +52,8 @@ export default {
upId: this.nodeInfo.id,
code: 0,
status: 0,
codeRuleId:this.nodeInfo.codeRuleId
codeRuleId:this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
},
upName: this.nodeInfo.title,
disabled: false,
......
......@@ -51,13 +51,14 @@ export default {
entity: {
upId: 0,
code: 0,
codeRuleId:this.nodeInfo.codeRuleId
codeRuleId: this.nodeInfo.codeRuleId,
codeRuleType: this.nodeInfo.codeRuleType,
},
upName: this.nodeInfo.title,
disabled: false,
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
name: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: ["nodeInfo"],
......@@ -69,25 +70,25 @@ export default {
},
methods: {
get() {
Api.get({ id: this.nodeInfo.id }).then(r => {
Api.get({ id: this.nodeInfo.id }).then((r) => {
if (r.result) {
this.entity = r.result;
}
});
},
handleSubmit() {
this.$refs.form.validate(v => {
this.$refs.form.validate((v) => {
if (v) {
Api.update({ categoryDto: this.entity, pro: [] })
.then(r => {
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok",this.entity);
this.$emit("on-ok", this.entity);
} else {
this.$Message.error(r.error.message);
}
})
.catch(err => {
.catch((err) => {
this.disabled = false;
this.$Message.error(r.error.message);
});
......@@ -96,7 +97,7 @@ export default {
},
handleClose() {
this.$emit("on-close");
}
}
},
},
};
</script>
......@@ -91,14 +91,15 @@ export default {
codeRuleId: this.nodeInfo.codeRuleId,
categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId //左侧树点击的数据的最顶层id
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
codeRuleType: this.nodeInfo.codeRuleType,
},
disabled: false,
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
name: [{ required: true, message: "必填", trigger: "blur" }],
},
fileds: [] //扩展属性
fileds: [], //扩展属性
};
},
async fetch({ store, params }) {
......@@ -113,17 +114,17 @@ export default {
{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId
}
fieldValue: this.nodeInfo.rootCategoryId,
},
];
Api.listTable({
conditions: conditions,
sortBy: "id",
isDesc: false
}).then(r => {
isDesc: false,
}).then((r) => {
if (r.result) {
this.fileds = r.result.filter(function(item) {
this.fileds = r.result.filter(function (item) {
item.span = 12;
if (item.dataType > 4) {
item.span = 24;
......@@ -131,7 +132,7 @@ export default {
delete item["id"];
return item.fieldType != 1;
});
this.fileds.map(u => {
this.fileds.map((u) => {
let v = "";
if (u.dataType == 1 || u.dataType == 2) {
v = 0;
......@@ -158,12 +159,12 @@ export default {
},
handleSubmit() {
this.$refs.form.validate(v => {
this.$refs.form.validate((v) => {
if (v) {
// let categoryDto = this.entity;
// let pro = this.checkList.concat(this.arr);
Api.create(this.entity)
.then(r => {
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
......@@ -171,7 +172,7 @@ export default {
this.$Message.error(r.error.message);
}
})
.catch(err => {
.catch((err) => {
this.disabled = false;
this.$Message.error(r.error.message);
});
......@@ -180,7 +181,7 @@ export default {
},
handleClose() {
this.$emit("on-close");
}
}
},
},
};
</script>
......@@ -89,14 +89,15 @@ export default {
categoryId: this.nodeInfo.categoryId, //左侧树点击的id
customProperties: {},
rootCategoryId: this.nodeInfo.rootCategoryId, //左侧树点击的数据的最顶层id
version: null
version: null,
codeRuleType: this.nodeInfo.codeRuleType,
},
fileds: [],
checkList: [],
disabled: false,
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
name: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
async fetch({ store, params }) {
......@@ -114,16 +115,16 @@ export default {
{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: this.nodeInfo.rootCategoryId
}
fieldValue: this.nodeInfo.rootCategoryId,
},
];
Api.listTable({
conditions: conditions,
sortBy: "id",
isDesc: false
}).then(r => {
isDesc: false,
}).then((r) => {
if (r.result) {
this.fileds = r.result.filter(function(item) {
this.fileds = r.result.filter(function (item) {
item.span = 12;
if (item.dataType > 4) {
item.span = 24;
......@@ -131,7 +132,7 @@ export default {
delete item["id"];
return item.fieldType != 1;
});
this.fileds.map(u => {
this.fileds.map((u) => {
let v = "";
if (u.dataType == 1 || u.dataType == 2) {
v = 0;
......@@ -143,7 +144,7 @@ export default {
});
},
get() {
Api.get({ id: this.eid }).then(r => {
Api.get({ id: this.eid }).then((r) => {
if (r.result) {
this.entity = r.result;
this.entity.version = parseInt(r.result.version);
......@@ -155,23 +156,23 @@ export default {
{
conditionalType: "In",
fieldName: "fieldType",
fieldValue: "1,2"
fieldValue: "1,2",
},
{
conditionalType: "Equal",
fieldName: "categoryId",
fieldValue: "0"
}
fieldValue: "0",
},
];
Api.listTable({
conditions: conditions,
sortBy: "id",
isDesc: false
}).then(r => {
isDesc: false,
}).then((r) => {
if (r.result) {
var arr = r.result;
this.checkList = arr.filter(function(item) {
this.checkList = arr.filter(function (item) {
item.mid = item.id;
delete item["id"]; //删除属性id
return item;
......@@ -195,12 +196,12 @@ export default {
},
handleSubmit() {
this.$refs.form.validate(v => {
this.$refs.form.validate((v) => {
if (v) {
// let categoryDto = this.entity;
// let pro = this.checkList.concat(this.arr);
Api.update(this.entity)
.then(r => {
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
......@@ -208,7 +209,7 @@ export default {
this.$Message.error(r.error.message);
}
})
.catch(err => {
.catch((err) => {
this.disabled = false;
this.$Message.error(r.error.message);
});
......@@ -217,7 +218,7 @@ export default {
},
handleClose() {
this.$emit("on-close");
}
}
},
},
};
</script>
<template>
<div class="classification">
<div class="classification">
<Layout>
<Sider width="300" v-if="showMenu">
<div class="p-list">
......@@ -10,13 +10,25 @@
<Icon type="ios-arrow-down"></Icon>
</a>
<DropdownMenu slot="list">
<DropdownItem v-for="item in cityList" :key="item.id" :name="item.id">{{ item.name }}</DropdownItem>
<DropdownItem
v-for="item in cityList"
:key="item.id"
:name="item.id"
>{{ item.name }}</DropdownItem>
</DropdownMenu>
</Dropdown>
<div class="fr mr10 mt10">
<ButtonGroup class="fr ddi" size="small">
<Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button>
<Button icon="md-refresh" title="刷新" @click="loadTree(model8)"></Button>
<Button
:icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'"
@click="toggle"
title="展开/合并"
></Button>
<Button
icon="md-refresh"
title="刷新"
@click="loadTree(model8,nodeInfo.codeRuleType)"
></Button>
<Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup>
</div>
......@@ -40,7 +52,7 @@
<MasterData ref="dataTable" :nodeInfo="nodeInfo" @on-ok="ok" />
</Content>
</Layout>
</div>
</div>
</template>
<script>
......@@ -67,6 +79,7 @@ export default {
ids: [],
addChange: true,
codeRuleId: 0,
codeRuleType: "",
},
downName: "请选择类型",
modal: false,
......@@ -75,15 +88,12 @@ export default {
detail: null,
showMenu: true,
dataList: [],
codeRuleId: "",
rootCategoryId: null,
categoryId: null,
};
},
async fetch({
store,
params
}) {
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
......@@ -92,15 +102,15 @@ export default {
},
methods: {
clickItem(val) {
this.codeRuleId = val;
this.nodeInfo.codeRuleId = val;
this.model8 = val;
this.loadTree(this.codeRuleId);
this.cityList.forEach((e) => {
if (val == e.id) {
this.downName = e.name;
this.nodeInfo.codeRuleType = e.type;
}
});
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
},
listSlecet() {
let data = {
......@@ -113,7 +123,8 @@ export default {
this.downName = this.cityList[0].name;
this.model8 = this.cityList[0].id;
this.nodeInfo.codeRuleId = this.cityList[0].id;
this.loadTree(this.nodeInfo.codeRuleId);
this.nodeInfo.codeRuleType = this.cityList[0].type;
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
});
},
......@@ -122,7 +133,7 @@ export default {
this.showMenu = true;
},
ok(row) {
this.loadTree(this.codeRuleId);
this.loadTree(this.nodeInfo.codeRuleId, this.nodeInfo.codeRuleType);
// this.modal = false;
// this.curId = 0;
// if (row) {
......@@ -137,13 +148,10 @@ export default {
this.curId = 0;
this.modal = false;
},
renderContent(h, {
root,
node,
data
}) {
renderContent(h, { root, node, data }) {
return h(
"span", {
"span",
{
on: {
click: () => {
this.handleSelect(root, data); //手动选择树节点
......@@ -152,9 +160,9 @@ export default {
},
data.title +
"(" +
(data.totalMaterialCount == undefined ?
"0" :
data.totalMaterialCount) +
(data.totalMaterialCount == undefined
? "0"
: data.totalMaterialCount) +
")"
);
},
......@@ -186,16 +194,23 @@ export default {
this.nodeInfo.rootCategoryName = data.name;
} else {
this.nodeInfo.rootCategoryId = pid;
this.nodeInfo.rootCategoryName = pname
this.nodeInfo.rootCategoryName = pname;
}
},
loadTree(id) {
loadTree(id, codeRuleType) {
let data = {
conditions: [{
conditions: [
{
fieldName: "codeRuleId",
fieldValue: id,
conditionalType: "Equal"
}, ],
conditionalType: "Equal",
},
{
fieldName: "codeRuleType",
fieldValue: codeRuleType,
conditionalType: "Equal",
},
],
sortBy: "code",
isDesc: false,
};
......
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