|
@@ -0,0 +1,207 @@
|
|
|
+ <!-- -->
|
|
|
+ <template>
|
|
|
+ <el-dialog
|
|
|
+ title="关联试验划分树"
|
|
|
+ class="excelBox"
|
|
|
+ :visible.sync="testGLExcel"
|
|
|
+ width="500px"
|
|
|
+ modal-append-to-body
|
|
|
+ append-to-body
|
|
|
+ @close="testGLExcelMD"
|
|
|
+ >
|
|
|
+ <div class="mg-b-10">
|
|
|
+ <el-alert
|
|
|
+ :closable="false"
|
|
|
+ title="选择需要关联的清表 注意:每次只能单选操作"
|
|
|
+ type="warning">
|
|
|
+ </el-alert>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-select
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="testGLExcelFrom.name"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="changetherr()"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, key) in testGLExcelData"
|
|
|
+ :key="key"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-scrollbar style="margin-top: 20px; height: 50vh">
|
|
|
+ <el-input
|
|
|
+ style="width: 100%"
|
|
|
+ v-model.trim="testGLExcelFrom.search"
|
|
|
+ placeholder="请输入需要选择的内容"
|
|
|
+ ></el-input>
|
|
|
+ <el-tree
|
|
|
+ :filter-node-method="filterNode222"
|
|
|
+ ref="tree"
|
|
|
+ class="filter-tree"
|
|
|
+ style="margin-top: 10px"
|
|
|
+ :props="testGLExcelProps"
|
|
|
+ :data="testexceldata"
|
|
|
+ node-key="id"
|
|
|
+ accordion
|
|
|
+ show-checkbox
|
|
|
+ @check="checkchange"
|
|
|
+ v-loading="testGLExcelLoading"
|
|
|
+ >
|
|
|
+ </el-tree>
|
|
|
+ </el-scrollbar>
|
|
|
+ </div>
|
|
|
+ <span
|
|
|
+ slot="footer"
|
|
|
+ class="dialog-footer"
|
|
|
+ style="display: flex; justify-content: center; align-items: center"
|
|
|
+ >
|
|
|
+ <el-button @click="GLExcelMD()">取 消</el-button>
|
|
|
+ <el-button
|
|
|
+ style="margin-left: 30px"
|
|
|
+ type="primary"
|
|
|
+ v-throttle="2000"
|
|
|
+ @click="saveLinkTab()"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ import {
|
|
|
+ getList as getListQing,
|
|
|
+ tabLazytreeAll,
|
|
|
+ saveLinkTab,
|
|
|
+ getExcelHtml,
|
|
|
+} from "@/api/exctab/excelmodel";
|
|
|
+ export default{
|
|
|
+ props: {
|
|
|
+ testGLExcel: {
|
|
|
+ type: Boolean,
|
|
|
+ default:false
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
+ data(){
|
|
|
+ return{
|
|
|
+ testGLExcelLoading:false,
|
|
|
+ testGLExcelFrom:{
|
|
|
+ id: "",
|
|
|
+ name: "",
|
|
|
+ search: "", //搜素框舒服的值
|
|
|
+ ids: "",
|
|
|
+ excelId: "",
|
|
|
+ initTableName: "",
|
|
|
+ initTableId:""
|
|
|
+ },
|
|
|
+ testGLExcelData:[],
|
|
|
+ testexceldata:[],
|
|
|
+ testGLExcelProps: {
|
|
|
+ label: "name",
|
|
|
+ children: "children",
|
|
|
+ disabled: "hasChildren",
|
|
|
+ isLeaf: function (data) {
|
|
|
+ let tag = false;
|
|
|
+ if (!data.hasChildren) {
|
|
|
+ tag = true;
|
|
|
+ }
|
|
|
+ if (data.isExistForm == 1) {
|
|
|
+ tag = true;
|
|
|
+ }
|
|
|
+ return tag;
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ testGLExcelMD(){
|
|
|
+ //弹框关闭事件
|
|
|
+ this.testGLExcelFrom.name = "";
|
|
|
+ this.testGLExcelFrom.search = "";
|
|
|
+ this.testGLExcelFrom.id = "";
|
|
|
+ this.testexceldata = [];
|
|
|
+
|
|
|
+ this.testGLExcel = false;
|
|
|
+ },
|
|
|
+ async tabLazytreeAll() {
|
|
|
+ //清表树信息
|
|
|
+ this.GLExcelLoading = true;
|
|
|
+ const { data: res } = await tabLazytreeAll({
|
|
|
+ modeId: this.testGLExcelFrom.name,
|
|
|
+ name: this.testGLExcelFrom.search,
|
|
|
+ });
|
|
|
+ this.testGLExcelLoading = false;
|
|
|
+ console.log(res);
|
|
|
+ if (res.code === 200 && res.msg === "操作成功") {
|
|
|
+ this.testexceldata = res.data;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getList(da) {
|
|
|
+ //获取清表模板信息
|
|
|
+ const { data: res } = await getListQing(da);
|
|
|
+ console.log(res);
|
|
|
+ if (res.code === 200 && res.msg === "操作成功") {
|
|
|
+ this.testGLExcelData = res.data.records;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changetherr() {
|
|
|
+ //清表类型选择框change事件
|
|
|
+ if (this.testGLExcelFrom.name != "") {
|
|
|
+ this.testGLExcelFrom.search = "";
|
|
|
+ this.tabLazytreeAll();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ filterNode222(value,data,node) {
|
|
|
+ if(!value){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ let level = node.level;
|
|
|
+ let _array = [];//这里使用数组存储 只是为了存储值。
|
|
|
+ this.getReturnNode2(node,_array,value);
|
|
|
+ let result = false;
|
|
|
+ _array.forEach((item)=>{
|
|
|
+ result = result || item;
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ getReturnNode2(node,_array,value){
|
|
|
+ let isPass = node.data && node.data.name && node.data.name.indexOf(value) !== -1;
|
|
|
+ isPass?_array.push(isPass):'';
|
|
|
+ if(!isPass && node.level!=1 && node.parent){
|
|
|
+ this.getReturnNode2(node.parent,_array,value);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkchange(data) {
|
|
|
+ //节点选中回调
|
|
|
+ if (this.$refs.tree.getCheckedNodes().length === 0) {
|
|
|
+ this.$refs.tree.setCheckedKeys([]);
|
|
|
+ } else if (this.$refs.tree.getCheckedNodes().length >= 1) {
|
|
|
+ this.$refs.tree.setCheckedKeys([data.id]);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ testGLExcel(val){
|
|
|
+ if(val){
|
|
|
+ this.getList({
|
|
|
+ current: 1,
|
|
|
+ size: 100000,
|
|
|
+ parentId: 0,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "testGLExcelFrom.search"(val) {
|
|
|
+ console.log(val);
|
|
|
+ if (this.testexceldata) {
|
|
|
+ this.$refs.tree.filter(val);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ <style lang='scss' scoped>
|
|
|
+ </style>
|