任务执行

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' 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) { export function starttask(id) {
return request({ return request({
url: `/quality/inspecttask/${id}/start/`, url: `/quality/inspecttask/${id}/start/`,

View File

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