提交检查结果报错
This commit is contained in:
		
							parent
							
								
									c3ac5073fe
								
							
						
					
					
						commit
						385856fa1f
					
				| 
						 | 
				
			
			@ -97,6 +97,24 @@
 | 
			
		|||
		        "enablePullDownRefresh": false
 | 
			
		||||
		    }
 | 
			
		||||
		    
 | 
			
		||||
		}
 | 
			
		||||
        ,{
 | 
			
		||||
            "path" : "pages/subtask/my",
 | 
			
		||||
            "style" :                                                                                    
 | 
			
		||||
            {
 | 
			
		||||
                "navigationBarTitleText": "我的巡查任务",
 | 
			
		||||
                "enablePullDownRefresh": false
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
        ,{
 | 
			
		||||
            "path" : "pages/subtask/subtaskdetail",
 | 
			
		||||
            "style" :                                                                                    
 | 
			
		||||
            {
 | 
			
		||||
                "navigationBarTitleText": "任务详情",
 | 
			
		||||
                "enablePullDownRefresh": false
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
	"subPackages": [{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,8 +2,17 @@
 | 
			
		|||
	<view class="wrap">
 | 
			
		||||
		<u-swiper @change="change" :height="250" :list="swiper_list" :title="swtitle" :effect3d="effect3d"
 | 
			
		||||
			:indicator-pos="indicatorPos" :mode="mode" :interval="3000" @click="click"></u-swiper>
 | 
			
		||||
			
 | 
			
		||||
		
 | 
			
		||||
		<view style="margin-top:12rpx;margin-bottom: 12rpx;">
 | 
			
		||||
		<u-grid :col="3" :border="false">
 | 
			
		||||
			<u-grid-item v-for="(item, index) in grids" v-bind:key="index" @click="clickGrid(item)">
 | 
			
		||||
				<u-icon :name="item.icon" :size="60"></u-icon>
 | 
			
		||||
				<view class="grid-text">{{item.name}}</view>
 | 
			
		||||
			</u-grid-item>
 | 
			
		||||
		</u-grid>
 | 
			
		||||
		</view>
 | 
			
		||||
		<view style="margin-bottom: 12rpx;margin-left: 6rpx;">
 | 
			
		||||
		<u-section title="最近任务" :right="false" ></u-section>
 | 
			
		||||
		</view>
 | 
			
		||||
		<u-card v-for="(item, index) in myinspecttaskList" v-bind:key="index" :title="item.name" margin="6rpx"
 | 
			
		||||
			:border="false" :foot-border-top="false" border-radius="2rpx" :head-style="headstyle"
 | 
			
		||||
			@body-click="taskClick" :index="item.id">
 | 
			
		||||
| 
						 | 
				
			
			@ -55,22 +64,26 @@
 | 
			
		|||
				effect3d: true,
 | 
			
		||||
				test: '',
 | 
			
		||||
				myinspecttaskList: [],
 | 
			
		||||
				list: [{
 | 
			
		||||
					groupName: '最近任务',
 | 
			
		||||
					list: [{
 | 
			
		||||
							path: '/pages/example/js',
 | 
			
		||||
							title: '员工台账',
 | 
			
		||||
				grids: [{
 | 
			
		||||
						name: '巡查任务',
 | 
			
		||||
						icon: 'calendar',
 | 
			
		||||
						path: '/pages/subtask/my'
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
							path: '/pages/example/components',
 | 
			
		||||
							title: '放射源台账',
 | 
			
		||||
						name: '能力共享',
 | 
			
		||||
						icon: 'share',
 | 
			
		||||
						path: ''
 | 
			
		||||
					},
 | 
			
		||||
					{
 | 
			
		||||
						name: '手册/资料',
 | 
			
		||||
						icon: 'file-text',
 | 
			
		||||
						path: ''
 | 
			
		||||
					}
 | 
			
		||||
				],
 | 
			
		||||
				headstyle: {
 | 
			
		||||
					"padding-top": "12rpx",
 | 
			
		||||
					"padding-bottom": "12rpx"
 | 
			
		||||
				}
 | 
			
		||||
					]
 | 
			
		||||
				}],
 | 
			
		||||
				title: '素胚勾勒出青花,笔锋浓转淡',
 | 
			
		||||
				subTitle: '2020-05-15',
 | 
			
		||||
				thumb: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
 | 
			
		||||
				headstyle:{"padding-top":"12rpx","padding-bottom":"12rpx"}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		computed: {
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +106,9 @@
 | 
			
		|||
				}).catch(e => {})
 | 
			
		||||
			},
 | 
			
		||||
			getMyInspectTask() {
 | 
			
		||||
				this.$u.api.getMyInspectTask({state:'执行中'}).then(res => {
 | 
			
		||||
				this.$u.api.getMyInspectTask({
 | 
			
		||||
					state: '执行中'
 | 
			
		||||
				}).then(res => {
 | 
			
		||||
					this.myinspecttaskList = res.data
 | 
			
		||||
				}).catch(e => {})
 | 
			
		||||
			},
 | 
			
		||||
| 
						 | 
				
			
			@ -109,28 +124,31 @@
 | 
			
		|||
 | 
			
		||||
			},
 | 
			
		||||
			taskClick(index) {
 | 
			
		||||
				console.log(index)
 | 
			
		||||
				uni.navigateTo({
 | 
			
		||||
					url:"/pages/subtask/subtaskdetail?id="+index
 | 
			
		||||
				})
 | 
			
		||||
			},
 | 
			
		||||
			clickGrid(val){
 | 
			
		||||
				uni.navigateTo({
 | 
			
		||||
					url:val.path
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style>
 | 
			
		||||
	page {
 | 
			
		||||
		background-color: #ededed;
 | 
			
		||||
	}
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
	.u-body-item-title {
 | 
			
		||||
		font-size: 32rpx;
 | 
			
		||||
		color: #333;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	.u-body-item {
 | 
			
		||||
		margin-top: 4rpx;
 | 
			
		||||
		span {
 | 
			
		||||
			color: #333;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
</style>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,68 @@
 | 
			
		|||
<template>
 | 
			
		||||
	<view class="wrap">
 | 
			
		||||
		<u-card v-for="(item, index) in myinspecttaskList" v-bind:key="index" :title="item.name" margin="6rpx"
 | 
			
		||||
			:border="false" :foot-border-top="false" border-radius="2rpx" :head-style="headstyle"
 | 
			
		||||
			@body-click="taskClick" :index="item.id">
 | 
			
		||||
			<view class="" slot="body">
 | 
			
		||||
				<view class="u-body-item-title">
 | 
			
		||||
					<span style="color:blue;border:1rpx solid blue;margin-right:6rpx">{{item.state}}</span>
 | 
			
		||||
					{{item.name}}
 | 
			
		||||
				</view>
 | 
			
		||||
				<view class="u-body-item">
 | 
			
		||||
					所属任务:
 | 
			
		||||
					<span>{{item.inspecttask_.name}}</span>
 | 
			
		||||
				</view>
 | 
			
		||||
				<view class="u-body-item">
 | 
			
		||||
					检查期限:
 | 
			
		||||
					<span>{{item.inspecttask_.start_date}}</span>至
 | 
			
		||||
					<span>{{item.inspecttask_.end_date}}</span>
 | 
			
		||||
				</view>
 | 
			
		||||
				<view class="u-body-item">
 | 
			
		||||
					涉及单位:
 | 
			
		||||
					<span style="color:blue;">{{item.depts_count}}</span>家
 | 
			
		||||
					巡查组:
 | 
			
		||||
					<span style="color:blue;">{{item.members.length}}</span>人
 | 
			
		||||
				</view>
 | 
			
		||||
			</view>
 | 
			
		||||
		</u-card>
 | 
			
		||||
	</view>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
	export default {
 | 
			
		||||
		data() {
 | 
			
		||||
			return {
 | 
			
		||||
				myinspecttaskList: [],
 | 
			
		||||
				headstyle: {
 | 
			
		||||
					"padding-top": "12rpx",
 | 
			
		||||
					"padding-bottom": "12rpx"
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		onShow() {
 | 
			
		||||
			this.getMyInspectTask();
 | 
			
		||||
		},
 | 
			
		||||
		methods: {
 | 
			
		||||
			getMyInspectTask() {
 | 
			
		||||
				this.$u.api.getMyInspectTask({}).then(res => {
 | 
			
		||||
					this.myinspecttaskList = res.data
 | 
			
		||||
				}).catch(e => {})
 | 
			
		||||
			},
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss" scoped>
 | 
			
		||||
	.u-body-item-title {
 | 
			
		||||
		font-size: 32rpx;
 | 
			
		||||
		color: #333;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	.u-body-item {
 | 
			
		||||
		margin-top: 4rpx;
 | 
			
		||||
		span {
 | 
			
		||||
			color: #333;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
<template>
 | 
			
		||||
	<view>
 | 
			
		||||
		
 | 
			
		||||
	</view>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
	export default {
 | 
			
		||||
		data() {
 | 
			
		||||
			return {
 | 
			
		||||
				
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		methods: {
 | 
			
		||||
			
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style>
 | 
			
		||||
 | 
			
		||||
</style>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
page {
 | 
			
		||||
	color: $u-main-color;
 | 
			
		||||
	background-color: #ededed;
 | 
			
		||||
	font-size: 28rpx;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -97,11 +97,9 @@ class InspectRecordCheckSerializer(serializers.ModelSerializer):
 | 
			
		|||
        fields = ['id', 'result', 'note', 'imgs']
 | 
			
		||||
    
 | 
			
		||||
    def validate_result(self, result):
 | 
			
		||||
        if not self.obj.checker in [None, self.request.user]:
 | 
			
		||||
            raise serializers.ValidationError('您无权操作')
 | 
			
		||||
        if result:
 | 
			
		||||
            if result == '发现':
 | 
			
		||||
                if not (self.note or self.imgs):
 | 
			
		||||
                if not (self.data.note or self.data.imgs):
 | 
			
		||||
                    raise serializers.ValidationError('发现问题请填写说明或上传图片')
 | 
			
		||||
        else:
 | 
			
		||||
            raise serializers.ValidationError('未填写检查结果')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue