cabinetFiling.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view>
  3. <u-navbar :title="title">
  4. <!-- <view class="slot-wrap">
  5. <u-icon name="search"
  6. @click="gotoUrl('pages/search/searchResult?type='+listForm.typeId)"
  7. size="48" color="#777777"></u-icon>
  8. </view> -->
  9. </u-navbar>
  10. <view class="head-head">
  11. <u-search placeholder="请输入标题" :show-action="true"
  12. @search="init()" @clear="init()" @custom="init()"
  13. v-model="keyword"></u-search>
  14. </view>
  15. <view class="head-head-placeholder ">
  16. </view>
  17. <u-popup v-model="show" height="600"
  18. :closeable="true"
  19. mode="bottom" border-radius="30" >
  20. <view class="showInfo">
  21. <view class="row">
  22. <view class="name">
  23. 标题
  24. </view>
  25. <view class="value">
  26. {{showInfo.name}}
  27. </view>
  28. </view>
  29. <view class="row" v-if="infoList.length"
  30. >
  31. <view class="name">
  32. 附件
  33. </view>
  34. <view class="url" >
  35. <view class="urlitem" v-for="(item,i) in infoList"
  36. :key="i"
  37. @click="downInfo(item)" >
  38. {{item.name}} 下载
  39. </view>
  40. </view>
  41. </view>
  42. <view class="row" v-else >
  43. <u-divider
  44. :isnone="true" nonetext="未上传附件"
  45. ></u-divider>
  46. </view>
  47. </view>
  48. </u-popup>
  49. <view class="news">
  50. <view class="news-item" v-for="(item,i) in list"
  51. :key="i">
  52. <view class="content">
  53. <view class="news-title">
  54. {{item.name}}
  55. </view>
  56. <view class="information">
  57. <view class="classify" :style="item.createByN?'':'color:red'">
  58. {{item.orgName?item.orgName+'-':''}} {{item.createByN?item.createByN:'后台'}}上传
  59. </view>
  60. <view class="date">
  61. {{substrDate(item.uploadTime)}}
  62. </view>
  63. </view>
  64. <view class="row" v-if="getInfoList(item.url).length"
  65. >
  66. <view class="url" >
  67. <view class="urlitem" v-for="(item,i) in getInfoList(item.url)"
  68. :key="i"
  69. @click="downInfo(item)" >
  70. {{item.name}} 下载
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="img" v-if="userPhone==item.createPhone">
  76. <u-button size="mini" type="primary" @click="addInfo(item.id)" >修改文件</u-button>
  77. <u-button size="mini" style="margin-left: 18rpx;" type="success" @click="addInfo2(item.id)" >权限调整</u-button>
  78. <u-button size="mini" style=" float: right;" type="error" @click="addInfo3(item)" >删除</u-button>
  79. </view>
  80. </view>
  81. <u-divider v-if="list.length==recordsTotal"
  82. :isnone="list.length==0" nonetext="没有找到相关内容"
  83. >已经到底了</u-divider>
  84. </view>
  85. <view class="bottom">
  86. <u-button type="primary" @click="addInfo()">添加文件</u-button>
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. import * as API from '@/apis/pagejs/addressbook.js'
  92. export default {
  93. data() {
  94. return {
  95. title:"文件柜",
  96. list:[],
  97. listForm:{
  98. pageIndex:1,
  99. // typeId:"",
  100. // title:"",
  101. pageSize:20,
  102. },
  103. recordsTotal:0,
  104. imgurl:'',
  105. show:false,
  106. showInfo:{
  107. url:"",
  108. },
  109. keyword:"",
  110. userPhone:"",
  111. }
  112. },
  113. onLoad(op){
  114. // if(op.title){
  115. // this.title=op.title
  116. // }
  117. // this.listForm.typeId=op.id
  118. this.userPhone=this.carhelp.getPersonInfo().phone
  119. this.getList()
  120. },
  121. onReachBottom() {
  122. if (this.list.length < this.recordsTotal) {
  123. this.myLoadmore();
  124. }
  125. },
  126. computed:{
  127. infoList(){
  128. var url=this.showInfo.url;
  129. if(url){
  130. return JSON.parse(url)
  131. }
  132. return []
  133. }
  134. },
  135. methods: {
  136. deleteApi(id){
  137. uni.showLoading({
  138. title: "加载中",
  139. mask: true,
  140. })
  141. API.oaFileInfoDelete(id).then((res) => {
  142. uni.hideLoading();
  143. uni.showModal({
  144. title:"提示",
  145. showCancel:false,
  146. content:"操作成功!",
  147. success() {
  148. }
  149. })
  150. this.init()
  151. }).catch(error => {
  152. uni.showToast({
  153. title: error,
  154. icon: "none"
  155. })
  156. })
  157. },
  158. addInfo3(item){
  159. uni.showModal({
  160. title: '提示',
  161. content: `确认是否删除[${item.name}]?`,
  162. success: res=> {
  163. if (res.confirm) {
  164. //付钱 改为组件
  165. this.deleteApi(item.id);
  166. } else if (res.cancel) {
  167. console.log('用户点击取消');
  168. }
  169. }
  170. });
  171. },
  172. addInfo2(id){
  173. uni.navigateTo({
  174. url:"/pages/oawork/cabinet/cabinetRoot?id="+id,
  175. })
  176. },
  177. addInfo(id){
  178. var url=""
  179. if(id){
  180. url+="?id="+id
  181. }
  182. uni.navigateTo({
  183. url:"/pages/oawork/cabinet/cabinetAdd"+url,
  184. events: {
  185. refreshData: () => {
  186. this.init()
  187. }
  188. }
  189. })
  190. },
  191. getInfoList(url){
  192. if(url){
  193. return JSON.parse(url)
  194. }
  195. return []
  196. },
  197. init(){
  198. this.listForm.pageIndex=1
  199. this.list =[]
  200. this.listForm.name=this.keyword
  201. this.getList()
  202. },
  203. downInfo(item){
  204. window.location.href=item.url
  205. },
  206. ckInfo(item){
  207. // var url="/pages/news/articleDetails?id="+id;
  208. // uni.navigateTo({
  209. // url:url
  210. // })
  211. this.showInfo=item;
  212. this.show=true
  213. },
  214. myLoadmore(){
  215. this.listForm.pageIndex += 1;
  216. this.getList();
  217. },
  218. getList(){
  219. uni.showLoading({
  220. title: "加载中",
  221. mask: true,
  222. })
  223. API.oaFileInfoList(this.listForm).then((res) => {
  224. uni.hideLoading();
  225. this.list = [
  226. ...this.list,
  227. ...res.data.data
  228. ];
  229. this.recordsTotal = res.data.recordsTotal;
  230. }).catch(error => {
  231. uni.showToast({
  232. title: error,
  233. icon: "none"
  234. })
  235. })
  236. }
  237. }
  238. }
  239. </script>
  240. <style lang="scss" scoped>
  241. .showInfo{
  242. padding: 60rpx;
  243. }
  244. .row{
  245. display: flex;
  246. font-size: 32rpx;
  247. margin-top: 12rpx;
  248. .name{
  249. margin-right: 16rpx;
  250. white-space: pre;
  251. color: #9E9E9E;
  252. }
  253. .value{
  254. font-size: 36rpx;
  255. font-weight: bold;
  256. }
  257. .url{
  258. font-size: 32rpx;
  259. color: #00BCD4;
  260. .urlitem{
  261. margin-bottom: 16rpx;
  262. }
  263. }
  264. }
  265. /deep/.u-slot-content {
  266. display: block;
  267. text-align: right !important;
  268. margin-right: 16px;
  269. color: #333333;
  270. }
  271. .news{
  272. padding-bottom:120rpx;
  273. .news-item{
  274. padding:30rpx;
  275. margin: 20rpx;
  276. background: #fff;
  277. border-radius: 10px;
  278. .news-title{
  279. font-size: 42rpx;
  280. font-weight: bold;
  281. }
  282. .information{
  283. display: flex;
  284. justify-content: space-between;
  285. color: #9E9E9E;
  286. }
  287. }
  288. }
  289. .head-head{
  290. box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.15);
  291. background: #fff;
  292. padding:24rpx;
  293. position: fixed;
  294. left: 0;
  295. right: 0;
  296. top: 80rpx;
  297. z-index: 991;
  298. }
  299. .head-head-placeholder{
  300. height: 112rpx;
  301. }
  302. .bottom {
  303. position: fixed;
  304. bottom: 0;
  305. left: 0;
  306. right: 0;
  307. //background-color: #fff;
  308. padding: 16rpx 32rpx;
  309. uni-button {
  310. height: 88rpx;
  311. line-height: 88rpx;
  312. border-radius: 8px;
  313. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 0%, rgba(16, 98, 213, 1) 100%);
  314. color: rgba(255, 255, 255, 1);
  315. font-size: 32rpx;
  316. font-family: Microsoft Yahei;
  317. }
  318. }
  319. </style>