Merge branch 'master' of https://e.coding.net/ctcdevteam/cma_search
This commit is contained in:
commit
b507f5028c
|
@ -8,22 +8,23 @@
|
||||||
<div class="ma">
|
<div class="ma">
|
||||||
<span class="term">上报状态</span>
|
<span class="term">上报状态</span>
|
||||||
<span class="desc">{{ record.state }}</span>
|
<span class="desc">{{ record.state }}</span>
|
||||||
|
<el-tag v-if="record.is_self" style="margin-left:2px">主动上报</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div class="ma">
|
<div class="ma" v-if="record.task_">
|
||||||
<span class="term">所属任务</span>
|
<span class="term">所属任务</span>
|
||||||
<span class="desc">{{ record.task_.name }}</span>
|
<span class="desc">{{ record.task_.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ma">
|
<div class="ma" v-if="record.task_">
|
||||||
<span class="term">任务过期</span>
|
<span class="term">任务过期</span>
|
||||||
<span class="desc">{{ record.task_.end_date }}</span>
|
<span class="desc">{{ record.task_.end_date }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ma">
|
<div class="ma" v-if="record.task_">
|
||||||
<span class="term">上报备注</span>
|
<span class="term">上报备注</span>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="record.note"
|
v-model="record.note"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:readonly="data.action!= 'update' && data.action != 'reject'"
|
:readonly="data.action != 'update' && data.action != 'reject'"
|
||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ma" v-if="record.up_user_">
|
<div class="ma" v-if="record.up_user_">
|
||||||
<span class="term">上报人</span>
|
<span class="term">上报人</span>
|
||||||
<span class="desc">{{ record.up_user_.name }}/{{ record.up_state }}</span>
|
<span class="desc">{{ record.up_user_.name }}/{{ record.up_date }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ma">
|
<div class="ma">
|
||||||
<span class="term">上报说明</span>
|
<span class="term">上报说明</span>
|
||||||
|
@ -41,28 +42,35 @@
|
||||||
v-model="record.noteb"
|
v-model="record.noteb"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:readonly="data.action!='up'"
|
:readonly="data.action != 'up'"
|
||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="ma">
|
<div class="ma">
|
||||||
<span class="term">是否适用</span>
|
<span class="term">是否适用</span>
|
||||||
<el-switch v-model="record.is_yes" :disabled="data.action=='view'"></el-switch>
|
<el-switch
|
||||||
|
v-model="record.is_yes"
|
||||||
|
:disabled="data.action == 'view'"
|
||||||
|
></el-switch>
|
||||||
</div>
|
</div>
|
||||||
<div class="ma">
|
<div class="ma">
|
||||||
|
<span class="term">已上传文件</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="(item, index) in fileList" v-bind:key="item.id">
|
||||||
|
<i 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 }}</el-link>
|
||||||
|
</div>
|
||||||
|
<div class="ma" v-if="data.action == 'up'" style="margin-top: 2px">
|
||||||
<el-upload
|
<el-upload
|
||||||
:disabled="data.action!='up'"
|
|
||||||
ref="upload"
|
ref="upload"
|
||||||
:action="upUrl"
|
:action="upUrl"
|
||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
:on-success="handleUpSuccess"
|
:on-success="handleUpSuccess"
|
||||||
:headers="upHeaders"
|
:headers="upHeaders"
|
||||||
multiple
|
multiple
|
||||||
:on-preview="handlePreview"
|
accept="image/*,.ppt,.pdf,.doc,.docx,.xls,.xlsx"
|
||||||
:file-list="fileList"
|
|
||||||
accept="image/*,application/pdf,application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/msword,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
|
|
||||||
>
|
>
|
||||||
<el-button size="small" type="primary" :disabled="data.action!='up'">上传文件</el-button>
|
<el-button size="small" type="primary">上传文件</el-button>
|
||||||
<template #tip>
|
<template #tip>
|
||||||
<div class="el-upload__tip">
|
<div class="el-upload__tip">
|
||||||
可上传pdf,word,ppt,excel,图片文件,大小不超过20M
|
可上传pdf,word,ppt,excel,图片文件,大小不超过20M
|
||||||
|
@ -72,7 +80,12 @@
|
||||||
</div>
|
</div>
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="primary" @click="confirm()" v-if="this.data.action =='reject'">驳回</el-button>
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="confirm()"
|
||||||
|
v-if="this.data.action == 'reject'"
|
||||||
|
>驳回</el-button
|
||||||
|
>
|
||||||
<el-button type="primary" @click="confirm()" v-else>确认</el-button>
|
<el-button type="primary" @click="confirm()" v-else>确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -91,10 +104,20 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
.litem {
|
||||||
|
margin-left: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
import { updateRecord, upRecord, rejectRecord, confirmRecord } from "@/api/record"
|
import {
|
||||||
|
updateRecord,
|
||||||
|
upRecord,
|
||||||
|
rejectRecord,
|
||||||
|
confirmRecord,
|
||||||
|
} from "@/api/record";
|
||||||
export default {
|
export default {
|
||||||
name: "recorddo",
|
name: "recorddo",
|
||||||
props: ["data"],
|
props: ["data"],
|
||||||
|
@ -103,45 +126,38 @@ export default {
|
||||||
upHeaders: upHeaders(),
|
upHeaders: upHeaders(),
|
||||||
upUrl: upUrl(),
|
upUrl: upUrl(),
|
||||||
record: this.data.record,
|
record: this.data.record,
|
||||||
fileList:[]
|
fileList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {},
|
||||||
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initList()
|
this.initList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initList(){
|
initList() {
|
||||||
for(var i=0;i<this.record.files_.length;i++){
|
for (var i = 0; i < this.record.files_.length; i++) {
|
||||||
this.fileList.push({
|
this.fileList.push({
|
||||||
id:this.record.files_[i].id,
|
id: this.record.files_[i].id,
|
||||||
name:this.record.files_[i].name,
|
name: this.record.files_[i].name,
|
||||||
url:this.record.files_[i].path
|
path: this.record.files_[i].path,
|
||||||
})
|
});
|
||||||
}
|
|
||||||
},
|
|
||||||
handlePreview(file){
|
|
||||||
if ("url" in file) {
|
|
||||||
window.open(file.url);
|
|
||||||
} else {
|
|
||||||
window.open(file.response.data.path);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleUpSuccess(res, file, filelist) {
|
handleUpSuccess(res, file, filelist) {
|
||||||
this.fileList.push({
|
this.fileList.push({
|
||||||
id: res.data.id,
|
id: res.data.id,
|
||||||
name: res.data.name,
|
name: res.data.name,
|
||||||
url: res.data.path
|
path: res.data.path,
|
||||||
})
|
});
|
||||||
|
this.handleRemove(file)
|
||||||
},
|
},
|
||||||
beforeRemove(){
|
handleRemove(file) {
|
||||||
if(this.record.state!='待上报'&& this.record.state!='待整改'){
|
// 实现删除文件
|
||||||
this.$message.error("当前状态不可移除")
|
let fileList = this.$refs.upload.uploadFiles;
|
||||||
return False;
|
let index = fileList.findIndex((fileItem) => {
|
||||||
}
|
return fileItem.uid === file.uid;
|
||||||
return True
|
});
|
||||||
|
fileList.splice(index, 1);
|
||||||
},
|
},
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
const isLt2M = file.size / 1024 / 1024 < 20;
|
const isLt2M = file.size / 1024 / 1024 < 20;
|
||||||
|
@ -150,39 +166,47 @@ export default {
|
||||||
}
|
}
|
||||||
return isLt2M;
|
return isLt2M;
|
||||||
},
|
},
|
||||||
confirm(){
|
deleteFile(index){
|
||||||
if(this.data.action=='update'){
|
this.$confirm('确定删除该文件, 是否继续?', {type:'error'}).then(() => {
|
||||||
updateRecord(this.record.id, this.record).then(res=>{
|
console.log(index)
|
||||||
this.$message.success('成功')
|
this.fileList.splice(index)
|
||||||
this.$emit('handleDo')
|
}).catch(e=>{})
|
||||||
})
|
},
|
||||||
|
confirm() {
|
||||||
|
if (this.data.action == "update") {
|
||||||
|
updateRecord(this.record.id, this.record).then((res) => {
|
||||||
|
this.$message.success("成功");
|
||||||
|
this.$emit("handleDo");
|
||||||
|
});
|
||||||
|
} else if (this.data.action == "up") {
|
||||||
|
var files = [];
|
||||||
|
for (var i = 0; i < this.fileList.length; i++) {
|
||||||
|
files.push(this.fileList[i].id);
|
||||||
}
|
}
|
||||||
else if(this.data.action=='up'){
|
this.record.files = files;
|
||||||
var files = []
|
upRecord(this.record.id, this.record).then((res) => {
|
||||||
for(var i=0;i<this.fileList.length;i++){
|
this.$message.success("成功");
|
||||||
files.push(this.fileList[i].id)
|
this.$emit("handleDo");
|
||||||
}
|
});
|
||||||
this.record.files = files
|
} else if (this.data.action == "reject") {
|
||||||
upRecord(this.record.id, this.record).then(res=>{
|
rejectRecord(this.record.id, this.record).then((res) => {
|
||||||
this.$message.success('成功')
|
this.$message.success("成功");
|
||||||
this.$emit('handleDo')
|
this.$emit("handleDo");
|
||||||
})
|
});
|
||||||
}
|
} else if (this.data.action == "confirm") {
|
||||||
else if(this.data.action=='reject'){
|
confirmRecord(this.record.id).then((res) => {
|
||||||
rejectRecord(this.record.id, this.record).then(res=>{
|
this.$message.success("成功");
|
||||||
this.$message.success('成功')
|
this.$emit("handleDo");
|
||||||
this.$emit('handleDo')
|
});
|
||||||
})
|
} else if (this.data.action == "confirm") {
|
||||||
|
confirmRecord(this.record.id).then((res) => {
|
||||||
}
|
this.$message.success("成功");
|
||||||
else if(this.data.action=='confirm'){
|
this.$emit("handleDo");
|
||||||
confirmRecord(this.record.id).then(res=>{
|
});
|
||||||
this.$message.success('成功')
|
} else if (this.data.action == "view") {
|
||||||
this.$emit('handleDo')
|
this.$emit("handleDo");
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -73,12 +73,11 @@
|
||||||
style="height: 600px; overflow-y: auto; overflow-x: auto"
|
style="height: 600px; overflow-y: auto; overflow-x: auto"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-for="item in contents"
|
v-for="(item, index) in contents"
|
||||||
v-bind:key="item.id"
|
v-bind:key="item.id"
|
||||||
class="litem"
|
|
||||||
@click="chosecontent(item)"
|
@click="chosecontent(item)"
|
||||||
>
|
>
|
||||||
{{ item.name }}
|
<el-link type="primary">{{index+1}}-{{ item.name }}</el-link>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -183,12 +182,11 @@
|
||||||
style="height: 600px; overflow-y: auto; overflow-x: auto"
|
style="height: 600px; overflow-y: auto; overflow-x: auto"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-for="item in depts"
|
v-for="(item, index) in depts"
|
||||||
v-bind:key="item.id"
|
v-bind:key="item.id"
|
||||||
class="litem"
|
|
||||||
@click="chosedept(item)"
|
@click="chosedept(item)"
|
||||||
>
|
>
|
||||||
{{ item.name }}
|
<el-link type="primary">{{index+1}}-{{ item.name }}</el-link>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -300,7 +298,7 @@
|
||||||
>
|
>
|
||||||
<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">
|
<el-drawer title="记录" :visible.sync="drawer" :with-header="false" size="40%">
|
||||||
<recorddo
|
<recorddo
|
||||||
ref="recorddo"
|
ref="recorddo"
|
||||||
:data="data"
|
:data="data"
|
||||||
|
|
|
@ -46,16 +46,6 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
return TaksDetailSerializer
|
return TaksDetailSerializer
|
||||||
return TaskListSerializer
|
return TaskListSerializer
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map = {'post':'task_createself'})
|
|
||||||
def createself(self, request):
|
|
||||||
"""
|
|
||||||
主动报送
|
|
||||||
"""
|
|
||||||
serializer = self.get_serializer(data=request.data)
|
|
||||||
serializer.is_valid(raise_exception=True)
|
|
||||||
serializer.save(is_self=True, create_by=request.user, belong_dept=request.user.dept)
|
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map = {'post':'task_init'})
|
@action(methods=['post'], detail=True, perms_map = {'post':'task_init'})
|
||||||
def init(self, request, *args, **kwargs):
|
def init(self, request, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue