Commit b20ca33c authored by 仇晓婷's avatar 仇晓婷

物料

parent 2a93b79c
......@@ -97,13 +97,15 @@
<script>
import Api from "./api";
export default {
props: ["nodeInfo"],
data() {
return {
arr: [],
entity: {
upId: 0,
code: 0,
status:0,
status: 0,
codeRuleId: this.nodeInfo.codeRuleId
},
disabled: false,
columns: [
......
......@@ -99,7 +99,8 @@ export default {
return {
entity: {
upId: 0,
code: 0
code: 0,
codeRuleId: this.nodeInfo.codeRuleId
},
arr: [],
disabled: false,
......
......@@ -4,14 +4,19 @@
<Sider width="300" v-if="showMenu">
<div class="p-list">
<h3>
<Select
v-model="model8"
clearable
style="width:130px;float:left;margin-top:8px"
@on-change="chnangeClick"
>
<Option v-for="item in cityList" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select>
<Dropdown @on-click="clickItem">
<a href="javascript:void(0)">
{{downName}}
<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>
</DropdownMenu>
</Dropdown>
<div class="fr mr10 mt10">
<ButtonGroup class="fr" size="small">
<Button icon="md-add" title="新增顶级" @click="addNew"></Button>
......@@ -86,15 +91,19 @@ export default {
name: "classification",
data() {
return {
model8: "",
root: {
id: 0,
ids: []
},
downName: "请选择类型",
cityList: [],
keys: "",
expand: false,
list: [],
nodeInfo: {},
nodeInfo: {
codeRuleId: ""
},
modal: false,
title: "新增",
curId: 0,
......@@ -107,10 +116,19 @@ export default {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.loadTree();
// this.loadTree();
this.listSlecet();
},
methods: {
clickItem(val) {
this.nodeInfo.codeRuleId = val;
this.loadTree(this.nodeInfo.codeRuleId);
this.cityList.forEach(e => {
if (val == e.id) {
this.downName = e.name;
}
});
},
listSlecet() {
let data = {
conditions: []
......@@ -119,15 +137,13 @@ export default {
this.cityList = r.result.items;
});
},
chnangeClick(val) {
this.loadTree(val);
},
showMenuFn() {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
ok(row) {
this.loadTree();
this.loadTree(this.nodeInfo.codeRuleId);
this.modal = false;
this.curId = 0;
// if (row) {
......@@ -139,11 +155,15 @@ export default {
// }
},
addNew() {
if (this.model8) {
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
this.$refs.chlidren.arr = [];
} else {
this.$Message.error("请先选择类型");
}
},
add() {
this.curId = 0;
......@@ -177,7 +197,7 @@ export default {
onOk: () => {
Api.delete(this.nodeInfo.id).then(r => {
if (r.success) {
this.loadTree();
this.loadTree(this.nodeInfo.codeRuleId);
this.$Message.success("删除成功");
}
});
......@@ -245,7 +265,9 @@ export default {
// }
},
loadTree(id) {
let conditions = [];
let conditions = [
{ fieldName: "codeRuleId", fieldValue: id, conditionalType: "Equal" }
];
Api.list({ conditions: conditions }).then(r => {
var data = this.$u.toTree(
r.result,
......@@ -261,11 +283,15 @@ export default {
});
},
toggle() {
if (this.model8) {
this.expand = !this.expand;
} else {
this.$Message.error("请先选择类型");
}
},
change(v, b) {
// console.log(v);
// console.log(b);
// alert(JSON.stringify(b));
let ids = [];
ids.push(b.id);
if (b.children) {
......@@ -281,6 +307,7 @@ export default {
}
this.root.ids = ids;
this.root.id = b.id;
// this.root.codeRuleId=b.codeRuleId
},
hide() {
this.showMenu = false;
......
<template>
<div class="master-data">
<!-- <Table border :columns="columns" :data="dataColumns" :height="tableHeight"></Table> -->
<DataGrid :columns="columns" ref="grid" :action="action" :high="false" :height="750">
<DataGrid
:columns="columns"
ref="grid"
:conditions="easySearch"
:action="action"
:high="false"
:height="tableHeight"
>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input
placeholder="请输入编码/名称"
v-width="200"
v-model="easySearch.keys.value"
clearable
/>
<Input placeholder="请输入编码/名称" v-width="200" v-model="easySearch.keys.value" clearable />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<!-- <template slot="searchForm">
<Search />
</template>-->
<!-- <template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>-->
</DataGrid>
</div>
</template>
......@@ -39,7 +34,7 @@ export default {
dataColumns: [],
easySearch: {
keys: { op: "code,name", value: null },
id: { op: "In", value: this.root.ids }
id: { op: "In", value: "" }
},
columns: [
// {
......@@ -63,15 +58,6 @@ export default {
title: "状态",
align: "left",
code: "materail.category.status"
// render: (h, params) => {
// return h("state", {
// props: {
// code: "materail.category.status",
// type: "text",
// value: params.row.status + ""
// }
// });
// }
},
{
......@@ -79,7 +65,6 @@ export default {
title: "描述",
align: "left"
},
{
title: "操作",
key: "action",
......@@ -113,19 +98,21 @@ export default {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.tableHeight = window.innerHeight - 150;
this.tableHeight = window.innerHeight - 220;
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.tableHeight = window.innerHeight - 150;
this.tableHeight = window.innerHeight - 220;
})();
};
},
methods: {
search() {
alert(JSON.stringify(this.easySearch));
console.log(this.easySearch);
this.$refs.grid.reload(this.easySearch);
},
edit(row) {
......@@ -154,9 +141,11 @@ export default {
watch: {
root: {
handler(newName, oldName) {
this.easySearch.id.value = newName.ids;
if (newName.id) {
this.easySearch.id.value = newName.ids;
this.$refs.grid.reload(this.easySearch);
} else {
this.easySearch.id.value = "-1";
}
},
immediate: true,
......
......@@ -51,7 +51,8 @@ export default {
entity: {
upId: this.nodeInfo.id,
code: 0,
status: 0
status: 0,
codeRuleId:this.nodeInfo.codeRuleId
},
upName: this.nodeInfo.title,
disabled: false,
......
......@@ -50,7 +50,8 @@ export default {
return {
entity: {
upId: 0,
code: 0
code: 0,
codeRuleId:this.nodeInfo.codeRuleId
},
upName: this.nodeInfo.title,
disabled: false,
......
......@@ -4,10 +4,23 @@
<Sider width="300" v-if="showMenu">
<div class="p-list">
<h3>
<Select v-model="model8" clearable style="width:130px;float:left;margin-top:8px" @on-change='chnangeClick'>
<!-- <Select v-model="model8" clearable style="width:130px;float:left;margin-top:8px" @on-change='chnangeClick' placeholder="请选择类型">
<Option v-for="item in cityList" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select>
</Select>
</Select> -->
<Dropdown @on-click="clickItem">
<a href="javascript:void(0)">
{{downName}}
<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>
</DropdownMenu>
</Dropdown>
<div class="fr mr10 mt10">
<ButtonGroup class="fr ddi" size="small">
<!-- <Button icon="md-add" title="新增顶级" @click="addNew"></Button> -->
......@@ -53,6 +66,7 @@ export default {
name: "masterData",
data() {
return {
model8:'',
type: "",
keys: "",
cityList:[],
......@@ -63,22 +77,33 @@ export default {
rootCategoryId: 0,
ids: []
},
downName: "请选择类型",
modal: false,
title: "新增",
curId: 0,
detail: null,
showMenu: true,
dataList: []
dataList: [],
codeRuleId:'',
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
this.loadTree();
// this.loadTree();
this.listSlecet();
},
methods: {
clickItem(val) {
this.codeRuleId = val;
this.loadTree(this.codeRuleId);
this.cityList.forEach(e => {
if (val == e.id) {
this.downName = e.name;
}
});
},
listSlecet() {
let data = {
conditions: []
......@@ -87,15 +112,16 @@ export default {
this.cityList = r.result.items;
});
},
chnangeClick(val){
this.loadTree(val);
},
// chnangeClick(val){
// this.codeRuleId = val;
// this.loadTree(this.codeRuleId);
// },
showMenuFn() {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
ok(row) {
this.loadTree();
this.loadTree(this.codeRuleId);
// this.modal = false;
// this.curId = 0;
// if (row) {
......@@ -169,7 +195,12 @@ export default {
});
},
toggle() {
if (this.model8) {
this.expand = !this.expand;
} else {
this.$Message.error("请先选择类型");
}
},
change(v, b) {
let ids = [];
......
......@@ -3,10 +3,11 @@
<DataGrid
:columns="columns"
ref="grid"
:conditions="easySearch"
:action="action"
:initsearch="sets"
:high="false"
:height="750"
:height="tableHeight"
>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
......@@ -54,7 +55,7 @@ export default {
data() {
return {
action: Api.index,
tableHeight: "",
modal: false,
title: "新增",
curId: 0,
......@@ -145,6 +146,14 @@ export default {
on: { click: () => this.remove(params.row.id) }
},
"删除"
),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.send(params.row) }
},
"送审"
)
]);
}
......@@ -156,8 +165,16 @@ export default {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
// this.$refs.grid.reload(this.easySearch);
this.tableHeight = window.innerHeight - 220;
},
mounted() {
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.tableHeight = window.innerHeight - 220;
})();
};
},
methods: {
search() {
......@@ -203,7 +220,6 @@ export default {
// });
},
details(id) {
this.$router.push({
path: "/materiel/masterData/details",
query: {
......@@ -219,14 +235,17 @@ export default {
cancel() {
this.curId = 0;
this.modal = false;
}
},
send(row) {}
},
watch: {
nodeInfo: {
handler(newName, oldName) {
this.easySearch.categoryId.value = newName.ids;
if (newName.categoryId) {
this.easySearch.categoryId.value = newName.ids;
this.$refs.grid.reload(this.easySearch);
} else {
this.easySearch.categoryId.value = "-1";
}
},
immediate: true,
......
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