todoDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. <template>
  2. <view class="content">
  3. <view class="datebox">
  4. <!-- <view class="form-item">
  5. <text class="label">日期</text>
  6. <view class="right-box">
  7. <view class="input-box">
  8. {{form.completeTime}}
  9. </view>
  10. </view>
  11. <picker class="birth-picker" mode="date" @change="bindDateChange">
  12. <view class="right-box">
  13. <view class="input-box">
  14. <input type="text" :value="form.dueDate" placeholder="请选择日期" placeholder-class="form-input" disabled="disabled" />
  15. </view>
  16. <image class="w48 h48" src="@/static/images/health/right_arrow_right_icon24.png"></image>
  17. </view>
  18. </picker>
  19. </view> -->
  20. <view class="form-item">
  21. <text class="label">截止时间</text>
  22. <view class="right-box">
  23. <view class="input-box">
  24. {{form.dueDate}}
  25. </view>
  26. </view>
  27. <!-- <picker class="birth-picker" mode="date" :start="time" @change="bindTimeChange">
  28. <view class="right-box">
  29. <view class="input-box">
  30. <input type="text" :value="form.completeTime" placeholder="请选择时间" placeholder-class="form-input" disabled="disabled" />
  31. </view>
  32. <image class="w48 h48" src="@/static/images/health/right_arrow_right_icon24.png"></image>
  33. </view>
  34. </picker> -->
  35. </view>
  36. <view class="form-item">
  37. <text class="label">事项状态</text>
  38. <!-- <view class="right-box">
  39. <view class="input-box">
  40. {{form.statusText||''}}
  41. </view>
  42. </view> -->
  43. <picker class="birth-picker" mode="selector" @change="bindStatusChange($event,tags)" :range="tags" range-key="dictLabel">
  44. <view class="right-box">
  45. <view class="input-box">
  46. <input type="text" :value="form.statusText" placeholder="请选择状态" placeholder-class="form-input" disabled="disabled" />
  47. </view>
  48. <image class="w48 h48" src="@/static/images/health/right_arrow_right_icon24.png"></image>
  49. </view>
  50. </picker>
  51. </view>
  52. <view class="form-item">
  53. <text class="label">优先级</text>
  54. <view class="right-box">
  55. <view class="input-box">
  56. {{form.priorityText||''}}
  57. </view>
  58. </view>
  59. <!-- <picker class="birth-picker" mode="date" :start="time" @change="bindTimeChange">
  60. <view class="right-box">
  61. <view class="input-box">
  62. <input type="text" :value="form.completeTime" placeholder="请选择时间" placeholder-class="form-input" disabled="disabled" />
  63. </view>
  64. <image class="w48 h48" src="@/static/images/health/right_arrow_right_icon24.png"></image>
  65. </view>
  66. </picker> -->
  67. </view>
  68. </view>
  69. <view class="datebox2">
  70. <view class="bold">事项情况</view>
  71. <view class="textinput">
  72. <textarea v-model="form.description" auto-height maxlength='500' placeholder="请输入事项情况"/>
  73. </view>
  74. </view>
  75. <view class="btn-box">
  76. <view class="sub-btn" @click="submit()">
  77. 确定
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import {getFindById,updateById} from '@/api/companyUser.js'
  84. import {getDictByKey} from '@/api/common.js'
  85. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  86. export default {
  87. mixins: [MescrollMixin],
  88. data() {
  89. return {
  90. time:this.utils.timeFormat(new Date(),'yyyy-mm-dd'),
  91. type:null,
  92. showType:1,
  93. mescroll:null,
  94. tags:[
  95. // {id:0,name:'未完成'},
  96. // {id:1,name:'进行中'},
  97. // {id:2,name:'已完成'},
  98. ],
  99. // 上拉加载的配置
  100. upOption: {
  101. onScroll:true,
  102. use: true, // 是否启用上拉加载; 默认true
  103. page: {
  104. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  105. size: 10 // 每页数据的数量,默认10
  106. },
  107. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  108. empty: {
  109. icon:'/static/images/no_data.png',
  110. tip: '暂无数据'
  111. }
  112. },
  113. form:{
  114. }
  115. }
  116. },
  117. onLoad(option) {
  118. this.type=option.type;
  119. console.log(this.type)
  120. if(this.type=='edit'){
  121. this.recordId=option.id;
  122. this.getInfo();
  123. }
  124. this.getDictByKey()
  125. },
  126. methods: {
  127. navgetTo(url){
  128. uni.navigateTo({
  129. url:url
  130. })
  131. },
  132. bindDateChange: function(e) {
  133. this.form.dueDate= e.target.value
  134. },
  135. bindTimeChange: function(e) {
  136. this.form.completeTime = e.target.value
  137. },
  138. bindStatusChange: function(e,list) {
  139. this.form.status = list[e.target.value].dictValue
  140. this.form.statusText=list[e.target.value].dictLabel
  141. },
  142. getDictByKey(){
  143. var data={key:'todo_item_status'}
  144. getDictByKey(data).then(
  145. res => {
  146. if(res.code==200){
  147. this.tags=res.data;
  148. }
  149. },
  150. err => {
  151. }
  152. );
  153. },
  154. getInfo(){
  155. var data={id:this.recordId};
  156. getFindById(data).then(
  157. res => {
  158. if(res.code==200){
  159. this.form=res.data;
  160. // this.form.completeTime=this.form.completeTime.slice(0,5)
  161. }else{
  162. uni.showToast({
  163. title: res.msg,
  164. });
  165. }
  166. },
  167. rej => {}
  168. );
  169. },
  170. submit(){
  171. if(this.form.status==null){
  172. uni.showToast({
  173. icon:'none',
  174. title: "请选择状态",
  175. });
  176. return;
  177. }
  178. // if(this.form.recordTime==null){
  179. // uni.showToast({
  180. // icon:'none',
  181. // title: "记录时间不能为空",
  182. // });
  183. // return;
  184. // }
  185. // if(this.form.mealDescription==null){
  186. // uni.showToast({
  187. // icon:'none',
  188. // title: "用餐情况不能为空",
  189. // });
  190. // return;
  191. // }
  192. if(this.type=="add"){
  193. this.addRecord()
  194. }
  195. else if(this.type=="edit"){
  196. this.updateById()
  197. }
  198. },
  199. updateById(){
  200. updateById(this.form).then(
  201. res => {
  202. if(res.code==200){
  203. uni.showToast({
  204. icon:'success',
  205. title: "操作成功",
  206. });
  207. setTimeout(function() {
  208. uni.$emit('refreshToDoList');
  209. uni.navigateBack({
  210. delta: 1
  211. })
  212. }, 500);
  213. }else{
  214. uni.showToast({
  215. icon:'none',
  216. title: res.msg,
  217. });
  218. }
  219. },
  220. rej => {}
  221. );
  222. },
  223. addRecord(){
  224. addRecord(this.form).then(
  225. res => {
  226. if(res.code==200){
  227. uni.showToast({
  228. icon:'success',
  229. title: "操作成功",
  230. });
  231. setTimeout(function() {
  232. uni.$emit('refreshToDoList');
  233. uni.navigateBack({
  234. delta: 1
  235. })
  236. }, 500);
  237. }else{
  238. uni.showToast({
  239. icon:'none',
  240. title: res.msg,
  241. });
  242. }
  243. },
  244. rej => {}
  245. );
  246. },
  247. }
  248. }
  249. </script>
  250. <style lang="scss" scoped>
  251. @mixin u-flex($flexD, $alignI, $justifyC) {
  252. display: flex;
  253. flex-direction: $flexD;
  254. align-items: $alignI;
  255. justify-content: $justifyC;
  256. }
  257. .flex-bt {
  258. @include u-flex(row, center, space-between);
  259. }
  260. .default {
  261. font-weight: 400;
  262. font-size: 28rpx;
  263. color: #999999;
  264. }
  265. .content{
  266. padding: 20upx;
  267. .datebox {
  268. padding: 0 30rpx;
  269. margin-bottom: 20rpx;
  270. background: #FFFFFF;
  271. border-radius: 16rpx 16rpx 16rpx 16rpx;
  272. .form-item{
  273. padding: 30upx 0;
  274. display: flex;
  275. align-items: flex-start;
  276. border-bottom: 1px solid #F1F1F1;
  277. &:last-child{
  278. border-bottom: none;
  279. }
  280. .label{
  281. flex:1;
  282. font-family: PingFang SC, PingFang SC;
  283. font-weight: 500;
  284. font-size: 32rpx;
  285. color: #222426;
  286. line-height: 34rpx;
  287. text-align: left;
  288. }
  289. input{
  290. text-align: right;
  291. }
  292. .form-input{
  293. font-size: 30upx;
  294. font-family: PingFang SC;
  295. font-weight: 500;
  296. color: #999999;
  297. text-align: right;
  298. }
  299. .form-textarea{
  300. font-size: 30upx;
  301. color: #999999;
  302. height: 100upx;
  303. padding: 4upx 0;
  304. }
  305. .birth-picker {
  306. flex: 1;
  307. display: flex;
  308. align-items: center;
  309. .right-box{
  310. width: 100%;
  311. display: flex;
  312. align-items: center;
  313. .input-box{
  314. // width: 470upx;
  315. }
  316. .arrow{
  317. width: 13upx;
  318. height: 23upx;
  319. margin-left: 20upx;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. .datebox2{
  326. background: #FFFFFF;
  327. padding:30rpx;
  328. border-radius: 16rpx 16rpx 16rpx 16rpx;
  329. .textinput{
  330. margin-top: 30rpx;
  331. height:200rpx;
  332. overflow-y: scroll;
  333. }
  334. }
  335. .top-fixed{
  336. width: 100%;
  337. position: fixed;
  338. top: 0;
  339. left: 0;
  340. z-index: 10;
  341. }
  342. .pub-tab-box{
  343. box-sizing: border-box;
  344. width: 100%;
  345. padding: 0 40upx;
  346. background-color: #FFFFFF;
  347. .tab-inner{
  348. height: 88upx;
  349. line-height: 88upx;
  350. display: flex;
  351. align-items: center;
  352. justify-content: space-between;
  353. overflow-x: auto;
  354. }
  355. .item{
  356. flex:1;
  357. font-size: 28upx;
  358. white-space: nowrap;
  359. line-height: 1;
  360. font-family: PingFang SC;
  361. font-weight: 500;
  362. color: #626468;
  363. // margin-right: 60upx;
  364. display: flex;
  365. align-items: center;
  366. justify-content: center;
  367. &:last-child{
  368. margin-right: 0;
  369. }
  370. &.active{
  371. font-weight: bold;
  372. color:#008FD3;
  373. &::after {
  374. content: "";
  375. width: 48rpx;
  376. height: 8rpx;
  377. background: linear-gradient(120deg, #31A1FE 0%, #008FD3 100%);
  378. position: absolute;
  379. bottom: 0;
  380. border-radius: 6upx 6upx 0upx 0;
  381. }
  382. }
  383. .text{
  384. position: relative;
  385. z-index: 1;
  386. }
  387. .tab-bg{
  388. width: 72upx;
  389. height: 28upx;
  390. position: absolute;
  391. top: 17upx;
  392. left: 50%;
  393. transform: translateX(-36upx);
  394. z-index: -1;
  395. }
  396. }
  397. }
  398. .btn-box{
  399. z-index: 9999;
  400. width: 100%;
  401. padding: 30upx;
  402. // position: fixed;
  403. bottom: 0;
  404. left: 0;
  405. box-sizing: border-box;
  406. // background: #FFFFFF;
  407. display: flex;
  408. align-items: center;
  409. justify-content: space-between;
  410. padding-bottom: 40rpx;
  411. .sub-btn{
  412. flex:1;
  413. // width: 100%;
  414. height: 88upx;
  415. line-height: 88upx;
  416. text-align: center;
  417. font-size: 32upx;
  418. font-family: PingFang SC;
  419. font-weight: bold;
  420. color: #FFFFFF;
  421. background: #008FD3;
  422. border-radius: 44upx;
  423. display: flex;
  424. align-items: center;
  425. border: 2rpx solid #008FD3;
  426. justify-content: center;
  427. image{
  428. margin-right: 16rpx;
  429. }
  430. }
  431. .sub-btn2{
  432. flex:1;
  433. height: 88upx;
  434. line-height: 88upx;
  435. text-align: center;
  436. font-size: 32rpx;
  437. color: #008FD3;
  438. font-family: PingFang SC;
  439. font-weight: bold;
  440. background: #FFFFFF;
  441. border-radius: 44rpx 44rpx 44rpx 44rpx;
  442. border: 2rpx solid #008FD3;
  443. margin-right: 20rpx;
  444. }
  445. }
  446. .phone-list{
  447. // padding: 30rpx;
  448. .item{
  449. display: flex;
  450. align-items: center;
  451. justify-content: space-between;
  452. background: #FFFFFF;
  453. border-radius: 16rpx 16rpx 16rpx 16rpx;
  454. // border-bottom: 1rpx solid #ECECEC;
  455. padding: 20rpx;
  456. margin-bottom: 20rpx;
  457. &:last-child{
  458. margin-bottom: 0;
  459. }
  460. .phone-name{
  461. display: flex;
  462. flex-direction: column;
  463. align-items: flex-start;
  464. // justify-content: flex-start;
  465. // padding-left: 24rpx;
  466. flex: 1;
  467. .name{
  468. font-family: PingFang SC, PingFang SC;
  469. font-weight: 500;
  470. font-size: 32rpx;
  471. color: #222426;
  472. text-align: left;
  473. }
  474. .type{
  475. font-family: PingFang SC;
  476. font-weight: 400;
  477. font-size: 28rpx;
  478. color: #626468;
  479. text-align: right;
  480. }
  481. .time{
  482. font-family: PingFang SC;
  483. font-weight: 400;
  484. font-size: 24rpx;
  485. color: #898E91;
  486. text-align: left;
  487. margin-top: 14rpx;
  488. }
  489. }
  490. }
  491. }
  492. .sms-list{
  493. .item{
  494. padding: 30rpx;
  495. background: #FFFFFF;
  496. border-radius: 16rpx 16rpx 16rpx 16rpx;
  497. margin-bottom: 20rpx;
  498. .title{
  499. font-family: PingFang SC;
  500. font-weight: 500;
  501. font-size: 32rpx;
  502. color: #222426;
  503. text-align: left;
  504. }
  505. .box{
  506. display: flex;
  507. align-items: center;
  508. justify-content: space-between;
  509. padding-top: 22rpx;
  510. .time{
  511. font-family: PingFang SC;
  512. font-weight: 400;
  513. font-size: 24rpx;
  514. color: #898E91;
  515. text-align: left;
  516. }
  517. .state{
  518. font-family: PingFang SC;
  519. font-weight: 400;
  520. font-size: 24rpx;
  521. color: #2CAE5C;
  522. text-align: right;
  523. }
  524. }
  525. }
  526. }
  527. }
  528. </style>