Bladeren bron

feat(采购计划管理): 添加任务作废功能

liujt 4 maanden geleden
bovenliggende
commit
af7712156c
1 gewijzigde bestanden met toevoegingen van 48 en 2 verwijderingen
  1. 48 2
      pages/home/wt/components/purchasePlanManage/taskSubmit.vue

+ 48 - 2
pages/home/wt/components/purchasePlanManage/taskSubmit.vue

@@ -18,6 +18,10 @@
 			<u-button style="width: 100%;" :loading='loading' type="error" icon="close" text="驳回"
 				@click="handleAudit(0)" v-if="!['starter'].includes(taskDefinitionKey)"></u-button>
 		</view>
+		<view class="btnConcel">
+			<u-button @click="showAction = true">更多</u-button>
+		</view>
+		<u-action-sheet :actions="actionList" :closeOnClickOverlay="true" :closeOnClickAction="true" title="更多操作" :show="showAction" @close="showAction = false" @select="selectActionClick"></u-action-sheet>
 		<u-picker itemHeight='60' :show="technicianShow" visibleItemCount='10' :columns="userOptions" keyName="name"
 			@confirm='selectTechnicianInfo' @cancel='technicianShow = false' title='选择负责人'></u-picker>
 	</view>
@@ -26,7 +30,8 @@
 <script>
 	import {
 		approveTaskWithVariables,
-		AssignPurchasePlanUserAPI
+		AssignPurchasePlanUserAPI,
+		cancelTask
 	} from '@/api/wt/index.js'
 	import {
 		listAllUserBind
@@ -50,7 +55,13 @@
 
 		data() {
 			return {
+				showAction: false,
 				loading: false,
+				actionList: [{
+					name: '作废',
+					fontSize: '28',
+					color: '#ffaa7f'
+				}],
 				technicianShow: false,
 				userOptions: [],
 				form: {
@@ -79,6 +90,38 @@
 			this.getUserOptions()
 		},
 		methods: {
+			selectActionClick(item) {
+				console.log('selectActionClick', item)
+				if (item.name == '作废') {
+					uni.showModal({
+						title: '提示',
+						content: '是否确认作废?',
+						success: (res) => {
+							if (res.confirm) {
+								this.loading = true
+								cancelTask({
+									taskId: this.taskId,
+									id: this.id,
+									reason: this.form.reason,
+									businessId: this.businessId,
+								}).then(() => {
+									if (res.code != '-1') {
+										this.loading = false
+										this.$emit('handleAudit', {
+											title: '作废'
+										});
+									}
+								}).catch(() => {
+									this.loading = false
+									this.$message.error("流程作废失败");
+								});
+							} else if (res.cancel) {
+								console.log('用户点击取消');
+							}
+						}
+					});
+				}
+			},
 			async getUserOptions() {
 				const data = await listAllUserBind()
 				this.userOptions.push(data)
@@ -140,5 +183,8 @@
 	}
 </script>
 
-<style>
+<style scoped>
+.btnConcel {
+		margin-top: 20rpx;
+	}
 </style>