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": [{ "subPackages": [{
"root": "pages/componentsC", "root": "pages/componentsC",

View File

@ -2,11 +2,20 @@
<view class="wrap"> <view class="wrap">
<u-swiper @change="change" :height="250" :list="swiper_list" :title="swtitle" :effect3d="effect3d" <u-swiper @change="change" :height="250" :list="swiper_list" :title="swtitle" :effect3d="effect3d"
:indicator-pos="indicatorPos" :mode="mode" :interval="3000" @click="click"></u-swiper> :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" <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" :border="false" :foot-border-top="false" border-radius="2rpx" :head-style="headstyle"
@body-click="taskClick" :index="item.id"> @body-click="taskClick" :index="item.id">
<view class="" slot="body"> <view class="" slot="body">
<view class="u-body-item-title"> <view class="u-body-item-title">
<span style="color:blue;border:1rpx solid blue;margin-right:6rpx">{{item.state}}</span> <span style="color:blue;border:1rpx solid blue;margin-right:6rpx">{{item.state}}</span>
@ -54,23 +63,27 @@
indicatorPos: 'bottomCenter', indicatorPos: 'bottomCenter',
effect3d: true, effect3d: true,
test: '', test: '',
myinspecttaskList:[], myinspecttaskList: [],
list: [{ grids: [{
groupName: '最近任务', name: '巡查任务',
list: [{ icon: 'calendar',
path: '/pages/example/js', path: '/pages/subtask/my'
title: '员工台账', },
}, {
{ name: '能力共享',
path: '/pages/example/components', icon: 'share',
title: '放射源台账', path: ''
} },
] {
}], name: '手册/资料',
title: '素胚勾勒出青花,笔锋浓转淡', icon: 'file-text',
subTitle: '2020-05-15', path: ''
thumb: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg', }
headstyle:{"padding-top":"12rpx","padding-bottom":"12rpx"} ],
headstyle: {
"padding-top": "12rpx",
"padding-bottom": "12rpx"
}
} }
}, },
computed: { computed: {
@ -93,9 +106,11 @@
}).catch(e => {}) }).catch(e => {})
}, },
getMyInspectTask() { getMyInspectTask() {
this.$u.api.getMyInspectTask({state:'执行中'}).then(res => { this.$u.api.getMyInspectTask({
this.myinspecttaskList = res.data state: '执行中'
}).catch(e=>{}) }).then(res => {
this.myinspecttaskList = res.data
}).catch(e => {})
}, },
openPage(path) { openPage(path) {
this.$u.route({ this.$u.route({
@ -108,29 +123,32 @@
click() { click() {
}, },
taskClick(index){ taskClick(index) {
console.log(index) uni.navigateTo({
url:"/pages/subtask/subtaskdetail?id="+index
})
},
clickGrid(val){
uni.navigateTo({
url:val.path
})
} }
} }
} }
</script> </script>
<style>
page {
background-color: #ededed;
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
.u-body-item-title{ .u-body-item-title {
font-size: 32rpx; font-size: 32rpx;
color: #333; color: #333;
} }
.u-body-item{
margin-top:4rpx; .u-body-item {
span{ margin-top: 4rpx;
span {
color: #333; color: #333;
} }
} }
</style> </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 { page {
color: $u-main-color; color: $u-main-color;
background-color: #ededed;
font-size: 28rpx; font-size: 28rpx;
} }

View File

@ -97,11 +97,9 @@ class InspectRecordCheckSerializer(serializers.ModelSerializer):
fields = ['id', 'result', 'note', 'imgs'] fields = ['id', 'result', 'note', 'imgs']
def validate_result(self, result): def validate_result(self, result):
if not self.obj.checker in [None, self.request.user]:
raise serializers.ValidationError('您无权操作')
if result: if result:
if result == '发现': if result == '发现':
if not (self.note or self.imgs): if not (self.data.note or self.data.imgs):
raise serializers.ValidationError('发现问题请填写说明或上传图片') raise serializers.ValidationError('发现问题请填写说明或上传图片')
else: else:
raise serializers.ValidationError('未填写检查结果') raise serializers.ValidationError('未填写检查结果')