|
|
@@ -278,6 +278,24 @@
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!-- 字段选择对话框 -->
|
|
|
+ <el-dialog title="选择导出字段" v-model="showExportFieldsDialog" width="600px" append-to-body>
|
|
|
+ <el-transfer
|
|
|
+ v-model="exportFieldsSelected"
|
|
|
+ :data="exportFieldsData"
|
|
|
+ :titles="['可选字段', '导出字段']"
|
|
|
+ show-checkbox
|
|
|
+ filterable
|
|
|
+ filter-placeholder="请输入字段名称">
|
|
|
+ </el-transfer>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="showExportFieldsDialog = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="confirmExport">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
<!-- 单选设备选择组件 -->
|
|
|
<equipment-select-single v-model="singleEquipmentSelectVisible" @onSelected="onSingleEquipmentSelected"></equipment-select-single>
|
|
|
|
|
|
@@ -291,7 +309,7 @@
|
|
|
|
|
|
<script setup name="Equipment">
|
|
|
import { getToken } from "@/utils/auth"
|
|
|
-import { listEquipment, getEquipment, delEquipment, addEquipment, updateEquipment, listBrands, listModelsByBrand, listMaintenanceCenters, listStationsByMaintenanceCenter } from "@/api/gxt/equipment"
|
|
|
+import { listEquipment, getEquipment, delEquipment, addEquipment, updateEquipment, listBrands, listModelsByBrand, listMaintenanceCenters, listStationsByMaintenanceCenter, getExportFields } from "@/api/gxt/equipment"
|
|
|
import { listDeptData } from "@/api/system/dept"
|
|
|
import EquipmentSelectSingle from "@/components/equipmentSelect/single.vue"
|
|
|
import EquipmentSelectMulti from "@/components/equipmentSelect/multi.vue"
|
|
|
@@ -331,6 +349,11 @@ const singleEquipmentSelectVisible = ref(false) // 单选设备选择组件可
|
|
|
const multiEquipmentSelectVisible = ref(false) // 多选设备选择组件可见性
|
|
|
const userSelectVisible = ref(false) // 人员选择组件可见性
|
|
|
|
|
|
+// 导出字段相关变量
|
|
|
+const showExportFieldsDialog = ref(false)
|
|
|
+const exportFieldsData = ref([])
|
|
|
+const exportFieldsSelected = ref([])
|
|
|
+
|
|
|
/*** 设备导入参数 */
|
|
|
const upload = reactive({
|
|
|
// 是否显示弹出层(设备导入)
|
|
|
@@ -660,9 +683,39 @@ function handleDelete(row) {
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
function handleExport() {
|
|
|
- proxy.download('gxt/equipment/export', {
|
|
|
- ...queryParams.value
|
|
|
- }, `equipment_${new Date().getTime()}.xlsx`)
|
|
|
+ // 显示字段选择对话框
|
|
|
+ showExportFieldsDialog.value = true;
|
|
|
+ // 初始时不选中任何字段(符合用户期望)
|
|
|
+ exportFieldsSelected.value = [];
|
|
|
+ // 获取导出字段数据
|
|
|
+ getExportFieldsData();
|
|
|
+}
|
|
|
+
|
|
|
+/** 确认导出 */
|
|
|
+function confirmExport() {
|
|
|
+ if (exportFieldsSelected.value.length === 0) {
|
|
|
+ proxy.$modal.msgWarning("请至少选择一个导出字段");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 将导出字段拼接成字符串
|
|
|
+ const exportFieldsStr = exportFieldsSelected.value.join(',');
|
|
|
+
|
|
|
+ const exportParams = {
|
|
|
+ ...queryParams.value,
|
|
|
+ exportFields: exportFieldsStr
|
|
|
+ };
|
|
|
+
|
|
|
+ proxy.download('gxt/equipment/export', exportParams, `equipment_${new Date().getTime()}.xlsx`);
|
|
|
+
|
|
|
+ showExportFieldsDialog.value = false;
|
|
|
+}
|
|
|
+
|
|
|
+/** 获取导出字段数据 */
|
|
|
+function getExportFieldsData() {
|
|
|
+ getExportFields().then(response => {
|
|
|
+ exportFieldsData.value = response.data
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
/** 导入按钮操作 */
|