From ea065c83cb6c9b9478f5dd34f4170399df5c08ef Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 10 八月 2023 17:14:32 +0800
Subject: [PATCH] 1.组织价格静态实现70%
---
src/utils/request.js | 2
src/api/basicSettings.js | 9 +
src/views/basicSettings/roleList.vue | 2
src/layout/components/Sidebar/index.vue | 2
src/views/basicSettings/organizationList.vue | 327 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/views/template.vue | 2
6 files changed, 337 insertions(+), 7 deletions(-)
diff --git a/src/api/basicSettings.js b/src/api/basicSettings.js
index a022539..a66e9c8 100644
--- a/src/api/basicSettings.js
+++ b/src/api/basicSettings.js
@@ -1,5 +1,14 @@
import request from '@/utils/request'
+// 缁勭粐鏋舵瀯,鏌ヨ缁勭粐淇℃伅
+// export function STorgData(data) {
+// return request({
+// url: 'BasicSetting/STorgData',
+// method: 'get',
+// params: data
+// })
+// }
+
// 瑙掕壊鏉冮檺鏌ヨ瑙掕壊
export function RolePermissionSearchRole(data) {
return request({
diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue
index 2b8d983..f62720f 100644
--- a/src/layout/components/Sidebar/index.vue
+++ b/src/layout/components/Sidebar/index.vue
@@ -77,7 +77,7 @@
activeMenu() {
const route = this.$route
const { meta, path } = route
- console.log(meta, path, 7)
+ // console.log(meta, path, 7)
// if set path, the sidebar will highlight the path you set
removeCookie('ruleCode')
setCookie('ruleCode', meta.code)// 灏嗙紪鐮佽鍒檆ode瀛樺埌cookie閲岄潰
diff --git a/src/utils/request.js b/src/utils/request.js
index 2d0b42b..0c655ce 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -16,7 +16,7 @@
// do something before request is sent
config.headers['Token'] = localStorage.getItem('token')
- config.headers['ruleCode'] = getCookie('ruleCode') // 缂栫爜瑙勫垯
+ // config.headers['ruleCode'] = getCookie('ruleCode') // 缂栫爜瑙勫垯
return config
},
error => {
diff --git a/src/views/basicSettings/organizationList.vue b/src/views/basicSettings/organizationList.vue
index 2464b07..5fdc897 100644
--- a/src/views/basicSettings/organizationList.vue
+++ b/src/views/basicSettings/organizationList.vue
@@ -1,11 +1,332 @@
-<template />
+<template>
+ <div>
+ <div class="body" :style="{height:mainHeight+'px'}">
+ <div
+ class="elTableDiv"
+ >
+
+ <div style="width: 300px;background:#fff">
+
+ <div style="margin: 20px 10px 0 10px;display: flex;justify-content: space-between;">
+ <div style="display: flex;">
+ <div
+ style="width: 5px;height: 100%;border-radius: 5px;"
+ :style="{background:$store.state.settings.theme}"
+ />
+ <div style="margin-left: 8px;">缁勭粐鍚嶇О</div>
+ </div>
+
+ <!-- <div style="margin-right:10px">-->
+ <!-- <i class="el-icon-plus" style="cursor: pointer;color: #999" />-->
+ <!-- </div>-->
+ <!-- @click="rolePlusClick"-->
+ </div>
+
+ <el-tree
+ ref="treeLeftRef"
+ style="padding: 10px;overflow: auto"
+ :style="{height:(tableHeight-20)+'px'}"
+ :data="treeLeft"
+ node-key="code"
+ highlight-current
+ :props="defaultPropsLeft"
+ :default-expand-all="true"
+ :expand-on-click-node="false"
+ draggable
+ :allow-drop="treeLeftAllowDrop"
+ >
+ <!-- @node-click="treeLeftNodeClick"-->
+
+ <span slot-scope="{ node, data }" class="custom-tree-node">
+ <span v-if="!data.isEdit">{{ data.name }}</span>
+ <input
+ v-if="data.isEdit"
+ :ref="data.code"
+ v-model="data.name"
+ type="text"
+ @click.stop
+ @blur="treeSave(data)"
+ @keyup.enter="treeSave(data)"
+ >
+
+ <span v-if="!data.isEdit">
+ <i
+ class="el-icon-plus"
+ style="margin-right:10px;color: #999"
+ @click.stop="val=>treeAddClick(val,node,data)"
+ />
+ <i
+ v-if="data.code!=='000'"
+ class="el-icon-edit"
+ style="margin-right:10px;color: #999"
+ @click.stop="val=>treeEditClick(val,node,data)"
+ />
+ <i
+ v-if="data.code!=='000'"
+ class="el-icon-delete"
+ style="margin-right: 4px;color: #999"
+ @click.stop="val=>treeDeleteClick(val,node,data)"
+ />
+ </span>
+ </span>
+ </el-tree>
+ </div>
+
+ <div
+ style="margin-left: 10px;width:100%;position: relative"
+ >
+
+ <el-table
+ ref="tableDataRef"
+ class="tableFixed"
+ :data="tableData"
+ :height="(tableHeight-40)+'px'"
+ border
+ row-class-name="custom-row"
+ :style="{width: 100+'%',height:(tableHeight-40)+'px',marginBottom:'10px'}"
+ highlight-current-row
+ :header-cell-style="this.$headerCellStyle"
+ :cell-style="this.$cellStyle"
+ @sort-change="sortChange"
+ >
+ <!-- prop="RowNum"-->
+ <el-table-column
+ type="index"
+ width="50"
+ fixed
+ label="搴忓彿"
+ />
+ <el-table-column
+ prop="code"
+ label="鐢ㄦ埛缂栫爜"
+ sortable="custom"
+ />
+ <!-- <el-table-column-->
+ <!-- label="鎿嶄綔"-->
+ <!-- width="120"-->
+ <!-- fixed="right"-->
+ <!-- >-->
+ <!-- <template slot-scope="{row}">-->
+ <!-- <div class="operationClass">-->
+ <!-- <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">-->
+ <!-- <i class="el-icon-edit-outline" @click="edit('edit',row)" />-->
+ <!-- </el-tooltip>-->
+ <!-- <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">-->
+ <!-- <i class="el-icon-delete" @click="del(row)" />-->
+ <!-- </el-tooltip>-->
+ <!-- </div>-->
+ <!-- </template>-->
+ <!-- </el-table-column>-->
+ </el-table>
+
+ <!--鍒嗛〉-->
+ <pagination
+ :total="total"
+ :page.sync="form.page"
+ :limit.sync="form.rows"
+ align="right"
+ layout="total,prev, pager, next,sizes,jumper"
+ popper-class="select_bottom"
+ @pagination="getOrganizationSearch"
+ />
+
+ </div>
+
+ </div>
+
+ </div>
+
+ </div>
+</template>
<script>
+import waves from '@/directive/waves'
+import arrayToTree from 'array-to-tree'
+import { throttle } from '@/utils/debounceAndThrottle'
+import Pagination from '@/components/Pagination'
+
export default {
- name: 'OrganizationList'
+ name: 'RoleList',
+ directives: { waves },
+ components: {
+ Pagination
+ },
+ data() {
+ return {
+ mainHeight: 0,
+ tableHeight: 0,
+
+ treeLeft: [
+ {
+ code: '000',
+ name: '澶у矝鐢靛櫒',
+ isEdit: false,
+ children: [
+ {
+ code: '001',
+ name: '鐮斿彂閮�',
+ isEdit: false,
+ children: []
+ }, {
+ code: '002',
+ name: '閿�鍞儴',
+ isEdit: false,
+ children: []
+ }, {
+ code: '003',
+ name: '鐢熶骇閮�',
+ isEdit: false,
+ children: [
+ {
+ code: '004',
+ name: '閲戝伐杞﹂棿涓�',
+ isEdit: false,
+ children: []
+ }, {
+ code: '005',
+ name: '閲戝伐杞﹂棿浜�',
+ isEdit: false,
+ children: []
+ }
+ ]
+ }
+ ]
+ }
+ ], // 宸︿晶鏍�
+ defaultPropsLeft: {
+ children: 'children',
+ label: 'name'
+ },
+ tableData: [
+ { code: '001' },
+ { code: '002' },
+ { code: '003' }
+ ],
+ form: {
+ page: 1,
+ rows: 20
+ },
+ total: 0
+
+ }
+ },
+ watch: {
+ // treeLeft: {
+ // handler(newValue, oldValue) {
+ // newValue[0].roles.forEach(i => {
+ // if (i.isEdit) {
+ // this.$nextTick(() => {
+ // this.$refs[i.code].focus()
+ // })
+ // }
+ // })
+ // },
+ // deep: true
+ // }
+ },
+
+ created() {
+
+ },
+ mounted() {
+ window.addEventListener('resize', this.getHeight)
+ this.getHeight()
+ },
+ methods: {
+ // 鑾峰彇椤甸潰楂樺害
+ getHeight() {
+ this.$nextTick(() => {
+ this.mainHeight = window.innerHeight - 75
+ this.tableHeight = this.mainHeight - 50
+ })
+ },
+ // 宸︿晶鏍戝舰鎷栧姩澶勭悊
+ treeLeftAllowDrop(draggingNode, dropNode, type) {
+ // console.log(draggingNode, dropNode, type)
+ // 娉ㄦ帀鐨勬槸鍚岀骇鎷栨嫿
+ // if (draggingNode.level === dropNode.level) {
+ // return type === 'prev' || type === 'next'
+ // } else {
+ // // 涓嶅悓绾ц繘琛屽鐞�
+ // return false
+ // }
+ },
+ getTreeAttr(val) {
+ console.log(val, 1)
+ if (val['children']) {
+ val['children'].push({
+ code: '',
+ name: '',
+ isEdit: true,
+ children: []
+ })
+ } else {
+ val.children.push(
+ { code: '', name: '', isEdit: true }
+ )
+ }
+ this.$nextTick(() => {
+ this.$refs[''].focus()
+ })
+ },
+ // 瑙掕壊鍚嶇О淇濆瓨 閲囩敤闃叉姈褰㈠紡
+ treeSave: throttle(function(val) {
+ val.isEdit = false
+
+ console.log('鎵ц浜嗭紒')
+ }, 1000, true),
+
+ treeEditClick(val, node, data) {
+ data.isEdit = true
+ this.$nextTick(() => {
+ this.$refs[data.code].focus()
+ })
+ },
+ treeDeleteClick(val, node, data) {
+
+ },
+ treeAddClick(val, node, data) {
+ // console.log(val, node, data, 2)
+
+ // this.treeLeft = data.children.push({ code: '', name: '', isEdit: true })
+ this.getTreeAttr(data)
+
+ // console.log(this.treeLeft, 3)
+ },
+ sortChange({ column, prop, order }) {
+ if (order === 'descending') {
+ order = 'desc'
+ } else if (order === 'ascending') {
+ order = 'asc'
+ } else {
+ order = 'desc'
+ }
+ this.form.order = order
+ this.form.prop = prop
+ // this.getOrganizationSearch()
+ },
+ getOrganizationSearch() {
+
+ }
+ }
}
</script>
-<style scoped>
+<style scoped lang="scss">
+.custom-tree-node {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 14px;
+ padding-right: 8px;
+}
+//::v-deep .el-checkbox__label {
+// width: 55px;
+//}
+//
+.el-icon-plus:hover, .el-icon-edit:hover, .el-icon-delete:hover {
+ color: #000 !important;
+}
</style>
diff --git a/src/views/basicSettings/roleList.vue b/src/views/basicSettings/roleList.vue
index cd9cfe5..f1b91b1 100644
--- a/src/views/basicSettings/roleList.vue
+++ b/src/views/basicSettings/roleList.vue
@@ -68,7 +68,7 @@
</div>
<div
- style="margin-left: 15px;width:100%;position: relative"
+ style="margin-left: 10px;width:100%;position: relative"
>
<el-button
diff --git a/src/views/template.vue b/src/views/template.vue
index 6f02a6c..3143141 100644
--- a/src/views/template.vue
+++ b/src/views/template.vue
@@ -148,7 +148,7 @@
:page.sync="form.page"
:limit.sync="form.rows"
align="right"
- layout="total,prev, pager, next,sizes"
+ layout="total,prev, pager, next,sizes,jumper"
popper-class="select_bottom"
@pagination="getOrganizationSearch"
/>
--
Gitblit v1.9.3