Przeglądaj źródła

作废检测项目增加作废理由输入框

yangguanjin 1 dzień temu
rodzic
commit
08a1f2c2db

+ 4 - 2
src/pages/equipment/detail/components/BoilerInspectProject.vue

@@ -1382,7 +1382,9 @@ const handleDelReport = () => {
 
   tipsPopupRef.value?.show({
     text: '是否作废已选择的检验项目?',
-    confirm: async () => {
+    showInput: true,
+    inputPlaceholder: '请输入作废理由',
+    confirm: async (reason?: string) => {
       try {
         uni.showLoading({ title: '作废中...' })
 
@@ -1392,7 +1394,7 @@ const handleDelReport = () => {
         if (props.useOnline === '1') {
           const cancelReq = []
           cancelIds.forEach((id) => {
-            cancelReq.push({ id, reason: '' })
+            cancelReq.push({ id, reason: reason || '' })
           })
           const fetchResult = await cancelBoilerInSpectProject(cancelReq)
           result = fetchResult.data

+ 4 - 2
src/pages/equipment/detail/components/PipeInspectProject.vue

@@ -1093,7 +1093,9 @@ const handleDelReport = () => {
 
   tipsPopupRef.value?.show({
     text: '是否作废已选择的检验项目?',
-    confirm: async () => {
+    showInput: true,
+    inputPlaceholder: '请输入作废理由',
+    confirm: async (reason?: string) => {
       try {
         uni.showLoading({ title: '作废中...' })
 
@@ -1103,7 +1105,7 @@ const handleDelReport = () => {
         if (props.useOnline === '1') {
           const cancelReq: any[] = []
           cancelIds.forEach((id) => {
-            cancelReq.push({ id, reason: '' })
+            cancelReq.push({ id, reason: reason || '' })
           })
           const fetchResult = await cancelPipeInSpectProject(cancelReq)
           result = fetchResult.data

+ 33 - 3
src/pages/equipment/detail/components/inspectProjectComponent/TipsPopup.vue

@@ -7,6 +7,13 @@
 
       <view class="tips-body">
         <text class="tips-text">{{ content }}</text>
+        <textarea
+          v-if="showInput"
+          v-model="reason"
+          class="tips-input"
+          :placeholder="inputPlaceholder"
+          :maxlength="200"
+        />
       </view>
 
       <view class="tips-footer">
@@ -26,19 +33,27 @@ import { ref } from 'vue'
 
 const visible = ref(false)
 const content = ref('')
-let confirmCallback: (() => void) | null = null
+const showInput = ref(false)
+const reason = ref('')
+const inputPlaceholder = ref('请输入作废理由')
+let confirmCallback: ((reason?: string) => void) | null = null
 let cancelCallback: (() => void) | null = null
 
 interface PopupOptions {
   text: string
-  confirm?: () => void
+  confirm?: (reason?: string) => void
   cancel?: () => void
+  showInput?: boolean
+  inputPlaceholder?: string
 }
 
 const show = (options: PopupOptions) => {
   content.value = options.text
   confirmCallback = options.confirm || null
   cancelCallback = options.cancel || null
+  showInput.value = options.showInput || false
+  inputPlaceholder.value = options.inputPlaceholder || '请输入作废理由'
+  reason.value = ''
   visible.value = true
 }
 
@@ -47,11 +62,13 @@ const hide = () => {
   content.value = ''
   confirmCallback = null
   cancelCallback = null
+  showInput.value = false
+  reason.value = ''
 }
 
 const handleConfirm = () => {
   if (confirmCallback) {
-    confirmCallback()
+    confirmCallback(reason.value)
   }
   hide()
 }
@@ -116,6 +133,19 @@ defineExpose({
   line-height: 1.5;
 }
 
+.tips-input {
+  width: 100%;
+  height: 80px;
+  margin-top: 12px;
+  padding: 8px 10px;
+  font-size: 14px;
+  color: #333;
+  background-color: #f5f5f5;
+  border: 1px solid #ddd;
+  border-radius: 4px;
+  box-sizing: border-box;
+}
+
 .tips-footer {
   display: flex;
   flex-direction: row;