123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <template>
- <view class="task-page">
- <div class="title">{{viewData.taskTitle}}</div>
- <div class="info" v-if="items.length>0">
- <div class="item-checklist" v-for="item in items">
- <view class="name">{{item.checklistItemContent}}</view>
- <view class="cont">
- <uni-data-checkbox v-model="item.state" :localdata="checkState" @change="changeCheck(item)"/>
- </view>
- </div>
- </div>
- <view class="empty" v-else>
- 没有可检查项
- </view>
- <view class="footer" @click="onSubmit" v-if="items.length>0">提交</view>
- </view>
- </template>
- <script>
- import {parseTime} from '@/libs/index.js'
- import { getChecklistItemById } from '@/api/check'
- import { handleCheckTask } from '@/api/task'
- export default {
- data() {
- return {
- userData:{},
- viewData:{
- },
- flow:{
- status:"",
- time:"",
- desc:"",
- attachList:[]
- },
- items:[],
- checkState:[{"value": 1,"text": "通过" },{"value": 0,"text": "不通过"}]
- }
- },
- onLoad() {
- this.init()
- },
- methods: {
- parseTime,
- init(){
- let data=uni.getStorageSync('task-item')
- this.userData=uni.getStorageSync('accountInfo')
- let scanCode_info=uni.getStorageSync('scanCode-info')
- let checklistId=data.checklistId
- if(scanCode_info){
- checklistId=scanCode_info.checklistId
- }
- this.viewData=data
- getChecklistItemById(checklistId).then((res) => {
- this.items = res.data.map(item=>{
- return{
- ...item,
- state:1
- }
- })
- })
- },
- changeCheck(item){
- console.log(item.state)
- },
- onSubmit(){
- let viewData=uni.getStorageSync('task-item')
- let checkItemNopass = ''
- let checkItemPass = ''
- let checkResult=0
- let handleAccountId =this.userData.userId
- let handleAccountName =this.userData.userName
- let handlePositionId =this.userData.positionId
- let handlePositionName =this.userData.positionName
- let handleGroupId =this.userData.groupId
- let handleGroupName =this.userData.groupName
- this.items.forEach(item => {
- if (item.state===1) {
- checkItemPass += item.checklistItemContent + '通过;'
- }else{
- checkResult=1
- checkItemNopass += item.checklistItemContent + '不通过;'
- }
- })
- checkItemPass = checkItemPass.substring(0, checkItemPass.length - 1)
- checkItemNopass = checkItemNopass.substring(0, checkItemNopass.length - 1)
- if(checkResult===1){
- uni.showModal({
- title: '提示',
- content: "确认检查项是否提交准确",
- success: function (res) {
- if (res.confirm) {
- handleCheckTask({
- ...viewData,
- handleAccountId,
- handleAccountName,
- handlePositionId,
- handlePositionName,
- handleGroupId,
- handleGroupName,
- 'status': 1,
- checkResult,
- checkItemPass,
- checkItemNopass
- }).then(() => {
- let submit_data=uni.getStorageSync('task-item')
- uni.removeStorageSync('task-item')
- submit_data.checkItemNopass=checkItemNopass
- uni.setStorageSync('submit-data',submit_data)
- let viewData=
- uni.navigateTo({
- url:'/pages/task/submit/submit'
- })
- })
- }
- }
- });
- }else{
- handleCheckTask({
- ...viewData,
- handleAccountId,
- handleAccountName,
- handlePositionId,
- handlePositionName,
- handleGroupId,
- handleGroupName,
- 'status': 1,
- checkResult,
- checkItemPass,
- checkItemNopass
- }).then(() => {
- uni.switchTab({
- url:'/pages/index/index'
- })
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .task-page{
- background-color: #F3F5FB;
- height: 100vh;
- .title{
- font-family: 'Source Han Sans CN';
- font-style: normal;
- font-weight: 700;
- font-size: 36rpx;
- line-height: 54rpx;
- color: #212121;
- padding:0 32rpx;
- }
- .info{
- padding: 0 10rpx;
- margin: 40rpx 0 0;
- padding-bottom: 150rpx;
- background: #FFFFFF;
- border-radius: 32rpx 32rpx 0px 0px;
- .item-checklist{
- display: flex;
- justify-content: space-between;
- padding: 18rpx 20rpx;
- border-bottom: 1rpx solid #EFF1F3;
- .name{
- flex: 1;
- }
- .cont{
- padding-left: 20rpx;
- width: 200rpx;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- box-sizing: border-box;
- }
- }
- }
- .empty{
- text-align: center;
- font-size: 28rpx;
- margin-top: 10%;
- color: #666;
- }
- .footer{
- width: 100%;
- height: 136rpx;
- background: #FFFFFF;
- border-radius: 16upx 16upx 0px 0px;
- position: fixed;
- left: 0;
- bottom: 0;
- text-align: center;
- color: #168DEC;
- font-size: 32upx;
- padding-top: 20upx;
- letter-spacing: 2px;
- border-top: 1rpx solid #eaeaea;
- }
- }
- </style>
|