|
|
@@ -729,6 +729,13 @@
|
|
|
>
|
|
|
<Icon icon="ep:edit" class="mr-5px" /> 批量修改约检联系人
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="handleBatchEditLocationFn"
|
|
|
+ :disabled="selectedEquips.length === 0"
|
|
|
+ >
|
|
|
+ <Icon icon="ep:edit" class="mr-5px" /> 批量修改地址
|
|
|
+ </el-button>
|
|
|
<el-button type="default" @click="handleExportFn">
|
|
|
<el-icon size="16" class="mr-5px">
|
|
|
<Download />
|
|
|
@@ -1311,6 +1318,38 @@
|
|
|
<batchEditForm ref="batchEditFormRef" @success="() => handleEquipQuery(true)" />
|
|
|
<EquipContainerForm ref="EquipContainerFormRef" />
|
|
|
<FileUploadModal ref="fileUploadModalRef" @success="handleFileUploadSuccess" />
|
|
|
+
|
|
|
+ <!-- 批量修改地址弹窗 -->
|
|
|
+ <Dialog v-model="batchEditLocationVisible" title="批量修改地址">
|
|
|
+ <el-form
|
|
|
+ ref="batchEditLocationFormRef"
|
|
|
+ v-loading="formLoading"
|
|
|
+ :model="batchEditLocationFormData"
|
|
|
+ :rules="batchEditLocationFormRules"
|
|
|
+ label-width="140px"
|
|
|
+ >
|
|
|
+ <el-form-item label="设备所在行政区" prop="equipDistrict">
|
|
|
+ <AreaSelect
|
|
|
+ v-model="batchEditLocationFormData.equipDistrict"
|
|
|
+ :areaType="batchEditLocationFormData.areaType"
|
|
|
+ @area-type-change="changeArea"
|
|
|
+ @change="changeAddress"
|
|
|
+ placeholder="请选择设备所在行政区"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备所在街道" prop="equipStreet">
|
|
|
+ <StreetSelect
|
|
|
+ v-model="batchEditLocationFormData.equipStreet"
|
|
|
+ :district-ids="[batchEditLocationFormData.equipDistrict]"
|
|
|
+ placeholder="请选择设备所在街道"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button :disabled="formLoading" type="primary" @click="batchEditLocationSubmitForm">批量修改</el-button>
|
|
|
+ <el-button @click="batchEditLocationVisible = false">取 消</el-button>
|
|
|
+ </template>
|
|
|
+ </Dialog>
|
|
|
</div>
|
|
|
|
|
|
<Dialog title="历史联系人信息" v-model="historyDialogVisible" align-center width="1100px">
|
|
|
@@ -1499,6 +1538,9 @@ import {
|
|
|
} from '@/utils/constants'
|
|
|
import { useEmitt } from '@/hooks/web/useEmitt'
|
|
|
import { getUnitNewList, getUnitContacts } from '@/api/laboratory/unit'
|
|
|
+import { EquipContainerApi } from '@/api/pressure/equipcontainer'
|
|
|
+import { EquipBoilerSchedulingApi } from '@/api/pressure2/equipboilerscheduling'
|
|
|
+import { EquipPipeSchedulingApi } from '@/api/pressure2/pipescheduling'
|
|
|
import { numberToChinese } from '@/utils/formatter'
|
|
|
import UploadFile from './components/UploadFile.vue'
|
|
|
import FileUploadModal from './components/ImportFile.vue'
|
|
|
@@ -1540,6 +1582,17 @@ const route = useRoute()
|
|
|
const router = useRouter()
|
|
|
const tagsViewStore = useTagsViewStore()
|
|
|
const batchEditFormRef = ref()
|
|
|
+const batchEditLocationVisible = ref(false)
|
|
|
+const batchEditLocationFormRef = ref()
|
|
|
+const batchEditLocationFormData = ref({
|
|
|
+ areaType: '',
|
|
|
+ equipDistrict: '', // 设备所在行政区
|
|
|
+ equipStreet: '', // 设备所在街道
|
|
|
+})
|
|
|
+const batchEditLocationFormRules = reactive({
|
|
|
+ equipDistrict: [{ required: true, message: '请选择设备所在行政区', trigger: 'change' }],
|
|
|
+ equipStreet: [{ required: true, message: '请选择设备所在街道', trigger: 'change' }],
|
|
|
+})
|
|
|
const dictStore = useDictStore()
|
|
|
const getUnitEnterpriseType = computed(
|
|
|
() => dictStore.getDictMap['system_client_unit_enterprise_type']
|
|
|
@@ -2210,6 +2263,60 @@ const handleBatchEditFn = () => {
|
|
|
}
|
|
|
batchEditFormRef.value.open(selectedEquips.value, '1')
|
|
|
}
|
|
|
+/** 批量修改地址 - 打开弹窗 */
|
|
|
+const handleBatchEditLocationFn = async () => {
|
|
|
+ const selectRows = selectedEquips.value || []
|
|
|
+ if (!selectRows.length) {
|
|
|
+ return ElMessage.error('请选择要修改的设备')
|
|
|
+ }
|
|
|
+ formLoading.value = true
|
|
|
+ try {
|
|
|
+ // 使用第一个选中设备的地址信息预填表单
|
|
|
+ const firstEquip = selectRows[0]
|
|
|
+ batchEditLocationFormData.value.areaType = firstEquip.areaType || ''
|
|
|
+ batchEditLocationFormData.value.equipDistrict = firstEquip.equipDistrict || ''
|
|
|
+ batchEditLocationFormData.value.equipStreet = firstEquip.equipStreet || ''
|
|
|
+ batchEditLocationVisible.value = true
|
|
|
+ } finally {
|
|
|
+ formLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+const changeArea = (areaType: 'all' | 'gz') => {
|
|
|
+ batchEditLocationFormData.value.areaType = areaType
|
|
|
+}
|
|
|
+const changeAddress = () => {
|
|
|
+ batchEditLocationFormData.value.equipStreet = null as any
|
|
|
+ setTimeout(() => {
|
|
|
+ batchEditLocationFormRef.value?.clearValidate(['equipStreet'])
|
|
|
+ }, 0)
|
|
|
+}
|
|
|
+const batchEditLocationSubmitForm = async () => {
|
|
|
+ if (!batchEditLocationFormRef.value) return
|
|
|
+ const valid = await batchEditLocationFormRef.value.validate()
|
|
|
+ if (!valid) return
|
|
|
+ formLoading.value = true
|
|
|
+ try {
|
|
|
+ const selectRows = selectedEquips.value || []
|
|
|
+ const data = {
|
|
|
+ ...batchEditLocationFormData.value,
|
|
|
+ ids: selectRows.map((item) => item.id)
|
|
|
+ }
|
|
|
+ // 根据设备类型调用不同的 API
|
|
|
+ const equipMainType = orderDetail.value?.equipMainType
|
|
|
+ if (equipMainType === 200) {
|
|
|
+ await EquipBoilerSchedulingApi.batchUpdateDistrict(data)
|
|
|
+ } else if (equipMainType === 300) {
|
|
|
+ await EquipPipeSchedulingApi.batchUpdateDistrict(data)
|
|
|
+ } else {
|
|
|
+ await EquipContainerApi.batchUpdateDistrictApi(data)
|
|
|
+ }
|
|
|
+ ElMessage.success('修改成功')
|
|
|
+ handleEquipQuery(true)
|
|
|
+ batchEditLocationVisible.value = false
|
|
|
+ } finally {
|
|
|
+ formLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
const handleExportFn = async () => {
|
|
|
loading.value = true
|
|
|
try {
|