| | |
| | | <template> |
| | | <div> |
| | | <Card> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%;"> |
| | | <div class="header-title-left"> |
| | | <img src="@/assets/public/headercard.png" /> |
| | |
| | | </div> |
| | | </div> |
| | | <el-form-item prop="reportName" style="margin-top: 38px"> |
| | | <el-input v-model="form.reportName" style="width: 100%;" placeholder="请输入报告编号" /> |
| | | <el-input v-model="form.reportName" style="width: 100%;" placeholder="请输入报告名称" /> |
| | | </el-form-item> |
| | | |
| | | <div class="header-title" style="width: 100%;"> |
| | |
| | | </div> |
| | | </div> |
| | | <el-form-item prop="reportText" style="margin-top: 38px"> |
| | | <ai-editor v-model="form.reportText" style="width: 100%;" placeholder="请输入报告编号" /> |
| | | <ai-editor ref="materialEditor" :value="form.reportText" style="width: 100%;" |
| | | placeholder="请输入报告正文" /> |
| | | </el-form-item> |
| | | <div class="header-title" style="width: 100%;"> |
| | | <div class="header-title-left"> |
| | |
| | | </el-form-item> |
| | | |
| | | <div class="end-btn" style="margin-top: 38px"> |
| | | <el-button type="primary" @click="submit">发送</el-button> |
| | | <el-button type="default" @clice="save">存草稿</el-button> |
| | | <el-button type="primary" @click="submit" :loading="loading">发送</el-button> |
| | | <el-button type="default" @click="save" :loading="loading">存草稿</el-button> |
| | | </div> |
| | | </el-form> |
| | | </Card> |
| | |
| | | import { Card } from 'element-ui'; |
| | | import AiEditor from '@/components/AiEditor' |
| | | import chooseProject from '@/components/chooseProject' |
| | | import { addData, getDetail, editData } from './service' |
| | | export default { |
| | | components: { |
| | | AiEditor, |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | loading: false, |
| | | form: { |
| | | planName: "", |
| | | planCode: "", |
| | | stage: "", |
| | | creator: "", |
| | | createTime: "", |
| | | approvalComment: "", |
| | | status: "pending", |
| | | approver: "", |
| | | approveTime: "" |
| | | reportCode: "", |
| | | reportName: "", |
| | | reportText: "" |
| | | }, |
| | | tableData: [], |
| | | fileList: [], // 附件列表 |
| | | showChoose: false, |
| | | radio1: 1, |
| | | rules: {}, |
| | | status: "1", |
| | | remark: "", |
| | | queryForm: { |
| | | |
| | | } |
| | | rules: { |
| | | reportCode: [ |
| | | { required: true, message: '请输入报告编号', trigger: 'blur' } |
| | | ], |
| | | reportName: [ |
| | | { required: true, message: '请输入报告名称', trigger: 'blur' } |
| | | ], |
| | | }, |
| | | queryForm: {} |
| | | } |
| | | }, |
| | | |
| | | mounted() { |
| | | if (this.$route.query.id) { |
| | | this.getDetail() |
| | | } |
| | | }, |
| | | |
| | | methods: { |
| | | getDetail() { |
| | | getDetail(this.$route.query.id).then(res => { |
| | | this.form = res |
| | | this.tableData = [{ ...res.projectTeam, staffName: res.staffNames }] |
| | | this.fileList = res.fileList |
| | | }) |
| | | }, |
| | | //获取选择项目组数据 |
| | | getProjectData(data) { |
| | | console.log('4458454', data); |
| | | this.tableData = [data] |
| | | this.$forceUpdate() |
| | | console.log('dsadasdsad', this.tableData); |
| | | |
| | | this.showChoose = false |
| | | }, |
| | | submit(){ |
| | | |
| | | }, |
| | | save(){ |
| | | submit() { |
| | | console.log(this.$refs.materialEditor.getContent()); |
| | | if (this.tableData.length == 0) { |
| | | this.$message.error('请选择项目组') |
| | | return |
| | | } |
| | | |
| | | this.$refs.form.validate((valid) => { |
| | | if (this.$refs.materialEditor.getContent() == '<p></p>') { |
| | | this.$message.error('请输入报告正文') |
| | | return |
| | | } |
| | | let data = { |
| | | ...this.form, |
| | | reportType: 1, |
| | | status: 1, |
| | | reportText: this.$refs.materialEditor.getContent(), |
| | | teamId: this.tableData[0].id |
| | | } |
| | | if (valid) { |
| | | this.loading = true |
| | | if (this.$route.query.id) { |
| | | editData({ ...data, id: this.$route.query.id }).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message.success('修改成功') |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(res.message) |
| | | } |
| | | }) |
| | | } else { |
| | | addData({ ...data }).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message.success('发布成功') |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(res.message) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | save() { |
| | | this.$refs.form.validate((valid) => { |
| | | let data = { |
| | | ...this.form, |
| | | reportType: 1, |
| | | status: -1, |
| | | reportText: this.$refs.materialEditor.getContent(), |
| | | teamId: this.tableData[0].id |
| | | } |
| | | |
| | | delete data.id |
| | | |
| | | if (valid) { |
| | | this.loading = true |
| | | addData({ ...data }).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message.success('提交成功') |
| | | this.$router.back() |
| | | } else { |
| | | this.$message.error(res.message) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | }, |
| | | } |