提交 a298c993 编写于 作者: zhentian.jia's avatar zhentian.jia

fix bug 17:08

上级 aa51195b
export function getAdministrative(data) {
let list = data.split('|');
//for(let i)
console.log(list);
return list
}
export function getLevelList(data) {
let level = [];
for (let i = 0; i < data.length; i++) {
let obj = {
id: data[i].no,
label: data[i].value,
}
level.push(obj);
}
console.log(level);
return level;
}
function recursiveTraverse (node) {
let afterTree = [];
node.forEach(function(item, index) {
let obj = {
value: item.id,
label: item.label,
}
afterTree.push(obj);
});
return afterTree;
}
//拼装选择的tree
export function getTreeData(data) {
console.log('allTree', data, data.length);
let afterTree = recursiveTraverse(data.children);
console.log('afterTree ',afterTree);
let options = [
{
value: 'zhinan',
label: '指南',
children: [{
value: 'shejiyuanze',
label: '设计原则',
children: [{
value: 'yizhi',
label: '一致'
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '导航',
children: [{
value: 'cexiangdaohang',
label: '侧向导航'
}, {
value: 'dingbudaohang',
label: '顶部导航'
}]
}]
}, {
value: 'zujian',
label: '组件',
children: [{
value: 'basic',
label: 'Basic',
children: [{
value: 'layout',
label: 'Layout 布局'
}, {
value: 'color',
label: 'Color 色彩'
}, {
value: 'typography',
label: 'Typography 字体'
}, {
value: 'icon',
label: 'Icon 图标'
}, {
value: 'button',
label: 'Button 按钮'
}]
}, {
value: 'form',
label: 'Form',
children: [{
value: 'radio',
label: 'Radio 单选框'
}, {
value: 'checkbox',
label: 'Checkbox 多选框'
}, {
value: 'input',
label: 'Input 输入框'
}, {
value: 'input-number',
label: 'InputNumber 计数器'
}, {
value: 'select',
label: 'Select 选择器'
}, {
value: 'cascader',
label: 'Cascader 级联选择器'
}, {
value: 'switch',
label: 'Switch 开关'
}, {
value: 'slider',
label: 'Slider 滑块'
}, {
value: 'time-picker',
label: 'TimePicker 时间选择器'
}, {
value: 'date-picker',
label: 'DatePicker 日期选择器'
}, {
value: 'datetime-picker',
label: 'DateTimePicker 日期时间选择器'
}, {
value: 'upload',
label: 'Upload 上传'
}, {
value: 'rate',
label: 'Rate 评分'
}, {
value: 'form',
label: 'Form 表单'
}]
}, {
value: 'data',
label: 'Data',
children: [{
value: 'table',
label: 'Table 表格'
}, {
value: 'tag',
label: 'Tag 标签'
}, {
value: 'progress',
label: 'Progress 进度条'
}, {
value: 'tree',
label: 'Tree 树形控件'
}, {
value: 'pagination',
label: 'Pagination 分页'
}, {
value: 'badge',
label: 'Badge 标记'
}]
}, {
value: 'notice',
label: 'Notice',
children: [{
value: 'alert',
label: 'Alert 警告'
}, {
value: 'loading',
label: 'Loading 加载'
}, {
value: 'message',
label: 'Message 消息提示'
}, {
value: 'message-box',
label: 'MessageBox 弹框'
}, {
value: 'notification',
label: 'Notification 通知'
}]
}, {
value: 'navigation',
label: 'Navigation',
children: [{
value: 'menu',
label: 'NavMenu 导航菜单'
}, {
value: 'tabs',
label: 'Tabs 标签页'
}, {
value: 'breadcrumb',
label: 'Breadcrumb 面包屑'
}, {
value: 'dropdown',
label: 'Dropdown 下拉菜单'
}, {
value: 'steps',
label: 'Steps 步骤条'
}]
}, {
value: 'others',
label: 'Others',
children: [{
value: 'dialog',
label: 'Dialog 对话框'
}, {
value: 'tooltip',
label: 'Tooltip 文字提示'
}, {
value: 'popover',
label: 'Popover 弹出框'
}, {
value: 'card',
label: 'Card 卡片'
}, {
value: 'carousel',
label: 'Carousel 走马灯'
}, {
value: 'collapse',
label: 'Collapse 折叠面板'
}]
}]
}, {
value: 'ziyuan',
label: '资源',
children: [{
value: 'axure',
label: 'Axure Components'
}, {
value: 'sketch',
label: 'Sketch Templates'
}, {
value: 'jiaohu',
label: '组件交互文档'
}]
}];
return afterTree;
}
\ No newline at end of file
......@@ -180,7 +180,7 @@
</div>
<div class="second-step" v-else-if="active === 1">
<el-tabs v-model="activeName" @tab-click="handleClickTabs">
<el-tab-pane v-if="idType == 1" label="设定行政范围" name="first">
<el-tab-pane v-if="idType !== 2" label="设定行政范围" name="first">
<el-row :gutter="20">
<el-col class="rim" :span="12">
<!--
......@@ -233,11 +233,11 @@
:value="item.id"
></el-option>
</el-select>-->
<!-- <el-cascader
<el-cascader
expand-trigger="hover"
:options="organizationRegion"
v-model="formOrganization.region"
></el-cascader>-->
></el-cascader>
</el-form-item>
<el-form-item>
<el-select size="mini" v-model="formOrganization.grade" placeholder="全部医院级别">
......@@ -473,10 +473,10 @@
<script>
import BreadCrumb from "../../components/breadcrumb.vue";
import { doUpload, getFilePath } from "../../utils/qiniu-util";
import { returnData } from "../mock";
import { mapGetters } from "vuex";
import { openLoading, closeLoading } from "../../utils/utils";
import * as commonUtil from "../../utils/utils";
import * as operationData from "../../utils/operation";
let vm = null;
export default {
components: {
......@@ -548,6 +548,7 @@ export default {
},
fileList: [],
//设定行政范围 数据
scopeReq: {},
allSelectedKeys: [],
updatedTree: false,
defaultProps: {
......@@ -566,32 +567,14 @@ export default {
updatedOrganization: false,
formOrganization: {
name: "",
region: "",
region: [],
grade: "",
chechAll: true,
pageNum: 1,
pageSize: 10
},
organizationRegion: [
{
id: "100",
label: "上海"
},
{
id: "101",
label: "北京"
}
],
organizationRank: [
{
id: "1",
label: "一甲"
},
{
id: "2",
label: "二甲"
}
],
organizationRegion: [],
organizationRank: [],
hasOrganizationInit: false,
tableOrganization: new Array(),
multipleSelectionOrganization: [],
......@@ -904,7 +887,9 @@ export default {
let req = {};
vm.GET("portal/scope/v1/"+this.projectId+"/operation/last", req).then(res => {
if (res.code == "000000") {
console.log(res);
this.scopeReq = res.data.scopeReq;
console.log(this.scopeReq);
//operationData.getAdministrative(res.data.scopeReq.scopeOfAdministrative);
}
});
},
......@@ -1082,7 +1067,7 @@ export default {
} else {
vm.uploadImgMessage2 = false;
}
console.log("判断移动" + removeState);
//console.log("判断移动" + removeState);
if (removeState === true) {
//校验名字
let projectId = vm.getUrlSearch(window.location.href, "projectId");
......@@ -1379,7 +1364,7 @@ export default {
//新建
} else {
//编辑
if (this.idType == 1) {
if (this.idType !== 2) {
this.getAdministrative();
} else {
this.activeName = "second";
......@@ -1394,6 +1379,7 @@ export default {
//设定机构
this.getCheckedTree();
this.getOrganization();
this.listLevels();
} else if (tabName == "third") {
//设定科室
// if (this.checkTableState.multipleDepartment && this.firstDepartment) {
......@@ -1411,7 +1397,8 @@ export default {
//获取勾选树
getCheckedTree() {
let allTree = Object.assign({}, this.treeData[0].children);
console.log(allTree);
//this.organizationRegion = operationData.getTreeData(this.treeData[0]);
//console.log('allTree',this.treeData[0]);
},
//初始化范围树
setTreeData(administrative) {
......@@ -1446,7 +1433,6 @@ export default {
}
});
},
//列举选中地区
initCheckList(allSelectedKeys) {
this.tagsRegion = [];
......@@ -1513,39 +1499,6 @@ export default {
});
}
},
//树结构
loadNode(node, resolve) {
if (node.level === 0) {
return resolve([{ label: "全国", id: "000", status: 0 }]);
}
if (node.level === 1) {
let req = {
//projectId: vm.getUrlSearch(window.location.href, "projectId"),
projectId: 54
};
vm.GET("portal/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("portal/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() {
console.log(this.$refs.tree.getCheckedKeys());
},
......@@ -1659,6 +1612,16 @@ export default {
}
return reverse;
},
//获取医院等级
listLevels() {
let req = {};
vm.GET("contents/courseDoctor/listLevels?sysCode=10", req).then(res => {
if (res.code == "000000") {
console.log(res);
this.organizationRank = operationData.getLevelList(res.data.list);
}
});
},
//改变 设定机构选项
selectionChangeOrganization(val) {
this.multipleSelectionOrganization = val;
......@@ -1669,7 +1632,7 @@ export default {
this.updatedOrganization == false
) {
this.updatedOrganization = true;
console.log("机构被更新", this.updatedOrganization);
//console.log("机构被更新", this.updatedOrganization);
}
if (this.updatedOrganization == true) {
this.changedOrganization[this.formOrganization.pageNum] = [];
......@@ -1681,7 +1644,7 @@ export default {
this.multipleSelectionOrganization
);
this.changedOrganization[this.formOrganization.pageNum][1] = reverse;
console.log("check机构:", this.changedOrganization);
//console.log("check机构:", this.changedOrganization);
}
},
//改变机构 table 的check状态
......
......@@ -183,7 +183,7 @@
import BreadCrumb from "../../components/breadcrumb.vue";
import { create } from "domain";
import { mapGetters } from 'vuex'
import { returnData } from "../mock";
import { returnData } from "../../utils/mock";
import { openLoading, closeLoading } from "../../utils/utils";
import * as commonUtil from "../../utils/utils";
import { setTimeout } from 'timers';
......
let data = {
"projectModel":
{
"projectBegintime": 1551948983468,
"projectEndtime": 1551948983468,
"projectIntro": "测试用例",
"projectName": "testProjectName"
},
"attachmentModel": [
{
"attachmentType": 1,
"attachmentUrl": "www.baidu.com",
"kind": 1, "seqNo": 1
},
{
"attachmentType": 2,
"attachmentUrl": "www.qq.com",
"kind": 2, "seqNo": 1
}
],
"attachmentPDFModel": [
{
"attachmentType": 3,
"attachmentUrl": "www.pdf.com",
"kind": 3
}
]
};
let req = {
projectModel:
'{"id":6,"projectBegintime":1551853576789,"projectEndtime":1551853576789,"projectIntro":"测试用例","projectName":"testProjectName"}',
attachmentModel:
'[{"attachmentType":1,"attachmentUrl":"www.baidu.com","kind":1,"portalProjectId":6,"seqNo":1},{"attachmentType":2,"attachmentUrl":"www.qq.com","kind":2,"portalProjectId":6,"seqNo":1}]',
attachmentPDFModel:
'[{"attachmentType":3,"attachmentUrl":"www.pdf.com","kind":3,"portalProjectId":6},{"attachmentType":3,"attachmentUrl":"www.pdf.com","kind":3,"portalProjectId":6}]'
};
/**
projectModel
ProjectBegintime ProjectEndtime 开始结束时间
projectIntro 项目简介 test
ProjectName 项目名称
attachmentModel 附件信息
attachmentType 1:项目列表 2:封面信息(图片和视频) 3:PDF
attachmenturl 链接
kind 1:图片 2:视频 3:PDF
attachmentName 附件名称
attachment_ext 附件格式
attachment_size 附件大小
*/
\ No newline at end of file
<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
......@@ -176,7 +176,7 @@ export default {
value: "L1"
},
{
label: "项目管理员",
label: "项目负责人",
value: "L2"
},
{
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册