城阳pc工作端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
4.4 KiB

3 years ago
<template>
3 years ago
<div>
<div class="dialog-h-content scroll-h">
3 years ago
<div class="div_tinymce">
<Tinymce class="tinymce_view"
v-model="actContent"
:height="450"
style="width:1000px"
:customerId="customerId"
placeholder="在这里输入文字" />
</div>
3 years ago
</div>
3 years ago
<div class="div_btn">
<el-button size="small"
@click="handleCancle"> </el-button>
<el-button size="small"
type="primary"
:disabled="btnDisable"
@click="handleComfirm"> </el-button>
</div>
3 years ago
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { Loading } from 'element-ui' // 引入Loading服务
import { requestPost } from '@/js/dai/request'
3 years ago
import Tinymce from '@c/tinymce2/index.vue'
3 years ago
let loading // 加载动画
3 years ago
3 years ago
export default {
data () {
3 years ago
3 years ago
return {
3 years ago
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情
btnDisable: false,
customerId: '',
actId: '',
3 years ago
actSummary: [],
actContent: '',
3 years ago
3 years ago
}
},
3 years ago
components: { Tinymce },
3 years ago
mounted () {
3 years ago
this.customerId = localStorage.getItem('customerId')
3 years ago
},
methods: {
3 years ago
async initForm (actId) {
3 years ago
this.startLoading()
3 years ago
3 years ago
3 years ago
if (actId) {
this.actId = actId
3 years ago
}
3 years ago
this.endLoading()
3 years ago
},
3 years ago
async handleComfirm () {
3 years ago
if (!this.actContent) {
this.$message({
type: 'info',
message: '活动回顾不能为空'
})
return false
}
this.actSummary = [{
contentType: 'rich_text',
content: this.dormatHtml(this.actContent)
}]
3 years ago
3 years ago
let url = "/heart/work/act/summaryact"
3 years ago
// let url = "http://yapi.elinkservice.cn/mock/245/gov/org/placepatrolrecord/add"
3 years ago
let params = {
actId: this.actId,
actSummary: this.actSummary
}
console.log(params)
3 years ago
3 years ago
const { data, code, msg } = await requestPost(url, params)
3 years ago
3 years ago
if (code === 0) {
3 years ago
this.$message({
3 years ago
type: 'success',
message: '操作成功'
3 years ago
})
3 years ago
this.actContent = ''
this.$emit('reviewDiaOk')
3 years ago
} else {
3 years ago
3 years ago
this.$message.error(msg)
}
},
3 years ago
dormatHtml (content) {
let c = ''
if (content.indexOf('DOCTYPE') != -1) {
c = content.slice(45, -16);
3 years ago
}
3 years ago
console.log('content', typeof content)
return c || content
3 years ago
},
handleCancle () {
3 years ago
this.$emit('reviewDiaClose')
3 years ago
},
3 years ago
resetData () {
this.formData = {
actContent: '',
}
},
3 years ago
// 开启加载动画
startLoading () {
loading = Loading.service({
lock: true, // 是否锁定
text: '正在加载……', // 加载中需要显示的文字
background: 'rgba(0,0,0,.7)' // 背景颜色
})
},
// 结束加载动画
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
},
computed: {
3 years ago
dataRule () {
return {
gridId: [
{ required: true, message: '场所网格不能为空', trigger: 'blur' }
],
ninePlaceVal: [
{ required: true, message: '场所类型不能为空', trigger: 'blur' },
],
placeOrgId: [
{ required: true, message: '场所名称不能为空', trigger: 'blur' }
],
placePatrolTeamId: [
{ required: true, message: '分队不能为空', trigger: 'blur' }
],
inspectorArray: [
{ required: true, message: '巡检人员不能为空', trigger: 'blur' }
],
firstTime: [
{ required: true, message: '首次巡查时间不能为空', trigger: 'blur' }
],
detailed: [
{ required: true, message: '隐患明细不能为空', trigger: 'blur' }
],
firstResult: [
{ required: true, message: '首次巡查结果不能为空', trigger: 'blur' }
]
}
3 years ago
},
},
props: {
}
}
</script>
<style lang="scss" scoped >
3 years ago
@import "@/assets/scss/modules/management/form-main.scss";
3 years ago
.div_tinymce {
display: flex;
justify-content: center;
}
3 years ago
.avatar-uploader {
margin: 0 0 0 20px;
3 years ago
}
3 years ago
</style>
<style lang="scss">
.el-dialog__body {
padding: 0 10px 20px !important;
3 years ago
}
3 years ago
.hide {
.el-upload--picture-card {
display: none !important;
3 years ago
}
}
</style>
3 years ago