|
|
@@ -61,15 +61,41 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <TipsPopup ref="tipsPopupRef" />
|
|
|
+ <view v-if="popupVisible" class="popup-overlay" @click="handlePopupCancel">
|
|
|
+ <view class="popup-content" @click.stop>
|
|
|
+ <view class="popup-header">
|
|
|
+ <text class="popup-title">作废项目</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="popup-body">
|
|
|
+ <text class="popup-label">是否作废已选择的检验项目?</text>
|
|
|
+ <textarea
|
|
|
+ class="popup-textarea"
|
|
|
+ v-model="cancelReason"
|
|
|
+ placeholder="请输入作废理由"
|
|
|
+ :maxlength="200"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="popup-footer">
|
|
|
+ <view class="popup-btn cancel-btn" @click="handlePopupCancel">
|
|
|
+ <text class="popup-btn-text">取消</text>
|
|
|
+ </view>
|
|
|
+ <view class="popup-btn confirm-btn" @click="handlePopupConfirm">
|
|
|
+ <text class="popup-btn-text confirm-btn-text">确定</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, watch, withDefaults } from 'vue'
|
|
|
import { PressureReportType, PressureReportTypeMap } from '@/utils/dictMap'
|
|
|
-import TipsPopup from './inspectProjectComponent/TipsPopup.vue'
|
|
|
+import { useConfigStore } from '@/store/config'
|
|
|
import eventBus from '@/utils/eventBus'
|
|
|
+import { requestFunc, TaskOrderFuncName } from '@/api/ApiRouter/taskOrder'
|
|
|
|
|
|
interface ReportItem {
|
|
|
id: string
|
|
|
@@ -93,6 +119,7 @@ interface Props {
|
|
|
orderItemId?: string
|
|
|
}
|
|
|
|
|
|
+const equipType = useConfigStore().getEquipType()
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
|
otherReportList: () => [],
|
|
|
})
|
|
|
@@ -102,10 +129,10 @@ const emit = defineEmits<{
|
|
|
handleEditWorkInstruction: [item: ReportItem]
|
|
|
}>()
|
|
|
|
|
|
-const tipsPopupRef = ref<any>(null)
|
|
|
+const popupVisible = ref(false)
|
|
|
+const cancelReason = ref('')
|
|
|
const selectedProjects = ref<ReportItem[]>([])
|
|
|
const selectAll = ref(false)
|
|
|
-const itemRefs = ref<Record<string, any>>({})
|
|
|
|
|
|
const dataSource = ref<GroupItem[]>([])
|
|
|
|
|
|
@@ -180,22 +207,40 @@ const showDelReportPopup = () => {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- tipsPopupRef.value?.show({
|
|
|
- text: '是否作废已选择的检验项目?',
|
|
|
- confirm: handleDelReport,
|
|
|
- })
|
|
|
+ cancelReason.value = ''
|
|
|
+ popupVisible.value = true
|
|
|
}
|
|
|
|
|
|
-const handleDelReport = async () => {
|
|
|
+const handlePopupCancel = () => {
|
|
|
+ popupVisible.value = false
|
|
|
+ cancelReason.value = ''
|
|
|
+}
|
|
|
+
|
|
|
+const handlePopupConfirm = () => {
|
|
|
+ if (!cancelReason.value.trim()) {
|
|
|
+ uni.showToast({ title: '请输入作废理由', icon: 'none' })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ popupVisible.value = false
|
|
|
+ handleDelReport(cancelReason.value.trim())
|
|
|
+}
|
|
|
+
|
|
|
+const handleDelReport = async (reason: string) => {
|
|
|
try {
|
|
|
uni.showLoading({ title: '作废中...' })
|
|
|
+ const invalidItems = selectedProjects.value.filter((item) => item.status !== 0)
|
|
|
+ if (invalidItems.length) {
|
|
|
+ uni.showToast({ title: '只能作废待提交的项目', icon: 'error' })
|
|
|
+ uni.hideLoading()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- const cancelIds = selectedProjects.value.map((item) => item.id)
|
|
|
+ const cancelReportReq = selectedProjects.value.map((item) => ({ id: item.id, reason }))
|
|
|
let result = null
|
|
|
|
|
|
if (props.useOnline === '1') {
|
|
|
- const { delReportApi } = await import('@/api/task')
|
|
|
- const fetchResult = await delReportApi({ ids: cancelIds })
|
|
|
+ const fetchResult = await requestFunc(TaskOrderFuncName.BatchCancelReport, equipType, cancelReportReq)
|
|
|
result = fetchResult.data
|
|
|
} else {
|
|
|
uni.showToast({ title: '离线模式暂不支持作废', icon: 'none' })
|
|
|
@@ -222,12 +267,6 @@ const handleDelReport = async () => {
|
|
|
const initSelected = () => {
|
|
|
selectAll.value = false
|
|
|
selectedProjects.value = []
|
|
|
-
|
|
|
- for (const key in itemRefs.value) {
|
|
|
- if (itemRefs.value[key]?.setSelect) {
|
|
|
- itemRefs.value[key].setSelect(false)
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
const showStatusTag = (item: ReportItem): boolean => {
|
|
|
@@ -245,6 +284,8 @@ const getStatusText = (item: ReportItem): string => {
|
|
|
return '待提交'
|
|
|
case 100:
|
|
|
return '待批准'
|
|
|
+ case 200:
|
|
|
+ return '待批准'
|
|
|
case 300:
|
|
|
return '退回'
|
|
|
default:
|
|
|
@@ -502,4 +543,91 @@ const handleViewDetail = async (item: ReportItem) => {
|
|
|
.delete-btn {
|
|
|
background-color: #ff4445;
|
|
|
}
|
|
|
+
|
|
|
+.popup-overlay {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ z-index: 9999;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
+}
|
|
|
+
|
|
|
+.popup-content {
|
|
|
+ width: 80%;
|
|
|
+ max-width: 320px;
|
|
|
+ overflow: hidden;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 8px;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-header {
|
|
|
+ padding: 20px 15px 15px;
|
|
|
+ text-align: center;
|
|
|
+ border-bottom: 1px solid #f0f0f0;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-title {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #333;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-body {
|
|
|
+ padding: 20px 15px;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-label {
|
|
|
+ font-size: 15px;
|
|
|
+ line-height: 1.5;
|
|
|
+ color: #666;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-textarea {
|
|
|
+ width: 100%;
|
|
|
+ height: 80px;
|
|
|
+ padding: 10px;
|
|
|
+ margin-top: 12px;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 1.5;
|
|
|
+ color: #333;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ border: 1px solid #e0e0e0;
|
|
|
+ border-radius: 4px;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-footer {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ border-top: 1px solid #f0f0f0;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-btn {
|
|
|
+ flex: 1;
|
|
|
+ padding: 15px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.cancel-btn {
|
|
|
+ border-right: 1px solid #f0f0f0;
|
|
|
+}
|
|
|
+
|
|
|
+.popup-btn-text {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #666;
|
|
|
+}
|
|
|
+
|
|
|
+.confirm-btn {
|
|
|
+ background-color: #fff;
|
|
|
+}
|
|
|
+
|
|
|
+.confirm-btn-text {
|
|
|
+ font-weight: 500;
|
|
|
+ color: #4B8CD9;
|
|
|
+}
|
|
|
</style>
|