diff --git a/src/main.js b/src/main.js index e686458..701a505 100644 --- a/src/main.js +++ b/src/main.js @@ -20,6 +20,13 @@ import AvueFormDesign from '@sscfaith/avue-form-design' import basicContainer from './components/basic-container/main' import api from './api' import AvueUeditor from 'avue-plugin-ueditor' +import indexDb from './util/indexedDb' + +let storeName = { name: 'tableOption', key: 'tableIdName' } // name 表名 key 主键 +indexDb.openDB('hxz', 1, storeName, function(db) { + Vue.prototype.$tableDb = db + Vue.prototype.$indexDb = indexDb +}) Vue.use(AvueUeditor); import VueQuillEditor from 'vue-quill-editor' //vue-quill-editor其它文件可在应用页面直接引入 @@ -74,6 +81,9 @@ iconfontVersion.forEach(ele => { Vue.config.productionTip = false import APlayer from '@moefe/vue-aplayer'; +import tableOption from './util/table' +Vue.prototype.$tableOption = tableOption + Vue.use(APlayer, { productionTip: true, }); diff --git a/src/page/index/tags.vue b/src/page/index/tags.vue index 6d28178..4f47f1b 100644 --- a/src/page/index/tags.vue +++ b/src/page/index/tags.vue @@ -75,7 +75,6 @@ }, mounted() { this.setActive() - console.log(localStorage.getItem('allClose')); if(localStorage.getItem('allClose')=='true'){ this.closeAllTags() } diff --git a/src/page/index/top/top-menu.vue b/src/page/index/top/top-menu.vue index 2c564f8..13ad9e3 100644 --- a/src/page/index/top/top-menu.vue +++ b/src/page/index/top/top-menu.vue @@ -35,7 +35,6 @@ export default { this.getTopMenu() // 用户权限加载 this.getUserInfo() - console.log('this.getUserInfo()') }, computed: { ...mapGetters(['menu']) diff --git a/src/page/login/userlogin.vue b/src/page/login/userlogin.vue index 6d77902..ffbd9e9 100644 --- a/src/page/login/userlogin.vue +++ b/src/page/login/userlogin.vue @@ -161,7 +161,7 @@ export default { } else if (res.data.length == 1) { let idx = res.data[0].orgType; localStorage.setItem("orgType", idx); - console.log("登陆成功啦!!!") + if (this.rememberPwd) { this.setCookie(this.loginForm.username, this.loginForm.password, 7); } else { diff --git a/src/page/wel.vue b/src/page/wel.vue index 53af99c..48bb7c9 100644 --- a/src/page/wel.vue +++ b/src/page/wel.vue @@ -3,14 +3,34 @@
筛选日期:
- 今天 - 近7天 - 近30天 + 今天 + 近7天 + 近30天
- +
@@ -30,88 +50,153 @@
- +
-
-
+
+
接待量 (次)
- +
-
{{ cardlist.datalist.receptionCount || 0 }}
+
+ {{ cardlist.datalist.receptionCount || 0 }} +
- +
- 环比:{{ cardlist.sequential.receptionCount || 0 }} + 环比:{{ cardlist.sequential.receptionCount || 0 }} - + +{{ cardlist.liftlist.receptionCount || 0 }} - + {{ cardlist.liftlist.receptionCount || 0 }} - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
+
+
有效接待(次)
- +
-
{{ cardlist.datalist.activeCustomer || 0 }}
+
+ {{ cardlist.datalist.activeCustomer || 0 }} +
- +
- 环比:{{ cardlist.sequential.activeCustomer || 0 }} + 环比:{{ cardlist.sequential.activeCustomer || 0 }} - + +{{ cardlist.liftlist.activeCustomer || 0 }} - + {{ cardlist.liftlist.activeCustomer || 0 }} - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
+
顾问(人)
@@ -134,13 +219,22 @@
-
-
+
+
平均执行率
- +
@@ -148,13 +242,18 @@
- +
- 环比:{{ cardlist.sequential.fraction || 0 }} + 环比:{{ cardlist.sequential.fraction || 0 }} +{{ cardlist.liftlist.fraction || 0 }}% @@ -165,34 +264,57 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
+
+
平均接待时长(分钟)
- +
-
{{ cardlist.datalist.avgDuration || 0 }}
+
+ {{ cardlist.datalist.avgDuration || 0 }} +
- +
- 环比:{{ cardlist.sequential.avgDuration || 0 }} + 环比:{{ cardlist.sequential.avgDuration || 0 }} +{{ cardlist.liftlist.avgDuration || 0 }} @@ -203,76 +325,126 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
- - -
-
+
+
违禁接待次数(次)
- +
-
{{ cardlist.datalist.prohibitedCustomer || 0 }}
+
+ {{ cardlist.datalist.prohibitedCustomer || 0 }} +
- +
- 环比:{{ cardlist.sequential.prohibitedCustomer || 0 }} + 环比:{{ cardlist.sequential.prohibitedCustomer || 0 }} - + +{{ cardlist.liftlist.prohibitedCustomer || 0 }} - + {{ cardlist.liftlist.prohibitedCustomer || 0 }} - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
+
+
违禁接待占比
- +
-
{{ cardlist.datalist.prohibitedZb || 0 }}%
+
+ {{ cardlist.datalist.prohibitedZb || 0 }}% +
- +
- 环比:{{ cardlist.sequential.prohibitedZb || 0 }} + 环比:{{ cardlist.sequential.prohibitedZb || 0 }} +{{ cardlist.liftlist.prohibitedZb || 0 }}% @@ -283,9 +455,16 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
@@ -296,42 +475,61 @@
- 场景执行分析 - - - + 场景执行分析 + + +
-
+ " + >
-
暂无数据
+
暂无数据
-
-
+
+
- +
-
+
{{ item.name.substring(0, 6) }}
@@ -344,20 +542,26 @@
顾问执行率排名(TOP10)
-
+ " + >
-
暂无数据
+
暂无数据
-
+
顾问
@@ -372,26 +576,67 @@
-
-
-
{{ i + 1 }}{{ item.accountName }}
+
+
+
+ {{ i + 1 }}{{ item.accountName }} +
-
-
+
{{ item.fraction }}%
@@ -407,8 +652,12 @@
- + @@ -420,7 +669,10 @@ @@ -430,20 +682,41 @@
- -
+ +
离线工牌
- -
+ +
低电工牌
- > + > @@ -463,15 +736,23 @@
- + - +
@@ -479,26 +760,33 @@
-
+
-
待处理
-
-
+
+ 待处理 +
+
+
45天到期的代理商
{{ sysTop.matuityOfAgent || 0 }}
-
+
45天到期的项目
{{ sysTop.matuityOfHouse || 0 }}
-
+
离线设备
{{ sysTop.offlineEquipmentQUantity || 0 }} @@ -509,7 +797,11 @@
低电量设备
- +
@@ -540,22 +832,30 @@
-
- -
+
+
-
新增项目数 +
+ 新增项目数
{{ sysSec.newAddHouseQuantity || 0 }}
- +
- 环比:{{ sysCompare.newAddHouseQuantity || 0 }} + 环比:{{ sysCompare.newAddHouseQuantity || 0 }} +{{ orderBy.newAddHouseQuantity || 0 }} @@ -566,30 +866,44 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
- -
+
+
-
活跃项目数 +
+ 活跃项目数
{{ sysSec.activeHouseQuantity || 0 }}
- +
- 环比:{{ sysCompare.activeHouseQuantity || 0 }} + 环比:{{ sysCompare.activeHouseQuantity || 0 }} +{{ orderBy.activeHouseQuantity || 0 }} @@ -600,69 +914,108 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
- -
+
+
-
活跃设备数
- - - +
活跃设备数
+ + + +
+
+ {{ sysSec.activeEquipmentQuantity || 0 }}
-
{{ sysSec.activeEquipmentQuantity || 0 }}
- +
- 环比:{{ sysCompare.activeEquipmentQuantity || 0 }} + 环比:{{ sysCompare.activeEquipmentQuantity || 0 }} - + +{{ orderBy.activeEquipmentQuantity || 0 }} - + {{ orderBy.activeEquipmentQuantity || 0 }} - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
- -
+
+
-
录音总时长(小时) +
+ 录音总时长(小时)
{{ sysSec.receptionTime || 0 }}
- +
- 环比:{{ sysCompare.receptionTime || 0 }} + 环比:{{ sysCompare.receptionTime || 0 }} +{{ orderBy.receptionTime || 0 }} @@ -673,23 +1026,34 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
- -
-
- -
+
+
接待量
- +
@@ -698,13 +1062,18 @@
- +
- 环比:{{ sysCompare.receptionCount || 0 }} + 环比:{{ sysCompare.receptionCount || 0 }} +{{ orderBy.receptionCount || 0 }} @@ -715,38 +1084,55 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
- -
+
+
-
有效接待
- - - +
有效接待
+ + +
{{ sysSec.activeCustomer || 0 }}
- +
- 环比:{{ sysCompare.activeCustomer || 0 }} + 环比:{{ sysCompare.activeCustomer || 0 }} +{{ orderBy.activeCustomer || 0 }} @@ -757,37 +1143,59 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
- -
-
- -
+
+
-
违禁接待次数
- - - +
违禁接待次数
+ + +
{{ sysSec.prohibitedCount || 0 }}
- +
- 环比:{{ sysCompare.prohibitedCount || 0 }} + 环比:{{ sysCompare.prohibitedCount || 0 }} +{{ orderBy.prohibitedCount || 0 }} @@ -798,35 +1206,57 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
-
+
+
-
平均接待时长(分钟)
- - - +
平均接待时长(分钟)
+ + + +
+
+ {{ sysSec.receptionTimeWithAvg || 0 }}
-
{{ sysSec.receptionTimeWithAvg || 0 }}
- +
- 环比:{{ sysCompare.receptionTimeWithAvg || 0 }} + 环比:{{ sysCompare.receptionTimeWithAvg || 0 }} +{{ orderBy.receptionTimeWithAvg || 0 }} @@ -837,15 +1267,21 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
- - - - - - -
-
-
+
+
-
接待量
- - - +
接待量
+ + +
{{ sysSec.receptionCount || 0 }}
- +
- 环比:{{ sysCompare.receptionCount || 0 }} + 环比:{{ sysCompare.receptionCount || 0 }} +{{ orderBy.receptionCount || 0 }} @@ -964,35 +1406,53 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
-
+
+
-
有效接待
- - - +
有效接待
+ + +
{{ sysSec.activeCustomer || 0 }}
- +
- 环比:{{ sysCompare.activeCustomer || 0 }} + 环比:{{ sysCompare.activeCustomer || 0 }} +{{ orderBy.activeCustomer || 0 }} @@ -1003,35 +1463,53 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
-
+
+
-
-
平均执行率
- +
+
平均执行率
+ - -
+
+
{{ sysSec.avgFration || 0 }}
- +
- 环比:{{ sysCompare.avgFration || 0 }} + 环比:{{ sysCompare.avgFration || 0 }} +{{ orderBy.avgFration || 0 }}% @@ -1042,35 +1520,51 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
-
+
+
-
-
平均接待时长(分钟)
- - - -
-
{{ sysSec.receptionTimeWithAvg || 0 }}
+
+
平均接待时长(分钟)
+ + + +
+
+ {{ sysSec.receptionTimeWithAvg || 0 }} +
- +
- 环比:{{ sysCompare.receptionTimeWithAvg || 0 }} + 环比:{{ sysCompare.receptionTimeWithAvg || 0 }} +{{ orderBy.receptionTimeWithAvg || 0 }} @@ -1081,34 +1575,53 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
-
+
+
-
违禁接待次数
- - -
+
违禁接待次数
+ + + +
{{ sysSec.prohibitedCount || 0 }}
- +
- 环比:{{ sysCompare.prohibitedCount || 0 }} + 环比:{{ sysCompare.prohibitedCount || 0 }} +{{ orderBy.prohibitedCount || 0 }} @@ -1119,29 +1632,44 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
-
+
+
-
接待时长(小时) +
+ 接待时长(小时)
{{ sysSec.receptionTime || 0 }}
- +
- 环比:{{ sysCompare.receptionTime || 0 }} + 环比:{{ sysCompare.receptionTime || 0 }} +{{ orderBy.receptionTime || 0 }} @@ -1152,29 +1680,44 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
-
+
+
-
活跃项目数 +
+ 活跃项目数
{{ sysSec.activeHouseQuantity || 0 }}
- +
- 环比:{{ sysCompare.activeHouseQuantity || 0 }} + 环比:{{ sysCompare.activeHouseQuantity || 0 }} +{{ orderBy.activeHouseQuantity || 0 }} @@ -1185,29 +1728,44 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
-
+
+
-
无效接待 +
+ 无效接待
{{ sysSec.invalidCustomer || 0 }}
- +
- 环比:{{ sysCompare.invalidCustomer || 0 }} + 环比:{{ sysCompare.invalidCustomer || 0 }} +{{ orderBy.invalidCustomer || 0 }} @@ -1218,96 +1776,152 @@ - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
- - - -
-
+
+
-
活跃设备数
- - -
-
{{ sysSec.activeEquipmentQuantity || 0 }}
+
活跃设备数
+ + + +
+
+ {{ sysSec.activeEquipmentQuantity || 0 }} +
- +
- 环比:{{ sysCompare.activeEquipmentQuantity || 0 }} + 环比:{{ sysCompare.activeEquipmentQuantity || 0 }} - + +{{ orderBy.activeEquipmentQuantity || 0 }} - + {{ orderBy.activeEquipmentQuantity || 0 }} - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
-
-
+
+
-
活跃设备占比
- - -
-
{{ sysSec.activeEquipmentQuantityZB || 0 }}%
+
活跃设备占比
+ + + +
+
+ {{ sysSec.activeEquipmentQuantityZB || 0 }}% +
- +
- 环比:{{ sysCompare.activeEquipmentQuantityZB || 0 }} + 环比:{{ sysCompare.activeEquipmentQuantityZB || 0 }} - + +{{ orderBy.activeEquipmentQuantityZB || 0 }} - + {{ orderBy.activeEquipmentQuantityZB || 0 }} - 数据有所增长 - 数据有所下降 - + 数据有所增长 + 数据有所下降
-
- -
@@ -1317,30 +1931,60 @@
{{ role == 2 ? "项目排名(TOP10)" : "公司排名(TOP10)" }}
-
-
+
+
接待量
-
+
平均执行率
- - + + - + - + - + @@ -1354,31 +1998,61 @@ {{ role == 2 ? "顾问排名(TOP10)" : "项目排名(TOP10)" }}
-
+
接待量
-
+
平均执行率
- > - + > + - + - + - + @@ -1388,7 +2062,10 @@
-
+
欢迎光临
@@ -1442,7 +2119,7 @@ export default { computed: { ...mapGetters(["permissions"]), info() { - return this.$store.state.user.userInfo + return this.$store.state.user.userInfo; }, RandomColor() { return (index) => { @@ -1507,11 +2184,13 @@ export default { default: return "#138BFB"; } - } - } + }; + }, }, mounted() { + console.log(this.$tableOption) + console.log(this.$tableOption, '多久啊开始了的接口撒了就的克拉斯绝地狂龙撒') this.role = localStorage.getItem("orgType"); if (this.role == 3) { this.houseId = localStorage.getItem("houseId"); @@ -1537,49 +2216,49 @@ export default { * 2、有效接待、平均执行率、平均接待时长:打开接待页面,筛选条件:日期+有效接待 * 3、顾问:打开顾问排名,筛选条件:时间; * 4、违禁接待次数、违禁接待占比:打开接待记录,筛选条件:日期+违禁是+有效接待; - * */ + * */ nowSelectTime(type) { - let str = '' - switch(type) { + let str = ""; + switch (type) { case 1: if (this.TimetoAhoose == 0) { - str = `dateType,${this.TimetoAhoose}` - } else if(this.TimetoAhoose == 1) { - str = `dateType,${2}` + str = `dateType,${this.TimetoAhoose}`; + } else if (this.TimetoAhoose == 1) { + str = `dateType,${2}`; } else { - str = '' + str = ""; } break; case 2: if (this.TimetoAhoose == 0) { - str = `dateType,${this.TimetoAhoose}&validInvalid,0` - } else if(this.TimetoAhoose == 1) { - str = `dateType,${2}&validInvalid,0` + str = `dateType,${this.TimetoAhoose}&validInvalid,0`; + } else if (this.TimetoAhoose == 1) { + str = `dateType,${2}&validInvalid,0`; } else { - str = 'validInvalid,0' + str = "validInvalid,0"; } break; case 3: if (this.TimetoAhoose == 0) { - str = `dateType,0` + str = `dateType,0`; } else if (this.TimetoAhoose == 1) { - str = `dateType,4` + str = `dateType,4`; } else { - str = 'dateType,6' + str = "dateType,6"; } break; case 4: if (this.TimetoAhoose == 0) { - str = `dateType,${this.TimetoAhoose}&taboo,1&validInvalid,0` - } else if(this.TimetoAhoose == 1) { - str = `dateType,${2}&taboo,1&validInvalid,0` + str = `dateType,${this.TimetoAhoose}&taboo,1&validInvalid,0`; + } else if (this.TimetoAhoose == 1) { + str = `dateType,${2}&taboo,1&validInvalid,0`; } else { - str = 'taboo,1&validInvalid,0' + str = "taboo,1&validInvalid,0"; } break; } - return str + return str; }, // 跳转详情 @@ -1633,10 +2312,12 @@ export default { }, // 获取时间段 getTimes() { - let str = '' - let time = new Date().getTime() + let str = ""; + let time = new Date().getTime(); if (this.TimetoAhoose == 0) { - str = `${new Date(time).getFullYear()}-${new Date(time).getMonth()+1}-${new Date(time).getDate()}` + str = `${new Date(time).getFullYear()}-${ + new Date(time).getMonth() + 1 + }-${new Date(time).getDate()}`; } if (this.TimetoAhoose == 1) { let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 7; @@ -1647,9 +2328,9 @@ export default { let endDate = `${new Date(endTime).getFullYear()}-${ new Date(endTime).getMonth() + 1 }-${new Date(endTime).getDate()}`; - str = `${startDate},${endDate}` + str = `${startDate},${endDate}`; } - if(this.TimetoAhoose == 2) { + if (this.TimetoAhoose == 2) { let starTime = new Date().getTime() - 24 * 60 * 60 * 1000 * 30; let startDate = `${new Date(starTime).getFullYear()}-${ new Date(starTime).getMonth() + 1 @@ -1658,9 +2339,9 @@ export default { let endDate = `${new Date(endTime).getFullYear()}-${ new Date(endTime).getMonth() + 1 }-${new Date(endTime).getDate()}`; - str = `${startDate},${endDate}` + str = `${startDate},${endDate}`; } - return str + return str; }, jumpto(ind) { @@ -1958,7 +2639,7 @@ export default { \ No newline at end of file diff --git a/src/router/router.js b/src/router/router.js index a2bb161..68f475d 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -17,7 +17,6 @@ export const createRouter = () => new VueRouter({ }) const Router = createRouter() -console.log(Router,'路由'); AvueRouter.install(Router, Store) Router.$avueRouter.formatRoutes(Store.state.user.menu, true) // 重置路由 diff --git a/src/util/indexedDb.js b/src/util/indexedDb.js index 94f1e92..02088a2 100644 --- a/src/util/indexedDb.js +++ b/src/util/indexedDb.js @@ -1,10 +1,10 @@ export default { // indexedDB 兼容 indexedDB: window.indexedDB || window.webkitindexedDB || window.msIndexedDB || window.mozIndexedDB, - + /** * 打开数据库 - * 新对象存储空间newStore参数:newStore.name、newStore.key + * 新对象存储空间newStore参数:name、key * 新增对象存储空间要更改数据库版本 * @param {数据库名称} dbname * @param {版本} version @@ -16,14 +16,14 @@ export default { let db version = version || 1; const request = this.indexedDB.open(dbname, version); - + // 打开失败回调 request.onerror = function () { throw "IndexedDb数据库打开错误" } // 打开成功回调 - request.onsuccess = function(event) { + request.onsuccess = function (event) { db = event.target.result; if (callback && (typeof callback === 'function')) { callback(db); @@ -31,19 +31,22 @@ export default { } // 调用创建新的存储空间 - request.onupgradeneeded = function(event) { + request.onupgradeneeded = function (event) { db = event.target.result; if (newStore) { if (!db.objectStoreNames.contains(newStore.name)) { const objectStore = db.createObjectStore(newStore.name, { keyPath: newStore.key + }, { + unique: false, + autoIncrement: true }) - - newStore.index.forEach(item => { - objectStore.createIndex(`${item}_index`, item, { - unique: false - }) - }) + // newStore.index.forEach(item => { + // objectStore.createIndex(`${item}`, item, { + // unique: false, + // autoIncrement: true + // }) + // }) } } } @@ -53,14 +56,14 @@ export default { * 删除数据库 * @params {*} dbname * @params {*} callback - * */ + * */ deleteDb(dbname, callback) { const deleteQuest = this.indexedDB.deleteDatabase(dbname); - deleteQuest.onerror = function() { + deleteQuest.onerror = function () { throw "删除数据库出错"; } - deleteQuest.onsuccess = function() { + deleteQuest.onsuccess = function () { if (callback && (typeof callback === 'function')) { callback(); } @@ -85,41 +88,41 @@ export default { deleteData(db, storename, key, callback) { const store = db.transaction(storename, 'readwrite').objectStore(storename) const request = store.delete(key); - request.onsuccess = function() { + request.onsuccess = function () { if (callback && (typeof callback === 'function')) { callback(`删除${storename}成功`) } } - request.onerror = function() { + request.onerror = function () { if (callback && (typeof callback === 'function')) { callback(`删除${storename}失败`) } } }, - + /** * 清空数据 * @params {*} db * @params {*} storename * @params {*} callback * */ - clearData(db, storename, callback) { + clearData(db, storename, callback) { const store = db.transaction(storename, 'readwrite').objectStore(storename); const request = store.clear(); - request.onsuccess = function() { + request.onsuccess = function () { if (callback && (typeof callback === 'function')) { callback(`清空${storename}成功`) } - } - request.onerror = function() { + } + request.onerror = function () { if (callback && (typeof callback === 'function')) { callback(`清空${storename}失败`) } } }, - + /** * 添加数据 @@ -127,17 +130,16 @@ export default { * @params {*} storename * @params {*} obj * */ - addData(db, storename, list) { + addData(db, storename, obj) { const store = db.transaction(storename, 'readwrite').objectStore(storename); - list.forEach(ls => { - const request = store.add(ls); - request.onsuccess = function() { - console.log(`写入${storename}数据成功`) - } - request.onsuccess = function() { - console.log(`写入${storename}数据失败`) - } - }) + const request = store.add(obj); + request.onsuccess = function () { + console.log(`写入${storename}数据成功`) + } + request.onerror = function (e) { + console.log(`写入${storename}数据失败`) + console.log(e) + } }, /** @@ -146,17 +148,15 @@ export default { * @params {*} storename * @params {*} obj * */ - updateData(db, storename, list) { + updateData(db, storename, obj) { const store = db.transaction(storename, 'readwrite').objectStore(storename); - list.forEach(ls => { - const request = store.put(ls); - request.onsuccess = function() { - console.log(`更新${storename}数据成功`) - } - request.onsuccess = function() { - console.log(`更新${storename}数据失败`) - } - }) + const request = store.put(obj); + request.onsuccess = function () { + console.log(`更新${storename}数据成功`) + } + request.onerror = function () { + console.log(`更新${storename}数据失败`) + } }, /** @@ -168,32 +168,12 @@ export default { * */ getData(db, storename, key) { const store = db.transaction(storename, 'readwrite').objectStore(storename); - const request = objectStore.get(key); - request.onerror = function() { + const request = store.get(key); + request.onerror = function () { console.log(`获取${storename} 里主键 ${key} 的数据失败`) } return new Promise(resolve => { - request.onsuccess = function(e) { - resolve(e.target.result) - } - }) - }, - - - /** - * 根据索引获取数据 - * @params {*} db - * @params {*} storename - * @params {*} field - * @params {*} val - * @return - * */ - getDataByIndex(db, storename, field, val) { - const store = db.transaction(storename, 'readwrite').objectStore(storename); - const index = store.index(`${field}_index`); - const request = index.get(val) - return new Promise(resolve => { - request.onsuccess = function(e) { + request.onsuccess = function (e) { resolve(e.target.result) } }) @@ -205,13 +185,13 @@ export default { * @params {*} storename * @return * */ - getAllData(db, storename) { + getAllData(db, storename) { const store = db.transaction(storename, 'readwrite').objectStore(storename); const request = store.openCursor(); let data = []; return new Promise(resolve => { - request.onsuccess = function(e) { + request.onsuccess = function (e) { let cursor = e.target.result; if (cursor) { data.push(cursor.value); @@ -223,21 +203,4 @@ export default { }) }, - /** - * 遍历全部数据,判断是否已存在数据库 - * @params {*} allDbData - * @params {*} key - * @return - * */ - readAllData(allDbData, key) { - let flagIndex - allDbData.then((result) => { - flagIndex = result.findIndex(val => { - return (val.name == key) - }) - }) - return flagIndex; - } - - } \ No newline at end of file diff --git a/src/util/table.js b/src/util/table.js new file mode 100644 index 0000000..dada9e7 --- /dev/null +++ b/src/util/table.js @@ -0,0 +1,87 @@ +// 公共配置项,示例 +const publicOption = { + CustomerAgentManagement: { + tableIdName: 'CustomerAgentManagement', + border: true, + index: true, + height: 527, + indexLabel: "序号", + stripe: true, + menuAlign: "center", + menuWidth: 250, + menu: false, + align: "center", + refreshBtn: false, + showColumnBtn: false, + searchSize: "mini", + searchMenuSpan: 9, + delBtn: false, + addBtn: false, + editBtn: false, + viewBtn: true, + size: "small", + column: [ + { + label: "操作人", + prop: "name", + search: true + }, + { + label: "操作手机", + prop: "createBy", + search: true + }, + { + label: "登录IP", + prop: "remoteAddr" + }, + { + label: "操作时间", + prop: "createTime", + }, + { + label: "操作类型", + prop: "type", + dicData: [{ + label: '新增管理', + value: "0" + }, { + label: '编辑项目', + value: "1" + }, { + label: '删除项目', + value: "2" + }, { + label: '新增公司', + value: "3" + }, { + label: '编辑公司', + value: "4" + }, { + label: '删除公司', + value: "5" + }, { + label: '新增代理商', + value: "6" + }, { + label: '系统运营', + value: '7' + }] + }, + { + label: '操作内容', + prop: 'title', + search: true + } + ] + } +} + +const modulesFiles = require.context('@/views',true,/\.js$/); +const modules = modulesFiles.keys().reduce((modules, modulePath) => { + const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1'); + const value = modulesFiles(modulePath); + Object.assign(modules, value.default); + return modules; +}, publicOption); +export default modules; \ No newline at end of file diff --git a/src/views/building/index.vue b/src/views/building/index.vue index 225aacd..1e69b30 100644 --- a/src/views/building/index.vue +++ b/src/views/building/index.vue @@ -246,243 +246,91 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +
- + { + let index = this.$tableOption.buildingIndex.column.findIndex( + (findObj) => item == findObj.label + ); + let obj = this.$tableOption.buildingIndex.column[index]; + if (obj.label == "代理商" && this.orgType == 0) { + obj.hide = false; + obj.showColumn = true; + } + if ((obj.label == "公司" || obj.label == "项目类型") && this.orgType != 2) { + obj.hide = false; + obj.showColumn = true; + } + + if (obj.label == "运营人员" && (this.orgType == 0 || this.orgType == 1)) { + obj.hide = false; + obj.showColumn = true; + } + }); + + console.log(this.$tableOption.buildingIndex); + + // return this.$tableOption.buildingIndex + }, + isSystoleForm() { this.isOpen = !this.isOpen; }, //切换项目 houseChange() { - this.currentPage = 1; + this.page.currentPage = 1; this.zkhousePage(); }, //获取项目 @@ -1318,7 +1206,7 @@ export default { // }); }, screen() { - this.currentPage = 1; + this.page.currentPage = 1; this.zkhousePage(); }, addSurequxiao() { @@ -1333,14 +1221,14 @@ export default { } this.loadingFlag = true; if (this.ruleForm.closeTime && this.ruleForm.closeTime < 30) { - this.$message.error('自动结束接待时长限制最小为30分钟') + this.$message.error("自动结束接待时长限制最小为30分钟"); this.loadingFlag = false; - return + return; } if (this.ruleForm.closeTime && this.ruleForm.closeTime > 720) { - this.$message.error('自动结束接待时长限制最大为720分钟') + this.$message.error("自动结束接待时长限制最大为720分钟"); this.loadingFlag = false; - return + return; } // 编辑 if (this.editFlag) { @@ -1471,7 +1359,7 @@ export default { // console.log(this.time) this.ruleForm = Object.assign({}, row); this.ruleForm.area = [this.ruleForm.provinceId, this.ruleForm.cityId]; - this.ruleForm.time = row.time || '22:00' + this.ruleForm.time = row.time || "22:00"; this.dialogVisible = true; // 获取地区选择数据,在这里对回显的时候进行操作,首先先获取一级省的数据 // this.getProvinceList(); @@ -1565,8 +1453,8 @@ export default { // 获取项目列表 zkhousePage() { let obj = { - current: this.currentPage, - size: this.size, + current: this.page.currentPage, + size: this.page.pageSize, orgType: localStorage.getItem("orgType"), agentId: localStorage.getItem("agentId"), orgCode: localStorage.getItem("orgCode"), @@ -1584,12 +1472,7 @@ export default { this.$api.api.zkhousePage(obj).then((res) => { // console.log(res) this.tableData = res.data.records; - - // 表格中设置ref属性,在数据渲染之后或者updated()之后 - this.$nextTick(() => { - this.$refs.table.doLayout(); - }); - this.total = res.data.total; + this.page.total = res.data.total; }); }, async getProvinceList(parentId = 0) { @@ -1665,7 +1548,7 @@ export default { operationStaffId: "", }; this.area = []; - this.currentPage = 1; + this.page.currentPage = 1; this.zkhousePage(); }, timeChange1(e) { @@ -1682,12 +1565,12 @@ export default { }, handleSizeChange(val) { console.log(`每页 ${val} 条`); - this.size = val; + this.page.pageSize = val; this.zkhousePage(); }, handleCurrentChange(val) { console.log(`当前页: ${val}`); - this.currentPage = val; + this.page.currentPage = val; this.zkhousePage(); }, locationsChange(e) { diff --git a/src/views/building/table.js b/src/views/building/table.js new file mode 100644 index 0000000..5a14246 --- /dev/null +++ b/src/views/building/table.js @@ -0,0 +1,123 @@ +export default { + buildingIndex: { + tableIdName: "buildingIndex", + border: true, + index: false, + height: 500, + indexLabel: "序号", + stripe: true, + menuAlign: "center", + menuWidth: 146, + menu: true, + align: "center", + refreshBtn: false, + showColumnBtn: false, + searchSize: "mini", + searchMenuSpan: 9, + delBtn: false, + addBtn: false, + editBtn: false, + viewBtn: true, + size: "small", + column: [ + { + label: "项目名称", + prop: "propertyName", + }, + { + label: "代理商", + prop: "agentName", + width: "120px", + }, + { + label: "公司", + prop: "corporateName", + width: "120px", + }, + { + label: "项目地区", + prop: "provinceName", + width: "120px", + formatter: (data) => { + return `${data.provinceName || '-'}${data.cityName || ''}` + } + }, + { + label: "联系人信息", + prop: "linkman", + width: "110px", + formatter: (data) => { + return `${data.linkman}-${data.linkmanPhone}` + } + }, + { + label: "管理员账号", + prop: "managerPhone", + width: "110px", + }, + { + label: "运营人员", + prop: "operationStaffName", + }, + { + label: "项目类型", + prop: "houseType", + width: "110px", + dicData: [{ + label: '正式', + value: 0 + },{ + label: '试用', + value: 1 + },{ + label: '演示', + value: 2 + },{ + label: '测试', + value: 3 + }] + }, + { + label: "合同开始日期", + prop: "startWorking", + width: "100px", + }, + { + label: "合同结束日期", + prop: "endWorking", + width: "100px", + }, + { + label: "添加日期", + prop: "createTime", + width: "100px", + formatter: (data) => { + return data.createTime.substring(0, 10) + } + }, + { + label: "服务状态", + prop: "residueTime", + width: "100px", + formatter: data => { + let str = '' + if (Number(data.residueTime) >= 0) { + str = `服务中(${data.residueTime})` + } else { + str = `过期(${Math.abs(data.residueTime)})` + } + return str + } + }, + { + label: "状态", + prop: "lockFlag", + width: "100px", + formatter: data => { + return data.lockFlag == 1 ? "禁用" : "启用" + } + }, + + ] + } +} \ No newline at end of file