notificationMangePage.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  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. innerWidth: window.innerWidth,
  279. dialogVisible: false,
  280. filesVisible: false,
  281. isSave: false,
  282. isDisable: false,
  283. title: '',
  284. evalradio: {},
  285. changeDateSelect: [],
  286. notificationData:[],
  287. filesData: [],
  288. departData: [],
  289. sendToData: [],
  290. fabuW: fabuW,
  291. cancelW: cancelW,
  292. editW: editW,
  293. deleteW: deleteW,
  294. draft: draft,
  295. release: release,
  296. fileW: fileW,
  297. file: file,
  298. yulan: yulan,
  299. fileDelete: fileDelete,
  300. page:{
  301. pagesize: 12,
  302. currentPage: 1,
  303. total: 0
  304. },
  305. ruleForm: {
  306. serialNumber: 1,
  307. noticeTitle: '',
  308. noticeContent: '',
  309. sendTo: '',
  310. sendToContent: [],
  311. releaseDept: '',
  312. releasePeople: '',
  313. },
  314. filesList: [],
  315. filesListEdit: [],
  316. filesConcent: '',
  317. filesUrl: '',
  318. rules: {
  319. noticeTitle: [
  320. { required: true, message: '请输入通告标题', trigger: 'blur' }
  321. ],
  322. noticeContent: [
  323. { required: true, message: '请输入通告内容', trigger: 'blur' }
  324. ],
  325. sendTo: [
  326. { required: true, message: '请选择通告对象', trigger: 'change' }
  327. ],
  328. sendToContent: [
  329. { required: true, message: '请选择个别部门', trigger: 'change' }
  330. ]
  331. },
  332. noticeTitle: '',
  333. userMes: {},
  334. headers: { "Content-Type": "multipart/form-data" },
  335. fileType: [ "pdf", "doc", "docx", "xls", "xlsx","txt","png","jpg", "bmp", "jpeg"]
  336. }
  337. },
  338. created() {
  339. this.userMes = JSON.parse(window.sessionStorage.getItem('user'))
  340. this.sendToData = [
  341. {
  342. label: '所有单位',
  343. value: '所有单位'
  344. },
  345. {
  346. label: '本部部门',
  347. value: '本部部门'
  348. },
  349. {
  350. label: '个别部门',
  351. value: '个别部门'
  352. }
  353. ]
  354. this.getevalunotificationList()
  355. this.getDepartmentFromTreeData()
  356. },
  357. methods:{
  358. // 查询列表页面
  359. getevalunotificationList() {
  360. let that = this
  361. let params = {
  362. pageNum: that.page.currentPage,
  363. pageSize: that.page.pagesize,
  364. noticeTitle: that.noticeTitle
  365. }
  366. apiGetevaluationdeptnoticeList(params).then(datas =>{
  367. if (datas && datas.data) {
  368. that.notificationData = datas.data.records
  369. that.page.total = datas.data.total
  370. }
  371. })
  372. },
  373. // 查询部门
  374. getDepartmentFromTreeData() {
  375. let that = this
  376. let params = {
  377. id: '23031001',
  378. num: 1,
  379. type: 140
  380. }
  381. apiGetorganizationstructureFromTree(params).then(datas =>{
  382. if (datas && datas.data) {
  383. that.departData = datas.data[0].children
  384. }
  385. })
  386. },
  387. notificationTableSty() {
  388. if (this.winPix === 1.25 || this.innerWidth < 1800) {
  389. return 'notification125Table'
  390. } else {
  391. return 'notification100Table'
  392. }
  393. },
  394. notificationFn() {
  395. if (this.notificationData.length>0) {
  396. notificationData.slice((page.currentPage-1)*page.pagesize, page.currentPage*page.pagesize)
  397. }
  398. },
  399. //修改状态
  400. changeStatus(row, type) {
  401. let that = this
  402. let params = {
  403. ids: row.id,
  404. releaseState: type
  405. }
  406. apiPostevaluationdeptnoticeModifiedState(params).then(datas =>{
  407. if (datas.success) {
  408. that.getevalunotificationList()
  409. }
  410. })
  411. },
  412. handleRelease() {
  413. this.changeDataRelease('已发布')
  414. },
  415. handleCancelRelease() {
  416. this.changeDataRelease('未发布')
  417. },
  418. //多个数据发布或取消发布
  419. changeDataRelease(type) {
  420. let that = this
  421. let idsArr = []
  422. that.changeDateSelect.forEach(item =>{
  423. idsArr.push(item.id)
  424. })
  425. let params = {
  426. ids: idsArr.join(','),
  427. releaseState: type
  428. }
  429. apiPostevaluationdeptnoticeModifiedState(params).then(datas =>{
  430. if (datas.success) {
  431. that.getevalunotificationList()
  432. }
  433. })
  434. },
  435. saveevaluaStart(formName, type) {
  436. let that = this
  437. that.$refs[formName].validate((valid) => {
  438. if (valid) {
  439. that.saveAndEditnotificationData(type)
  440. }
  441. });
  442. },
  443. //新增/修改考评启动数据
  444. saveAndEditnotificationData(type) {
  445. let that = this
  446. let params = {
  447. serialNumber: that.ruleForm.serialNumber,
  448. noticeTitle: that.ruleForm.noticeTitle,
  449. noticeContent: that.ruleForm.noticeContent,
  450. sendTo: that.ruleForm.sendTo,
  451. sendToContent: that.ruleForm.sendToContent.join(','),
  452. releaseState: type === '草稿'? '草稿': type === '发布'?'已发布':'未发布',
  453. releaseDept: that.userMes.deptId,
  454. releaseDeptName: that.userMes.deptName,
  455. releasePeople: that.userMes.id,
  456. releasePeopleName: that.userMes.name
  457. }
  458. if (type === '发布') {
  459. params.releaseDate = that.$utils.getAllTime(new Date())
  460. }
  461. if (that.isSave) {
  462. params.id = that.evalradio.id
  463. }
  464. // formData.append('deptNames', 'deptNames')
  465. apiGetevaluationdeptnoticeSave(params).then(datas =>{
  466. if (!datas.success) {
  467. that.$message({
  468. message: datas.message,
  469. type: 'error'
  470. });
  471. } else {
  472. const formData = new FormData()
  473. if (that.filesList.length>0) {
  474. that.filesList.forEach(item =>{
  475. formData.append('files', item.raw)
  476. })
  477. apiGetuploadAttachment({id: datas.data}, formData).then(request =>{
  478. if (request.success) {
  479. if (!that.isSave) {
  480. that.$message({
  481. message: '通告新增成功',
  482. type: 'success'
  483. });
  484. } else {
  485. that.$message({
  486. message: '通告修改成功',
  487. type: 'success'
  488. });
  489. }
  490. that.dialogVisible = false
  491. that.changeDateSelect = []
  492. that.getevalunotificationList()
  493. }
  494. })
  495. } else {
  496. if (!that.isSave) {
  497. that.$message({
  498. message: '通告新增成功',
  499. type: 'success'
  500. });
  501. } else {
  502. that.$message({
  503. message: '通告修改成功',
  504. type: 'success'
  505. });
  506. }
  507. that.dialogVisible = false
  508. that.changeDateSelect = []
  509. that.getevalunotificationList()
  510. }
  511. }
  512. })
  513. },
  514. getSeachData() {
  515. this.page.currentPage = 1
  516. this.getevalunotificationList()
  517. },
  518. resetSeach() {
  519. this.page.currentPage = 1
  520. this.noticeTitle = ''
  521. this.getevalunotificationList()
  522. },
  523. handleSizeChange(val){
  524. this.page.pagesize = val
  525. this.getevalunotificationList()
  526. },
  527. handleCurrentChange(val){
  528. this.page.currentPage =val
  529. this.getevalunotificationList()
  530. },
  531. rowClick(selection, row) {
  532. this.changeDateSelect = selection
  533. },
  534. handleAdd() {
  535. this.dialogVisible = true
  536. this.isSave = false
  537. this.isDisable = false
  538. this.title = '公告发布'
  539. this.$nextTick(() =>{
  540. this.$refs['ruleForm'].resetFields()
  541. this.filesList = []
  542. this.ruleForm = {
  543. serialNumber: 1,
  544. noticeTitle: '',
  545. noticeContent: '',
  546. sendTo: '',
  547. sendToContent: [],
  548. releaseDept: '',
  549. releasePeople: ''
  550. }
  551. })
  552. },
  553. handleEdit(row) {
  554. this.dialogVisible = true
  555. this.isSave = true
  556. this.isDisable = false
  557. this.title = '公告发布'
  558. this.filesList = []
  559. this.filesListEdit = []
  560. if (row) {
  561. this.evalradio = row
  562. } else {
  563. this.evalradio = this.changeDateSelect[0]
  564. }
  565. if (this.evalradio.releaseState === '已发布') {
  566. this.isDisable = true
  567. }
  568. // let conStr = ''
  569. // for(let i in this.evalradio.noticeContent) {
  570. // let it = this.evalradio.noticeContent[i]
  571. // if (it === ' ' && i !== 0 && this.evalradio.noticeContent[i-1] !== ' ') {
  572. // it = it+'\n'
  573. // }
  574. // conStr += it
  575. // }
  576. this.ruleForm = {
  577. serialNumber: this.evalradio.serialNumber*1,
  578. noticeTitle: this.evalradio.noticeTitle,
  579. noticeContent: this.evalradio.noticeContent,
  580. sendTo: this.evalradio.sendTo,
  581. sendToContent: this.evalradio.sendToContent.split(','),
  582. releaseDept: this.evalradio.releaseDept,
  583. releasePeople: this.evalradio.releasePeople
  584. }
  585. if (this.evalradio.noticeAnnex !== '') {
  586. let filesArr = this.evalradio.noticeAnnex.split(',')
  587. this.filesListEdit = filesArr
  588. }
  589. // filesArr.forEach(item =>{
  590. // let str = item.substring(item.lastIndexOf('/')+1, item.length)
  591. // this.filesListEdit.push(str)
  592. // })
  593. },
  594. //删除
  595. handleDelete(row) {
  596. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  597. confirmButtonText: '确定',
  598. cancelButtonText: '取消',
  599. type: 'warning'
  600. }).then(() => {
  601. let that = this
  602. let paramsStr = ''
  603. if (row) {
  604. paramsStr = row.id
  605. } else {
  606. let paramsArr = []
  607. that.changeDateSelect.forEach(it =>{
  608. paramsArr.push(it.id)
  609. })
  610. paramsStr = paramsArr.join(',')
  611. }
  612. apiPostevaluationdeptnoticeDelete(paramsStr).then(datas =>{
  613. that.$message({
  614. type: 'success',
  615. message: '删除成功!'
  616. });
  617. that.getevalunotificationList()
  618. that.changeDateSelect = []
  619. })
  620. })
  621. },
  622. //上传文件之前验证文件类型和大小
  623. beforeUpload(file) {
  624. // this.ruleForm.files = []
  625. if (file.type != "" || file.type != null || file.type != undefined){
  626. //截取文件的后缀,判断文件类型
  627. const FileExt = file.name.replace(/.+\./, "").toLowerCase();
  628. //计算文件的大小
  629. const isLt5M = file.size / 1024 / 1024 < 5; //这里做文件大小限制
  630. //如果大于5M
  631. if (!isLt5M) {
  632. this.$message({
  633. message: '上传文件大小不能超过 5MB!',
  634. type: 'info'
  635. });
  636. return false;
  637. }
  638. //如果文件类型不在允许上传的范围内
  639. if(this.fileType.includes(FileExt)){
  640. return true;
  641. }
  642. else {
  643. this.$message.error("上传文件格式不正确!");
  644. return false;
  645. }
  646. }
  647. },
  648. previewFile(it) {
  649. // this.filesVisible = true
  650. let params = {
  651. url: it
  652. }
  653. apiGetevaluationdeptnoticeFilePreview(params).then(datas =>{
  654. if (datas) {
  655. // const blob = new Blob([datas], {type: 'application/pdf'})
  656. // const url = URL.createObjectURL(blob)
  657. // window.open(url)
  658. // console.log('files', datas)
  659. window.open(datas.data, 'target')
  660. }
  661. })
  662. },
  663. //移除文件
  664. removeFile(item) {
  665. for (var i in this.filesList) {
  666. if (item.name == this.filesList[i].name) {
  667. this.filesList.splice(i, 1)
  668. }
  669. }
  670. },
  671. removeFileFn(item) {
  672. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  673. confirmButtonText: '确定',
  674. cancelButtonText: '取消',
  675. type: 'warning'
  676. }).then(() => {
  677. let that = this
  678. let params = {
  679. id: that.evalradio.id,
  680. noticeAnnex: item
  681. }
  682. apievaluationdeptnoticeDelete(params).then(datas =>{
  683. if (datas.success) {
  684. that.filesListEdit.forEach((it, index) =>{
  685. if (it === item) {
  686. that.filesListEdit.splice(index, 1)
  687. }
  688. })
  689. } else {
  690. this.$message({
  691. message: datas.message,
  692. type: 'error'
  693. });
  694. }
  695. })
  696. })
  697. }
  698. }
  699. }
  700. </script>
  701. <style lang="less">
  702. .notification{
  703. .notificationBtn{
  704. .collectSeach{
  705. display: flex;
  706. padding: 24px 20px 24px 0;
  707. border-bottom: 1px solid#D6DBEA;
  708. justify-content: space-between;
  709. .exceed{
  710. display: flex;
  711. .exceedSpan{
  712. width: 100px;
  713. height: 12px;
  714. font-size: 14px;
  715. font-family: Microsoft YaHei;
  716. font-weight: 400;
  717. color: #8991B0;
  718. line-height: 12px;
  719. margin-top: 14px;
  720. }
  721. .el-input{
  722. margin-right:10px;
  723. height: 40px;
  724. .el-input__inner{
  725. height:40px;
  726. }
  727. .el-input__suffix{
  728. .el-select__caret{
  729. line-height:30px;
  730. }
  731. }
  732. }
  733. }
  734. .el-select{
  735. margin-right:10px;
  736. .el-input__inner{
  737. height:30px;
  738. }
  739. .el-input__suffix{
  740. .el-select__caret{
  741. line-height:30px;
  742. }
  743. }
  744. }
  745. }
  746. span{
  747. font-size:14px;
  748. }
  749. .PeriodBtn{
  750. display: flex;
  751. justify-content: flex-end;
  752. }
  753. .el-button{
  754. height: 30px;
  755. // width:100px;
  756. padding: 0 20px ;
  757. // padding-top: 8px;
  758. span{
  759. margin:0;
  760. }
  761. }
  762. .notificationTableData{
  763. margin-top: 20px;
  764. .notification125Table{
  765. .el-table__body-wrapper{
  766. height: 60vh !important;
  767. }
  768. }
  769. .notification100Table{
  770. .el-table__body-wrapper{
  771. height: 65vh !important;
  772. }
  773. }
  774. .el-table{
  775. .el-input__inner{
  776. height: 30px !important;
  777. }
  778. .el-radio__label{
  779. display: none;
  780. }
  781. .statusSty{
  782. width: 52px;
  783. height: 21px;
  784. line-height: 21px;
  785. display: inline-block;
  786. border-radius: 3px;
  787. color: #fff;
  788. }
  789. .tooltipCC{
  790. width: 300px !important;
  791. display: inline-block;
  792. overflow: hidden;
  793. text-overflow: ellipsis;
  794. white-space: nowrap;
  795. }
  796. .tooltipCCDes{
  797. width: 200px;
  798. display: inline-block;
  799. overflow: hidden;
  800. text-overflow: ellipsis;
  801. white-space: nowrap;
  802. }
  803. .indicitem{
  804. color: #409EFF;
  805. font-size: 12px;
  806. margin-right: 20px;
  807. cursor:pointer;
  808. &:hover{
  809. text-decoration: underline;
  810. }
  811. }
  812. }
  813. .el-pagination{
  814. margin-top: 20px;
  815. text-align: end;
  816. position: relative;
  817. }
  818. }
  819. .el-overlay{
  820. .startToDia{
  821. margin-top: 3vh;
  822. background: #EDEFF5;
  823. .el-dialog__body{
  824. padding: 30px 60px 30px 20px !important;
  825. .notifcaFrom{
  826. .el-select, .el-input{
  827. width: 100%;
  828. }
  829. .el-input{
  830. height: 30px;
  831. }
  832. .uploadFiles{
  833. .el-button{
  834. height: 25px !important;
  835. }
  836. }
  837. .fliesHeader{
  838. width: 100%;
  839. display: flex;
  840. justify-content: space-around;
  841. }
  842. .fliesMain{
  843. width: 100%;
  844. display: flex;
  845. .fliesMainSpan{
  846. display: inline-block;
  847. width: 260px;
  848. overflow: hidden;
  849. text-overflow: ellipsis;
  850. white-space: nowrap;
  851. }
  852. .spanOne{
  853. color: #1063CB;
  854. }
  855. .spanTwo{
  856. text-align: center;
  857. }
  858. .fileOperate{
  859. width: 160px;
  860. display: flex;
  861. justify-content: space-around;
  862. .removeImg{
  863. margin-right: 10px;
  864. position: relative;
  865. top: 2px;
  866. }
  867. }
  868. .removeDiv{
  869. width: 160px;
  870. .removeImg{
  871. margin: 0 10px 0 20px;
  872. position: relative;
  873. top: 3px;
  874. }
  875. }
  876. }
  877. }
  878. .flowSty{
  879. width: 100%;
  880. height: 70vh;
  881. }
  882. }
  883. .el-dialog__footer{
  884. background: #fff;
  885. border-radius: 0 0 10px 10px;
  886. text-align: left;
  887. padding-top: 20px !important;
  888. .notificationFooter{
  889. margin-left: 20px;
  890. .el-button{
  891. height: 40px !important;
  892. }
  893. }
  894. }
  895. }
  896. }
  897. }
  898. }
  899. </style>