feat(B批缝隙): B3残留catch补齐/B7-1 add成环/B4-5 key/B5-2 scores索引/门禁62-0-0

This commit is contained in:
12914
2026-09-14 02:18:23 +08:00
parent 4111cba637
commit f47bd75e78
18 changed files with 168 additions and 100 deletions
+1 -1
View File
@@ -43,7 +43,7 @@
@sort-change="sortChange($event, 'create_date')">创建时间</uni-th>
<uni-th align="center" :width="buttonThWidth">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in data" :key="index" :disabled="item.appid === appid">
<uni-tr v-for="(item,index) in data" :key="item._id || item.appid || index" :disabled="item.appid === appid">
<uni-td align="center">{{item.appid}}</uni-td>
<uni-td align="center">{{item.name}}</uni-td>
<uni-td align="left"><text>{{item.description || '-'}}</text></uni-td>
+28 -11
View File
@@ -48,8 +48,9 @@
</template>
<script>
import validator from '@/js_sdk/validator/opendb-admin-menus.js';
import Icons from '@/pages/demo/icons/icons.vue'
import validator from '@/js_sdk/validator/opendb-admin-menus.js';
import Icons from '@/pages/demo/icons/icons.vue'
import { wouldCreateCycle } from '@/components/uni-data-menu/util.js';
const db = uniCloud.database();
const dbCmd = db.command;
@@ -124,20 +125,36 @@
title: '提交中...',
mask: true
})
// 使用 uni-clientDB 提交数据
db.collection(dbCollectionName).add(value).then((res) => {
uni.showToast({
title: '新增成功'
// B7-1: 祖先链成环校验(与 edit 页一致:拉全量菜单走一遍祖先链,500 与 list 页一致)
db.collection(dbCollectionName).field('menu_id,parent_id').limit(500).get().then((listRes) => {
const menus = (listRes.result && listRes.result.data) || []
if (wouldCreateCycle(menus, value.menu_id, value.parent_id)) {
uni.hideLoading()
return uni.showModal({
content: '该父菜单会导致循环引用(A→B→A),已阻止提交',
showCancel: false
})
}
return db.collection(dbCollectionName).add(value).then((res) => {
uni.showToast({
title: '新增成功'
})
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
}).finally(() => {
uni.hideLoading()
})
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}).catch((err) => {
uni.hideLoading()
uni.showModal({
content: err.message || '请求服务失败',
content: (err && err.message) || '菜单校验失败,请重试',
showCancel: false
})
}).finally(() => {
uni.hideLoading()
})
},
showIconPopup() {
+1 -1
View File
@@ -19,7 +19,7 @@
<uni-th align="center">IP</uni-th>
<uni-th align="center">时间</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in data" :key="index">
<uni-tr v-for="(item,index) in data" :key="item._id || (item.create_date + '-' + item.ip + '-' + item.type) || index">
<uni-td align="center">{{(pagination.current -1)*pagination.size + (index+1)}}</uni-td>
<uni-td align="center">{{item.user_id[0] && item.user_id[0].username || '-'}}</uni-td>
<uni-td align="center">{{item.user_id[0] && item.user_id[0].nickname || '-'}}</uni-td>
+10 -6
View File
@@ -59,6 +59,7 @@
formatDate,
maxDeltaDay,
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import fieldsMap from './fieldsMap.js'
export default {
@@ -232,7 +233,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
})
} else {
// 周、月范围的处理
@@ -319,9 +322,10 @@
})
})
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:主表查询失败必须落 errorMessage + 清空 tableData + loading=false(三态落定)
this.errorMessage = getStatErrorMessage(err)
this.tableData = []
this.loading = false
})
},
@@ -424,9 +428,9 @@
this.channelData = channels
})
.catch((err) => {
// B3-2:渠道下拉失败不污染主错误态,仅清空下拉并保留 console 兜底
this.channelData = []
console.error(err)
// err.message 错误信息
// err.code 错误码
}).finally(() => {})
}
+10 -7
View File
@@ -124,7 +124,8 @@
formatDate,
parseDateTime,
getFieldTotal,
debounce
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import {
fieldsMap,
@@ -452,9 +453,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
}).finally(() => {})
},
@@ -531,9 +532,11 @@
this.loading = false
})
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:页面排行查询失败必须落 errorMessage + 清空双表 + loading=false
this.errorMessage = getStatErrorMessage(err)
this.resTableData = []
this.entTableData = []
this.loading = false
}).finally(() => {})
},
+10 -9
View File
@@ -82,7 +82,8 @@
division,
format,
formatDate,
debounce
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import fieldsFactory from './fieldsMap.js'
export default {
@@ -310,9 +311,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
}).finally(() => {
this.loading = false
})
@@ -350,9 +351,9 @@
this.tableData = []
this.tableData = data
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:主表查询失败必须落 errorMessage + 清空 tableData(finally 置 loading=false)
this.errorMessage = getStatErrorMessage(err)
this.tableData = []
}).finally(() => {
this.loading = false
})
@@ -404,9 +405,9 @@
this.channelData = channels
})
.catch((err) => {
// B3-2:渠道下拉失败不污染主错误态,仅清空下拉并保留 console 兜底
this.channelData = []
console.error(err)
// err.message 错误信息
// err.code 错误码
}).finally(() => {})
}
@@ -55,7 +55,8 @@
getTimeOfSomeDayAgo,
division,
format,
debounce
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import fieldsMap from './fieldsMap.js'
export default {
@@ -253,9 +254,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
}).finally(() => {
this.loading = false
})
@@ -330,9 +331,9 @@
this.tableData = []
this.tableData = tableData
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:主表查询失败必须落 errorMessage + 清空 tableData(finally 置 loading=false)
this.errorMessage = getStatErrorMessage(err)
this.tableData = []
}).finally(() => {
this.loading = false
})
@@ -384,9 +385,9 @@
this.channelData = channels
})
.catch((err) => {
// B3-2:渠道下拉失败不污染主错误态,仅清空下拉并保留 console 兜底
this.channelData = []
console.error(err)
// err.message 错误信息
// err.code 错误码
}).finally(() => {})
}
+10 -9
View File
@@ -62,7 +62,8 @@
format,
formatDate,
getFieldTotal,
debounce
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import fieldsMap from './fieldsMap.js'
export default {
@@ -312,9 +313,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
}).finally(() => {
this.loading = false
})
@@ -356,9 +357,9 @@
this.options.total = count
this.tableData = data
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:主表查询失败必须落 errorMessage + 清空 tableData(finally 置 loading=false)
this.errorMessage = getStatErrorMessage(err)
this.tableData = []
}).finally(() => {
this.loading = false
})
@@ -439,9 +440,9 @@
this.channelData = channels
})
.catch((err) => {
// B3-2:渠道下拉失败不污染主错误态,仅清空下拉并保留 console 兜底
this.channelData = []
console.error(err)
// err.message 错误信息
// err.code 错误码
}).finally(() => {})
}
+8 -7
View File
@@ -181,7 +181,8 @@
fileToUrl,
debounce,
getAllDateCN,
createUniStatQuery
createUniStatQuery,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import {
fieldsMap,
@@ -508,9 +509,9 @@
}
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
}).finally(() => {})
},
@@ -617,9 +618,9 @@
})
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:错误明细表查询失败必须落 errorMessage + 清空 tableData(finally 置 loading=false)
this.errorMessage = getStatErrorMessage(err)
this.tableData = []
}).finally(() => {
this.loading = false
})
@@ -24,6 +24,7 @@
stringifyField,
stringifyGroupField,
getTimeOfSomeDayAgo,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import timeUtil from "@/js_sdk/uni-stat/timeUtil.js"
import {
@@ -146,7 +147,9 @@
});
this.setChartData(data, insideQuery.dimension);
}).catch((err) => {
console.error(err);
// B3-2:漏斗趋势查询失败必须落 errorMessage + 清空 chartData(图表已接 errorMessage)
this.errorMessage = getStatErrorMessage(err);
this.chartData = {};
}).finally(() => {})
},
// 设置图表数据
@@ -23,6 +23,7 @@
stringifyField,
stringifyGroupField,
getTimeOfSomeDayAgo,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import timeUtil from "@/js_sdk/uni-stat/timeUtil.js"
import {
@@ -161,7 +162,9 @@
//console.log('trendChartData: ', data)
this.setChartData(data, fieldsMap, insideQuery);
}).catch((err) => {
console.error(err);
// B3-2:总览趋势查询失败必须落 errorMessage + 清空 chartData(图表已接 errorMessage)
this.errorMessage = getStatErrorMessage(err);
this.chartData = {};
}).finally(() => {})
},
// 设置图表数据
+10 -6
View File
@@ -63,6 +63,7 @@
formatDate,
maxDeltaDay,
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import fieldsMap from './fieldsMap.js'
export default {
@@ -238,7 +239,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
})
} else {
// 获取周活、月活
@@ -322,9 +325,10 @@
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:主表查询失败必须落 errorMessage + 清空 tableData + loading=false(三态落定)
this.errorMessage = getStatErrorMessage(err)
this.tableData = []
this.loading = false
})
},
@@ -428,9 +432,9 @@
this.channelData = channels
})
.catch((err) => {
// B3-2:渠道下拉失败不污染主错误态,仅清空下拉并保留 console 兜底
this.channelData = []
console.error(err)
// err.message 错误信息
// err.code 错误码
}).finally(() => {})
}
+5 -4
View File
@@ -55,7 +55,8 @@
formatDate,
parseDateTime,
getFieldTotal,
debounce
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import {
fieldsMap,
@@ -375,9 +376,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
}).finally(() => {})
},
+10 -9
View File
@@ -81,7 +81,8 @@
division,
format,
formatDate,
debounce
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import fieldsFactory from './fieldsMap.js'
export default {
@@ -309,9 +310,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
}).finally(() => {
this.loading = false
})
@@ -349,9 +350,9 @@
this.tableData = []
this.tableData = data
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:主表查询失败必须落 errorMessage + 清空 tableData(finally 置 loading=false)
this.errorMessage = getStatErrorMessage(err)
this.tableData = []
}).finally(() => {
this.loading = false
})
@@ -403,9 +404,9 @@
this.channelData = channels
})
.catch((err) => {
// B3-2:渠道下拉失败不污染主错误态,仅清空下拉并保留 console 兜底
this.channelData = []
console.error(err)
// err.message 错误信息
// err.code 错误码
}).finally(() => {})
}
+10 -9
View File
@@ -54,7 +54,8 @@
getTimeOfSomeDayAgo,
division,
format,
debounce
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import fieldsMap from './fieldsMap.js'
export default {
@@ -251,9 +252,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
}).finally(() => {
this.loading = false
})
@@ -328,9 +329,9 @@
this.tableData = []
this.tableData = tableData
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:主表查询失败必须落 errorMessage + 清空 tableData(finally 置 loading=false)
this.errorMessage = getStatErrorMessage(err)
this.tableData = []
}).finally(() => {
this.loading = false
})
@@ -382,9 +383,9 @@
this.channelData = channels
})
.catch((err) => {
// B3-2:渠道下拉失败不污染主错误态,仅清空下拉并保留 console 兜底
this.channelData = []
console.error(err)
// err.message 错误信息
// err.code 错误码
}).finally(() => {})
}
+10 -9
View File
@@ -65,7 +65,8 @@
format,
formatDate,
getFieldTotal,
debounce
debounce,
getStatErrorMessage
} from '@/js_sdk/uni-stat/util.js'
import fieldsMap from './fieldsMap.js'
export default {
@@ -316,9 +317,9 @@
}
this.chartData = options
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:图表查询失败必须落 errorMessage + 清空 chartData(图表组件已接 errorMessage)
this.errorMessage = getStatErrorMessage(err)
this.chartData = {}
}).finally(() => {
this.loading = false
})
@@ -360,9 +361,9 @@
this.options.total = count
this.tableData = data
}).catch((err) => {
console.error(err)
// err.message 错误信息
// err.code 错误码
// B3-2:主表查询失败必须落 errorMessage + 清空 tableData(finally 置 loading=false)
this.errorMessage = getStatErrorMessage(err)
this.tableData = []
}).finally(() => {
this.loading = false
})
@@ -443,9 +444,9 @@
this.channelData = channels
})
.catch((err) => {
// B3-2:渠道下拉失败不污染主错误态,仅清空下拉并保留 console 兜底
this.channelData = []
console.error(err)
// err.message 错误信息
// err.code 错误码
}).finally(() => {})
}