检查表模板
This commit is contained in:
parent
69162eba3a
commit
b5cbd62ceb
|
@ -11,7 +11,7 @@ const install = (Vue, vm) => {
|
||||||
// header: {
|
// header: {
|
||||||
// 'content-type': 'xxx'
|
// 'content-type': 'xxx'
|
||||||
// }
|
// }
|
||||||
showLoading: false,
|
showLoading: true,
|
||||||
loadingText: '请求中..',
|
loadingText: '请求中..',
|
||||||
originalData: true,
|
originalData: true,
|
||||||
loadingTime: 800,
|
loadingTime: 800,
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<u-swiper @change="change" :height="250" :list="swiper_list" :title="swtitle" :effect3d="effect3d"
|
<u-image :src="imageURL" mode="widthFix"></u-image>
|
||||||
:indicator-pos="indicatorPos" :mode="mode" :interval="3000" @click="click"></u-swiper>
|
<!-- <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;">
|
<view style="margin-top:12rpx;margin-bottom: 12rpx;">
|
||||||
<u-grid :col="3" :border="false">
|
<u-grid :col="3" :border="false">
|
||||||
<u-grid-item v-for="(item, index) in grids" v-bind:key="index" @click="clickGrid(item)">
|
<u-grid-item v-for="(item, index) in grids" v-bind:key="index" @click="clickGrid(item)">
|
||||||
|
@ -13,7 +14,7 @@
|
||||||
<view style="margin-bottom: 12rpx;margin-left: 6rpx;">
|
<view style="margin-bottom: 12rpx;margin-left: 6rpx;">
|
||||||
<u-section title="最近任务" :right="false" ></u-section>
|
<u-section title="最近任务" :right="false" ></u-section>
|
||||||
</view>
|
</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="12rpx"
|
||||||
: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" padding="10">
|
@body-click="taskClick" :index="item.id" padding="10">
|
||||||
<view class="" slot="body">
|
<view class="" slot="body">
|
||||||
|
@ -45,6 +46,7 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
imageURL: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
|
||||||
swiper_list: [{
|
swiper_list: [{
|
||||||
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
|
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
|
||||||
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
|
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="wrap">
|
<view class="wrap">
|
||||||
<u-card :title="initData.dept__name" margin="6rpx" :border="false" :foot-border-top="false" border-radius="2rpx"
|
<u-card :title="initData.dept__name" margin="12rpx" :border="false" :foot-border-top="false" border-radius="2rpx"
|
||||||
:head-style="headstyle" padding="10">
|
:head-style="headstyle" padding="10">
|
||||||
<view class="" slot="body">
|
<view class="" slot="body">
|
||||||
<view class="u-body-item-title">
|
<view class="u-body-item-title">
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
<u-form :model="form" label-position="top" :label-style="labelStyle" ref="uForm" :rules="rules"
|
<u-form :model="form" label-position="top" :label-style="labelStyle" ref="uForm" :rules="rules"
|
||||||
:errorType="errorType">
|
:errorType="errorType">
|
||||||
<u-form-item label="检查事项" v-if="form.item_">
|
<u-form-item label="检查事项" v-if="form.item_">
|
||||||
|
<view>
|
||||||
<view >类别:<span style="color:darkblue;font-weight: bold;">{{form.item_.type}}</span></view>
|
<view >类别:<span style="color:darkblue;font-weight: bold;">{{form.item_.type}}</span></view>
|
||||||
<view>{{form.item_.sortnum}}.{{form.item_.name}}</view>
|
<view>{{form.item_.sortnum}}.{{form.item_.name}}</view>
|
||||||
|
</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u-form-item label="取证要求" v-if="form.item_">
|
<u-form-item label="取证要求" v-if="form.item_">
|
||||||
<span>{{form.item_.require}}</span>
|
<span>{{form.item_.require}}</span>
|
||||||
|
@ -107,7 +109,9 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
// console.log(sData.imgs)
|
// console.log(sData.imgs)
|
||||||
|
|
||||||
this.$u.api.checkInspectRecord(sData.id, sData).then(res => {
|
this.$u.api.checkInspectRecord(sData.id, sData).then(res => {
|
||||||
|
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<view class="wrap">
|
<view class="wrap">
|
||||||
<view class="top"></view>
|
<view class="top"></view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
|
<view style="text-align: center;font-weight: 500;font-size: 40rpx;">国检集团</view>
|
||||||
<view class="title">能力共享和质量监督平台</view>
|
<view class="title">能力共享和质量监督平台</view>
|
||||||
<u-form :model="loginForm" :rules="rules" ref="uForm" :errorType="errorType">
|
<u-form :model="loginForm" :rules="rules" ref="uForm" :errorType="errorType">
|
||||||
<u-form-item label="邮箱号" prop="mail" label-width="150">
|
<u-form-item label="邮箱号" prop="mail" label-width="150">
|
||||||
|
@ -13,7 +14,11 @@
|
||||||
<u-button slot="right" type="success" size="mini" @click="getCode">{{codeTips}}</u-button>
|
<u-button slot="right" type="success" size="mini" @click="getCode">{{codeTips}}</u-button>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</u-form>
|
</u-form>
|
||||||
<button @tap="submit" :style="[inputStyle]" class="getCaptcha">登录</button>
|
<!-- <button :style="[inputStyle]" class="getCaptcha">登录</button> -->
|
||||||
|
<!-- <u-gap height="1" bg-color="#bbb"></u-gap> -->
|
||||||
|
<view style="margin-top: 16rpx;">
|
||||||
|
<u-button @click="submit" type="warning" >登录</u-button>
|
||||||
|
</view>
|
||||||
<view class="alternative">
|
<view class="alternative">
|
||||||
<navigator url="login_password" class="password" open-type="redirect">密码登录</navigator>
|
<navigator url="login_password" class="password" open-type="redirect">密码登录</navigator>
|
||||||
</view>
|
</view>
|
||||||
|
@ -89,21 +94,30 @@ export default {
|
||||||
style.backgroundColor = this.$u.color['warning'];
|
style.backgroundColor = this.$u.color['warning'];
|
||||||
}
|
}
|
||||||
return style;
|
return style;
|
||||||
|
},
|
||||||
|
submitEnable(){
|
||||||
|
if(this.loginForm.mail && this.loginForm.msg) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submit() {
|
submit() {
|
||||||
this.$refs.uForm.validate(valid => {
|
this.$refs.uForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
uni.showLoading({
|
||||||
|
})
|
||||||
this.$u.api.codeLogin(this.loginForm).then(res=>{
|
this.$u.api.codeLogin(this.loginForm).then(res=>{
|
||||||
this.$u.vuex('vuex_token', res.data.access)
|
this.$u.vuex('vuex_token', res.data.access)
|
||||||
this.$u.api.getUserInfo().then(res=>{
|
this.$u.api.getUserInfo().then(res=>{
|
||||||
this.$u.vuex('vuex_user', res.data)
|
this.$u.vuex('vuex_user', res.data)
|
||||||
|
uni.hideLoading()
|
||||||
})
|
})
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url:'/pages/home/home'
|
url:'/pages/home/home'
|
||||||
})
|
})
|
||||||
}).catch(e=>{})
|
}).catch(e=>{uni.hideLoading()})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -142,7 +156,7 @@ export default {
|
||||||
margin: 40rpx auto 0;
|
margin: 40rpx auto 0;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
text-align: left;
|
text-align: center;
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-bottom: 100rpx;
|
margin-bottom: 100rpx;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<view class="wrap">
|
<view class="wrap">
|
||||||
<view class="top"></view>
|
<view class="top"></view>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
|
<view style="text-align: center;font-weight: 500;font-size: 40rpx;">国检集团</view>
|
||||||
<view class="title">能力共享和质量监督平台</view>
|
<view class="title">能力共享和质量监督平台</view>
|
||||||
<u-form :model="loginForm" :rules="rules" ref="uForm" :errorType="errorType">
|
<u-form :model="loginForm" :rules="rules" ref="uForm" :errorType="errorType">
|
||||||
<u-form-item label="账户" prop="username" label-width="150">
|
<u-form-item label="账户" prop="username" label-width="150">
|
||||||
|
@ -11,7 +12,9 @@
|
||||||
<u-input placeholder="请输入密码" v-model="loginForm.password" type="password"></u-input>
|
<u-input placeholder="请输入密码" v-model="loginForm.password" type="password"></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</u-form>
|
</u-form>
|
||||||
<button @click="submit" :style="[inputStyle]" class="getCaptcha">登陆</button>
|
<view style="margin-top: 16rpx;">
|
||||||
|
<u-button @click="submit" type="warning" >登录</u-button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
@ -99,7 +102,7 @@ export default {
|
||||||
margin: 80rpx auto 0;
|
margin: 80rpx auto 0;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
text-align: left;
|
text-align: center;
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-bottom: 100rpx;
|
margin-bottom: 100rpx;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="wrap">
|
<view class="wrap">
|
||||||
<u-card :title="subtask.name" margin="6rpx" :border="false" :foot-border-top="false" border-radius="2rpx"
|
<u-card :title="subtask.name" margin="12rpx" :border="false" :foot-border-top="false" border-radius="2rpx"
|
||||||
:head-style="headstyle" padding="10">
|
:head-style="headstyle" padding="10">
|
||||||
<view class="" slot="body">
|
<view class="" slot="body">
|
||||||
<view class="u-body-item-title">
|
<view class="u-body-item-title">
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
name: '检查中'
|
name: '检查中'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '已完成'
|
name: '已提交'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
taskdepts: [],
|
taskdepts: [],
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 3.0.5 on 2021-04-25 00:28
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('quality', '0012_inspecttemplate'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='inspectitem',
|
||||||
|
name='template',
|
||||||
|
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='quality.InspectTemplate', verbose_name='所属模板'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
|
@ -21,7 +21,7 @@ class InspectItem(CommonAModel):
|
||||||
type = models.CharField('类型', max_length=50, choices=type_choices, default='合规')
|
type = models.CharField('类型', max_length=50, choices=type_choices, default='合规')
|
||||||
require = models.TextField('取证要求', null=True, blank=True)
|
require = models.TextField('取证要求', null=True, blank=True)
|
||||||
sortnum = models.IntegerField('序号', default=1)
|
sortnum = models.IntegerField('序号', default=1)
|
||||||
# template = models.ForeignKey(InspectTemplate, on_delete=models.CASCADE, verbose_name='所属模板')
|
template = models.ForeignKey(InspectTemplate, on_delete=models.CASCADE, verbose_name='所属模板')
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '检查清单'
|
verbose_name = '检查清单'
|
||||||
verbose_name_plural = verbose_name
|
verbose_name_plural = verbose_name
|
||||||
|
|
|
@ -127,7 +127,7 @@ class InspectRecordCheckSerializer(serializers.ModelSerializer):
|
||||||
raise ParseError('未填写检查结果')
|
raise ParseError('未填写检查结果')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
class InspectTemplateSerializer(serializers.ModelSerializer):
|
class InspectTemplateSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = InspectTemplate
|
model = InspectTemplate
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
|
@ -23,7 +23,17 @@ from .serializers import *
|
||||||
from .permission import IsSubInspectTaskLeader, IsInspectRecordChecker
|
from .permission import IsSubInspectTaskLeader, IsInspectRecordChecker
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
class InspectItemViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
class InspectTemplateViewSet(PageOrNot, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
|
"""
|
||||||
|
检查表模板
|
||||||
|
"""
|
||||||
|
perms_map = {'get': '*', 'post': 'inspectitem',
|
||||||
|
'put': 'inspectitem', 'delete': 'inspectitem'}
|
||||||
|
queryset = InspectTemplate.objects.all()
|
||||||
|
serializer_class = InspectTemplateSerializer
|
||||||
|
ordering = ['id']
|
||||||
|
|
||||||
|
class InspectItemViewSet(PageOrNot, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
"""
|
"""
|
||||||
检查表清单:增删改查
|
检查表清单:增删改查
|
||||||
"""
|
"""
|
||||||
|
@ -31,9 +41,8 @@ class InspectItemViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
'put': 'inspectitem', 'delete': 'inspectitem'}
|
'put': 'inspectitem', 'delete': 'inspectitem'}
|
||||||
queryset = InspectItem.objects.all()
|
queryset = InspectItem.objects.all()
|
||||||
serializer_class = InspectItemSerializer
|
serializer_class = InspectItemSerializer
|
||||||
pagination_class = None
|
|
||||||
search_fields = ['name', 'require']
|
search_fields = ['name', 'require']
|
||||||
filterset_fields = ['type','cate']
|
filterset_fields = ['type','cate', 'template']
|
||||||
ordering = ['sortnum', 'cate__sort', 'create_time']
|
ordering = ['sortnum', 'cate__sort', 'create_time']
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,8 +133,13 @@ class SubtaskViewSet(PageOrNot, CreateUpdateCustomMixin, OptimizationMixin, Mode
|
||||||
return Response(data)
|
return Response(data)
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
创建子任务
|
||||||
|
form:{inspecttask:id, name:'', leader:id, members:[id]}
|
||||||
|
"""
|
||||||
obj = SubInspectTask()
|
obj = SubInspectTask()
|
||||||
obj.inspecttask = InspectTask.objects.get(pk=request.data['inspecttask'])
|
inspecttask = InspectTask.objects.get(pk=request.data['inspecttask'])
|
||||||
|
obj.inspecttask = inspecttask
|
||||||
obj.name = request.data['name']
|
obj.name = request.data['name']
|
||||||
obj.create_by = request.user
|
obj.create_by = request.user
|
||||||
obj.save()
|
obj.save()
|
||||||
|
@ -141,7 +155,7 @@ class SubtaskViewSet(PageOrNot, CreateUpdateCustomMixin, OptimizationMixin, Mode
|
||||||
data['dept'] = mdept
|
data['dept'] = mdept
|
||||||
data['subtask'] = obj
|
data['subtask'] = obj
|
||||||
depts.append(InspectDept(**data))
|
depts.append(InspectDept(**data))
|
||||||
for i in InspectItem.objects.filter(is_deleted=False):
|
for i in InspectItem.objects.filter(is_deleted=False, template=inspecttask.template):
|
||||||
r = {}
|
r = {}
|
||||||
r['dept'] = mdept
|
r['dept'] = mdept
|
||||||
r['item'] = i
|
r['item'] = i
|
||||||
|
|
Loading…
Reference in New Issue