From 43d509c637cb3df7e6c95f9e0469e4aaf0a220f1 Mon Sep 17 00:00:00 2001 From: wangbing Date: Wed, 9 Sep 2020 17:37:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/control/mint-ui-extend.ftl | 554 +++--------------- .../resources/templates/layout/app.ftl | 199 ++++--- 2 files changed, 199 insertions(+), 554 deletions(-) diff --git a/src/main/resources/modules/SpringBoot/resources/templates/control/mint-ui-extend.ftl b/src/main/resources/modules/SpringBoot/resources/templates/control/mint-ui-extend.ftl index 80d01fbc..c5c3925e 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/control/mint-ui-extend.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/control/mint-ui-extend.ftl @@ -5,9 +5,9 @@ context: '${context?default("")}', tip: { show: function (msg) { - if(msg) { + if (msg) { this.$indicator.open(msg); - }else { + } else { this.$indicator.open(); } }, @@ -34,496 +34,118 @@ } }); - Vue.component('wb-field-select', { - data: function () { - return { - selectValue: '', - popupVisible: false, - clearVisible: false, - slots: [{ - values: this.items - }], - } - }, - computed: { - currentValue: { - get: function () { - return this.value; - }, - set: function (value) { - this.$emit('input', value); - value ? this.clearVisible = true : this.clearVisible = false; - } - } - }, + Vue.prototype.$action = 'go'; + Vue.prototype.$isSubmit = false; + Vue.mixin({ methods: { - onSelect: function () { - this.popupVisible = true; - if (!this.value) { - this.currentValue = this.items[0]; - } - }, - onClear: function () { - this.currentValue = ''; - }, - onValuesChange: function (picker, values) { - if (this.popupVisible) { - this.currentValue = picker.getValues(0)[0]; + $push: function (param) { + Vue.prototype.$action = 'go'; + if (typeof param === 'string') { + param = { + name: param + }; } - }, - - }, - props: ['value', 'label', 'placeholder', 'items'], - template: '' + - '' + - '
' + - '
{{label}}
' + - '
' + - ' ' + - '
' + - '
' + - '
' + - ' ' + - '
' - }); - - Vue.component('wb-field-dict', { - data: function () { - return { - selectValue: '', - popupVisible: false, - clearVisible: false, - slots: [{ - values: this.items - }], - } - }, - computed: { - currentValue: { - get: function () { - return this.value; - }, - set: function (value) { - this.$emit('input', value); - value ? this.clearVisible = true : this.clearVisible = false; - } - } - }, - created: function () { - this.items.forEach(function (item) { - item.keyValue = "[" + item.key + "]" + item.value; - }) - }, - methods: { - onSelect: function () { - this.popupVisible = true; - if (!this.value) { - this.currentValue = "[" + this.items[0].key + "]" + this.items[0].value; + this.$router.push(param); + }, + $pop: function () { + Vue.prototype.$action = 'back'; + // if (typeof (this.$router) === 'undefined') {//客户端使用时偶会出现undefined错误 + // window.history.back(); + // this.$destroy(); + // } else { + this.$router.go(-1); + this.$destroy(); + // } + }, + $replace: function (param) { + Vue.prototype.$action = 'go'; + if (typeof param === 'string') { + param = { + name: param + }; } + this.$router.replace(param); + }, + $home: function () { + Vue.prototype.$action = 'back'; + this.$router.push("nav") + this.$destroy() + }, + $showLoading: function () { + this.$toast.loading({ + duration: 0, + forbidClick: true, + message: '请稍等...' + }); + Vue.prototype.$isSubmit = true }, - onClear: function () { - this.currentValue = ''; + $closeLoading: function () { + this.$toast.clear(); + Vue.prototype.$isSubmit = false }, - onValuesChange: function (picker, values) { - if (this.popupVisible) { - this.currentValue = "[" + picker.getValues(0)[0].key + "]" + picker.getValues(0)[0].value; - } - } - }, - props: ['value', 'label', 'placeholder', 'items'], - template: '' + - '' + - '
' + - '
{{label}}
' + - '
' + - ' ' + - '
' + - '
' + - '
' + - ' ' + - '
' - }); - - Vue.component('wb-field-date', { - data: function () { - var startDate = new Date(); - startDate.setFullYear(1990, 0, 1); - return { - selectValue: '', - clearVisible: false, - startDate:startDate - } - }, - computed: { - currentValue: { - get: function () { - return this.value; - }, - set: function (value) { - this.$emit('input', value); - value ? this.clearVisible = true : this.clearVisible = false; + $showMessage: function (msg, fn) { + this.$toast({ + duration: 1000, + message: msg + }); + if (typeof fn === 'function') { + setTimeout(function () { + fn(); + }, 1000) } - } - }, - methods: { - onSelect: function () { - this.$refs.picker.open(); }, - onClear: function () { - this.currentValue = ''; - }, - onConfirm: function (value) { - this.currentValue = value.format("yyyy-MM-dd") - } }, - props: ['value', 'label', 'placeholder', 'items'], - template: '' + - '' + - '
' + - '
{{label}}
' + - '
' + - ' ' + - '
' + - '
' + - '
' + - ' ' + - '
' - }); - - Vue.component('wb-field-time', { - data: function () { - return { - selectValue: '', - clearVisible: false, - } + activated: function () { }, - computed: { - currentValue: { - get: function () { - return this.value; - }, - set: function (value) { - this.$emit('input', value); - value ? this.clearVisible = true : this.clearVisible = false; + filters: { + notNull: function (val) { + if (val === null) { + return ""; } - } - }, - methods: { - onSelect: function () { - this.$refs.picker.open(); - }, - onClear: function () { - this.currentValue = ''; }, - onConfirm: function (value) { - this.currentValue = value; - } - }, - props: ['value', 'label', 'placeholder', 'items'], - template: '' + - '' + - '
' + - '
{{label}}
' + - '
' + - ' ' + - '
' + - '
' + - '
' + - ' ' + - '
' + } }); - Vue.component('wb-field-datetime', { + Vue.component('form-area', { data: function () { return { - selectValue: '', - clearVisible: false, + showValue: '' } }, - computed: { - currentValue: { - get: function () { - return this.value; - }, - set: function (value) { - this.$emit('input', value); - value ? this.clearVisible = true : this.clearVisible = false; - } - } - }, - methods: { - onSelect: function () { - this.$refs.picker.open(); + props: { + 'label': { + type: String, + default: '' }, - onClear: function () { - this.currentValue = ''; + 'required': { + type: Boolean, + default: false }, - onConfirm: function (value) { - this.currentValue = value.format("yyyy-MM-dd hh:mm") - } - }, - props: ['value', 'label', 'placeholder', 'items'], - template: '' + - '' + - '
' + - '
{{label}}
' + - '
' + - ' ' + - '
' + - '
' + - '
' + - ' ' + - '
' - }); - - Vue.component('wb-field-cphm', { - data: function () { - return { - prefixData: [ - { - key: '', - value: '京', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'Y'] - }, - { - key: '', - value: '津', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R'] - }, - {key: '', value: '冀', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'O', 'R', 'T']}, - {key: '', value: '晋', children: ['A', 'B', 'C', 'D', 'E', 'F', 'H', 'J', 'K', 'L', 'M']}, - {key: '', value: '蒙', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M']}, - { - key: '', - value: '辽', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P'] - }, - {key: '', value: '吉', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K']}, - { - key: '', - value: '黑', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R'] - }, - { - key: '', - value: '沪', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'AX', 'BX', 'DX'] - }, - { - key: '', - value: '苏', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'U'] - }, - {key: '', value: '浙', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L']}, - { - key: '', - value: '皖', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S'] - }, - {key: '', value: '闽', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K']}, - {key: '', value: '赣', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'S']}, - { - key: '', - value: '鲁', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'U', 'V', 'W', 'Y'] - }, - { - key: '', - value: '豫', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'U'] - }, - { - key: '', - value: '鄂', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'AW'] - }, - { - key: '', - value: '湘', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'S', 'U'] - }, - { - key: '', - value: '粤', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] - }, - { - key: '', - value: '桂', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R'] - }, - {key: '', value: '琼', children: ['A', 'B', 'C', 'D', 'E', 'F']}, - {key: '', value: '渝', children: ['A', 'B', 'C', 'D', 'F', 'G', 'H', 'N']}, - { - key: '', - value: '川', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] - }, - {key: '', value: '贵', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J']}, - { - key: '', - value: '云', - children: ['A', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S'] - }, - {key: '', value: '藏', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J']}, - {key: '', value: '陕', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'V']}, - { - key: '', - value: '甘', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P'] - }, - {key: '', value: '青', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']}, - {key: '', value: '宁', children: ['A', 'B', 'C', 'D', 'E']}, - { - key: '', - value: '新', - children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'S'] - } - ], - popupVisible: false, - clearVisible: false, - slots: [{ - values: [], - defaultIndex: 9, - className: 'slot1' - }, { - divider: true, - content: '', - className: 'slot2' - }, { - values: [], - defaultIndex: 11, - className: 'slot3' - }], - } - }, - created: function () { - if (!this.value) {//当model为空时初始化前缀 - this.$emit('input', this.prefixData[this.slots[0].defaultIndex].value + this.prefixData[this.slots[0].defaultIndex].children[this.slots[2].defaultIndex]); - } - this.slots[0].values = this.getSlot1(); - this.slots[2].values = this.getSlot3(this.prefixData[0].value); - }, - computed: { - prefix: { - get: function () { - return this.value.slice(0, 2); - }, - set: function (value) { - this.$emit('input', value + this.value.slice(2, this.value.length)); - } + 'readonly': { + type: Boolean, + default: false }, - subfix: { - get: function () { - return this.value.slice(2, this.value.length); - }, - set: function (value) { - this.$emit('input', this.value.slice(0, 2) + value); - value ? this.clearVisible = true : this.clearVisible = false; - } + 'value': { + type: String, + default: '' } }, methods: { - onSelect: function () { - this.popupVisible = true; - }, - getSlot1: function () { - var items = []; - this.prefixData.forEach(function (item) { - items.push(item.value); - }); - return items; - }, - getSlot3: function (value) { - for (var i in this.prefixData) { - if (value == this.prefixData[i].value) { - return this.prefixData[i].children; - } - } - return [] - }, - onClear: function () { - this.subfix = ''; - }, - onValuesChange: function (picker, values) { - if (this.popupVisible) { - picker.setSlotValues(1, this.getSlot3(values[0])); - this.prefix = picker.getSlotValue(0) + picker.getSlotValue(1) - } + onChange: function (value) { + this.$emit('input', value); } }, - props: ['value', 'label', 'placeholder', 'items'], template: '' + - '' + - '
' + - '
{{label}}
' + - '
' + - ' {{prefix}}' + - ' ' + - '
' + - '
' + - '
' + - ' ' + - '
' + '' }); - Vue.component('wb-field-pictures', { - data: function () { - return { - fileList: [] - } - }, - - methods: { - onClear: function (item) { - this.fileList.remove(item); - }, - onValuesChange: function (picker, values) { - if (this.popupVisible) { - picker.setSlotValues(1, this.getSlot3(values[0])); - this.prefix = picker.getSlotValue(0) + picker.getSlotValue(1) - } - }, - onTakePicture: function () { - this.fileList.push({ - name: '', - file: '' - }) - setTimeout(function () { - this.$refs.input[this.fileList.length - 1].click(); - }.bind(this), 1) - }, - onChange: function (e, file) { - file.file = e.target.files[0] - file.name = e.target.files[0].name; - this.$emit("handle-file", file, { - finish: function () { - this.$emit("input", this.fileList) - }.bind(this), - cancel: function () { - this.fileList.remove(file); - this.$emit("input", this.fileList) - }.bind(this) - }); - }, - - }, - props: ['value', 'label'], - template: '' + - '' + - ' ' + - '' - }); \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/resources/templates/layout/app.ftl b/src/main/resources/modules/SpringBoot/resources/templates/layout/app.ftl index 0eec21e9..d5f3dbcf 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/layout/app.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/layout/app.ftl @@ -3,10 +3,11 @@ - + - - + + -<#include Layout.setControl("mint-ui-extend")/> +<#include controlHolder("mint-ui-extend")/>
- +