维修页面部分完善
This commit is contained in:
parent
7528f80bcb
commit
4bc0c07d10
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
// 点击跳转出库页面
|
||||
|
|
|
|||
|
|
@ -20,3 +20,13 @@ export const getRepairDetailsAPI = (data) => {
|
|||
data,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 维修 ---- 合格操作
|
||||
*/
|
||||
export const setQualifiedAPI = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/material/repair/completeRepair',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue