Kaynağa Gözat

文件柜功能开发, 权限分配

zhengkaixin 10 ay önce
ebeveyn
işleme
145ff6e2e1

+ 51 - 0
apis/pagejs/addressbook.js

@@ -49,3 +49,54 @@ export function oaFileInfoList(formData) {
 	//	header:{'Content-Type':'application/json'},
 	})
 }
+
+
+export function oaFileInfoAdd(formData) {
+	return request({
+		url: '/mobile/oaFileInfo/add',
+		data: formData,
+		method: 'post',	
+		header:{'Content-Type':'application/json'},
+	})
+}
+export function oaFileInfoDelete(formData) {
+	return request({
+		url: '/mobile/oaFileInfo/delete/'+formData,
+		//data: formData,
+		method: 'post',	
+	//	header:{'Content-Type':'application/json'},
+	})
+}
+export function oaFileInfoEdit(formData) {
+	return request({
+		url: '/mobile/oaFileInfo/edit/'+formData,
+		//data: formData,
+		method: 'get',	
+	//	header:{'Content-Type':'application/json'},
+	})
+}
+export function oaFileInfoQuery(formData) {
+	return request({
+		url: '/mobile/oaFileInfo/query?id='+formData,
+		//data: formData,
+		method: 'get',	
+	//	header:{'Content-Type':'application/json'},
+	})
+}
+export function oaFileInfoRelationItem(formData) {
+	return request({
+		url: '/mobile/oaFileInfo/relationItem',
+		data: formData,
+		method: 'post',	
+		header:{'Content-Type':'application/json'},
+	})
+}
+
+export function oaFileInfoUpdate(formData) {
+	return request({
+		url: '/mobile/oaFileInfo/update',
+		data: formData,
+		method: 'post',	
+		header:{'Content-Type':'application/json'},
+	})
+}

+ 2 - 2
config/.env.dev.js

@@ -10,8 +10,8 @@ const UNI_APP = {
 	
 	NODE_ENV :"dev",
 	SIMPLE_RUN:true,// 无视权限控制跳转页面   , 用于样式人员快速访问各种功能 ,快速测试等
-	//openId:"1234",//开发人员2
-	openId:"55555",//测试人员 开发环境
+	openId:"1234",//开发人员2
+	//openId:"55555",//测试人员 开发环境
 	//openId:"oK9Wr57rAcNzihDN2PEdptprT0As", 
 	// openId:"oK9Wr54VbEh3xvWYmD_zT5NbH4AY",
 	openId:"oBEnI6GDWCRQqn_xlyPlCYFY8Amg",//zkx

+ 15 - 1
pages.json

@@ -498,7 +498,21 @@
 			"path" : "pages/oawork/cabinetFiling",
 			"style" : 
 			{
-				"navigationBarTitleText" : ""
+				
+			}
+		},
+		{
+			"path" : "pages/oawork/cabinet/cabinetAdd",
+			"style" : 
+			{
+				
+			}
+		},
+		{
+			"path" : "pages/oawork/cabinet/cabinetRoot",
+			"style" : 
+			{
+				
 			}
 		}
 	],

+ 363 - 0
pages/oawork/cabinet/cabinetAdd.vue

@@ -0,0 +1,363 @@
+<template>
+	<view>
+		<u-navbar title="发布文件" ></u-navbar>
+		<u-calendar v-model="showcalendar" @change="changeCalendar" max-date="2060-01-01"  mode="date"></u-calendar>
+		<view class="businessMain">
+			<view class="oawork-item oawork-text">
+				
+				<view class="oawork-item1">
+					<view class="oawork-item1_a">文件名称<span  style="color:red">*</span></view>
+					<view class="oawork-item1_b">
+						<u-input v-model="name" placeholder="请输入文件名称"
+							 class="oawork-line"  />
+					</view>
+				</view>
+			</view>
+			
+			<view class="oawork-item oawork-text">
+				
+				<view class="oawork-item1">
+					<view class="oawork-item1_a">上传日期<span  style="color:red">*</span></view>
+					<view class="oawork-item1_b oawork-line" @click="showcalendar=true">
+						{{uploadTime?uploadTime:'选择日期'}}
+					</view>
+				</view>
+			</view>
+			
+			<view class="upload" style="margin-top: 20rpx;    width: 100%;">
+			
+				<u-upload-file-all ref="uUpload" :action="action" :max-size="50 * 1024 * 1024"
+					:file-max-size="50 * 1024 * 1024" :maxCount="1" :form-data="uploadData"
+					:header="header" :file-list="fileList"></u-upload-file-all>
+			</view>
+			
+		</view>
+		
+		
+
+	  
+	
+	
+	  
+	  <view class="bottom" @click="submit()" >
+	  			<button>发布文件</button>
+	  </view>
+	
+	</view>
+</template>
+
+<script>
+	import * as API from '@/apis/pagejs/addressbook.js'
+	
+	export default {
+		data() {
+			return {
+				showcalendar:false,
+				uploadTime:"",
+				name:"",
+				url:"",
+				action:"",
+				formData:{},
+				fileList:[],
+				uploadData: {},
+				header:{
+					
+				},
+				 id:"",
+				
+				subForm:{
+					
+				},
+				editForm:{
+					
+				},
+			}
+		},onLoad(op) {
+			if(op.id){
+				this.id=op.id;
+				this.getInfo()
+			}
+			this.action=process.car.BASE_URL+"uploadPicture"
+			
+			this.formData.subFolder="cabinet"
+			this.uploadData.subFolder = "cabinet1";
+			
+			//接口应该免登陆
+			var token=this.carhelp.getToken()
+			
+			this.header={
+		
+				'Authorization':token
+			}
+			
+			
+		},
+		methods:{
+			getInfo(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.oaFileInfoEdit(this.id).then((res) => {
+					uni.hideLoading();
+					var info =res.data
+					this.uploadTime=info.uploadTime
+					this.name=info.name
+					this.fileList=info.urlList
+					this.fileList.forEach(item=>{
+						item.view=1
+					})
+					this.editForm=info;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			changeCalendar(e) {
+				
+				this.uploadTime = e.result;
+			},
+			submit(){
+				if(!this.name){
+					uni.showToast({
+						title: "请输入文件名称",
+						icon: "none"
+					})
+					return false
+				}
+				if(!this.uploadTime){
+					uni.showToast({
+						title: "请输入上传时间",
+						icon: "none"
+					})
+					return false
+				}
+				if(this.$refs.uUpload){
+					var list=this.$refs.uUpload.lists.filter(val => {
+						return val.progress == 100;
+					})
+					if(list.length){
+						var str =list.map(item=>{
+							//(item)
+							return  {
+								name:item.file?item.file.name:item.name,
+								url:item.response?item.response.data.fileUrl:item.url
+							}
+						})
+						this.url=JSON.stringify(str)
+						
+					}else{
+						uni.showToast({
+							title: "请上传文件",
+							icon: "none"
+						})
+						return false
+					}
+				}
+				
+				this.subForm={
+					name:this.name,
+					uploadTime:this.uploadTime,
+					url:this.url
+				}
+				// console.log(this.subForm)
+				// return 
+				
+				if(this.id){
+					this.oaFileInfoEdit()
+				}else{
+					this.oaFileInfoAdd()
+				}
+				
+				
+			},
+			oaFileInfoAdd(){
+				
+				API.oaFileInfoAdd(this.subForm).then((res) => {
+					uni.hideLoading();
+					const eventChannel = this.getOpenerEventChannel();
+					eventChannel.emit('refreshData');
+					uni.showModal({
+						title:"提示",
+						showCancel:false,
+						content:"操作成功!",
+						
+						success() {
+							uni.navigateBack()
+						}
+					})
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			oaFileInfoEdit(){
+				this.editForm.name=this.subForm.name;
+				this.editForm.uploadTime=this.subForm.uploadTime;
+				this.editForm.url=this.subForm.url;
+				this.editForm.urlList=null;
+				
+				API.oaFileInfoUpdate(this.editForm).then((res) => {
+					uni.hideLoading();
+					const eventChannel = this.getOpenerEventChannel();
+					eventChannel.emit('refreshData');
+					uni.showModal({
+						title:"提示",
+						showCancel:false,
+						content:"操作成功!",
+						
+						success() {
+							uni.navigateBack()
+						}
+					})
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.bottom{
+		   padding: 16rpx 32rpx;
+		   background-color: #fff;
+		   position: fixed;
+		   bottom: 0;
+		   left: 0;
+		   right: 0;
+		   uni-button{
+			   border-radius: 8px;
+			   background-color: rgba(31, 74, 153, 1);
+			   color: rgba(255, 255, 255, 1);
+			   font-size: 16px;
+			   line-height: 40px;
+			   
+		   }
+		   
+	}
+	page{
+		background-color: #fff;
+		font-family: 'Regular';
+	}
+	.oawork-line {
+		border-bottom: 1px solid #c8c8c8;
+	}
+	
+	.businessMain {
+		/deep/.uni-input-input {
+			font-size: 24rpx;
+		}
+	
+		font-size: 32rpx;
+	
+		background: #fff;
+		padding-top: 10rpx;
+		padding-bottom: 50rpx;
+		margin-bottom: 40rpx;
+		display: flex;
+		flex-wrap: wrap;
+	
+		.oawork-item {
+			padding: 4rpx 16rpx 4rpx 16rpx;
+			width: 100%;
+	
+			.oawork-item1 {
+				display: flex;
+				align-items: center;
+				margin-top: 16rpx;
+				.oawork-item1_a {
+					min-width: 160rpx;
+					font-weight: bold;
+				}
+	
+				.oawork-item1_b {
+					color: #777777;
+					width: 100%;
+					
+				}
+	
+				.oawork-item1_c {
+					padding-left: 16rpx;
+				}
+	
+			}
+	
+		}
+	
+		.oawork-selecttime,
+		.oawork-selecttime2 {
+			margin: 10rpx 0;
+			display: flex;
+	
+			.oawork-item1 {
+				width: 100%;
+			}
+	
+			.oawork-item1_b {
+				display: flex;
+				align-items: center;
+				justify-content: flex-end;
+				height: 100%;
+				border-bottom: 1px solid #c8c8c8;
+			}
+		}
+	
+		.oawork-itemrow {
+			.oawork-item1_a {
+				font-weight: 400 !important;
+				width: 200%;
+			}
+		}
+		// .oawork-itemline {
+		// 	.oawork-item1_a {
+				
+		// 		width: 100%;
+		// 	}
+		// }
+		.oawork-texteditor{
+			margin-top: 10px;
+		}
+		.oawork-textlong,.oawork-itemline {
+			.oawork-item1_a {
+				width: 100%;
+	
+			}
+		}
+	
+		.oawork-title {
+			padding: 20rpx 0px 4rpx 20rpx;
+	
+			.oawork-item1_a {
+				width: 100%;
+				font-size: 32rpx;
+			}
+		}
+	
+		.width200 {
+	
+			// padding:20rpx 0px 4rpx 20rpx;
+			.oawork-item1_a {}
+		}
+	
+		/deep/.oawork-width49 {
+			padding: 4rpx 0px 4rpx 10rpx;
+			width: 49%;
+			
+			.oawork-item1_a {
+				font-size: 28rpx;
+				min-width: 140rpx !important;
+			}
+		}
+	}
+	 
+</style>

+ 330 - 0
pages/oawork/cabinet/cabinetRoot.vue

@@ -0,0 +1,330 @@
+<template>
+	<view>
+		<u-navbar title="文件权限" ></u-navbar>
+		<view class="main">
+			<view class="item" v-show="show1" >
+				
+		
+				<view class="name" >
+					分配部门
+					<u-button  style="float: right;" size="mini" @click="show1=false,show2=true" > 编辑</u-button>
+				</view>
+				<view class="value">
+					<view  class="tag" v-for="(item,i) in orgListIndex" :class="{
+						tagindex:true
+					}"   >
+						{{item.name}}
+					</view>
+				</view>
+				<u-divider  bgColor="#FFF" v-if="orgListIndex.length==0&&show1"
+				 :isnone="orgListIndex.length==0" nonetext="点击编辑设置权限" 
+				></u-divider>
+			</view>
+			
+			<view class="item"  v-show="show2" >
+				<view class="name">部门列表<span>(点击勾选)</span>
+				
+				<u-button  style="float: right;" size="mini" type="primary"  @click="show2=false,show1=true" > 完成</u-button>
+				</view>
+				<view class="value">
+					<view  class="tag" v-for="(item,i) in orgList"
+					 v-show="item.name.indexOf('测试')==-1"
+					 :class="{
+						tagindex:getTagindex(item)
+					}"  @click="ckTagindex(item)" >
+						{{item.name}}
+					</view>
+				</view>
+			</view>
+			
+			<view class="item"  >
+				
+					
+				<view class="name" >
+					分配人员<span v-show="show3&&userListIndex.length">(点击删除)</span>
+					<u-button  style="float: right;" size="mini" v-show="!show3" @click="show3=true" > 编辑</u-button>
+					<u-button  style="float: right;" size="mini" v-show="show3" type="primary"  @click="show3=false" > 完成</u-button>
+					
+				</view>
+				
+				<view class="value">
+					
+					
+					
+					<view  class="tag" v-for="(item,i) in userListIndex" :class="{
+						tagindex:true
+						
+					}" @click="ckTagindexUser(item)"  >
+						{{item.name}}
+					</view>
+				</view>
+				<u-divider  bgColor="#FFF" v-if="userListIndex.length==0&&!show3" 
+				 :isnone="userListIndex.length==0" nonetext="点击编辑设置权限" 
+				></u-divider>
+				<view class="query" style="margin-top: 40rpx;" v-show="show3">
+					<view  >
+						搜索人员:
+						<u-input style="border: 1px solid #cfd4db;margin: 12rpx;"
+						 v-model="key" placeholder="输入姓名查找"></u-input>
+						
+					</view>
+					<view >
+						查询结果:<span v-if="regUserQuery.length!=0" style="color:red;">(点击勾选)</span>
+						<view  class="tag" v-for="(item,i) in regUserQuery" :class="{
+							tagindex:getTagindexUser(item)
+						}"  @click="ckTagindexUser(item)" >
+							{{item.name}}
+						</view>
+					</view>
+					<u-divider  bgColor="#FFF"
+					 :isnone="regUserQuery.length==0" nonetext="没有找到相关内容" 
+					>最多查询{{regUserQueryLength}}条</u-divider>
+				</view>
+			</view>
+			
+		</view>
+		
+		<view class="bottom" @click="submit()" >
+					<button>保存权限</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import * as API from '@/apis/pagejs/addressbook.js'
+	
+	export default {
+		data() {
+			return {
+				id:"",
+				orgList:[],
+				orgRelationList:[],
+				regUserList:[],
+				regUserRelationList:[],
+				show1:true,
+				show2:false,
+				show3:false,
+				regUserQueryLength:10,
+				key:""
+			}
+		},
+		onLoad(op) {
+			if(op.id){
+				this.id=op.id;
+				this.getInfo()
+			}
+		},
+		computed:{
+			regUserQuery(){
+					var sz=[];
+					if(this.key){
+						for(var i=0;i< this.regUserList.length;i++){
+							if(sz.length>=this.regUserQueryLength){
+								break
+							}
+							var item=this.regUserList[i]
+							if(item.name.indexOf(this.key)!=-1){
+								sz.push(item)
+							}
+							
+						}
+					}
+					return sz
+			},
+			orgListIndex(){
+				var sz=[]
+				this.orgList.forEach(item1=>{
+					if(this.getTagindex(item1)){
+						sz.push(item1)
+					}
+				})
+				return sz;
+			},
+			userListIndex(){
+				var sz=[]
+				this.regUserList.forEach(item1=>{
+					if(this.getTagindexUser(item1)){
+						sz.push(item1)
+					}
+				})
+				return sz;
+			}
+		},
+		methods: {
+			submit(){
+				var orgSelected=this.orgListIndex.map(item=>{
+						return item.id
+					})
+				var relatedUser=this.userListIndex.map(item=>{
+						return item.id
+					})
+				var subForm={
+					fileId:this.id,
+					orgSelected:orgSelected,
+					relatedUser:relatedUser
+				}
+				API.oaFileInfoRelationItem(subForm).then((res) => {
+					uni.hideLoading();
+				
+					uni.showModal({
+						title:"提示",
+						showCancel:false,
+						content:"操作成功!",
+						
+						success() {
+							uni.navigateBack()
+						}
+					})
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			ckTagindexUser(item){
+				if(!this.show3){
+						return
+				}
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				var k =this.regUserRelationList.findIndex(it=>{
+					
+					return it.businessId==item.id
+				})
+				
+				if(k==-1){
+					this.regUserRelationList.push({
+						businessId:item.id
+					})
+				}else{
+					this.regUserRelationList.splice(k,1)
+				}
+				
+				uni.hideLoading();
+				
+			},
+			ckTagindex(item){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				var k =this.orgRelationList.findIndex(it=>{
+					
+					return it.businessId==item.id
+				})
+				
+				if(k==-1){
+					this.orgRelationList.push({
+						businessId:item.id
+					})
+				}else{
+					this.orgRelationList.splice(k,1)
+				}
+				uni.hideLoading();
+				
+			},
+			getTagindex(item){
+				
+				var k =this.orgRelationList.findIndex(it=>{
+					
+					return it.businessId==item.id
+				})
+				return k!=-1
+			},
+			getTagindexUser(item){
+				
+				var k =this.regUserRelationList.findIndex(it=>{
+					
+					return it.businessId==item.id
+				})
+				return k!=-1
+			},
+			getInfo(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.oaFileInfoQuery(this.id).then((res) => {
+					uni.hideLoading();
+					var info =res.data
+					this.orgList=info.orgList;
+					this.orgRelationList=info.orgRelationList;
+					this.regUserList=info.regUserList;
+					this.regUserList.forEach(item=>{
+						var phone=item.phone
+						var phone1 = phone.slice(0,3);
+						var phone2 = phone.slice(-4);
+						item.name= item.name+"["+ phone1 + '****' + phone2+"]";
+					})
+					
+					this.regUserRelationList=info.regUserRelationList;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+		}
+	}
+</script>
+
+<style  scoped lang="scss">
+	.bottom{
+		   padding: 16rpx 32rpx;
+		   background-color: #fff;
+		   position: fixed;
+		   z-index: 99999;
+		   bottom: 0;
+		   left: 0;
+		   right: 0;
+		   uni-button{
+			   border-radius: 8px;
+			   background-color: rgba(31, 74, 153, 1);
+			   color: rgba(255, 255, 255, 1);
+			   font-size: 16px;
+			   line-height: 40px;
+			   
+		   }
+		   
+	}
+	.main{
+		
+		padding-bottom:120rpx ;
+		
+		.name{
+			font-size: 44rpx;
+			font-weight: bold;
+			span{
+				font-size: 32rpx;
+				font-weight: 400;
+				color:red;
+			}
+		}
+		.item{
+			padding: 32rpx;
+			margin-bottom: 30rpx;
+			background-color: #fff;
+		}
+		.value{
+			display: flex;
+			  flex-wrap: wrap;
+			
+		}
+		.tag{
+			border: 1px solid #cfd4db;
+			padding: 12rpx 16rpx;
+			margin: 12rpx ;
+		}
+		.tagindex{
+			border: 1px solid #19be6b;
+			color:#19be6b;
+		}
+	}
+</style>

+ 97 - 7
pages/oawork/cabinetFiling.vue

@@ -64,8 +64,8 @@
 					
 					
 					<view class="information">
-						<view class="classify">
-							{{item.typeN}}
+						<view class="classify" :style="item.createByN?'':'color:red'">
+						{{item.orgName?item.orgName+'-':''}}	{{item.createByN?item.createByN:'后台'}}上传
 						</view>
 						
 						<view class="date">
@@ -89,15 +89,24 @@
 					</view>
 				</view>
 				
-				<view class="img">
-					
+				<view class="img" v-if="userPhone==item.createPhone">
+					<u-button  size="mini" type="primary"  @click="addInfo(item.id)" >修改文件</u-button>
+					<u-button  size="mini" style="margin-left: 18rpx;" type="success"  @click="addInfo2(item.id)" >权限调整</u-button>
+					<u-button   size="mini" style="    float: right;" type="error"  @click="addInfo3(item)" >删除</u-button>
+					  
 				</view>
 				
 			</view>
+			<u-divider  v-if="list.length==recordsTotal"
+			 :isnone="list.length==0" nonetext="没有找到相关内容" 
+			>已经到底了</u-divider>
 		   </view>
-		<u-divider  v-if="list.length==recordsTotal"
-		 :isnone="list.length==0" nonetext="没有找到相关内容" 
-		>已经到底了</u-divider>
+		
+		
+		
+		<view class="bottom">
+			<u-button type="primary"  @click="addInfo()">添加文件</u-button>
+		</view>
 	</view>
 </template>
 
@@ -122,6 +131,7 @@
 					url:"",
 				},
 				keyword:"",
+				userPhone:"",
 				
 			}
 		},
@@ -130,6 +140,7 @@
 			// 	this.title=op.title
 			// }
 			// this.listForm.typeId=op.id
+			this.userPhone=this.carhelp.getPersonInfo().phone
 			this.getList()
 		},
 		onReachBottom() {
@@ -148,6 +159,66 @@
 			}
 		},
 		methods: {
+			deleteApi(id){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.oaFileInfoDelete(id).then((res) => {
+					uni.hideLoading();
+					uni.showModal({
+						title:"提示",
+						showCancel:false,
+						content:"操作成功!",
+						
+						success() {
+							
+						}
+					})
+					this.init()
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			addInfo3(item){
+				uni.showModal({
+					title: '提示',
+					content: `确认是否删除[${item.name}]?`,
+					success: res=> {
+						if (res.confirm) {
+						   //付钱  改为组件
+						   this.deleteApi(item.id);
+						   
+						} else if (res.cancel) {
+							console.log('用户点击取消');
+						}
+					}
+				});
+			},
+			addInfo2(id){
+				uni.navigateTo({
+					url:"/pages/oawork/cabinet/cabinetRoot?id="+id,
+					
+				})
+			},
+			addInfo(id){
+				var url=""
+				if(id){
+					url+="?id="+id
+				}
+				uni.navigateTo({
+					url:"/pages/oawork/cabinet/cabinetAdd"+url,
+					events: {
+						refreshData: () => {
+							this.init()
+						}
+					}
+				})
+			},
 			getInfoList(url){
 				
 				if(url){
@@ -240,6 +311,7 @@
 		color: #333333;
 	}
 .news{
+	padding-bottom:120rpx;
 		.news-item{
 			padding:30rpx;
 			margin: 20rpx;
@@ -272,4 +344,22 @@
 		
 	}
 
+	.bottom {
+		position: fixed;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		//background-color: #fff;
+		padding: 16rpx 32rpx;
+	
+		uni-button {
+			height: 88rpx;
+			line-height: 88rpx;
+			border-radius: 8px;
+			background: linear-gradient(180deg, rgba(22, 119, 255, 1) 0%, rgba(16, 98, 213, 1) 100%);
+			color: rgba(255, 255, 255, 1);
+			font-size: 32rpx;
+			font-family: Microsoft Yahei;
+		}
+	}
 </style>