From 7b230899435f64c2191af136d8d43e273eb19d70 Mon Sep 17 00:00:00 2001 From: hailin <1356886193@qq.com> Date: 星期三, 19 七月 2023 13:03:43 +0800 Subject: [PATCH] 补充修复侧边栏的样式以及一些小问题 --- src/views/standardLibrary/index.vue | 242 ++++++++++++++++++++++++++++++++---------------- 1 files changed, 160 insertions(+), 82 deletions(-) diff --git a/src/views/standardLibrary/index.vue b/src/views/standardLibrary/index.vue index abd9871..e5d8274 100644 --- a/src/views/standardLibrary/index.vue +++ b/src/views/standardLibrary/index.vue @@ -6,24 +6,25 @@ v-model="filterText" placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" /> + <el-button type="text" @click="getAllStandard">鍏ㄩ儴</el-button> <el-tree ref="tree" class="filter-tree" - :data="data" + :data="standardTree" :props="defaultProps" default-expand-all :filter-node-method="filterNode" - > - </el-tree> + @node-click="nodeClick" + /> </div> <div class="library-table"> <div class="table-header"> <div class="search-bar"> - <el-form ref="form" inline="true" :model="searchData"> + <el-form ref="form" :inline="true" :model="searchData"> <el-form-item> <el-input - placeholder="璇疯緭鍏ヤ汉鍛樺悕绉�/鍘熸潗鏂欏悕绉�" v-model="searchData.keyword" + placeholder="璇疯緭鍏ヤ汉鍛樺悕绉�/鍘熸潗鏂欏悕绉�" > <i slot="prefix" class="el-input__icon el-icon-search" /> </el-input> @@ -41,78 +42,86 @@ </div> <div class="table-box"> <el-table - ref="personnerlTable" - + ref="tableData" :cell-style="{textAlign: 'center'}" :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}" - :data="personnerlTable" + :data="tableData" style="width: 100%" > <el-table-column - prop="roleName" - label="瑙掕壊鍚嶇О" - min-width="120" + type="index" + label="搴忓彿" + min-width="50" /> <el-table-column - prop="rolePermissions" - label="瑙掕壊鏉冮檺" - min-width="120" - /> - <el-table-column - prop="age" - label="骞撮緞" + prop="name" + label="浜у搧鍚嶇О" min-width="150" /> <el-table-column - prop="creatTime" - label="鍒涘缓鏃堕棿" - min-width="180" + prop="username" + label="鏇存柊浜�" + min-width="100" /> <el-table-column - prop="phone" - label="鐢佃瘽" - min-width="200" + prop="updateTime" + label="鏇存柊鏃堕棿" + min-width="150" /> <el-table-column - prop="mailbox" - label="閭" - min-width="200" + prop="vel" + label="鐗堟湰" + min-width="100" /> <el-table-column - prop="incumbentStatus" - label="鍦ㄨ亴鐘舵��" - min-width="120" - :filters="[{ text: 0, value: 0 }, { text: 1, value: 1 }]" - :filter-method="filterTag" - filter-placement="bottom-end" + prop="spe_state" + label="鐘舵��" + min-width="150" > <template slot-scope="scope"> <el-tag - :type="scope.row.businessStatus === 0 ? 'primary' : 'success'" + :type="scope.row.spe_state === 0 ? 'primary' : 'success'" disable-transitions - >{{ scope.row.businessStatus === 0 ? '鏈悓鎰�' : '宸插悓鎰�' }}</el-tag> + >{{ scope.row.spe_state === 0 ? '鏈悓鎰�' : '宸插悓鎰�' }}</el-tag> </template> </el-table-column> <el-table-column label="鎿嶄綔" - min-width="120" + min-width="150" > <template slot-scope="scope"> - <el-button @click="handleClick(scope.row)" type="text" size="small">缂栬緫</el-button> - <!-- <el-button type="text" size="small">缂栬緫</el-button> --> + <el-button + type="text" + size="small" + :style="{marginRight:'8px'}" + @click="specificationDetails(scope.row)" + >鏌ョ湅</el-button> + <el-popover + v-model="scope.row.visible" + placement="top" + width="30" + > + <div style="text-align: center; margin: 0"> + <div> + <el-button size="mini" type="text">缂栬緫</el-button> + </div> + <div> + <el-button size="mini" type="text">鍋滅敤</el-button> + </div> + </div> + <el-button slot="reference" type="text"><i class="el-icon-more" /></el-button> + </el-popover> </template> </el-table-column> </el-table> <div> <el-pagination - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - :current-page="currentPage" - :page-sizes="[100, 200, 300, 400]" - :page-size="100" + :current-page="pageParams.pageNo" + :page-sizes="[10, 20, 30, 40]" + :page-size="pageParams.pageNo" layout="total, sizes, prev, pager, next, jumper" - :total="400"> - </el-pagination> + :total="pageParams.total" + /> </div> </div> </div> @@ -121,30 +130,58 @@ </template> <script> +import { getStandardsList, getSerialNumberList, getSpecificationsList, getStandardsListOfPage } from '@/api/standardLibrary' export default { data() { return { - data: [{ - id: 1, - label: '涓�绾� 1', - children: [{ - id: 4, - label: '浜岀骇 1-1', - children: [{ - id: 9, - label: '涓夌骇 1-1-1' - }, { - id: 10, - label: '涓夌骇 1-1-2' - }] - }] - }], + visible: false, + filterText: '', + // 鏍囧噯搴揵om鏍� + standardTree: [], + // bom鐨�,榛樿鍊� defaultProps: { children: 'children', label: 'label' }, + // 鏌ヨ鏉′欢 searchData: { keyword: '' + }, + tableData: [ + { + id: 2, + name: 'AB', + updateTime: '2023-07-12 00:00:12', + username: '灏忓皬', + vel: 'V1.0', + spe_state: 1, + visible: false + }, + { + id: 3, + name: 'AB', + updateTime: '2023-07-12 00:00:12', + username: '灏忓皬', + vel: 'V1.0', + spe_state: 1, + visible: false + + }, + { + id: 4, + name: 'AB', + updateTime: '2023-07-12 00:00:12', + username: '灏忓皬', + vel: 'V1.0', + spe_state: 1, + visible: false + + } + ], + pageParams: { + pageNo: 1, + pageSize: 10, + total: 3 } } }, @@ -153,16 +190,56 @@ this.$refs.tree.filter(val) } }, + created() { + this.getStandardTree() + }, methods: { filterNode(value, data) { if (!value) return true return data.label.indexOf(value) !== -1 + }, + async getStandardTree() { + const { data: standard } = await getStandardsList()// 鑾峰彇鎵�鏈夋爣鍑� + console.log(standard)// 鑾峰彇鎵�鏈夋爣鍑� + this.standardTree = standard.map(item => { + item.serialNumber = item.serialNumber?.map(childrenItem => ({ ...childrenItem, label: childrenItem.name })) + return { ...item, label: item.name, children: item.serialNumber } + }) + console.log(this.standardTree) + }, + async nodeClick(data, node, element) { + console.log(data) + console.log('children' in data) + if (!('children' in data)) { + console.log('鐐瑰嚮瀛愯妭鐐�', data) + const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, specificationsName: data.label, pageNo: 1, pageSize: 10 }) + console.log(row) + this.tableData = row + this.pageParams.total = total + return + } + const { data: { row, total }} = await getSerialNumberList({ standardsId: data.id, ...this.pageParams }) + // console.log('鐐瑰嚮鐖惰妭鐐�', serialNumberList) + this.tableData = row + this.pageParams.total = total + }, + specificationDetails(row) { + // 璺宠浆浜у搧瑙勬牸璇︽儏椤� + console.log(row) + this.$router.push(`/standardLibrary/SpecificationDetails/${row.id}`) + }, + async getAllStandard() { + console.log(this.pageParams) + const { data: { row, total }} = await getStandardsListOfPage({ ...this.pageParams }) + this.pageParams.total = total + this.tableData = row } } } </script> <style lang="scss" scoped> + .standard-library-main{ width: 100%; height: 100%; @@ -180,27 +257,30 @@ flex: 2; margin-right: 12px; .el-tree { - margin-top: 12px; - ::v-deep .el-tree-node__content{ - height: 24px !important; - font-size: 14px; - display: inline-block !important; - padding: 2px; - color: #333; - } - ::v-deep .el-tree-node__content:hover{ - background: rgba(58,124,253,0.1) !important; - // opacity: 0.31; - border-radius: 3px; - color: #333 !important; - } - ::v-deep .el-tree-node:focus>.el-tree-node__content{ - background: rgba(58,124,253,0.1) !important; - // opacity: 0.31; - border-radius: 3px; - color: #333 !important; - } + // margin-top: 12px; } + // .el-tree { + // margin-top: 12px; + // ::v-deep .el-tree-node__content{ + // height: 24px !important; + // font-size: 14px; + // display: inline-block !important; + // padding: 2px; + // color: #333; + // } + // ::v-deep .el-tree-node__content:hover{ + // background: rgba(58,124,253,0.1) ; + // // opacity: 0.31; + // border-radius: 3px; + // color: #333 !important; + // } + // ::v-deep .el-tree-node:focus>.el-tree-node__content{ + // background: rgba(58,124,253,0.1) ; + // // opacity: 0.31; + // border-radius: 3px; + // color: #333 !important; + // } + // } } .library-table{ flex: 8; @@ -228,9 +308,7 @@ display: flex; justify-content: end; margin: 10px 0; - // ::v-deep } - } } } -- Gitblit v1.9.3