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">
|
||||
<span class="term">上报状态</span>
|
||||
<span class="desc">{{ record.state }}</span>
|
||||
<el-tag v-if="record.is_self" style="margin-left:2px">主动上报</el-tag>
|
||||
</div>
|
||||
<div class="ma">
|
||||
<div class="ma" v-if="record.task_">
|
||||
<span class="term">所属任务</span>
|
||||
<span class="desc">{{ record.task_.name }}</span>
|
||||
</div>
|
||||
<div class="ma">
|
||||
<div class="ma" v-if="record.task_">
|
||||
<span class="term">任务过期</span>
|
||||
<span class="desc">{{ record.task_.end_date }}</span>
|
||||
</div>
|
||||
<div class="ma">
|
||||
<div class="ma" v-if="record.task_">
|
||||
<span class="term">上报备注</span>
|
||||
<el-input
|
||||
v-model="record.note"
|
||||
placeholder=""
|
||||
type="textarea"
|
||||
:readonly="data.action!= 'update' && data.action != 'reject'"
|
||||
:readonly="data.action != 'update' && data.action != 'reject'"
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
|
@ -33,7 +34,7 @@
|
|||
</div>
|
||||
<div class="ma" v-if="record.up_user_">
|
||||
<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 class="ma">
|
||||
<span class="term">上报说明</span>
|
||||
|
@ -41,28 +42,35 @@
|
|||
v-model="record.noteb"
|
||||
placeholder=""
|
||||
type="textarea"
|
||||
:readonly="data.action!='up'"
|
||||
:readonly="data.action != 'up'"
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="ma">
|
||||
<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 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
|
||||
:disabled="data.action!='up'"
|
||||
ref="upload"
|
||||
:action="upUrl"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="handleUpSuccess"
|
||||
:headers="upHeaders"
|
||||
multiple
|
||||
:on-preview="handlePreview"
|
||||
: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"
|
||||
accept="image/*,.ppt,.pdf,.doc,.docx,.xls,.xlsx"
|
||||
>
|
||||
<el-button size="small" type="primary" :disabled="data.action!='up'">上传文件</el-button>
|
||||
<el-button size="small" type="primary">上传文件</el-button>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">
|
||||
可上传pdf,word,ppt,excel,图片文件,大小不超过20M
|
||||
|
@ -72,7 +80,12 @@
|
|||
</div>
|
||||
<el-divider></el-divider>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -91,10 +104,20 @@
|
|||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
.litem {
|
||||
margin-left: 2px;
|
||||
cursor: pointer;
|
||||
color: #409eff;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import { upUrl, upHeaders } from "@/api/file";
|
||||
import { updateRecord, upRecord, rejectRecord, confirmRecord } from "@/api/record"
|
||||
import {
|
||||
updateRecord,
|
||||
upRecord,
|
||||
rejectRecord,
|
||||
confirmRecord,
|
||||
} from "@/api/record";
|
||||
export default {
|
||||
name: "recorddo",
|
||||
props: ["data"],
|
||||
|
@ -103,45 +126,38 @@ export default {
|
|||
upHeaders: upHeaders(),
|
||||
upUrl: upUrl(),
|
||||
record: this.data.record,
|
||||
fileList:[]
|
||||
fileList: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
created() {},
|
||||
mounted() {
|
||||
this.initList()
|
||||
this.initList();
|
||||
},
|
||||
methods: {
|
||||
initList(){
|
||||
for(var i=0;i<this.record.files_.length;i++){
|
||||
initList() {
|
||||
for (var i = 0; i < this.record.files_.length; i++) {
|
||||
this.fileList.push({
|
||||
id:this.record.files_[i].id,
|
||||
name:this.record.files_[i].name,
|
||||
url:this.record.files_[i].path
|
||||
})
|
||||
}
|
||||
},
|
||||
handlePreview(file){
|
||||
if ("url" in file) {
|
||||
window.open(file.url);
|
||||
} else {
|
||||
window.open(file.response.data.path);
|
||||
id: this.record.files_[i].id,
|
||||
name: this.record.files_[i].name,
|
||||
path: this.record.files_[i].path,
|
||||
});
|
||||
}
|
||||
},
|
||||
handleUpSuccess(res, file, filelist) {
|
||||
this.fileList.push({
|
||||
id: res.data.id,
|
||||
name: res.data.name,
|
||||
url: res.data.path
|
||||
})
|
||||
id: res.data.id,
|
||||
name: res.data.name,
|
||||
path: res.data.path,
|
||||
});
|
||||
this.handleRemove(file)
|
||||
},
|
||||
beforeRemove(){
|
||||
if(this.record.state!='待上报'&& this.record.state!='待整改'){
|
||||
this.$message.error("当前状态不可移除")
|
||||
return False;
|
||||
}
|
||||
return True
|
||||
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 < 20;
|
||||
|
@ -150,39 +166,47 @@ export default {
|
|||
}
|
||||
return isLt2M;
|
||||
},
|
||||
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)
|
||||
deleteFile(index){
|
||||
this.$confirm('确定删除该文件, 是否继续?', {type:'error'}).then(() => {
|
||||
console.log(index)
|
||||
this.fileList.splice(index)
|
||||
}).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);
|
||||
}
|
||||
this.record.files = files
|
||||
upRecord(this.record.id, this.record).then(res=>{
|
||||
this.$message.success('成功')
|
||||
this.$emit('handleDo')
|
||||
})
|
||||
this.record.files = files;
|
||||
upRecord(this.record.id, this.record).then((res) => {
|
||||
this.$message.success("成功");
|
||||
this.$emit("handleDo");
|
||||
});
|
||||
} else if (this.data.action == "reject") {
|
||||
rejectRecord(this.record.id, this.record).then((res) => {
|
||||
this.$message.success("成功");
|
||||
this.$emit("handleDo");
|
||||
});
|
||||
} else if (this.data.action == "confirm") {
|
||||
confirmRecord(this.record.id).then((res) => {
|
||||
this.$message.success("成功");
|
||||
this.$emit("handleDo");
|
||||
});
|
||||
} else if (this.data.action == "confirm") {
|
||||
confirmRecord(this.record.id).then((res) => {
|
||||
this.$message.success("成功");
|
||||
this.$emit("handleDo");
|
||||
});
|
||||
} else if (this.data.action == "view") {
|
||||
this.$emit("handleDo");
|
||||
}
|
||||
else if(this.data.action=='reject'){
|
||||
rejectRecord(this.record.id, this.record).then(res=>{
|
||||
this.$message.success('成功')
|
||||
this.$emit('handleDo')
|
||||
})
|
||||
|
||||
}
|
||||
else if(this.data.action=='confirm'){
|
||||
confirmRecord(this.record.id).then(res=>{
|
||||
this.$message.success('成功')
|
||||
this.$emit('handleDo')
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -73,12 +73,11 @@
|
|||
style="height: 600px; overflow-y: auto; overflow-x: auto"
|
||||
>
|
||||
<div
|
||||
v-for="item in contents"
|
||||
v-for="(item, index) in contents"
|
||||
v-bind:key="item.id"
|
||||
class="litem"
|
||||
@click="chosecontent(item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
<el-link type="primary">{{index+1}}-{{ item.name }}</el-link>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
@ -183,12 +182,11 @@
|
|||
style="height: 600px; overflow-y: auto; overflow-x: auto"
|
||||
>
|
||||
<div
|
||||
v-for="item in depts"
|
||||
v-for="(item, index) in depts"
|
||||
v-bind:key="item.id"
|
||||
class="litem"
|
||||
@click="chosedept(item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
<el-link type="primary">{{index+1}}-{{ item.name }}</el-link>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
@ -300,7 +298,7 @@
|
|||
>
|
||||
<taskinit ref="taskinit" @handleChose="chooseComplete"></taskinit>
|
||||
</el-dialog>
|
||||
<el-drawer title="记录" :visible.sync="drawer" :with-header="false">
|
||||
<el-drawer title="记录" :visible.sync="drawer" :with-header="false" size="40%">
|
||||
<recorddo
|
||||
ref="recorddo"
|
||||
:data="data"
|
||||
|
|
|
@ -46,16 +46,6 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
|||
return TaksDetailSerializer
|
||||
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'})
|
||||
def init(self, request, *args, **kwargs):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue