Преглед на файлове

feat(采购需求管理): 添加任务作废功能并调整表单字段

liujt преди 6 месеца
родител
ревизия
6d7110a146
променени са 3 файла, в които са добавени 48 реда и са изтрити 7 реда
  1. 10 0
      api/wt/index.js
  2. 4 4
      pages/home/wt/components/purchaseNeedManage/taskForm.vue
  3. 34 3
      pages/home/wt/components/purchaseNeedManage/taskSubmit.vue

+ 10 - 0
api/wt/index.js

@@ -70,6 +70,16 @@ export async function rejectTask(data) {
 
 }
 
+// 作废
+export async function cancelTask(data) {
+	const res = await postJ(Vue.prototype.apiUrl + `/bpm/process-instance/cancel`, data)
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+
+}
+
 //获取已办事项列表
 export async function getDoneTaskPage(query) {
 	const res = await get(

+ 4 - 4
pages/home/wt/components/purchaseNeedManage/taskForm.vue

@@ -137,10 +137,6 @@
 						label: '物品级别',
 						field: 'goodsLevelName',
 					},
-					{
-						label: '库存数量',
-						field: 'availableCountBase',
-					},
 					{
 						label: '已采数量',
 						field: 'doneTotalCount', // measuringUnit
@@ -185,6 +181,10 @@
 						label: '颜色',
 						field: 'colorKey',
 					},
+					{
+						label: '牌号',
+						field: 'productBrand',
+					},
 					{
 						label: '到货方式',
 						field: 'arrivalWayName',

+ 34 - 3
pages/home/wt/components/purchaseNeedManage/taskSubmit.vue

@@ -11,8 +11,10 @@
 			<u-button style="width: 100%;margin-bottom: 10rpx;" icon="edit-pen" :loading='loading' type="success"
 				text="通过" @click="handleAudit(1)">
 			</u-button>
-			<u-button style="width: 100%;" :loading='loading' type="error" icon="close" text="驳回"
+			<u-button style="width: 100%;margin-bottom: 10rpx;" :loading='loading' type="error" icon="close" text="驳回"
 				@click="handleAudit(0)" v-if="!['starter'].includes(taskDefinitionKey)"></u-button>
+			<u-button style="width: 100%;margin-bottom: 10rpx;" :loading='loading' type="info" icon="close" text="作废"
+				@click="handleCancel()"></u-button>
 		</view>
 
 	</view>
@@ -21,7 +23,8 @@
 <script>
 	import {
 		approveTaskWithVariables,
-		rejectTask
+		rejectTask,
+		cancelTask,
 	} from '@/api/wt/index.js'
 	export default {
 		name: 'taskSubmit',
@@ -92,7 +95,35 @@
 				}
 				
 			},
-
+			handleCancel() {
+				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('用户点击取消');
+						}
+					}
+				});
+			},
 			getTableValue() {
 				return new Promise((resolve, reject) => {
 					this.$emit('getTableValue', async (data) => {