维修页面部分完善

This commit is contained in:
BianLzhaoMin 2024-11-21 14:30:20 +08:00
parent 7528f80bcb
commit 4bc0c07d10
2 changed files with 59 additions and 23 deletions

View File

@ -11,7 +11,9 @@
<view class="search">查询</view>
</uni-col>
<uni-col :span="4">
<view class="search" style="background-color: #19be6b">合格</view>
<view class="search" style="background-color: #19be6b" @tap="onQualified"
>合格</view
>
</uni-col>
</uni-row>
@ -41,14 +43,13 @@
<view class="line"></view>
<uni-row :gutter="24">
<uni-col :span="2">
<checkbox-group @change="onChangeChecked(item.isChecked)">
<checkbox-group @change="onChangeChecked(item)">
<label>
<checkbox
color="#409eff"
borderColor="#409eff"
activeBorderColor="#409eff"
:checked="item.isChecked"
value="all"
style="transform: scale(0.7)"
/>
</label>
@ -104,27 +105,11 @@
</template>
<script setup>
import { ref, onUnmounted } from 'vue'
import { getRepairDetailsAPI } from '@/services/repair/repair.js'
import { ref, onUnmounted, computed } from 'vue'
import { getRepairDetailsAPI, setQualifiedAPI } from '@/services/repair/repair.js'
import { onLoad } from '@dcloudio/uni-app'
const detailsList = ref([])
const query = defineProps() //
const allChecked = ref(false)
//
const leaseApplyInfo = ref({
leaseUnit: '', //
leaseProject: '', //
maTypeName: '', //
typeName: '', //
unitName: '', //
storageNum: '', //
preNum: '', //
parentId: query.id, // id
id: '', // id
typeId: '', // typeId
manageType: '', // manageType
})
//
const getOutboundDetailsData = async () => {
@ -137,11 +122,52 @@ const getOutboundDetailsData = async () => {
//
const onChangeAllChecked = (e) => {
console.log('全选', e.detail.value)
detailsList.value.forEach((item) => {
if (e.detail.value.length > 0) {
item.isChecked = true
} else {
item.isChecked = false
}
})
}
//
const onChangeChecked = (val) => {
val = !val
val.isChecked = !val.isChecked
}
//
const allChecked = computed(() => {
return detailsList.value.every((e) => e.isChecked == true)
})
//
const onQualified = async () => {
const isSelect = detailsList.value.some((e) => e.isChecked == true)
if (!isSelect) {
uni.showToast({
title: '请勾选需要需要合格的数据!',
icon: 'none',
})
return
}
//
const ids = []
detailsList.value.forEach((e) => {
if (e.isChecked) {
ids.push(e.id)
}
})
console.log('合格参数', ids)
const res = await setQualifiedAPI(ids)
if (res.code === 200) {
uni.showToast({
title: '操作成功!',
icon: 'none',
})
getOutboundDetailsData()
}
}
//

View File

@ -20,3 +20,13 @@ export const getRepairDetailsAPI = (data) => {
data,
})
}
/**
* 维修 ---- 合格操作
*/
export const setQualifiedAPI = (data) => {
return http({
method: 'POST',
url: '/material/repair/completeRepair',
data,
})
}