|
|
@@ -35,21 +35,16 @@
|
|
|
<view v-if="!loading && listData.length === 0" class="empty-text">暂无数据</view>
|
|
|
</scroll-view>
|
|
|
|
|
|
- <!-- 删除确认弹窗 -->
|
|
|
- <view v-if="showDeletePopup" class="popup-mask" @click="closeDeletePopup">
|
|
|
- <view class="popup-content" @click.stop>
|
|
|
- <TipsPopup text="确认删除吗?" @hide="closeDeletePopup" @confirm="confirmDelete" />
|
|
|
- </view>
|
|
|
- </view>
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
|
|
+import { ref, reactive, onUnmounted } from 'vue'
|
|
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
|
|
-import { getSafetyCheckRecordPage, deleteSafetyCheckRecord } from '@/api/task'
|
|
|
import Item from './components/Item.vue'
|
|
|
-import TipsPopup from '@/components/Popup/components/TipsPopup.vue'
|
|
|
+import { useConfigStore } from '@/store/config'
|
|
|
+import { SecurityCheckFuncName, requestFunc } from '@/api/ApiRouter/taskOrderSecurityCheck'
|
|
|
|
|
|
defineOptions({
|
|
|
name: 'securityCheckList',
|
|
|
@@ -60,6 +55,8 @@ const orderId = ref('')
|
|
|
const unitContact = ref('')
|
|
|
const unitPhone = ref('')
|
|
|
const receiverEmail = ref('')
|
|
|
+const configStore = useConfigStore()
|
|
|
+const equipType = configStore.equipType
|
|
|
|
|
|
onLoad((options: any) => {
|
|
|
orderId.value = options.orderId || ''
|
|
|
@@ -78,9 +75,35 @@ const params = reactive({
|
|
|
orderId: '',
|
|
|
})
|
|
|
|
|
|
-// 删除弹窗
|
|
|
-const showDeletePopup = ref(false)
|
|
|
-const deleteItem = ref<any>(null)
|
|
|
+// 删除记录
|
|
|
+const handleDeleteSavetyRecord = (item: any) => {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认删除吗?',
|
|
|
+ success: async (res) => {
|
|
|
+ if (!res.confirm) return
|
|
|
+
|
|
|
+ try {
|
|
|
+ uni.showLoading({ title: '删除中...', mask: true })
|
|
|
+ const result = await requestFunc(SecurityCheckFuncName.delSecurityCheckItem, equipType, {
|
|
|
+ id: item.id,
|
|
|
+ })
|
|
|
+ uni.hideLoading()
|
|
|
+
|
|
|
+ if (result?.code === 0) {
|
|
|
+ uni.showToast({ title: '删除成功', icon: 'success', duration: 3000 })
|
|
|
+ refreshList()
|
|
|
+ } else {
|
|
|
+ uni.showToast({ title: result?.msg || '删除失败', icon: 'none', duration: 3000 })
|
|
|
+ }
|
|
|
+ } catch (error: any) {
|
|
|
+ uni.hideLoading()
|
|
|
+ console.error('删除安全检查记录失败:', error)
|
|
|
+ uni.showToast({ title: error?.msg || '删除失败', icon: 'none', duration: 3000 })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
// 获取列表数据
|
|
|
const fetchList = async (refresh = false) => {
|
|
|
@@ -93,7 +116,7 @@ const fetchList = async (refresh = false) => {
|
|
|
uni.showLoading({ title: '加载中...', mask: true })
|
|
|
|
|
|
try {
|
|
|
- const result = await getSafetyCheckRecordPage(params)
|
|
|
+ const result = await requestFunc(SecurityCheckFuncName.getPage, equipType, params)
|
|
|
uni.hideLoading()
|
|
|
|
|
|
if (result?.code === 0 && result?.data?.list?.length) {
|
|
|
@@ -140,43 +163,6 @@ const handleModifySavetyRecord = (item: any) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-// 删除记录
|
|
|
-const handleDeleteSavetyRecord = (item: any) => {
|
|
|
- deleteItem.value = item
|
|
|
- showDeletePopup.value = true
|
|
|
-}
|
|
|
-
|
|
|
-// 关闭删除弹窗
|
|
|
-const closeDeletePopup = () => {
|
|
|
- showDeletePopup.value = false
|
|
|
- deleteItem.value = null
|
|
|
-}
|
|
|
-
|
|
|
-// 确认删除
|
|
|
-const confirmDelete = async () => {
|
|
|
- if (!deleteItem.value) return
|
|
|
-
|
|
|
- try {
|
|
|
- uni.showLoading({ title: '删除中...', mask: true })
|
|
|
- const res = await deleteSafetyCheckRecord({ id: deleteItem.value.id })
|
|
|
- uni.hideLoading()
|
|
|
-
|
|
|
- console.log('删除结果:', res)
|
|
|
- if (res?.code === 0) {
|
|
|
- uni.showToast({ title: '删除成功', icon: 'success', duration: 3000 })
|
|
|
- refreshList()
|
|
|
- } else {
|
|
|
- uni.showToast({ title: res?.msg || '删除失败', icon: 'none', duration: 3000 })
|
|
|
- }
|
|
|
- } catch (error: any) {
|
|
|
- uni.hideLoading()
|
|
|
- console.error('删除安全检查记录失败:', error)
|
|
|
- uni.showToast({ title: error?.msg || '删除失败', icon: 'none', duration: 3000 })
|
|
|
- } finally {
|
|
|
- closeDeletePopup()
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// 页面显示时刷新
|
|
|
onShow(() => {
|
|
|
refreshList()
|
|
|
@@ -200,8 +186,8 @@ defineExpose({})
|
|
|
|
|
|
.navigate-view {
|
|
|
display: flex;
|
|
|
- justify-content: center;
|
|
|
align-items: center;
|
|
|
+ justify-content: center;
|
|
|
height: 44px;
|
|
|
background-color: #fff;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
@@ -225,27 +211,9 @@ defineExpose({})
|
|
|
.loading-text,
|
|
|
.no-more-text,
|
|
|
.empty-text {
|
|
|
- text-align: center;
|
|
|
padding: 15px;
|
|
|
- color: #999;
|
|
|
font-size: 14px;
|
|
|
-}
|
|
|
-
|
|
|
-.popup-mask {
|
|
|
- position: fixed;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- right: 0;
|
|
|
- bottom: 0;
|
|
|
- background-color: rgba(0, 0, 0, 0.5);
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- z-index: 999;
|
|
|
-}
|
|
|
-
|
|
|
-.popup-content {
|
|
|
- width: 80%;
|
|
|
- max-width: 320px;
|
|
|
+ color: #999;
|
|
|
+ text-align: center;
|
|
|
}
|
|
|
</style>
|