Browse Source

权限控制

lilei 4 năm trước cách đây
mục cha
commit
ad8de914ed

+ 8 - 14
pages.json

@@ -177,19 +177,12 @@
 			"path": "pages/spotCheckConfigure/spotCheckList",
 			"style": {
 				"navigationBarTitleText": "点检任务配置",
-				"app-plus": {
-					"scrollIndicator": "none",
-					"titleNView": {
-						"buttons": [ //原生标题栏按钮配置,
-							{
-								"text": "\ue610 新增", //原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听
-								"fontSize": 16,
-								"color": "#eee",
-								"width": "90px",
-								"fontSrc": "/static/iconfont/iconfont.ttf"
-							}
-						]
-					}
+				"titleNView": {
+					"buttons": [
+						{
+							"text": ""
+						}
+					]
 				}
 			}
 		},
@@ -305,7 +298,8 @@
 		"backgroundColor": "#F8F8F8",
 		"app-plus": {
 			// 将回弹属性关掉
-			"bounce": "none"
+			"bounce": "none",
+			"scrollIndicator": "none"
 		}
 	},
 	"tabBar": {

+ 59 - 48
pages/spotCheckConfigure/spotCheckList.vue

@@ -10,22 +10,18 @@
 				<span class="date">{{ item.startDate }} 至 {{ item.endDate }}</span>
 				<span>
 					<u-button type="success" size="mini" @click="handetail(item)">查看</u-button>
-					<u-button v-if="item.status == 0&&item.taskGenerateFlag==0" type="primary" size="mini" style="margin-left: 15upx;" @click="handedit(item)">编辑</u-button>
-					<u-button v-if="item.status == 0&&item.taskGenerateFlag==0" type="error" size="mini" style="margin-left: 15upx;" @click="handelete(item)">删除</u-button>
+					<u-button v-if="item.status == 0 && item.taskGenerateFlag == 0" type="primary" size="mini" style="margin-left: 15upx;" @click="handedit(item)">编辑</u-button>
+					<u-button v-if="item.status == 0 && item.taskGenerateFlag == 0" type="error" size="mini" style="margin-left: 15upx;" @click="handelete(item)">删除</u-button>
 				</span>
 			</view>
 		</view>
-		<view style="padding-top: 30vh;">
-			<u-empty :text="noDataText" v-if="list.length == 0 && status != 'loading'" mode="list"></u-empty>
-		</view>
-		<view style="padding: 20upx;">
-			<u-loadmore v-if="total > pageSize || status == 'loading'" :status="status" />
-		</view>
+		<view style="padding-top: 30vh;"><u-empty :text="noDataText" v-if="list.length == 0 && status != 'loading'" mode="list"></u-empty></view>
+		<view style="padding: 20upx;"><u-loadmore v-if="total > pageSize || status == 'loading'" :status="status" /></view>
 	</view>
 </template>
 
 <script>
-import {clzConfirm} from '@/libs/tools.js'
+import { clzConfirm } from '@/libs/tools.js';
 import { getCheckTaskConfigList, delCheckTaskConfig, enableCheckTaskConfig } from '@/api/checkTaskConfig.js';
 export default {
 	data() {
@@ -39,12 +35,27 @@ export default {
 		};
 	},
 	onLoad() {
+		console.log(this.$hasPermissions("M_spotCheckConfig_list"))
+		if(this.$hasPermissions("M_spotCheckConfig_list")){
+			// 设置标题栏按钮
+			let currentWebview = this.$scope.$getAppWebview();
+			currentWebview.setTitleNViewButtonStyle(0, {
+				text: '\ue610 新增',
+				fontSize: 16,
+				color: '#eee',
+				width: '80px',
+				fontSrc: '/static/iconfont/iconfont.ttf'
+			});
+		}
+		
+		// 首次加载列表
 		this.getList();
-		uni.$on("updateCheckTaskConfigList",()=>{
+		// 刷新列表
+		uni.$on('updateCheckTaskConfigList', () => {
 			this.pageNo = 1;
-			this.list = []
+			this.list = [];
 			this.getList();
-		})
+		});
 	},
 	// 新增
 	onNavigationBarButtonTap() {
@@ -55,15 +66,15 @@ export default {
 	// 上拉分页
 	onReachBottom() {
 		console.log('onReachBottom');
-		if(this.list.length< this.total){
-		  this.pageNo++
-		  this.getList()
-		}else {
-		  uni.showToast({
-			title: '已经到底了',
-			icon: 'none'
-		  })
-		  this.status = "nomore"
+		if (this.list.length < this.total) {
+			this.pageNo++;
+			this.getList();
+		} else {
+			uni.showToast({
+				title: '已经到底了',
+				icon: 'none'
+			});
+			this.status = 'nomore';
 		}
 	},
 	methods: {
@@ -72,16 +83,16 @@ export default {
 			let _this = this;
 			let params = {
 				pageNo: this.pageNo,
-				pageSize: this.pageSize,
+				pageSize: this.pageSize
 			};
 			this.status = 'loading';
 			getCheckTaskConfigList(params).then(res => {
 				if (res.status == 200) {
 					let list = res.data.list;
-					if(_this.pageNo>1){
+					if (_this.pageNo > 1) {
 						_this.list = _this.list.concat(list);
-					}else{
-						_this.list = list
+					} else {
+						_this.list = list;
 					}
 					_this.total = res.data.count;
 				} else {
@@ -95,33 +106,33 @@ export default {
 			});
 		},
 		// 启用禁用
-		changeItem(item){
-			let _this = this
-			let status = item.status == 1 ? 0 : 1
-			enableCheckTaskConfig({id:item.id,flag: status}).then(res=>{
-				if(res.status == 200){
-					console.log(_this.list,status)
-					let i = _this.list.findIndex(a=>a.id == item.id)
-					console.log(i)
-					_this.list[i].status = status
-					_this.list.splice()
+		changeItem(item) {
+			let _this = this;
+			let status = item.status == 1 ? 0 : 1;
+			enableCheckTaskConfig({ id: item.id, flag: status }).then(res => {
+				if (res.status == 200) {
+					console.log(_this.list, status);
+					let i = _this.list.findIndex(a => a.id == item.id);
+					console.log(i);
+					_this.list[i].status = status;
+					_this.list.splice();
 				}
 				uni.showToast({
 					title: res.message,
 					icon: 'none'
-				})
-			})
+				});
+			});
 		},
 		// 查看详情
 		handetail(item) {
 			uni.navigateTo({
-				url: '/pages/spotCheckConfigure/spotCheckDetail/spotCheckDetail?id='+item.id
+				url: '/pages/spotCheckConfigure/spotCheckDetail/spotCheckDetail?id=' + item.id
 			});
 		},
 		// 编辑
 		handedit(item) {
 			uni.navigateTo({
-				url: '/pages/spotCheckConfigure/addSpotCheck?id='+item.id
+				url: '/pages/spotCheckConfigure/addSpotCheck?id=' + item.id
 			});
 		},
 		// 删除
@@ -132,16 +143,16 @@ export default {
 				content: '确认删除,删除后数据将无法恢复?',
 				success: function(res) {
 					if (res.confirm || res.index == 0) {
-						delCheckTaskConfig({id:item.id}).then(ret=>{
-							if(ret.status == 200){
-								let i = _this.list.findIndex(a=>a.id == item.id)
-								_this.list.splice(i,1)
+						delCheckTaskConfig({ id: item.id }).then(ret => {
+							if (ret.status == 200) {
+								let i = _this.list.findIndex(a => a.id == item.id);
+								_this.list.splice(i, 1);
 							}
 							uni.showToast({
 								title: ret.message,
 								icon: 'none'
-							})
-						})
+							});
+						});
 					}
 				}
 			});
@@ -159,19 +170,19 @@ page {
 	margin: 20upx;
 	background-color: #fff;
 	border-radius: 3px;
-	box-shadow: 1px 1px 3px #EEEEEE;
+	box-shadow: 1px 1px 3px #eeeeee;
 	.itemName {
 		padding: 25upx;
 		display: flex;
 		justify-content: space-between;
 		align-items: center;
-		.date{
+		.date {
 			color: #666;
 		}
 	}
 	.itemName:first-child {
 		border-bottom: 1px solid #f8f8f8;
-		padding:15upx 25upx;
+		padding: 15upx 25upx;
 	}
 }
 </style>

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
unpackage/dist/dev/app-plus/app-config-service.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 9 - 9
unpackage/dist/dev/app-plus/app-service.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3 - 2
unpackage/dist/dev/app-plus/app-view.js


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác