Commit 97441189 by 李长胜

增加搜索框

1 parent 9d41b271
......@@ -2,13 +2,29 @@
<div class="system-container">
<div class="container">
<div class="topform">
<rule-form :ruleForm="addUpdateForm" :rules="rules" :ruleData="addUpdateData" :labelWidth="'120px'" ref="addUpdateForm">
<rule-form
:ruleForm="addUpdateForm"
:rules="rules"
:ruleData="addUpdateData"
:labelWidth="'120px'"
ref="addUpdateForm"
>
<div slot="select-type">
<el-select v-model="addUpdateForm.initOrganize" placeholder="请选择" :disabled="
<el-select
v-model="addUpdateForm.initOrganize"
placeholder="请选择"
:disabled="
this.$route.query.title == 'view' ||
this.$route.query.title == 'edit'
" filterable>
<el-option v-for="i in tenantList" :key="i.tenantId" :label="i.departmentName" :value="i.tenantId">
"
filterable
>
<el-option
v-for="i in tenantList"
:key="i.tenantId"
:label="i.departmentName"
:value="i.tenantId"
>
</el-option>
</el-select>
</div>
......@@ -23,14 +39,38 @@
<div class="layer" v-if="!showTree">
<i class="el-icon-loading"></i> 正在加载中...
</div>
<el-tree v-if="showTree" :data="treedata" :default-expanded-keys="expandedKey" :props="defaultProps" show-checkbox node-key="id" ref="tree" highlight-current lazy :load="loadNode">
<div class="searchInput" v-if="showTree">
<el-input placeholder="输入关键字进行查询" v-model="filterText">
</el-input>
</div>
<el-tree
v-if="showTree"
:data="treedata"
:default-expanded-keys="expandedKey"
:props="defaultProps"
show-checkbox
node-key="id"
ref="tree"
highlight-current
lazy
:load="loadNode"
:filter-node-method="filterNode"
>
</el-tree>
</div>
</div>
<div class="pull-right">
<el-button type="primary" @click="submitForm" :loading="aloading" v-if="!(setPageTitle == 'view')">保存</el-button>
<el-button @click="handCancle('addUpdateForm')">取消</el-button>
<el-button
type="primary"
@click="submitForm"
:loading="aloading"
v-if="!(setPageTitle == 'view')"
>保存</el-button
>
<el-button @click="handCancle('addUpdateForm')" :loading="bloading"
>取消</el-button
>
</div>
</div>
</template>
......@@ -91,6 +131,7 @@ export default {
enableStatus: [{ required: true }],
// menuIdList: [{ required: true, validator: checkMenu, trigger: "blur" }],
},
filterText:'',
treedata: [],
treeLeafData: [],
tenantList: [],
......@@ -104,6 +145,7 @@ export default {
showTree: false,
checkList: [],
aloading: false,
bloading: false,
expandedKey: [],
tenantListElement: {},
type: 1,
......@@ -119,6 +161,11 @@ export default {
: "view";
},
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
},
created() {},
mounted() {
let _this = this;
......@@ -165,18 +212,13 @@ export default {
this.getInfo(o.id);
}
},
methods: {
// 获取页面详情的接口
editVehicleType(params) {
editVehicleType(params).then((res) => {
if (res.code == "200") {
this.addUpdateForm.name = res.data.name || "暂无";
this.addUpdateForm.initOrganize = res.data.tenantId;
this.addUpdateForm.enableStatus =
res.data.enableStatus == 2 ? false : true;
}
});
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
// 获取租户列表
getTenantList(params) {
getTenantList(params).then((res) => {
......@@ -301,6 +343,7 @@ export default {
_this.goBack();
})
.catch((error) => {
console.log("错误信息:", error);
_this.aloading = false;
});
});
......@@ -308,6 +351,7 @@ export default {
// 取消保存
handCancle(formName) {
this.bloading = true;
this.goBack();
},
......@@ -344,13 +388,14 @@ export default {
}
let o = res.data || {};
let typeList = o.typeIds;
console.log(new Date().getTime());
console.log("开始", new Date().getTime());
_this.treeMainWorker(o).then((j) => {
console.log(j);
// console.log("扩展开来得key数组", j);
_this.expandedKey = j;
// console.log("typeList得数组", typeList);
_this.$refs.tree.setCheckedKeys(typeList);
});
console.log(new Date().getTime());
console.log("结束", new Date().getTime());
this.addUpdateForm.name = o.name || "暂无";
this.addUpdateForm.initOrganize = o.tenantId;
......@@ -413,6 +458,8 @@ export default {
_this.treedata = _obj.tree;
_this.newArr = _obj.data;
resolve(_obj);
//关闭线程
// webWorker.terminate();
};
// 监听文件失败
webWorker.onmessageerror = function (e) {
......@@ -497,6 +544,8 @@ export default {
// _this.newArr = _obj.data;
_this.showTree = true;
resolve(_obj.expanded);
//关闭线程
// webWorker.terminate();
};
// 监听文件失败
webWorker.onmessageerror = function (e) {
......@@ -525,6 +574,9 @@ export default {
position: absolute;
z-index: 10;
}
.searchInput{
width: 30%;
}
}
.pull-right {
margin-top: 20px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!