Commit 617bdabb authored by 仇晓婷's avatar 仇晓婷

产品结构管理

parent b4082311
...@@ -20,10 +20,14 @@ ...@@ -20,10 +20,14 @@
<p>将文件拖到此处,或点击上传</p> <p>将文件拖到此处,或点击上传</p>
</div> </div>
<Button icon="ios-cloud-upload-outline" v-if="!cloudIco">上传文件</Button> <Button icon="ios-cloud-upload-outline" v-if="!cloudIco">上传文件</Button>
<span style="font-size:10px;color:#aaa" v-if="fileFormat">文件格式:{{JSON.stringify(formatList).replace('[', '').replace(']', '').replace(/\"/g, '')}};文件最大:{{maxSize}}k</span> <span
style="font-size:10px;color:#aaa"
v-if="fileFormat"
>文件格式:{{JSON.stringify(formatList).replace('[', '').replace(']', '').replace(/\"/g, '')}};文件最大:{{maxSize}}k</span>
</Upload> </Upload>
<Progress :percent="per" :stroke-width="5" v-show="vshowPro" /> <Progress :percent="per" :stroke-width="5" v-show="vshowPro" />
<Tag <Tag
v-if="Photo"
v-for="(item,index) in nameList" v-for="(item,index) in nameList"
:key="index" :key="index"
:name="item.id" :name="item.id"
...@@ -33,10 +37,28 @@ ...@@ -33,10 +37,28 @@
> >
<a :href="fileUrlPath" @click="downFile(item.filePath)" target="_blank">{{item.fileName}}</a> <a :href="fileUrlPath" @click="downFile(item.filePath)" target="_blank">{{item.fileName}}</a>
</Tag> </Tag>
<div class="upload-body" v-else>
<div
class="demo-upload-list"
v-for="(item,index) in nameList"
:key="index"
:closable="!unClosable"
@click="listData(item,index)"
:class="isactive == index ? 'addclass' : '' "
>
<template>
<img :src="downUrl+item.filePath" />
</template>
<div class="demo-upload-list-cover">
<Icon type="ios-eye" @click.native="seeFile(item.filePath)"></Icon>
<Icon type="ios-trash-outline" @click.native="handleClose2($event,item.id)"></Icon>
</div>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import util from '@/libs/util'; import util from "@/libs/util";
export default { export default {
name: "files", name: "files",
model: { model: {
...@@ -49,12 +71,14 @@ export default { ...@@ -49,12 +71,14 @@ export default {
fileUrlPath: "", fileUrlPath: "",
nameList: [], nameList: [],
hbaseFileListNew: [], hbaseFileListNew: [],
formatList: ["jpg","gif","png"], formatList: ["jpg", "gif", "png"],
multiple: true, multiple: true,
postUrl: "", postUrl: "",
style: "", style: "",
per: 0, per: 0,
vshowPro: false vshowPro: false,
Photo: true,
isactive: 0
}; };
}, },
created() {}, created() {},
...@@ -64,7 +88,8 @@ export default { ...@@ -64,7 +88,8 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
singleFile: {//上传单文件 singleFile: {
//上传单文件
type: Boolean, type: Boolean,
default: false default: false
}, },
...@@ -84,12 +109,21 @@ export default { ...@@ -84,12 +109,21 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
fileFormat:{ fileFormat: {
type: Boolean,
default: false
},
Photos: {
type: Boolean, type: Boolean,
default: false default: false
} }
}, },
methods: { methods: {
listData(li, index) {
this.$emit("clickItem", this.downUrl + li.filePath);
this.isactive = index;
},
onProgress(event, file, fileList) { onProgress(event, file, fileList) {
this.per = 0; this.per = 0;
this.vshowPro = true; this.vshowPro = true;
...@@ -99,6 +133,11 @@ export default { ...@@ -99,6 +133,11 @@ export default {
// }, // },
//上传成功文件 //上传成功文件
uploadSuccess(response, file, fileList) { uploadSuccess(response, file, fileList) {
if (this.Photos) {
this.Photo = false;
} else {
this.Photo = true;
}
this.per = 60; this.per = 60;
this.vshowPro = true; this.vshowPro = true;
const hbaseFileList = []; const hbaseFileList = [];
...@@ -113,6 +152,7 @@ export default { ...@@ -113,6 +152,7 @@ export default {
objImag.id = file.response.data.id; objImag.id = file.response.data.id;
filesList.push(objImag); filesList.push(objImag);
this.nameList = this.nameList.concat(filesList); this.nameList = this.nameList.concat(filesList);
console.log(this.nameList);
this.per = 100; this.per = 100;
setTimeout(() => { setTimeout(() => {
this.per = 0; this.per = 0;
...@@ -158,6 +198,10 @@ export default { ...@@ -158,6 +198,10 @@ export default {
downFile(path) { downFile(path) {
this.fileUrlPath = this.downUrl + path; this.fileUrlPath = this.downUrl + path;
}, },
seeFile(path) {
this.fileUrlPath = this.downUrl + path;
window.open(this.fileUrlPath, "_blank");
},
formatL() { formatL() {
if (this.files) { if (this.files) {
this.formatList = [ this.formatList = [
...@@ -169,7 +213,7 @@ export default { ...@@ -169,7 +213,7 @@ export default {
"doc", "doc",
"xls", "xls",
"xlsx", "xlsx",
"txt", "txt"
]; ];
} }
return this.formatList; return this.formatList;
...@@ -186,7 +230,7 @@ export default { ...@@ -186,7 +230,7 @@ export default {
this.postUrl = this.postUrl =
fileUrl + fileUrl +
"/upload/?token=Bearer " + "/upload/?token=Bearer " +
util.cookies.get('token') + util.cookies.get("token") +
"&" + "&" +
this.convertObj(this.parms); this.convertObj(this.parms);
//是否显示上传按钮 //是否显示上传按钮
...@@ -279,4 +323,49 @@ export default { ...@@ -279,4 +323,49 @@ export default {
}; };
</script> </script>
<style lang="less"> <style lang="less">
.upload-body {
width: 100%;
border: 1px solid #eee;
margin-top: 10px;
.demo-upload-list {
display: inline-block;
width: 60px;
height: 60px;
text-align: center;
line-height: 60px;
border: 1px solid transparent;
border-radius: 4px;
overflow: hidden;
background: #fff;
position: relative;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
margin: 10px 10px 0 10px;
cursor: pointer;
}
.demo-upload-list img {
width: 100%;
height: 100%;
}
.demo-upload-list-cover {
display: none;
position: absolute;
top: -20px;
right: 0;
// background: rgba(0, 0, 0, 0.6);
}
.demo-upload-list:hover .demo-upload-list-cover {
display: block;
// border: 1px solid #eee;
}
.demo-upload-list-cover i {
color: #000;
font-size: 20px;
cursor: pointer;
margin: 0 2px;
}
.addclass {
border: 1px solid #2680eb;
}
}
</style> </style>
\ No newline at end of file
...@@ -1425,5 +1425,18 @@ export default { ...@@ -1425,5 +1425,18 @@ export default {
check_person:'校对人', check_person:'校对人',
executive_branch:'执行部门', executive_branch:'执行部门',
},
product_info:{
mmcode:'物料编号',
drawingNo:'图号',
name:'名称',
productCode:'产品编号',
status:'',
remark:'备注',
madeCompany:'主承制单位',
extend:'',
productUrl:'产品图像url',
productUrlList:'产品图象列表',
} }
} }
<template> <template>
<div> <div class="product-mix">
产品结构 <Layout>
</div> <Sider width="300">
<!-- <h4>产品列表</h4> -->
<div class="p-list">
<!-- <Input search enter-button placeholder="请输入产品名称" /> -->
<ProductTree @on-hide="onHide" @on-select="productSearch"/>
</div>
</Sider>
<Content>
<Product :parent="parent"/>
</Content>
</Layout>
</div>
</template> </template>
<script> <script>
import ProductTree from "./productTree";
import Product from "./product";
export default { export default {
data(){ components: {
return{ ProductTree,
Product
},
data() {
return {
parent: {
id: null,
parentName: ""
}
};
},
methods: {
productSearch(id, item, ids) {
this.parent.parentName = item.title;
this.parent.id = id;
// let where = { productId: { op: "In", value: ids } };
// this.$refs.grid.reload(where);
},
onHide() {
// this.$Message.info("收起左侧树")
this.showMenu = false;
}
}
};
</script>
<style lang="less" >
.product-mix {
font-family: Microsoft YaHei;
.ivu-layout-sider {
background: rgba(255, 255, 255, 1);
margin-right: 10px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
} h4 {
height: 30px;
line-height: 30px;
background: #eee;
padding-left: 10px;
}
.p-list {
padding: 10px;
height: 85vh;
overflow: auto;
} }
}
.ivu-layout-content {
margin-left: 5px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
height: 88vh;
overflow: auto;
padding: 10px;
}
} }
</script> </style>
\ No newline at end of file \ No newline at end of file
<template>
<Layout>
<Sider width="300">
<div class="add-list">
<img :src="img" width="100%" height="100%" />
</div>
</Sider>
<Content>
<Form ref="form" :model="entity" :rules="rules" :label-width="120">
<Row>
<Col :span="12">
<FormItem label="上级所属" prop="parentName">
<Input v-model="entity.parentName" disabled></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('productCode')" prop="productCode">
<Input v-model="entity.productCode"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('mmcode')" prop="mmcode">
<Input v-model="entity.mmcode"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('drawingNo')" prop="drawingNo">
<Input v-model="entity.drawingNo"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('madeCompany')" prop="madeCompany">
<Input v-model="entity.madeCompany"></Input>
</FormItem>
</Col>
<!-- <Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark"></Input>
</FormItem>
</Col>-->
<Col :span="24">
<FormItem :label="l('productUrlList')" prop="productUrlList">
<!-- <InputFile v-model="entity.productUrl"></InputFile> -->
<files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" />
</FormItem>
</Col>
<!-- <Col :span="24">
<FormItem :label="l('productUrlList')" prop="productUrlList">-->
<!-- <Input v-model="entity.productUrlList" type="textarea" :rows="5"></Input> -->
<!-- <filesList v-model="entity.productUrlList"></filesList>
</FormItem>
</Col>-->
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</Content>
</Layout>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
disabled: false,
entity: {
mmcode: "",
drawingNo: "",
name: "",
productCode: "",
// status: null,
remark: "",
madeCompany: "",
extend: "",
productUrl: "",
productUrlList: "",
levelId: null,
parentName: this.parents.parentName
},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
},
parms: {
app: "technology",
eid: null,
name: "",
field: ""
},
img: ""
};
},
props: {
v: Object,
eid: Number,
parents: {
parentName: String,
parentId: Number
}
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
},
methods: {
clickData(data) {
this.img = data;
},
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
if (this.$refs.refFile.nameList.length > 0) {
this.entity.productUrlList = this.parms.eid;
this.entity.productUrl = this.img;
} else {
this.entity.productUrlList = "";
}
this.entity.levelId = this.parents.parentId;
Api.create(this.entity)
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.entity.id = 0;
});
},
l(key) {
key = "product_info" + "." + key;
return this.$t(key);
}
},
watch: {
v() {
this.entity = this.$u.clone(this.v);
},
eid(v) {
if (v > 0) {
this.load(v);
}
}
}
};
</script>
<style lang="less">
.ivu-layout-sider {
background: rgba(255, 255, 255, 1);
margin-right: 10px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.15);
.add-list {
width: 100%;
height: 300px;
overflow: hidden;
}
}
</style>
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index:`${technologyUrl}productinfo/paged`,
paged(params){
return Api.post(`${technologyUrl}productinfo/paged`,params);
},
get(params){
return Api.get(`${technologyUrl}productinfo/get`,params);
},
create(params){
return Api.post(`${technologyUrl}productinfo/create`,params);
},
update(params){
return Api.post(`${technologyUrl}productinfo/update`,params);
},
delete(id) {
return Api.delete(`${technologyUrl}productinfo/delete`,{params:{id:id}});
},
deletes(params) {
return Api.post(`${technologyUrl}productinfo/batchdelete`,params);
}
}
\ No newline at end of file
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('mmcode')">{{entity.mmcode}}</Filed>
<Filed :span="12" :name="l('drawingNo')">{{entity.drawingNo}}</Filed>
<Filed :span="12" :name="l('name')">{{entity.name}}</Filed>
<!-- <Filed :span="12" :name="l('productCode')">{{entity.productCode}}</Filed> -->
<!-- <Filed :span="12" :name="l('status')">{{entity.status}}</Filed> -->
<!-- <Filed :span="24" :name="l('remark')">{{entity.remark}}</Filed> -->
<Filed :span="12" :name="l('madeCompany')">{{entity.madeCompany}}</Filed>
<!-- <Filed :span="12" :name="l('extend')">{{entity.extend}}</Filed> -->
<Filed :span="24" :name="l('productUrl')">{{entity.productUrl}}</Filed>
<Filed :span="24" :name="l('productUrlList')">{{entity.productUrlList}}</Filed>
</Row>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
props: {
eid: Number
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "product_info" + "." + key;
return this.$t(key);
}
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
}
}
};
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="120">
<Row>
<Col :span="12">
<FormItem :label="l('mmcode')" prop="mmcode">
<Input v-model="entity.mmcode"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('drawingNo')" prop="drawingNo">
<Input v-model="entity.drawingNo"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('madeCompany')" prop="madeCompany">
<Input v-model="entity.madeCompany"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('productUrl')" prop="productUrl">
<files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" />
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Edit",
data() {
return {
disabled: false,
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
props: {
eid: Number
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
});
},
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
Api.update(this.entity)
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "product_info" + "." + key;
return this.$t(key);
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
}
};
</script>
\ No newline at end of file
<template>
<div class="product-m">
<DataGrid
:columns="columns"
ref="grid"
:action="action"
type="card"
:high="false"
:span="6"
:lazy="true"
>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入物料编号/名称" v-model="easySearch.keys.value" />
</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>
<template slot="card" slot-scope="{row}">
<div class="body-card">
<Row class="title-i">
<Col :span="12">名称:{{row.name}}</Col>
<Col :span="12" class="btn-click">物料编号:{{row.mmcode}}</Col>
</Row>
<Row class="row-down">
<Col span="7">
<div class="img-i">图片</div>
</Col>
<Col span="17" class="c">
<div>产品分类:{{row.productClass}}</div>
<div>图号:{{row.drawingNo}}</div>
<div>主制单位:{{row.madeCompany}}</div>
<p class="a-icon">
<a @click="edit(row.id)">
<Icon type="md-create" />编辑
</a>&nbsp;
<a @click="remove(row.id)">
<Icon type="ios-trash" />删除
</a>&nbsp;
<a @click="view(row.id)">
<Icon type="md-document" />详情
</a>
</p>
</Col>
</Row>
</div>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" :parents="parents" />
</Modal>
</div>
</template>
<script>
import Api from "./api";
import Search from "./search";
export default {
name: "list",
components: {
Search
},
head: {
title: "",
author: "henq",
description: "product_info 5/20/2020 3:13:51 PM"
},
props: {
parent: {
id: Number,
parentName: String
}
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: "mmcode,name,productCode", value: null }
},
modal: false,
title: "新增",
detail: null,
curId: 0,
columns: [
{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true
}
],
parents: {
parentId: null,
parentName: ""
}
};
},
mounted() {
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
this.parents.parentId = this.parent.id;
this.parents.parentName = this.parent.parentName;
alert(this.parents.parentId);
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
},
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then(r => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
cancel() {
this.curId = 0;
this.modal = false;
},
l(key) {
/*
product_info:{
mmcode:'物料编号',
drawingNo:'图号',
name:'名称',
productCode:'',
status:'',
remark:'',
madeCompany:'主承制单位',
extend:'',
productUrl:'产品图像url',
productUrlList:'产品图象列表',
}
*/
let vkey = "product_info" + "." + key;
return this.$t(vkey) || key;
}
}
};
</script>
<style lang="less">
.product-m {
.body-card {
border: 1px solid rgba(38, 128, 235, 1);
margin: 10px;
border-radius: 4px;
.title-i {
border-bottom: 1px solid #2680eb;
padding: 0 10px;
height: 35px;
line-height: 35px;
background: rgba(38, 128, 235, 0.2);
color: #2680eb;
.btn-click {
text-align: right;
}
}
.row-down {
padding: 10px;
.img-i {
background: #eee;
height: 90px;
margin-right: 15px;
}
.c div {
margin-bottom: 8px;
}
.a-icon {
text-align: right;
margin-bottom: -5px;
}
}
}
}
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show"><FormItem :label="$t('id')" prop="id"> <Input v-model="condition.id.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.creationTime.show"><FormItem :label="$t('creationTime')" prop="creationTime"> <DatePicker type="daterange" v-model="condition.creationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.creatorUserId.show"><FormItem :label="$t('creatorUserId')" prop="creatorUserId"> <Input v-model="condition.creatorUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModificationTime.show"><FormItem :label="$t('lastModificationTime')" prop="lastModificationTime"> <DatePicker type="daterange" v-model="condition.lastModificationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show"><FormItem :label="$t('lastModifierUserId')" prop="lastModifierUserId"> <Input v-model="condition.lastModifierUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.mmcode.show"><FormItem :label="l('mmcode')" prop="mmcode"> <Input v-model="condition.mmcode.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.drawingNo.show"><FormItem :label="l('drawingNo')" prop="drawingNo"> <Input v-model="condition.drawingNo.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.name.show"><FormItem :label="l('name')" prop="name"> <Input v-model="condition.name.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.productCode.show"><FormItem :label="l('productCode')" prop="productCode"> <Input v-model="condition.productCode.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.status.show"><FormItem :label="l('status')" prop="status"> <Input v-model="condition.status.value"> </Input>
</FormItem></Col>
<Col :span="24" :v-if="condition.remark.show"><FormItem :label="l('remark')" prop="remark"> <Input v-model="condition.remark.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.madeCompany.show"><FormItem :label="l('madeCompany')" prop="madeCompany"> <Input v-model="condition.madeCompany.value"> </Input>
</FormItem></Col>
<Col :span="24" :v-if="condition.productUrl.show"><FormItem :label="l('productUrl')" prop="productUrl"> <Input v-model="condition.productUrl.value"> </Input>
</FormItem></Col>
<Col :span="24" :v-if="condition.productUrlList.show"><FormItem :label="l('productUrlList')" prop="productUrlList"> <Input v-model="condition.productUrlList.value"> </Input>
</FormItem></Col>
</Row>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
condition: {
id:{op:"Equal",value:null,show:true},
creationTime:{op:"Range",value:null,show:true},
creatorUserId:{op:"Equal",value:null,show:true},
lastModificationTime:{op:"Range",value:null,show:true},
lastModifierUserId:{op:"Equal",value:null,show:true},
mmcode:{op:"Equal",value:null,show:true},
drawingNo:{op:"Equal",value:null,show:true},
name:{op:"Equal",value:null,show:true},
productCode:{op:"Equal",value:null,show:true},
status:{op:"Equal",value:null,show:true},
remark:{op:"Equal",value:null,show:true},
madeCompany:{op:"Equal",value:null,show:true},
productUrl:{op:"Equal",value:null,show:true},
productUrlList:{op:"Equal",value:null,show:true},
},
}
},
methods: {
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "product_info" + "." + key;
return this.$t(key)
}
}
}
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12"><FormItem :label="l('name')" prop="name"> <Input v-model="entity.name"> </Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('upId')" prop="upId"> <InputNumber v-model="entity.upId"></InputNumber>
</FormItem></Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
disabled: false,
entity: {name: "",
upId: null},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
v: Object,
eid: Number
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.create(this.entity).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.entity.id = 0;
});
},
l(key) {
key = "product_level" + "." + key;
return this.$t(key)
}
},
watch: {
v() {
this.entity = this.$u.clone(this.v)
},
eid(v) {
if (v > 0) {
this.load(v);
}
}
}
}
</script>
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index:`${technologyUrl}productlevel/getleveltree`,
getleveltree(params){
return Api.get(`${technologyUrl}productlevel/getleveltree`,params);
},
get(params){
return Api.get(`${technologyUrl}productlevel/get`,params);
},
create(params){
return Api.post(`${technologyUrl}productlevel/create`,params);
},
update(params){
return Api.post(`${technologyUrl}productlevel/update`,params);
},
delete(id) {
return Api.delete(`${technologyUrl}productlevel/delete`,{params:{id:id}});
},
deletes(params) {
return Api.post(`${technologyUrl}productlevel/batchdelete`,params);
}
}
\ No newline at end of file
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('name')">{{entity.name}}</Filed>
<Filed :span="12" :name="l('upId')">{{entity.upId}}</Filed>
</Row>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }],
code: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
eid: Number
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
this.$emit('on-load')
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "product_level" + "." + key;
return this.$t(key)
}
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
}
}
}
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12"><FormItem :label="l('name')" prop="name"> <Input v-model="entity.name"> </Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('upId')" prop="upId"> <InputNumber v-model="entity.upId"></InputNumber>
</FormItem></Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Edit',
data() {
return {
disabled: false,
entity: {
},
rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
eid: Number
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then(r => {
this.entity = r.result;
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.update(this.entity).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "product_level" + "." + key;
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
}
}
</script>
\ No newline at end of file
<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="data" ref="tree" @on-select-change="change"></Tree>
</div>
</div>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "",
data() {
return {
keys: "",
expand: false,
list: []
};
},
created() {
this.loadTree();
},
methods: {
loadTree() {
Api.getleveltree().then(r => {
setTree(r.result);
function setTree(data) {
data.map(u => {
u.title = u.name;
u.value = u.id;
if (u.children) {
setTree(u.children);
}
});
}
var data = r.result;
this.list = this.$u.clone(data);
});
},
toggle() {
this.expand = !this.expand;
},
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 < u.title) {
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
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show"><FormItem :label="$t('id')" prop="id"> <Input v-model="condition.id.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.creationTime.show"><FormItem :label="$t('creationTime')" prop="creationTime"> <DatePicker type="daterange" v-model="condition.creationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.creatorUserId.show"><FormItem :label="$t('creatorUserId')" prop="creatorUserId"> <Input v-model="condition.creatorUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModificationTime.show"><FormItem :label="$t('lastModificationTime')" prop="lastModificationTime"> <DatePicker type="daterange" v-model="condition.lastModificationTime.value"></DatePicker>
</FormItem></Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show"><FormItem :label="$t('lastModifierUserId')" prop="lastModifierUserId"> <Input v-model="condition.lastModifierUserId.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.name.show"><FormItem :label="l('name')" prop="name"> <Input v-model="condition.name.value"> </Input>
</FormItem></Col>
<Col :span="12" :v-if="condition.upId.show"><FormItem :label="l('upId')" prop="upId"> <Input v-model="condition.upId.value"> </Input>
</FormItem></Col>
</Row>
</Form>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
condition: {
id:{op:"Equal",value:null,show:true},
creationTime:{op:"Range",value:null,show:true},
creatorUserId:{op:"Equal",value:null,show:true},
lastModificationTime:{op:"Range",value:null,show:true},
lastModifierUserId:{op:"Equal",value:null,show:true},
name:{op:"Equal",value:null,show:true},
upId:{op:"Equal",value:null,show:true},
},
}
},
methods: {
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "product_level" + "." + key;
return this.$t(key)
}
}
}
</script>
\ 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