Commit 3d745e5d by 前端

3月版本功能代码提交

1 parent df799594
import { Util } from "@/common/util"
import { reportTrack } from "@api/resident"
import {
Util
} from "@/common/util"
import {
reportTrack
} from "@api/resident"
export default {
data () {
data() {
return {
prePagePath: '',
prePagePath: "",
track_timerFlag: false,
track_batchId: null,
track_page_view_flag: false,
track_timer_out: null
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
beforeRouteEnter(to, from, next) {
next((vm) => {
vm.prePagePath = from.path
})
},
computed: {
loginAccount () {
loginAccount() {
return this.$store.state.d2admin.user.info.loginAccount
}
},
methods: {
setReportTrackData (eventType, eventCode = '', businessParam = '', batchId = '') {
let recordList = localStorage.getItem('recordList'),
route = this.$route,
{ loginAccout, uuid, userType } = this.loginAccount,
{ prePagePath } = this,
item = {
loginAccount: loginAccout,
uuid,
userType,
systemSource: 1,
eventTime: Util.dateFormate(Date.now(), "YYYY-MM-DD HH:mm:ss"),
eventType,
pagePath: route.path,
}
setReportTrackData(
eventType,
eventCode = "",
businessParam = "",
batchId = ""
) {
let recordList = localStorage.getItem("recordList")
const route = this.$route
const {
loginAccout,
uuid,
userType
} = this.loginAccount
let {
prePagePath
} = this
const item = {
loginAccount: loginAccout,
uuid,
userType,
systemSource: 1,
eventTime: Util.dateFormate(Date.now(), "YYYY-MM-DD HH:mm:ss"),
eventType,
pagePath: route.path
}
if (!prePagePath) prePagePath = this.getPrePagePath(this)
item.prePagePath = prePagePath || '/index'
item.prePagePath = prePagePath || "/index"
if (batchId) item.batchId = batchId
if (eventCode) item.eventCode = eventCode
if (businessParam) item.businessParam = JSON.stringify(businessParam)
......@@ -46,26 +61,31 @@ export default {
recordList = JSON.parse(recordList)
recordList.push(item)
}
localStorage.setItem('recordList', JSON.stringify(recordList))
localStorage.setItem("recordList", JSON.stringify(recordList))
if (recordList.length > 9) {
reportTrack({
recordList
}).then(res => {
if (res) localStorage.removeItem('recordList')
}).then((res) => {
if (res) localStorage.removeItem("recordList")
})
}
},
getRandomString (length = 30) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
getRandomString(length = 30) {
const characters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
let result = ""
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
result += characters.charAt(
Math.floor(Math.random() * characters.length)
)
}
return result;
return result
},
onPageShow () {
onPageShow() {
if (this.track_page_view_flag) return
if (!this.track_batchId) this.track_batchId = `DJ_${this.getRandomString()}_${Date.now()}`
if (!this.track_batchId) {
this.track_batchId = `DJ_${this.getRandomString()}_${Date.now()}`
}
this.track_timerFlag = true
this.track_page_view_flag = true
if (this.track_timer_out) {
......@@ -76,44 +96,52 @@ export default {
this.setBrowseTrackData()
}, 300)
},
onPageHide () {
onPageHide() {
this.track_timerFlag = false
this.track_batchId = null
this.track_page_view_flag = false
clearTimeout(this.track_timer_out)
this.track_timer_out = null
},
setBrowseTrackData () {
setBrowseTrackData() {
try {
if (!this.track_timerFlag || this.$route.path != '/qualityControlList') return
else this.track_timer_out = setTimeout(() => {
this.setBrowseTrackData()
}, 10e3)
this.setReportTrackData(2, this.track_event_code, this[this.track_businessParam_key], this.track_batchId)
if (!this.track_timerFlag || (this.$route.path != "/qualityControlList" && this.$route.path != "/shopConfig")) {
return
} else {
this.track_timer_out = setTimeout(() => {
this.setBrowseTrackData()
}, 10e3)
}
this.setReportTrackData(
2,
this.track_event_code,
this[this.track_businessParam_key],
this.track_batchId
)
} catch (error) {
console.log(error)
}
},
getPrePagePath (_this) {
let current = _this;
const visited = new Set();
getPrePagePath(_this) {
let current = _this
const visited = new Set()
while (current) {
if (visited.has(current)) {
// 防止无限循环
console.error('Detected circular reference in parent chain');
return '';
console.error("Detected circular reference in parent chain")
return ""
}
visited.add(current);
visited.add(current)
if (current.$parent && current.$parent.prePagePath) {
return current.$parent.prePagePath;
return current.$parent.prePagePath
}
current = current.$parent;
current = current.$parent
}
return '';
return ""
}
}
}
\ No newline at end of file
}
......@@ -111,9 +111,11 @@ import { limitPrice, rangePickerOptions_deliveryQuantity } from '@/common/format
import { getList } from "@api/merchant"
import { outputValue_operTypeOpt } from "@/common/constants.js"
import { insertDeliverTargeConfig, updateDeliverTargeConfig, getById_deliver, getCarBrand } from '@api/shopConfig'
// import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default {
name: 'EditDialog',
// mixins: [reportTrackFunMixin],
directives: {
'el-select-loadmore': {
bind(el, binding) {
......@@ -201,6 +203,8 @@ export default {
operTypeOpt: deepClone(outputValue_operTypeOpt),
currentPage: 1,
pageSize: 20
// track_event_code: 'shopConfig_merchantDeliverTargeConfig_add',
// track_businessParam_key: 'searchForm'
}
},
......@@ -223,17 +227,18 @@ export default {
computed: {
dialogShow: {
get() {
// this.setCode()
// this.onPageShow()
return this.visible
},
set(newVal) {
this.$emit('dialogClose', { flag: newVal, attrName: 'visible' })
// this.onPageHide()
this.$emit('dialogClose', { flag: 'dialogClose' })
}
}
},
mounted() {
console.log('this.paramsObj', this.paramsObj)
console.log('this.operationType', this.operationType)
if (this.paramsObj) {
this.getInfo(this.paramsObj.id)
if (this.operationType == 'edit') {
......@@ -248,6 +253,17 @@ export default {
},
methods: {
// setCode() {
// if (this.paramsObj) {
// if (this.operationType == 'edit') {
// this.track_event_code = 'shopConfig_merchantDeliverTargeConfig_edit'
// } else {
// this.track_event_code = 'shopConfig_merchantDeliverTargeConfig_detail'
// }
// } else {
// this.track_event_code = 'shopConfig_merchantDeliverTargeConfig_add'
// }
// },
// 获取4S门店数据
remoteMethod(query) {
this.merchantName = query
......@@ -299,7 +315,6 @@ export default {
this.formData = deepClone(res)
this.tableData = deepClone(res.logList)
this.formData.brand = [this.formData.brandId, this.formData.childId]
console.log('this.formData', this.formData)
const obj = { merchantId: this.formData.merchantId, merchantName: this.formData.merchantName }
this.getSelectingList(obj)
this.getCarBrand(this.formData.merchantId)
......@@ -311,7 +326,6 @@ export default {
},
choose4S(merchantId) {
console.log('merchantId', merchantId)
this.formData.brand = []
this.formData.brandId = ''
this.formData.brandName = ''
......@@ -332,8 +346,6 @@ export default {
},
chooseBrand(value) {
console.log('value', value)
console.log('getCheckedNodes', this.$refs.cascader.getCheckedNodes())
const checkedNode = this.$refs.cascader.getCheckedNodes()[0]
const brandNode = checkedNode.pathNodes[0]
const childNode = checkedNode.pathNodes[1]
......@@ -356,20 +368,23 @@ export default {
},
handleAddConfirm() {
if (this.operationType == 'detail') {
this.dialogShow = false
return
}
this.$refs.infoForm.validate(valid => {
if (valid) {
var params = deepClone(this.formData)
params.merchantName = this.baseData.merchantList.find(item => item.merchantId == params.merchantId).merchantName
// return console.log('params', params)
if (params.id) {
updateDeliverTargeConfig(params).then(res => {
this.notice.okTips('操作成功')
this.dialogShow = true
this.dialogShow = false
})
} else {
insertDeliverTargeConfig(params).then(res => {
this.notice.okTips('操作成功')
this.dialogShow = true
this.dialogShow = false
})
}
}
......
......@@ -42,7 +42,8 @@
@click="handleClickIcon"
class="el-icon-circle-close"></i>
</div>
<!----><!---->
<div class="errorTips"
v-if="tipsShow">最大交付数需大于最小交付数</div>
</div>
</template>
<script>
......@@ -56,7 +57,8 @@ export default {
oldVal: {
startInput: '',
endInput: ''
}
},
tipsShow: false
}
},
......@@ -76,31 +78,18 @@ export default {
},
methods: {
handleStartInput(event) {
// const isNumber = /^\d+$/.test(event)
// if (!isNumber) {
// event = null
// }
// if (event > 100) event = 100
// this.userInput[0] = event
this.userInput[0] = limitPrice(event, this.oldVal.startInput, 20, 2)
this.oldVal.startInput = this.userInput[0]
},
handleEndInput(event) {
// const isNumber = /^\d+$/.test(event)
// if (!isNumber) {
// event = null
// }
// if (event > 100) event = 100
// this.userInput[1] = event
this.userInput[1] = limitPrice(event, this.oldVal.endInput, 20, 2)
this.oldVal.endInput = this.userInput[1]
},
handleClickIcon(event) {
this.userInput[0] = null
this.userInput[1] = null
this.tipsShow = false
},
valueIsEmpty() {
const val = this.userInput
......@@ -138,6 +127,9 @@ export default {
if (Array.isArray(val)) {
if (+val[0] > +val[1]) {
val[1] = null
this.tipsShow = true
} else {
this.tipsShow = false
}
}
}
......@@ -169,5 +161,10 @@ export default {
}
}
}
.errorTips {
color: red;
text-align: center;
font-size: 12px;
}
}
</style>
......@@ -36,8 +36,8 @@
</el-date-picker>
</div>
<div slot="targetValueHtml">
<input-range start-placeholder="最小产值"
end-placeholder="最大产值"
<input-range start-placeholder="最小交付数"
end-placeholder="最大交付数"
:display-value="searchForm.targetValue"></input-range>
</div>
</d2-search>
......@@ -85,7 +85,7 @@
</div>
</d2-table>
</div>
<d2-dialog :title="'产值导入'"
<d2-dialog :title="'交付数导入'"
:is-visible="fileVisible"
@closeDialog="handleImport"
@confirmDialog="handleConfirmImport">
......@@ -138,8 +138,10 @@ import editDialog from "./components/editDialog"
import { listWithPage_deliver, deliverTargeConfigImport, deleteById_deliver, distinctAllBrand } from '@api/shopConfig'
import { getList } from "@api/merchant"
import { outputValue_businessOpt } from "@/common/constants.js"
import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default {
name: "DeliveryQuantity",
mixins: [reportTrackFunMixin], // 导入混入
directives: {
'el-select-loadmore': {
bind(el, binding) {
......@@ -219,7 +221,7 @@ export default {
{
label: "品牌",
prop: "brandName",
width: "300",
width: "500",
formatter: (cellValue) => {
return cellValue.brandName + ' - ' + cellValue.childName
}
......@@ -232,7 +234,10 @@ export default {
{
label: "交付数",
prop: "targetValue",
width: "200"
width: "200",
formatter: (cellValue) => {
return (cellValue.targetValue || cellValue.targetValue == 0) ? cellValue.targetValue : "-"
}
},
{
label: "导入时间",
......@@ -268,7 +273,9 @@ export default {
pageSize: 20,
fileVisible: false,
fileForm: {},
editVisible: false
editVisible: false,
track_event_code: 'shopConfig_merchantDeliverTargeConfig_list',
track_businessParam_key: 'searchForm'
}
},
......@@ -283,6 +290,7 @@ export default {
})
},
mounted() {
this.onPageShow()
this.getBaseData()
},
......@@ -342,7 +350,6 @@ export default {
const resArr = [...res.list]
const arr = this.baseData.merchantList.concat(resArr)
this.baseData.merchantList = arr
console.log('this.baseData.merchantList', this.baseData.merchantList)
this.getOptionsList()
}).catch(() => {
})
......@@ -543,6 +550,9 @@ export default {
console.log(err)
})
}
},
beforeDestroy() {
this.onPageHide()
}
}
</script>
......
......@@ -116,9 +116,11 @@ import { limitPrice, rangePickerOptions_outputValue } from '@/common/format'
import { getList } from "@api/merchant"
import { outputValue_businessOpt, outputValue_operTypeOpt } from "@/common/constants.js"
import { insertOutputTargeConfig, updateOutputTargeConfig, getById } from '@api/shopConfig'
// import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default {
name: 'EditDialog',
// mixins: [reportTrackFunMixin],
directives: {
'el-select-loadmore': {
bind(el, binding) {
......@@ -204,6 +206,8 @@ export default {
operTypeOpt: deepClone(outputValue_operTypeOpt),
currentPage: 1,
pageSize: 20
// track_event_code: 'shopConfig_merchantOutputTargeConfig_add',
// track_businessParam_key: 'searchForm'
}
},
......@@ -226,17 +230,18 @@ export default {
computed: {
dialogShow: {
get() {
// this.setCode()
// this.onPageShow()
return this.visible
},
set(newVal) {
this.$emit('dialogClose', { flag: newVal, attrName: 'visible' })
// this.onPageHide()
this.$emit('dialogClose', { flag: 'dialogClose' })
}
}
},
mounted() {
console.log('this.paramsObj', this.paramsObj)
console.log('this.operationType', this.operationType)
if (this.paramsObj) {
this.getInfo(this.paramsObj.id)
if (this.operationType == 'edit') {
......@@ -251,6 +256,17 @@ export default {
},
methods: {
// setCode() {
// if (this.paramsObj) {
// if (this.operationType == 'edit') {
// this.track_event_code = 'shopConfig_merchantOutputTargeConfig_edit'
// } else {
// this.track_event_code = 'shopConfig_merchantOutputTargeConfig_detail'
// }
// } else {
// this.track_event_code = 'shopConfig_merchantOutputTargeConfig_add'
// }
// },
// 获取商品数据
remoteMethod(query) {
this.merchantName = query
......@@ -301,7 +317,6 @@ export default {
}).then(res => {
this.formData = deepClone(res)
this.tableData = deepClone(res.logList)
console.log('this.formData', this.formData)
const obj = { merchantId: this.formData.merchantId, merchantName: this.formData.merchantName }
this.getSelectingList(obj)
this.formData.createdDateShow = this.formData.createdDate
......@@ -336,6 +351,10 @@ export default {
},
handleAddConfirm() {
if (this.operationType == 'detail') {
this.dialogShow = false
return
}
this.$refs.infoForm.validate(valid => {
if (valid) {
var params = deepClone(this.formData)
......@@ -343,12 +362,12 @@ export default {
if (params.id) {
updateOutputTargeConfig(params).then(res => {
this.notice.okTips('操作成功')
this.dialogShow = true
this.dialogShow = false
})
} else {
insertOutputTargeConfig(params).then(res => {
this.notice.okTips('操作成功')
this.dialogShow = true
this.dialogShow = false
})
}
}
......
......@@ -42,7 +42,8 @@
@click="handleClickIcon"
class="el-icon-circle-close"></i>
</div>
<!----><!---->
<div class="errorTips"
v-if="tipsShow">最大产值需大于最小产值</div>
</div>
</template>
<script>
......@@ -56,7 +57,8 @@ export default {
oldVal: {
startInput: '',
endInput: ''
}
},
tipsShow: false
}
},
......@@ -76,31 +78,18 @@ export default {
},
methods: {
handleStartInput(event) {
// const isNumber = /^\d+$/.test(event)
// if (!isNumber) {
// event = null
// }
// if (event > 100) event = 100
// this.userInput[0] = event
this.userInput[0] = limitPrice(event, this.oldVal.startInput, 20, 2)
this.userInput[0] = limitPrice(event, this.oldVal.startInput, 11, 2)
this.oldVal.startInput = this.userInput[0]
},
handleEndInput(event) {
// const isNumber = /^\d+$/.test(event)
// if (!isNumber) {
// event = null
// }
// if (event > 100) event = 100
// this.userInput[1] = event
this.userInput[1] = limitPrice(event, this.oldVal.endInput, 20, 2)
this.userInput[1] = limitPrice(event, this.oldVal.endInput, 11, 2)
this.oldVal.endInput = this.userInput[1]
},
handleClickIcon(event) {
this.userInput[0] = null
this.userInput[1] = null
this.tipsShow = false
},
valueIsEmpty() {
const val = this.userInput
......@@ -138,6 +127,9 @@ export default {
if (Array.isArray(val)) {
if (+val[0] > +val[1]) {
val[1] = null
this.tipsShow = true
} else {
this.tipsShow = false
}
}
}
......@@ -169,5 +161,10 @@ export default {
}
}
}
.errorTips {
color: red;
text-align: center;
font-size: 12px;
}
}
</style>
......@@ -136,7 +136,7 @@
</d2-container>
</template>
<script>
<script type='text/ecmascript-6'>
import { mapActions, mapState } from "vuex"
import { Util, deepClone } from "@/common/util"
import inputRange from './components/inputRange'
......@@ -144,10 +144,10 @@ import editDialog from "./components/editDialog"
import { listWithPage, targeConfigImport, deleteById } from '@api/shopConfig'
import { getList } from "@api/merchant"
import { outputValue_businessOpt } from "@/common/constants.js"
import reportTrackPageMixin from "@/mixins/reportTrackPageMixin"
import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default {
mixins: [reportTrackPageMixin],
name: "QutputValue",
mixins: [reportTrackFunMixin], // 导入混入
directives: {
'el-select-loadmore': {
bind(el, binding) {
......@@ -227,7 +227,7 @@ export default {
{
label: "业务类型",
addHtml: "typeHtml",
width: "100"
width: "150"
},
{
label: "产值目标月份",
......@@ -237,7 +237,10 @@ export default {
{
label: "产值",
prop: "targetValue",
width: "200"
width: "200",
formatter: (cellValue) => {
return (cellValue.targetValue || cellValue.targetValue == 0) ? cellValue.targetValue : "-"
}
},
{
label: "导入时间",
......@@ -272,7 +275,9 @@ export default {
pageSize: 20,
fileVisible: false,
fileForm: {},
editVisible: false
editVisible: false,
track_event_code: 'shopConfig_merchantOutputTargeConfig_list',
track_businessParam_key: 'searchForm'
}
},
......@@ -287,6 +292,7 @@ export default {
})
},
mounted() {
this.onPageShow()
this.getBaseData()
},
......@@ -339,7 +345,6 @@ export default {
const resArr = [...res.list]
const arr = this.baseData.merchantList.concat(resArr)
this.baseData.merchantList = arr
console.log('this.baseData.merchantList', this.baseData.merchantList)
this.getOptionsList()
}).catch(() => {
})
......@@ -366,25 +371,6 @@ export default {
this.getSelectingList()
}, 10)
},
// showOperate(row) {
// const show = false
// if (row.targetMonth) {
// const targetDate = new Date(row.targetMonth)
// console.log('targetDate', targetDate)
// const nowDate = new Date()
// console.log('nowDate', nowDate)
// // 判断是否同年
// if (targetDate.getFullYear() === nowDate.getFullYear()) {
// console.log('当前年')
// } else {
// console.log(this.monthsBetween(targetDate, nowDate))
// }
// }
// },
// monthsBetween(date1, date2) {
// const monthsDiff = (date2.getFullYear() - date1.getFullYear()) * 12 + date2.getMonth() - date1.getMonth()
// return Math.abs(monthsDiff)
// },
handleReset() {
this.searchForm = {
merchantIdList: [],
......@@ -545,6 +531,9 @@ export default {
console.log(err)
})
}
},
beforeDestroy() {
this.onPageHide()
}
}
</script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!