This commit is contained in:
shilixia 2021-04-16 14:02:01 +08:00
commit 00e8856710
6 changed files with 166 additions and 41 deletions

View File

@ -98,6 +98,24 @@
}
}
,{
"path" : "pages/subtask/my",
"style" :
{
"navigationBarTitleText": "我的巡查任务",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/subtask/subtaskdetail",
"style" :
{
"navigationBarTitleText": "任务详情",
"enablePullDownRefresh": false
}
}
],
"subPackages": [{
"root": "pages/componentsC",

View File

@ -2,11 +2,20 @@
<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>
<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 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">
<view class="" slot="body">
<view class="u-body-item-title">
<span style="color:blue;border:1rpx solid blue;margin-right:6rpx">{{item.state}}</span>
@ -54,23 +63,27 @@
indicatorPos: 'bottomCenter',
effect3d: true,
test: '',
myinspecttaskList:[],
list: [{
groupName: '最近任务',
list: [{
path: '/pages/example/js',
title: '员工台账',
},
{
path: '/pages/example/components',
title: '放射源台账',
}
]
}],
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"}
myinspecttaskList: [],
grids: [{
name: '巡查任务',
icon: 'calendar',
path: '/pages/subtask/my'
},
{
name: '能力共享',
icon: 'share',
path: ''
},
{
name: '手册/资料',
icon: 'file-text',
path: ''
}
],
headstyle: {
"padding-top": "12rpx",
"padding-bottom": "12rpx"
}
}
},
computed: {
@ -81,7 +94,7 @@
},
},
onLoad() {
},
onShow() {
this.getMyInspectTask();
@ -93,9 +106,11 @@
}).catch(e => {})
},
getMyInspectTask() {
this.$u.api.getMyInspectTask({state:'执行中'}).then(res => {
this.myinspecttaskList = res.data
}).catch(e=>{})
this.$u.api.getMyInspectTask({
state: '执行中'
}).then(res => {
this.myinspecttaskList = res.data
}).catch(e => {})
},
openPage(path) {
this.$u.route({
@ -108,29 +123,32 @@
click() {
},
taskClick(index){
console.log(index)
taskClick(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{
.u-body-item-title {
font-size: 32rpx;
color: #333;
}
.u-body-item{
margin-top:4rpx;
span{
.u-body-item {
margin-top: 4rpx;
span {
color: #333;
}
}
</style>

View File

@ -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>

View File

@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@ -1,5 +1,6 @@
page {
color: $u-main-color;
background-color: #ededed;
font-size: 28rpx;
}

View File

@ -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('未填写检查结果')