zck 9 months ago
parent
commit
5ce3f2000b
1 changed files with 52 additions and 13 deletions
  1. 52 13
      src/view/performance/caiqiebaogong.vue

+ 52 - 13
src/view/performance/caiqiebaogong.vue

@@ -368,7 +368,7 @@ import {ref, reactive} from 'vue';
 import {getSpotList,getInfo,OrderAttachments,getTabByGdbh,search,spotcheckdel,SubWorkOrderStatusList,Mabaolist,orderBomList,outReport} from '@/api/mes/job';
 import {getMachineMac} from '@/api/jixiaoguanli/jitairibaobiao'
 import {getMac} from '@/api/jixiaoguanli/baogong'
-import {ElMessage} from "element-plus";
+import {ElMessage,ElMessageBox} from "element-plus";
 import PrintPage from '../yunyin/shengchanguanli/components/print.vue';
 import luckyexcelPage from '../yunyin/shengchanguanli/components/luckyexcel.vue';
 import SubOrderPage from '../yunyin/shengchanguanli/components/SubOrder.vue';
@@ -683,9 +683,23 @@ const cp_gdprintonClick = async () => {
 	SubOrderPageRef.value.open(add_searchInfo.value,add_formData['工序']) 
 }
 	
-	
-//报工
-const add_Dialog = async ()=>{
+// 标志变量,用于控制按钮的可点击状态
+let isClickable = true;
+
+const add_Dialog = async () => {
+    // 如果按钮不可点击,直接返回
+    if (!isClickable) {
+        return;
+    }
+    // 禁用按钮
+    isClickable = false;
+
+    // 设置定时器,2 秒后重新启用按钮
+    setTimeout(() => {
+        isClickable = true;
+    }, 2000);
+
+
 	if(add_formData['机台号'] === '测试机台'){
 		ElMessage({ type: 'warning', message: '测试机台禁止报工' });
 		return;
@@ -813,23 +827,48 @@ const gd_yulan = () => {
 //报工删除
 const delall = ref(true)
 const Selection = ref('')
+const select_jtbh = ref('')
 const selectionChange = (selection, type) => {
+	console.log(selection)
 	const ids = selection.map(item => {
 		return item.UniqId
 	})
+	const zbs = selection.map(item => {
+		return item.sczl_jtbh	
+	})
 	Selection.value = ids.join(',')
+	select_jtbh.value = zbs.join(',')
 	console.log(Selection.value)
 }
 const del_delclick = async () => {
-	console.log(Selection.value)
-	console.log(add_formData['组别'])
-	const res1 = await spotcheckdel({UniqId:Selection.value,sys_id:add_formData['组别']})
-	if(res1.code === 0){
-		ElMessage.success('删除成功')
-		Selection.value = ''
-		add_onSubmit()
-	}
-}
+    // 检查机台号是否匹配
+    if (select_jtbh.value != add_formData['机台号']) {
+        ElMessage({ type: 'warning', message: '请选择与机台号相同的记录' });
+        return false;
+    }
+    try {
+        // 显示确认弹窗
+        const confirmResult = await ElMessageBox.confirm('确定要删除这条记录吗?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+        });
+        // 如果用户点击了确定
+        if (confirmResult === 'confirm') {
+            console.log(Selection.value);
+            console.log(add_formData['组别']);
+            const res1 = await spotcheckdel({ UniqId: Selection.value, sys_id: add_formData['组别'] });
+            if (res1.code === 0) {
+                ElMessage.success('删除成功');
+                Selection.value = '';
+                add_onSubmit();
+            }
+        }
+    } catch (error) {
+        // 用户点击了取消或关闭了弹窗
+        ElMessage.info('删除操作已取消');
+    }
+};
 
 const _orderid = ref('')//订单子编号
 const _kh = ref('')//生产款号