From 32d56327d6f69373ada1c3447f542ec1a39282b1 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期一, 06 五月 2024 17:31:01 +0800
Subject: [PATCH] 合并冲突

---
 src/components/view/role-manage.vue |  563 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 280 insertions(+), 283 deletions(-)

diff --git a/src/components/view/role-manage.vue b/src/components/view/role-manage.vue
index 9bc9e85..28c4b8d 100644
--- a/src/components/view/role-manage.vue
+++ b/src/components/view/role-manage.vue
@@ -1,77 +1,85 @@
 <style scoped>
-	.title {
-		height: 60px;
-		line-height: 60px;
-	}
+  .title {
+    height: 60px;
+    line-height: 60px;
+  }
 
-	.search {
-		background-color: #fff;
-		height: 80px;
-		display: flex;
-		align-items: center;
-	}
+  .search {
+    background-color: #fff;
+    height: 80px;
+    display: flex;
+    align-items: center;
+  }
 
-	.search_thing {
-		width: 350px;
-		display: flex;
-		align-items: center;
-	}
+  .search_thing {
+    width: 350px;
+    display: flex;
+    align-items: center;
+  }
 
-	.search_label {
-		width: 110px;
-		font-size: 14px;
-		text-align: right;
-	}
+  .search_label {
+    width: 110px;
+    font-size: 14px;
+    text-align: right;
+  }
 
-	.search_input {
-		width: calc(100% - 110px);
-	}
+  .search_input {
+    width: calc(100% - 110px);
+  }
 
-	.table {
-		margin-top: 10px;
-		background-color: #fff;
-		width: calc(100% - 40px);
-		height: calc(100% - 60px - 80px - 10px - 40px);
-		padding: 20px;
-	}
+  .table {
+    margin-top: 10px;
+    background-color: #fff;
+    width: calc(100% - 40px);
+    height: calc(100% - 60px - 80px - 10px - 40px);
+    padding: 20px;
+  }
 </style>
 
 <template>
-	<div class="role_manage">
-		<div>
-			<el-row class="title">
-				<el-col :span="12" style="padding-left: 20px;">瑙掕壊绠$悊</el-col>
-				<el-col :span="12" style="text-align: right;">
-					<el-button size="medium" type="primary" @click="openAdd" v-if="addPower">鏂板瑙掕壊</el-button>
-				</el-col>
-			</el-row>
-		</div>
-		<div class="search">
-			<div class="search_thing">
-				<div class="search_label">瑙掕壊鍚嶇О锛�</div>
-				<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="componentData.entity.name"
-						@keyup.enter.native="refreshTable()"></el-input></div>
-			</div>
-			<div class="search_thing" style="padding-left: 30px;">
-				<el-button size="small" @click="refresh()">閲� 缃�</el-button>
-				<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
-			</div>
-		</div>
-		<div class="table">
-			<ValueTable ref="ValueTable" :url="$api.user.selectRoleLists" :delUrl="$api.user.delRole"
-				:componentData="componentData" :key="upIndex" @upRole="upRole" @selectRole="selectRole" />
-		</div>
-		<el-dialog :title="type" :visible.sync="addDia" width="500px" @closed="closed">
-			<div style="max-height: 500px;overflow-y: auto;padding: 8px;" v-if="addDia">
-				<el-row style="line-height: 40px;margin-bottom: 15px;">
-					<el-col :span="8"><span class="required-span">* </span>瑙掕壊鍚�</el-col>
-					<el-col :span="16">
-						<el-input v-model="addData.roleName" size="medium" placeholder="闇�鍞竴瑙掕壊鍚�" clearable :disabled="type=='鏌ョ湅'"></el-input>
-					</el-col>
-				</el-row>
-				<el-divider content-position="left">鏉冮檺鍒嗛厤</el-divider>
-				<el-collapse style="margin-top: 10px;">
-					<el-collapse-item title="鏌ヨ">
+  <div class="role_manage">
+    <div>
+      <el-row class="title">
+        <el-col :span="12" style="padding-left: 20px;">瑙掕壊绠$悊</el-col>
+        <el-col :span="12" style="text-align: right;">
+          <el-button size="medium" type="primary" @click="openAdd" v-if="addPower">鏂板瑙掕壊</el-button>
+        </el-col>
+      </el-row>
+    </div>
+    <div class="search">
+      <div class="search_thing">
+        <div class="search_label">瑙掕壊鍚嶇О锛�</div>
+        <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="componentData.entity.name"
+            @keyup.enter.native="refreshTable()"></el-input></div>
+      </div>
+      <div class="search_thing" style="padding-left: 30px;">
+        <el-button size="small" @click="refresh()">閲� 缃�</el-button>
+        <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
+      </div>
+    </div>
+    <div class="table">
+      <ValueTable ref="ValueTable" :url="$api.user.selectRoleLists" :delUrl="$api.user.delRole"
+        :componentData="componentData" :key="upIndex" @upRole="upRole" @selectRole="selectRole" />
+    </div>
+    <el-dialog :title="type" :visible.sync="addDia" width="550px" @closed="closed">
+      <div style="max-height: 500px;overflow-y: auto;padding: 10px;" v-if="addDia">
+        <el-row style="line-height: 40px;margin-bottom: 20px;">
+          <el-col :span="8" style="font-size: 16px;"><span class="required-span">* </span>瑙掕壊鍚�</el-col>
+          <el-col :span="16">
+            <el-input v-model="addData.roleName" size="medium" placeholder="闇�鍞竴瑙掕壊鍚�" clearable
+              :disabled="type=='鏌ョ湅'"></el-input>
+          </el-col>
+        </el-row>
+        <el-divider content-position="left">鏉冮檺鍒嗛厤</el-divider>
+        <el-collapse style="margin-top: 10px;padding: 0 10px;">
+          <el-collapse-item v-for="(category, ci) in menuCategroy" :key="ci">
+            <template slot="title">
+              <i class="el-icon-circle-plus-outline" style="margin-right: 10px;"></i>{{category}}
+            </template>
+            <div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type==category"><el-checkbox
+                v-model="a.isClick" :disabled="type=='鏌ョ湅'">{{a.remark}}</el-checkbox></div>
+          </el-collapse-item>
+          <!-- <el-collapse-item title="鏌ヨ">
 						<el-row style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='鏌ヨ'">
 							<el-col :span="18">
 								<el-checkbox :disabled="type=='鏌ョ湅'" v-model="a.isClick">{{a.remark}}</el-checkbox>
@@ -80,224 +88,213 @@
 								<el-checkbox :disabled="type=='鏌ョ湅'" v-model="a.look">鍙湅鎴�</el-checkbox>
 							</el-col>
 						</el-row>
-					</el-collapse-item>
-					<el-collapse-item title="娣诲姞">
-						<div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='娣诲姞'"><el-checkbox
-								v-model="a.isClick" :disabled="type=='鏌ョ湅'">{{a.remark}}</el-checkbox></div>
-					</el-collapse-item>
-					<el-collapse-item title="淇敼">
-						<div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='淇敼'"><el-checkbox
-								v-model="a.isClick" :disabled="type=='鏌ョ湅'">{{a.remark}}</el-checkbox></div>
-					</el-collapse-item>
-					<el-collapse-item title="鍒犻櫎">
-						<div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='鍒犻櫎'"><el-checkbox
-								v-model="a.isClick" :disabled="type=='鏌ョ湅'">{{a.remark}}</el-checkbox></div>
-					</el-collapse-item>
-					<el-collapse-item title="瀵煎叆">
-						<div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='瀵煎叆'"><el-checkbox
-								v-model="a.isClick" :disabled="type=='鏌ョ湅'">{{a.remark}}</el-checkbox></div>
-					</el-collapse-item>
-					<el-collapse-item title="瀵煎嚭">
-						<div style="padding: 3px 30px;" v-for="(a, ai) in menu" :key="ai" v-if="a.type=='瀵煎嚭'"><el-checkbox
-								v-model="a.isClick" :disabled="type=='鏌ョ湅'">{{a.remark}}</el-checkbox></div>
-					</el-collapse-item>
-				</el-collapse>
-			</div>
-			<span slot="footer" class="dialog-footer">
-				<el-button @click="addDia = false">鍙� 娑�</el-button>
-				<el-button type="primary" @click="saveAddData" :loading="addLoad" v-if="type!='鏌ョ湅'">纭� 瀹�</el-button>
-			</span>
-		</el-dialog>
-	</div>
+					</el-collapse-item> -->
+        </el-collapse>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="addDia = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="saveAddData" :loading="addLoad" v-if="type!='鏌ョ湅'">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-	import ValueTable from '../tool/value-table.vue'
-	export default {
-		components: {
-			ValueTable
-		},
-		data() {
-			return {
-				componentData: {
-					entity: {
-						name: null,
-						orderBy: {
-							field: 'id',
-							order: 'asc'
-						}
-					},
-					showSelect: false,
-					select: true,
-					isIndex: true,
-					do: [{
-						font: '缂栬緫',
-						type: 'text',
-						method: 'upRole',
-						field: []
-					}, {
-						id: 'delete',
-						font: '鍒犻櫎',
-						type: 'text',
-						method: 'doDiy',
-					}, {
-						font: '鏌ョ湅',
-						type: 'text',
-						method: 'selectRole',
-					}],
-					tagField: {},
-					selectField: {}
-				},
-				entityCopy: {},
-				upIndex: 0,
-				addDia: false,
-				addLoad: false,
-				addData: {
-					roleId2: null,
-					roleName: null,
-					powers: []
-				},
-				menu: [],
-				menuCopy: [],
-				type: '鏂板',
-				addPower: true
-			}
-		},
-		mounted() {
-			this.entityCopy = this.HaveJson(this.componentData.entity)
-			this.selectMenuList()
-			this.getPower()
-		},
-		methods: {
-			refreshTable() {
-				this.$refs['ValueTable'].selectList()
-			},
-			refresh() {
-				this.componentData.entity = this.HaveJson(this.entityCopy)
-				this.upIndex++
-			},
-			selectMenuList() {
-				this.$axios.get(this.$api.user.selectMenuList).then(res => {
-					res.data.forEach(a => {
-						a.isClick = false
-						a.look = false
-					})
-					this.menu = res.data
-					this.menuCopy = this.HaveJson(res.data)
-				})
-			},
-			upRole(row) {
-				this.type = '淇敼'
-				this.addData.roleName = row.name
-				this.selectPowerByRoleId(row.id)
-			},
-			selectRole(row) {
-				this.type = '鏌ョ湅'
-				this.addData.roleName = row.name
-				this.selectPowerByRoleId(row.id)
-			},
-			openAdd() {
-				this.type = '鏂板'
-				this.addDia = true
-			},
-			saveAddData() {
-				if (this.addData.roleName == '' || this.addData.roleName == null) {
-					this.$message.error('璇峰~鍐欒鑹插悕')
-					return
-				}
-				this.addLoad = true
-				let url = ''
-				if (this.type == '鏂板') {
-					url = this.$api.user.addRole
-				} else {
-					url = this.$api.user.upRole
-				}
-				this.addData.powers = []
-				this.menu.forEach(a => {
-					if (a.isClick) {
-						let str = 0
-						if (a.look) {
-							str = 1
-						}
-						this.addData.powers.push({
-							menuMethod: a.method,
-							look: str
-						})
-					}
-				})
-				this.$axios.post(url, {
-					str: JSON.stringify(this.addData)
-				}).then(res => {
-					if(res.code == 201){
-						if (this.type == '鏂板') {
-							this.$message.error('娣诲姞澶辫触')
-						} else {
-							this.$message.error('淇敼澶辫触')
-						}
-						this.addLoad = false
-						return
-					}
-					if (this.type == '鏂板') {
-						this.$message.success('娣诲姞鎴愬姛')
-					} else {
-						this.$message.success('淇敼鎴愬姛')
-					}
-					this.addLoad = false
-					this.addDia = false
-					this.refreshTable()
-				}).catch(e => {
-					this.addLoad = false
-				})
-			},
-			selectPowerByRoleId(id) {
-				this.$axios.post(this.$api.user.selectPowerByRoleId, {
-					id: id
-				}).then(res => {
-					res.data.forEach(a => {
-						this.menu.forEach(b => {
-							if (a.menuMethod == b.method) {
-								b.isClick = true
-								b.look = (a.look == 1 ? true : false)
-							}
-						})
-					})
-					this.addData.roleId2 = id
-					this.addDia = true
-				})
-			},
-			closed() {
-				this.addData = {
-					roleId2: null,
-					roleName: null,
-					powers: []
-				}
-				this.menu = this.HaveJson(this.menuCopy)
-			},
-			// 鏉冮檺鍒嗛厤
-			getPower(){
-				let power = JSON.parse(sessionStorage.getItem('power'))
-				let up = false
-				let del = false
-				let add = false
-				for (var i = 0; i < power.length; i++) {
-					if(power[i].menuMethod=='upRole'){
-						up = true
-					}
-					if(power[i].menuMethod=='delRole'){
-						del = true
-					}
-					if(power[i].menuMethod=='addRole'){
-						add = true
-					}
-				}
-				if(!del){
-					this.componentData.do.splice(1, 1)
-				}
-				if(!up){
-					this.componentData.do.splice(0, 1)
-				}
-				this.addPower = add
-			}
-		}
-	}
-</script>
\ No newline at end of file
+  import {
+    set
+  } from 'vue'
+  import ValueTable from '../tool/value-table.vue'
+  export default {
+    components: {
+      ValueTable
+    },
+    data() {
+      return {
+        componentData: {
+          entity: {
+            name: null,
+            orderBy: {
+              field: 'id',
+              order: 'asc'
+            }
+          },
+          showSelect: false,
+          select: true,
+          isIndex: true,
+          do: [{
+            font: '缂栬緫',
+            type: 'text',
+            method: 'upRole',
+            field: []
+          }, {
+            id: 'delete',
+            font: '鍒犻櫎',
+            type: 'text',
+            method: 'doDiy',
+          }, {
+            font: '鏌ョ湅',
+            type: 'text',
+            method: 'selectRole',
+          }],
+          tagField: {},
+          selectField: {}
+        },
+        entityCopy: {},
+        upIndex: 0,
+        addDia: false,
+        addLoad: false,
+        addData: {
+          roleId2: null,
+          roleName: null,
+          powers: []
+        },
+        menu: [],
+        menuCategroy: [],
+        menuCopy: [],
+        type: '鏂板',
+        addPower: true
+      }
+    },
+    mounted() {
+      this.entityCopy = this.HaveJson(this.componentData.entity)
+      this.selectMenuList()
+      this.getPower()
+    },
+    methods: {
+      refreshTable() {
+        this.$refs['ValueTable'].selectList()
+      },
+      refresh() {
+        this.componentData.entity = this.HaveJson(this.entityCopy)
+        this.upIndex++
+      },
+      selectMenuList() {
+        this.$axios.get(this.$api.user.selectMenuList).then(res => {
+          res.data.forEach(a => {
+            a.isClick = false
+            a.look = false
+          })
+          let set = new Set()
+          res.data.forEach(a => {
+            set.add(a.type)
+          })
+          this.menuCategroy = set
+          this.menu = res.data
+          this.menuCopy = this.HaveJson(res.data)
+        })
+      },
+      upRole(row) {
+        this.type = '淇敼'
+        this.addData.roleName = row.name
+        this.selectPowerByRoleId(row.id)
+      },
+      selectRole(row) {
+        this.type = '鏌ョ湅'
+        this.addData.roleName = row.name
+        this.selectPowerByRoleId(row.id)
+      },
+      openAdd() {
+        this.type = '鏂板'
+        this.addDia = true
+      },
+      saveAddData() {
+        if (this.addData.roleName == '' || this.addData.roleName == null) {
+          this.$message.error('璇峰~鍐欒鑹插悕')
+          return
+        }
+        this.addLoad = true
+        let url = ''
+        if (this.type == '鏂板') {
+          url = this.$api.user.addRole
+        } else {
+          url = this.$api.user.upRole
+        }
+        this.addData.powers = []
+        this.menu.forEach(a => {
+          if (a.isClick) {
+            let str = 0
+            if (a.look) {
+              str = 1
+            }
+            this.addData.powers.push({
+              menuMethod: a.method,
+              look: str
+            })
+          }
+        })
+        this.$axios.post(url, {
+          str: JSON.stringify(this.addData)
+        }).then(res => {
+          if (res.code == 201) {
+            if (this.type == '鏂板') {
+              this.$message.error('娣诲姞澶辫触')
+            } else {
+              this.$message.error('淇敼澶辫触')
+            }
+            this.addLoad = false
+            return
+          }
+          if (this.type == '鏂板') {
+            this.$message.success('娣诲姞鎴愬姛')
+          } else {
+            this.$message.success('淇敼鎴愬姛')
+          }
+          this.addLoad = false
+          this.addDia = false
+          this.refreshTable()
+        }).catch(e => {
+          this.addLoad = false
+        })
+      },
+      selectPowerByRoleId(id) {
+        this.$axios.post(this.$api.user.selectPowerByRoleId, {
+          id: id
+        }).then(res => {
+          res.data.forEach(a => {
+            this.menu.forEach(b => {
+              if (a.menuMethod == b.method) {
+                b.isClick = true
+                b.look = (a.look == 1 ? true : false)
+              }
+            })
+          })
+          this.addData.roleId2 = id
+          this.addDia = true
+        })
+      },
+      closed() {
+        this.addData = {
+          roleId2: null,
+          roleName: null,
+          powers: []
+        }
+        this.menu = this.HaveJson(this.menuCopy)
+      },
+      // 鏉冮檺鍒嗛厤
+      getPower() {
+        let power = JSON.parse(sessionStorage.getItem('power'))
+        let up = false
+        let del = false
+        let add = false
+        for (var i = 0; i < power.length; i++) {
+          if (power[i].menuMethod == 'upRole') {
+            up = true
+          }
+          if (power[i].menuMethod == 'delRole') {
+            del = true
+          }
+          if (power[i].menuMethod == 'addRole') {
+            add = true
+          }
+        }
+        if (!del) {
+          this.componentData.do.splice(1, 1)
+        }
+        if (!up) {
+          this.componentData.do.splice(0, 1)
+        }
+        this.addPower = add
+      }
+    }
+  }
+</script>

--
Gitblit v1.9.3