任务执行

This commit is contained in:
shilixia 2021-04-16 17:10:33 +08:00
parent 00e8856710
commit 9c2e20badc
2 changed files with 125 additions and 41 deletions

View File

@ -22,6 +22,21 @@ export function getsubinspecttask(id) {
method: 'get'
})
}
export function updateinspectrecord(id,data) {
return request({
url: `/quality/inspectrecord/${id}/check/`,
method: 'put',
data
})
}
export function getinspectrecord(id) {
return request({
url: `/quality/inspectrecord/${id}/`,
method: 'get'
})
}
export function starttask(id) {
return request({
url: `/quality/inspecttask/${id}/start/`,

View File

@ -4,7 +4,7 @@
<el-table
:data="recordList"
max-height="300"
fit
stripe
highlight-current-row
@ -36,7 +36,6 @@
<el-table
:data="inspectitemList"
max-height="300"
fit
stripe
highlight-current-row
@ -92,17 +91,27 @@
label="检查状态"
width="150">
<template slot-scope="scope" >
<span v-if="scope.row.checked">已检查</span>
<span v-else>未检查</span>
<span v-if="scope.row.checked" style="color:green">已检查</span>
<span v-else style="color:blue">未检查</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
@click="handleCheck(scope.row)">提交结果</el-button>
<el-button
v-if="
scope.row.checked == true
"
type="warning"
size="small"
@click="handcheckupdate(scope)"
>编辑</el-button
>
<el-button v-if="
scope.row.checked == false
"
@click="handleCheck(scope)">提交结果</el-button>
</template>
</el-table-column>
@ -118,27 +127,31 @@
>
<div class="demo-drawer__content">
<el-form :model="form">
<el-form-item label="检查结果" :label-width="formLabelWidth">
<el-select v-model="form.region" placeholder="请选择活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
<el-form-item label="取证要求" v-if="inspectrecord.item_" :label-width="formLabelWidth">
{{ inspectrecord.item_.require }}
</el-form-item>
<el-form-item label="巡查结果" :label-width="formLabelWidth">
<el-select v-model="form.result" placeholder="请选择巡查结果">
<el-option label="发现" value="发现"></el-option>
<el-option label="未发现" value="未发现"></el-option>
<el-option label="不适用" value="不适用"></el-option>
</el-select>
</el-form-item>
<el-form-item label="检查说明" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off"></el-input>
<el-input type="textarea" v-model="form.note" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="文件列表">
<el-form-item label="文件列表" :label-width="formLabelWidth">
<el-upload
:action="upUrl"
:before-upload="beforeUpload"
:on-success="handleUpSuccess"
:headers="upHeaders"
ref="upload"
multiple
accept="image/*,.ppt,.pdf,.doc,.docx,.xls,.xlsx"
>
<el-button size="small" type="primary">上传文件</el-button>
<span class="el-upload__tip">
可上传多个pdf,word,ppt,excel,图片文件,单文件大小不超过50M
</span>
</el-upload>
</el-form-item>
<div
@ -150,7 +163,6 @@
class="el-icon-delete"
@click="deleteFile(index)"
style="color: red"
v-if="data.action == 'up'"
></i>
<el-link :href="item.path" target="_blank" type="primary">{{
item.name
@ -167,17 +179,12 @@
</div>
</template>
<script>
import {getsubinspecttaskdep,getinspectrecordlist,addappoint} from "@/api/subinspecttask";
import {getsubinspecttaskdep,getinspectrecordlist,updateinspectrecord,getinspectrecord} from "@/api/subinspecttask";
import { upUrl, upHeaders } from "@/api/file";
import Pagination from "@/components/Pagination";
import checkPermission from "@/utils/permission";
const defaulttask = {
name: "",
leader:"",
members:"",
depts:"",
};
const mbersData = {
checker:""
}
@ -186,7 +193,6 @@ export default {
data() {
return {
inspecttask: defaulttask,
listLoading: true,
dialog:false,
recordList:[],
@ -195,13 +201,21 @@ export default {
leaders:[],
dialogType: "new",
listQuery:{},
inspectrecord:[],
require:"",
upHeaders: upHeaders(),
upUrl: upUrl(),
fileList: [],
table: false,
dialog: false,
loading: false,
recordid:null,
form: {
name: '',
id:null,
note: '',
result:'',
imgs:[],
},
formLabelWidth: '80px',
@ -246,28 +260,83 @@ export default {
this.listQuery = {pageoff:true, subtask: this.subtask, dept: row.dept }
this.getinspectrecordlist();
},
handcheckupdate(scope)
{
this.dialog=true;
getinspectrecord(scope.row.id).then((res) => {
this.form.note=res.data.note;
this.from.result=res.data.result;
this.form.imgs=res.data.imgs;
})
},
handleCheck(scope)
{
this.dialog=true;
this.recordid=scope.row.id
getinspectrecord(this.recordid).then((res) => {
this.inspectrecord = res.data;
})
},
handleUpSuccess(res, file, filelist) {
this.fileList.push({
id: res.data.id,
name: res.data.name,
path: res.data.path,
});
this.handleRemove(file);
},
handleRemove(file) {
// 实现删除文件
let fileList = this.$refs.upload.uploadFiles;
let index = fileList.findIndex((fileItem) => {
return fileItem.uid === file.uid;
});
fileList.splice(index, 1);
},
beforeUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 50;
if (!isLt2M) {
this.$message.error("单文件不能超过50MB!");
}
return isLt2M;
},
deleteFile(index) {
this.$confirm("确定删除该文件, 是否继续?", { type: "error" })
.then(() => {
this.fileList.splice(index, 1);
})
.catch((e) => {});
},
//提交结果
handleClose(done) {
if (this.loading) {
return;
}
this.$confirm('确定要提交表单吗?')
.then(_ => {
this.loading = true;
this.timer = setTimeout(() => {
done();
// 动画关闭需要一定的时间
setTimeout(() => {
this.loading = false;
}, 400);
}, 2000);
var files = [];
for (var i = 0; i < this.fileList.length; i++) {
files.push(this.fileList[i].id);
}
this.form.imgs = files;
this.form.id=this.recordid;
updateinspectrecord(this.recordid, this.form).then((res) => {
if (res.code >= 200) {
this.getinspectrecordlist();
this.getsubinspecttaskdep()
this.dialog = false;
this.$message.success("成功");
}
});
})
.catch(_ => {});
},