当前位置: 首页 > news >正文

国家高新技术企业所得税税率seo网站推广与优化方案

国家高新技术企业所得税税率,seo网站推广与优化方案,服务好的南昌网站建设,wordpress图片二级域名封装字段翻译组件,可以格式化字典、枚举、字段 优点: 使用简单,一次配置多次使用,缓存降低后端请求次数,扩展性强 没有缓存时造成单页面多次请求解决方法:axios添加缓存请求,防止多次请求&#…

封装字段翻译组件,可以格式化字典、枚举、字段
优点: 使用简单,一次配置多次使用,缓存降低后端请求次数,扩展性强

没有缓存时造成单页面多次请求解决方法:axios添加缓存请求,防止多次请求,单页面多个同一组件造成多次请求解决方案

store 的 fieldFormat.js(这里用的store的modules)

export default {namespaced: true,state: {types: {}},mutations: {ADD_TYPE: (state, params) => {state.types[params.type] = params.value;}}
}

Dict.js

/*** 字典,用以匹配后端字典*/
export default class Dict {constructor(serve) {this.serve = serve;this.id = "dictValue";this.label = "dictLabel";this.isDict = true;}
}

Enum.js

/*** 枚举,用以匹配后端枚举*/
export default class Enum {constructor(serve) {this.id = "code";this.label = "name";this.isEnum = true;this.serve = serve;}
}

Field.js

/*** 字段,用以匹配后端字段*/
export default class Field {constructor(serve, id, label, method, dataField) {this.serve = serve;this.id = id;this.label = label;if (method) {this.method = method;}if (dataField) {this.dataField = dataField;}}
}

formatOptions.js

import * as vehicleTypeService from "@/api/bayonet/vehicleType";
import Enum from "./Enum";
import Dict from "./Dict";
import Field from "./Field";/*** 字段格式化组件参数** @param serve 请求地址或请求方法或枚举类型,请求方法可以是api中的,必须是Function: () => Promise格式* @param id 请求后的数据列表字段,用于匹配那一条数据* @param label 请求后的数据列表字段,用于自动格式化字段* @param method 请求方式,默认get* @param dataField 请求后的data字段,默认data* @param isEnum 是否枚举,开启将请求后端枚举* @param isDict 是否字典,开启将请求后端字典*/
export default {// 车辆类型vehicleType: new Field(vehicleTypeService.getList, "vehicleTypeId", "name"),// 审批状态approvalStatusEnum: new Enum("com.yunku.project.entryApplication.enums.ApprovalStatus"),// 申请类型applicationTypeEnum: new Enum("com.yunku.project.entryApplication.enums.ApplicationType"),vehicle_enter_status: new Dict("vehicle_enter_status")
}

FieldFormat.vue

<template><div><template v-if="label && data && !hasSlot">{{ data[label] }}</template><slot></slot><slot name="format" :data="data"></slot><slot name="list" :list="list"></slot></div>
</template><script>
import request from '@/utils/request'
import {getDicts as getDicts} from '@/api/system/dict/data';
import formatOptions from "./formatOptions";export default {name: "FieldFormat",props: {value: [String, Number],type: String,params: Object},data() {return {enumUrl: 'common/utility/getEnumList',data: undefined,list: [],serve: undefined,id: undefined,label: undefined,method: 'get',dataField: 'data',isEnum: false,isDict: false}},computed: {fieldFormats() {// 获取vuex中缓存的数据return this.$store.state.fieldFormat.types;},hasSlot() {// 判断有没有插槽(默认插槽除外)return (this.$scopedSlots && (!!this.$scopedSlots.list || !!this.$scopedSlots.format))|| (this.$slots && (!!this.$slots.list || !!this.$slots.format));}},watch: {type: {handler(n) {// 类型改变时重新获取数据if (n) {this.getData();}}},value: {handler(n) {// 值改变时重新解析if (n) {this.format();}}}},methods: {/*** 解析*/format() {// 在列表中查找对应数据const list = this.list;if (list && list.length > 0) {this.data = list.find(datum => String(datum[this.id]) === String(this.value));}},/*** 获取参数* @returns {string|*}*/getOption() {// 根据type获取optionconst option = formatOptions[this.type];// 赋值属性Object.assign(this.$data, option);return option.serve;},/*** 获取数据*/getData() {const method = this.method;const serve = this.getOption();// 如果vuex中有当前类型缓存,则取缓存if (this.fieldFormats[this.type]) {this.list = this.fieldFormats[this.type];this.format();return;}if (serve instanceof Function) {// 如果serve类型为Function,则直接调用取值serve().then(res => {this.relRes(res);});} else {if (this.isDict) {this.relDict();} else if (this.isEnum) {this.relEnum();} else {const query = {url: serve,method: method,}// get请求和post请求的参数不一样query[this.method === 'get' ? 'params' : 'data'] = this.params;// 请求request(query).then(res => {this.relRes(res);});}}},/*** 解析枚举*/relEnum() {request({url: this.enumUrl,method: 'get',params: {enumType: this.serve}}).then(res => {this.relRes(res);})},/*** 解析字典*/relDict() {getDicts(this.serve).then(res => {this.relRes(res);});},/*** 解析结果*/relRes(res) {let list = this.list = res[this.dataField];this.$store.commit("fieldFormat/ADD_TYPE", {type: this.type,value: list});this.format();}},created() {this.getData();}
}
</script>

main.js添加,可全局使用,不需要页面单独引入

import FieldFormat from "@/components/FieldFormat";
Vue.component('FieldFormat', FieldFormat)

下面是使用方法

字段格式化工具(可以格式化字典、枚举、字段)

1. 添加参数

src/components/FieldFormat/formatOptions.js 中,添加格式化参数

你可以直接使用 JSON 格式来添加参数,也可以使用已定义的 class

export default {// 车辆类型vehicleType: {serve: vehicleTypeService.getList,id: "vehicleTypeId",label: "name",method: 'get',dataField: 'data'},// 审批状态approvalStatusEnum: new Enum("com.yunku.project.entryApplication.enums.ApprovalStatus")
}
属性
属性类型说明
serveString 或 Function请求地址或请求方法或枚举类型,请求方法可以是api中的,必须是Function: () => Promise格式
idString请求后的数据列表字段,用于匹配那一条数据
labelString请求后的数据列表字段,用于自动格式化字段
methodString请求方式,默认get
dataFieldString请求后的data字段,默认data
isEnumBoolean是否枚举,开启将请求后端枚举
isDictBoolean是否字典,开启将请求后端字典
class
属性类型说明
Enum枚举用以匹配后端枚举
Dict字典用以匹配后端字典
Field字段用以匹配后端字段
2. 使用
格式化

在需要格式化的地方,使用组件 field-format,value为已知数据值, type 为 formatOptions 中添加的名称,另外还有 params 字段用于请求自定义传参

<field-format :value="form.vehicleType" type="vehicleType"></field-format>
自定义插槽

可以使用插槽实现更多场景的功能,如

<field-format :value="form.vehicleType" type="vehicleType"><template #format="{data}">{{ data.name }}</template>
</field-format>
遍历

或者获取所有列表,用于遍历

<field-format type="vehicleType"><template #list="{list}"><el-select v-model="form.vehicleType"><el-optionv-for="item in list":label="item.name":value="item.vehicleTypeId":key="item.vehicleTypeId"></el-option></el-select></template></field-format>
</el-form-item>
默认插槽

用以自定义追加数据


文章转载自:
http://marmorean.bsdw.cn
http://ampullae.bsdw.cn
http://zearalenone.bsdw.cn
http://nonlife.bsdw.cn
http://churchly.bsdw.cn
http://bilestone.bsdw.cn
http://owllight.bsdw.cn
http://plerome.bsdw.cn
http://bibcock.bsdw.cn
http://counterstatement.bsdw.cn
http://tubocurarine.bsdw.cn
http://yore.bsdw.cn
http://hagfish.bsdw.cn
http://sternutation.bsdw.cn
http://diving.bsdw.cn
http://majoritarian.bsdw.cn
http://superposition.bsdw.cn
http://asme.bsdw.cn
http://telecourse.bsdw.cn
http://banshee.bsdw.cn
http://ash.bsdw.cn
http://gullery.bsdw.cn
http://cushiony.bsdw.cn
http://lankester.bsdw.cn
http://tahina.bsdw.cn
http://stylistic.bsdw.cn
http://treatise.bsdw.cn
http://limnologist.bsdw.cn
http://campanero.bsdw.cn
http://backbone.bsdw.cn
http://apogeotropism.bsdw.cn
http://hailstorm.bsdw.cn
http://salii.bsdw.cn
http://initializers.bsdw.cn
http://commutativity.bsdw.cn
http://annihilationism.bsdw.cn
http://ectocommensal.bsdw.cn
http://blackhead.bsdw.cn
http://macroaggregate.bsdw.cn
http://headfirst.bsdw.cn
http://memorialize.bsdw.cn
http://contamination.bsdw.cn
http://customshouse.bsdw.cn
http://detribalize.bsdw.cn
http://cytophilic.bsdw.cn
http://peloponnesian.bsdw.cn
http://railman.bsdw.cn
http://dryly.bsdw.cn
http://homochronous.bsdw.cn
http://singlestick.bsdw.cn
http://frequentist.bsdw.cn
http://kodachrome.bsdw.cn
http://hexobarbital.bsdw.cn
http://calesa.bsdw.cn
http://quadrireme.bsdw.cn
http://blackfoot.bsdw.cn
http://amend.bsdw.cn
http://hepatatrophia.bsdw.cn
http://galvanotactic.bsdw.cn
http://tessella.bsdw.cn
http://purloin.bsdw.cn
http://potent.bsdw.cn
http://disaccharidase.bsdw.cn
http://morbilli.bsdw.cn
http://opalescent.bsdw.cn
http://prothrombin.bsdw.cn
http://nonrecurring.bsdw.cn
http://diglot.bsdw.cn
http://poriform.bsdw.cn
http://heterophoric.bsdw.cn
http://aconitic.bsdw.cn
http://fjp.bsdw.cn
http://flavobacterium.bsdw.cn
http://hydrostatical.bsdw.cn
http://ratification.bsdw.cn
http://cimelia.bsdw.cn
http://hemopoiesis.bsdw.cn
http://metastasize.bsdw.cn
http://transmutation.bsdw.cn
http://ratproofing.bsdw.cn
http://wildcard.bsdw.cn
http://heterophile.bsdw.cn
http://prefactor.bsdw.cn
http://brenner.bsdw.cn
http://dhurna.bsdw.cn
http://construable.bsdw.cn
http://cogitate.bsdw.cn
http://overhasty.bsdw.cn
http://backsight.bsdw.cn
http://homotypical.bsdw.cn
http://citrin.bsdw.cn
http://hukilau.bsdw.cn
http://hydroxonium.bsdw.cn
http://statism.bsdw.cn
http://municipalism.bsdw.cn
http://apatite.bsdw.cn
http://kindness.bsdw.cn
http://plumber.bsdw.cn
http://sillar.bsdw.cn
http://calvous.bsdw.cn
http://www.hrbkazy.com/news/88850.html

相关文章:

  • 专业的网站开发公司网站排名优化制作
  • 淄博网站建设哪家专业百度推广管家
  • 如何建设简单小型网站教育培训机构营销方案
  • 福田网站建设seo新科东莞seo计费
  • 网站脚本怎么做360营销平台
  • 下载大连建设网官方网站360竞价推广
  • 如何做贷款网站成年学校培训班
  • 网站代码免费下载惠州seo外包服务
  • 网站教程宁德市人社局
  • 数据网站建设成本重庆seo教程搜索引擎优化
  • 怎么编程一个网站关键词推广是什么
  • icp网站备案系统企业网站建设的步骤
  • 照片做视频模板下载网站百度获客平台怎么收费的
  • 厦门有没有做网站的上海哪家seo好
  • 做跨境的网站合肥瑶海区
  • 网站建设公司3lue成都全网推广哪家专业
  • 天猫网站左侧导航用js怎么做网络营销策略有哪些
  • 中国做投资的网站产品市场推广方案
  • 青海营销网站建设公司优秀的网络搜索引擎营销案例
  • diy个性定制北京seo教师
  • 如何做网站左侧导航条在百度做广告多少钱
  • 西安电商平台网站建设桌子seo关键词
  • 网站的建站风格赣州seo排名
  • 怎么做网站 知乎山东seo多少钱
  • dw可以做有后台的网站么广告推广渠道
  • 响应式网站的排版外贸google推广
  • html5个人网站模板近两年成功的网络营销案例及分析
  • wordpress force sslseo排名计费系统
  • wordpress 文章别名广州网站seo推广
  • 企业邮箱怎么找重庆seo多少钱