123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530 |
- import { mapActions, mapGetters } from 'vuex'
- import currency from 'currency.js'
- import { Calc, Format } from '@fujica/utils'
- export default {
- data() {
- return {
- // 全局格式化方法类
- Format,
- // 全局计算
- Calc,
- public_msgType: [
- {
- id: '0',
- name: '立即返回'
- },
- {
- id: '1',
- name: '业务返回'
- }
- ],
- public_projectType: [
- {
- id: '0',
- name: '车场项目'
- },
- {
- id: '1',
- name: '人行项目'
- }
- ],
- // public_cartype: [ // 车辆类型,待定
- // {
- // id: 1,
- // name: '蓝牌车'
- // },
- // {
- // id: 2,
- // name: '绿牌车'
- // },
- // {
- // id: 3,
- // name: '黄牌车'
- // },
- // {
- // id: 4,
- // name: '白牌车'
- // },
- // {
- // id: 5,
- // name: '黑牌车'
- // },
- // {
- // id: 6,
- // name: '其他'
- // }
- // ],
- public_cartype_obj: {
- 1: '蓝牌车',
- 2: '绿牌车',
- 3: '黄牌车',
- 4: '白牌车',
- 5: '黑牌车',
- 6: '其他'
- },
- public_cartype1: [ // 车辆类型,待定
- {
- id: 1,
- name: '小型车'
- },
- {
- id: 2,
- name: '小型车'
- },
- {
- id: 3,
- name: '大型车'
- },
- {
- id: 4,
- name: '小型车'
- },
- {
- id: 5,
- name: '小型车'
- },
- {
- id: 6,
- name: '其他车'
- }
- ],
- public_cartype_obj1: {
- 1: '小型车',
- 2: '小型车',
- 3: '大型车',
- 4: '小型车',
- 5: '小型车',
- 6: '其他车'
- },
- public_carcolor: [ // 车辆类型,待定
- {
- id: 1,
- name: '蓝牌'
- },
- {
- id: 2,
- name: '绿牌'
- },
- {
- id: 3,
- name: '黄牌'
- },
- {
- id: 4,
- name: '白牌'
- },
- {
- id: 5,
- name: '黑牌'
- },
- {
- id: 6,
- name: '其他'
- }
- ],
- public_carcolor_obj: {
- 1: '蓝牌',
- 2: '绿牌',
- 3: '黄牌',
- 4: '白牌',
- 5: '黑牌',
- 6: '其他'
- },
- public_state: [ // 启用禁用状态
- {
- id: 0,
- name: '禁用'
- },
- {
- id: 1,
- name: '启用'
- }
- ],
- public_couponsource: [ // 优惠券种类
- {
- id: 1,
- name: '电子优惠券'
- },
- {
- id: 2,
- name: '纸质优惠券'
- },
- {
- id: 3,
- name: '活动优惠券'
- },
- {
- id: 4,
- name: '时段优惠券'
- },
- {
- id: 10,
- name: '电子优惠券'
- }
- ],
- public_coupontype: [ // 优惠券类型
- {
- id: 1,
- name: '全免'
- },
- {
- id: 2,
- name: '当天全免'
- },
- {
- id: 3,
- name: '金额减免'
- },
- {
- id: 4,
- name: '小时减免'
- },
- {
- id: 10,
- name: '平台时长优惠'
- }
- ],
- public_chargetype: [ // 计费类型
- {
- id: 1,
- name: '长租车'
- },
- {
- id: 2,
- name: '临停车'
- }
- ],
- public_chargetype_obj: {
- 1: '长租车',
- 2: '临停车'
- },
- public_inout: [ // 进出类型
- {
- id: 1,
- name: '入场'
- },
- {
- id: 2,
- name: '出场'
- }
- ],
- public_inout_obj: {
- 1: '入场',
- 2: '出场'
- },
- public_eventsource: [ // 事件来源
- {
- id: 4,
- name: '车主呼叫'
- },
- {
- id: 2,
- name: '超时转化'
- },
- {
- id: 3,
- name: '视频转化'
- },
- {
- id: 1,
- name: '实时触发'
- }
- ],
- public_eventsource_obj: {
- 1: '实时触发',
- 2: '超时转化',
- 3: '视频转化',
- 4: '车主呼叫'
- },
- public_changeway: [ // 转化方式
- {
- id: 0,
- name: '未转化'
- },
- {
- id: 1,
- name: '自动转化'
- },
- {
- id: 2,
- name: '手动转化'
- },
- {
- id: 3,
- name: '现场恢复'
- }
- ],
- public_changeway_obj: {
- 0: '未转化',
- 1: '自动转化',
- 2: '手动转化',
- 3: '现场恢复'
- },
- public_open_model: { // 开闸模式
- 1: '自动开闸',
- 2: '确认开闸',
- 3: '禁止入场/出场'
- },
- public_time_type: {
- // 1: {
- // zh: '日',
- // en: 'day'
- // },
- 2: {
- zh: '月',
- en: 'month'
- },
- 3: {
- zh: '年',
- en: 'year'
- }
- },
- public_free_time_list: [
- {
- id: 1,
- num: 1,
- type: 2
- },
- {
- id: 2,
- num: 2,
- type: 2
- },
- {
- id: 3,
- num: 3,
- type: 2
- },
- {
- id: 4,
- num: 6,
- type: 2
- },
- {
- id: 5,
- num: 1,
- type: 3
- }
- ],
- DICT_CODE: {
- devicename_type: '201', // 报警处理设备类别
- alarm_type: '188', // 报警事件类型
- public_cartype: '216', // 车牌颜色
- cardvoucher_type: '237', // 卡凭证类型
- device_state: '182', // 人行梯控设备状态
- device_type: '201', // 人行梯控设备类型
- message_type: '242', // 消息类型
- platform_type: '226', // 开票平台类型
- handle_method: '244', // 处理方式
- event_status: '245', // 事件状态
- convert_method: '246', // 转化方式
- menusystem_type: '183', // 菜单管理-系统类型
- lane_type: '274', // 通道类别
- pay_way: '284', // 支付方式
- pay_type: '284', // 支付方式
- pay_type1: '211', // 支付类型
- pay_type_db: '249', // 上海地标支付类型
- pay_channel: '280', // 支付渠道
- pay_source: '281' // 支付来源
- },
- // 缺省图
- default_graph_small: require('@/assets/default_graph/graph_car_small.png'),
- default_graph_big: require('@/assets/default_graph/graph_car_big.png')
- }
- },
- computed: {
- ...mapGetters(['public_dict', 'globalProject', 'globalUserInfo', 'globalFilter', 'globalCompany']),
- public_cartype() {
- const arr = this.public_dict[this.DICT_CODE.public_cartype] || []
- arr.forEach(item => {
- item.id = parseInt(item.mycode)
- item.name = item.myname
- })
- return arr
- },
- globalProjectNo() { // 全局项目ID
- return this.globalProject.projectNo
- },
- globalCompanyId() { // 全局企业ID【当前项目所属企业】
- return this.isFujicaAdmin ? (this.$store.state.user.company?.id || 0) : this.globalUserInfo.companyId
- },
- isFujicaAdmin() { // 超管用户
- return this.globalUserInfo.companyId === 0
- },
- isCompanyAdmin() { // 企业超管
- }
- },
- methods: {
- ...mapActions('dict', {
- 'storeDictByCode': 'dict'
- }),
- // 公共获取文本方法
- publicGetTxt(id, data, nulltxt) {
- const txt = id || id == 0 ? data.filter(item => item.id.toString() === id.toString())[0] : ''
- return txt ? txt.name || txt.myname : (nulltxt || '--')
- },
- /*
- * 获取集合字段显示
- * params: Array list
- * params: String filedName
- * */
- getMultipleFiled(list, filedName) {
- if (!list?.length) return '--'
- return list.map(item => item[filedName] || '--').join(',')
- },
- // 金额计算方法
- floatNumCalc() {
- let sum = 0
- for (var i = 0; i < arguments.length; i++) {
- const val = arguments[i] || 0
- sum = currency(sum).add(val).value // .value 不显示.00
- }
- return sum
- },
- // 获取数字字典key值 增加单独处理 spe
- findValue(code, val, spe = false) {
- if (!val && val != 0) return '--'
- const obj = this.public_dict?.[code] ? this.public_dict[code].find(item => spe ? item.mycode.indexOf(val) > -1 : item.mycode == val) : {}
- return obj?.myname || '--'
- },
- filterButton(str) {
- return this.$store.getters.operations.includes(str)
- },
- /* 用于弹窗嵌套*/
- _openLoading() {
- this._loadingInstance = this.$loading({
- lock: true,
- text: '等待中...',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- })
- },
- _closeLoading() {
- this._loadingInstance && this._loadingInstance.close()
- },
- downloadExcel(res, name) {
- var blob, url, a
- if (res.success) {
- url = res.data
- a = document.createElement('a')
- a.href = url
- a.click()
- }
- if (!res.code) {
- blob = new Blob([res.data], {
- type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
- })
- url = window.URL.createObjectURL(blob)
- a = document.createElement('a')
- if (res.headers['content-disposition']) {
- const fileName = res.headers['content-disposition'].split('=')[1]
- if (fileName) {
- const formatString = escape(fileName)
- const fname = decodeURI(formatString)
- a.download = fname
- }
- }
- // var timestamp = Date.parse(new Date())
- // a.download = name + timestamp + '.xlsx'
- a.href = url
- a.click()
- window.URL.revokeObjectURL(url)
- }
- },
- ruleTxt(type, rule) { // 优惠券规则文本拼接
- var txt = ''
- switch (parseInt(type)) {
- case 1: {
- txt = '停车费全免'
- break
- }
- case 2: {
- txt = '入场当天停车费全免'
- break
- }
- case 3: {
- txt = '减免金额' + rule + '元'
- break
- }
- case 4: {
- txt = '减免时长' + rule + '小时'
- break
- }
- case 10: {
- txt = rule
- break
- }
- default: {
- txt = '--'
- }
- }
- return txt
- },
- getDictTxt(list, code) {
- const obj = list.find(item => item.mycode == code)
- return obj ? obj.myname : '--'
- },
- /*
- *@description: 根据秒转化为时分秒
- *@params: time:传入的秒 require
- *@params: type: HH-MM-SS(00时00分00秒) HH-MM(00时00分) hh-mm-ss(0时0分0秒) hh-mm(0时0分)
- * */
- formateTime(time, type = 'hhmmss') {
- if (!time) return
- time = parseInt(time)
- const h = Math.floor(time / 3600)
- const m = Math.floor((time / 60 % 60))
- const s = Math.floor((time % 60))
- const hh = h < 10 ? '0' + h : h
- const mm = m < 10 ? '0' + m : m
- const ss = s < 10 ? '0' + s : s
- const hhmmss = `${h > 0 ? h + '时' : ''}${m > 0 ? m + '分' : ''}${s > 0 ? s + '秒' : ''}`
- const HHMMSS = `${h > 0 ? hh + '时' : ''}${m > 0 ? mm + '分' : ''}${s > 0 ? ss + '秒' : ''}`
- const hhmm = `${h > 0 ? h + '时' : ''}${m > 0 ? m + '分' : ''}`
- const HHMM = `${h > 0 ? hh + '时' : ''}${m > 0 ? mm + '分' : ''}`
- return {
- hhmmss,
- HHMMSS,
- hhmm,
- HHMM
- }[type]
- },
- exportnotify(val,res) {
- const _this = this
- if (val) {
- this.$notify({
- title: '数据导入/出成功',
- dangerouslyUseHTMLString: true,
- message: `请前往【<span><a underline="false" type="primary" style="color: #2d72ff" >数据中心/导入导出结果</a></span>】查看结果`,
- onClick: function() {
- _this.$router.push({
- path: '/exportlist/exportlist'
- })
- }
- })
- } else {
- if(res.code == '1000000'){
- this.$notify({
- title: '存在错误数据',
- dangerouslyUseHTMLString: true,
- message: `请前往【<span><a underline="false" type="primary" style="color: #2d72ff" >数据/导入导出报表中心</a></span>】查看结果`,
- onClick: function() {
- _this.$router.push({
- path: '/exportlist/exportlist'
- })
- }
- })
- }else{
- this.$message.error(res.msg || '操作失败')
- }
- }
- }
- }
- }
|