content.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <template>
  2. <view class="oa-notice-detail">
  3. <view class="covers-body covers-uploader oa-uploader">
  4. <view>
  5. <view style="text-align: center;">{{content.title}}</view>
  6. <view class="input-title">
  7. <mp-html :content="content.content" />
  8. <!-- <view class="input-content" v-html="content.content"></view> -->
  9. </view>
  10. </view>
  11. <view class="input-title" v-if="file.length>0">
  12. <view>附件:</view>
  13. <view class="uni-uploader">
  14. <view class="uni-uploader-body" v-for="(item,i) in file" :key="i">
  15. <view class="uni-uploader_files" @click="showFile(item.path)">
  16. <block>
  17. <view class="uni-uploader__file" style="position: relative;">
  18. {{item.name}}
  19. </view>
  20. </block>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="covers-body covers-uploader oa-uploader">
  27. <view class="input-body">
  28. <view class="input-content">拟办意见:<text>{{content.proposed}}</text></view>
  29. <view class="input-content">领导批示:<text>{{content.roval}}</text></view>
  30. <view class="input-content">联系人:<text>{{content.contactperson}}</text></view>
  31. <view class="input-content">电&nbsp;&nbsp;&nbsp;话:<text>{{content.contacttel}}</text></view>
  32. <view class="input-content" v-if="!ismine">发送人:<text>{{content.sendperson}}</text></view>
  33. <view class="input-content" v-if="!ismine">发送时间:<text>{{content.sendtime}}</text></view>
  34. </view>
  35. </view>
  36. <view class="covers-body covers-uploader oa-uploader" v-if="ismine">
  37. <view class="input-title">签收详情:</view>
  38. <view class="uni-timeline">
  39. <view class="uni-timeline-item" :class="[
  40. item.recvstatus === '0' ? `text-${themeColor.name} uni-timeline-first-item` : 'uni-timeline-last-item']"
  41. v-for="(item, index) in approveDetail" :key="index">
  42. <view class="uni-timeline-item-content">
  43. <view>
  44. {{ item.recvperson }} ----- {{ item.recvstatus|qsstatus }}
  45. </view>
  46. <view class="datetime" v-if="item.recvtime!=null">
  47. {{ item.recvtime|time}}
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- <view class="footer" v-else-if="!qianshou">
  54. <view v-for="(item, index) in radioList" :key="index">
  55. <button class="action-btn" :class="'text-' + themeColor.name" @tap="openDialog()">
  56. {{item.value}}
  57. </button>
  58. </view>
  59. </view> -->
  60. <view class="covers-body covers-uploader oa-uploader" v-else-if="!qianshou">
  61. <view v-for="(item, index) in radioList" :key="index">
  62. <button class="action-btn" :class="'text-' + themeColor.name" @tap="handleWorksOperation()">
  63. {{item.value}}
  64. </button>
  65. </view>
  66. </view>
  67. <!-- <view class="covers-body covers-uploader oa-uploader qianshou" v-else-if="qianshou">
  68. <view class="input-title">参会人员信息:</view>
  69. <view class="uni-uploader">
  70. <view class="uni-uploader-body" v-for="(person,id) in canhuiperson" :key="id">
  71. <view class="input-content"><text>姓&nbsp;&nbsp;&nbsp;名:{{person.name}}</text><text class="text2">手机号:{{person.phone}}</text>
  72. </view>
  73. </view>
  74. </view>
  75. </view> -->
  76. <!-- 签收弹出框 -->
  77. <popup-layer ref="popupRef" :direction="'top'">
  78. <view class="zidingyiBox">
  79. <view class="input-title">
  80. <view class="input-content">请填写参会人员姓名以及电话:</view>
  81. <view class="input-content">
  82. <a class="btn btn_plus" role="button" title="增加" @click="addperson()"></a>
  83. </view>
  84. </view>
  85. <view class="pop-item" v-for="(person,id) in canhuiperson" :key="id">
  86. <a class="btn btn_minus" role="button" title="减少" @click="minusperson(person.id)"
  87. v-if="canhuiperson.length>1"></a>
  88. <view><text>姓&nbsp;&nbsp;&nbsp;名:</text>
  89. <input v-model="person.name" placeholder="请输入参会人员姓名"></input>
  90. </view>
  91. <view>
  92. <text>手机号:</text>
  93. <input v-model="person.phone" placeholder="请输入手机号"></input>
  94. </view>
  95. </view>
  96. <view>
  97. <button class="action-btn" :class="'text-' + themeColor.name" @tap="handleWorksOperation()">
  98. 签收
  99. </button>
  100. </view>
  101. </view>
  102. </popup-layer>
  103. </view>
  104. </template>
  105. <script>
  106. import moment from '@/common/moment';
  107. import popupLayer from '@/components/popup-layer/popup-layer.vue'
  108. import mpHtml from '@/components/mp-html/mp-html'
  109. import {
  110. toastMsg
  111. } from '@/pages/toast/toast.js'
  112. export default {
  113. components: {
  114. mpHtml
  115. },
  116. data() {
  117. return {
  118. id: '',
  119. content: {},
  120. contentFile: {},
  121. file: {},
  122. qianshou: false,
  123. ismine: false,
  124. approveDetail: [],
  125. radioList: [{
  126. "value": "签收"
  127. }],
  128. canhuiperson: [{
  129. id: 1,
  130. name: '',
  131. phone: '',
  132. }],
  133. maxid: 1,
  134. meetingNamePhome: ''
  135. }
  136. },
  137. components: {
  138. popupLayer
  139. },
  140. filters: {
  141. time(val) {
  142. var date = new Date(val);
  143. return moment(date).format('YYYY-MM-DD HH:mm');
  144. },
  145. qsstatus(val) {
  146. if (val == "0") {
  147. return "未签收";
  148. } else {
  149. return "已签收";
  150. }
  151. }
  152. },
  153. onLoad: function(opt) {
  154. this.id = opt.id;
  155. if (opt.qianshou == "1") this.qianshou = true;
  156. else this.qianshou = false;
  157. if (opt.ismine == "true") this.ismine = true;
  158. this.initData();
  159. },
  160. methods: {
  161. // 数据初始化
  162. initData() {
  163. this.getContent();
  164. uni.setNavigationBarColor({
  165. frontColor: '#ffffff',
  166. backgroundColor: this.themeColor.color,
  167. animation: {
  168. duration: 400,
  169. timingFunc: 'easeIn'
  170. }
  171. })
  172. },
  173. getContent() {
  174. var url = this.$mConfig.baseUrl + '/notify/' + this.id;
  175. var token = this.$preToken + ' ' + this.$store.state.accessToken;
  176. var that = this;
  177. this.$http.request({
  178. url: url,
  179. header: {
  180. 'content-type': 'application/json',
  181. 'Authorization': token
  182. }
  183. }).then(r => {
  184. if (r.code == "200") {
  185. that.content = r.data;
  186. //附件文件
  187. var filearr = [];
  188. if (r.data.filename) var filelist = r.data.filename.substr(0, r.data.filename
  189. .length - 1).split(',');
  190. else var filelist = [];
  191. for (var i = 0; i < filelist.length; i++) {
  192. filearr.push({
  193. "name": filelist[i],
  194. "path": r.data.filepath.substr(0, r.data.filepath.length - 1).split(',')[i]
  195. });
  196. }
  197. that.file = filearr;
  198. } else {
  199. }
  200. }).then(res => {
  201. if (that.ismine) {
  202. var detailUrl = this.$mConfig.baseUrl + '/notify/recvDetail/' + that.id;
  203. this.$http.request({
  204. url: detailUrl,
  205. header: {
  206. 'content-type': 'application/json',
  207. 'Authorization': token
  208. }
  209. }).then(r => {
  210. if (r.code == "200") {
  211. that.approveDetail = r.data;
  212. }
  213. })
  214. } else if (that.qianshou) {
  215. /* var personList = that.content.namePhone.split(';');
  216. that.canhuiperson.splice(0, 1);
  217. personList.forEach(function(item, i) {
  218. if (item == "") return;
  219. var person = {
  220. id: i,
  221. name: item.split(',')[0],
  222. phone: item.split(',')[1]
  223. }
  224. that.canhuiperson.push(person);
  225. }) */
  226. }
  227. })
  228. },
  229. addperson() {
  230. var newid = parseInt(this.maxid) + 1;
  231. let person = {
  232. id: parseInt(newid),
  233. name: '',
  234. phone: ''
  235. }
  236. this.canhuiperson.push(person);
  237. this.maxid = parseInt(this.maxid) + 1;
  238. },
  239. minusperson(id) {
  240. console.log(id);
  241. var that = this;
  242. this.canhuiperson.forEach(function(index, i) {
  243. if (index.id == id) {
  244. that.canhuiperson.splice(i, 1);
  245. }
  246. })
  247. },
  248. showFile(path) {
  249. var type = path.split('.')[1].toLocaleLowerCase();
  250. var url = this.$mConfig.baseUrl + path;
  251. if (type == 'jpg' || type == 'jpeg' || type == 'bmp' || type == 'gif' || type == 'png') {
  252. var arr = [];
  253. arr.push(url);
  254. uni.previewImage({
  255. urls: arr
  256. });
  257. } else if (type == 'doc' || type == 'xls' || type == 'ppt' || type == 'pdf' || type == 'docx' || type ==
  258. 'xlsx' || type == 'pptx') {
  259. uni.downloadFile({
  260. url: url,
  261. success: function(res) {
  262. var filePath = res.tempFilePath;
  263. uni.openDocument({
  264. filePath: filePath,
  265. success: function(res) {
  266. console.log(res);
  267. }
  268. });
  269. }
  270. });
  271. } else {
  272. uni.downloadFile({
  273. url: url,
  274. success: (res) => {
  275. if (res.statusCode === 200) {
  276. var tempFilePaths = res.tempFilePath;
  277. uni.saveFile({
  278. tempFilePath: tempFilePaths[0],
  279. success: function(res) {
  280. var savedFilePath = res.savedFilePath;
  281. toastMsg('success', "已保存文件至:" + savedFilePath);
  282. }
  283. });
  284. }
  285. }
  286. })
  287. }
  288. },
  289. openDialog() {
  290. this.$refs.popupRef.show();
  291. },
  292. preHandleWorks() {
  293. var that = this;
  294. if (that.canhuiperson.length == 1) {
  295. if (that.canhuiperson[0].name == "" || that.canhuiperson[0].phone == "") {
  296. toastMsg('warning', '请填写参会人员姓名和手机号')
  297. return false;
  298. } else {
  299. that.meetingNamePhome = that.canhuiperson[0].name + ',' + that.canhuiperson[0].phone + ',' + that
  300. .$mStore.state.user.dept.deptName;
  301. return true;
  302. }
  303. } else {
  304. for (var i = 0; i < that.canhuiperson.length; i++) {
  305. if (that.canhuiperson[i].name == "" || that.canhuiperson[i].phone == "") {
  306. toastMsg('warning', '请填写第' + (parseInt(i) + 1) + '参会人员的姓名和手机号')
  307. return false;
  308. } else {
  309. that.meetingNamePhome += that.canhuiperson[i].name + ',' + that.canhuiperson[i].phone + ';';
  310. }
  311. }
  312. return true;
  313. }
  314. },
  315. handleWorksOperation() {
  316. //if (this.preHandleWorks()) {
  317. var url = this.$mConfig.baseUrl + '/notify/receive';
  318. var token = this.$preToken + ' ' + this.$store.state.accessToken;
  319. var that = this;
  320. this.$http.request({
  321. url: url,
  322. method: "GET",
  323. header: {
  324. 'content-type': 'application/json',
  325. 'Authorization': token
  326. },
  327. params: {
  328. id: that.id,
  329. instructions: "同意"
  330. }
  331. }).then(r => {
  332. if (r.code == "200") {
  333. toastMsg('success', '签收成功');
  334. that.qianshou = true;
  335. that.$refs.popupRef.close();
  336. that.getTabBarBadge();
  337. } else {
  338. toastMsg('warning', '签收失败');
  339. }
  340. })
  341. //}
  342. }
  343. }
  344. }
  345. </script>
  346. <style lang="scss">
  347. .oa-notice-detail {
  348. .uni-timeline {
  349. padding: $spacing-lg;
  350. background-color: $color-white;
  351. }
  352. .feedback-title {
  353. display: flex;
  354. flex-direction: row;
  355. justify-content: space-between;
  356. align-items: center;
  357. padding: $spacing-base;
  358. margin-top: $spacing-base;
  359. font-size: $font-base;
  360. }
  361. .feedback-star-view.feedback-title {
  362. justify-content: flex-start;
  363. margin: 0;
  364. }
  365. .feedback-quick {
  366. position: relative;
  367. padding-right: 40upx;
  368. .iconfont {
  369. font-size: $font-sm;
  370. }
  371. }
  372. .feedback-body {
  373. background: $color-white;
  374. padding: $spacing-sm $spacing-base;
  375. .gender-item {
  376. margin-right: 20upx;
  377. .gender-item-text {
  378. padding-left: 10upx;
  379. }
  380. radio .wx-radio-input.wx-radio-input-checked {
  381. background: $uni-color-primary;
  382. border-color: $uni-color-primary;
  383. }
  384. }
  385. }
  386. .feedback-textare {
  387. height: 200upx;
  388. font-size: 34upx;
  389. line-height: 50upx;
  390. width: 100%;
  391. box-sizing: border-box;
  392. padding: 20upx 30upx 0;
  393. }
  394. .footer {
  395. position: fixed;
  396. left: 0;
  397. bottom: 0;
  398. z-index: 98;
  399. width: 100%;
  400. background-color: $color-white;
  401. color: $font-color-base;
  402. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  403. display: flex;
  404. justify-content: flex-end;
  405. align-items: center;
  406. padding: 15upx $spacing-base;
  407. .action-btn {
  408. font-size: $font-sm;
  409. margin: 0 0 0 15upx;
  410. padding: 0 $spacing-lg;
  411. text-align: center;
  412. height: 80upx;
  413. line-height: 80upx;
  414. }
  415. }
  416. .banner {
  417. overflow: hidden;
  418. position: relative;
  419. background-color: #ccc;
  420. .banner-img {
  421. height: 300upx;
  422. width: 100%;
  423. }
  424. .banner-title {
  425. max-height: 84upx;
  426. overflow: hidden;
  427. position: absolute;
  428. bottom: 0;
  429. width: 100%;
  430. font-size: 32upx;
  431. font-weight: 400;
  432. line-height: 42upx;
  433. color: white;
  434. z-index: 11;
  435. background-color: rgba(0, 0, 0, 0.25);
  436. padding: 4upx 20upx;
  437. }
  438. }
  439. .banner-title {
  440. padding: $spacing-lg $spacing-lg 0;
  441. font-size: $font-lg;
  442. }
  443. .article-meta {
  444. padding: 20upx 40upx;
  445. display: flex;
  446. flex-direction: row;
  447. justify-content: flex-start;
  448. color: gray;
  449. .article-text {
  450. font-size: 26upx;
  451. line-height: 50upx;
  452. margin: 0 20upx;
  453. }
  454. .article-author,
  455. .article-time {
  456. font-size: 30upx;
  457. }
  458. }
  459. .article-content {
  460. padding: 0 30upx;
  461. overflow: hidden;
  462. font-size: 30upx;
  463. margin-bottom: 30upx;
  464. }
  465. .input-title {
  466. display: flex;
  467. flex-direction: row;
  468. justify-content: space-between;
  469. align-items: center;
  470. padding: $spacing-base;
  471. margin-top: $spacing-base;
  472. font-size: $font-base;
  473. }
  474. .input-body {
  475. background: $color-white;
  476. padding: $spacing-sm $spacing-base;
  477. }
  478. .covers-title {
  479. display: flex;
  480. flex-direction: row;
  481. justify-content: space-between;
  482. align-items: center;
  483. padding: $spacing-base;
  484. margin-top: $spacing-base;
  485. font-size: $font-base;
  486. }
  487. .covers-body {
  488. background: $color-white;
  489. padding: $spacing-sm $spacing-base;
  490. .gender-item {
  491. margin-right: 20upx;
  492. .gender-item-text {
  493. padding-left: 10upx;
  494. }
  495. radio .wx-radio-input.wx-radio-input-checked {
  496. background: $uni-color-primary;
  497. border-color: $uni-color-primary;
  498. }
  499. }
  500. }
  501. .covers-uploader {
  502. padding: 22upx 20upx;
  503. margin: 22upx 20upx;
  504. }
  505. .qianshou{
  506. view{
  507. line-height: 2;
  508. }
  509. .input-content{
  510. padding-left: 18rpx;
  511. }
  512. .text2{
  513. margin-left: 40upx;
  514. }
  515. }
  516. .pop-item {
  517. margin: 40upx;
  518. }
  519. .pop-item view {
  520. line-height: 2;
  521. margin: 10upx;
  522. font-size: 36upx;
  523. display: flex;
  524. flex-wrap: wrap;
  525. flex-direction: row;
  526. justify-content: space-between
  527. }
  528. .pop-item input {
  529. width: 70%;
  530. border-bottom: 1px solid #eaeaea;
  531. }
  532. }
  533. .btn {
  534. display: inline-block;
  535. vertical-align: middle;
  536. background: #f0f0f0 no-repeat center;
  537. border: 1px solid #d0d0d0;
  538. width: 24px;
  539. height: 24px;
  540. border-radius: 20px;
  541. box-shadow: 0 1px rgba(100, 100, 100, .1);
  542. color: #666;
  543. transition: color .2s, background-color .2s;
  544. }
  545. .btn:active {
  546. box-shadow: inset 0 1px rgba(100, 100, 100, .1);
  547. }
  548. .btn:hover {
  549. background-color: #e9e9e9;
  550. color: #333;
  551. }
  552. .btn_plus {
  553. background-image: linear-gradient(to top, currentColor, currentColor), linear-gradient(to top, currentColor, currentColor);
  554. background-size: 10px 2px, 2px 10px;
  555. }
  556. .btn_minus {
  557. background-image: linear-gradient(to top, currentColor, currentColor);
  558. background-size: 10px 2px;
  559. float: right;
  560. right: -9px;
  561. position: relative;
  562. }
  563. </style>