diff --git a/report-ui/src/assets/styles/index.scss b/report-ui/src/assets/styles/index.scss index c8829ebb..2e564ab1 100644 --- a/report-ui/src/assets/styles/index.scss +++ b/report-ui/src/assets/styles/index.scss @@ -310,3 +310,41 @@ a:hover { // line-height: 30px !important; // height: 30px; // } + +//自定义表格特殊类型 文字背景 +// 'highway': 'table-primary', +// 'railway': 'table-success', +// 'waterway': 'table-info', +// 'airtransport': 'table-warning', +// 'multimodal': 'table-danger' +.table-primary,.table-success,.table-info,.table-warning,.table-danger{ + border-radius:3px; + padding: 2px 5px; + border-width: 1px; + border-style: solid; +} +.table-primary{ + background: rgba(32, 182, 249, .1); + border-color: rgba(32, 182, 249, .2); + color: rgb(32, 182, 249); +} +.table-success{ + background: rgba(0, 226, 68, .1); + border-color: rgba(0, 226, 68, 0.2); + color: rgb(0, 226, 68); +} +.table-info{ + background: rgba(216, 216, 216, .1); + border-color: rgba(216, 216, 216, .2); + color: rgb(216, 216, 216); +} +.table-warning{ + background: rgba(255, 216, 40, .1); + border-color: rgba(255, 216, 40, .2); + color: rgb(241, 185, 0); +} +.table-danger{ + background: rgba(249, 32, 32, .1); + border-color: rgba(249, 32, 32, .2); + color: rgb(249, 32, 32); +} \ No newline at end of file diff --git a/report-ui/src/components/AnjiPlus/anji-crud/anji-crud.vue b/report-ui/src/components/AnjiPlus/anji-crud/anji-crud.vue new file mode 100644 index 00000000..73f8d575 --- /dev/null +++ b/report-ui/src/components/AnjiPlus/anji-crud/anji-crud.vue @@ -0,0 +1,661 @@ + + + + diff --git a/report-ui/src/components/AnjiPlus/anji-crud/edit-form.vue b/report-ui/src/components/AnjiPlus/anji-crud/edit-form.vue new file mode 100644 index 00000000..d186a84e --- /dev/null +++ b/report-ui/src/components/AnjiPlus/anji-crud/edit-form.vue @@ -0,0 +1,362 @@ + + + + + + diff --git a/report-ui/src/components/AnjiPlus/anji-crud/edit-table.vue b/report-ui/src/components/AnjiPlus/anji-crud/edit-table.vue new file mode 100644 index 00000000..df3b030b --- /dev/null +++ b/report-ui/src/components/AnjiPlus/anji-crud/edit-table.vue @@ -0,0 +1,498 @@ + + + + + + diff --git a/report-ui/src/components/AnjiPlus/anji-crud/edit.vue b/report-ui/src/components/AnjiPlus/anji-crud/edit.vue new file mode 100644 index 00000000..76bb6d6b --- /dev/null +++ b/report-ui/src/components/AnjiPlus/anji-crud/edit.vue @@ -0,0 +1,386 @@ + + + + + + diff --git a/report-ui/src/main.js b/report-ui/src/main.js index 64d4cfe5..f0bb4635 100644 --- a/report-ui/src/main.js +++ b/report-ui/src/main.js @@ -23,8 +23,17 @@ import 'echarts/lib/component/tooltip' // import 'echarts-gl' Vue.component('v-chart', ECharts) +// anji component +import anjiCrud from '@/components/AnjiPlus/anji-crud/anji-crud' +import anjiSelect from '@/components/AnjiPlus/anji-select' +Vue.component('anji-crud', anjiCrud) +Vue.component('anji-select', anjiSelect) + // permission control import '@/permission' +// 按钮权限的指令 +import permission from '@/components/Permission/index' +Vue.use(permission) import Avue from '@smallwei/avue'; import '@smallwei/avue/lib/index.css'; @@ -44,6 +53,10 @@ Object.keys(filter).forEach(key => { // register global mixins. Vue.mixin(mixins) + +// 分页的全局size配置; +Vue.prototype.$pageSizeAll = [10, 50, 100, 200, 500] + Vue.config.productionTip = false // create the app instance. diff --git a/report-ui/src/mixins/common.js b/report-ui/src/mixins/common.js index f52bd6ed..a20150bf 100644 --- a/report-ui/src/mixins/common.js +++ b/report-ui/src/mixins/common.js @@ -1,3 +1,4 @@ +import Cookies from 'js-cookie' export default { data () { return { @@ -5,11 +6,11 @@ export default { }, computed: { // 网页高度 - bodyWidth() { + bodyWidth () { return document.body.clientWidth }, // 网页宽度 - bodyHeight() { + bodyHeight () { return document.body.clientHeight }, }, @@ -20,6 +21,12 @@ export default { destroyed () { }, methods: { + setCookies (key, val, option) { + if (option == null) { + option = { expires: 15 } + } + Cookies.set(key, val, option) + }, goBack () { this.$router.go(-1) }, @@ -95,7 +102,7 @@ export default { } }, // 获取对象类型 - getObjectType(obj) { + getObjectType (obj) { var toString = Object.prototype.toString var map = { '[object Boolean]': 'boolean', @@ -114,21 +121,41 @@ export default { } return map[toString.call(obj)] }, - isNumber(obj) { + isNumber (obj) { return this.getObjectType(obj) == 'number' }, - isString(obj) { + isString (obj) { return this.getObjectType(obj) == 'string' }, - - hasOwn(obj, key) { + isArray (obj) { + return this.getObjectType(obj) == 'array' + }, + hasOwn (obj, key) { return Object.prototype.hasOwnProperty.call(obj, key) }, - isNotNull(val) { + isNotBlank (val) { + return !this.isBlank(val) + }, + isBlank (val) { + if (this.isNull(val)) { + return true + } + if (typeof val === 'string') { + return val.trim() == '' + } + if (typeof val === 'object') { + for (var key in val) { + return false + } + return true + } + return false + }, + isNotNull (val) { return !this.isNull(val) }, - isNull(val) { + isNull (val) { // 特殊判断 if (val && parseInt(val) === 0) return false const list = ['$parent'] @@ -154,7 +181,7 @@ export default { }, // 对象深拷贝 - deepClone(data) { + deepClone (data) { var type = this.getObjectType(data) var obj if (type === 'array') { @@ -190,7 +217,7 @@ export default { }, // 合并json - mergeObject() { + mergeObject () { var target = arguments[0] || {} var deep = false var arr = Array.prototype.slice.call(arguments) @@ -233,7 +260,7 @@ export default { }, // 获取dom在屏幕中的top和left - getDomTopLeftById(id) { + getDomTopLeftById (id) { var dom = document.getElementById(id) var top = 0 var left = 0 @@ -243,7 +270,7 @@ export default { } return { top: top, left: left } }, - objToOne(obj) { + objToOne (obj) { var tmpData = {} for (var index in obj) { if (typeof obj[index] == 'object') { @@ -255,5 +282,68 @@ export default { } return tmpData }, + urlEncode (val) { + return encodeURIComponent(val) + }, + urlDecode (val) { + return decodeURIComponent(val) + }, + urlEncodeObject (obj, ingoreFields) { + if (toString.call(obj) != '[object Object]') { + return obj + } + var result = {} + for (var key in obj) { + if (this.isBlank(obj[key])) { + continue + } + if (ingoreFields != null && ingoreFields.indexOf(key) >= 0) { + result[key] = obj[key] + } else { + result[key] = this.urlEncode(obj[key]) + } + } + return result + }, + + // 根据数据字典,查询指定字典dict指定值code的,返回整个dictItem{id, text, extend} + getDictItemByCode (dict, code) { + var dicts = JSON.parse(localStorage.getItem('gaeaDict')) + if (!dicts.hasOwnProperty(dict)) { + return null + } + var dictItems = dicts[dict] + for (var i = 0; i < dictItems.length; i++) { + var dictItem = dictItems[i] + if (typeof (code) == 'number') { + code = code.toString() + } + if (dictItem['id'].toString() == code) { + return dictItem + } + } + return null + }, + // 根据数据字典,查询指定字典dict指定值code的dictItem.text + getDictLabelByCode (dict, code) { + var dictItem = this.getDictItemByCode(dict, code) + if (dictItem != null) { + return dictItem['text'] + } else { + return '' + } + }, + // 根据数据字典,查询指定字典dict指定值code的dictItem.extend + getDictExtendByCode (dict, code) { + var dictItem = this.getDictItemByCode(dict, code) + if (dictItem == null) { + return null + } + var extend = dictItem['extend'] + if (extend == null || extend.trim() == 'null') { + return null + } + return dictItem['extend'] + }, } }