Commit 1f591d42 by zhangquan

bug修复

1 parent 520e048b
......@@ -62,6 +62,6 @@ export function getMerchantListByScene(data) {
//获取品牌列表
export function getBrandList(data) {
data.method = `dj.api.smartcarlife.common.car.brand.list`
data.method = `dj.api.smartcarlife.common.car.brand.page`
return request(data)
}
......@@ -262,7 +262,11 @@ export const Util = {
// return
const Temp = document.createElement("a")
// Temp.href = process.env.VUE_APP_BASE_URL + '/article/export.do?articleId=' + row.id
url = url + `${url.includes('?') ? '&' : '?'}` + "timestamp=" + new Date().getTime()
url =
url +
`${url.includes("?") ? "&" : "?"}` +
"timestamp=" +
new Date().getTime()
Temp.href = url
// console.log(url)
// console.log(Temp.href)
......@@ -339,6 +343,34 @@ export const Util = {
num += ".00"
}
return num
},
getExplorer: function () {
var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = "IE"
} else if (ua.match(/firefox/) != null) {
browserType = "火狐"
} else if (ua.match(/ubrowser/) != null) {
browserType = "UC"
} else if (ua.match(/opera/) != null) {
browserType = "欧朋"
} else if (ua.match(/bidubrowser/) != null) {
browserType = "百度"
} else if (ua.match(/metasr/) != null) {
browserType = "搜狗"
} else if (
ua.match(/tencenttraveler/) != null ||
ua.match(/qqbrowse/) != null
) {
browserType = "QQ"
} else if (ua.match(/maxthon/) != null) {
browserType = "遨游"
} else {
browserType = "谷歌"
}
return browserType
}
}
......@@ -349,3 +381,4 @@ export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone
export const downLoadFile = Util.downLoadFile
export const returnFloat = Util.returnFloat
export const getExplorer = Util.getExplorer
<!-- 关联门店弹窗 -->
<template>
<d2-dialog
:isVisible="dialogVisible"
class="accountDailog"
title="选择品牌"
width="720px"
@confirmDialog="handleAddConfirm"
@closeDialog="handleClose"
:is-visible.sync="relateStoreVisible"
width="70%"
btn-ok-label="确定"
@confirmDialog="handleRelateStoreConfirm"
@closeDialog="handleRelateStoreClose"
class="relateStore"
>
<div class="tableBox">
<!-- <div style="padding: 10px 50px">
<el-form :model="storeSearchForm" ref="relate" :inline="true">
<el-form-item label="门店名称:">
<el-input
v-model="realSearchForm.label"
placeholder="搜索品牌名称"
maxlength="20"
v-model.trim="storeSearchForm.label"
placeholder="门店名称"
@keydown.native="handleStoreInput"
clearable
size="small"
style="width: 300px; margin-right: 12px"
/>
<el-button size="small" type="primary" @click="searchList">
查询
</el-button>
</div> -->
<d2-table
class="table"
ref="brandTable"
:table-params="tableParams"
:tableData="tableData"
:hasPage="false"
</el-form-item>
<el-button type="primary" @click="handleSearchStore">搜索</el-button>
</el-form>
<el-row class="tableCon">
<div class="tableBox">
<el-table
ref="seletingTable"
:data="selectingData"
height="464px"
class="table"
border
@select="handleChange"
@select-all="handleAll"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column prop="label" label="品牌名称" align="center">
</el-table-column>
</el-table>
<el-pagination
small
background
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="pageSize"
layout="total, prev, pager, next"
:total="total"
/>
</div>
<el-table
class="tableBox table"
:data="selectedData"
border
height="464px"
>
</d2-table>
</div>
<el-table-column prop="merchantName" label="品牌名称" align="center">
<template slot-scope="scope">
<span>{{ scope.row.label }}</span>
</template>
</el-table-column>
<el-table-column label="删除" align="center" width="50px">
<template slot-scope="scope">
<el-button
class="el-icon-delete"
@click="handleDelete(scope.row)"
type="text"
/>
</template>
</el-table-column>
</el-table>
</el-row>
</d2-dialog>
</template>
<script>
import {
getAllMerchantList,
getMerchantListByScene,
getBrandList
} from "@api/contentManager"
import { deepClone } from "@/common/util"
import { getBrandList } from "@api/contentManager"
export default {
name: "SelectGoodsTypeDialog",
name: "RelateStoreDialog",
data() {
return {
selectedData: [],
selectingData: [],
// 分页
total: 0,
currentPage: 1,
pageSize: 20,
storeSearchForm: {}
}
},
props: {
dialogVisible: {
relateStoreVisible: {
type: Boolean,
default: false
},
selectedRecord: {
storeSelected: {
type: Array,
default: () => []
}
},
data() {
return {
realSearchForm: {
label: ""
},
tableData: [],
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
mutiSelectUniqueKey: "id",
mutiSelectName: "brandIndex",
tableColumns: [
{
label: "品牌名称",
prop: "label"
}
]
}
}
},
mounted() {
this.getList()
this.selectedData = this.storeSelected
this.getSelectingList()
},
methods: {
getList() {
getBrandList({ label: "奥迪" }).then((res) => {
console.log(res)
if (res?.length) {
this.sourceData = res
this.tableData = res
}
recoverySelection() {
var exitIds = this.selectedData.map((item) => item.id)
this.selectingData.forEach((item) => {
exitIds.includes(item.id) &&
this.$refs.seletingTable.toggleRowSelection(item, true)
})
},
searchList() {
if (this.realSearchForm.label) {
this.tableData = this.sourceData.filter((item) => {
return item.label?.indexOf(this.realSearchForm.label) > -1
getSelectingList() {
getBrandList({
...this.storeSearchForm,
currentPage: this.currentPage,
pageSize: this.pageSize
}).then((res) => {
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
} else {
this.tableData = deepClone(this.sourceData)
}
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find((item) => item.id === row.id)
addOrDelete
? this.selectedData.push(row)
: (this.selectedData = this.selectedData.filter(
(item) => item.id !== row.id
))
},
handleAll(selection) {
this.selectingData.forEach((item) => {
var isExit = this.selectedData.findIndex(
(subItem) => subItem.id === item.id
)
if (selection.length && isExit === -1) {
this.selectedData.push(item)
} else if (!selection.length && isExit !== -1) {
this.selectedData.splice(isExit, 1)
}
})
},
handleDelete(row) {
this.selectedData = this.selectedData.filter((item) => item.id !== row.id)
const obj = this.selectingData.find((v) => v.id == row.id)
this.$refs.seletingTable.toggleRowSelection(obj)
},
changeEvent(e) {
console.log(e)
handleCurrentChange(val) {
this.currentPage = val
this.getSelectingList()
},
handleAddConfirm() {
const selectItemList =
this.$refs.brandTable?.mutiSelectArr?.[
this.tableParams.mutiSelectName
] || []
if (selectItemList.length) {
this.$emit("confirmDialogFn", selectItemList)
} else {
this.$message.error("请勾选品牌")
}
handleRelateStoreConfirm() {
this.$emit("handleRelateStoreConfirm", this.selectedData)
},
handleClose() {
this.$emit("closeDialogFn")
handleRelateStoreClose() {
this.$emit("handleRelateStoreClose")
}
}
}
</script>
<style scoped lang="scss">
.table {
::v-deep .el-table__body-wrapper {
height: 400px;
overflow-y: auto;
<style lang="scss">
.relateStore .table {
margin: 0 auto 20px !important;
width: 98%;
}
.relateStore .tableCon {
margin-top: 20px;
display: flex;
.tableBox {
flex: 1;
}
}
.service-store .relateStore .el-table .cell,
.d2-form .relateStore .el-table .cell {
line-height: 26px !important;
}
.service-store .relateStore .el-table--medium td,
.d2-form .relateStore .el-table--medium td {
padding: 6px 8px !important;
}
.relateStore .red {
color: red;
}
.relateStore .tip-icon {
position: absolute;
display: inline-block;
height: 10px;
width: 10px;
line-height: 10px;
color: #ffffff;
background-color: red;
border: 1px solid red;
border-radius: 50%;
cursor: pointer;
font-size: 6px;
margin-left: 2px;
}
</style>
......@@ -204,13 +204,6 @@
>
</div>
</div>
<!-- <merchantDialog
v-if="merchantVisible"
:dialogVisible="merchantVisible"
:config="{ scene: formData.scene, type: formData.showMerchant }"
@confirmDialogFn="confirmDialogFn"
@closeDialogFn="closeDialogFn"
></merchantDialog> -->
<relate-store-dialog
v-if="relateStoreVisible"
ref="formRelateStore"
......@@ -264,10 +257,13 @@
</relate-store-dialog>
<brandDialog
v-if="brandVisible"
:dialogVisible="brandVisible"
@confirmDialogFn="confirmDialogFn"
@closeDialogFn="closeDialogFn"
></brandDialog>
ref="brandRef"
:relate-store-visible="brandVisible"
:store-selected="storeSelected"
@handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose"
>
</brandDialog>
<el-dialog :visible.sync="lookImgVisible">
<img width="100%" :src="dialogObj.url" alt="图片" />
</el-dialog>
......@@ -520,7 +516,8 @@ export default {
},
commitFn(type) {
const params = this.getParams(type)
addContent(params).then((res) => {
const _api = params.id ? updateContent : addContent
_api(params).then((res) => {
if (res) {
this.$message.success(
`${!type ? "保存草稿" : params.id ? "修改" : "新增"}成功`
......@@ -546,14 +543,17 @@ export default {
},
handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) {
return this.$message.error("请选择门店")
return this.$message.error(
`请选择${this.formData.showMerchant == 1 ? "品牌" : "门店"}`
)
}
this.$refs.channelForm.clearValidate("showMerchant")
this.tableData = selectedData
this.relateStoreVisible = false
this.handleRelateStoreClose()
},
handleRelateStoreClose() {
this.relateStoreVisible = false
this.brandVisible = false
},
handleStoreInput(e) {
e.keyCode === 13 && this.handleSearchStore()
......@@ -561,17 +561,6 @@ export default {
handleSearchStore() {
this.$refs.formRelateStore.handleCurrentChange(1)
},
confirmDialogFn(e) {
this.closeDialogFn()
this.$refs.channelForm.clearValidate("showMerchant")
this.$nextTick(() => {
this.tableData = e || []
})
},
closeDialogFn() {
this.merchantVisible = false
this.brandVisible = false
},
delMerchant(row, idx) {
this.tableData.splice(idx, 1)
}
......
......@@ -280,7 +280,7 @@ export default {
var params = { currentPage: 1, pageSize: 2000, merchantIdName: "" }
this.getBaseData()
getMerchantList(params).then((res) => {
this.getSetMerchant(res.list || [])
this.getSetMerchant(res || [])
})
},
......
......@@ -34,7 +34,11 @@
<script>
import { Util, deepClone } from "@/common/util"
import { getStatisticsList, exportStatisticsList,getMerchantList } from "@api/contentManager"
import {
getStatisticsList,
exportStatisticsList,
getMerchantList
} from "@api/contentManager"
export default {
name: "contentManagerList",
data() {
......@@ -105,7 +109,7 @@ export default {
var params = { currentPage: 1, pageSize: 2000, merchantIdName: "" }
getMerchantList(params)
.then((res) => {
this.getBaseData(res.list)
this.getBaseData(res)
})
.catch(() => {
this.getBaseData([])
......@@ -150,7 +154,7 @@ export default {
exportStatisticsList(params).then((res) => {
console.log(res, "res")
// window.open(res)
let tempaa = utils.getExplorer()
let tempaa = Util.getExplorer()
if (tempaa == "QQ") {
window.open(res)
} else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!