|
@@ -1,205 +1,390 @@
|
|
|
-<template>
|
|
|
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
|
|
|
<div>
|
|
|
<el-dialog
|
|
|
:title="title"
|
|
|
:close-on-click-modal="false"
|
|
|
- append-to-body
|
|
|
v-dialogDrag
|
|
|
+ width="1400px"
|
|
|
+ height="500px"
|
|
|
+ @close="close"
|
|
|
+ append-to-body
|
|
|
+ @keyup.enter.native=""
|
|
|
:visible.sync="visible">
|
|
|
- <el-form size="small" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view' || method === 'read'?'readonly':''" :disabled="method==='view' || method === 'read'" @keyup.enter.native="doSubmit()"
|
|
|
- label-width="120px" @submit.native.prevent>
|
|
|
- <el-row :gutter="15">
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="类型" prop="type"
|
|
|
- :rules="[
|
|
|
+ <el-form size="small" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view' || method === 'read'?'readonly':''" :disabled="method==='view' || method === 'read'"
|
|
|
+ label-width="80px" @submit.native.prevent>
|
|
|
+ <el-row :gutter="15">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="通告状态" prop="notifyType"
|
|
|
+ :rules="[
|
|
|
+ {required: true, message:'通告状态不能为空', trigger:'blur'}
|
|
|
+ ]">
|
|
|
+ <el-select size="medium" @change="changeNotifyType" v-model="inputForm.notifyType" placeholder="请选择" style="width: 100%;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in $dictUtils.getDictList('oa_notify_status')"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" v-if="inputForm.notifyType === '0'">
|
|
|
+ <el-form-item label="通告时间" prop="dates"
|
|
|
+ :rules="[
|
|
|
+ {required: true, message:'通告时间不能为空', trigger:'blur'}
|
|
|
+ ]">
|
|
|
+ <el-date-picker
|
|
|
+ size="medium"
|
|
|
+ style="width: 100%"
|
|
|
+ placement="bottom-start"
|
|
|
+ format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ v-model="inputForm.dates"
|
|
|
+ type="datetimerange"
|
|
|
+ range-separator="至"
|
|
|
+ @input="daterangeChange"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="类型" prop="type"
|
|
|
+ :rules="[
|
|
|
{required: true, message:'类型不能为空', trigger:'blur'}
|
|
|
]">
|
|
|
- <el-select v-model="inputForm.type" placeholder="请选择" style="width: 100%;">
|
|
|
- <el-option
|
|
|
- v-for="item in $dictUtils.getDictList('oa_notify_type')"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="标题" prop="title"
|
|
|
- :rules="[
|
|
|
+ <el-select size="medium" v-model="inputForm.type" placeholder="请选择" style="width: 100%;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in $dictUtils.getDictList('oa_notify_type')"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="标题" prop="title"
|
|
|
+ :rules="[
|
|
|
{required: true, message:'标题不能为空', trigger:'blur'}
|
|
|
]">
|
|
|
- <el-input v-model="inputForm.title" placeholder="请填写标题" ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="内容" prop="content"
|
|
|
- :rules="[
|
|
|
- {required: true, message:'内容不能为空', trigger:'blur'}
|
|
|
- ]">
|
|
|
- <el-input type="textarea" :rows="8" v-model="inputForm.content" placeholder="请填写内容" ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="附件" prop="files">
|
|
|
- <el-upload ref="files"
|
|
|
- :action="`${this.$http.BASE_URL}/sys/file/webupload/upload?uploadPath=/notify/notify`"
|
|
|
- :headers="{token: $cookie.get('token')}"
|
|
|
- :on-preview="(file, fileList) => {$window.location.href = file.url}"
|
|
|
- :on-success="(response, file, fileList) => {
|
|
|
- inputForm.files = fileList.map(item => item.url || item.response.url).join('|')
|
|
|
- }"
|
|
|
- :on-error="(response) => {
|
|
|
- $message.error(response.message)
|
|
|
- }"
|
|
|
- :on-remove="(file, fileList) => {
|
|
|
- $http.delete(`/sys/file/webupload/deleteByUrl?url=${file.url}`).then(({data}) => {
|
|
|
- $message.success(data)
|
|
|
- })
|
|
|
- inputForm.files = fileList.map(item => item.url).join('|')
|
|
|
- }"
|
|
|
- :before-remove="(file, fileList) => {
|
|
|
- return $confirm(`确定移除 ${file.name}?`)
|
|
|
- }"
|
|
|
- multiple
|
|
|
- :limit="5"
|
|
|
- :on-exceed="(files, fileList) =>{
|
|
|
- $message.warning(`当前限制选择 5 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
|
|
|
- }"
|
|
|
- :file-list="filesArra">
|
|
|
- <el-button size="small" type="primary">点击上传</el-button>
|
|
|
- <div slot="tip" class="el-upload__tip">添加相关附件</div>
|
|
|
- </el-upload>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" v-if="method !== 'read'">
|
|
|
- <el-form-item label="状态" prop="status"
|
|
|
- :rules="[
|
|
|
- {required: true, message:'状态不能为空', trigger:'blur'}
|
|
|
- ]">
|
|
|
- <el-radio-group v-model="inputForm.status">
|
|
|
- <el-radio v-for="item in $dictUtils.getDictList('oa_notify_status')" :label="item.value" :key="item.id">{{item.label}}</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="接收人" prop="notifyRecordIds"
|
|
|
- :rules="[
|
|
|
- {required: true, message:'接收人不能为空', trigger:'blur'}
|
|
|
+ <el-input size="medium" v-model="inputForm.title" placeholder="请填写标题" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="文号" prop="no"
|
|
|
+ :rules="[
|
|
|
]">
|
|
|
- <user-select :value="inputForm.notifyRecordIds" @getValue='(value) => {inputForm.notifyRecordIds=value}'></user-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24" v-if="method ==='view' && inputForm.status === '1'">
|
|
|
- <el-form-item label="接收人">
|
|
|
- <el-table
|
|
|
- size="small"
|
|
|
- :data="notifyRecordDTOList"
|
|
|
- style="width: 100%">
|
|
|
- <el-table-column
|
|
|
- prop="userDTO.name"
|
|
|
- label="接收人"
|
|
|
- width="180">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="userDTO.officeDTO.name"
|
|
|
- label="接收部门"
|
|
|
- width="180">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="readFlag"
|
|
|
- label="阅读状态">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-tag type="success" v-if="scope.row.readFlag === '1'"> {{ $dictUtils.getDictLabel("oa_notify_read", scope.row.readFlag, '-') }}</el-tag>
|
|
|
- <el-tag type="danger" v-if="scope.row.readFlag === '0'"> {{ $dictUtils.getDictLabel("oa_notify_read", scope.row.readFlag, '-') }}</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="readDate"
|
|
|
- label="阅读时间"
|
|
|
- width="180">
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
+ <el-input size="medium" v-model="inputForm.no" placeholder="请填写文号" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="创建人" prop="createBy.name"
|
|
|
+ :rules="[
|
|
|
+ ]">
|
|
|
+ <el-input size="medium" :disabled="true" v-model="inputForm.createBy.name" placeholder="请填写创建人" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="所属部门" prop="officeId"
|
|
|
+ :rules="[
|
|
|
+ ]">
|
|
|
+ <SelectTree
|
|
|
+ ref="officeTree"
|
|
|
+ :props="{
|
|
|
+ value: 'id', // ID字段名
|
|
|
+ label: 'name', // 显示名称
|
|
|
+ children: 'children' // 子级字段名
|
|
|
+ }"
|
|
|
+ :url="`/sys/office/treeData?type=2`"
|
|
|
+ :value="inputForm.officeId"
|
|
|
+ :accordion="true"
|
|
|
+ :disabled="true"
|
|
|
+ size="medium"
|
|
|
+ @getValue="(value) => {inputForm.officeId=value}"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="内容" prop="content"
|
|
|
+ :rules="[
|
|
|
+ {required: true, message:'内容不能为空', trigger:'blur'}
|
|
|
+ ]">
|
|
|
+ <WangEditor ref="contentEditor" v-model="inputForm.content" @getUrl="(url, lsUrl) => {
|
|
|
+ inputForm.editorFilesDTOList.push({temporaryUrl: lsUrl, url: url})
|
|
|
+ }"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-divider content-position="left">
|
|
|
+ <div style="float:left;"><i class="el-icon-document"></i> 通告范围-部门</div>
|
|
|
+ <div style="float:left;">
|
|
|
+ <el-button style="margin-left: 20px" :disabled="true" type="primary" size="mini" @click="openOfficeChoose" plain>
|
|
|
+ 选择
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </el-divider>
|
|
|
+ <el-row :gutter="15" >
|
|
|
+ <el-form :disabled="true">
|
|
|
+ <vxe-table
|
|
|
+ border
|
|
|
+ :column-config="{resizable: true}"
|
|
|
+ show-overflow
|
|
|
+ show-footer
|
|
|
+ :key="tableKeyOffice"
|
|
|
+ ref="officeTable"
|
|
|
+ class="vxe-table-element"
|
|
|
+ :data="inputForm.pluginNotifyOfficesDTOList"
|
|
|
+ style=""
|
|
|
+ @cell-click=""
|
|
|
+ @edit-closed=""
|
|
|
+ highlight-current-row
|
|
|
+ >
|
|
|
+ <vxe-table-column align="center" field="officeName" title="部门"></vxe-table-column>
|
|
|
+ <vxe-table-column align="center" title="操作" width="100">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'office')">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </vxe-table-column>
|
|
|
+ </vxe-table>
|
|
|
+ </el-form>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <div style="margin-top: 30px">
|
|
|
+ <el-divider content-position="left" >
|
|
|
+ <div style="float: left"><i class="el-icon-document"></i> 通告范围-成员</div>
|
|
|
+ <UserSelectButton ref="userSelectButton" :disabled="true" @getValue="(value) => {openUserChoose(value)}"></UserSelectButton>
|
|
|
+ </el-divider>
|
|
|
+ </div>
|
|
|
+ <el-row :gutter="15">
|
|
|
+ <el-form :disabled="true">
|
|
|
+ <vxe-table
|
|
|
+ border
|
|
|
+ :column-config="{resizable: true}"
|
|
|
+ show-overflow
|
|
|
+ show-footer
|
|
|
+ :key="tableKeyUser"
|
|
|
+ ref="userTable"
|
|
|
+ class="vxe-table-element"
|
|
|
+ :data="inputForm.pluginNotifyUserDTOList"
|
|
|
+ style=""
|
|
|
+ @cell-click=""
|
|
|
+ @edit-closed=""
|
|
|
+ highlight-current-row
|
|
|
+ >
|
|
|
+ <vxe-table-column align="center" field="userName" title="姓名"></vxe-table-column>
|
|
|
+ <vxe-table-column align="center" field="officeName" title="部门"></vxe-table-column>
|
|
|
+ <vxe-table-column align="center" title="操作" width="100">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'user')">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </vxe-table-column>
|
|
|
+ </vxe-table>
|
|
|
+ </el-form>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
- <el-button size="small" @click="visible = false" icon="el-icon-circle-close">关闭</el-button>
|
|
|
- <el-button size="small" type="primary" v-if="method != 'view' && method != 'read'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
|
|
|
+ <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
|
|
|
+ <el-button size="small" v-if="method === 'edit'" type="primary" icon="el-icon-circle-check" @click="doSubmit()">确定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <OfficeTreeSelect ref="officeTreeSelect" @getOfficeChoose="getOfficeChoose"></OfficeTreeSelect>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import UserSelect from '@/components/userSelect'
|
|
|
import NotifyService from '@/api/notify/NotifyService'
|
|
|
+ import SelectTree from '@/components/treeSelect/treeSelect.vue'
|
|
|
+ import WangEditor from '@/components/editor/WangEditor'
|
|
|
+ import OfficeTreeSelect from '@/components/officeTreeSelect'
|
|
|
+ import UserSelectButton from '@/components/userSelectButton/DividerButton'
|
|
|
+ import UserService from '@/api/sys/UserService'
|
|
|
+ import UpLoadComponent from '@/views/common/UpLoadComponent'
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ businessId: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ formReadOnly: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ status: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
title: '',
|
|
|
method: '',
|
|
|
- visible: false,
|
|
|
loading: false,
|
|
|
- filesArra: [],
|
|
|
- notifyRecordDTOList: [],
|
|
|
inputForm: {
|
|
|
+ createBy: {
|
|
|
+ id: '',
|
|
|
+ name: ''
|
|
|
+ },
|
|
|
+ createDate: '',
|
|
|
id: '',
|
|
|
type: '',
|
|
|
title: '',
|
|
|
content: '',
|
|
|
files: '',
|
|
|
status: '',
|
|
|
- notifyRecordIds: ''
|
|
|
+ remarks: '',
|
|
|
+ notifyType: '',
|
|
|
+ no: '',
|
|
|
+ beginDate: '',
|
|
|
+ endDate: '',
|
|
|
+ dates: '',
|
|
|
+ officeId: '',
|
|
|
+ workAttachmentDtoList: [],
|
|
|
+ pluginNotifyOfficesDTOList: [],
|
|
|
+ pluginNotifyUserDTOList: [],
|
|
|
+ editorFilesDTOList: []
|
|
|
+ },
|
|
|
+ keyWatch: '',
|
|
|
+ tableKeyOffice: '',
|
|
|
+ tableKeyUser: '',
|
|
|
+ visible: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ bus: {
|
|
|
+ get () {
|
|
|
+ return this.businessId
|
|
|
+ },
|
|
|
+ set (val) {
|
|
|
+ this.businessId = val
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ 'keyWatch': {
|
|
|
+ handler (newVal) {
|
|
|
+ if (this.commonJS.isNotEmpty(this.bus)) {
|
|
|
+ this.init('', this.bus)
|
|
|
+ } else {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.inputForm.resetFields()
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
- UserSelect
|
|
|
+ UserSelect,
|
|
|
+ SelectTree,
|
|
|
+ WangEditor,
|
|
|
+ OfficeTreeSelect,
|
|
|
+ UserSelectButton,
|
|
|
+ UpLoadComponent
|
|
|
},
|
|
|
notifyService: null,
|
|
|
+ userService: null,
|
|
|
created () {
|
|
|
this.notifyService = new NotifyService()
|
|
|
+ this.userService = new UserService()
|
|
|
},
|
|
|
methods: {
|
|
|
+ getKeyWatch (keyWatch) {
|
|
|
+ this.keyWatch = keyWatch
|
|
|
+ },
|
|
|
init (method, id) {
|
|
|
this.method = method
|
|
|
+ this.inputForm = {
|
|
|
+ createBy: {
|
|
|
+ id: '',
|
|
|
+ name: ''
|
|
|
+ },
|
|
|
+ createDate: '',
|
|
|
+ id: '',
|
|
|
+ type: '',
|
|
|
+ title: '',
|
|
|
+ content: '',
|
|
|
+ files: '',
|
|
|
+ status: '',
|
|
|
+ remarks: '',
|
|
|
+ notifyType: '',
|
|
|
+ no: '',
|
|
|
+ beginDate: '',
|
|
|
+ endDate: '',
|
|
|
+ dates: ['', ''],
|
|
|
+ officeId: '',
|
|
|
+ workAttachmentDtoList: [],
|
|
|
+ pluginNotifyOfficesDTOList: [],
|
|
|
+ pluginNotifyUserDTOList: [],
|
|
|
+ editorFilesDTOList: []
|
|
|
+ }
|
|
|
this.inputForm.id = id
|
|
|
if (method === 'add') {
|
|
|
- this.title = `新建通知`
|
|
|
+ this.title = '新建通告'
|
|
|
} else if (method === 'edit') {
|
|
|
- this.title = '修改通知'
|
|
|
+ this.title = '修改通告'
|
|
|
} else if (method === 'view') {
|
|
|
- this.title = '查看通知'
|
|
|
+ this.title = '查看通告'
|
|
|
} else if (method === 'read') {
|
|
|
- this.title = '阅读通知'
|
|
|
+ this.title = '阅读通告'
|
|
|
}
|
|
|
this.visible = true
|
|
|
this.loading = false
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.inputForm.resetFields()
|
|
|
- this.$refs.files.clearFiles()
|
|
|
- this.filesArra = []
|
|
|
- if (method === 'edit' || method === 'view' || method === 'read') { // 修改或者查看
|
|
|
- this.loading = true
|
|
|
- this.notifyService.query({
|
|
|
- id: this.inputForm.id,
|
|
|
- isSelf: method === 'read'
|
|
|
- }).then(({data}) => {
|
|
|
- this.inputForm = this.recover(this.inputForm, data)
|
|
|
- this.notifyRecordDTOList = data.notifyRecordDTOList
|
|
|
- this.inputForm.files.split('|').forEach((item) => {
|
|
|
- if (item.trim().length > 0) {
|
|
|
- this.filesArra.push({name: decodeURIComponent(item.substring(item.lastIndexOf('/') + 1)), url: item})
|
|
|
- }
|
|
|
- })
|
|
|
- if (method === 'read') {
|
|
|
- this.$emit('refreshDataList')
|
|
|
- }
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
- }
|
|
|
+ this.loading = true
|
|
|
+ this.$refs.contentEditor.clear()
|
|
|
+ this.notifyService.query({id: this.inputForm.id, isSelf: method === 'read'}).then(({data}) => {
|
|
|
+ this.$refs.uploadComponent.clearUpload()
|
|
|
+ this.inputForm = this.recover(this.inputForm, data)
|
|
|
+ this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
|
|
|
+ if (this.method === 'view' || this.method === 'read') {
|
|
|
+ this.$refs.contentEditor.disable()
|
|
|
+ } else {
|
|
|
+ this.$refs.contentEditor.enable()
|
|
|
+ }
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.content)) {
|
|
|
+ this.$refs.contentEditor.init(this.inputForm.content)
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.editorFilesDTOList)) {
|
|
|
+ this.inputForm.editorFilesDTOList = []
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.createBy.id)) {
|
|
|
+ this.inputForm.createBy.id = JSON.parse(localStorage.getItem('user')).id
|
|
|
+ this.inputForm.createBy.name = JSON.parse(localStorage.getItem('user')).name
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.officeId)) {
|
|
|
+ this.inputForm.officeId = JSON.parse(localStorage.getItem('user')).officeDTO.id
|
|
|
+ }
|
|
|
+ this.inputForm.dates = ['', '']
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.beginDate) && this.commonJS.isNotEmpty(this.inputForm.endDate)) {
|
|
|
+ this.inputForm.dates[0] = this.inputForm.beginDate
|
|
|
+ this.inputForm.dates[1] = this.inputForm.endDate
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.notifyType)) {
|
|
|
+ this.inputForm.notifyType = '0'
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.pluginNotifyOfficesDTOList)) {
|
|
|
+ this.inputForm.pluginNotifyOfficesDTOList = []
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.pluginNotifyUserDTOList)) {
|
|
|
+ this.inputForm.pluginNotifyUserDTOList = []
|
|
|
+ }
|
|
|
+ if (this.method === 'view' || this.method === 'read') {
|
|
|
+ this.$refs.uploadComponent.newUpload('view', this.inputForm.workAttachmentDtoList, 'notify')
|
|
|
+ } else {
|
|
|
+ this.$refs.uploadComponent.newUpload('edit', this.inputForm.workAttachmentDtoList, 'notify')
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.workAttachmentDtoList)) {
|
|
|
+ this.inputForm.workAttachmentDtoList = []
|
|
|
+ }
|
|
|
+ if (method === 'read') {
|
|
|
+ this.$emit('refreshDataList')
|
|
|
+ }
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
// 表单提交
|
|
@@ -207,17 +392,207 @@
|
|
|
this.$refs['inputForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true
|
|
|
- this.notifyService.save(this.inputForm).then(({data}) => {
|
|
|
+ if (this.$refs.uploadComponent.checkProgress()) {
|
|
|
this.loading = false
|
|
|
- this.visible = false
|
|
|
- this.$message.success(data)
|
|
|
- this.$emit('refreshDataList')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.pluginNotifyOfficesDTOList) && this.commonJS.isEmpty(this.inputForm.pluginNotifyUserDTOList)) {
|
|
|
+ this.$message.error('通告范围(部门或成员),至少填写一项')
|
|
|
+ this.loading = false
|
|
|
+ throw new Error('通告范围(部门或成员),至少填写一项')
|
|
|
+ }
|
|
|
+ this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.dates)) {
|
|
|
+ this.inputForm.beginDate = this.inputForm.dates[0]
|
|
|
+ this.inputForm.endDate = this.inputForm.dates[1]
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.beginDate) && this.commonJS.isNotEmpty(this.inputForm.endDate)) {
|
|
|
+ if (this.inputForm.beginDate === this.inputForm.endDate) {
|
|
|
+ if (this.inputForm.notifyType === '0') {
|
|
|
+ this.$message.error('通告起止时间不可以相同')
|
|
|
+ this.loading = false
|
|
|
+ throw new Error('通告起止时间不可以相同')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.inputForm.notifyType === '0') {
|
|
|
+ this.$message.error('请填写通告时间')
|
|
|
+ this.loading = false
|
|
|
+ throw new Error('请填写通告时间')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.inputForm.beginDate = ''
|
|
|
+ this.inputForm.endDate = ''
|
|
|
+ if (this.inputForm.notifyType === '0') {
|
|
|
+ this.$message.error('请填写通告时间')
|
|
|
+ this.loading = false
|
|
|
+ throw new Error('请填写通告时间')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.content)) {
|
|
|
+ this.$message.error('请填写内容')
|
|
|
+ this.loading = false
|
|
|
+ throw new Error('请填写内容')
|
|
|
+ }
|
|
|
+ this.getEditorFilesDTOList()
|
|
|
+ this.notifyService.saveForm(this.inputForm).then(({data}) => {
|
|
|
+ this.loading = false
|
|
|
+ this.close()
|
|
|
}).catch(() => {
|
|
|
this.loading = false
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ close () {
|
|
|
+ this.$refs.uploadComponent.clearUpload()
|
|
|
+ this.$refs.contentEditor.enable()
|
|
|
+ this.$emit('refreshDataList')
|
|
|
+ this.visible = false
|
|
|
+ this.inputForm = {
|
|
|
+ createBy: {
|
|
|
+ id: '',
|
|
|
+ name: ''
|
|
|
+ },
|
|
|
+ createDate: '',
|
|
|
+ id: '',
|
|
|
+ type: '',
|
|
|
+ title: '',
|
|
|
+ content: '',
|
|
|
+ files: '',
|
|
|
+ status: '',
|
|
|
+ remarks: '',
|
|
|
+ notifyType: '',
|
|
|
+ no: '',
|
|
|
+ beginDate: '',
|
|
|
+ endDate: '',
|
|
|
+ dates: '',
|
|
|
+ officeId: '',
|
|
|
+ workAttachmentDtoList: [],
|
|
|
+ pluginNotifyOfficesDTOList: [],
|
|
|
+ pluginNotifyUserDTOList: [],
|
|
|
+ editorFilesDTOList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeNotifyType () {
|
|
|
+ this.inputForm.beginDate = ''
|
|
|
+ this.inputForm.endDate = ''
|
|
|
+ this.inputForm.dates = ['', '']
|
|
|
+ },
|
|
|
+ daterangeChange (e) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$forceUpdate()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getEditorFilesDTOList () {
|
|
|
+ let a = []
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.editorFilesDTOList)) {
|
|
|
+ this.inputForm.content = this.inputForm.content.replace(/&/, '&')
|
|
|
+ console.log('content', this.inputForm.content)
|
|
|
+ console.log('editorFilesDTOList', this.inputForm.editorFilesDTOList)
|
|
|
+ this.inputForm.editorFilesDTOList.forEach((item) => {
|
|
|
+ console.log('尽')
|
|
|
+ if (this.inputForm.content.includes(item.temporaryUrl)) {
|
|
|
+ a.push(item)
|
|
|
+ console.log('a', a)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ this.inputForm.editorFilesDTOList = []
|
|
|
+ a.forEach((item) => {
|
|
|
+ console.log('editorFilesDTOList', this.inputForm.editorFilesDTOList)
|
|
|
+ this.inputForm.editorFilesDTOList.push(item)
|
|
|
+ })
|
|
|
+ }, 200)
|
|
|
+ },
|
|
|
+ openOfficeChoose () {
|
|
|
+ this.$refs.officeTreeSelect.init()
|
|
|
+ },
|
|
|
+ getOfficeChoose (list) {
|
|
|
+ let _this = this
|
|
|
+ const wait = () => new Promise((resolve, reject) => {
|
|
|
+ if (_this.commonJS.isEmpty(_this.inputForm.pluginNotifyOfficesDTOList)) {
|
|
|
+ _this.inputForm.pluginNotifyOfficesDTOList = []
|
|
|
+ resolve()
|
|
|
+ } else if (_this.commonJS.isEmpty(list)) {
|
|
|
+ resolve()
|
|
|
+ } else {
|
|
|
+ list.forEach((item, index) => {
|
|
|
+ _this.inputForm.pluginNotifyOfficesDTOList.forEach((office, rowIndex) => {
|
|
|
+ if (item.id === office.officeId || item.name === office.officeName) {
|
|
|
+ this.$refs.officeTable.remove(office)
|
|
|
+ this.inputForm.pluginNotifyOfficesDTOList.splice(rowIndex, 1)
|
|
|
+ this.tableKeyOffice = Math.random()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ resolve()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ wait().then(() => {
|
|
|
+ list.forEach((item) => {
|
|
|
+ let d = {
|
|
|
+ officeName: item.name,
|
|
|
+ officeId: item.id
|
|
|
+ }
|
|
|
+ this.$refs.officeTable.insertAt(d)
|
|
|
+ this.inputForm.pluginNotifyOfficesDTOList.push(d)
|
|
|
+ this.tableKeyOffice = Math.random()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ removeEvent (row, rowIndex, type) {
|
|
|
+ if (type === 'office') {
|
|
|
+ this.$refs.officeTable.remove(row)
|
|
|
+ this.inputForm.pluginNotifyOfficesDTOList.splice(rowIndex, 1)
|
|
|
+ this.tableKeyOffice = Math.random()
|
|
|
+ }
|
|
|
+ if (type === 'user') {
|
|
|
+ this.$refs.userTable.remove(row)
|
|
|
+ this.inputForm.pluginNotifyUserDTOList.splice(rowIndex, 1)
|
|
|
+ this.tableKeyUser = Math.random()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ openUserChoose (value) {
|
|
|
+ if (this.commonJS.isNotEmpty(value)) {
|
|
|
+ this.userService.queryDetailList(value).then(({data}) => {
|
|
|
+ if (this.commonJS.isEmpty(this.inputForm.pluginNotifyUserDTOList)) {
|
|
|
+ this.inputForm.pluginNotifyUserDTOList = []
|
|
|
+ }
|
|
|
+ data.forEach(item => {
|
|
|
+ this.inputForm.pluginNotifyUserDTOList.forEach((user, rowIndex) => {
|
|
|
+ if (this.commonJS.isEmpty(item.name) || user.userName === item.name || user.userId === item.id) {
|
|
|
+ this.$refs.userTable.remove(user)
|
|
|
+ this.inputForm.pluginNotifyUserDTOList.splice(rowIndex, 1)
|
|
|
+ this.tableKeyUser = Math.random()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ data.forEach(item => {
|
|
|
+ let param = {
|
|
|
+ userId: item.id,
|
|
|
+ userName: this.commonJS.isEmpty(item.name) ? '' : item.name,
|
|
|
+ officeName: this.commonJS.isEmpty(item.officeDTO) ? '' : this.commonJS.isEmpty(item.officeDTO.name) ? '' : item.officeDTO.name
|
|
|
+ }
|
|
|
+ this.$refs.userTable.insertAt(param)
|
|
|
+ this.inputForm.pluginNotifyUserDTOList.push(param)
|
|
|
+ this.tableKeyUser = Math.random()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
+<style scoped>
|
|
|
+ /deep/ .w-e-text-container {
|
|
|
+ z-index: 1 !important;
|
|
|
+ }
|
|
|
+ /deep/ .w-e-menu {
|
|
|
+ z-index: 2 !important;
|
|
|
+ }
|
|
|
+ /deep/ .wtext {
|
|
|
+ height: 400px
|
|
|
+ }
|
|
|
+</style>
|