detail.vue 7.8 KB

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