From 44281a4147688e421401231e778f50e947589b40 Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期一, 11 九月 2023 09:26:46 +0800 Subject: [PATCH] modified: src/components/view/standard-table/material.vue modified: src/components/view/standard-table/technology.vue modified: src/components/view/standard.vue --- src/components/view/standard.vue | 47 ++++++++++++++++++----- src/components/view/standard-table/technology.vue | 31 +++++---------- src/components/view/standard-table/material.vue | 24 ++++-------- 3 files changed, 55 insertions(+), 47 deletions(-) diff --git a/src/components/view/standard-table/material.vue b/src/components/view/standard-table/material.vue index d4d1d4d..0e8af0b 100644 --- a/src/components/view/standard-table/material.vue +++ b/src/components/view/standard-table/material.vue @@ -1,7 +1,7 @@ <template> <div class="standard"> <div> - <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="name" border + <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" border @selection-change="handleSelectionChange" default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> <el-table-column type="selection" width="55"> @@ -10,27 +10,19 @@ </el-table-column> <el-table-column prop="father" label="宸ュ簭" sortable width="200px"> <template slot-scope="scope"> - <el-tag v-if="scope.row.children" :type="scope.row.children ? 'primary' : 'success'"> - <div class="firstDiv" :style="{ color: scope.row.children ? '#16a7ff' : '#58c173' }"> - 01 - </div> - </el-tag> - <span style="color: black"> + <el-tag v-if="scope.row.children" type="primary">01</el-tag> + <span style="color: #000000"> {{ scope.row.father }} </span> </template> </el-table-column> - <el-table-column prop="tanme" sortable label="宸ヨ壓鍚嶇О"> - <!-- <template slot-scope="scope"> - <el-tag v-if="!scope.row.children"> - <div class="firstDiv" :style="`color: ${scope.row.children? '#16a7ff' : '#58c173'}`"> - 02 - </div> - </el-tag> + <el-table-column prop="name" sortable label="宸ヨ壓鍚嶇О"> + <template slot-scope="scope"> + <el-tag type="success" v-if="!scope.row.children">02</el-tag> <span style="color: black"> - {{ scope.row.tname }} + {{ scope.row.name }} </span> - </template> --> + </template> </el-table-column> <el-table-column prop="mname" label="鏉愭枡鍚嶇О"> </el-table-column> diff --git a/src/components/view/standard-table/technology.vue b/src/components/view/standard-table/technology.vue index 835a583..a8f67ba 100644 --- a/src/components/view/standard-table/technology.vue +++ b/src/components/view/standard-table/technology.vue @@ -1,43 +1,34 @@ <template> <div class="standard"> <div> - <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="name" border + <el-table :data="tableData" height="800" row-key="id" border + :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'left'}" @selection-change="handleSelectionChange" default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> <el-table-column type="selection" width="55"> </el-table-column> - <el-table-column type="index" width="50" label="搴忓彿"> + <el-table-column type="index" width="60" label="搴忓彿"> </el-table-column> <el-table-column prop="father" label="宸ュ簭" sortable width="200px"> <template slot-scope="scope"> - <el-tag v-if="scope.row.children" :type="scope.row.children ? 'primary' : 'success'"> - <div class="firstDiv" :style="{ color: scope.row.children ? '#16a7ff' : '#58c173' }"> - 01 - </div> - </el-tag> + <el-tag v-if="scope.row.children" type="primary">01</el-tag> <span style="color: black"> {{ scope.row.father }} </span> </template> </el-table-column> - <el-table-column prop="name" sortable label="宸ヨ壓鍚嶇О"> + <el-table-column sortable label="宸ヨ壓鍚嶇О"> <template slot-scope="scope"> - <el-tag v-if="!scope.row.children"> - <div class="firstDiv" :style="`color: ${scope.row.children? '#16a7ff' : '#58c173'}`"> - 02 - </div> - </el-tag> - <span style="color: black"> - {{ scope.row.name }} - </span> - </template> + <el-tag type="success" v-if="!scope.row.children">02</el-tag> + <span style="color: black">{{ scope.row.name }}</span> + </template> </el-table-column> <el-table-column prop="dg" label="璁惧缁�"> </el-table-column> <el-table-column prop="pq" label="鐢熶骇瀹氶"> </el-table-column> - <el-table-column prop="" label="鎿嶄綔"> - <el-butten style="color: rgb(137, 137, 229);">缂栬緫</el-butten> + <el-table-column label="鎿嶄綔"> + <el-button style="color: rgb(137, 137, 229);">缂栬緫</el-button> </el-table-column> </el-table> </div> @@ -53,7 +44,7 @@ }, props:['tableData','tableType'], created() { - console.log(this.tableData,this.tableType) + console.log(this.tableData) }, mounted() { diff --git a/src/components/view/standard.vue b/src/components/view/standard.vue index 845bf37..b5afbd2 100644 --- a/src/components/view/standard.vue +++ b/src/components/view/standard.vue @@ -52,18 +52,14 @@ 璇�</span></el-button> </div> - <div v-if="this.typeselect == 0"> + <div class="contentTable" v-if="this.typeselect == 0"> <technology :tableType="tableType" :tableData="tableData"></technology> </div> - <div v-if="this.typeselect == 1"> - 鎶�鏈寚鏍� - </div> + <div v-if="this.typeselect == 1">鎶�鏈寚鏍�</div> <div v-if="this.typeselect == 2"> <material :tableType="tableType" :tableData="tableData"></material> </div> - <div v-if="this.typeselect == 3"> - 鐢熶骇宸ヨ壓 - </div> + <div v-if="this.typeselect == 3">鐢熶骇宸ヨ壓</div> <!-- <div class="table"> <technology v-if="tableData.length !== 0" :tableType="tableType" :tableData="tableData"></technology> </div> --> @@ -104,7 +100,6 @@ checkTreeNode: {},// 鐐瑰嚮閫変腑鏍戣妭鐐� tableData: [], bomAddModelVisible: false,// 鎺у埗bom鏂板妯℃�佹鏄惁鏄剧ず - list: [], typeselect: 0, returntree: { id:28, @@ -184,7 +179,6 @@ }, //鍙充晶鏁版嵁 selectAll() { - console.log(this.$axios.get(this.$api.url.selectAll)); this.$axios.get(this.$api.url.selectAll, { params: { specificationsId: this.returntree.id,//tree鐨勭偣鍑诲弽棣� @@ -192,8 +186,11 @@ version: this.character,//鐗堟湰 } }).then(res => { - console.log(res.data); - this.tableData = res.data + let arr = res.data; + for(var i=0;i<arr.length;i++){ + arr[i].id = "0" + i; + } + this.tableData = arr; }) }, verevent(val) { @@ -219,8 +216,33 @@ } }) this.selectDataList() + // 榛樿绗竴涓簲绾ц妭鐐规悳绱紝鏂板閰嶇疆椤� + const treeOptions = JSON.parse(JSON.stringify(this.list)); + this.getDefault(treeOptions, 0); + this.formTypeOptions = treeOptions; + this.$nextTick().then(() => { + const firstNode = document.querySelector( + ".el-tree-node .el-tree-node__children .el-tree-node .el-tree-node__children .el-tree-node .el-tree-node__children .el-tree-node .el-tree-node__children .el-tree-node" + ); + try { + firstNode.click(); + } catch (e) { + //TODO handle the exception + } + }); }) }, + getDefault(arr, index) { + for (const item of arr) { + if (item.children && item.children.length > 0) { + // 鏈夊瓙鑺傜偣 + this.getDefault(item.children, index + 1); + if (index === 2) { + item.children = null; + } + } + } + }, filterNode(value, data) { if (!value) return true; return data.label.indexOf(value) !== -1; @@ -269,6 +291,9 @@ <style scoped> .standard {} +.standard .contentTable{ +} + .standard .title .el-button { height: 32px; border: 1px solid rgba(190, 190, 190, 0.44); -- Gitblit v1.9.3