Просмотр исходного кода

更改bug单【ID1004956】 视频巡店按组织机构选择门店,督导只可看到或操作所属机构下的门店

chenrui 4 лет назад
Родитель
Сommit
c5e036db33
1 измененных файлов с 24 добавлено и 17 удалено
  1. 24 17
      pages/organization/organization.vue

+ 24 - 17
pages/organization/organization.vue

@@ -3,7 +3,7 @@
 		<!-- 组织结构根节点 -->
 		<view class="organization-root-tit">
 			<view class="structure-con" v-for="(item,index) in nowStructure" :key="index">
-				<text class="structure-name" @click="checkedStructure(index)">{{item}}</text>
+				<text :class="item.disabled ? '' : 'structure-name'" @click="item.disabled ? null : checkedStructure(index)">{{item.name}}</text>
 				<u-icon class="structure-icon" name="arrow-right" color="#999" size="28"></u-icon>
 			</view>
 		</view>
@@ -49,11 +49,10 @@
 				status: 'loading',  //  加载中状态
 				noDataText: '暂无数据',  //  数据异常提示
 				list: [],  //  门店数据列表
+				readonlyLen: 0,  //  只读的组织机构个数
 			}
 		},
 		onLoad() {
-			//  权限下所有门店数据
-			this.getStoreList()
 			//  权限下的组织机构数据
 			this.getOrgList()
 		},
@@ -77,10 +76,19 @@
 			getOrgList(){
 				findUserInfo().then(res => {
 					if(res.status == 200){
-						this.nowStructure.push(res.data[0].name)
+						this.nowStructure = []
+						let parentNamePathsArr = res.data[0].parentNamePaths ? res.data[0].parentNamePaths.split(',') : []
+						parentNamePathsArr = parentNamePathsArr.length > 0 ? parentNamePathsArr.splice(0,parentNamePathsArr.length-1) : []
+						parentNamePathsArr.map((item,ind) => {
+							this.nowStructure.push({ name: item, disabled: true })
+						})
+						this.readonlyLen = parentNamePathsArr.length
+						this.nowStructure.push({ name: res.data[0].name, disabled: false })
 						this.organizationList = res.data
-						this.organizationNowList = res.data[0].children
+						this.organizationNowList = res.data[0].children ? res.data[0].children : []
+						this.getStoreList(res.data[0].code)
 					}else{
+						this.readonlyLen = 0
 						this.organizationList = []
 						this.organizationNowList = []
 						this.nowStructure = []
@@ -95,22 +103,21 @@
 				}else{
 					this.organizationNowList = []
 				}
-				this.nowStructure.push(item.name)
+				this.nowStructure.push({ name: item.name, disabled: false })
 				this.getStoreList(item.code)
 			},
 			//  切换至当前所选的组织结构
-			checkedStructure(ind){
+			checkedStructure(index){
+				let ind = index - this.readonlyLen
+				let subInd = JSON.parse(JSON.stringify(this.nowInd)).splice(0, ind)
+				this.nowInd = subInd
+				let code = ''  //  组织机构编码
 				if(ind == 0){
 					this.nowInd = []
 					this.organizationNowList = this.organizationList[0].children
-					this.nowStructure = []
-					this.nowStructure.push(this.organizationList[0].name)
-					this.getStoreList()
+					code = this.organizationList[0].code
 				}else{
-					let subInd = JSON.parse(JSON.stringify(this.nowInd)).splice(0, ind)
-					this.nowInd = subInd
-					let code = ''  //  组织机构编码
-					for(let i=0; i< subInd.length;i++){
+					for(let i=0; i<subInd.length; i++){
 						if(i==0){
 							this.organizationNowList = this.organizationList[0].children[subInd[i]].children
 							code = this.organizationList[0].children[subInd[i]].code
@@ -119,9 +126,9 @@
 							code = this.organizationNowList[subInd[i]].code
 						}
 					}
-					this.nowStructure = JSON.parse(JSON.stringify(this.nowStructure)).splice(0, ind+1)
-					this.getStoreList(code)
 				}
+				this.nowStructure = JSON.parse(JSON.stringify(this.nowStructure)).splice(0, index+1)
+				this.getStoreList(code)
 			},
 			//  开始巡店
 			goPage(item){
@@ -188,7 +195,7 @@
 		.organization-root-tit{
 			position: fixed;
 			left: 0;
-			top: 0;
+			// top: 0;
 			width: 100%;
 			padding: 20upx 30upx;
 			line-height: 45upx;