<template>
|
<el-main>
|
<el-form ref="form" :model="form" label-width="80px">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="调查人">
|
<el-input type="text" v-model="form.name" placeholder="请填写调查人"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="签字日期">
|
<el-date-picker
|
v-model="form.DataTime"
|
type="date"
|
:value-format="'yyyy-MM-dd'"
|
placeholder="选择日期">
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<h1 style="text-align: center;font-weight: bold;font-size: 20px">报告如下</h1>
|
<ul style="list-style: none!important;">
|
<li v-for="(item,index) in form.reportes" :key="index">
|
<el-form-item>
|
<el-input type="textarea" v-model="item.centeres"></el-input>
|
</el-form-item>
|
</li>
|
</ul>
|
<el-form-item label-width="50%">
|
<el-button type="text" @click="addEle">
|
<img src="../../../../assets/lawImg/addIcon.png" alt="">
|
</el-button>
|
</el-form-item>
|
|
|
<WordView ref="wordInfo" :isShowYulan="showView" @cancel="cancelWord"></WordView>
|
</el-form>
|
|
<div style="text-align: center">
|
<el-button v-if="isFinish!='2'" plain @click="dataFormSubmit('0')">保存</el-button>
|
<el-button v-if="isFinish!='2'" type="warning" plain @click="dataFormSubmit('1')">定稿</el-button>
|
<el-button type="primary" plain @click="viewVord(form)">预览</el-button>
|
<el-button type="success" plain @click="downloadWord(form)">下载</el-button>
|
</div>
|
</el-main>
|
</template>
|
|
<script>
|
import WordView from "@/views/News/word-view";
|
import {getObj, saveObj} from "@/api/News/CaseClosureReport";
|
|
export default {
|
name: "CaseClosureReport",
|
props: ['isShowYulan', 'id', 'isFinish', 'processId', 'title'],
|
components: {
|
WordView
|
},
|
data() {
|
return {
|
showView: false,
|
form: {
|
light: "",
|
reportes:[],
|
}
|
}
|
},
|
methods: {
|
init() {
|
getObj(this.id).then((res) => {
|
// 转换null为""
|
let v = res.data.data;
|
for (let attr in v) {
|
if (v[attr] == null) {
|
v[attr] = "";
|
}
|
}
|
let str = JSON.stringify(v);
|
let data = JSON.parse(str);
|
this.form = data;
|
});
|
},
|
dataFormSubmit(type) {
|
this.$refs['form'].validate((valid) => {
|
if (valid) {
|
let obj = this;
|
if ("1" == type) {
|
this.$confirm('保存为定稿将不能修改,是否继续?', '提示', {
|
confirmButtonText: '是',
|
cancelButtonText: '否',
|
type: 'warning'
|
}).then(function () {
|
obj.form.registerState = type;
|
obj.form.registerId = obj.id;
|
obj.form.processId = obj.processId;
|
saveObj(obj.form).then((res) => {
|
// this.submitLoading = false;
|
obj.$message.success('操作成功');
|
obj.cancel();
|
obj.$emit('getDataList');
|
})
|
})
|
} else {
|
obj.form.registerState = type;
|
obj.form.registerId = obj.id;
|
obj.form.processId = obj.processId;
|
saveObj(obj.form).then((res) => {
|
// this.submitLoading = false;
|
obj.$message.success("操作成功");
|
obj.cancel();
|
obj.$emit('getDataList');
|
})
|
}
|
}
|
})
|
},
|
cancelWord() {
|
this.showView = false;
|
},
|
// 点击添加
|
addEle() {
|
this.form.reportes.push({
|
centeres: "",
|
});
|
},
|
cancell(e, d) {
|
this.isShow = e;
|
if (d != undefined) {
|
this.form.goodsDis.push(d)
|
}
|
},
|
viewVord(data) {
|
if (data.registerState == null || data.registerState == "") {
|
//预览前先进行保存
|
data.registerState = '0';
|
data.registerId = this.id;
|
data.processId = this.processId;
|
saveObj(data).then((res) => {
|
})
|
}
|
//↓↓↓↓↓↓以下部分根据具体业务修改↓↓↓↓↓↓
|
//格式转换
|
let wordData = this.transforData(data);
|
//↑↑↑↑↑↑以上部分根据具体业务修改↑↑↑↑↑↑
|
this.showView = true;
|
this.$nextTick(() => {
|
this.$refs.wordInfo.init(wordData, "/wordes/saveproofDisposeInform.docx");
|
})
|
},
|
downloadWord(data) {
|
if (data.registerState == null || data.registerState == "") {
|
//预览前先进行保存
|
data.registerState = '0';
|
data.registerId = this.id;
|
data.processId = this.processId;
|
saveObj(data).then((res) => {
|
})
|
}
|
let wordData = this.transforData(data);
|
WordView.methods.exportDoc(wordData, "/wordes/saveproofDisposeInform.docx", this.title + '.docx');
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|