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

物料

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