supervision 基本完成
This commit is contained in:
parent
66f68e5a34
commit
53ad1ae23f
|
@ -56,3 +56,9 @@ export function rejectRecord(id, data) {
|
|||
data
|
||||
})
|
||||
}
|
||||
export function deleteRecord(id) {
|
||||
return request({
|
||||
url: `/supervision/record/${id}/`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
|
|
@ -62,3 +62,10 @@ export function gettaskdepts(id) {
|
|||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function starttask(id) {
|
||||
return request({
|
||||
url: `/supervision/task/${id}/start/`,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
|
@ -23,7 +23,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
title: '国检集团检验检测能力共享平台',
|
||||
title: '检验检测能力共享和质量管理平台',
|
||||
// logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png'
|
||||
logo:'http://testsearch.ctc.ac.cn:8000/media/default/avatar.png'
|
||||
}
|
||||
|
|
|
@ -64,7 +64,13 @@ div:focus {
|
|||
.app-container {
|
||||
padding: 6px;
|
||||
}
|
||||
body .el-table th.gutter{
|
||||
display: table-cell!important;
|
||||
}
|
||||
|
||||
body .el-table colgroup.gutter{
|
||||
display: table-cell!important;
|
||||
}
|
||||
.el-table--medium td, .el-table--medium th {
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,10 @@
|
|||
<template>
|
||||
|
||||
<div class="login">
|
||||
|
||||
|
||||
|
||||
<div class="login-form">
|
||||
|
||||
<img class="logo" src="../../assets/logo.png">
|
||||
<img class="logo" src="../../assets/logo.png" />
|
||||
|
||||
<h3 class="title">检验检测能力共享和质量管理平台</h3>
|
||||
<el-tabs v-model="activeName" :stretch="true">
|
||||
|
||||
|
||||
<el-tab-pane label="验证码登录" name="msg">
|
||||
<el-form
|
||||
ref="loginForm2"
|
||||
|
@ -20,7 +13,6 @@
|
|||
auto-complete="on"
|
||||
label-position="left"
|
||||
>
|
||||
|
||||
<el-form-item prop="mail">
|
||||
<el-input
|
||||
ref="mail"
|
||||
|
@ -30,11 +22,15 @@
|
|||
type="text"
|
||||
tabindex="1"
|
||||
auto-complete="on"
|
||||
> <svg-icon slot="prefix" icon-class="email" class="el-input__icon input-icon" /></el-input>
|
||||
>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="email"
|
||||
class="el-input__icon input-icon"
|
||||
/></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="msg">
|
||||
|
||||
<el-input
|
||||
ref="msg"
|
||||
v-model="loginForm2.msg"
|
||||
|
@ -44,24 +40,26 @@
|
|||
tabindex="2"
|
||||
auto-complete="on"
|
||||
@keyup.enter.native="handleLogin"
|
||||
> <svg-icon slot="prefix" icon-class="message" class="el-input__icon input-icon" /></el-input>
|
||||
>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="message"
|
||||
class="el-input__icon input-icon"
|
||||
/></el-input>
|
||||
<span class="show-pwd" @click="sendMsg" style="color: black">
|
||||
|
||||
<template>{{ buttonmsg }}</template>
|
||||
|
||||
<!-- <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" /> -->
|
||||
</span>
|
||||
|
||||
</el-form-item>
|
||||
<el-button
|
||||
:loading="loading2"
|
||||
type="primary"
|
||||
style="width:100%;margin-bottom:30px;"
|
||||
style="width: 100%; margin-bottom: 30px"
|
||||
@click.native.prevent="handleLogin2"
|
||||
>验证登录</el-button>
|
||||
>验证登录</el-button
|
||||
>
|
||||
</el-form>
|
||||
|
||||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="密码登录" name="pwd">
|
||||
<el-form
|
||||
|
@ -72,7 +70,6 @@
|
|||
label-position="left"
|
||||
>
|
||||
<el-form-item prop="username">
|
||||
|
||||
<el-input
|
||||
ref="username"
|
||||
v-model="loginForm.username"
|
||||
|
@ -81,11 +78,14 @@
|
|||
type="text"
|
||||
tabindex="1"
|
||||
auto-complete="on"
|
||||
><svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /></el-input>
|
||||
><svg-icon
|
||||
slot="prefix"
|
||||
icon-class="user"
|
||||
class="el-input__icon input-icon"
|
||||
/></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="password">
|
||||
|
||||
<el-input
|
||||
:key="passwordType"
|
||||
ref="password"
|
||||
|
@ -96,17 +96,24 @@
|
|||
tabindex="2"
|
||||
auto-complete="on"
|
||||
@keyup.enter.native="handleLogin"
|
||||
><svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /></el-input>
|
||||
><svg-icon
|
||||
slot="prefix"
|
||||
icon-class="password"
|
||||
class="el-input__icon input-icon"
|
||||
/></el-input>
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||
<svg-icon
|
||||
:icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
|
||||
/>
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-button
|
||||
:loading="loading"
|
||||
type="primary"
|
||||
style="width:100%;margin-bottom:30px;"
|
||||
style="width: 100%; margin-bottom: 30px"
|
||||
@click.native.prevent="handleLogin"
|
||||
>登录</el-button>
|
||||
>登录</el-button
|
||||
>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
@ -116,8 +123,8 @@
|
|||
|
||||
<script>
|
||||
// import { validUsername } from '@/utils/validate'
|
||||
import { sendMsg } from '@/api/msg'
|
||||
import { login2 } from "@/api/user"
|
||||
import { sendMsg } from "@/api/msg";
|
||||
import { login2 } from "@/api/user";
|
||||
export default {
|
||||
name: "Login",
|
||||
data() {
|
||||
|
@ -138,7 +145,7 @@ export default {
|
|||
return {
|
||||
timer: null,
|
||||
disabled: false,
|
||||
buttonmsg:'发送验证码',
|
||||
buttonmsg: "发送验证码",
|
||||
count: 60,
|
||||
activeName: "msg",
|
||||
loginForm: {
|
||||
|
@ -177,7 +184,7 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
this.getUP()
|
||||
this.getUP();
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
|
@ -199,19 +206,20 @@ export default {
|
|||
});
|
||||
},
|
||||
sendMsg() {
|
||||
if(this.loginForm2.mail.length&&this.buttonmsg=='发送验证码'){
|
||||
this.getTimer()
|
||||
sendMsg({'mail':this.loginForm2.mail}).then(res=>{
|
||||
this.$message.success('验证码已发送至该邮箱,请注意查收')
|
||||
|
||||
}).catch(e=>{
|
||||
if (this.loginForm2.mail.length && this.buttonmsg == "发送验证码") {
|
||||
this.getTimer();
|
||||
sendMsg({ mail: this.loginForm2.mail })
|
||||
.then((res) => {
|
||||
this.$message.success("验证码已发送至该邮箱,请注意查收");
|
||||
})
|
||||
.catch((e) => {
|
||||
this.disabled = false;
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
this.buttonmsg = '发送验证码'
|
||||
})
|
||||
this.buttonmsg = "发送验证码";
|
||||
});
|
||||
} else {
|
||||
this.$message.warning('请输入邮箱号')
|
||||
this.$message.warning("请输入邮箱号");
|
||||
}
|
||||
},
|
||||
getTimer() {
|
||||
|
@ -222,14 +230,14 @@ export default {
|
|||
this.timer = setInterval(() => {
|
||||
if (this.count > 0 && this.count <= TIME_COUNT) {
|
||||
this.count--;
|
||||
this.buttonmsg = this.count + '秒'
|
||||
this.buttonmsg = this.count + "秒";
|
||||
} else {
|
||||
this.disabled = false;
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
this.buttonmsg = '发送验证码'
|
||||
this.buttonmsg = "发送验证码";
|
||||
}
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
handleLogin() {
|
||||
|
@ -275,7 +283,7 @@ export default {
|
|||
},
|
||||
//读取cookie
|
||||
getUP() {
|
||||
this.loginForm2.mail = localStorage.getItem("rem_mail")
|
||||
this.loginForm2.mail = localStorage.getItem("rem_mail");
|
||||
this.loginForm.username = localStorage.getItem("rem_username");
|
||||
this.loginForm.password = localStorage.getItem("rem_password");
|
||||
},
|
||||
|
@ -318,7 +326,6 @@ export default {
|
|||
width: 14px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.show-pwd {
|
||||
|
|
|
@ -125,21 +125,18 @@
|
|||
</el-tag>
|
||||
</template>
|
||||
</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.up_date }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上报人">
|
||||
<template slot-scope="scope" v-if="scope.row.up_user">{{
|
||||
scope.row.up_user_.name
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="截止时间">
|
||||
<el-table-column label="任务截止时间">
|
||||
<template slot-scope="scope">{{ scope.row.end_date }}</template>
|
||||
</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" v-if="scope.row.up_user_"
|
||||
>{{ scope.row.up_user_.name }}/{{ scope.row.up_date }}</template
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="上报备注">
|
||||
<template slot-scope="scope">{{ scope.row.note }}</template>
|
||||
</el-table-column>
|
||||
|
@ -157,7 +154,7 @@
|
|||
<el-tag type="danger" v-if="scope.row.state == '待上报'">{{
|
||||
scope.row.state
|
||||
}}</el-tag>
|
||||
<el-tag type="warning" v-else-if="scope.row.state == '待整改'">{{
|
||||
<el-tag type="warning" v-else-if="scope.row.state == '待整改' || scope.row.state == '待发布'">{{
|
||||
scope.row.state
|
||||
}}</el-tag>
|
||||
<el-tag type="success" v-else-if="scope.row.state == '已确认'">{{
|
||||
|
@ -191,17 +188,17 @@
|
|||
fixed="right"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '待上报' &&
|
||||
(scope.row.state == '待上报'||scope.row.state=='待发布' )&&
|
||||
checkPermission(['record_update'])
|
||||
"
|
||||
type="primary"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="handleRecord({ action: 'update', record: scope.row })"
|
||||
>编辑</el-button
|
||||
>编辑</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
(scope.row.state == '待上报' || scope.row.state == '待整改') &&
|
||||
checkPermission(['record_up'])
|
||||
|
@ -209,19 +206,19 @@
|
|||
type="primary"
|
||||
size="small"
|
||||
@click="handleRecord({ action: 'up', record: scope.row })"
|
||||
>上报</el-button
|
||||
>上报</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '已上报' &&
|
||||
checkPermission(['record_confirm'])
|
||||
"
|
||||
type="primary"
|
||||
type="success"
|
||||
size="small"
|
||||
@click="handleRecord({ action: 'confirm', record: scope.row })"
|
||||
>确认</el-button
|
||||
>确认</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '已上报' &&
|
||||
checkPermission(['record_reject'])
|
||||
|
@ -229,13 +226,22 @@
|
|||
type="danger"
|
||||
size="small"
|
||||
@click="handleRecord({ action: 'reject', record: scope.row })"
|
||||
>驳回</el-button
|
||||
>驳回</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="checkPermission(['record_view'])"
|
||||
size="small"
|
||||
@click="handleRecord({ action: 'view', record: scope.row })"
|
||||
>查看</el-button
|
||||
>查看</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="checkPermission(['record_delete'])"
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="
|
||||
handleRecord({ action: 'delete', record: scope.row })
|
||||
"
|
||||
>删除</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
|
@ -81,11 +81,17 @@
|
|||
<el-divider></el-divider>
|
||||
<div style="text-align: right">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="confirm()"
|
||||
type="danger"
|
||||
v-if="this.data.action == 'reject'"
|
||||
>驳回</el-button
|
||||
>
|
||||
<el-button
|
||||
type="danger"
|
||||
@click="confirm()"
|
||||
v-else-if="this.data.action == 'delete'"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button type="primary" @click="confirm()" v-else>确认</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -117,6 +123,7 @@ import {
|
|||
upRecord,
|
||||
rejectRecord,
|
||||
confirmRecord,
|
||||
deleteRecord
|
||||
} from "@/api/record";
|
||||
export default {
|
||||
name: "recorddo",
|
||||
|
@ -205,7 +212,20 @@ export default {
|
|||
});
|
||||
} else if (this.data.action == "view") {
|
||||
this.$emit("handleDo");
|
||||
} else if (this.data.action == "delete") {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteRecord(this.record.id);
|
||||
this.$message.success("成功");
|
||||
this.$emit("handleDo");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.state=='创建中'" type="warning">{{scope.row.state}}</el-tag>
|
||||
<el-tag v-if="scope.row.state=='创建中'||scope.row.state=='待发布'" type="warning">{{scope.row.state}}</el-tag>
|
||||
<el-tag v-else-if="scope.row.state=='执行中'" type="primary">{{scope.row.state}}</el-tag>
|
||||
<el-tag v-else type="success">{{scope.row.state}}</el-tag>
|
||||
</template>
|
||||
|
|
|
@ -66,6 +66,13 @@
|
|||
size="small"
|
||||
>初始化任务</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="starttask()"
|
||||
v-if="task.state == '待发布'"
|
||||
size="small"
|
||||
>发布任务</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
@ -127,7 +134,7 @@
|
|||
>
|
||||
<el-tag
|
||||
type="warning"
|
||||
v-else-if="scope.row.state == '待整改'"
|
||||
v-else-if="scope.row.state == '待整改' || scope.row.state == '待发布'"
|
||||
>{{ scope.row.state }}</el-tag
|
||||
>
|
||||
<el-tag
|
||||
|
@ -146,6 +153,9 @@
|
|||
scope.row.up_date
|
||||
}}</template
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="上报备注">
|
||||
<template slot-scope="scope">{{ scope.row.note }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="文件">
|
||||
<template slot-scope="scope" v-if="scope.row.files">
|
||||
|
@ -177,23 +187,23 @@
|
|||
<el-table-column
|
||||
align="center"
|
||||
label="操作"
|
||||
width="220px"
|
||||
width="240px"
|
||||
fixed="right"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '待上报' &&
|
||||
(scope.row.state == '待上报'||scope.row.state=='待发布' )&&
|
||||
checkPermission(['record_update'])
|
||||
"
|
||||
type="primary"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="
|
||||
handleRecord({ action: 'update', record: scope.row })
|
||||
"
|
||||
>编辑</el-button
|
||||
>编辑</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
(scope.row.state == '待上报' ||
|
||||
scope.row.state == '待整改') &&
|
||||
|
@ -204,21 +214,21 @@
|
|||
@click="
|
||||
handleRecord({ action: 'up', record: scope.row })
|
||||
"
|
||||
>上报</el-button
|
||||
>上报</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '已上报' &&
|
||||
checkPermission(['record_confirm'])
|
||||
"
|
||||
type="primary"
|
||||
type="success"
|
||||
size="small"
|
||||
@click="
|
||||
handleRecord({ action: 'confirm', record: scope.row })
|
||||
"
|
||||
>确认</el-button
|
||||
>确认</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '已上报' &&
|
||||
checkPermission(['record_reject'])
|
||||
|
@ -228,15 +238,24 @@
|
|||
@click="
|
||||
handleRecord({ action: 'reject', record: scope.row })
|
||||
"
|
||||
>驳回</el-button
|
||||
>驳回</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="checkPermission(['record_view'])"
|
||||
size="small"
|
||||
@click="
|
||||
handleRecord({ action: 'view', record: scope.row })
|
||||
"
|
||||
>查看</el-button
|
||||
>查看</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="checkPermission(['record_delete'])"
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="
|
||||
handleRecord({ action: 'delete', record: scope.row })
|
||||
"
|
||||
>删除</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -297,7 +316,7 @@
|
|||
>
|
||||
<el-tag
|
||||
type="warning"
|
||||
v-else-if="scope.row.state == '待整改'"
|
||||
v-else-if="scope.row.state == '待整改' || scope.row.state == '待发布'"
|
||||
>{{ scope.row.state }}</el-tag
|
||||
>
|
||||
<el-tag
|
||||
|
@ -314,30 +333,57 @@
|
|||
<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 label="上报备注">
|
||||
<template slot-scope="scope">{{ scope.row.note }}</template>
|
||||
</el-table-column>
|
||||
<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
|
||||
align="center"
|
||||
label="操作"
|
||||
width="220px"
|
||||
width="240px"
|
||||
fixed="right"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '待上报' &&
|
||||
(scope.row.state == '待上报'||scope.row.state=='待发布' )&&
|
||||
checkPermission(['record_update'])
|
||||
"
|
||||
type="primary"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="
|
||||
handleRecord({ action: 'update', record: scope.row })
|
||||
"
|
||||
>编辑</el-button
|
||||
>编辑</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
(scope.row.state == '待上报' ||
|
||||
scope.row.state == '待整改') &&
|
||||
|
@ -348,21 +394,21 @@
|
|||
@click="
|
||||
handleRecord({ action: 'up', record: scope.row })
|
||||
"
|
||||
>上报</el-button
|
||||
>上报</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '已上报' &&
|
||||
checkPermission(['record_confirm'])
|
||||
"
|
||||
type="primary"
|
||||
type="success"
|
||||
size="small"
|
||||
@click="
|
||||
handleRecord({ action: 'confirm', record: scope.row })
|
||||
"
|
||||
>确认</el-button
|
||||
>确认</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="
|
||||
scope.row.state == '已上报' &&
|
||||
checkPermission(['record_reject'])
|
||||
|
@ -372,15 +418,24 @@
|
|||
@click="
|
||||
handleRecord({ action: 'reject', record: scope.row })
|
||||
"
|
||||
>驳回</el-button
|
||||
>驳回</el-link
|
||||
>
|
||||
<el-button
|
||||
<el-link
|
||||
v-if="checkPermission(['record_view'])"
|
||||
size="small"
|
||||
@click="
|
||||
handleRecord({ action: 'view', record: scope.row })
|
||||
"
|
||||
>查看</el-button
|
||||
>查看</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="checkPermission(['record_delete'])"
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="
|
||||
handleRecord({ action: 'delete', record: scope.row })
|
||||
"
|
||||
>删除</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -433,7 +488,7 @@
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
import { gettask, inittask, gettaskcontents, gettaskdepts } from "@/api/task";
|
||||
import { gettask, inittask, gettaskcontents, gettaskdepts, starttask } from "@/api/task";
|
||||
import { getRecordList } from "@/api/record";
|
||||
import Pagination from "@/components/Pagination";
|
||||
import taskinit from "@/views/supervision/taskinit";
|
||||
|
@ -503,6 +558,18 @@ export default {
|
|||
});
|
||||
});
|
||||
},
|
||||
starttask(){
|
||||
this.$confirm("确认发布任务吗?", "提示")
|
||||
.then(async () => {
|
||||
await starttask(this.task.id);
|
||||
this.$message.success("成功");
|
||||
location.reload();
|
||||
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
gettaskdepts() {
|
||||
gettaskdepts(this.task.id).then((res) => {
|
||||
this.depts = res.data;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.0.5 on 2021-03-23 06:25
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('supervision', '0009_auto_20210317_0922'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='record',
|
||||
name='state',
|
||||
field=models.CharField(choices=[('待发布', '待发布'), ('待上报', '待上报'), ('已上报', '已上报'), ('已确认', '已确认'), ('待整改', '待整改')], default='待上报', max_length=50, verbose_name='记录状态'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='task',
|
||||
name='state',
|
||||
field=models.CharField(choices=[('创建中', '创建中'), ('待发布', '待发布'), ('执行中', '执行中'), ('已完成', '已完成')], default='创建中', max_length=50, verbose_name='任务状态'),
|
||||
),
|
||||
]
|
|
@ -23,6 +23,7 @@ class Task(CommonBModel):
|
|||
"""
|
||||
state_choices = (
|
||||
('创建中', '创建中'),
|
||||
('待发布', '待发布'),
|
||||
('执行中', '执行中'),
|
||||
('已完成', '已完成'),
|
||||
)
|
||||
|
@ -44,6 +45,7 @@ class Record(CommonBModel):
|
|||
上报记录
|
||||
"""
|
||||
state_choices = (
|
||||
('待发布', '待发布'),
|
||||
('待上报', '待上报'),
|
||||
('已上报', '已上报'),
|
||||
('已确认', '已确认'),
|
||||
|
|
|
@ -17,6 +17,7 @@ from .filters import RecordFilter
|
|||
from django.db.models.query import QuerySet
|
||||
from django.core.cache import cache
|
||||
from apps.system.permission import get_permission_list, has_permission
|
||||
from django.db.models import Q
|
||||
# Create your views here.
|
||||
|
||||
class ContentViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||
|
@ -70,9 +71,10 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
|||
data['task'] = obj
|
||||
data['end_date'] = obj.end_date
|
||||
data['create_by'] = request.user
|
||||
data['state'] = '待发布'
|
||||
record_list.append(Record(**data))
|
||||
Record.objects.bulk_create(record_list)
|
||||
obj.state = '执行中'
|
||||
obj.state = '待发布'
|
||||
obj.save()
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
return Response('单位或清单不能为空', status=status.HTTP_400_BAD_REQUEST)
|
||||
|
@ -95,6 +97,19 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
|||
serializer = OrganizationSimpleSerializer(obj.depts.distinct(), many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
@action(methods=['put'], detail=True, perms_map = {'put':'task_start'})
|
||||
def start(self, request, *args, **kwargs):
|
||||
"""
|
||||
发布任务
|
||||
"""
|
||||
obj = self.get_object()
|
||||
if obj.state == '待发布':
|
||||
obj.state = '执行中'
|
||||
obj.save()
|
||||
Record.objects.filter(task=obj).update(state='待上报')
|
||||
return Response(status=status.HTTP_200_OK)
|
||||
return Response('任务状态错误', status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def cal_task_rate(task):
|
||||
"""
|
||||
计算任务上报率, 确认率
|
||||
|
|
Loading…
Reference in New Issue