| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- //* 实例化,提供基础服务
- let mixins = [];
- if (typeof mixin !== "undefined") {
- mixins.push(mixin);
- }
- if (typeof componentMixins !== "undefined") {
- mixins.push(componentMixins);
- }
- const PanelForm = {
- template: `<el-form v-bind="$attrs"><slot/></el-form>`,
- };
- const PanelComponent = {
- template: `
- <div class="vue-main" :style="{ backgroundColor:backgroundColor,padding:padding }"><slot/></div>
- `,
- props: {
- backgroundColor: {
- type: String,
- default: "white"
- },
- padding: {
- type: String,
- default: "20px"
- }
- }
- };
- const PanelTitle = {
- template: `
- <div class="vue-main-title">
- <div class="vue-main-title-left"></div>
- <div class="vue-main-title-content">
- <slot />
- <span class="vue-main-title-sub"><slot name="sub"/></span>
- </div>
- <div class="vue-main-title-button"><slot name="right" /></div>
- </div>
- `,
- };
- const PageFixedContainer = {
- template: `
- <div class="vue-page">
- <slot />
- </div>
- `,
- };
- const FormItemPrompt = {
- props: {
- color: {
- type: String,
- default: "#999",
- },
- size: {
- type: String,
- default: "12px",
- },
- },
- template: `
- <div class="d-prompt" :style="{ color,fontSize:size }"><slot/></div>
- `,
- };
- new Vue({
- el: "#app",
- delimiters: ["[[", "]]"],
- mixins,
- data() {
- return {
- timeRangeTypes: [{
- text: "日",
- key: "day"
- }, {
- text: "周",
- key: "week"
- }, {
- text: "月",
- key: "month"
- }]
- }
- },
- methods: {
- fetchData(URL, requestParams) {
- return new Promise((resolve, reject) => {
- this.$http
- .post(URL, requestParams)
- .then(function (response) {
- return response.json();
- })
- .then(({ result, data, msg }) => {
- if (result == 0) {
- this.$message({
- message: msg,
- type: "error",
- });
- reject({ result, data, msg });
- }
- resolve(data);
- })
- .catch((err) => {
- reject(err);
- });
- });
- },
- randomNumber(baseNumber = 1000) {
- return Math.round(Math.random() * baseNumber);
- }
- },
- components: {
- PanelForm,
- PanelTitle,
- panel: PanelComponent,
- FormItemPrompt,
- PageFixedContainer,
- },
- });
|