Commit 97441189 by 李长胜

增加搜索框

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