Commit 1f591d42 by zhangquan

bug修复

1 parent 520e048b
...@@ -62,6 +62,6 @@ export function getMerchantListByScene(data) { ...@@ -62,6 +62,6 @@ export function getMerchantListByScene(data) {
//获取品牌列表 //获取品牌列表
export function getBrandList(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) return request(data)
} }
...@@ -262,7 +262,11 @@ export const Util = { ...@@ -262,7 +262,11 @@ export const Util = {
// return // return
const Temp = document.createElement("a") const Temp = document.createElement("a")
// Temp.href = process.env.VUE_APP_BASE_URL + '/article/export.do?articleId=' + row.id // 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 Temp.href = url
// console.log(url) // console.log(url)
// console.log(Temp.href) // console.log(Temp.href)
...@@ -339,6 +343,34 @@ export const Util = { ...@@ -339,6 +343,34 @@ export const Util = {
num += ".00" num += ".00"
} }
return num 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 ...@@ -349,3 +381,4 @@ export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone export const deepClone = Util.deepClone
export const downLoadFile = Util.downLoadFile export const downLoadFile = Util.downLoadFile
export const returnFloat = Util.returnFloat export const returnFloat = Util.returnFloat
export const getExplorer = Util.getExplorer
<!-- 关联门店弹窗 -->
<template> <template>
<d2-dialog <d2-dialog
:isVisible="dialogVisible"
class="accountDailog"
title="选择品牌" title="选择品牌"
width="720px" :is-visible.sync="relateStoreVisible"
@confirmDialog="handleAddConfirm" width="70%"
@closeDialog="handleClose" btn-ok-label="确定"
@confirmDialog="handleRelateStoreConfirm"
@closeDialog="handleRelateStoreClose"
class="relateStore"
> >
<div class="tableBox"> <el-form :model="storeSearchForm" ref="relate" :inline="true">
<!-- <div style="padding: 10px 50px"> <el-form-item label="门店名称:">
<el-input <el-input
v-model="realSearchForm.label" v-model.trim="storeSearchForm.label"
placeholder="搜索品牌名称" placeholder="门店名称"
maxlength="20" @keydown.native="handleStoreInput"
clearable clearable
size="small"
style="width: 300px; margin-right: 12px"
/> />
<el-button size="small" type="primary" @click="searchList"> </el-form-item>
查询 <el-button type="primary" @click="handleSearchStore">搜索</el-button>
</el-button> </el-form>
</div> --> <el-row class="tableCon">
<d2-table <div class="tableBox">
<el-table
ref="seletingTable"
:data="selectingData"
height="464px"
class="table" class="table"
ref="brandTable" border
:table-params="tableParams" @select="handleChange"
:tableData="tableData" @select-all="handleAll"
:hasPage="false"
> >
</d2-table> <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> </div>
<el-table
class="tableBox table"
:data="selectedData"
border
height="464px"
>
<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> </d2-dialog>
</template> </template>
<script> <script>
import { import { getBrandList } from "@api/contentManager"
getAllMerchantList,
getMerchantListByScene,
getBrandList
} from "@api/contentManager"
import { deepClone } from "@/common/util"
export default { export default {
name: "SelectGoodsTypeDialog", name: "RelateStoreDialog",
data() {
return {
selectedData: [],
selectingData: [],
// 分页
total: 0,
currentPage: 1,
pageSize: 20,
storeSearchForm: {}
}
},
props: { props: {
dialogVisible: { relateStoreVisible: {
type: Boolean, type: Boolean,
default: false default: false
}, },
selectedRecord: { storeSelected: {
type: Array, type: Array,
default: () => [] 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() { mounted() {
this.getList() this.selectedData = this.storeSelected
this.getSelectingList()
}, },
methods: { methods: {
getList() { recoverySelection() {
getBrandList({ label: "奥迪" }).then((res) => { var exitIds = this.selectedData.map((item) => item.id)
console.log(res) this.selectingData.forEach((item) => {
if (res?.length) { exitIds.includes(item.id) &&
this.sourceData = res this.$refs.seletingTable.toggleRowSelection(item, true)
this.tableData = res
}
}) })
}, },
searchList() { getSelectingList() {
if (this.realSearchForm.label) { getBrandList({
this.tableData = this.sourceData.filter((item) => { ...this.storeSearchForm,
return item.label?.indexOf(this.realSearchForm.label) > -1 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)
}
}, },
changeEvent(e) { handleChange(selection, row) {
console.log(e) var addOrDelete = !!selection.find((item) => item.id === row.id)
addOrDelete
? this.selectedData.push(row)
: (this.selectedData = this.selectedData.filter(
(item) => item.id !== row.id
))
}, },
handleAddConfirm() { handleAll(selection) {
const selectItemList = this.selectingData.forEach((item) => {
this.$refs.brandTable?.mutiSelectArr?.[ var isExit = this.selectedData.findIndex(
this.tableParams.mutiSelectName (subItem) => subItem.id === item.id
] || [] )
if (selectItemList.length) { if (selection.length && isExit === -1) {
this.$emit("confirmDialogFn", selectItemList) this.selectedData.push(item)
} else { } else if (!selection.length && isExit !== -1) {
this.$message.error("请勾选品牌") 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)
}, },
handleClose() { handleCurrentChange(val) {
this.$emit("closeDialogFn") this.currentPage = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
this.$emit("handleRelateStoreConfirm", this.selectedData)
},
handleRelateStoreClose() {
this.$emit("handleRelateStoreClose")
} }
} }
} }
</script> </script>
<style lang="scss">
<style scoped lang="scss"> .relateStore .table {
.table { margin: 0 auto 20px !important;
::v-deep .el-table__body-wrapper { width: 98%;
height: 400px; }
overflow-y: auto; .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> </style>
...@@ -204,13 +204,6 @@ ...@@ -204,13 +204,6 @@
> >
</div> </div>
</div> </div>
<!-- <merchantDialog
v-if="merchantVisible"
:dialogVisible="merchantVisible"
:config="{ scene: formData.scene, type: formData.showMerchant }"
@confirmDialogFn="confirmDialogFn"
@closeDialogFn="closeDialogFn"
></merchantDialog> -->
<relate-store-dialog <relate-store-dialog
v-if="relateStoreVisible" v-if="relateStoreVisible"
ref="formRelateStore" ref="formRelateStore"
...@@ -264,10 +257,13 @@ ...@@ -264,10 +257,13 @@
</relate-store-dialog> </relate-store-dialog>
<brandDialog <brandDialog
v-if="brandVisible" v-if="brandVisible"
:dialogVisible="brandVisible" ref="brandRef"
@confirmDialogFn="confirmDialogFn" :relate-store-visible="brandVisible"
@closeDialogFn="closeDialogFn" :store-selected="storeSelected"
></brandDialog> @handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose"
>
</brandDialog>
<el-dialog :visible.sync="lookImgVisible"> <el-dialog :visible.sync="lookImgVisible">
<img width="100%" :src="dialogObj.url" alt="图片" /> <img width="100%" :src="dialogObj.url" alt="图片" />
</el-dialog> </el-dialog>
...@@ -520,7 +516,8 @@ export default { ...@@ -520,7 +516,8 @@ export default {
}, },
commitFn(type) { commitFn(type) {
const params = this.getParams(type) const params = this.getParams(type)
addContent(params).then((res) => { const _api = params.id ? updateContent : addContent
_api(params).then((res) => {
if (res) { if (res) {
this.$message.success( this.$message.success(
`${!type ? "保存草稿" : params.id ? "修改" : "新增"}成功` `${!type ? "保存草稿" : params.id ? "修改" : "新增"}成功`
...@@ -546,14 +543,17 @@ export default { ...@@ -546,14 +543,17 @@ export default {
}, },
handleRelateStoreConfirm(selectedData) { handleRelateStoreConfirm(selectedData) {
if (!selectedData.length) { if (!selectedData.length) {
return this.$message.error("请选择门店") return this.$message.error(
`请选择${this.formData.showMerchant == 1 ? "品牌" : "门店"}`
)
} }
this.$refs.channelForm.clearValidate("showMerchant") this.$refs.channelForm.clearValidate("showMerchant")
this.tableData = selectedData this.tableData = selectedData
this.relateStoreVisible = false this.handleRelateStoreClose()
}, },
handleRelateStoreClose() { handleRelateStoreClose() {
this.relateStoreVisible = false this.relateStoreVisible = false
this.brandVisible = false
}, },
handleStoreInput(e) { handleStoreInput(e) {
e.keyCode === 13 && this.handleSearchStore() e.keyCode === 13 && this.handleSearchStore()
...@@ -561,17 +561,6 @@ export default { ...@@ -561,17 +561,6 @@ export default {
handleSearchStore() { handleSearchStore() {
this.$refs.formRelateStore.handleCurrentChange(1) 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) { delMerchant(row, idx) {
this.tableData.splice(idx, 1) this.tableData.splice(idx, 1)
} }
......
...@@ -280,7 +280,7 @@ export default { ...@@ -280,7 +280,7 @@ export default {
var params = { currentPage: 1, pageSize: 2000, merchantIdName: "" } var params = { currentPage: 1, pageSize: 2000, merchantIdName: "" }
this.getBaseData() this.getBaseData()
getMerchantList(params).then((res) => { getMerchantList(params).then((res) => {
this.getSetMerchant(res.list || []) this.getSetMerchant(res || [])
}) })
}, },
......
...@@ -34,7 +34,11 @@ ...@@ -34,7 +34,11 @@
<script> <script>
import { Util, deepClone } from "@/common/util" import { Util, deepClone } from "@/common/util"
import { getStatisticsList, exportStatisticsList,getMerchantList } from "@api/contentManager" import {
getStatisticsList,
exportStatisticsList,
getMerchantList
} from "@api/contentManager"
export default { export default {
name: "contentManagerList", name: "contentManagerList",
data() { data() {
...@@ -105,7 +109,7 @@ export default { ...@@ -105,7 +109,7 @@ export default {
var params = { currentPage: 1, pageSize: 2000, merchantIdName: "" } var params = { currentPage: 1, pageSize: 2000, merchantIdName: "" }
getMerchantList(params) getMerchantList(params)
.then((res) => { .then((res) => {
this.getBaseData(res.list) this.getBaseData(res)
}) })
.catch(() => { .catch(() => {
this.getBaseData([]) this.getBaseData([])
...@@ -150,7 +154,7 @@ export default { ...@@ -150,7 +154,7 @@ export default {
exportStatisticsList(params).then((res) => { exportStatisticsList(params).then((res) => {
console.log(res, "res") console.log(res, "res")
// window.open(res) // window.open(res)
let tempaa = utils.getExplorer() let tempaa = Util.getExplorer()
if (tempaa == "QQ") { if (tempaa == "QQ") {
window.open(res) window.open(res)
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!