index.vue
2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<template>
<d2-dialog
:is-visible="dialogVisible"
class="accountDailog"
title="选择门店"
width="720px"
@confirmDialog="handleAddConfirm"
@closeDialog="handleClose">
<div class="tableBox">
<div style="padding: 10px 50px">
<el-input
v-model="realSearchForm.merchantIdName"
placeholder="搜索门店名称"
maxlength="20"
clearable
size="small"
style="width: 300px; margin-right: 12px" />
<el-button size="small" type="primary" @click="searchList">
查询
</el-button>
</div>
<d2-table
ref="merchantTable"
:search-form="realSearchForm"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn">
</d2-table>
</div>
</d2-dialog>
</template>
<script>
import {
getAllMerchantList,
getMerchantListByScene,
getBrandList
} from "@api/contentManager"
import { deepClone } from "@/common/util"
export default {
name: "SelectGoodsTypeDialog",
props: {
config: {
type: Object,
require: true
},
dialogVisible: {
type: Boolean,
default: false
},
selectedRecord: {
type: Array,
default: () => []
}
},
data() {
return {
getListApi: getAllMerchantList,
realSearchForm: {
merchantIdName: ""
},
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
mutiSelectUniqueKey: "id",
mutiSelectName: "merchantIndex",
tableColumns: [
{
label: "门店名称",
prop: "merchantName"
}
]
}
}
},
mounted() {},
methods: {
beforeSearchFn() {
return new Promise((resolve) => {
if (this.config.scene == 0 || this.config.scene == 4) {
this.getListApi = getAllMerchantList
} else {
this.getListApi = getMerchantListByScene
this.realSearchForm.scene = this.config.scene
}
resolve()
})
},
searchList() {
this.$refs?.merchantTable?.refreshTable(true, true)
},
handleAddConfirm() {
const selectItemList =
this.$refs.merchantTable?.mutiSelectArr?.[
this.tableParams.mutiSelectName
] || []
if (selectItemList.length) {
this.$emit("confirmDialogFn", selectItemList)
} else {
this.$message.error("请勾选门店")
}
},
handleClose() {
this.$emit("closeDialogFn")
}
}
}
</script>
<style></style>