Commit 0ad3cee5 authored by renjintao's avatar renjintao

supporting

parent 6f7b2dfd
<template> <template>
<div class="product-m"> <div class="product-m">
<DataGrid <DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch" :type="typeInfo" :high="false" :span="6" :lazy="true" exportTitle="产品管理">
:columns="columns" <template slot="easySearch">
ref="grid" <Form ref="formInline" :model="easySearch" inline>
:action="action" <FormItem prop="keys">
:conditions="easySearch" <Input placeholder="请输入物料编号/名称" v-model="easySearch.keys.value" />
:type="typeInfo" </FormItem>
:high="false" <FormItem>
:span="6" <Button type="primary" @click="search">查询</Button>
:lazy="true" </FormItem>
> </Form>
<template slot="easySearch"> </template>
<Form ref="formInline" :model="easySearch" inline> <template slot="searchForm">
<FormItem prop="keys"> <Search />
<Input placeholder="请输入物料编号/名称" v-model="easySearch.keys.value" /> </template>
</FormItem> <template slot="buttons">
<FormItem> <Button type="primary" @click="add">新增</Button>&nbsp;
<Button type="primary" @click="search">查询</Button> </template>
</FormItem> <template slot="buttons">
</Form> <Button :icon="iconInfo" shape="circle" :title="titleInfo" @click="changeShwo"></Button>
</template> </template>
<template slot="searchForm"> <template slot="card" slot-scope="{row}">
<Search /> <div class="body-card">
</template> <Row class="title-i">
<template slot="buttons"> <Col :span="16">
<Button type="primary" @click="add">新增</Button>&nbsp; <Ellipsis :text="row.name" :length="12" tooltip />
</template> </Col>
<template slot="buttons"> <Col :span="8" class="btn-click">{{row.mmcode}}</Col>
<Button :icon="iconInfo" shape="circle" :title="titleInfo" @click="changeShwo"></Button> </Row>
</template> <Row class="row-down" :gutter="10">
<template slot="card" slot-scope="{row}"> <Col span="7">
<div class="body-card"> <div class="img-i">
<Row class="title-i"> <img :src="downUrl +row.productUrl" v-if="row.productUrl" />
<Col :span="16"> <!-- onerror="this.src='/imgicon/chan_Pin.png'" -->
<Ellipsis :text="row.name" :length="12" tooltip /> <img src="@/assets/imgicon/chan_Pin.png" v-else width="100%" height="100%" />
</Col> </div>
<Col :span="8" class="btn-click">{{row.mmcode}}</Col> </Col>
</Row> <Col span="17" class="c">
<Row class="row-down" :gutter="10"> <div>分类:{{row.levelTitle}}</div>
<Col span="7"> <div>图号:{{row.drawingNo}}</div>
<div class="img-i"> <div>主制单位:{{row.madeCompanyTitle}}</div>
<img :src="downUrl +row.productUrl" v-if="row.productUrl" /> <p class="a-icon">
<!-- onerror="this.src='/imgicon/chan_Pin.png'" --> <a @click="bom(row)">
<img src="@/assets/imgicon/chan_Pin.png" v-else width="100%" height="100%" /> <Icon type="md-git-merge" />BOM
</div> </a>&nbsp;
</Col> <a @click="edit(row)">
<Col span="17" class="c"> <Icon type="md-create" />编辑
<div>分类:{{row.levelTitle}}</div> </a>&nbsp;
<div>图号:{{row.drawingNo}}</div> <a @click="remove(row)">
<div>主制单位:{{row.madeCompanyTitle}}</div> <Icon type="ios-trash" />删除
<p class="a-icon"> </a>&nbsp;
<a @click="bom(row)"> <a @click="view(row)">
<Icon type="md-git-merge" />BOM <Icon type="md-document" />详情
</a>&nbsp; </a>
<a @click="edit(row)"> </p>
<Icon type="md-create" />编辑 </Col>
</a>&nbsp; </Row>
<a @click="remove(row)"> </div>
<Icon type="ios-trash" />删除 </template>
</a>&nbsp;
<a @click="view(row)">
<Icon type="md-document" />详情
</a>
</p>
</Col>
</Row>
</div>
</template>
</DataGrid> </DataGrid>
<Modal <Modal v-model="modal" :title="title" width="1200" footer-hide :fullscreen="fullscreen" :mask-closable="false">
v-model="modal" <component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" :parents="parent" />
:title="title"
width="1200"
footer-hide
:fullscreen="fullscreen"
:mask-closable="false"
>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" :parents="parent" />
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Search from "./search"; import Search from "./search";
export default { export default {
name: "list", name: "list",
components: { components: {
Search, Search,
}, },
head: { head: {
title: "", title: "",
author: "henq", author: "henq",
description: "product_info 5/20/2020 3:13:51 PM", description: "product_info 5/20/2020 3:13:51 PM",
},
props: {
parent: {
id: Number,
parentName: String,
ids: String,
bomId: Number,
}, },
}, props: {
data() { parent: {
return { id: Number,
action: Api.index, parentName: String,
fullscreen: false, ids: String,
easySearch: { bomId: Number,
keys: { op: "mmcode,name", value: null },
levelId: { op: "In", value: this.id },
upId: { op: "In", value: 0 },
},
modal: false,
title: "新增",
detail: null,
downUrl: fileUrlDown,
curId: 0,
columns: [
{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true,
}, },
{ },
title: this.l("name"), data() {
key: "name", return {
action: Api.index,
fullscreen: false,
easySearch: {
keys: {
op: "mmcode,name",
value: null
},
levelId: {
op: "In",
value: this.id
},
upId: {
op: "In",
value: 0
},
},
modal: false,
title: "新增",
detail: null,
downUrl: fileUrlDown,
curId: 0,
columns: [{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true,
},
{
title: this.l("name"),
key: "name",
align: "left", align: "left",
}, },
{
key: "mmcode",
title: this.l("mmcode"),
align: "center",
high: true,
},
{
key: "productUrl",
title: this.l("productUrl"),
align: "left",
high: true,
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"a",
{ {
attrs: { key: "mmcode",
oprate: "detail", title: this.l("mmcode"),
// href: this.fileUrlPath, align: "center",
// target: "_blank" high: true,
}, },
on: { {
click: () => { key: "productUrl",
this.downFile(params.row.productUrl); title: this.l("productUrl"),
align: "left",
high: true,
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(
"a", {
attrs: {
oprate: "detail",
// href: this.fileUrlPath,
// target: "_blank"
},
on: {
click: () => {
this.downFile(params.row.productUrl);
},
},
},
"查看图片"
),
]);
}, },
},
}, },
"查看图片"
),
]);
},
},
{
key: "levelTitle",
title: this.l("levelTitle"),
align: "left",
high: true,
},
{
key: "drawingNo",
title: this.l("drawingNo"),
align: "right",
high: true,
},
{
key: "madeCompanyTitle",
title: this.l("madeCompanyTitle"),
align: "center",
width: 260,
high: true,
},
{
title: "操作",
key: "action",
width: 200,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "levelTitle",
on: { title: this.l("levelTitle"),
click: () => this.bom(params.row), align: "left",
}, high: true,
}, },
"BOM"
),
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "drawingNo",
on: { title: this.l("drawingNo"),
click: () => this.edit(params.row), align: "right",
}, high: true,
}, },
"编辑"
),
h(
"op",
{ {
attrs: { oprate: "delete" }, key: "madeCompanyTitle",
on: { click: () => this.remove(params.row) }, title: this.l("madeCompanyTitle"),
align: "center",
width: 260,
high: true,
}, },
"删除"
),
h(
"op",
{ {
attrs: { oprate: "view" }, title: "操作",
on: { key: "action",
click: () => this.view(params.row), width: 200,
}, align: "center",
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.bom(params.row),
},
},
"BOM"
),
h(
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row),
},
},
"编辑"
),
h(
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row)
},
},
"删除"
),
h(
"op", {
attrs: {
oprate: "view"
},
on: {
click: () => this.view(params.row),
},
},
"详情"
),
]);
},
}, },
"详情" ],
), typeInfo: "card",
]); iconInfo: "md-apps",
}, titleInfo: "卡片模式",
}, };
],
typeInfo: "card",
iconInfo: "md-apps",
titleInfo: "卡片模式",
};
},
mounted() {
this.$refs.grid.reload(this.easySearch);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
changeShwo() {
//显示模式切换
if (this.typeInfo == "card") {
this.typeInfo = "table";
this.iconInfo = "md-list";
this.titleInfo = "列表模式";
} else {
this.typeInfo = "card";
this.iconInfo = "md-apps";
this.titleInfo = "卡片模式";
}
},
downFile(url) {
let url1 = this.downUrl + url;
if (url) {
window.open(url1, "_blank");
} else {
this.$Message.error("暂无图片");
}
},
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
if (this.parent.id) {
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
this.fullscreen = false;
} else {
this.$Message.error("请先选择产品分类");
}
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
this.fullscreen = false;
},
view(row) {
this.curId = row.id;
this.parent.id = row.levelId;
this.parent.parentName = row.levelTitle;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
this.fullscreen = false;
},
edit(row) {
this.curId = row.id;
this.parent.id = row.levelId;
this.parent.parentName = row.levelTitle;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
this.fullscreen = false;
}, },
bom(row) { mounted() {
this.curId = row.id; this.$refs.grid.reload(this.easySearch);
this.parent.bomId = row.bomId;
this.parent.id = row.levelId;
this.parent.parentName = row.levelTitle;
this.title = "BOM";
this.detail = () => import("./bom");
this.modal = true;
this.fullscreen = true;
}, },
remove(row) { async fetch({
Api.delete(row.bomId).then((r) => { store,
if (r.success) { params
this.$refs.grid.load(); }) {
this.$Message.success("删除成功"); await store.dispatch("loadDictionary"); // 加载数据字典
}
});
}, },
cancel() { methods: {
this.curId = 0; changeShwo() {
this.modal = false; //显示模式切换
}, if (this.typeInfo == "card") {
l(key) { this.typeInfo = "table";
let vkey = "product_info" + "." + key; this.iconInfo = "md-list";
return this.$t(vkey) || key; this.titleInfo = "列表模式";
} else {
this.typeInfo = "card";
this.iconInfo = "md-apps";
this.titleInfo = "卡片模式";
}
},
downFile(url) {
let url1 = this.downUrl + url;
if (url) {
window.open(url1, "_blank");
} else {
this.$Message.error("暂无图片");
}
},
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
if (this.parent.id) {
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
this.fullscreen = false;
} else {
this.$Message.error("请先选择产品分类");
}
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
this.fullscreen = false;
},
view(row) {
this.curId = row.id;
this.parent.id = row.levelId;
this.parent.parentName = row.levelTitle;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
this.fullscreen = false;
},
edit(row) {
this.curId = row.id;
this.parent.id = row.levelId;
this.parent.parentName = row.levelTitle;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
this.fullscreen = false;
},
bom(row) {
this.curId = row.id;
this.parent.bomId = row.bomId;
this.parent.id = row.levelId;
this.parent.parentName = row.levelTitle;
this.title = "BOM";
this.detail = () => import("./bom");
this.modal = true;
this.fullscreen = true;
},
remove(row) {
Api.delete(row.bomId).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
cancel() {
this.curId = 0;
this.modal = false;
},
l(key) {
let vkey = "product_info" + "." + key;
return this.$t(vkey) || key;
},
}, },
}, watch: {
watch: { "parent.id"(v) {
"parent.id"(v) { if (v) {
if (v) { let data = {
let data = { levelId: {
levelId: { op: "In", value: this.parent.ids }, op: "In",
upId: { op: "In", value: 0 }, value: this.parent.ids
}; },
this.$refs.grid.reload(data); upId: {
} op: "In",
value: 0
},
};
this.$refs.grid.reload(data);
}
},
}, },
},
}; };
</script> </script>
<style lang="less"> <style lang="less">
.product-m { .product-m {
.body-card { .body-card {
border: 1px solid rgba(38, 128, 235, 1); border: 1px solid rgba(38, 128, 235, 1);
margin: 10px; margin: 10px;
border-radius: 4px; border-radius: 4px;
.title-i {
border-bottom: 1px solid #2680eb; .title-i {
padding: 0 10px; border-bottom: 1px solid #2680eb;
height: 35px; padding: 0 10px;
line-height: 35px; height: 35px;
background: rgba(38, 128, 235, 0.2); line-height: 35px;
color: #2680eb; background: rgba(38, 128, 235, 0.2);
.btn-click { color: #2680eb;
text-align: right;
} .btn-click {
} text-align: right;
.row-down { }
padding: 10px; }
.img-i {
width: 90px; .row-down {
background: #eee; padding: 10px;
height: 90px;
margin-right: 15px; .img-i {
// overflow: hidden; width: 90px;
img { background: #eee;
width: 90px; height: 90px;
height: 90px; margin-right: 15px;
// overflow: hidden;
img {
width: 90px;
height: 90px;
}
}
.c div {
margin-bottom: 8px;
}
.a-icon {
text-align: right;
margin-bottom: -5px;
}
} }
}
.c div {
margin-bottom: 8px;
}
.a-icon {
text-align: right;
margin-bottom: -5px;
}
} }
}
} }
</style> </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