追加关于党组织的抽象类

This commit is contained in:
aixianling
2022-10-24 11:58:47 +08:00
parent bda2b10c7f
commit f178667db8
7 changed files with 85 additions and 133 deletions

View File

@@ -5,6 +5,15 @@ let components = [];
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
const install = function (Vue) {
if (install.installed) return;
// 声明全局业务对象类
const models = require.context('./model', true, /\.js$/)
if (models) {
const model = {}
models.keys().map(e => {
model[e.replace(/\.[\/\\]([^\\\/]+)\.js$/, '$1')] = models(e).default
})
Vue.prototype.MODEL = model
}
// 遍历注册全局组件
let contexts = require.context('.', true, /[\\\/]Ai([^\\\/]+)\.vue$/);
if (contexts) {

View File

View File

@@ -0,0 +1,25 @@
import http from "dvcp-ui/lib/js/request";
export default class PartyOrg {
constructor(id) {
this.id = id
this.loaded = false
this.init().finally(() => this.loaded = true)
}
init() {
return PartyOrg.getInfo(this.id).then(data => {
Object.entries(data).map(([k, v]) => this[k] = v)
})
}
static getInfo(id) {
return http.post("/app/partyOrganization/queryOrgById", null, {
params: {id}
}).then(res => {
if (res?.data) {
return res.data
}
})
}
}