detail.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="detail">
  3. <!-- 主体 -->
  4. <view class="deboxs">
  5. <view class="bghbox"></view>
  6. <view class="dbox fmt30">
  7. <view class="dtit">{{datainfo.noticeTitle}}</view>
  8. <view class="titinf">
  9. <view class="txt"><text>通知类别</text>{{typeFormat(datainfo.noticeType,tzlbList)}}</view>
  10. <view class="txt"><text>发布人</text>{{datainfo.issuer}}</view>
  11. <view class="txt"><text>发布单位</text>{{datainfo.issuerDept}}</view>
  12. <view class="txt"><text>发布时间</text>{{datainfo.issuerTime}}</view>
  13. <view class="txt"><text>通知内容</text>
  14. <rich-text :nodes="datainfo.noticeContent"></rich-text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="dbox" v-if="filelist.length">
  19. <view class="ftit mb14">附件信息</view>
  20. <view class="fjlists flext" v-for="(ite,idx) in filelist" :key='idx' @click="getDown(ite.url)">
  21. <view class="imgl"><image :src="fjimg" ></image></view>
  22. <view class="tit">{{ite.name}}</view>
  23. <view class="fjlook">查看</view>
  24. </view>
  25. </view>
  26. <view class="fbtns" style="flex-wrap: wrap;">
  27. <view class="btn btn1" @click="getEditFn" v-if="checkPermi(['zxNotice:notice:edit'])">修改</view>
  28. <view class="btn btn3" @click="getDelFn" v-if="checkPermi(['zxNotice:notice:remove'])">删除</view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  35. import popUp from "@/work/components/popup/popup.vue"
  36. import noData from "@/components/nodata/nodata.vue"
  37. import {getDeptTree} from"@/api/mine/mine.js"
  38. import { selectValue,selectValuetext } from '@/utils/common.js';
  39. import {getNoticeDetail,getNoticeDel,} from "@/api/mine/news.js"
  40. import {getDictionaryFn} from "@/api/mine/register.js"
  41. import config from '@/config'
  42. const baseUrl = config.baseUrl
  43. export default{
  44. components:{popUp,noData},
  45. data(){
  46. return{
  47. bgimg:require("@/static/images/bg.png"),
  48. fjimg:require("@/work/static/images/fjimg.png"),
  49. filelist:[],
  50. tabidx:5,
  51. titimg:require("@/work/static/images/titbg.png"),
  52. upsimg:require("@/work/static/images/ups.png"),
  53. zheList:[{val:0,zheflag:true,moreflag:true},],
  54. ptype:'',
  55. datainfo:{},
  56. tary:'',
  57. tzlbList:[],
  58. }
  59. },
  60. onUnload(){
  61. uni.$off('refreshdetail')
  62. },
  63. onLoad(e) {
  64. this.id=e.id;
  65. this.getDetail()
  66. this.init()
  67. uni.$on('refreshdetail', (e) => {
  68. this.getDetail()
  69. })
  70. },
  71. methods:{
  72. checkPermi, checkRole,
  73. kaType(ite){
  74. if(ite){
  75. var newArr=ite.split(',')
  76. var actions=[];
  77. var datas=this.matterList;
  78. newArr.forEach(ite=>{
  79. Object.keys(datas).some((key) => {
  80. if (datas[key].value == ('' + ite)) {
  81. actions.push(datas[key].label);
  82. return true;
  83. }
  84. })
  85. })
  86. return actions.join(' ')
  87. }
  88. },
  89. typeFormat(ite,list){
  90. return selectValue(list, ite);
  91. },
  92. typeFormattext(ite,list){
  93. return selectValuetext(list, ite);
  94. },
  95. init(){
  96. getDictionaryFn('sys_notice_type').then(res=>{
  97. if(res.code==200&&res.data.length){
  98. this.tzlbList = res.data.map(v => {
  99. return {
  100. label: v.dictLabel,
  101. value: v.dictValue
  102. }
  103. })
  104. }
  105. })
  106. },
  107. getEditFn(){
  108. this.$tab.navigateTo('/work/pages/news/add?type=edit&id='+this.id)
  109. },
  110. getClose(){
  111. this.ptype=""
  112. },
  113. getZheFn(idx){
  114. this.zheList[idx].zheflag=!this.zheList[idx].zheflag
  115. },
  116. getDelFn(){
  117. var that=this;
  118. uni.showModal({
  119. title: '确认删除',
  120. content: "是否确认删除该消息",
  121. cancelText: '取消',
  122. confirmText: '确认',
  123. success: function(res) {
  124. if (res.confirm) {
  125. getNoticeDel(that.id).then(res=>{
  126. if(res.code==200){
  127. that.$toast('删除成功')
  128. uni.$emit("refreshxxlist")
  129. setTimeout(function(){
  130. uni.navigateBack({
  131. delta: 1 //返回层数,2则上上页
  132. });
  133. },1200)
  134. }
  135. })
  136. } else if (res.cancel) {
  137. // console.log('用户点击取消');
  138. }
  139. }
  140. });
  141. },
  142. getDetail(){
  143. getNoticeDetail(this.id).then(res=>{
  144. if(res.code==200){
  145. this.datainfo=res.data;
  146. if(res.data.zxFjList&&res.data.zxFjList.length){
  147. this.filelist=JSON.parse(JSON.stringify(res.data.zxFjList))
  148. }
  149. }
  150. })
  151. },
  152. getDown(e){
  153. uni.showLoading({
  154. title: '加载中'
  155. });
  156. var url=baseUrl+e;
  157. uni.downloadFile({
  158. url: url,//文件的下载路径
  159. success(result) {
  160. uni.hideLoading()
  161. var filePath = result.tempFilePath;
  162. uni.openDocument({
  163. filePath: filePath,
  164. showMenu: true,
  165. success: function (res) {
  166. // console.log('打开文档成功');
  167. }
  168. });
  169. },
  170. fail(res) {uni.hideLoading()}
  171. })
  172. },
  173. }
  174. }
  175. </script>
  176. <style scoped lang="scss">
  177. .detail{display: flex;flex-direction: column;height: 100vh;}
  178. .deboxs{flex:1;overflow: auto;padding-bottom: 30rpx;
  179. .bghbox{height: 80rpx;background-color: $com-cd3;}
  180. .dbox{background: #FFFFFF;border-radius: 10rpx;margin: 0 24rpx 24rpx;padding: 36rpx 24rpx 24rpx;
  181. .dtit{font-weight: bold;font-size: 15px;color: #222327;margin-bottom: 48rpx;
  182. text{color: #E70000;}
  183. }
  184. .titbox{
  185. .tit{
  186. image{width: 32rpx;height: 18rpx;margin-right: 10rpx;}
  187. view{font-weight: bold;font-size: 32rpx;color: #222327;}
  188. }
  189. }
  190. .titinf{display: flex;flex-wrap: wrap;flex-direction: column;
  191. &.nact{height: 0;overflow: hidden;}
  192. &.act{height: auto;}
  193. .txt{font-weight: 500;font-size: 26rpx;margin-bottom: 20rpx;color: #222327;display: flex;align-items: flex-start;wi
  194. &.nact{height: 200rpx;overflow: hidden;}
  195. &.act{height: auto;}
  196. text{color: #AAAAAA;min-width: 104rpx;text-align-last: justify;flex: 0 0 auto;margin-right: 20rpx;
  197. &.w65{width: 130rpx;}
  198. }
  199. // view{text-indent: 2rem;}
  200. }
  201. }
  202. .txtbox{text-indent: 2rem;line-height: 36rpx;font-weight: 500;font-size: 26rpx;color: #222327;
  203. &.nact{max-height: 432rpx;overflow: hidden;}
  204. &.act{height: auto;}
  205. }
  206. // tab
  207. .dbtabs{
  208. .dbtab{font-weight: 500;font-size: 26rpx;height: 60rpx;line-height: 60rpx;color: #666666;position: relative;padding: 0 38rpx;margin-left: 8rpx;
  209. &.act{font-weight: bold;font-size: 30rpx;color: #222327;
  210. &::after{content: "";width: 48rpx;height: 4rpx;background: #3699FF;border-radius: 2rpx;position: absolute;left: 50%;margin-left: -24rpx;bottom: -4rpx;}
  211. }
  212. }
  213. }
  214. .bortop{border-top: 2rpx dashed #C1C1C1;margin-bottom: 32rpx;margin-top: 14rpx;width: 100%;}
  215. .ftit{font-weight: bold;font-size: 26rpx;color: #222327;}
  216. .zhebox{display: flex;align-items: center;flex-direction: column;padding: 24rpx 0;
  217. image{width: 28rpx;height: 30rpx;margin-bottom: 10rpx;transition: all 0.3s;}
  218. &.act{
  219. image{transform: rotate(-180deg);}
  220. }
  221. view{font-weight: 500;font-size: 24rpx;color: #AAAAAA;}
  222. }
  223. // 附件
  224. .fjlists {display: flex;align-items: flex-start;justify-content: space-between;margin-bottom: 12rpx;
  225. // image{margin-right: 18rpx;flex: 0 0 auto;}
  226. .imgl{width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;margin-right: 6rpx;flex: 0 0 auto;
  227. image{width: 26rpx;height: 24rpx;}
  228. }
  229. .tit{font-size: 26rpx;color: #343434;font-weight: 500;margin-top: 4rpx;flex:1;}
  230. .fjlook{font-weight: 500;font-size: 26rpx;color: #1D64E2;flex: 0 0 auto;margin-left: 20rpx;margin-top: 4rpx;}
  231. }
  232. }
  233. }
  234. // 按钮
  235. .fbtns{display: flex;align-items: center;justify-content: space-between;padding: 54rpx 12rpx 34rpx;display: flex;flex-wrap: wrap;
  236. .btn{height: 80rpx;font-weight: bold;font-size: 30rpx;box-sizing: border-box;border-radius: 40rpx;display: flex;align-items: center;
  237. justify-content: center;margin:0 12rpx;flex:1;
  238. &.btn1{border: 2rpx solid #1D64E2;background: #ffffff;color: #1D64E2;}
  239. &.btn2{background: #1D64E2;color: #ffffff;}
  240. &.btn3{border: 2rpx solid #FF0000;background: #ffffff;color: #FF0000;}
  241. }
  242. }
  243. </style>