This commit is contained in:
caoqianming 2021-03-18 09:15:39 +08:00
commit 2f9db6f915
4 changed files with 194 additions and 86 deletions

View File

@ -34,7 +34,13 @@ export function updateRecord(id, data) {
data data
}) })
} }
export function createself(data) {
return request({
url: `/supervision/record/createself/`,
method: 'post',
data
})
}
export function upRecord(id, data) { export function upRecord(id, data) {
return request({ return request({
url: `/supervision/record/${id}/up/`, url: `/supervision/record/${id}/up/`,

View File

@ -76,15 +76,15 @@
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="任务标题"> <el-table-column label="任务标题">
<template slot-scope="scope">{{ scope.row.task_.name }}</template> <template slot-scope="scope" v-if="scope.row.task">{{ scope.row.task_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="材料名称"> <el-table-column label="材料名称">
<template slot-scope="scope">{{ scope.row.content_.name }}</template> <template slot-scope="scope" >{{ scope.row.content_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column sortable label="上报时间"> <el-table-column sortable label="上报时间">
<template slot-scope="scope">{{ scope.row.up_date }}</template> <template slot-scope="scope" >{{ scope.row.up_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="上报人"> <el-table-column label="上报人" >
<template slot-scope="scope">{{ scope.row.up_user }}</template> <template slot-scope="scope">{{ scope.row.up_user }}</template>
</el-table-column> </el-table-column>
<el-table-column sortable label="截止时间"> <el-table-column sortable label="截止时间">
@ -100,7 +100,7 @@
</el-table-column> </el-table-column>
<el-table-column label="上报单位"> <el-table-column label="上报单位">
<template slot-scope="scope">{{ scope.row.belong_dept_.name }}</template> <template slot-scope="scope" >{{ scope.row.belong_dept_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="记录状态"> <el-table-column label="记录状态">
<template slot-scope="scope">{{ scope.row.state }}</template> <template slot-scope="scope">{{ scope.row.state }}</template>

View File

@ -1,80 +1,124 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div style="margin-top: 10px"> <el-card
<el-tabs v-model="activeName"> style="margin-top: 10px"
<el-tab-pane label="待上报" name="first" lazy> </el-tab-pane>
<el-tab-pane label="已上报" name="three" lazy> </el-tab-pane>
<el-tab-pane label="待整改" name="secord" lazy> </el-tab-pane>
<el-tab-pane label="已确认" name="fore" lazy> </el-tab-pane>
</el-tabs>
</div>
<el-table
v-loading="listLoading"
:data="recordList"
border
fit
stripe
highlight-current-row
max-height="600px"
> >
<el-table-column label="序号" type="index" align="center" /> <el-row>
<el-table-column label="单位"> <el-button type="primary" @click="centerDialogVisible = true" plain>主动上报</el-button>
<template slot-scope="scope">{{ <el-dialog
scope.row.belong_dept_.name title="提示"
}}</template> :visible.sync="centerDialogVisible"
</el-table-column> width="50%"
<el-table-column label="状态"> center>
<template slot-scope="scope">{{ scope.row.state }}</template> <el-transfer
</el-table-column> v-model="contents"
<el-table-column label="上报情况"> :data="contentOptions"
<template slot-scope="scope" v-if="scope.row.up_user_" :titles="['材料清单', '选择的清单']"
>{{ scope.row.up_user_.name }}/{{ scope.row.up_date }}</template :props="{ key : 'id' , label: 'name' }"
> />
</el-table-column> <span slot="footer" class="dialog-footer">
<el-table-column align="center" label="操作"> <el-button type="danger" @click="dialogVisible = false">取消</el-button>
<template slot-scope="scope"> <el-button type="primary" @click="contentup()">确认</el-button>
<el-button
v-if=" </span>
scope.row.state == '待上报' && checkPermission(['record_update']) </el-dialog>
" </el-row>
type="primary" </el-card>
size="small" <el-card
@click="handleUpdate(scope)" style="margin-top: 10px"
>编辑</el-button >
> <el-row>
<el-button <el-col :span="24">
v-if="scope.row.state == '待上报' && checkPermission(['record_up'])" <el-tabs v-model="activeName" @tab-click="handleClick">
type="primary" <el-tab-pane label="待上报" name="first" lazy>
size="small" </el-tab-pane>
@click="handleUp(scope)" <el-tab-pane label="已上报" name="second" lazy>
>上报</el-button </el-tab-pane>
> <el-tab-pane label="待整改" name="third" lazy>
<el-button </el-tab-pane>
v-if=" <el-tab-pane label="已确认" name="forth" lazy>
scope.row.state == '已提交' && checkPermission(['record_confirm']) </el-tab-pane>
"
type="primary"
size="small"
@click="handleConfirm(scope)" </el-tabs>
>确认</el-button
> </el-col>
<el-button
v-if="scope.state == '已提交' && checkPermission(['record_reject'])" </el-row>
type="danger" <el-table
size="small" v-loading="listLoading"
@click="handleReject(scope)" :data="recordList"
>驳回</el-button border
> fit
<el-button stripe
v-if="checkPermission(['record_view'])" highlight-current-row
size="small" max-height="600px"
@click="handleView(scope)" >
>查看</el-button <el-table-column label="序号" type="index" align="center" />
> <el-table-column label="任务标题">
</template> <template slot-scope="scope" v-if="scope.row.task">{{
</el-table-column> scope.row.task_.name
</el-table> }}</template>
<el-dialog </el-table-column>
<el-table-column label="材料">
<template slot-scope="scope">{{
scope.row.content_.name
}}</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">{{
scope.row.state
}}</template>
</el-table-column>
<el-table-column label="上报情况">
<template slot-scope="scope"
v-if="scope.row.up_user_">{{ scope.row.up_user_.name }}/{{ scope.row.up_date }}</template
>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
v-if="scope.row.state == '待上报' && checkPermission(['record_update'])"
type="primary"
size="small"
@click="handleUpdate(scope)"
>编辑</el-button
>
<el-button
v-if="scope.row.state == '待上报' && checkPermission(['record_up'])"
type="primary"
size="small"
@click="handleUp(scope)"
>上报</el-button
>
<el-button
v-if="scope.row.state == '已提交' && checkPermission(['record_confirm'])"
type="primary"
size="small"
@click="handleConfirm(scope)"
>确认</el-button
>
<el-button
v-if="scope.state == '已提交' && checkPermission(['record_reject'])"
type="danger"
size="small"
@click="handleReject(scope)"
>驳回</el-button
>
<el-button
v-if="checkPermission(['record_view'])"
size="small"
@click="handleView(scope)"
>查看</el-button
>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
title="主动上报" title="主动上报"
:close-on-click-modal="false" :close-on-click-modal="false"
@ -92,7 +136,9 @@
</div> </div>
</template> </template>
<script> <script>
import { getRecordList } from "@/api/record"; import { getRecordList,createself } from "@/api/record";
import { getContentList } from "@/api/content";
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
import taskinit from "@/views/supervision/taskinit"; import taskinit from "@/views/supervision/taskinit";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
@ -101,8 +147,13 @@ export default {
components: { Pagination, taskinit, recorddo }, components: { Pagination, taskinit, recorddo },
data() { data() {
return { return {
centerDialogVisible: false,
dialogVisible: false, dialogVisible: false,
activeName: "first", activeName: "first",
state:"待上报",
can_doself:true,
contents: [],
contentOptions: [],
contents: [], contents: [],
depts: [], depts: [],
listLoading: false, listLoading: false,
@ -112,22 +163,60 @@ export default {
}; };
}, },
created() { created() {
this.getContentList();
this.getRecordList(); this.getRecordList();
}, },
methods: { methods: {
checkPermission, checkPermission,
getRecordList() { getRecordList(){
getRecordList().then((res) => {
getRecordList({state:this.state}).then((res) => {
this.listLoading = false; this.listLoading = false;
this.recordList = res.data.results; this.recordList = res.data.results;
}); });
}, },
getContentList() {
getContentList({can_doself:this.can_doself}).then(res=>{
this.contentOptions = res.data
})
},
handleClick(tab, event) {
switch (tab.name) {
case "first":
this.state="待上报";
this.getRecordList();
break;
case "second":
this.state="已上报";
this.getRecordList();
break;
case "third":
this.state="待整改";
this.getRecordList();
break;
case "forth":
this.state="已确认";
this.getRecordList();
break;
}
},
handleUpdate(scope) { handleUpdate(scope) {
this.data = { this.data = {
action: "update", action: "update",
record: scope.row, record: scope.row,
}; };
this.drawer = true; this.drawer = true;
},
chooseComplete(data) {
this.dialogVisible = false;
const rLoading = this.openLoading("正在初始化任务,请稍等...");
inittask(this.task.id, data).then((res) => {
rLoading.close();
this.$message.success("成功");
this.$router.go(0);
});
}, },
handleUp(scope) { handleUp(scope) {
this.data = { this.data = {
@ -161,6 +250,19 @@ export default {
}; };
this.drawer = true; this.drawer = true;
}, },
contentup(){
console.log(this.contents)
if(this.contents.length>0){
createself({contents:this.contents}
).then((res) => {
alert(1)
});
}else{
this.$message.error('请选择清单!')
}
},
}, },
}; };
</script> </script>

View File

@ -29,7 +29,7 @@ class ContentViewSet(CreateUpdateCustomMixin, ModelViewSet):
serializer_class = ContentSerializer serializer_class = ContentSerializer
pagination_class = None pagination_class = None
search_fields = ['name', 'desc'] search_fields = ['name', 'desc']
filterset_fields = ['type'] filterset_fields = ['type','can_doself']
ordering = ['type__sort', 'create_time'] ordering = ['type__sort', 'create_time']
class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet): class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
@ -125,7 +125,7 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
instance.save() instance.save()
return Response(status=status.HTTP_200_OK) return Response(status=status.HTTP_200_OK)
@action(methods=['post'], detail=True, perms_map = {'post':'record_up'}) @action(methods=['post'], detail=False, perms_map = {'post':'record_creates'})
def createself(self, request, *args, **kwargs): def createself(self, request, *args, **kwargs):
contents = request.data['contents'] contents = request.data['contents']
rlist = [] rlist = []