4 changed files with 347 additions and 150 deletions
@ -0,0 +1,128 @@ |
|||
<template> |
|||
<div class="search"> |
|||
<Card> |
|||
<Row type="flex" justify="space-between"> |
|||
<Table :loading="loading" border :columns="columns" :data="data" :size="tableSize" sortable="custom" |
|||
ref="table"></Table> |
|||
<Row type="flex" justify="end" class="page"> |
|||
<Page :current="searchForm.pageNum" :total="total" :page-size="searchForm.pageSize" |
|||
@on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" |
|||
size="small" show-total show-elevator show-sizer></Page> |
|||
</Row> |
|||
</Col> |
|||
</Row> |
|||
</Card> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
getShareList |
|||
} from "@/api/app"; |
|||
export default { |
|||
name: "dic-manage", |
|||
data() { |
|||
return { |
|||
searchForm:{ |
|||
categoryId: "", |
|||
delFlag: 1, |
|||
pageNum: 1, |
|||
pageSize: "100", |
|||
shopId: "" |
|||
}, |
|||
columns: [ |
|||
// 表头 |
|||
{ |
|||
type: "selection", |
|||
width: 60, |
|||
align: "center", |
|||
}, |
|||
{ |
|||
type: "index", |
|||
width: 60, |
|||
align: "center", |
|||
}, |
|||
{ |
|||
title: "图片", |
|||
key: "productPicture", |
|||
minWidth: 60, |
|||
render: (h, params) => { |
|||
return h("img", { |
|||
attrs: { |
|||
src: params.row.productPicture, |
|||
}, |
|||
style: { |
|||
cursor: "zoom-in", |
|||
width: "80px", |
|||
height: "60px", |
|||
margin: "10px 0", |
|||
"object-fit": "contain", |
|||
}, |
|||
on: { |
|||
click: () => { |
|||
this.showPic(params.row); |
|||
}, |
|||
}, |
|||
}); |
|||
}, |
|||
}, |
|||
{ |
|||
title: "名称", |
|||
key: "productName", |
|||
minWidth: 60, |
|||
}, |
|||
{ |
|||
title: "排名", |
|||
key: "orderFiled", |
|||
width: 100, |
|||
}, |
|||
{ |
|||
title: "操作", |
|||
key: "action", |
|||
width: 350, |
|||
align: "center", |
|||
fixed: "right", |
|||
render: (h, params) => { |
|||
return h("div", [ |
|||
h( |
|||
"a", { |
|||
on: { |
|||
click: () => { |
|||
this.checkGoods(params.row); |
|||
}, |
|||
}, |
|||
}, |
|||
"选择" |
|||
), |
|||
]); |
|||
}, |
|||
}, |
|||
], |
|||
data: [], //表单数据 |
|||
total: 0, // 表单数据总数 |
|||
}; |
|||
}, |
|||
methods: { |
|||
init(v) { |
|||
console.log(v) |
|||
this.searchForm.shopId = JSON.parse(v).id |
|||
this.getDataList() |
|||
}, |
|||
getDataList() { |
|||
getShareList(this.searchForm).then((res) => { |
|||
if (res.success) { |
|||
this.data = res.result.records; |
|||
this.total = res.result.total; |
|||
if (this.data.length == 0 && this.searchForm.pageNum > 1) { |
|||
this.searchForm.pageNum -= 1; |
|||
this.getDataList(); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
checkGoods(v){ |
|||
this.$emit('on-submit1',v) |
|||
} |
|||
}, |
|||
}; |
|||
</script> |
|||
@ -1,126 +1,114 @@ |
|||
<template> |
|||
<div> |
|||
<Select |
|||
v-model="currentValue" |
|||
:size="size" |
|||
:loading="loading" |
|||
:placeholder="placeholder" |
|||
:multiple="multiple" |
|||
:disabled="disabled" |
|||
:filterable="filterable" |
|||
:transfer="transfer" |
|||
:clearable="clearable" |
|||
:placement="placement" |
|||
:transfer-class-name="transferClassName" |
|||
:prefix="prefix" |
|||
:max-tag-count="maxTagCount" |
|||
:max-tag-placeholder="maxTagPlaceholder" |
|||
@on-change="handleChange" |
|||
@on-query-change="handleQueryChange" |
|||
@on-clear="handleClear" |
|||
@on-open-change="handleOpenChange" |
|||
@on-select="handleSelect" |
|||
> |
|||
<Option v-for="(item, i) in dictData" :key="i" :value="item.value">{{ |
|||
<div> |
|||
<Select v-model="currentValue" :size="size" :loading="loading" :placeholder="placeholder" :multiple="multiple" |
|||
:disabled="disabled" :filterable="filterable" :transfer="transfer" :clearable="clearable" |
|||
:placement="placement" :transfer-class-name="transferClassName" :prefix="prefix" |
|||
:max-tag-count="maxTagCount" :max-tag-placeholder="maxTagPlaceholder" @on-change="handleChange" |
|||
@on-query-change="handleQueryChange" @on-clear="handleClear" @on-open-change="handleOpenChange" |
|||
@on-select="handleSelect"> |
|||
<Option v-for="(item, i) in dictData" :key="i" :value="item.value">{{ |
|||
item.title |
|||
}}</Option> |
|||
</Select> |
|||
</div> |
|||
</Select> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { getDictDataByType } from "@/api/index"; |
|||
export default { |
|||
name: "dict", |
|||
props: { |
|||
value: "", |
|||
dict: String, |
|||
placeholder: { |
|||
type: String, |
|||
default: "请选择", |
|||
}, |
|||
placement: { |
|||
type: String, |
|||
default: "bottom-start", |
|||
}, |
|||
size: String, |
|||
multiple: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
disabled: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
filterable: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
transfer: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
transferClassName: String, |
|||
prefix: String, |
|||
maxTagCount: Number, |
|||
maxTagPlaceholder: Function, |
|||
clearable: { |
|||
type: Boolean, |
|||
default: true, |
|||
}, |
|||
}, |
|||
data() { |
|||
return { |
|||
currentValue: this.value, |
|||
dictData: [], |
|||
loading: false, |
|||
}; |
|||
}, |
|||
methods: { |
|||
getData(v) { |
|||
this.loading = true; |
|||
getDictDataByType(v).then((res) => { |
|||
this.loading = false; |
|||
if (res.success) { |
|||
this.dictData = res.result; |
|||
} |
|||
}); |
|||
}, |
|||
handleChange(v) { |
|||
this.$emit("input", v); |
|||
this.$emit("on-change", v); |
|||
}, |
|||
handleQueryChange(v) { |
|||
this.$emit("on-query-change", v); |
|||
}, |
|||
handleClear() { |
|||
this.$emit("on-clear", ""); |
|||
}, |
|||
handleOpenChange(v) { |
|||
this.$emit("on-open-change", v); |
|||
}, |
|||
handleSelect(v) { |
|||
this.$emit("on-select", v); |
|||
}, |
|||
setCurrentValue(value) { |
|||
if (value === this.currentValue) { |
|||
return; |
|||
} |
|||
this.currentValue = value; |
|||
this.$emit("on-change", this.currentValue); |
|||
}, |
|||
}, |
|||
watch: { |
|||
value(val) { |
|||
this.setCurrentValue(val); |
|||
}, |
|||
dict(val) { |
|||
this.getData(val); |
|||
}, |
|||
}, |
|||
mounted() { |
|||
this.getData(this.dict); |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
import { |
|||
getDictDataByType |
|||
} from "@/api/index"; |
|||
export default { |
|||
name: "dict", |
|||
props: { |
|||
value: "", |
|||
dict: String, |
|||
placeholder: { |
|||
type: String, |
|||
default: "请选择", |
|||
}, |
|||
placement: { |
|||
type: String, |
|||
default: "bottom-start", |
|||
}, |
|||
size: String, |
|||
multiple: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
disabled: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
filterable: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
transfer: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
transferClassName: String, |
|||
prefix: String, |
|||
maxTagCount: Number, |
|||
maxTagPlaceholder: Function, |
|||
clearable: { |
|||
type: Boolean, |
|||
default: true, |
|||
}, |
|||
}, |
|||
data() { |
|||
return { |
|||
currentValue: this.value, |
|||
dictData: [], |
|||
loading: false, |
|||
}; |
|||
}, |
|||
methods: { |
|||
getData(v) { |
|||
this.loading = true; |
|||
|
|||
getDictDataByType(v).then((res) => { |
|||
this.loading = false; |
|||
if (res.success) { |
|||
this.dictData = res.result; |
|||
} |
|||
}); |
|||
|
|||
}, |
|||
handleChange(v) { |
|||
this.$emit("input", v); |
|||
this.$emit("on-change", v); |
|||
}, |
|||
handleQueryChange(v) { |
|||
this.$emit("on-query-change", v); |
|||
}, |
|||
handleClear() { |
|||
this.$emit("on-clear", ""); |
|||
}, |
|||
handleOpenChange(v) { |
|||
this.$emit("on-open-change", v); |
|||
}, |
|||
handleSelect(v) { |
|||
this.$emit("on-select", v); |
|||
}, |
|||
setCurrentValue(value) { |
|||
if (value === this.currentValue) { |
|||
return; |
|||
} |
|||
this.currentValue = value; |
|||
this.$emit("on-change", this.currentValue); |
|||
}, |
|||
}, |
|||
watch: { |
|||
value(val) { |
|||
this.setCurrentValue(val); |
|||
}, |
|||
dict(val) { |
|||
this.getData(val); |
|||
}, |
|||
}, |
|||
mounted() { |
|||
this.getData(this.dict); |
|||
}, |
|||
}; |
|||
</script> |
|||
Loading…
Reference in new issue