8d9fc669 by yuanbo

增加注释

1 parent 457da5df
/*
* @Description:
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-06-14 15:05:38
*/
......@@ -8,6 +8,10 @@ import Popup from './index.vue'
const PopupBox = Vue.extend(Popup)
let popuping = undefined
/**
* @description: close
* @author: renchao
*/
PopupBox.prototype.close = function () {
// 如果Popup 有引用,则去掉引用
if (popuping) {
......@@ -24,6 +28,14 @@ PopupBox.prototype.close = function () {
}, 300)
}
/**
* @description: Popup1
* @param {*} title
* @param {*} editItem
* @param {*} data
* @param {*} formData
* @author: renchao
*/
const Popup1 = (title, editItem, data, formData) => {
// 如果组件已渲染,则返回即可
if (popuping) {
......
......@@ -73,9 +73,17 @@
}, 300)
},
methods: {
/**
* @description: onCancel
* @author: renchao
*/
onCancel () {
Popup1().close()
},
/**
* @description: onConfirm
* @author: renchao
*/
onConfirm () {
let res = new Promise((resolve, reject) => {
this.confirm()
......@@ -85,6 +93,11 @@
this.isShow = false
}
},
/**
* @description: loadViewFn
* @param {*} view
* @author: renchao
*/
loadViewFn (view) {
return (r) =>
require.ensure([], () =>
......@@ -184,4 +197,3 @@
opacity: 0;
}
</style>
\ No newline at end of file
......
export const theme = {
/**
* @description: bind
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @author: renchao
*/
bind: function (el, binding, vnode) {
setEleStyleColorAttribute(el, binding);
},
/**
* @description: update
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @author: renchao
*/
update: function (el, binding, vnode) {
setEleStyleColorAttribute(el, binding);
},
/**
* @description: componentUpdated
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @author: renchao
*/
componentUpdated: function (el, binding, vnode) {
setEleStyleColorAttribute(el, binding);
}
......@@ -16,4 +37,4 @@ function setEleStyleColorAttribute (el, binding) {
if (background) el.style['background-color'] = value;
if (font) el.style.color = value;
if (border) el.style['border-color'] = value;
}
\ No newline at end of file
}
......
......@@ -57,6 +57,10 @@
window.removeEventListener('message')
},
methods: {
/**
* @description: queryNoticeList
* @author: renchao
*/
queryNoticeList () {
getHomeNoticeList().then(res => {
if (res.result) {
......@@ -64,6 +68,10 @@
}
})
},
/**
* @description: logout
* @author: renchao
*/
logout () {
axios.post(window._config.services.management + "/management/logout").then(() => {
setToken(undefined)
......@@ -73,12 +81,22 @@
})
},
/**
* @description: themeChange
* @param {*} val
* @author: renchao
*/
themeChange (val) {
this.$store.dispatch('app/updateTheme', val)
},
searchMessageCenter () {
this.$router.push({ name: 'messagecenter' })
},
/**
* @description: handleCommand
* @param {*} command
* @author: renchao
*/
handleCommand (command) {
if (command == 'a') {
//个人中心
......
......@@ -10,6 +10,10 @@ export default {
this.fixBugIniOS()
},
methods: {
/**
* @description: fixBugIniOS
* @author: renchao
*/
fixBugIniOS() {
const $subMenu = this.$refs.subMenu
if ($subMenu) {
......
......@@ -26,6 +26,11 @@ export default {
}
},
methods: {
/**
* @description: linkProps
* @param {*} to
* @author: renchao
*/
linkProps(to) {
if (this.isExternal) {
return {
......
......@@ -53,6 +53,12 @@ export default {
return {}
},
methods: {
/**
* @description: hasOneShowingChild
* @param {*} children
* @param {*} parent
* @author: renchao
*/
hasOneShowingChild (children = [], parent) {
const showingChildren = children.filter(item => {
if (item.hidden) {
......@@ -75,6 +81,11 @@ export default {
}
return false
},
/**
* @description: resolvePath
* @param {*} routePath
* @author: renchao
*/
resolvePath (routePath) {
if (isExternal(routePath)) {
return routePath
......@@ -86,4 +97,4 @@ export default {
}
}
}
</script>
\ No newline at end of file
</script>
......
......@@ -26,14 +26,28 @@ export default {
this.scrollWrapper.removeEventListener('scroll', this.emitScroll)
},
methods: {
/**
* @description: handleScroll
* @param {*} e
* @author: renchao
*/
handleScroll (e) {
const eventDelta = e.wheelDelta || -e.deltaY * 40
const $scrollWrapper = this.scrollWrapper
$scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4
},
/**
* @description: emitScroll
* @author: renchao
*/
emitScroll () {
this.$emit('scroll')
},
/**
* @description: moveToTarget
* @param {*} currentTag
* @author: renchao
*/
moveToTarget (currentTag) {
const $container = this.$refs.scrollContainer.$el
const $containerWidth = $container.offsetWidth
......
......@@ -59,12 +59,28 @@
this.addTags()
},
methods: {
/**
* @description: isActive
* @param {*} route
* @author: renchao
*/
isActive (route) {
return route.path === this.$route.path
},
/**
* @description: isAffix
* @param {*} tag
* @author: renchao
*/
isAffix (tag) {
return tag.meta && tag.meta.affix
},
/**
* @description: filterAffixTags
* @param {*} routes
* @param {*} basePath
* @author: renchao
*/
filterAffixTags (routes, basePath = '/') {
let tags = []
routes.forEach(route => {
......@@ -86,6 +102,10 @@
})
return tags
},
/**
* @description: initTags
* @author: renchao
*/
initTags () {
const affixTags = this.affixTags = this.filterAffixTags(this.routes)
for (const tag of affixTags) {
......@@ -95,6 +115,10 @@
}
}
},
/**
* @description: addTags
* @author: renchao
*/
addTags () {
const { name } = this.$route
if (name) {
......@@ -102,6 +126,10 @@
}
return false
},
/**
* @description: moveToCurrentTag
* @author: renchao
*/
moveToCurrentTag () {
const tags = this.$refs.tag
this.$nextTick(() => {
......@@ -117,6 +145,11 @@
}
})
},
/**
* @description: refreshSelectedTag
* @param {*} view
* @author: renchao
*/
refreshSelectedTag (view) {
this.$store.dispatch('tagsView/delCachedView', view).then(() => {
const { fullPath } = view
......@@ -127,6 +160,11 @@
})
})
},
/**
* @description: closeSelectedTag
* @param {*} view
* @author: renchao
*/
closeSelectedTag (view) {
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
if (this.isActive(view)) {
......@@ -134,12 +172,21 @@
}
})
},
/**
* @description: closeOthersTags
* @author: renchao
*/
closeOthersTags () {
this.$router.push(this.selectedTag)
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
this.moveToCurrentTag()
})
},
/**
* @description: closeAllTags
* @param {*} view
* @author: renchao
*/
closeAllTags (view) {
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
if (this.affixTags.some(tag => tag.path === view.path)) {
......@@ -148,6 +195,12 @@
this.toLastView(visitedViews, view)
})
},
/**
* @description: toLastView
* @param {*} visitedViews
* @param {*} view
* @author: renchao
*/
toLastView (visitedViews, view) {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
......@@ -163,6 +216,12 @@
}
}
},
/**
* @description: openMenu
* @param {*} tag
* @param {*} e
* @author: renchao
*/
openMenu (tag, e) {
// const menuMinWidth = 105
// const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
......@@ -179,9 +238,17 @@
this.visible = true
this.selectedTag = tag
},
/**
* @description: closeMenu
* @author: renchao
*/
closeMenu () {
this.visible = false
},
/**
* @description: handleScroll
* @author: renchao
*/
handleScroll () {
this.closeMenu()
}
......
......@@ -27,10 +27,18 @@ export default {
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
/**
* @description: $_isMobile
* @author: renchao
*/
$_isMobile() {
const rect = body.getBoundingClientRect()
return rect.width - 1 < WIDTH
},
/**
* @description: $_resizeHandler
* @author: renchao
*/
$_resizeHandler() {
if (!document.hidden) {
const isMobile = this.$_isMobile()
......
......@@ -20,6 +20,10 @@ const mutations = {
}
const actions = {
/**
* @description: generateDic
* @author: renchao
*/
generateDic ({ commit }) {
return new Promise(async (resolve) => {
let { result: res } = await getAllDict()
......@@ -27,6 +31,10 @@ const actions = {
resolve(true)
})
},
/**
* @description: resetdict
* @author: renchao
*/
resetdict ({ commit }) {
commit('RESET_DICT')
}
......
......@@ -6,7 +6,7 @@
import Layout from '@/layout'
/**
* @description:
* @description:
* @param {*} routers
* @author: renchao
*/
......@@ -30,6 +30,11 @@ export default function filterAsyncRouter (routers) {
})
return routers
}
/**
* @description: loadView
* @param {*} view
* @author: renchao
*/
function loadView (view) {
return r => require.ensure([], () => r(require(`@/views${view}.vue`)))
}
\ No newline at end of file
}
......
......@@ -2,7 +2,18 @@ import {loadModules} from 'esri-loader'
export default {
methods: {
/**
* @description: identify
* @param {*} url
* @param {*} layerIds
* @param {*} geometry
* @param {*} callBackFunction
* @param {*} returnGeometry
* @param {*} layerOption
* @param {*} tolerance
* @param {*} mapExtent
* @author: renchao
*/
identify(url,layerIds,geometry,callBackFunction,returnGeometry,layerOption,tolerance,mapExtent){
var self = this;
loadModules([
......@@ -19,7 +30,7 @@ export default {
identifyParameters.geometry = geometry;
if(layerIds){
identifyParameters.layerIds = layerIds;
}
}
identifyParameters.layerOption = layerOption ? layerOption : "all";
identifyParameters.tolerance = tolerance ? tolerance : 3;
identifyParameters.mapExtent = mapExtent ? mapExtent : geometry.extent;
......@@ -34,7 +45,7 @@ export default {
}).catch(err => {
throw(err);
});
}
}
}
\ No newline at end of file
}
......
import {maps} from '@/libs/map/mapUtils'
import {maps} from '@/libs/map/mapUtils'
import {loadModules} from 'esri-loader'
export default {
......@@ -10,6 +10,14 @@ export default {
}
},
methods: {
/**
* @description: initDraw
* @param {*} type
* @param {*} viewId
* @param {*} creationMode
* @param {*} callBackFunction
* @author: renchao
*/
initDraw(type,viewId,creationMode,callBackFunction){
var self = this;
loadModules([
......@@ -46,17 +54,21 @@ export default {
if(callBackFunction && typeof callBackFunction == 'function'){
callBackFunction(event.graphic.geometry);
}
}
})
}).catch(err=>{
throw(err);
});
},
/**
* @description: destroyeDraw
* @author: renchao
*/
destroyeDraw() {
if(this.drawAction){
this.drawAction.cancel();
}
}
}
}
\ No newline at end of file
}
......
......@@ -5,6 +5,13 @@ import {loadModules} from "esri-loader"
export default {
methods:{
/**
* @description: addGraphic
* @param {*} url
* @param {*} graphic
* @param {*} callBackFunction
* @author: renchao
*/
addGraphic(url,graphic,callBackFunction){
loadModules([
"esri/layers/FeatureLayer",
......@@ -57,6 +64,13 @@ export default {
throw (err);
})
},
/**
* @description: updateGraphic
* @param {*} url
* @param {*} graphic
* @param {*} callBackFunction
* @author: renchao
*/
updateGraphic(url,graphic,callBackFunction){
loadModules([
"esri/layers/FeatureLayer",
......@@ -107,6 +121,13 @@ export default {
throw (err);
})
},
/**
* @description: delGraphic
* @param {*} url
* @param {*} graphic
* @param {*} callBackFunction
* @author: renchao
*/
delGraphic(url,graphic,callBackFunction){
loadModules([
"esri/layers/FeatureLayer",
......@@ -160,4 +181,4 @@ export default {
})
}
}
}
\ No newline at end of file
}
......
......@@ -3,6 +3,16 @@ import {loadModules} from 'esri-loader'
export default {
methods:{
/**
* @description: findByPro
* @param {*} url
* @param {*} layerIds
* @param {*} searchFields
* @param {*} searchText
* @param {*} returnGeometry
* @param {*} callBackFunction
* @author: renchao
*/
findByPro(url,layerIds,searchFields,searchText,returnGeometry,callBackFunction){
loadModules([
"esri/tasks/FindTask",
......@@ -32,4 +42,4 @@ export default {
}
}
}
\ No newline at end of file
}
......
......@@ -9,6 +9,12 @@
}
},
methods: {
/**
* @description: measure
* @param {*} viewId
* @param {*} type
* @author: renchao
*/
measure(viewId,type){
var view = maps[viewId];
var self = this;
......@@ -35,8 +41,8 @@
view: view
});
}
// skip the initial 'new measurement' button
self.areaActive.viewModel.start();
break;
......@@ -59,4 +65,4 @@
}
}
}
\ No newline at end of file
}
......
......@@ -4,6 +4,17 @@ import {loadModules} from 'esri-loader'
export default{
methods: {
/**
* @description: queryByWhere
* @param {*} url
* @param {*} queryWhere
* @param {*} geometry
* @param {*} returnGeometry
* @param {*} outFields
* @param {*} outSpatialReference
* @param {*} callBackFunction
* @author: renchao
*/
queryByWhere(url,queryWhere,geometry,returnGeometry,outFields ,outSpatialReference ,callBackFunction){
var self = this;
loadModules([
......@@ -55,6 +66,11 @@ export default{
throw(err);
})
},
/**
* @description: parseObj2Arr
* @param {*} object
* @author: renchao
*/
parseObj2Arr(object){
var arr = [];
for(var key in object){
......@@ -64,6 +80,6 @@ export default{
arr.push(obj);
}
return arr;
}
}
},
}
......
......@@ -4,8 +4,14 @@ export default{
methods: {
/**
* @description: readShpByFile
* @param {*} file
* @param {*} callBackFunction
* @author: renchao
*/
readShpByFile(file,callBackFunction){
var reader = new FileReader();
var reader = new FileReader();
reader.readAsBinaryString(file);
reader.οnlοad=function(){
var fileData = this.result ; //fileData就是读取到的文件的二进制数据
......@@ -20,6 +26,12 @@ export default{
.catch(error => console.error(error.stack));
}
},
/**
* @description: readShpByFile
* @param {*} url
* @param {*} callBackFunction
* @author: renchao
*/
readShpByUrl(url,callBackFunction){
open(url).then(source => source.read()
.then(function log(result) {
......@@ -32,8 +44,14 @@ export default{
.catch(error => console.error(error.stack));
}
},
/**
* @description: readShpByZip
* @param {*} zipUrl
* @param {*} callBackFunction
* @author: renchao
*/
readShpByZip(zipUrl,callBackFunction){
}
}
\ No newline at end of file
}
......
......@@ -21,12 +21,21 @@ export default {
this.handleSearch()
},
methods: {
/**
* @description: handkeyCode
* @param {*} e
* @author: renchao
*/
handkeyCode(e) {
if(e.keyCode === 13){
console.log("安");
this.handleSearch()
}
},
/**
* @description: handleSearch
* @author: renchao
*/
handleSearch(){
this.pageData.currentPage = 1
if (this.fetchData) {
......@@ -36,22 +45,41 @@ export default {
this.queryClick()
}
},
/**
* @description: handleSizeChange
* @param {*} val
* @author: renchao
*/
handleSizeChange (val) {
this.pageData.currentPage = 1
this.pageData.pageSize = val
this.queryClick()
},
/**
* @description: handleCurrentChange
* @param {*} val
* @author: renchao
*/
handleCurrentChange (val) {
this.pageData.currentPage = val
if (this.queryClick) {
this.queryClick()
}
},
/**
* @description: handleDel
* @author: renchao
*/
handleDel () {
let deleteAfterPage = Math.ceil((this.tableData.total - 1) / this.pageData.pageSize)
let currentPage = this.pageData.currentPage > deleteAfterPage ? deleteAfterPage : this.pageData.currentPage
this.pageData.currentPage = currentPage < 1 ? 1 : currentPage
},
/**
* @description: resetForm
* @param {*} isYwbl
* @author: renchao
*/
resetForm(isYwbl){
if (isYwbl) {
this.queryForm = defaultParameters.defaultParameters();
......