城阳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.
 
 
 

214 lines
4.4 KiB

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