|
|
@@ -353,14 +353,13 @@
|
|
|
style="display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; background-color: #6cbcf5; color: #fff; font-size: 12px; border-radius: 2px; font-weight: bold;">主</span>
|
|
|
<span>{{ item.name }}</span>
|
|
|
</div>
|
|
|
- <span>
|
|
|
+ <span v-if="item.isFee === '1'">
|
|
|
(
|
|
|
<el-button link type="primary" @click="() => {
|
|
|
openFeeDialog(item)
|
|
|
}"
|
|
|
>费用:{{ item.fee || '无' }}</el-button
|
|
|
>
|
|
|
- <!-- >费用:{{ getCheckItemFeeType(item) }}</el-button-->
|
|
|
)
|
|
|
</span>
|
|
|
</div>
|
|
|
@@ -873,7 +872,13 @@ watch(() => preSelectedCheckers.value, (newVal) => {
|
|
|
}, {deep: true})
|
|
|
|
|
|
|
|
|
-/** 监听日期变化 */
|
|
|
+/** 监听检验性质变化 */
|
|
|
+watch(() => formData.value.checkType, (newType, oldType) => {
|
|
|
+ if (newType && newType !== oldType && !isOpening.value) {
|
|
|
+ handleQueryCheckItemList(newType)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
watch(() => formData.value.inDate, (newDate) => {
|
|
|
if (newDate) {
|
|
|
// 只有在未设置且未勾选"无需安排"的情况下才自动填充
|
|
|
@@ -1120,14 +1125,22 @@ const updateTeamList = (type) => {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// 查询项目列表
|
|
|
-const handleQueryCheckItemList = async () => {
|
|
|
- checkItemList.value = []
|
|
|
- const checkTypes = [
|
|
|
- PressureBoilerCheckType.IN,
|
|
|
- PressureBoilerCheckType.OUT,
|
|
|
- PressureBoilerCheckType.PRESSURE
|
|
|
- ];
|
|
|
+// 查询项目列表(按当前检验性质查询,并缓存结果)
|
|
|
+const checkItemListCache = ref<Record<string, any[]>>({})
|
|
|
+const isOpening = ref(false) // 标记弹窗是否正在打开,防止watch在数据未就绪时触发查询
|
|
|
+const handleQueryCheckItemList = async (checkType?: string) => {
|
|
|
+ const targetType = checkType || formData.value.checkType
|
|
|
+ // 如果已缓存,直接使用缓存数据
|
|
|
+ if (checkItemListCache.value[targetType]) {
|
|
|
+ // 合并缓存数据到 checkItemList(保留其他类型的数据,更新当前类型)
|
|
|
+ const cachedItems = checkItemListCache.value[targetType]
|
|
|
+ checkItemList.value = [
|
|
|
+ ...checkItemList.value.filter(i => i.inspectionNature != targetType),
|
|
|
+ ...cachedItems
|
|
|
+ ]
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
// 校验所有选中的任务列表中的设备类型是否一致
|
|
|
const allTasks = [
|
|
|
...formData.value.inTaskList,
|
|
|
@@ -1164,54 +1177,61 @@ const handleQueryCheckItemList = async () => {
|
|
|
// 获取统一的设备类型,如果列表为空则设为 undefined
|
|
|
const equipType = allTasks.length > 0 ? allTasks[0].type : undefined
|
|
|
|
|
|
- for (const type of checkTypes) {
|
|
|
- const params = {
|
|
|
- orderId: "0",
|
|
|
- itemIds: equipList.value.map(item => item.id),
|
|
|
- equipmentCategory: 200,
|
|
|
- inspectionNature: [type],
|
|
|
- equipType:equipType
|
|
|
- };
|
|
|
- const queryResult = await querySchedulingCheckItemList(params);
|
|
|
- const inspectionNatureType = await InspectionNatureTypeApi.getInspectionNatureTypePage({
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 1,
|
|
|
- equip: '200',
|
|
|
- nature: type
|
|
|
- })
|
|
|
- const inType = inspectionNatureType.list[0].type
|
|
|
- checkItemList.value.push({
|
|
|
- inspectionNatureName: PressureBoilerCheckTypeMap[type] + " 法定收费项目",
|
|
|
- inspectionNature: type,
|
|
|
- type: '1',
|
|
|
- isExpanded: inType == 1, // 根据 inType 决定是否默认展开
|
|
|
- itemList: (queryResult || []).map((item) => (
|
|
|
- {
|
|
|
- ...item,
|
|
|
- isAutoAmount: '0', // 批量模式下默认为'0'
|
|
|
- inspectionNature: type,
|
|
|
- type: '1',
|
|
|
- use: inType == 1 ? item.use : false
|
|
|
- }
|
|
|
- ))
|
|
|
- });
|
|
|
- checkItemList.value.push({
|
|
|
- inspectionNatureName: PressureBoilerCheckTypeMap[type] + " 服务收费项目",
|
|
|
- inspectionNature: type,
|
|
|
- type: '2',
|
|
|
- isExpanded: inType == 2, // 根据 inType 决定是否默认展开
|
|
|
- itemList: (queryResult || []).map((item) => (
|
|
|
- {
|
|
|
- ...item,
|
|
|
- isAutoAmount: '0', // 批量模式下默认为'0'
|
|
|
- inspectionNature: type,
|
|
|
- type: '2',
|
|
|
- use: inType == 2 ? item.use : false
|
|
|
- }
|
|
|
- ))
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
+ const type = Number(targetType) || targetType
|
|
|
+ const params = {
|
|
|
+ orderId: "0",
|
|
|
+ itemIds: equipList.value.map(item => item.id),
|
|
|
+ equipmentCategory: 200,
|
|
|
+ inspectionNature: [type],
|
|
|
+ equipType:equipType
|
|
|
+ };
|
|
|
+ const queryResult = await querySchedulingCheckItemList(params);
|
|
|
+ const inspectionNatureType = await InspectionNatureTypeApi.getInspectionNatureTypePage({
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 1,
|
|
|
+ equip: '200',
|
|
|
+ nature: type
|
|
|
+ })
|
|
|
+ const inType = inspectionNatureType.list[0].type
|
|
|
+ const newItems: any[] = []
|
|
|
+ newItems.push({
|
|
|
+ inspectionNatureName: PressureBoilerCheckTypeMap[type] + " 法定收费项目",
|
|
|
+ inspectionNature: type,
|
|
|
+ type: '1',
|
|
|
+ isExpanded: inType == 1,
|
|
|
+ itemList: (queryResult || []).map((item) => (
|
|
|
+ {
|
|
|
+ ...item,
|
|
|
+ isAutoAmount: '0',
|
|
|
+ inspectionNature: type,
|
|
|
+ type: '1',
|
|
|
+ use: inType == 1 ? item.use : false
|
|
|
+ }
|
|
|
+ ))
|
|
|
+ });
|
|
|
+ newItems.push({
|
|
|
+ inspectionNatureName: PressureBoilerCheckTypeMap[type] + " 服务收费项目",
|
|
|
+ inspectionNature: type,
|
|
|
+ type: '2',
|
|
|
+ isExpanded: inType == 2,
|
|
|
+ itemList: (queryResult || []).map((item) => (
|
|
|
+ {
|
|
|
+ ...item,
|
|
|
+ isAutoAmount: '0',
|
|
|
+ inspectionNature: type,
|
|
|
+ type: '2',
|
|
|
+ use: inType == 2 ? item.use : false
|
|
|
+ }
|
|
|
+ ))
|
|
|
+ });
|
|
|
+
|
|
|
+ // 缓存当前类型的结果
|
|
|
+ checkItemListCache.value[type] = newItems
|
|
|
+ // 合并到 checkItemList
|
|
|
+ checkItemList.value = [
|
|
|
+ ...checkItemList.value.filter(i => i.inspectionNature != type),
|
|
|
+ ...newItems
|
|
|
+ ]
|
|
|
}
|
|
|
|
|
|
/** 切换检验项目展开/收缩状态 */
|
|
|
@@ -1253,6 +1273,7 @@ const checkEquipDept = async (selectedRows: any[]) => {
|
|
|
/** 打开弹窗 */
|
|
|
const open = async (selectedInList, selectedOutList, selectedPreList, type?: string) => {
|
|
|
//console.log('open', props.selectedRows)
|
|
|
+ isOpening.value = true
|
|
|
dialogVisible.value = true
|
|
|
|
|
|
// 合并所有选中的设备列表
|
|
|
@@ -1309,7 +1330,11 @@ const open = async (selectedInList, selectedOutList, selectedPreList, type?: str
|
|
|
formData.value.outTaskList = selectedOutList
|
|
|
formData.value.pressureTaskList = selectedPreList
|
|
|
|
|
|
- handleQueryCheckItemList()
|
|
|
+ // 清空缓存和项目列表,只查询当前检验性质
|
|
|
+ checkItemList.value = []
|
|
|
+ checkItemListCache.value = {}
|
|
|
+ await handleQueryCheckItemList(formData.value.checkType)
|
|
|
+ isOpening.value = false
|
|
|
|
|
|
// 加载检验员列表(默认当前登录人的部门)
|
|
|
const deptId = userStore.getUser.deptId?.toString()
|
|
|
@@ -1325,6 +1350,8 @@ const open = async (selectedInList, selectedOutList, selectedPreList, type?: str
|
|
|
/** 取消操作 */
|
|
|
const handleCancel = () => {
|
|
|
dialogVisible.value = false
|
|
|
+ checkItemList.value = []
|
|
|
+ checkItemListCache.value = {}
|
|
|
if (!isBatch.value) {
|
|
|
emit('clear-selected-rows') // 新增事件用于清空选中行
|
|
|
}
|