界面调整

This commit is contained in:
caoqianming 2021-03-18 21:23:11 +08:00
parent cc340095db
commit 13303b884b
3 changed files with 208 additions and 66 deletions

View File

@ -121,8 +121,48 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作"> <el-table-column align="center" label="操作" width="220px" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
v-if="
scope.row.state == '待上报' &&
checkPermission(['record_update'])
"
type="primary"
size="small"
@click="handleRecord({action:'update', record:scope.row})"
>编辑</el-button
>
<el-button
v-if="
(scope.row.state == '待上报' || scope.row.state == '待整改')&&
checkPermission(['record_up'])
"
type="primary"
size="small"
@click="handleRecord({action:'up', record:scope.row})"
>上报</el-button
>
<el-button
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_confirm'])
"
type="primary"
size="small"
@click="handleRecord({action:'confirm', record:scope.row})"
>确认</el-button
>
<el-button
v-if="
scope.row.state == '已上报' &&
checkPermission(['record_reject'])
"
type="danger"
size="small"
@click="handleRecord({action:'reject', record:scope.row})"
>驳回</el-button
>
<el-button <el-button
v-if="checkPermission(['record_view'])" v-if="checkPermission(['record_view'])"
size="small" size="small"
@ -130,7 +170,7 @@
>查看</el-button >查看</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="recordList.count > 0" v-show="recordList.count > 0"

View File

@ -33,16 +33,22 @@
<div style="margin-bottom: 6px"> <div style="margin-bottom: 6px">
<span class="term">任务状态</span> <span class="term">任务状态</span>
<span class="desc"> <span class="desc">
<el-tag v-if="task.state=='创建中'" type="warning">{{task.state}}</el-tag> <el-tag v-if="task.state == '创建中'" type="warning">{{
<el-tag v-else-if="task.state=='执行中'" type="primary">{{task.state}}</el-tag> task.state
<el-tag v-else type="success">{{task.state}}</el-tag> }}</el-tag>
<el-tag v-else-if="task.state == '执行中'" type="primary">{{
task.state
}}</el-tag>
<el-tag v-else type="success">{{ task.state }}</el-tag>
</span> </span>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<div style="margin-bottom: 6px"> <div style="margin-bottom: 6px">
<span class="term">上报/确认率</span> <span class="term">上报/确认率</span>
<span class="desc"> {{ task.up_rate }}% -- {{task.confirm_rate}}%</span> <span class="desc">
{{ task.up_rate }}% -- {{ task.confirm_rate }}%</span
>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -81,7 +87,9 @@
v-bind:key="item.id" v-bind:key="item.id"
@click="chosecontent(item)" @click="chosecontent(item)"
> >
<el-link type="primary">{{index+1}}-{{ item.name }}</el-link> <el-link type="primary"
>{{ index + 1 }}-{{ item.name }}</el-link
>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
@ -90,10 +98,10 @@
shadow="never" shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto" style="height: 600px; overflow-y: auto; overflow-x: auto"
> >
<div style="margin-bottom:6px"> <div style="margin-bottom: 6px">
当前选择 当前选择
<span style="color:red">{{nowcontent.name}}</span> <span style="color: red">{{ nowcontent.name }}</span>
</div> </div>
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="recordList1" :data="recordList1"
@ -110,20 +118,67 @@
}}</template> }}</template>
</el-table-column> </el-table-column>
<el-table-column label="状态"> <el-table-column label="状态">
<template slot-scope="scope"><el-tag type="danger" v-if="scope.row.state == '待上报'">{{ scope.row.state }}</el-tag> <template slot-scope="scope"
<el-tag type="warning" v-else-if="scope.row.state == '待整改'">{{ scope.row.state }}</el-tag> ><el-tag
<el-tag type="success" v-else-if="scope.row.state == '已确认'">{{ scope.row.state }}</el-tag> type="danger"
<el-tag v-else-if="scope.row.state == '已上报'">{{ scope.row.state }}</el-tag></template> v-if="scope.row.state == '待上报'"
>{{ scope.row.state }}</el-tag
>
<el-tag
type="warning"
v-else-if="scope.row.state == '待整改'"
>{{ scope.row.state }}</el-tag
>
<el-tag
type="success"
v-else-if="scope.row.state == '已确认'"
>{{ scope.row.state }}</el-tag
>
<el-tag v-else-if="scope.row.state == '已上报'">{{
scope.row.state
}}</el-tag></template
>
</el-table-column> </el-table-column>
<el-table-column label="上报情况"> <el-table-column label="上报情况">
<template slot-scope="scope" <template slot-scope="scope" v-if="scope.row.up_user_"
v-if="scope.row.up_user_">{{ scope.row.up_user_.name }}/{{ scope.row.up_date }}</template >{{ scope.row.up_user_.name }}/{{
scope.row.up_date
}}</template
> >
</el-table-column> </el-table-column>
<el-table-column label="文件"> <el-table-column label="文件">
<template slot-scope="scope"> </template> <template slot-scope="scope" v-if="scope.row.files">
<el-link
v-if="scope.row.files.length > 1"
@click="
handleRecord({ action: 'view', record: scope.row })
"
>
<span style="color: red">{{
scope.row.files.length
}}</span>
个文件</el-link
>
<div
v-else
v-for="item in scope.row.files_"
v-bind:key="item.id"
>
<el-link
:href="item.path"
target="_blank"
type="primary"
>{{ item.name }}</el-link
>
</div>
</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="220px" fixed="right"> <el-table-column
align="center"
label="操作"
width="220px"
fixed="right"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-if=" v-if="
@ -132,17 +187,22 @@
" "
type="primary" type="primary"
size="small" size="small"
@click="handleRecord({action:'update', record:scope.row})" @click="
handleRecord({ action: 'update', record: scope.row })
"
>编辑</el-button >编辑</el-button
> >
<el-button <el-button
v-if=" v-if="
(scope.row.state == '待上报' || scope.row.state == '待整改')&& (scope.row.state == '待上报' ||
scope.row.state == '待整改') &&
checkPermission(['record_up']) checkPermission(['record_up'])
" "
type="primary" type="primary"
size="small" size="small"
@click="handleRecord({action:'up', record:scope.row})" @click="
handleRecord({ action: 'up', record: scope.row })
"
>上报</el-button >上报</el-button
> >
<el-button <el-button
@ -152,7 +212,9 @@
" "
type="primary" type="primary"
size="small" size="small"
@click="handleRecord({action:'confirm', record:scope.row})" @click="
handleRecord({ action: 'confirm', record: scope.row })
"
>确认</el-button >确认</el-button
> >
<el-button <el-button
@ -162,13 +224,17 @@
" "
type="danger" type="danger"
size="small" size="small"
@click="handleRecord({action:'reject', record:scope.row})" @click="
handleRecord({ action: 'reject', record: scope.row })
"
>驳回</el-button >驳回</el-button
> >
<el-button <el-button
v-if="checkPermission(['record_view'])" v-if="checkPermission(['record_view'])"
size="small" size="small"
@click="handleRecord({action:'view', record:scope.row})" @click="
handleRecord({ action: 'view', record: scope.row })
"
>查看</el-button >查看</el-button
> >
</template> </template>
@ -190,7 +256,9 @@
v-bind:key="item.id" v-bind:key="item.id"
@click="chosedept(item)" @click="chosedept(item)"
> >
<el-link type="primary">{{index+1}}-{{ item.name }}</el-link> <el-link type="primary"
>{{ index + 1 }}-{{ item.name }}</el-link
>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
@ -199,10 +267,10 @@
shadow="never" shadow="never"
style="height: 600px; overflow-y: auto; overflow-x: auto" style="height: 600px; overflow-y: auto; overflow-x: auto"
> >
<div style="margin-bottom:6px"> <div style="margin-bottom: 6px">
当前选择 当前选择
<span style="color:red">{{nowdept.name}}</span> <span style="color: red">{{ nowdept.name }}</span>
</div> </div>
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="recordList2" :data="recordList2"
@ -220,23 +288,40 @@
</el-table-column> </el-table-column>
<el-table-column label="状态"> <el-table-column label="状态">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="danger" v-if="scope.row.state == '待上报'">{{ scope.row.state }}</el-tag> <el-tag
<el-tag type="warning" v-else-if="scope.row.state == '待整改'">{{ scope.row.state }}</el-tag> type="danger"
<el-tag type="success" v-else-if="scope.row.state == '已确认'">{{ scope.row.state }}</el-tag> v-if="scope.row.state == '待上报'"
<el-tag v-else-if="scope.row.state == '已上报'">{{ scope.row.state }}</el-tag> >{{ scope.row.state }}</el-tag
>
<el-tag
type="warning"
v-else-if="scope.row.state == '待整改'"
>{{ scope.row.state }}</el-tag
>
<el-tag
type="success"
v-else-if="scope.row.state == '已确认'"
>{{ scope.row.state }}</el-tag
>
<el-tag v-else-if="scope.row.state == '已上报'">{{
scope.row.state
}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上报情况"> <el-table-column label="上报情况">
<template slot-scope="scope" <template slot-scope="scope" v-if="scope.row.up_user_"
v-if="scope.row.up_user_">{{ scope.row.up_user }}/{{ scope.row.up_date }}</template >{{ scope.row.up_user }}/{{ scope.row.up_date }}</template
> >
</el-table-column> </el-table-column>
<el-table-column label="文件"> <el-table-column label="文件">
<template slot-scope="scope"> <template slot-scope="scope"> </template>
</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="220px" fixed="right"> <el-table-column
align="center"
label="操作"
width="220px"
fixed="right"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
v-if=" v-if="
@ -245,18 +330,22 @@
" "
type="primary" type="primary"
size="small" size="small"
@click="handleRecord({action:'update', record:scope.row})" @click="
handleRecord({ action: 'update', record: scope.row })
"
>编辑</el-button >编辑</el-button
> >
<el-button <el-button
v-if=" v-if="
(scope.row.state == '待上报' || scope.row.state == '待整改') (scope.row.state == '待上报' ||
&& scope.row.state == '待整改') &&
checkPermission(['record_up']) checkPermission(['record_up'])
" "
type="primary" type="primary"
size="small" size="small"
@click="handleRecord({action:'up', record:scope.row})" @click="
handleRecord({ action: 'up', record: scope.row })
"
>上报</el-button >上报</el-button
> >
<el-button <el-button
@ -266,7 +355,9 @@
" "
type="primary" type="primary"
size="small" size="small"
@click="handleRecord({action:'confirm', record:scope.row})" @click="
handleRecord({ action: 'confirm', record: scope.row })
"
>确认</el-button >确认</el-button
> >
<el-button <el-button
@ -276,13 +367,17 @@
" "
type="danger" type="danger"
size="small" size="small"
@click="handleRecord({action:'reject', record:scope.row})" @click="
handleRecord({ action: 'reject', record: scope.row })
"
>驳回</el-button >驳回</el-button
> >
<el-button <el-button
v-if="checkPermission(['record_view'])" v-if="checkPermission(['record_view'])"
size="small" size="small"
@click="handleRecord({action:'view', record:scope.row})" @click="
handleRecord({ action: 'view', record: scope.row })
"
>查看</el-button >查看</el-button
> >
</template> </template>
@ -302,7 +397,12 @@
> >
<taskinit ref="taskinit" @handleChose="chooseComplete"></taskinit> <taskinit ref="taskinit" @handleChose="chooseComplete"></taskinit>
</el-dialog> </el-dialog>
<el-drawer title="记录" :visible.sync="drawer" :with-header="false" size="40%"> <el-drawer
title="记录"
:visible.sync="drawer"
:with-header="false"
size="40%"
>
<recorddo <recorddo
ref="recorddo" ref="recorddo"
:data="data" :data="data"
@ -349,8 +449,8 @@ export default {
listLoading: false, listLoading: false,
recordList1: [], recordList1: [],
recordList2: [], recordList2: [],
nowcontent:{}, nowcontent: {},
nowdept:{}, nowdept: {},
drawer: false, drawer: false,
data: {}, data: {},
}; };
@ -387,7 +487,10 @@ export default {
gettaskcontents(this.task.id).then((res) => { gettaskcontents(this.task.id).then((res) => {
this.contents = res.data; this.contents = res.data;
this.listLoading = true; this.listLoading = true;
this.nowcontent = {id:this.contents[0].id, name:this.contents[0].name} this.nowcontent = {
id: this.contents[0].id,
name: this.contents[0].name,
};
getRecordList({ getRecordList({
pageoff: true, pageoff: true,
content: this.contents[0].id, content: this.contents[0].id,
@ -404,11 +507,11 @@ export default {
}); });
}, },
chosecontent(item) { chosecontent(item) {
this.nowcontent = item this.nowcontent = item;
var data = { var data = {
pageoff: true, pageoff: true,
task: this.task.id, task: this.task.id,
content:item.id content: item.id,
}; };
this.listLoading = true; this.listLoading = true;
getRecordList(data).then((res) => { getRecordList(data).then((res) => {
@ -417,11 +520,11 @@ export default {
}); });
}, },
chosedept(item) { chosedept(item) {
this.nowdept = item this.nowdept = item;
var data = { var data = {
pageoff: true, pageoff: true,
task: this.task.id, task: this.task.id,
belong_dept:item.id belong_dept: item.id,
}; };
this.listLoading = true; this.listLoading = true;
getRecordList(data).then((res) => { getRecordList(data).then((res) => {
@ -429,17 +532,17 @@ export default {
this.recordList2 = res.data; this.recordList2 = res.data;
}); });
}, },
handleRecord(data){ handleRecord(data) {
this.data = data; this.data = data;
this.drawer = true; this.drawer = true;
}, },
handleDo(data) { handleDo(data) {
this.drawer = false; this.drawer = false;
this.gettask() this.gettask();
if(this.activeName == 'contenttab'){ if (this.activeName == "contenttab") {
this.chosecontent(this.nowcontent) this.chosecontent(this.nowcontent);
}else if(this.activeName == 'depttab'){ } else if (this.activeName == "depttab") {
this.chosedept(this.nowdept) this.chosedept(this.nowdept);
} }
}, },
}, },

View File

@ -154,11 +154,10 @@ class RecordViewSet(RbacFilterSet, PageOrNot, CreateUpdateCustomMixin, ModelView
obj = self.get_object() obj = self.get_object()
if obj.state in ['待整改','待上报']: if obj.state in ['待整改','待上报']:
if 'files' in request.data and len(request.data['files'])==0: if 'files' in request.data and len(request.data['files'])==0:
if request.data.get('noteb', None): if request.data.get('noteb', None) and request.data.get('is_yes', True):
if request.data.get('is_yes', True): pass
return Response('请选择不适用', status=status.HTTP_400_BAD_REQUEST)
else: else:
return Response('请上传文件或填写备注', status=status.HTTP_400_BAD_REQUEST) return Response('请上传文件或选择不适用并填写上报说明', status=status.HTTP_400_BAD_REQUEST)
obj.is_yes = request.data.get('is_yes') obj.is_yes = request.data.get('is_yes')
obj.files.clear() obj.files.clear()
obj.files.add(*request.data['files']) obj.files.add(*request.data['files'])