Commit 8ba6f75a authored by 仇晓婷's avatar 仇晓婷

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

parents aa489b06 7936cb0b
...@@ -66,6 +66,7 @@ export default { ...@@ -66,6 +66,7 @@ export default {
this.$http.storeHouse this.$http.storeHouse
.getpaged({ materialType: this.type }) .getpaged({ materialType: this.type })
.then((res) => { .then((res) => {
console.log(res.result)
if (res.result) { if (res.result) {
let items = res.result let items = res.result
this.tree = this.getTrees(items) this.tree = this.getTrees(items)
......
<template>
<div class="flex fd tree-menu">
<h3>
产品结构
<div class="fr mr10 mt10">
<ButtonGroup class="fr" size="small">
<Button
:icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'"
@click="toggle"
title="展开/合并"
></Button>
<Button icon="md-refresh" title="刷新" @click="loadTree"></Button>
<Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup>
</div>
</h3>
<div class="search">
<Input search placeholder="关键字" v-model="keys" clearable />
</div>
<div class="fg">
<div class="tree">
<Tree :data="tree" ref="tree" @on-select-change="change" :render="renderContent"></Tree>
</div>
</div>
</div>
</template>
<script>
export default {
name: "",
data() {
return {
expand: false,
ids: [],
tree: [],
divHeight:'',
keys: "",
// list: []
};
},
created() {
this.loadTree();
},
methods: {
toggle() {
this.expand = !this.expand;
this.loadTree()
},
async loadTree() {
this.$http.storeHouse
.getpaged({ materialType: this.type })
.then((res) => {
console.log(res.result)
if (res.result) {
let items = res.result;
// let item = this.$u.clone(res.result);
console.log('items:',items)
this.tree = this.getTrees(items)
this.change1(this.tree)
search(this.keys, items);
function search(keys, items) {
items.map(u => {
if (keys.length < 3) {
u.expand = expand;
result.push(u);
} else {
u.expand = expand;
if (u.title.indexOf(keys) > -1) {
result.push(u);
} else if (u.children) {
search(keys, u.children);
}
}
});
}
} else {
this.$Message.error('加载库房库位树失败!')
}
})
},
//重构左侧树
getTrees(trees) {
var expand = this.expand
trees.forEach((data, index) => {
var that = this
data.expand = expand
if (data.children.length > 0) {
this.getTrees(data.children)
}
})
return trees
},
renderContent(h, { root, node, data }) {
return h(
'span',
{
style: {
color: data.isClick ? '#000' : '#bbb', //根据选中状态设置样式
cursor: data.isClick ? 'pointer' : '',
background: node.node.selected&&data.isClick ? '#AAD8D4' : '#ffffff',
paddingLeft: '10px',
paddingRight: '10px',
paddingTop: '3px',
paddingBottom: '3px'
},
on: {
// click: () => {
// if (!node.node.selected) {
// this.$refs.tree.handleSelect(node.nodeKey) //手动选择树节点
// }
// }
}
},
data.title
)
},
//得到此树节点下所有是产品的Id
getAllIds(trees) {
trees.forEach((data, index) => {
var that = this
if (data.isClick) {
this.ids.push(data.id)
}
if (data.children.length > 0) {
this.getAllIds(data.children)
}
})
},
change(value) {
if (value.length > 0) {
if (value[0].isClick) {
this.ids = []
this.getAllIds(value)
if (this.ids.length > 0) {
this.$emit('storeIds', this.ids)
//this.easySearch.storeId.value = this.ids
} else {
this.$emit('storeIds', [-1])
}
} else {
this.$Message.error('当前操作用户无此库位的权限')
this.$emit('storeIds', [-1])
}
}
},
change1(value) {
if (value.length > 0) {
this.ids = []
this.getAllIds(value)
if (this.ids.length > 0) {
this.$emit('storeIds', this.ids)
} else {
this.$emit('storeIds', [-1])
}
}
},
// loadTree() {
// this.$http.storeHouse.getpaged({ materialType: this.type })
// .then(r => {
// console.log(r.result)
// var data = r.result;
// this.list = this.$u.clone(data);
// })
// },
// change(v, b) {
// let ids = [];
// ids.push(b.value);
// if (b.children) {
// addId(b.children);
// function addId(data) {
// data.map(u => {
// ids.push(u.value);
// if (u.children) {
// addId(u.children);
// }
// });
// }
// }
// this.$emit("on-select", b.value, b, ids);
// },
hide() {
this.$emit("on-hide");
}
},
computed: {
data() {
let items = this.$u.clone(this.list);
let expand = this.expand;
let result = [];
search(this.keys, items);
function search(keys, data) {
data.map(u => {
if (keys.length < 3) {
u.expand = expand;
result.push(u);
} else {
u.expand = expand;
if (u.title.indexOf(keys) > -1) {
result.push(u);
} else if (u.children) {
search(keys, u.children);
}
}
});
}
return result;
}
}
};
</script>
<style lang="less">
.tree-menu {
h3 {
height: 50px;
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: bold;
line-height: 50px;
color: rgba(81, 90, 110, 1);
background:rgba(245,246,250,1);
opacity: 1;
padding-left: 10px;
}
.search {
height: 50px;
padding: 5px 10px;
}
.fg {
flex: none;
// height:0;
overflow: auto;
padding-left: 10px;
}
.tree {
height: calc(100vh - 215px);
overflow: auto;
}
}
</style>
\ No newline at end of file
...@@ -31,9 +31,9 @@ export default { ...@@ -31,9 +31,9 @@ export default {
data.map(u => { data.map(u => {
u.title = u.name; u.title = u.name;
u.value = u.id; u.value = u.id;
// u.expand = true; u.expand = true;
// u.selected = false; u.selected = false;
// u.checked = false; u.checked = false;
if (u.children) { if (u.children) {
setTree(u.children); setTree(u.children);
} }
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
value: [String, Number, Array], value: [String, Number, Array],
placeholder: { placeholder: {
type: String, type: String,
default: "请选择部门" default: "请选择产品"
}, },
multiple: { multiple: {
type: Boolean, type: Boolean,
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
} }
}, },
methods: { methods: {
change(v) { change(v,item,items) {
console.log(v); console.log(v);
this.dep = v; this.dep = v;
var item; var item;
...@@ -70,6 +70,7 @@ export default { ...@@ -70,6 +70,7 @@ export default {
item = items[0]; item = items[0];
} }
this.$emit("on-change", v, item); this.$emit("on-change", v, item);
console.log(v,item,items)
} }
}, },
watch: { watch: {
......
<template>
<Cascader :data="data" v-model="name" @on-change="change" trigger="hover"></Cascader>
</template>
<script>
export default {
name: "roleSelect",
model: {
prop: "value",
event: "on-change"
},
data() {
return {
name: this.value,
data: [],
resources: [],
types: []
};
},
mounted() {
//
this.types = this.$store.getters.dictionaryByKey(
"aps.resource.type"
);
let url = `${systemUrl}/planresource/list`;
this.$api
.post(url, {
pageSize: 2000
})
.then(r => {
this.resources = r.result;
this.init();
});
},
props: {
value: [Array]
},
methods: {
init(data) {
var data = [];
this.types.map(u => {
let item = {
label: u.name,
value: u.code
};
var children = this.resources.filter(r => {
return r.type == u.code;
});
if (children && children.length > 0) {
var ul = [];
children.map(u => {
ul.push({
label: u.title,
value: u.id
});
});
item.children = ul;
}else{
item.disabled=true
}
data.push(item);
});
this.data = data;
},
change(value,selected) {
// console.log(event)
this.$emit("on-change", value,selected);
},
//获取所有的选中项
getSelectItems() {
var items = [];
this.value.forEach(v => {
var item = this.dic.filter(u => u.value == v);
if (item && item[0]) {
items.push(item[0]);
}
});
return items;
},
//获取所有选中项的名称
getSelectNames() {
var names = [];
this.getSelectItems().forEach(v => {
names.push(v.label);
});
return names;
}
},
computed: {
dic() {
let result = [];
this.data.forEach(u => {
result.push({
value: u.id,
label: u.name
});
});
return result;
}
},
watch: {
value: {
handler(v, o) {
this.name = v;
},
deep: true
}
}
};
</script>
\ No newline at end of file
...@@ -123,8 +123,8 @@ ...@@ -123,8 +123,8 @@
this.isChangeValueInTree = true; this.isChangeValueInTree = true;
this.$emit('input', this.currentValue); this.$emit('input', this.currentValue,currentNode,selectedNodes);
this.$emit('on-change', this.currentValue); this.$emit('on-change', this.currentValue,currentNode,selectedNodes);
this.dispatch('FormItem', 'on-form-change', this.currentValue); this.dispatch('FormItem', 'on-form-change', this.currentValue);
}, },
handleUpdateTreeNodes (data, isInit = false) { handleUpdateTreeNodes (data, isInit = false) {
......
...@@ -457,6 +457,7 @@ export default { ...@@ -457,6 +457,7 @@ export default {
this.formValidate.mydate = date; this.formValidate.mydate = date;
}, },
onchange_createtype() { onchange_createtype() {
if (this.createtype == 1) { if (this.createtype == 1) {
this.isshow_selectpdefm = false; this.isshow_selectpdefm = false;
this.clearModal2(); this.clearModal2();
...@@ -530,9 +531,8 @@ export default { ...@@ -530,9 +531,8 @@ export default {
}, },
setparentcreatetype(type, headerid) { setparentcreatetype(type, headerid) {
this.$parent.$parent.createtype = type this.$parent.$parent.$parent.createtype = type
this.$parent.$parent.headerid = headerid this.$parent.$parent.$parent.headerid = headerid
}, },
......
...@@ -3,7 +3,16 @@ ...@@ -3,7 +3,16 @@
<Sider hide-trigger :style="{ background: '#fff' }" class="menu" width="240" style=" flex:0;"> <Sider hide-trigger :style="{ background: '#fff' }" class="menu" width="240" style=" flex:0;">
<StoreHouseLeft @storeIds="storeIds" :type="1"></StoreHouseLeft> <StoreHouseLeft @storeIds="storeIds" :type="1"></StoreHouseLeft>
</Sider> </Sider>
<Content class="content"> <!-- <Sider hide-trigger v-if="showMenu" class="menu_side" width="300"> -->
<!-- <storeHouseTree @on-hide="onHide" @storeIds="storeIds" :type="1"/> -->
<!-- @on-select="productSearch" -->
<!-- </Sider> -->
<div v-if="!showMenu" class="show_menu">
<a class="menu_play fr" @click="showMenuFn" title="展开">
<Icon type="ios-arrow-forward" size="24" />
</a>
</div>
<Content class="content" :class="!showMenu?'con_bord':''">
<DataGrid <DataGrid
:columns="columns" :columns="columns"
ref="grid" ref="grid"
...@@ -73,6 +82,7 @@ import Detail from "./detail"; ...@@ -73,6 +82,7 @@ import Detail from "./detail";
import Search from "./search"; import Search from "./search";
import Inventory from "./inventory"; import Inventory from "./inventory";
import StoreHouseLeft from "@/components/modalTree/storeHouseLeft.vue"; import StoreHouseLeft from "@/components/modalTree/storeHouseLeft.vue";
import storeHouseTree from '@/components/modalTree/storeHouseTree.vue'
export default { export default {
name: "list", name: "list",
components: { components: {
...@@ -81,10 +91,12 @@ export default { ...@@ -81,10 +91,12 @@ export default {
Detail, Detail,
Search, Search,
Inventory, Inventory,
StoreHouseLeft StoreHouseLeft,
storeHouseTree
}, },
data() { data() {
return { return {
showMenu: true,
action: Api.index, action: Api.index,
addModal: false, addModal: false,
editModal: false, editModal: false,
...@@ -316,6 +328,20 @@ export default { ...@@ -316,6 +328,20 @@ export default {
this.tdHeight = window.innerHeight - 260 this.tdHeight = window.innerHeight - 260
}, },
methods: { methods: {
onHide() {
this.showMenu = false;
},
showMenuFn() {
this.showMenu = true;
},
// productSearch(id, item, ids) {
// let where = { productId: { op: "In", value: ids } };
// this.$refs.grid.reload(where);
// },
storeIds(val) {
this.easySearch.storeId.value = val;
this.$refs.grid.easySearch();
},
addOk() { addOk() {
this.$refs.grid.load(); this.$refs.grid.load();
this.addModal = false; this.addModal = false;
...@@ -389,10 +415,6 @@ export default { ...@@ -389,10 +415,6 @@ export default {
let vkey = "MaterialPowder" + "." + key; let vkey = "MaterialPowder" + "." + key;
return this.$t(vkey) || key; return this.$t(vkey) || key;
}, },
storeIds(val) {
this.easySearch.storeId.value = val;
this.$refs.grid.easySearch();
}
} }
}; };
</script> </script>
...@@ -63,6 +63,7 @@ import Detail from './detail' ...@@ -63,6 +63,7 @@ import Detail from './detail'
import Search from './search' import Search from './search'
import Inventory from './inventory' import Inventory from './inventory'
import StoreHouseLeft from '@/components/modalTree/storeHouseLeft.vue' import StoreHouseLeft from '@/components/modalTree/storeHouseLeft.vue'
// import StoreHouseLeft from '@/components/modalTree/storeHouseTree.vue'
export default { export default {
name: 'list', name: 'list',
components: { components: {
......
...@@ -331,6 +331,10 @@ export default { ...@@ -331,6 +331,10 @@ export default {
//this.$Message.info("展开左侧树") //this.$Message.info("展开左侧树")
this.showMenu = true; this.showMenu = true;
}, },
productSearch(id, item, ids) {
let where = { productId: { op: "In", value: ids } };
this.$refs.grid.reload(where);
},
// 详情页面 // 详情页面
view(row) { view(row) {
// this.$router.push("technology/details"); // this.$router.push("technology/details");
...@@ -358,10 +362,6 @@ export default { ...@@ -358,10 +362,6 @@ export default {
search() { search() {
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
}, },
productSearch(id, item, ids) {
let where = { productId: { op: "In", value: ids } };
this.$refs.grid.reload(where);
},
add() { add() {
this.curId = 0; this.curId = 0;
this.title = "新增"; this.title = "新增";
......
<style lang="less"> <style lang="less">
.test_layout { .test_layout {
height: 100%; height: 100%;
.bg1{ .bg1 {
background:#fefefe ; background: #fefefe;
} }
// &.fg { // &.fg {
// // overflow: auto; // // overflow: auto;
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<div class="layout-assistant"> <div class="layout-assistant">
<MenuItem name="1" to="/test/user">人员选择</MenuItem> <MenuItem name="1" to="/test/user">人员选择</MenuItem>
<MenuItem name="2" to="/test/com">异步组件</MenuItem> <MenuItem name="2" to="/test/com">异步组件</MenuItem>
<MenuItem name="4" to="/test/resource">资源选择</MenuItem>
<MenuItem name="3">Option 3</MenuItem> <MenuItem name="3">Option 3</MenuItem>
</div> </div>
</Menu> </Menu>
...@@ -32,6 +33,9 @@ ...@@ -32,6 +33,9 @@
</template> </template>
<script> <script>
export default { export default {
layout: "empty" layout: "empty",
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
}
}; };
</script> </script>
\ No newline at end of file
<template>
<div>
<ResourceSelect v-model="model" @on-change="change"></ResourceSelect>
<p>{{model}}</p>
<p>{{text}}</p>
<Button @click="set">赋值</Button>
<ProductSelect v-model="product" @on-change="pchange"></ProductSelect>
</div>
</template>
<script>
import ResourceSelect from "@/components/page/resourceSelect"
export default {
components:{ResourceSelect},
name: '',
data() {
return {
model:[],
text:"",
product:"",
}
},
methods:{
change(v,items){
this.text=items.map(u=>u.label).join('/');
},
set(){
this.model=[ "1", 91 ];
},
pchange(v){
// this.text=items.map(u=>u.label).join('/');
},
}
}
</script>
<style lang="less" >
</style>
\ No newline at end of file
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