Commit 12e3fcb5 authored by renjintao's avatar renjintao

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

parents 337114dd f28b0b07
<template>
<Select v-model="dep" :placeholder="placeholdeinfo" clearable @on-clear="onClear">
<Option
v-for="(item,index) in list"
:key="index"
:value="item.value"
style="display:none"
:label="item.label"
></Option>
<Tree key="mytree" :data="data1" ref="mytree" :render="renderContent"></Tree>
</Select>
</template>
<script>
import Api from "../../pages/technology/productMix/productTree/api";
export default {
name: "Add",
model: {
prop: "value",
event: "on-change"
},
data() {
return {
dep: "",
list: [],
data1: [],
selectdata: [],
placeholdeinfo: "请选择",
orderSearchForm: {
productId: null, //层级id
productName: "" //层级名称
}
};
},
props: {
value: [String, Number, Array],
placeholder: {
type: String,
default: "请选择部门"
},
multiple: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
},
mounted() {},
created() {
this.dep = this.value | "";
this.loadTree();
},
methods: {
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.name
);
},
handleSelect(data) {
console.log(data);
if (data.length > 0) {
this.list = [];
this.list.push({
label: data[0].name,
value: data[0].id
});
this.orderSearchForm.productName = data[0].name;
this.orderSearchForm.productId = data[0].id;
let listData = this.$u.clone(this.data1);
let result = [];
var nodeId = data.id;
// //传入参数:需要遍历的json,需要匹配的id
function findPnodeId(listData, nodeId) {
//设置结果
if (!listData) {
return; //如果data传空,直接返回
}
for (var i = 0; i < listData.children.length; i++) {
let item = listData.children[i];
if (item.id == nodeId) {
result.unshift(data.name);
//找到id相等的则返回父id
return result;
} else if (!!item.children) {
findPnodeId(item.children, nodeId);
}
}
//如果执行循环中都没有return,则在此return
return result;
}
console.log(result);
this.$emit("on-change", this.orderSearchForm);
}
},
loadTree() {
//打开新增订单窗口加载产品
var sumData = [];
Api.getleveltree().then(r => {
if (r.result) {
this.data1 = r.result;
} else {
this.$Message.error("加载产品树失败!");
}
});
},
onClear() {
this.list = [];
this.placeholdeinfo = "请选择";
this.$emit("on-change", this.orderSearchForm);
}
},
watch: {
value: {
handler(v, o) {
this.dep = v | "";
Api.getleveltree().then(res => {
if (res.result) {
let temData = this.$u.clone(this.data1);
this.list = [];
if (v != "" && v != null) {
let dataTemp = this.$u.treeToList(temData);
dataTemp.forEach(data => {
if (data.id == this.dep) {
this.list.push({ label: data.name, value: data.id });
}
});
}
} else {
this.$Message.error("加载产品树失败!");
}
});
},
deep: true
}
}
};
</script>
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem v-if="formItem.radio==0"> <FormItem v-if="formItem.radio==0">
<UserSelect v-model="user" :multiple="true" theme="list" /> <UserSelect v-model="user" :multiple="true" />
</FormItem> </FormItem>
<FormItem label="班组" v-if="formItem.radio==1"> <FormItem label="班组" v-if="formItem.radio==1">
<Select v-model="formItem.shopId" placeholder="请选择" style="width:300px"> <Select v-model="formItem.shopId" placeholder="请选择" style="width:300px">
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
style="width:300px" style="width:300px"
:multiple="true" :multiple="true"
/>--> />-->
<UserSelect v-model="formItem.userIds" :multiple="true" theme="list" /> <UserSelect v-model="formItem.userIds" :multiple="true" />
</FormItem> </FormItem>
<FormItem label="班组" v-if="mode==2" prop="shopId"> <FormItem label="班组" v-if="mode==2" prop="shopId">
<Select v-model="formItem.shopId" placeholder="请选择" style="width:300px"> <Select v-model="formItem.shopId" placeholder="请选择" style="width:300px">
......
...@@ -384,13 +384,12 @@ ...@@ -384,13 +384,12 @@
margin: 0 0 20px 0; margin: 0 0 20px 0;
} }
.list01{ .list01{
min-height: 50px;
max-height: 155px;
overflow-x: auto;
.tag_card{ .tag_card{
cursor: pointer; cursor: pointer;
margin: 0 20px 15px 0; margin: 0 20px 15px 0;
.hege{ i{color: #2680EB;} }
.rang{ i{color: #515A6E;} }
.fanxiu{ i{color: #FFA000;} }
.feipin{ i{color: #FE7777;} }
} }
.ivu-tag-checked{ .ivu-tag-checked{
border: 1px solid #2680EB !important; border: 1px solid #2680EB !important;
...@@ -400,6 +399,7 @@ ...@@ -400,6 +399,7 @@
} }
} }
.list02{ .list02{
min-height: 50px;
.tag_card02{ .tag_card02{
margin: 0 20px 15px 0; margin: 0 20px 15px 0;
} }
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<h2 class="heger">合格({{cardlist.length}}</h2> <h2 class="heger">合格({{cardlist.length}}</h2>
<div class="mass_list"> <div class="mass_list">
<p class="btn_play"> <p class="btn_play">
<Button class="button" type="primary">全选</Button> <Button class="button" type="primary" @click="allcheck">全选</Button>
<Button class="button" type="primary">反选</Button> <Button class="button" type="primary" @click="rechecked">反选</Button>
</p> </p>
<div class="list01"> <div class="list01">
<Tag type="dot" :checkable="true" class="tag_card" :checked="item.checked" size="large" v-for="(item,index) in cardlist" :name="item.id" :key="index" <Tag type="dot" :checkable="true" class="tag_card" :checked="item.checked" size="large" v-for="(item,index) in cardlist" :name="item.id" :key="index"
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
</div> </div>
</div> </div>
<div class="chuanse"> <div class="chuanse">
<Button class="button01">让步</Button> <Button class="button01" @click="chanserang">让步</Button>
<Button class="button02">返修</Button> <Button class="button02" @click="chansefan">返修</Button>
<Button class="button03">废品</Button> <Button class="button03" @click="chansefei">废品</Button>
</div> </div>
<div class="mass_list rangbu"> <div class="mass_list rangbu">
<h2 class="rangb">让步({{ranglist.length}}</h2> <h2 class="rangb">让步({{ranglist.length}}</h2>
...@@ -27,16 +27,16 @@ ...@@ -27,16 +27,16 @@
</div> </div>
</div> </div>
<div class="mass_list fanxiu_box"> <div class="mass_list fanxiu_box">
<h2 class="fanxiu">返修({{ranglist.length}}</h2> <h2 class="fanxiu">返修({{fanlist.length}}</h2>
<div class="list02"> <div class="list02">
<Tag type="dot" class="tag_card02" v-for="(item,index) in ranglist" :key="index" :name="item.id" :checkable="false" closable @on-close="handleClose">{{ item.code}}</Tag> <Tag type="dot" class="tag_card02" v-for="(item,index) in fanlist" :key="index" :name="item.id" :checkable="false" closable @on-close="fanClose">{{ item.code}}</Tag>
</div> </div>
</div> </div>
<div class="mass_list fei_box"> <div class="mass_list fei_box">
<h2 class="feipin">废品({{ranglist.length}}</h2> <h2 class="feipin">废品({{feilist.length}}</h2>
<div class="list02"> <div class="list02">
<Tag type="dot" class="tag_card02" v-for="(item,index) in ranglist" :key="index" :name="item.id" :checkable="false" closable @on-close="handleClose">{{ item.code}}</Tag> <Tag type="dot" class="tag_card02" v-for="(item,index) in feilist" :key="index" :name="item.id" :checkable="false" closable @on-close="feiClose">{{ item.code}}</Tag>
<!-- <div class="file_card" v-for="(item,index) in ranglist" :label="item.id" :key="index"> <!-- <div class="file_card" v-for="(item,index) in ranglist" :label="item.id" :key="index">
{{item.code}} {{item.code}}
<a class="del_card" @click="delCard"><Icon type="ios-close"/></a> <a class="del_card" @click="delCard"><Icon type="ios-close"/></a>
...@@ -44,19 +44,19 @@ ...@@ -44,19 +44,19 @@
</div> </div>
</div> </div>
<div class="fei_right"> <div class="fei_right">
<p>问题原因:<Select style="width:80%"> <p>问题原因:<Select style="width:80%" :disabled="feilist.length == 0 ? true:false">
<!-- <Option value="" class="option-text">请选择</Option> placeholder="选择问题原因" --> <Option value="" class="option-text">请选择</Option><!-- :disabled="feilist.length>0" placeholder="选择问题原因" -->
<Option v-for="item in problemList" :value="item.number" :key="item.index">{{ item.number }}</Option> <Option v-for="item in problemList" :value="item.number" :key="item.index">{{ item.number }}</Option>
</Select></p> </Select></p>
<p>责任归属:<Select style="width:80%"> <p>责任归属:<Select style="width:80%" :disabled="feilist.length == 0 ? true:false">
<!-- <Option value="" class="option-text">请选择</Option> placeholder="选择责任人" --> <Option value="" class="option-text">请选择</Option> <!-- placeholder="选择责任人" -->
<Option v-for="item in blameList" :value="item.user" :key="item.index">{{ item.user }}</Option> <Option v-for="item in blameList" :value="item.user" :key="item.index">{{ item.user }}</Option>
</Select></p> </Select></p>
</div> </div>
</div> </div>
<div class="futer flex fc-ev" > <div class="futer flex fc-ev" >
<Button class="button" size='large' type="primary"> 提交</Button> <Button class="button" size='large' type="primary" @click="submit"> 提交</Button>
<Button class="button" size='large' type="primary"> 取消</Button> <Button class="button" size='large' @click="toOrder"> 取消</Button>
</div> </div>
</div> </div>
</template> </template>
...@@ -69,129 +69,89 @@ export default { ...@@ -69,129 +69,89 @@ export default {
cardlist:[ cardlist:[
{ {
status:0, status:0,
code:1001210011, code:1001210101,
id:1, id:1,
checked:false, checked:false,
},{ },{
status:1, status:1,
code:1001210012, code:1001210102,
id:2, id:2,
checked:false, checked:false,
},{ },{
status:2, status:2,
code:1001210013, code:1001210103,
id:3, id:3,
checked:false, checked:false,
},{ },{
status:3, status:3,
code:1001210014, code:1001210104,
id:4, id:4,
checked:false, checked:false,
},{ },{
status:0, status:0,
code:1001210011, code:1001210105,
id:5, id:5,
checked:false, checked:false,
},{ },{
status:1, status:1,
code:1001210012, code:1001210106,
id:6, id:6,
checked:false, checked:false,
},{ },{
status:2, status:2,
code:1001210013, code:1001210107,
id:7, id:7,
checked:false, checked:false,
},{ },{
status:3, status:3,
code:1001210014, code:1001210108,
id:8, id:8,
checked:false, checked:false,
},{ },{
status:0, status:0,
code:1001210015, code:1001210109,
id:9, id:9,
checked:false, checked:false,
},{ },{
status:1, status:1,
code:1001210016, code:1001210110,
id:10, id:10,
checked:false, checked:false,
},{ },{
status:2, status:2,
code:1001210017, code:1001210111,
id:11, id:11,
checked:false, checked:false,
},{ },{
status:3, status:3,
code:1001210018, code:1001210112,
id:12, id:12,
checked:false, checked:false,
},{ },{
status:0, status:0,
code:1001210019, code:1001210113,
id:13, id:13,
checked:false, checked:false,
},{ },{
status:1, status:1,
code:10012100110, code:1001210114,
id:14, id:14,
checked:false, checked:false,
},{ },{
status:2, status:2,
code:10012100111, code:1001210115,
id:15, id:15,
checked:false, checked:false,
},{ },{
status:3, status:3,
code:10012100112, code:1001210116,
id:16, id:16,
checked:false, checked:false,
}, },
], ],
ranglist:[ ranglist:[],
{ fanlist:[],
status:0, feilist:[],
code:1001210011,
id:1,
checked:false,
},{
status:1,
code:1001210012,
id:2,
checked:false,
},{
status:2,
code:1001210013,
id:3,
checked:false,
},{
status:3,
code:1001210014,
id:4,
checked:false,
},{
status:0,
code:1001210011,
id:1,
checked:false,
},{
status:1,
code:1001210012,
id:2,
checked:true,
},{
status:2,
code:1001210013,
id:3,
checked:false,
},{
status:3,
code:1001210014,
id:4,
checked:false,
},
],
problemList:[ problemList:[
{ number:"问题描述01" , }, { number:"问题描述01" , },
{ number:"问题描述02" , }, { number:"问题描述02" , },
...@@ -225,14 +185,96 @@ export default { ...@@ -225,14 +185,96 @@ export default {
delCard(){ delCard(){
this.$Message.success("删除一条") this.$Message.success("删除一条")
}, },
// 全选
allcheck(){
this.cardlist.map((u,i)=>{
u.checked = true
})
},
// 反选
rechecked(){
this.cardlist.map((u,i)=>{ u.checked = !u.checked })
},
changeCards(checked,name){ changeCards(checked,name){
// console.log(checked) let lists = this.cardlist
// console.log(name) lists.map((u,i)=>{
if(u.id==name){ u.checked = checked }
})
},
// 让步
chanserang(){
let oldList = this.cardlist
let indese=[]
oldList.map((u,i)=>{
if(u.checked){
this.ranglist.push(u)
}
})
indese = oldList.filter(item => !this.ranglist.includes(item))
this.cardlist = indese
},
// 返工
chansefan(){
let oldList = this.cardlist
let indese=[]
oldList.map((u,i)=>{
if(u.checked){
this.fanlist.push(u)
}
})
indese = oldList.filter(item => !this.fanlist.includes(item))
this.cardlist = indese
},
// 废品
chansefei(){
let oldList = this.cardlist
let indese=[]
oldList.map((u,i)=>{
if(u.checked){
this.feilist.push(u)
}
})
indese = oldList.filter(item => !this.feilist.includes(item))
this.cardlist = indese
}, },
handleClose(event,name){ handleClose(event,name){
console.log(name) let rangold = this.ranglist
let index = this.ranglist.indexOf(name); let index = this.ranglist.indexOf(name);
let ide = this.cardlist.includes(name);
let itemlist = rangold.filter(item => {
if(item.id == name){ return item }
})
this.ranglist.splice(index, 1); this.ranglist.splice(index, 1);
this.cardlist.splice(ide, 0, itemlist[0]);
},
fanClose(event,name){
let fanold = this.fanlist
let index = this.fanlist.indexOf(name);
let ide = this.cardlist.includes(name);
let itemlist = fanold.filter(item => {
if(item.id == name){ return item }
})
this.fanlist.splice(index, 1);
this.cardlist.splice(ide, 0, itemlist[0]);
},
feiClose(event,name){
let feiold = this.feilist
let index = this.feilist.indexOf(name);
let ide = this.cardlist.includes(name);
let itemlist = feiold.filter(item => {
if(item.id == name){ return item }
})
this.feilist.splice(index, 1);
this.cardlist.splice(ide, 0, itemlist[0]);
},
// 提交
submit(){
this.$Message.success("提交中...")
},
// 取消
toOrder(){
this.$router.push("/produce/orderlist");
}, },
}, },
} }
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
<!-- <h4>产品列表</h4> --> <!-- <h4>产品列表</h4> -->
<div class="p-list"> <div class="p-list">
<!-- <Input search enter-button placeholder="请输入产品名称" /> --> <!-- <Input search enter-button placeholder="请输入产品名称" /> -->
<ProductTree @on-hide="onHide" @on-select="productSearch"/> <ProductTree @on-hide="onHide" @on-select="productSearch" />
</div> </div>
</Sider> </Sider>
<Content> <Content>
<Product :parent="parent"/> <Product :parent="parent" />
</Content> </Content>
</Layout> </Layout>
</div> </div>
...@@ -26,15 +26,16 @@ export default { ...@@ -26,15 +26,16 @@ export default {
return { return {
parent: { parent: {
id: null, id: null,
parentName: "" parentName: "",
ids: ""
} }
}; };
}, },
methods: { methods: {
productSearch(id, item, ids) { productSearch(id, item, ids) {
this.parent.parentName = item.title; this.parent.parentName = item.title;
this.parent.id = id; this.parent.id = id;
this.parent.ids = ids;
// let where = { productId: { op: "In", value: ids } }; // let where = { productId: { op: "In", value: ids } };
// this.$refs.grid.reload(where); // this.$refs.grid.reload(where);
}, },
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
<Row> <Row>
<Col :span="12"> <Col :span="12">
<FormItem label="上级所属" prop="parentName"> <FormItem label="上级所属" prop="parentName">
<Input v-model="entity.parentName" disabled></Input> <!-- <Input v-model="entity.parentName" disabled></Input> -->
<productSelect1 v-model="entity.levelId" @on-change="proChange"/>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
...@@ -155,6 +156,10 @@ export default { ...@@ -155,6 +156,10 @@ export default {
this.entity = r.result; this.entity = r.result;
this.entity.id = 0; this.entity.id = 0;
}); });
},
proChange(items) {
this.entity.levelId = items.productId;
}, },
l(key) { l(key) {
key = "product_info" + "." + key; key = "product_info" + "." + key;
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
</div> </div>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide> <Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" :parents="parents" /> <component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" :parents="parents" />
</Modal> </Modal>
...@@ -77,7 +76,8 @@ export default { ...@@ -77,7 +76,8 @@ export default {
props: { props: {
parent: { parent: {
id: Number, id: Number,
parentName: String parentName: String,
ids: String
} }
}, },
data() { data() {
...@@ -106,6 +106,7 @@ export default { ...@@ -106,6 +106,7 @@ export default {
}; };
}, },
mounted() { mounted() {
this.$refs.grid.reload();
console.log(this); console.log(this);
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
...@@ -125,10 +126,8 @@ export default { ...@@ -125,10 +126,8 @@ export default {
this.title = "新增"; this.title = "新增";
this.detail = () => import("./add"); this.detail = () => import("./add");
this.modal = true; this.modal = true;
this.parents.parentId = this.parent.id; this.parents.parentId = this.parent.id;
this.parents.parentName = this.parent.parentName; this.parents.parentName = this.parent.parentName;
alert(this.parents.parentId);
}, },
copy(id) { copy(id) {
this.curId = id; this.curId = id;
...@@ -178,6 +177,14 @@ export default { ...@@ -178,6 +177,14 @@ export default {
let vkey = "product_info" + "." + key; let vkey = "product_info" + "." + key;
return this.$t(vkey) || key; return this.$t(vkey) || key;
} }
},
watch: {
"parent.id"(v) {
if (v) {
let data = { levelId: { op: "In", value: this.parent.ids } };
this.$refs.grid.reload(data);
}
}
} }
}; };
</script> </script>
......
...@@ -61,6 +61,8 @@ export default { ...@@ -61,6 +61,8 @@ export default {
this.expand = !this.expand; this.expand = !this.expand;
}, },
change(v, b) { change(v, b) {
console.log(v)
console.log(b)
let ids = []; let ids = [];
ids.push(b.value); ids.push(b.value);
if (b.children) { if (b.children) {
......
...@@ -43,6 +43,7 @@ import User from '@/components/page/user.vue' ...@@ -43,6 +43,7 @@ import User from '@/components/page/user.vue'
import op from '@/components/page/opration.vue' import op from '@/components/page/opration.vue'
import ProductNumberSelect from '@/components/page/productNumberSelect.vue' import ProductNumberSelect from '@/components/page/productNumberSelect.vue'
import ProductSelect from '@/components/page/productSelect.vue' import ProductSelect from '@/components/page/productSelect.vue'
import ProductSelect1 from '@/components/page/productSelect1.vue'
import DTSpan from '@/components/page/dtSpan.vue' import DTSpan from '@/components/page/dtSpan.vue'
import DTSearch from '@/components/page/dtSearch.vue' import DTSearch from '@/components/page/dtSearch.vue'
import InputTime from '@/components/page/inputTime.vue' import InputTime from '@/components/page/inputTime.vue'
...@@ -96,6 +97,7 @@ Vue.component("op", op) //DepartmentSelect ...@@ -96,6 +97,7 @@ Vue.component("op", op) //DepartmentSelect
Vue.component("DepartmentSelect", DepartmentSelect) Vue.component("DepartmentSelect", DepartmentSelect)
Vue.component("ProductNumberSelect", ProductNumberSelect) Vue.component("ProductNumberSelect", ProductNumberSelect)
Vue.component("ProductSelect", ProductSelect) Vue.component("ProductSelect", ProductSelect)
Vue.component("ProductSelect1", ProductSelect1)
Vue.component("DTSpan", DTSpan) Vue.component("DTSpan", DTSpan)
Vue.component("DTSearch", DTSearch) Vue.component("DTSearch", DTSearch)
Vue.component("InputTime", InputTime) Vue.component("InputTime", InputTime)
......
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