notificationMangePage.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  1. <template>
  2. <div class="notification">
  3. <div class="notificationBtn">
  4. <div class="collectSeach" :style="$utils.collectSeachSty()">
  5. <div class="PeriodBtn">
  6. <btns
  7. :showImport="false"
  8. :showExport="false"
  9. :showRelease="true"
  10. :showCancelRelease="true"
  11. :addName="'新建通告'"
  12. :disSave="changeDateSelect.length === 0 || changeDateSelect.length>1"
  13. :disDelete="changeDateSelect.length === 0"
  14. :disImport="false"
  15. :disExport="false"
  16. @handleAdd="handleAdd"
  17. @handleEdit="handleEdit"
  18. @handleDelete="handleDelete"
  19. @handleRelease="handleRelease"
  20. @handleCancelRelease="handleCancelRelease"
  21. ></btns>
  22. </div>
  23. <div style="display: flex;">
  24. <div class="exceed">
  25. <!-- <span class="exceedSpan">通告标题:</span> -->
  26. <el-input v-model="noticeTitle" placeholder="请输入通告标题"></el-input>
  27. </div>
  28. <seachs :showRest="false" @handleSeach="getSeachData" @handleRest="resetSeach"></seachs>
  29. </div>
  30. </div>
  31. <div class="notificationTableData">
  32. <el-table :data="notificationData" style="width: 100%" @select="rowClick" @select-all="rowClick" :class="notificationTableSty()">
  33. <el-table-column type="selection" label="操作" align="center"></el-table-column>
  34. <!-- <el-table-column label="序号" prop="serialNumber" align="center" width="80"></el-table-column> -->
  35. <el-table-column label="发布状态" prop="releaseState" width="100" align="center">
  36. <template #default="scope">
  37. <span class="statusSty"
  38. :style="scope.row.releaseState === '已发布'?'background:#61C760':scope.row.releaseState === '未发布'?'background:#5093E1':'background:#9DA5BE'">
  39. {{scope.row.releaseState}}
  40. </span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="通告标题" width="200">
  44. <template #default="scope">
  45. <el-tooltip
  46. class="box-item"
  47. effect="customized"
  48. :content="scope.row.noticeTitle"
  49. placement="right"
  50. >
  51. <span class="tooltipCCDes">{{scope.row.noticeTitle}}</span>
  52. </el-tooltip>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="通告内容" width="400">
  56. <template #default="scope">
  57. <el-tooltip
  58. class="box-item"
  59. effect="customized"
  60. :content="scope.row.noticeContent"
  61. placement="right"
  62. >
  63. <span class="tooltipCC">{{scope.row.noticeContent}}</span>
  64. </el-tooltip>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="发布部门" prop="releaseDeptName" width="200" />
  68. <el-table-column label="发布至" prop="sendTo" />
  69. <el-table-column label="发布人" prop="releasePeopleName" />
  70. <el-table-column label="发布时间" prop="createTime" />
  71. <el-table-column label="发布" width="80" align="center">
  72. <template #default="scope">
  73. <img :src="cancelW" style="cursor:pointer" v-if="scope.row.releaseState === '已发布'" @click="changeStatus(scope.row, '未发布')">
  74. <img :src="fabuW" style="cursor:pointer" v-else @click="changeStatus(scope.row, '已发布')">
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="修改" width="80" align="center">
  78. <template #default="scope">
  79. <img :src="editW" style="cursor:pointer" @click="handleEdit(scope.row)">
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="删除" width="80" align="center">
  83. <template #default="scope">
  84. <img :src="deleteW" style="cursor:pointer" @click="handleDelete(scope.row)">
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <el-pagination
  89. @size-change="handleSizeChange"
  90. @current-change="handleCurrentChange"
  91. :current-page="page.currentPage"
  92. :page-size="page.pagesize"
  93. layout="total, prev, pager, next, jumper"
  94. :total="page.total">
  95. </el-pagination>
  96. </div>
  97. <el-dialog :title="title" custom-class="startToDia" v-model="dialogVisible" width="900px" :close-on-click-modal="false">
  98. <div class="notifcaFrom">
  99. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" :validate-on-rule-change="false">
  100. <el-form-item label="公告标题" prop="noticeTitle">
  101. <el-input v-model="ruleForm.noticeTitle" :disabled="isDisable" placeholder="请输入公告标题" />
  102. </el-form-item>
  103. <el-form-item label="公告内容" prop="noticeContent">
  104. <!-- <pre v-if="isSave">{{ruleForm.noticeContent}}</pre> -->
  105. <el-input v-model="ruleForm.noticeContent" :disabled="isDisable"
  106. type="textarea" :rows="10" placeholder="请输入公告内容"></el-input>
  107. </el-form-item>
  108. <el-form-item label="发布对象" prop="sendTo">
  109. <el-select v-model="ruleForm.sendTo" :disabled="isDisable" placeholder="请选择发布对象">
  110. <el-option
  111. v-for="item in sendToData"
  112. :key="item.value"
  113. :label="item.label"
  114. :value="item.value">
  115. </el-option>
  116. </el-select>
  117. </el-form-item>
  118. <el-row>
  119. <el-col :span="12" v-if="ruleForm.sendTo === '个别部门'">
  120. <el-form-item label="个别部门" prop="sendToContent">
  121. <el-select v-model="ruleForm.sendToContent" :disabled="isDisable" multiple collapse-tags placeholder="请选择部门">
  122. <el-option
  123. v-for="item in departData"
  124. :key="item.id"
  125. :label="item.name"
  126. :value="item.id">
  127. </el-option>
  128. </el-select>
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="12">
  132. <el-form-item label="排序">
  133. <el-input-number v-model="ruleForm.serialNumber" :disabled="isDisable" :min="1" />
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. <el-form-item label="">
  138. <div class="uploadFiles">
  139. <el-upload
  140. :file-list="filesList"
  141. multiple
  142. limit="3"
  143. :auto-upload="false"
  144. :show-file-list="false"
  145. >
  146. <el-button
  147. color="#3B7AD1"
  148. size="mini"
  149. :disabled="isDisable"
  150. >
  151. <img :src="fileW" style="margin-right: 10px">
  152. <span>添加附件</span>
  153. </el-button>
  154. <template #tip>
  155. <div class="el-upload__tip">
  156. 最多上传3个文件
  157. </div>
  158. </template>
  159. </el-upload>
  160. </div>
  161. </el-form-item>
  162. <el-form-item label="">
  163. <div class="fliesHeader">
  164. <span>附件名</span>
  165. <span>发送单位</span>
  166. <span>操作</span>
  167. </div>
  168. <div v-if="!isSave" style="width: 100%">
  169. <div v-for="it in filesList" :key="it.uid">
  170. <div class="fliesMain">
  171. <div>
  172. <img :src="file" style="margin-right: 10px" >
  173. <span class="fliesMainSpan spanOne">{{it.name}}</span>
  174. </div>
  175. <span class="fliesMainSpan spanTwo">{{userMes.unitName}}</span>
  176. <!-- <span class="fliesMainSpan spanTwo">测试</span> -->
  177. <div class="removeDiv">
  178. <!-- <div @click="previewFile(it)" style="cursor:pointer">
  179. <img :src="yulan" style="margin-right: 10px;" >
  180. <span>预览</span>
  181. </div> -->
  182. <div @click="removeFile(it)" style="cursor:pointer">
  183. <img :src="fileDelete" class="removeImg">
  184. <span>删除</span>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. <div v-else>
  191. <div v-for="it in filesList" :key="it.uid">
  192. <div class="fliesMain">
  193. <div>
  194. <img :src="file" style="margin-right: 10px" >
  195. <span class="fliesMainSpan spanOne">{{it.name}}</span>
  196. </div>
  197. <span class="fliesMainSpan spanTwo">{{it.releaseDeptName}}</span>
  198. <div class="removeDiv">
  199. <!-- <div @click="previewFile(it)" style="cursor:pointer">
  200. <img :src="yulan" style="margin-right: 10px;" >
  201. <span>预览</span>
  202. </div> -->
  203. <div @click="removeFile(it)" style="cursor:pointer">
  204. <img :src="fileDelete" class="removeImg">
  205. <span>删除</span>
  206. </div>
  207. </div>
  208. </div>
  209. </div>
  210. <div v-for="it in filesListEdit" :key="it">
  211. <div class="fliesMain">
  212. <div>
  213. <img :src="file" style="margin-right: 10px" >
  214. <span class="fliesMainSpan spanOne">{{it}}</span>
  215. </div>
  216. <span class="fliesMainSpan spanTwo">{{it.releaseDeptName}}</span>
  217. <div class="fileOperate">
  218. <div @click="previewFile(it)" style="cursor:pointer">
  219. <img :src="yulan" style="margin-right: 10px;" >
  220. <span>预览</span>
  221. </div>
  222. <div @click="removeFileFn(it)" style="cursor:pointer">
  223. <img :src="fileDelete" class="removeImg">
  224. <span>删除</span>
  225. </div>
  226. </div>
  227. </div>
  228. </div>
  229. </div>
  230. </el-form-item>
  231. </el-form>
  232. </div>
  233. <template #footer>
  234. <span class="notificationFooter">
  235. <el-button type="primary" size="mini" @click="saveevaluaStart('ruleForm', '发布')">
  236. <img :src="release" style="margin-right: 10px">
  237. <span>发布公告</span>
  238. </el-button>
  239. <el-button type="warning" size="mini" @click="saveevaluaStart('ruleForm', '草稿')">
  240. <img :src="draft" style="margin-right: 10px">
  241. <span>保存草稿</span>
  242. </el-button>
  243. <!-- <el-button @click="saveevaluaStart('ruleForm', '取消')">取 消</el-button> -->
  244. </span>
  245. </template>
  246. </el-dialog>
  247. <el-dialog title="预览" v-model="filesVisible" :fullscreen="true" :close-on-click-modal="false">
  248. <!-- <div v-html="filesConcent"></div> -->
  249. <iframe src="file:///C:/fakepath/数据导出 (29).xlsx" frameborder="0" width="100%" height="100%"></iframe>
  250. </el-dialog>
  251. </div>
  252. </div>
  253. </template>
  254. <script>
  255. import btns from '../elbuttonS.vue'
  256. import seachs from '../seachGroup.vue'
  257. import fabuW from '../../assets/btnIcon/fabuW.png'
  258. import cancelW from '../../assets/btnIcon/cancelW.png'
  259. import editW from '../../assets/btnIcon/edit.png'
  260. import deleteW from '../../assets/btnIcon/delete.png'
  261. import fileW from '../../assets/btnIcon/fileW.png'
  262. import file from '../../assets/btnIcon/file.png'
  263. import yulan from '../../assets/btnIcon/yulan.png'
  264. import fileDelete from '../../assets/btnIcon/fileDelete.png'
  265. import draft from '../../assets/btnIcon/draft.png'
  266. import release from '../../assets/btnIcon/release.png'
  267. import {apiGetevaluationdeptnoticeList, apiGetevaluationdeptnoticeSave,apievaluationdeptnoticeDelete,apiGetuploadAttachment,
  268. apiGetorganizationstructureFromTree, apiPostevaluationdeptnoticeDelete, apiPostevaluationdeptnoticeModifiedState,
  269. apiGetevaluationdeptnoticeFilePreview} from '../../api/api'
  270. export default {
  271. components: {
  272. btns,
  273. seachs
  274. },
  275. data() {
  276. return {
  277. winPix: window.devicePixelRatio,
  278. dialogVisible: false,
  279. filesVisible: false,
  280. isSave: false,
  281. isDisable: false,
  282. title: '',
  283. evalradio: {},
  284. changeDateSelect: [],
  285. notificationData:[],
  286. filesData: [],
  287. departData: [],
  288. sendToData: [],
  289. fabuW: fabuW,
  290. cancelW: cancelW,
  291. editW: editW,
  292. deleteW: deleteW,
  293. draft: draft,
  294. release: release,
  295. fileW: fileW,
  296. file: file,
  297. yulan: yulan,
  298. fileDelete: fileDelete,
  299. page:{
  300. pagesize: 12,
  301. currentPage: 1,
  302. total: 0
  303. },
  304. ruleForm: {
  305. serialNumber: 1,
  306. noticeTitle: '',
  307. noticeContent: '',
  308. sendTo: '',
  309. sendToContent: [],
  310. releaseDept: '',
  311. releasePeople: '',
  312. },
  313. filesList: [],
  314. filesListEdit: [],
  315. filesConcent: '',
  316. filesUrl: '',
  317. rules: {
  318. noticeTitle: [
  319. { required: true, message: '请输入通告标题', trigger: 'blur' }
  320. ],
  321. noticeContent: [
  322. { required: true, message: '请输入通告内容', trigger: 'blur' }
  323. ],
  324. sendTo: [
  325. { required: true, message: '请选择通告对象', trigger: 'change' }
  326. ],
  327. sendToContent: [
  328. { required: true, message: '请选择个别部门', trigger: 'change' }
  329. ]
  330. },
  331. noticeTitle: '',
  332. userMes: {},
  333. headers: { "Content-Type": "multipart/form-data" },
  334. fileType: [ "pdf", "doc", "docx", "xls", "xlsx","txt","png","jpg", "bmp", "jpeg"]
  335. }
  336. },
  337. created() {
  338. this.userMes = JSON.parse(window.sessionStorage.getItem('user'))
  339. this.sendToData = [
  340. {
  341. label: '所有单位',
  342. value: '所有单位'
  343. },
  344. {
  345. label: '本部部门',
  346. value: '本部部门'
  347. },
  348. {
  349. label: '个别部门',
  350. value: '个别部门'
  351. }
  352. ]
  353. this.getevalunotificationList()
  354. this.getDepartmentFromTreeData()
  355. },
  356. methods:{
  357. // 查询列表页面
  358. getevalunotificationList() {
  359. let that = this
  360. let params = {
  361. pageNum: that.page.currentPage,
  362. pageSize: that.page.pagesize,
  363. noticeTitle: that.noticeTitle
  364. }
  365. apiGetevaluationdeptnoticeList(params).then(datas =>{
  366. if (datas && datas.data) {
  367. that.notificationData = datas.data.records
  368. that.page.total = datas.data.total
  369. }
  370. })
  371. },
  372. // 查询部门
  373. getDepartmentFromTreeData() {
  374. let that = this
  375. let params = {
  376. id: '23031001',
  377. num: 1,
  378. type: 140
  379. }
  380. apiGetorganizationstructureFromTree(params).then(datas =>{
  381. if (datas && datas.data) {
  382. that.departData = datas.data[0].children
  383. }
  384. })
  385. },
  386. notificationTableSty() {
  387. if (this.winPix === 1.25) {
  388. return 'notification125Table'
  389. } else {
  390. return 'notification100Table'
  391. }
  392. },
  393. notificationFn() {
  394. if (this.notificationData.length>0) {
  395. notificationData.slice((page.currentPage-1)*page.pagesize, page.currentPage*page.pagesize)
  396. }
  397. },
  398. //修改状态
  399. changeStatus(row, type) {
  400. let that = this
  401. let params = {
  402. ids: row.id,
  403. releaseState: type
  404. }
  405. apiPostevaluationdeptnoticeModifiedState(params).then(datas =>{
  406. if (datas.success) {
  407. that.getevalunotificationList()
  408. }
  409. })
  410. },
  411. handleRelease() {
  412. this.changeDataRelease('已发布')
  413. },
  414. handleCancelRelease() {
  415. this.changeDataRelease('未发布')
  416. },
  417. //多个数据发布或取消发布
  418. changeDataRelease(type) {
  419. let that = this
  420. let idsArr = []
  421. that.changeDateSelect.forEach(item =>{
  422. idsArr.push(item.id)
  423. })
  424. let params = {
  425. ids: idsArr.join(','),
  426. releaseState: type
  427. }
  428. apiPostevaluationdeptnoticeModifiedState(params).then(datas =>{
  429. if (datas.success) {
  430. that.getevalunotificationList()
  431. }
  432. })
  433. },
  434. saveevaluaStart(formName, type) {
  435. let that = this
  436. that.$refs[formName].validate((valid) => {
  437. if (valid) {
  438. that.saveAndEditnotificationData(type)
  439. }
  440. });
  441. },
  442. //新增/修改考评启动数据
  443. saveAndEditnotificationData(type) {
  444. let that = this
  445. let params = {
  446. serialNumber: that.ruleForm.serialNumber,
  447. noticeTitle: that.ruleForm.noticeTitle,
  448. noticeContent: that.ruleForm.noticeContent,
  449. sendTo: that.ruleForm.sendTo,
  450. sendToContent: that.ruleForm.sendToContent.join(','),
  451. releaseState: type === '草稿'? '草稿': type === '发布'?'已发布':'未发布',
  452. releaseDept: that.userMes.deptId,
  453. releaseDeptName: that.userMes.deptName,
  454. releasePeople: that.userMes.id,
  455. releasePeopleName: that.userMes.name
  456. }
  457. if (type === '发布') {
  458. params.releaseDate = new Date()
  459. }
  460. if (that.isSave) {
  461. params.id = that.evalradio.id
  462. }
  463. // formData.append('deptNames', 'deptNames')
  464. apiGetevaluationdeptnoticeSave(params).then(datas =>{
  465. if (!datas.success) {
  466. that.$message({
  467. message: datas.message,
  468. type: 'error'
  469. });
  470. } else {
  471. const formData = new FormData()
  472. if (that.filesList.length>0) {
  473. that.filesList.forEach(item =>{
  474. formData.append('files', item.raw)
  475. })
  476. apiGetuploadAttachment({id: datas.data}, formData).then(request =>{
  477. if (request.success) {
  478. if (!that.isSave) {
  479. that.$message({
  480. message: '通告新增成功',
  481. type: 'success'
  482. });
  483. } else {
  484. that.$message({
  485. message: '通告修改成功',
  486. type: 'success'
  487. });
  488. }
  489. that.dialogVisible = false
  490. that.changeDateSelect = []
  491. that.getevalunotificationList()
  492. }
  493. })
  494. } else {
  495. if (!that.isSave) {
  496. that.$message({
  497. message: '通告新增成功',
  498. type: 'success'
  499. });
  500. } else {
  501. that.$message({
  502. message: '通告修改成功',
  503. type: 'success'
  504. });
  505. }
  506. that.dialogVisible = false
  507. that.changeDateSelect = []
  508. that.getevalunotificationList()
  509. }
  510. }
  511. })
  512. },
  513. getSeachData() {
  514. this.page.currentPage = 1
  515. this.getevalunotificationList()
  516. },
  517. resetSeach() {
  518. this.page.currentPage = 1
  519. this.noticeTitle = ''
  520. this.getevalunotificationList()
  521. },
  522. handleSizeChange(val){
  523. this.page.pagesize = val
  524. this.getevalunotificationList()
  525. },
  526. handleCurrentChange(val){
  527. this.page.currentPage =val
  528. this.getevalunotificationList()
  529. },
  530. rowClick(selection, row) {
  531. this.changeDateSelect = selection
  532. },
  533. handleAdd() {
  534. this.dialogVisible = true
  535. this.isSave = false
  536. this.isDisable = false
  537. this.title = '公告发布'
  538. this.$nextTick(() =>{
  539. this.$refs['ruleForm'].resetFields()
  540. this.filesList = []
  541. this.ruleForm = {
  542. serialNumber: 1,
  543. noticeTitle: '',
  544. noticeContent: '',
  545. sendTo: '',
  546. sendToContent: [],
  547. releaseDept: '',
  548. releasePeople: ''
  549. }
  550. })
  551. },
  552. handleEdit(row) {
  553. this.dialogVisible = true
  554. this.isSave = true
  555. this.isDisable = false
  556. this.title = '公告发布'
  557. this.filesList = []
  558. this.filesListEdit = []
  559. if (row) {
  560. this.evalradio = row
  561. } else {
  562. this.evalradio = this.changeDateSelect[0]
  563. }
  564. if (this.evalradio.releaseState === '已发布') {
  565. this.isDisable = true
  566. }
  567. // let conStr = ''
  568. // for(let i in this.evalradio.noticeContent) {
  569. // let it = this.evalradio.noticeContent[i]
  570. // if (it === ' ' && i !== 0 && this.evalradio.noticeContent[i-1] !== ' ') {
  571. // it = it+'\n'
  572. // }
  573. // conStr += it
  574. // }
  575. this.ruleForm = {
  576. serialNumber: this.evalradio.serialNumber*1,
  577. noticeTitle: this.evalradio.noticeTitle,
  578. noticeContent: this.evalradio.noticeContent,
  579. sendTo: this.evalradio.sendTo,
  580. sendToContent: this.evalradio.sendToContent.split(','),
  581. releaseDept: this.evalradio.releaseDept,
  582. releasePeople: this.evalradio.releasePeople
  583. }
  584. if (this.evalradio.noticeAnnex !== '') {
  585. let filesArr = this.evalradio.noticeAnnex.split(',')
  586. this.filesListEdit = filesArr
  587. }
  588. // filesArr.forEach(item =>{
  589. // let str = item.substring(item.lastIndexOf('/')+1, item.length)
  590. // this.filesListEdit.push(str)
  591. // })
  592. },
  593. //删除
  594. handleDelete(row) {
  595. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  596. confirmButtonText: '确定',
  597. cancelButtonText: '取消',
  598. type: 'warning'
  599. }).then(() => {
  600. let that = this
  601. let paramsStr = ''
  602. if (row) {
  603. paramsStr = row.id
  604. } else {
  605. let paramsArr = []
  606. that.changeDateSelect.forEach(it =>{
  607. paramsArr.push(it.id)
  608. })
  609. paramsStr = paramsArr.join(',')
  610. }
  611. apiPostevaluationdeptnoticeDelete(paramsStr).then(datas =>{
  612. that.$message({
  613. type: 'success',
  614. message: '删除成功!'
  615. });
  616. that.getevalunotificationList()
  617. that.changeDateSelect = []
  618. })
  619. })
  620. },
  621. //上传文件之前验证文件类型和大小
  622. beforeUpload(file) {
  623. // this.ruleForm.files = []
  624. if (file.type != "" || file.type != null || file.type != undefined){
  625. //截取文件的后缀,判断文件类型
  626. const FileExt = file.name.replace(/.+\./, "").toLowerCase();
  627. //计算文件的大小
  628. const isLt5M = file.size / 1024 / 1024 < 5; //这里做文件大小限制
  629. //如果大于5M
  630. if (!isLt5M) {
  631. this.$message({
  632. message: '上传文件大小不能超过 5MB!',
  633. type: 'info'
  634. });
  635. return false;
  636. }
  637. //如果文件类型不在允许上传的范围内
  638. if(this.fileType.includes(FileExt)){
  639. return true;
  640. }
  641. else {
  642. this.$message.error("上传文件格式不正确!");
  643. return false;
  644. }
  645. }
  646. },
  647. previewFile(it) {
  648. // this.filesVisible = true
  649. let params = {
  650. url: it
  651. }
  652. apiGetevaluationdeptnoticeFilePreview(params).then(datas =>{
  653. if (datas) {
  654. // const blob = new Blob([datas], {type: 'application/pdf'})
  655. // const url = URL.createObjectURL(blob)
  656. // window.open(url)
  657. // console.log('files', datas)
  658. window.open(datas.data, 'target')
  659. }
  660. })
  661. },
  662. //移除文件
  663. removeFile(item) {
  664. for (var i in this.filesList) {
  665. if (item.name == this.filesList[i].name) {
  666. this.filesList.splice(i, 1)
  667. }
  668. }
  669. },
  670. removeFileFn(item) {
  671. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  672. confirmButtonText: '确定',
  673. cancelButtonText: '取消',
  674. type: 'warning'
  675. }).then(() => {
  676. let that = this
  677. let params = {
  678. id: that.evalradio.id,
  679. noticeAnnex: item
  680. }
  681. apievaluationdeptnoticeDelete(params).then(datas =>{
  682. if (datas.success) {
  683. that.filesListEdit.forEach((it, index) =>{
  684. if (it === item) {
  685. that.filesListEdit.splice(index, 1)
  686. }
  687. })
  688. } else {
  689. this.$message({
  690. message: datas.message,
  691. type: 'error'
  692. });
  693. }
  694. })
  695. })
  696. }
  697. }
  698. }
  699. </script>
  700. <style lang="less">
  701. .notification{
  702. .notificationBtn{
  703. .collectSeach{
  704. display: flex;
  705. padding: 24px 20px 24px 0;
  706. border-bottom: 1px solid#D6DBEA;
  707. justify-content: space-between;
  708. .exceed{
  709. display: flex;
  710. .exceedSpan{
  711. width: 100px;
  712. height: 12px;
  713. font-size: 14px;
  714. font-family: Microsoft YaHei;
  715. font-weight: 400;
  716. color: #8991B0;
  717. line-height: 12px;
  718. margin-top: 14px;
  719. }
  720. .el-input{
  721. margin-right:10px;
  722. height: 40px;
  723. .el-input__inner{
  724. height:40px;
  725. }
  726. .el-input__suffix{
  727. .el-select__caret{
  728. line-height:30px;
  729. }
  730. }
  731. }
  732. }
  733. .el-select{
  734. margin-right:10px;
  735. .el-input__inner{
  736. height:30px;
  737. }
  738. .el-input__suffix{
  739. .el-select__caret{
  740. line-height:30px;
  741. }
  742. }
  743. }
  744. }
  745. span{
  746. font-size:14px;
  747. }
  748. .PeriodBtn{
  749. display: flex;
  750. justify-content: end;
  751. }
  752. .el-button{
  753. height: 30px;
  754. // width:100px;
  755. padding: 0 20px ;
  756. // padding-top: 8px;
  757. span{
  758. margin:0;
  759. }
  760. }
  761. .notificationTableData{
  762. margin-top: 20px;
  763. .notification125Table{
  764. .el-table__body-wrapper{
  765. height: 60vh !important;
  766. }
  767. }
  768. .notification100Table{
  769. .el-table__body-wrapper{
  770. height: 65vh !important;
  771. }
  772. }
  773. .el-table{
  774. .el-input__inner{
  775. height: 30px !important;
  776. }
  777. .el-radio__label{
  778. display: none;
  779. }
  780. .statusSty{
  781. width: 52px;
  782. height: 21px;
  783. line-height: 21px;
  784. display: inline-block;
  785. border-radius: 3px;
  786. color: #fff;
  787. }
  788. .tooltipCC{
  789. width: 300px !important;
  790. display: inline-block;
  791. overflow: hidden;
  792. text-overflow: ellipsis;
  793. white-space: nowrap;
  794. }
  795. .tooltipCCDes{
  796. width: 200px;
  797. display: inline-block;
  798. overflow: hidden;
  799. text-overflow: ellipsis;
  800. white-space: nowrap;
  801. }
  802. .indicitem{
  803. color: #409EFF;
  804. font-size: 12px;
  805. margin-right: 20px;
  806. cursor:pointer;
  807. &:hover{
  808. text-decoration: underline;
  809. }
  810. }
  811. }
  812. .el-pagination{
  813. margin-top: 20px;
  814. text-align: end;
  815. position: relative;
  816. }
  817. }
  818. .el-overlay{
  819. .startToDia{
  820. margin-top: 3vh;
  821. background: #EDEFF5;
  822. .el-dialog__body{
  823. padding: 30px 60px 30px 20px !important;
  824. .notifcaFrom{
  825. .el-select, .el-input{
  826. width: 100%;
  827. }
  828. .el-input{
  829. height: 30px;
  830. }
  831. .uploadFiles{
  832. .el-button{
  833. height: 25px !important;
  834. }
  835. }
  836. .fliesHeader{
  837. width: 100%;
  838. display: flex;
  839. justify-content: space-around;
  840. }
  841. .fliesMain{
  842. width: 100%;
  843. display: flex;
  844. .fliesMainSpan{
  845. display: inline-block;
  846. width: 260px;
  847. overflow: hidden;
  848. text-overflow: ellipsis;
  849. white-space: nowrap;
  850. }
  851. .spanOne{
  852. color: #1063CB;
  853. }
  854. .spanTwo{
  855. text-align: center;
  856. }
  857. .fileOperate{
  858. width: 160px;
  859. display: flex;
  860. justify-content: space-around;
  861. .removeImg{
  862. margin-right: 10px;
  863. position: relative;
  864. top: 2px;
  865. }
  866. }
  867. .removeDiv{
  868. width: 160px;
  869. .removeImg{
  870. margin: 0 10px 0 20px;
  871. position: relative;
  872. top: 3px;
  873. }
  874. }
  875. }
  876. }
  877. .flowSty{
  878. width: 100%;
  879. height: 70vh;
  880. }
  881. }
  882. .el-dialog__footer{
  883. background: #fff;
  884. border-radius: 0 0 10px 10px;
  885. text-align: left;
  886. padding-top: 20px !important;
  887. .notificationFooter{
  888. margin-left: 20px;
  889. .el-button{
  890. height: 40px !important;
  891. }
  892. }
  893. }
  894. }
  895. }
  896. }
  897. }
  898. </style>