This commit is contained in:
shilixia 2021-04-30 15:17:08 +08:00
commit 83a0ed11ff
12 changed files with 130 additions and 34 deletions

View File

@ -96,4 +96,11 @@ export function getmytasklist(query) {
method: 'get',
params: query
})
}
export function confirmTaskdept(id) {
return request({
url: `/supervision/taskdept/${id}/confirm/`,
method: 'put'
})
}

View File

@ -124,6 +124,25 @@
{{ scope.row.confirm_rate }}%
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="240px"
fixed="right"
>
<template slot-scope="scope">
<el-link
v-if="
scope.row.confirm_rate != 100 &&
checkPermission(['record_confirm'])
"
type="warning"
size="small"
@click="handleConfirmDept(scope)"
>确认</el-link
>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card style="margin-top: 2px">
@ -309,7 +328,7 @@
}
</style>
<script>
import { gettask, inittask, gettaskdeptall, starttask, appendtask } from "@/api/task";
import { gettask, inittask, gettaskdeptall, starttask, appendtask, confirmTaskdept } from "@/api/task";
import { getRecordList, updateRecords } from "@/api/record";
import Pagination from "@/components/Pagination";
import taskinit from "@/views/supervision/taskinit";
@ -442,6 +461,12 @@ export default {
}
this.selectRecords = selects;
},
handleConfirmDept(scope){
confirmTaskdept(scope.row.id).then(res=>{
this.getRecordList()
this.gettaskdeptall()
})
},
handleUp2(){
if (this.selectRecords.length) {
this.$prompt('请输入备注内容', '提示').then(({ value }) => {

View File

@ -13,25 +13,40 @@
/**
* h5app-plus(nvue下也为app-plus)mp-weixinmp-alipay......
*/
var that=this
//var that=this
// 小程序自动登录
uni.showLoading({
title:'微信自动登录中...',
mask: true
})
uni.login({
provider: 'weixin',
success: function (loginRes) {
that.$u.api.wxmplogin({code:loginRes.code}).then(res=>{
that.$u.vuex('vuex_token', res.data.access)
}).catch(e=>{uni.reLaunch({
success: (loginRes)=>{
this.$u.api.wxmplogin({code:loginRes.code}).then(res=>{
this.$u.vuex('vuex_token', res.data.access)
this.$u.api.getUserInfo().then(res=>{
uni.hideLoading()
uni.showToast({
title:"登录成功",
icon:"none"
})
uni.reLaunch({
url:"/pages/home/home"
})
this.$u.vuex('vuex_user', res.data)
})
}).catch(e=>{
uni.hideLoading()
uni.showToast({
title:"暂未绑定微信!",
icon:"none"
})
uni.reLaunch({
url:'/pages/login/login'
})})
}
});
// this.$u.api.getUserInfo().then(res=>{
// this.$u.vuex('vuex_user', res.data)
// }).catch(e=>{
// uni.reLaunch({
// url:'/pages/login/login'
// })
// })
},
}
</script>

View File

@ -11,6 +11,15 @@
// }]
// },
"pages": [
{
"path" : "pages/login/login",
"style" :
{
"navigationBarTitleText": "验证码登录",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/home/home",
"style" :
@ -28,15 +37,6 @@
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/login/login",
"style" :
{
"navigationBarTitleText": "验证码登录",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/login/login_password",

View File

@ -20,7 +20,7 @@
<u-form-item label="拍照取证">
<u-image
@click="imgListPreview(index)"
width="260rpx" height="260rpx" :src="item" v-for="(item, index) in fileList" v-bind:key="index" style="margin: 8rpx;"></u-image>
width="260rpx" height="260rpx" :src="item" v-for="(item, index) in fileList" v-bind:key="index" style="margin: 2rpx;"></u-image>
</u-form-item>
</u-form>

View File

@ -34,12 +34,12 @@ const store = new Vuex.Store({
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {},
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
// vuex_host: 'http://127.0.0.1:8000',
// vuex_api: 'http://127.0.0.1:8000/api',
// vuex_apifile: 'http://127.0.0.1:8000/api/file/',
vuex_api: 'http://127.0.0.1:8000/api',
vuex_apifile: 'http://127.0.0.1:8000/api/file/',
vuex_host: 'https://testsearch.ctc.ac.cn',
vuex_api: 'https://testsearch.ctc.ac.cn/api',
vuex_apifile: 'https://testsearch.ctc.ac.cn/api/file/',
// vuex_api: 'https://testsearch.ctc.ac.cn/api',
// vuex_apifile: 'https://testsearch.ctc.ac.cn/api/file/',
// 如果vuex_version无需保存到本地永久存储无需lifeData.vuex_version方式
// vuex_version: '1.0.1',

View File

@ -196,7 +196,7 @@ class InspectDeptViewSet(OptimizationMixin, ListModelMixin, RetrieveModelMixin,
if not InspectRecord.objects.filter(dept=obj.dept, subtask=obj.subtask).exists():
for i in InspectItem.objects.filter(is_deleted=False, template=obj.subtask.inspecttask.template):
r = {}
r['dept'] = obj.dpet
r['dept'] = obj.dept
r['item'] = i
r['subtask'] = obj.subtask
r['create_by'] = request.user

View File

@ -1,12 +1,13 @@
from apps.supervision.serializers import TaskDeptSerializer
from django.urls import path, include
from rest_framework import routers
from .views import ContentViewSet, TaskViewSet,RecordViewSet
from .views import ContentViewSet, TaskViewSet,RecordViewSet, TaskDeptViewSet
router = routers.DefaultRouter()
router.register('content', ContentViewSet, basename="content")
router.register('task', TaskViewSet, basename="task")
router.register('record', RecordViewSet, basename="record")
router.register('taskdept', TaskDeptViewSet, basename="taskdept")
urlpatterns = [
path('', include(router.urls))
]

View File

@ -331,3 +331,26 @@ class RecordViewSet(PageOrNot, CreateUpdateCustomMixin, ModelViewSet):
return Response('记录状态错误', status=status.HTTP_400_BAD_REQUEST)
class TaskDeptViewSet(ModelViewSet):
"""
任务关联部门 操作
"""
perms_map = {'get': '*', 'post': 'task_update',
'put': 'task_update', 'delete': 'task_update'}
queryset = TaskDept.objects.all()
serializer_class = TaskDeptSerializer
filterset_fields = ['task','dept']
ordering = ['dept__sort']
@action(methods=['put'], detail=True, perms_map = {'put':'record_confirm'})
def confirm(self, request, *args, **kwargs):
"""
批量确认
"""
obj = self.get_object()
if obj.up_rate == 100:
Record.objects.filter(task=obj.task, belong_dept=obj.dept).update(state='已确认')
obj.confirm_rate = 100
obj.save()
return Response(status=status.HTTP_200_OK)
return Response('报送未完成', status=status.HTTP_400_BAD_REQUEST)

View File

@ -0,0 +1,19 @@
# Generated by Django 3.0.5 on 2021-04-30 03:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('system', '0017_userthird'),
]
operations = [
migrations.AlterField(
model_name='userthird',
name='openid',
field=models.CharField(default='xx', max_length=200, unique=True, verbose_name='第三方账号'),
preserve_default=False,
),
]

View File

@ -229,4 +229,4 @@ class UserThird(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='关联账户', related_name='third_user')
type = models.CharField('类型', max_length=50, choices=type_choices, default='wx_mp')
openid = models.CharField('第三方账号', null=True, blank=True, max_length=200)
openid = models.CharField('第三方账号', max_length=200, unique=True)

View File

@ -315,8 +315,8 @@ class UserViewSet(PageOrNot, ModelViewSet):
'perms': perms,
}
try:
user = UserThird.objects.get(user=user,type='wx_mp').user
data['wxmp_openid'] = user.openid
usert = UserThird.objects.get(user=user,type='wx_mp')
data['wxmp_openid'] = usert.openid
except:
pass
return Response(data)
@ -343,7 +343,13 @@ class UserViewSet(PageOrNot, ModelViewSet):
code+'&grant_type=authorization_code').content.decode('utf-8')
info = json.loads(info)
openid = info['openid']
UserThird.objects.get_or_create(openid=openid, type='wx_mp', user=request.user, defaults={'openid':openid, 'user':request.user, 'type':'wx_mp'})
instances = UserThird.objects.filter(openid=openid)
if instances.exists():
instance = instances[0]
instance.user = request.user
instance.save()
else:
UserThird.objects.get_or_create(openid=openid, type='wx_mp', user=request.user, defaults={'openid':openid, 'user':request.user, 'type':'wx_mp'})
return Response({'wxmp_openid':openid},status=status.HTTP_200_OK)