提交 af2e5356 编写于 作者: Yuanzhao.dai's avatar Yuanzhao.dai

Merge branch 'dev-eduadmin-20190222' into dev-followUp-20190312

...@@ -95,15 +95,9 @@ export default { ...@@ -95,15 +95,9 @@ export default {
// 获取用户权限 // 获取用户权限
getUserAuth(token) { getUserAuth(token) {
let req = null let req = null
if(localStorage.getItem('storageToken')) {
req = {
token: localStorage.getItem('storageToken')
}
} else {
req = { req = {
token: token token: token
} }
}
vm.GET('common/v1/role',req).then((res) => { vm.GET('common/v1/role',req).then((res) => {
if(res.code == '000000') { if(res.code == '000000') {
vm.changeIdType(res.data.idType) vm.changeIdType(res.data.idType)
......
...@@ -8,6 +8,7 @@ const createComponent = r => require.ensure([], () => r(require('../views/educat ...@@ -8,6 +8,7 @@ const createComponent = r => require.ensure([], () => r(require('../views/educat
const roleManager = r => require.ensure([], () => r(require('../views/system/role.vue')),'role') const roleManager = r => require.ensure([], () => r(require('../views/system/role.vue')),'role')
const addManager = r => require.ensure([], () => r(require('../views/education/add-manager.vue')), 'add-manager') const addManager = r => require.ensure([], () => r(require('../views/education/add-manager.vue')), 'add-manager')
const itemRole = r => require.ensure([], () => r(require('../views/system/item-role.vue')), 'item-role') const itemRole = r => require.ensure([], () => r(require('../views/system/item-role.vue')), 'item-role')
const tree = r => require.ensure([], () => r(require('../views/education/tree.vue')), 'tree')
import followRouters from './follow' import followRouters from './follow'
...@@ -45,6 +46,9 @@ export default [{ ...@@ -45,6 +46,9 @@ export default [{
},{ },{
path: '/item-role', path: '/item-role',
component: itemRole component: itemRole
},{
path: '/tree',
component: tree
}, },
followRouters, followRouters,
] ]
......
import * as types from './mutations-types'
export const changeToken = ({commit}, data) => {
commit(types.TOKEN, data)
}
export const changeIdType = ({commit}, data) => {
commit(types.ID_TYPE, data)
}
\ No newline at end of file
export const _token = state => state._token
export const idType = state => state.idType const getters = {
_token: state => state.common._token,
idType: state => state.common.idType
}
export default getters
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import * as actions from './actions' import common from './modules/common'
import * as getters from './getters' import getters from './getters'
import state from './state'
import mutations from './mutations'
Vue.use(Vuex) Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
actions, modules: {
getters, common
state, },
mutations, getters
}) })
const common = {
state: {
_token: '',
idType: ''
},
mutations: {
CHANGE_TOKEN: (state, data) => {
state._token = data
},
CHANGE_IDTYPE: (state, data) => {
state.idType = data
}
},
actions: {
changeToken({ commit }, tokenData) {
commit('CHANGE_TOKEN', tokenData)
},
changeIdType({ commit }, idTypeData) {
commit('CHANGE_IDTYPE', idTypeData)
}
}
}
export default common
\ No newline at end of file
export const TOKEN = 'TOKEN'
export const ID_TYPE = 'ID_TYPE'
\ No newline at end of file
import * as types from './mutations-types'
const mutations = {
[types.TOKEN](state, tokenData) {
state._token = tokenData
},
[types.ID_TYPE](state, idTypeData) {
state.idType = idTypeData
}
}
export default mutations
\ No newline at end of file
const state = {
_token: '',
idType: ''
}
export default state
\ No newline at end of file
...@@ -6,17 +6,10 @@ export const envConfig = { ...@@ -6,17 +6,10 @@ export const envConfig = {
// baseUrl: 'https://dev-sc.yunqueyi.com/', // baseUrl: 'https://dev-sc.yunqueyi.com/',
// // baseUrl: 'http://10.177.15.180:10202/', // // baseUrl: 'http://10.177.15.180:10202/',
// // baseUrl: 'http://192.168.140.14:10201/', // // baseUrl: 'http://192.168.140.14:10201/',
// apiUrl: 'https://dev-api.yunqueyi.com/',
// webPageUrl: 'https://dev-phome.yunqueyi.com/',
// baseUrl: 'https://test1-sc.yunqueyi.com/', // baseUrl: 'https://test1-sc.yunqueyi.com/',
// apiUrl: 'https://test1-api.yunqueyi.com/',
// webPageUrl: 'https://test1-phome.yunqueyi.com/'
//baseUrl: 'https://uat-sc.yunqueyi.com/', //baseUrl: 'https://uat-sc.yunqueyi.com/',
baseUrl: 'http://192.168.110.226:11905/portal/', baseUrl: 'http://localhost:11905/portal/',
apiUrl: 'https://uat-api.yunqueyi.com/',
webPageUrl: 'https://uat-phome.yunqueyi.com/',
qiniuUrl: "http://localhost:10201/contents/admin/qiniu/token",
qiniuFileUrl: "http://localhost:10201/contents/admin/qiniu/token1", qiniuFileUrl: "http://localhost:10201/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com", qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com", qiniuImgUrl: "https://test1-file.yunqueyi.com",
...@@ -27,10 +20,7 @@ export const envConfig = { ...@@ -27,10 +20,7 @@ export const envConfig = {
}, },
dev: { dev: {
baseUrl: 'https://dev-sc.yunqueyi.com/portal/', baseUrl: 'https://dev-sc.yunqueyi.com/portal/',
apiUrl: 'https://dev-api.yunqueyi.com/', qiniuFileUrl: "https://dev-sc.yunqueyi.com/contents/admin/qiniu/token1",
webPageUrl: 'https://dev-phome.yunqueyi.com/',
qiniuUrl: "http://localhost:11905/contents/admin/qiniu/token",
qiniuFileUrl: "http://localhost:11905/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com", qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com", qiniuImgUrl: "https://test1-file.yunqueyi.com",
loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html', loginUrl: 'https://dev-saas.yunqueyi.com/pica-login/work_station.html',
...@@ -39,9 +29,6 @@ export const envConfig = { ...@@ -39,9 +29,6 @@ export const envConfig = {
}, },
test: { test: {
baseUrl: 'https://test1-sc.yunqueyi.com/portal/', baseUrl: 'https://test1-sc.yunqueyi.com/portal/',
apiUrl: 'https://test1-api.yunqueyi.com/',
webPageUrl: 'https://test1-phome.yunqueyi.com/',
qiniuUrl: "https://test1-sc.yunqueyi.com/contents/admin/qiniu/token",
qiniuFileUrl: "https://test1-sc.yunqueyi.com/contents/admin/qiniu/token1", qiniuFileUrl: "https://test1-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://test1-videos.yunqueyi.com", qiniuResourceUrl: "https://test1-videos.yunqueyi.com",
qiniuImgUrl: "https://test1-file.yunqueyi.com", qiniuImgUrl: "https://test1-file.yunqueyi.com",
...@@ -51,9 +38,6 @@ export const envConfig = { ...@@ -51,9 +38,6 @@ export const envConfig = {
}, },
uat: { uat: {
baseUrl: 'https://uat-sc.yunqueyi.com/portal/', baseUrl: 'https://uat-sc.yunqueyi.com/portal/',
apiUrl: 'https://uat-api.yunqueyi.com/',
webPageUrl: 'https://uat-phome.yunqueyi.com/',
qiniuUrl: "https://uat-sc.yunqueyi.com/contents/admin/qiniu/token",
qiniuFileUrl: "https://uat-sc.yunqueyi.com/contents/admin/qiniu/token1", qiniuFileUrl: "https://uat-sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://videos.yunqueyi.com", // 视频 qiniuResourceUrl: "https://videos.yunqueyi.com", // 视频
qiniuImgUrl: "https://file.yunqueyi.com", qiniuImgUrl: "https://file.yunqueyi.com",
...@@ -63,9 +47,6 @@ export const envConfig = { ...@@ -63,9 +47,6 @@ export const envConfig = {
}, },
pro: { pro: {
baseUrl: 'https://sc.yunqueyi.com/portal/', baseUrl: 'https://sc.yunqueyi.com/portal/',
apiUrl: 'https://api.yunqueyi.com/',
webPageUrl: 'https://phome.yunqueyi.com/',
qiniuUrl: "https://sc.yunqueyi.com/contents/admin/qiniu/token",
qiniuFileUrl: "https://sc.yunqueyi.com/contents/admin/qiniu/token1", qiniuFileUrl: "https://sc.yunqueyi.com/contents/admin/qiniu/token1",
qiniuResourceUrl: "https://videos.yunqueyi.com", qiniuResourceUrl: "https://videos.yunqueyi.com",
qiniuImgUrl: "https://file.yunqueyi.com", qiniuImgUrl: "https://file.yunqueyi.com",
......
...@@ -146,20 +146,7 @@ export function getBaseUrl(url) { ...@@ -146,20 +146,7 @@ export function getBaseUrl(url) {
return getConfigByEnvType('baseUrl') + url return getConfigByEnvType('baseUrl') + url
} }
// 获取API服务器域名地址
export function getApiUrl(url) {
return getConfigByEnvType('apiUrl') + url
}
// 获取WEB部署服务器域名地址
export function getWebPageUrl(url) {
return getConfigByEnvType('webPageUrl') + url
}
// 获取七牛token // 获取七牛token
export function getQiniuToken() {
return getConfigByEnvType('qiniuUrl')
}
export function getQiniuToken1() { export function getQiniuToken1() {
return getConfigByEnvType('qiniuFileUrl') return getConfigByEnvType('qiniuFileUrl')
} }
......
import fetch from '@/utils/fetch' import fetch from '@/utils/fetch'
import { getBaseUrl, getApiUrl } from '@/utils/index' import { getBaseUrl } from '@/utils/index'
module.exports = { module.exports = {
data: function () { data: function () {
...@@ -175,27 +175,6 @@ module.exports = { ...@@ -175,27 +175,6 @@ module.exports = {
}) })
}, },
// 通用GET请求
API_GET(api, para, callback) {
para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
let url = api + this.getUrlPara(para)
return fetch({
url: getApiUrl(url),
method: 'get',
data: para
})
},
// 通用POST请求
API_POST(api, para, callback) {
para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
return fetch({
url: getApiUrl(api),
method: 'post',
data: para
})
},
// 从html参数 // 从html参数
getUrlKey(name) { getUrlKey(name) {
if (decodeURIComponent && location.href) { if (decodeURIComponent && location.href) {
...@@ -219,7 +198,7 @@ module.exports = { ...@@ -219,7 +198,7 @@ module.exports = {
} }
} }
return null return null
}, }
} }
} }
import {isEmptyUtils, isNotEmptyUtils, subString} from "./utils"; import {isEmptyUtils, isNotEmptyUtils, subString} from "./utils";
import fetchQiniu from './fetchQiniu.js'; import fetchQiniu from './fetchQiniu.js';
import { getQiniuToken, getQiniuToken1, uploadVideo, uploadImg } from './index' import { getQiniuToken1, uploadVideo, uploadImg } from './index'
// let apiUrl = localStorage.getItem("qiniuUrl");
// let fileApiUrl = localStorage.getItem("qiniuFileUrl");
let apiUrl = getQiniuToken()
let fileApiUrl = getQiniuToken1() let fileApiUrl = getQiniuToken1()
//该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。 //该对象有一个 unsubscribe 方法取消订阅,同时终止上传行为。
let subscription = null; let subscription = null;
...@@ -82,32 +78,6 @@ export const createFilePath = (file, fileName) => { ...@@ -82,32 +78,6 @@ export const createFilePath = (file, fileName) => {
return filePath; return filePath;
}; };
/**
* 获取七牛上传凭证
*
* @return {Promise} token 七牛上传凭证
* */
const doQiniuAction = () => {
console.log('send---'+apiUrl);
return new Promise(function (resolve, reject) {
fetchQiniu(apiUrl,{}, 'GET').then(function (result) {
let token = null;
if (isNotEmptyUtils(result) && result.code == "000000") {
token = result.data.qiniuToken;
resolve(token);
console.log('七牛临时授权成功');
localStorage.setItem('qiniuToken',token);
} else {
reject(result);
console.error('七牛临时授权失败:', result);
}
}).catch(function (error) {
reject();
console.error('七牛临时授权失败:', error);
});
});
};
/** /**
* 获取七牛上传凭证 * 获取七牛上传凭证
* *
......
...@@ -124,20 +124,37 @@ ...@@ -124,20 +124,37 @@
</el-form> </el-form>
</div> </div>
<div class="second-step" v-else-if="active === 1"> <div class="second-step" v-else-if="active === 1">
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClickTabs">
<el-tab-pane label="设定行政范围" name="first"> <el-tab-pane label="设定行政范围" name="first">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col class="rim" :span="12"> <el-col class="rim" :span="12">
<!--
:load="loadNode"
lazy
default-expand-all
-->
<el-tree <el-tree
default-expand-all
:data="treeData" :data="treeData"
show-checkbox show-checkbox
default-expand-all
node-key="id" node-key="id"
ref="tree" ref="tree"
highlight-current highlight-current
:props="defaultProps" :props="defaultProps"
@check="onChecked" @check="onChecked"
></el-tree> >
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span>
<el-button
type="text"
icon="el-icon-caret-bottom"
size="mini"
@click="() => append(data,node)"
></el-button>
</span>
</span>
</el-tree>
</el-col> </el-col>
<el-col :span="11"> <el-col :span="11">
<el-tag <el-tag
...@@ -176,12 +193,20 @@ ...@@ -176,12 +193,20 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="small" type="primary" @click="">搜索</el-button> <el-button size="small" type="primary" @click="getOrganization()">搜索</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float:right;"> <el-form-item style="float:right;">
<el-button-group> <el-button-group>
<el-button size="small" type="default" @click="checkAll(true,'multipleOrganization')">选择全部</el-button> <el-button
<el-button size="small" type="default" @click="checkAll(false,'multipleOrganization')">全部不选</el-button> size="small"
type="default"
@click="checkAll(true,'multipleOrganization')"
>选择全部</el-button>
<el-button
size="small"
type="default"
@click="checkAll(false,'multipleOrganization')"
>全部不选</el-button>
</el-button-group> </el-button-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -256,8 +281,16 @@ ...@@ -256,8 +281,16 @@
</el-form-item> </el-form-item>
<el-form-item style="float:right;"> <el-form-item style="float:right;">
<el-button-group> <el-button-group>
<el-button size="small" type="default" @click="checkAll(true,'multiplePerson')">选择全部</el-button> <el-button
<el-button size="small" type="default" @click="checkAll(false,'multiplePerson')">全部不选</el-button> size="small"
type="default"
@click="checkAll(true,'multiplePerson')"
>选择全部</el-button>
<el-button
size="small"
type="default"
@click="checkAll(false,'multiplePerson')"
>全部不选</el-button>
</el-button-group> </el-button-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -336,7 +369,7 @@ ...@@ -336,7 +369,7 @@
<el-radio :label="2"></el-radio> <el-radio :label="2"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-show="formComponent.configure == 1" label="选择证书:" > <el-form-item v-show="formComponent.configure == 1" label="选择证书:">
<el-col :span="20"> <el-col :span="20">
<el-select <el-select
v-model="formComponent.certificate" v-model="formComponent.certificate"
...@@ -387,12 +420,13 @@ export default { ...@@ -387,12 +420,13 @@ export default {
return { return {
itemOrganization: itemOrganization, itemOrganization: itemOrganization,
itemPerson: itemPerson, itemPerson: itemPerson,
projectId: null,
//面包屑 //面包屑
curmbFirst: "教培项目", curmbFirst: "教培项目",
curmbSecond: "新建项目", curmbSecond: "新建项目",
//页面展示位置 //页面展示位置
stepData: [true, false, false], stepData: [true, false, false],
active: 0, active: 1,
activeName: "first", activeName: "first",
//基层信息 数据 //基层信息 数据
imageUrl: "", imageUrl: "",
...@@ -410,40 +444,44 @@ export default { ...@@ -410,40 +444,44 @@ export default {
fileList: [], fileList: [],
//设定行政范围 数据 //设定行政范围 数据
updatedTree: false, updatedTree: false,
treeProp: {
label: "name",
children: "zones",
isLeaf: "leaf"
},
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "label" label: "label",
isLeaf: "isLeaf"
}, },
treeData: returnData().treeData, //treeData: [],
treeData: [],
tagsRegion: [], tagsRegion: [],
//设定机构 数据 //设定机构 数据
organizationChange: false,
formOrganization: { formOrganization: {
name: "", name: "",
region: "", region: "",
grade: "", grade: "",
chechAll: true, chechAll: true,
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10
}, },
organizationRegion: [{ organizationRegion: [
id:'100', {
label: '上海', id: "100",
},{ label: "上海"
id:'101', },
label: '北京', {
}], id: "101",
organizationRank: [{ label: "北京"
id:'1', }
label: '一甲', ],
},{ organizationRank: [
id:'2', {
label: '二甲', id: "1",
}], label: "一甲"
},
{
id: "2",
label: "二甲"
}
],
hasOrganizationInit: false, hasOrganizationInit: false,
//tableOrganization: Array(10).fill(itemOrganization), //tableOrganization: Array(10).fill(itemOrganization),
tableOrganization: new Array(), tableOrganization: new Array(),
...@@ -461,7 +499,7 @@ export default { ...@@ -461,7 +499,7 @@ export default {
hospital: "", hospital: "",
department: "", department: "",
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10
}, },
tablePerson: new Array(), tablePerson: new Array(),
currentPerson: 1, currentPerson: 1,
...@@ -544,6 +582,7 @@ export default { ...@@ -544,6 +582,7 @@ export default {
}, },
created() { created() {
vm = this; vm = this;
this.projectId = vm.getUrlSearch(window.location.href, "projectId"),
this.editManager(); this.editManager();
this.changeOnStep(this.active); this.changeOnStep(this.active);
...@@ -602,11 +641,11 @@ export default { ...@@ -602,11 +641,11 @@ export default {
//设置选择项目组件页 //设置选择项目组件页
let componentEdit = []; let componentEdit = [];
let certificateEdit = 0; let certificateEdit = 0;
for(let i = 0;i<editData.componentData.length;i++) { for (let i = 0; i < editData.componentData.length; i++) {
componentEdit.push(editData.componentData[i].id); componentEdit.push(editData.componentData[i].id);
} }
this.formComponent.component = componentEdit; this.formComponent.component = componentEdit;
if(editData.certificateData.length > 0) { if (editData.certificateData.length > 0) {
this.formComponent.configure = 1; this.formComponent.configure = 1;
this.formComponent.certificate = editData.componentData[0].id; this.formComponent.certificate = editData.componentData[0].id;
} }
...@@ -720,7 +759,7 @@ export default { ...@@ -720,7 +759,7 @@ export default {
}; };
vm.POST("portalInfo/componentDraft", param).then(res => { vm.POST("portalInfo/componentDraft", param).then(res => {
console.log(res); console.log(res);
if(res.code == '000000') { if (res.code == "000000") {
this.$notify({ this.$notify({
title: "成功", title: "成功",
message: "项目创建成功" message: "项目创建成功"
...@@ -787,7 +826,6 @@ export default { ...@@ -787,7 +826,6 @@ export default {
if (this.active == 0) { if (this.active == 0) {
let formName = "formData"; let formName = "formData";
let removeState = this.submitForm(formName); let removeState = this.submitForm(formName);
console.log("判断移动" + removeState); console.log("判断移动" + removeState);
if (removeState === true) { if (removeState === true) {
//校验名字 //校验名字
...@@ -816,16 +854,32 @@ export default { ...@@ -816,16 +854,32 @@ export default {
this.stepData = [false, true, false]; this.stepData = [false, true, false];
this.initRange(); this.initRange();
} }
} }
} else if (this.active == 1) { } else if (this.active == 1) {
let removeState = true; let req = {
if (removeState === true) { projectId: 54,
//移动到第三页 选择项目组件 setKindOfAdministrative: 3,
scopeOfAdministrative: "000:2|000_110:1",
setKindOfOrganization: 3,
scopeOfOrganization: "2|3|4|5|6|7",
setKindOfDepartment: 3,
scopeOfDepartment: "54",
setKindOfPeople: 1,
scopeOfPeople: ""
};
vm.POST("scope", req).then(res => {
if (res.code == "000000") {
//移动到选择项目组件
console.log(res);
this.active++; this.active++;
this.stepData = [false, false, true]; this.stepData = [false, false, true];
} else {
this.$notify({
title: "",
message: res.message
});
} }
//this.stepData = [false, true, false]; });
} }
}, },
//图片上传 //图片上传
...@@ -963,34 +1017,50 @@ export default { ...@@ -963,34 +1017,50 @@ export default {
this.getAdministrative(); this.getAdministrative();
} }
}, },
//切换tabs
handleClickTabs(tab, event) {
let tabName = tab.name;
if (tabName == "second") {
//设定机构
this.getOrganization();
} else if (tabName == "third") {
//设定科室
} else if (tabName == "fourth") {
//设定人员
this.getPeople();
}
},
//初始化范围树
setTreeData(administrative) {
let treeIdList = [];
let checkList = [];
for (let i = 0; i < administrative.length; i++) {
treeIdList.push(administrative[i].id);
checkList[i] = {};
checkList[i].name = administrative[i].label;
checkList[i].key = administrative[i].id;
}
//console.log(treeIdList);
this.$refs.tree.setCheckedKeys(treeIdList);
this.tagsRegion = checkList;
},
//查询行政范围(树) //查询行政范围(树)
getAdministrative() { getAdministrative() {
let req = { let req = {
projectId: 1 projectId: 54
}; };
vm.GET("scope/v1/administrative", req).then(res => { vm.GET("scope/v1/administrative", req).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
//console.log(res.data); //console.log(res.data);
let administrativeAll = res.data.administrativeAll; let administrativeAll = res.data.administrativeAll;
console.log(administrativeAll); let administrative = res.data.administrative;
this.treeData = [] this.treeData = [];
this.treeData[0] = administrativeAll; this.treeData[0] = administrativeAll;
this.setTreeData(administrative);
console.log("treeData", this.treeData);
} }
}); });
}, },
//切换tab
handleClick(tab, event) {
let tabName = tab.name;
if(tabName == "second") {
//设定机构
this.getOrganization();
} else if(tabName == "third") {
//设定科室
} else if(tabName == "fourth") {
//设定人员
this.getPeople();
}
},
//列举选中地区 //列举选中地区
initCheckList(allSelectedKeys) { initCheckList(allSelectedKeys) {
...@@ -1012,18 +1082,60 @@ export default { ...@@ -1012,18 +1082,60 @@ export default {
} }
} }
}, },
//添加子节点
append(data, node) {
console.log("data:", data);
console.log("node:", node);
if (data.children.length == 0) {
let id = data.id + "add";
const newChild = [{ id: id, label: "testtest", children: [] },{ id: id, label: "22", children: [] }];
//data.children.push(newChild);
let req = {
id: data.id
};
vm.GET("scope/v1/administrative/children", req).then(res => {
if (res.code == "000000") {
let administrative = res.data.administrative;
console.log(administrative);
data.children = administrative;
//data.children.push(newChild);
}
});
}
},
//树结构 //树结构
loadNode(node, resolve) { loadNode(node, resolve) {
console.log(node);
if (node.level === 0) { if (node.level === 0) {
return resolve([{ label: "全国" }]); return resolve([{ label: "全国", id: "000", status: 0 }]);
} }
if (node.level > 1) return resolve([]); if (node.level === 1) {
let req = {
setTimeout(() => { //projectId: vm.getUrlSearch(window.location.href, "projectId"),
const data = []; projectId: 54
resolve(data); };
}, 500); vm.GET("scope/v1/administrative", req).then(res => {
if (res.code == "000000") {
let administrativeAll = res.data.administrativeAll;
let administrative = res.data.administrative;
let children = administrativeAll.children;
//console.log(administrativeAll);
return resolve(children);
}
});
}
if (node.level === 2 || node.level === 3 || node.level === 4) {
let req = {
id: node.data.id
};
vm.GET("scope/v1/administrative/children", req).then(res => {
if (res.code == "000000") {
let administrative = res.data.administrative;
return resolve(administrative);
}
});
}
if (node.level === 5) return resolve([]);
}, },
getCheckedKeys() { getCheckedKeys() {
console.log(this.$refs.tree.getCheckedKeys()); console.log(this.$refs.tree.getCheckedKeys());
...@@ -1043,10 +1155,10 @@ export default { ...@@ -1043,10 +1155,10 @@ export default {
}), }),
allSelectedKeys = savedCheckedKeys.concat(savedHalfCheckedKeys); allSelectedKeys = savedCheckedKeys.concat(savedHalfCheckedKeys);
//console.log(allSelectedKeys);
this.initCheckList(allSelectedKeys); this.initCheckList(allSelectedKeys);
//改变行政范围后,更新设定机构和设定人员 //改变行政范围后,更新设定机构和设定人员
this.updateOrganizationAndPerson(allSelectedKeys); this.updateOrganizationAndPerson(allSelectedKeys);
this.organizationChange = true;
}, },
// 递归删除列表中所有子节点 // 递归删除列表中所有子节点
delSubKeysByNode(node, checkedKeys) { delSubKeysByNode(node, checkedKeys) {
...@@ -1119,15 +1231,33 @@ export default { ...@@ -1119,15 +1231,33 @@ export default {
//this.$refs[name].clearSelection(); //this.$refs[name].clearSelection();
} }
}, },
//获取用户类型
getKind(type) {
let kind = 0;
if(type == 'organization') {
if(this.organizationChange) {
kind = 3;
} else {
kind = 0;
}
} else if(type == '') {
}
return kind;
},
//查询机构列表 //查询机构列表
getOrganization() { getOrganization() {
let req = { let req = {
projectId: 1, projectId: this.projectId,
setKind:3, setKind: this.getKind('organization'),
scope: '000_110', // scope: "000_110",
pageNum: this.formOrganization.pageNum, pageNum: this.formOrganization.pageNum,
pageSize: this.formOrganization.pageSize, pageSize: this.formOrganization.pageSize
}; };
if(req.setKind == 3) {
req.scope = '000_110';
console.log('tagsRegion',this.tagsRegion);
}
vm.GET("scope/v1/organization", req).then(res => { vm.GET("scope/v1/organization", req).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
console.log(res.data); console.log(res.data);
...@@ -1152,13 +1282,13 @@ export default { ...@@ -1152,13 +1282,13 @@ export default {
let req = { let req = {
projectId: 1, projectId: 1,
setKindOfAdministrative: 3, setKindOfAdministrative: 3,
scopeOfAdministrative: '000_110', scopeOfAdministrative: "000_110",
setKindOfOrganization: 3, setKindOfOrganization: 3,
scopeOfOrganization: '2|3|4|5|6|7', scopeOfOrganization: "2|3|4|5|6|7",
setKindOfDepartment: 3, setKindOfDepartment: 3,
scopeOfDepartment: 54, scopeOfDepartment: 54,
pageNum: this.formPersonnel.pageNum, pageNum: this.formPersonnel.pageNum,
pageSize: this.formPersonnel.pageSize, pageSize: this.formPersonnel.pageSize
}; };
vm.GET("scope/v1/people", req).then(res => { vm.GET("scope/v1/people", req).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
...@@ -1168,6 +1298,7 @@ export default { ...@@ -1168,6 +1298,7 @@ export default {
} }
}); });
}, },
//机构table修改 //机构table修改
handleSizeOrganization(val) { handleSizeOrganization(val) {
console.log(`每页 ${val} 条`); console.log(`每页 ${val} 条`);
...@@ -1312,6 +1443,10 @@ export default { ...@@ -1312,6 +1443,10 @@ export default {
} }
.second-step { .second-step {
margin: 10px 0 0 20px; margin: 10px 0 0 20px;
//隐藏树展开
.el-tree-node__expand-icon {
display: none;
}
.department { .department {
margin-top: 20px; margin-top: 20px;
border: 1px solid #dddddd; border: 1px solid #dddddd;
...@@ -1335,7 +1470,7 @@ export default { ...@@ -1335,7 +1470,7 @@ export default {
content: "•"; content: "•";
} }
.el-tag { .el-tag {
margin-right: 10px; margin: 0 10px 10px 0;
border: 1.3px solid #48a8fe; border: 1.3px solid #48a8fe;
color: #1e92fe; color: #1e92fe;
background-color: #e7f6fe; background-color: #e7f6fe;
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
</el-col> </el-col>
<el-col :span="10" v-if="idType == 1"> <el-col :span="10" v-if="idType == 1">
<el-form-item label="是否对外开放" prop="openFlag"> <el-form-item label="是否对外开放" prop="openFlag">
<el-radio-group v-model="item.openFlag" @change="selectIsOpen(index)" :disabled="item.moduleType == 2 || (componentId && item.openFlag == 2)"> <el-radio-group v-model="item.openFlag" @change="selectIsOpen(index)" :disabled="item.moduleType == 2 || (item.id != '' && item.openFlag == 2)">
<el-radio :label="2" @change="moduleOpenChange"></el-radio> <el-radio :label="2" @change="moduleOpenChange"></el-radio>
<el-radio :label="1" @change="moduleOpenChange"></el-radio> <el-radio :label="1" @change="moduleOpenChange"></el-radio>
</el-radio-group> </el-radio-group>
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<div class="template-btn" v-if="idType == 1"> <div class="template-btn" v-if="idType == 1">
<span class="word-size">添加一个模板</span> <span class="word-size">添加一个模板</span>
<el-button <el-button
:disabled="item.moduleType == 2 || (componentId && item.openFlag == 2)" :disabled="item.moduleType == 2 || (item.id != '' && item.openFlag == 2)"
v-for="(_item,_index) in templateDataList" v-for="(_item,_index) in templateDataList"
:key="_index" :key="_index"
type="primary" type="primary"
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<div class="template-content-div"> <div class="template-content-div">
<div class="title"> <div class="title">
{{item1.name}} {{item1.name}}
<span v-if="item.moduleType == 1 && componentId && item.openFlag == 1"> <span v-if="item.moduleType == 1 && (item.id == '' || (item.id != '' && item.openFlag == 1)) && idType == 1">
变更顺序: 变更顺序:
<i class="el-icon-caret-bottom" @click="sortUp(index,index1)" style="font-size:17px;"></i> <i class="el-icon-caret-bottom" @click="sortUp(index,index1)" style="font-size:17px;"></i>
<i class="el-icon-caret-top" @click="sortDown(index,index1)" style="font-size:17px;"></i> <i class="el-icon-caret-top" @click="sortDown(index,index1)" style="font-size:17px;"></i>
...@@ -141,15 +141,15 @@ ...@@ -141,15 +141,15 @@
<el-col :span="10" class="item-icon"> <el-col :span="10" class="item-icon">
<span class="require">*</span> <span class="require">*</span>
<el-form-item label="考试名称"> <el-form-item label="考试名称">
<el-input v-model="item3.content1" :disabled="item.moduleType == 2 || (componentId && item.openFlag == 2)" size="mini" maxlength='30' placeholder="请输入考试名称" style="width:288px;"></el-input> <el-input v-model="item3.content1" :disabled="item.moduleType == 2 || (item.id != '' && item.openFlag == 2) || idType == 2" size="mini" maxlength='30' placeholder="请输入考试名称" style="width:288px;"></el-input>
<span v-if="item2.numFlag == 2 && index3 == 0 && item.moduleType == 1 && componentId && item.openFlag == 1"><i class="el-icon-circle-plus" @click="addMatterCourse(index,index1,index2)" style="color:#449284;"></i></span> <span v-if="item2.numFlag == 2 && index3 == 0 && item.moduleType == 1 && idType == 1 && (item.id == '' || (item.id != '' && item.openFlag == 1))"><i class="el-icon-circle-plus" @click="addMatterCourse(index,index1,index2)" style="color:#449284;"></i></span>
<span v-if="item2.numFlag == 2 && index3 > 0 && item.moduleType == 1 && componentId && item.openFlag == 1"><i class="el-icon-delete" @click="deleteMatterCourse(index,index1,index2,index3)" style="color:red;"></i></span> <span v-if="item2.numFlag == 2 && index3 > 0 && item.moduleType == 1 && idType == 1 && (item.id == '' || (item.id != '' && item.openFlag == 1))"><i class="el-icon-delete" @click="deleteMatterCourse(index,index1,index2,index3)" style="color:red;"></i></span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10" class="item-icon"> <el-col :span="10" class="item-icon">
<span class="require">*</span> <span class="require">*</span>
<el-form-item label="关联考试"> <el-form-item label="关联考试">
<el-select v-model="item3.content2" @focus="examIDfocus(index,index1,index2,index3)" @change="changeExamID" :disabled="item.moduleType == 2 || (componentId && item.openFlag == 2)" size="mini" placeholder="请选择考试ID" style="width:288px;"> <el-select v-model="item3.content2" @focus="examIDfocus(index,index1,index2,index3)" @change="changeExamID" :disabled="item.moduleType == 2 || idType == 2 || (item.id != '' && item.openFlag == 2)" size="mini" placeholder="请选择考试ID" style="width:288px;">
<el-option <el-option
v-for="(itemTest,indexTest) in testIdSelect" v-for="(itemTest,indexTest) in testIdSelect"
:key="indexTest" :key="indexTest"
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
<el-col :span="10" class="item-icon"> <el-col :span="10" class="item-icon">
<span class="require">*</span> <span class="require">*</span>
<el-form-item label="配置证书"> <el-form-item label="配置证书">
<el-radio-group v-model="item3.certificateFlag" :disabled="item.moduleType == 2 || (componentId && item.openFlag == 2)"> <el-radio-group v-model="item3.certificateFlag" :disabled="item.moduleType == 2 || idType == 2 || (item.id != '' && item.openFlag == 2)">
<el-radio :label="2"></el-radio> <el-radio :label="2"></el-radio>
<el-radio :label="1"></el-radio> <el-radio :label="1"></el-radio>
</el-radio-group> </el-radio-group>
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
<el-col :span="10" v-if="item3.certificateFlag == 2" class="item-icon"> <el-col :span="10" v-if="item3.certificateFlag == 2" class="item-icon">
<span class="require">*</span> <span class="require">*</span>
<el-form-item label="选择证书"> <el-form-item label="选择证书">
<el-select v-model="item3.content3" :disabled="item.moduleType == 2 || (componentId && item.openFlag == 2)" size="mini" placeholder="请选择证书" style="width:288px;"> <el-select v-model="item3.content3" :disabled="item.moduleType == 2 || idType == 2 || (item.id != '' && item.openFlag == 2)" size="mini" placeholder="请选择证书" style="width:288px;">
<el-option <el-option
v-for="(itemCertificate,indexCertificate) in certificateIdSelect" v-for="(itemCertificate,indexCertificate) in certificateIdSelect"
:key="indexCertificate" :key="indexCertificate"
...@@ -193,15 +193,15 @@ ...@@ -193,15 +193,15 @@
<el-col :span="10" class="item-icon"> <el-col :span="10" class="item-icon">
<span class="require">*</span> <span class="require">*</span>
<el-form-item label="课程名称"> <el-form-item label="课程名称">
<el-input v-model="item3.content1" :disabled="item.moduleType == 2 || (componentId && item.openFlag == 2)" size="mini" maxlength='30' placeholder="请输入课程名称" style="width:288px;"></el-input> <el-input v-model="item3.content1" :disabled="item.moduleType == 2 || idType == 2 || (item.id != '' && item.openFlag == 2)" size="mini" maxlength='30' placeholder="请输入课程名称" style="width:288px;"></el-input>
<span v-if="item2.numFlag == 2 && index3 == 0 && item.moduleType == 1 && componentId && item.openFlag == 1"><i class="el-icon-circle-plus" @click="addMatterCourse(index,index1,index2)" style="color:#449284;"></i></span> <span v-if="item2.numFlag == 2 && index3 == 0 && item.moduleType == 1 && idType == 1 && (item.id == '' || (item.id != '' && item.openFlag == 1))"><i class="el-icon-circle-plus" @click="addMatterCourse(index,index1,index2)" style="color:#449284;"></i></span>
<span v-if="item2.numFlag == 2 && index3 > 0 && item.moduleType == 1 && componentId && item.openFlag == 1"><i class="el-icon-delete" @click="deleteMatterCourse(index,index1,index2,index3)" style="color:red;"></i></span> <span v-if="item2.numFlag == 2 && index3 > 0 && item.moduleType == 11 && idType == 1 && (item.id == '' || (item.id != '' && item.openFlag == 1))"><i class="el-icon-delete" @click="deleteMatterCourse(index,index1,index2,index3)" style="color:red;"></i></span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10" class="item-icon"> <el-col :span="10" class="item-icon">
<span class="require">*</span> <span class="require">*</span>
<el-form-item label="关联课程"> <el-form-item label="关联课程">
<el-select v-model="item3.content2" @focus="courseIDfocus(index,index1,index2,index3)" @change="changeCourseID" :disabled="item.moduleType == 2 || (componentId && item.openFlag == 2)" size="mini" placeholder="请选择课程ID" style="width:288px;"> <el-select v-model="item3.content2" @focus="courseIDfocus(index,index1,index2,index3)" @change="changeCourseID" :disabled="item.moduleType == 2 || idType == 2 || (item.id != '' && item.openFlag == 2)" size="mini" placeholder="请选择课程ID" style="width:288px;">
<el-option <el-option
v-for="(itemCourse,indexCourse) in courseIdSelect" v-for="(itemCourse,indexCourse) in courseIdSelect"
:key="indexCourse" :key="indexCourse"
...@@ -287,7 +287,7 @@ import BreadCrumb from '../../components/breadcrumb.vue' ...@@ -287,7 +287,7 @@ import BreadCrumb from '../../components/breadcrumb.vue'
import { doUpload, getFilePath } from "../../utils/qiniuUtil" import { doUpload, getFilePath } from "../../utils/qiniuUtil"
import { validateWord150 } from "../../utils/validate.js" import { validateWord150 } from "../../utils/validate.js"
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { openLoading, closeLoading, isNotEmptyUtils } from '../../utils/utils'; import { openLoading, closeLoading, isNotEmptyUtils, isEmptyList } from '../../utils/utils';
let vm = null let vm = null
// 判断组件是否重名 // 判断组件是否重名
let validateRepeatWord = function(rule, value, callback, message) { let validateRepeatWord = function(rule, value, callback, message) {
...@@ -384,7 +384,7 @@ export default { ...@@ -384,7 +384,7 @@ export default {
courseIdSelect: [], // 课程下拉列表 courseIdSelect: [], // 课程下拉列表
dialogData: [], dialogData: [],
portalComponent: { portalComponent: {
idType: 1, idType: '',
organizationId: '', organizationId: '',
name: '', name: '',
id: '', id: '',
...@@ -507,6 +507,7 @@ export default { ...@@ -507,6 +507,7 @@ export default {
}, },
// 暂存(下一步) // 暂存(下一步)
storageAndNext(flag) { storageAndNext(flag) {
vm.itemName = vm.portalComponent.name
if(vm.componentId) { // 编辑 if(vm.componentId) { // 编辑
vm.submitBasicData(flag,'portalComponent/updatePortalComponent') vm.submitBasicData(flag,'portalComponent/updatePortalComponent')
}else{ // 新增 }else{ // 新增
...@@ -663,9 +664,9 @@ export default { ...@@ -663,9 +664,9 @@ export default {
vm.componentList.moduleModelList[index].openFlag = vm.componentList.moduleModelList[index].openFlag == 1 ? 2 : 1 vm.componentList.moduleModelList[index].openFlag = vm.componentList.moduleModelList[index].openFlag == 1 ? 2 : 1
}, },
moduleOpenChange(value) { moduleOpenChange(value) {
for(let i=0;i<vm.componentList.moduleModelList.length;i++) { for(let i = 0; i < vm.componentList.moduleModelList.length; i++) {
if(vm.moduleIndex == i) { if(vm.moduleIndex == i) {
if(value == '') { if(value == '1') {
vm.componentList.moduleModelList[i].openFlag = 2 vm.componentList.moduleModelList[i].openFlag = 2
}else{ }else{
vm.componentList.moduleModelList[i].openFlag = 1 vm.componentList.moduleModelList[i].openFlag = 1
...@@ -784,6 +785,7 @@ export default { ...@@ -784,6 +785,7 @@ export default {
vm.GET('portalComponent/deletePortalTemplateById',{id: vm.componentList.moduleModelList[i].templetModelList[index1].id}).then((res) => { vm.GET('portalComponent/deletePortalTemplateById',{id: vm.componentList.moduleModelList[i].templetModelList[index1].id}).then((res) => {
if( res.code == '000000') { if( res.code == '000000') {
vm.$message.info('成功删除模板!') vm.$message.info('成功删除模板!')
vm.getModuleData()
} }
}) })
} else { } else {
...@@ -804,8 +806,8 @@ export default { ...@@ -804,8 +806,8 @@ export default {
vm.componentList.moduleModelList[i].templetModelList[j].partModelList[q].partContentModelList.push({ vm.componentList.moduleModelList[i].templetModelList[j].partModelList[q].partContentModelList.push({
id: '', id: '',
seqNo: '', seqNo: '',
content_1: '', content1: '',
content_2: '' content2: ''
}) })
break break
} }
...@@ -874,7 +876,7 @@ export default { ...@@ -874,7 +876,7 @@ export default {
finishConponent(flag) { finishConponent(flag) {
let req = null let req = null
if(vm.componentList.moduleModelList && vm.componentList.moduleModelList.length > 0) { if(vm.componentList.moduleModelList && vm.componentList.moduleModelList.length > 0) {
for(let i=0;i<vm.componentList.moduleModelList.length;i++) { for(let i = 0; i < vm.componentList.moduleModelList.length; i++) {
if(flag == 2) { // 完成 if(flag == 2) { // 完成
req = { req = {
id: vm.componentId, id: vm.componentId,
...@@ -884,10 +886,18 @@ export default { ...@@ -884,10 +886,18 @@ export default {
vm.$message.info("请输入模块名称") vm.$message.info("请输入模块名称")
return return
} }
if(!vm.componentList.moduleModelList[i]) { if(isEmptyList(vm.componentList.moduleModelList[i].templetModelList)) {
vm.$message.info("请给第"+ parseInt(i + 1) +"个模块添加有效模板后再保存") vm.$message.info("请给第"+ parseInt(i + 1) +"个模块添加有效模板后再保存")
return return
} }
for(let j = 0; j < vm.componentList.moduleModelList[i].templetModelList.length; j++) {
for(let k = 0; k < vm.componentList.moduleModelList[i].templetModelList[j].partModelList.length; k++) {
if(!vm.componentList.moduleModelList[i].templetModelList[j].partModelList[k].partContentModelList[0].content1 || !vm.componentList.moduleModelList[i].templetModelList[j].partModelList[k].partContentModelList[0].content2) {
vm.$message.info( vm.componentList.moduleModelList[i].templetModelList[j].name + "中名称为空,请添加内容后保存")
return
}
}
}
}else{ // 暂存 }else{ // 暂存
req = { req = {
id: vm.componentId, id: vm.componentId,
...@@ -905,15 +915,17 @@ export default { ...@@ -905,15 +915,17 @@ export default {
finishModule(req, flag) { finishModule(req, flag) {
vm.POST('portalComponent/insertOrUpdatePortalModule',{model: vm.componentList.moduleModelList,status: flag}).then((res) => { vm.POST('portalComponent/insertOrUpdatePortalModule',{model: vm.componentList.moduleModelList,status: flag}).then((res) => {
if( res.code == '000000') { if( res.code == '000000') {
vm.enableComponent(req) vm.enableComponent(req, flag)
} }
}) })
}, },
// 启用 // 启用
enableComponent(req) { enableComponent(req, flag) {
vm.GET('portalComponent/disableOrStart',req).then((res) => { vm.GET('portalComponent/disableOrStart',req).then((res) => {
if(res.code == "000000") { if(res.code == "000000") {
if(flag == 2) {
vm.$router.push({ path: 'item-component' }) vm.$router.push({ path: 'item-component' })
}
} else { } else {
vm.$message({ vm.$message({
message: res.message, message: res.message,
......
...@@ -306,7 +306,7 @@ export default { ...@@ -306,7 +306,7 @@ export default {
message: "ID为:" + row.id + "的项目删除成功" message: "ID为:" + row.id + "的项目删除成功"
}); });
this.loading = true; this.loading = true;
that.getProjectList(); vm.getProjectList();
} }
}); });
}, },
......
<template>
<div>
<el-tree
:data="data2"
show-checkbox
default-expand-all
node-key="id"
ref="tree"
highlight-current
:props="defaultProps"
@check="onChecked"
></el-tree>
<!-- <base1
:data="data2"
show-checkbox
default-expand-all
node-key="id"
ref="tree"
highlight-current
:props="defaultProps"
></base1>-->
<span></span>
<div class="buttons">
<el-button @click="getCheckedNodes">通过 node 获取</el-button>
<el-button @click="getCheckedKeys">通过 key 获取</el-button>
<el-button @click="setCheckedNodes">通过 node 设置</el-button>
<el-button @click="setCheckedKeys">通过 key 设置</el-button>
<el-button @click="resetChecked">清空</el-button>
</div>
</div>
</template>
<script>
import { ELTree1 } from "element-ui/lib/checkbox";
// import Vue from 'vue'
// require("element-ui/lib/checkbox"
export default {
// components: {
// base1
// },
mounted() {
// const base1 = Vue.extend(ELTree)
// Vue.component('base1', base1)
},
data() {
return {
data2: [
{
id: 11,
label: "一级 1",
children: [
{
id: 1,
label: "一级 1",
children: [
{
id: 4,
label: "二级 1-1",
children: [
{
id: 9,
label: "三级 1-1-1"
},
{
id: 10,
label: "三级 1-1-2"
}
]
}
]
},
{
id: 2,
label: "一级 2",
children: [
{
id: 5,
label: "二级 2-1"
},
{
id: 6,
label: "二级 2-2"
}
]
},
{
id: 3,
label: "一级 3",
children: [
{
id: 7,
label: "二级 3-1"
},
{
id: 8,
label: "二级 3-2"
}
]
}
]
}
],
defaultProps: {
children: "children",
label: "label"
}
};
},
methods: {
getCheckedNodes() {
console.log(this.$refs.tree.getCheckedNodes());
},
getCheckedKeys() {
console.log(this.$refs.tree.getCheckedKeys());
},
setCheckedNodes() {
this.$refs.tree.setCheckedNodes([
{
id: 5,
label: "二级 2-1"
},
{
id: 9,
label: "三级 1-1-1"
}
]);
},
setCheckedKeys() {
this.$refs.tree.setCheckedKeys([3]);
},
resetChecked() {
this.$refs.tree.setCheckedKeys([]);
},
onChecked() {
let cData = [],
oldData = (this.data2.length && this.data2.slice()) || [],
checkedKeys = this.$refs.tree.getCheckedKeys(),
halfCheckedKeys = this.$refs.tree.getHalfCheckedKeys(),
savedCheckedKeys = this.handlerCheckedData(oldData, checkedKeys).map(
key => {
return { type: 2, key: key };
}
),
savedHalfCheckedKeys = halfCheckedKeys.map(key => {
return { type: 1, key: key };
}),
allSelectedKeys = savedCheckedKeys.concat(savedHalfCheckedKeys);
console.log("treeData", this.data2);
console.log(allSelectedKeys);
},
// 递归删除列表中所有子节点
delSubKeysByNode(node, checkedKeys) {
let idIndex;
if (node.children && node.children.length) {
if (node.children && node.children.length) {
node.children.forEach(elm => {
idIndex = checkedKeys.findIndex(id => {
return id === elm.id;
});
if (idIndex > -1) {
checkedKeys.splice(idIndex, 1);
}
if (elm.children && elm.children.length) {
this.delSubKeysByNode(elm, checkedKeys);
}
});
}
}
},
// 去除子节点
handlerCheckedData(oldData, checkedKeys) {
oldData.forEach(element => {
for (let i = 0; i < checkedKeys.length; i++) {
// 如果此节点被选中,则删除所有子节点
if (element.id === checkedKeys[i]) {
this.delSubKeysByNode(element, checkedKeys);
} else {
if (element.children && element.children.length) {
this.handlerCheckedData(element.children, checkedKeys);
}
}
}
});
return checkedKeys;
}
}
};
</script>
\ No newline at end of file
...@@ -59,24 +59,7 @@ export default { ...@@ -59,24 +59,7 @@ export default {
spanSecondNum: 12, spanSecondNum: 12,
tableData: [], tableData: [],
count: 0, count: 0,
messageList:[ messageList:[]
// {
// menuName: '审核提醒',
// type: 1,
// portalTime: '2019-01-02',
// content: '王小波创建了"浙江省2019高血压第一季度考试"项目,提醒您审核。'
// },{
// menuName: '审核未通过',
// type: 2,
// portalTime: '2019-01-02',
// content: '王小波创建了"浙江省2019高血压第一季度考试"项目,提醒您审核。'
// },{
// menuName: '审核通过',
// type: 3,
// portalTime: '2019-01-02',
// content: '王小波创建了"浙江省2019高血压第一季度考试"项目,提醒您审核。'
// }
]
} }
}, },
created() { created() {
......
...@@ -57,6 +57,11 @@ export default { ...@@ -57,6 +57,11 @@ export default {
title: '项目管理', title: '项目管理',
icon: 'el-icon-setting', icon: 'el-icon-setting',
index: 'item-manager' index: 'item-manager'
},
{
title: '树',
icon: 'el-icon-setting',
index: 'tree'
} }
] ]
},{ },{
......
...@@ -48,10 +48,12 @@ let treeData = [ ...@@ -48,10 +48,12 @@ let treeData = [
id: 11, id: 11,
name: "一级 1", name: "一级 1",
label: "一级 1", label: "一级 1",
isLeaf: "true",
children: [ children: [
{ {
id: 1, id: 1,
label: "一级 1", label: "一级 1",
isLeaf: "true",
children: [ children: [
{ {
id: 4, id: 4,
...@@ -75,14 +77,21 @@ let treeData = [ ...@@ -75,14 +77,21 @@ let treeData = [
children: [ children: [
{ {
id: 5, id: 5,
label: "二级 2-1" label: "二级 2-1",
children: [],
}, },
{ {
id: 6, id: 6,
label: "二级 2-2" label: "二级 2-2",
isLeaf: false,
} }
] ]
}, },
{
id: 4,
label: "一级 4",
isLeaf: false,
},
{ {
id: 3, id: 3,
label: "一级 3", label: "一级 3",
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册