|
@@ -33,6 +33,27 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
+ <el-form-item label="所属组织" prop="deptIds">
|
|
|
|
+ <el-cascader
|
|
|
|
+ v-model="tableData.param.deptIds"
|
|
|
|
+ :options="deptOptions"
|
|
|
|
+ :props="{
|
|
|
|
+ checkStrictly: true,
|
|
|
|
+ value: 'deptId',
|
|
|
|
+ label: 'deptName',
|
|
|
|
+ children: 'children',
|
|
|
|
+ multiple: true,
|
|
|
|
+ emitPath: false
|
|
|
|
+ }"
|
|
|
|
+ style="width: 200px"
|
|
|
|
+ clearable
|
|
|
|
+ placeholder="请选择所属组织"
|
|
|
|
+ collapse-tags
|
|
|
|
+ collapse-tags-tooltip
|
|
|
|
+ filterable
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
<el-form-item label="标签" prop="tags">
|
|
<el-form-item label="标签" prop="tags">
|
|
<el-select
|
|
<el-select
|
|
v-model="tableData.param.tags"
|
|
v-model="tableData.param.tags"
|
|
@@ -181,6 +202,7 @@ import { ElMessageBox, ElMessage, FormInstance } from 'element-plus';
|
|
import EditDic from './component/edit.vue';
|
|
import EditDic from './component/edit.vue';
|
|
import ExcelDic from './component/excel.vue';
|
|
import ExcelDic from './component/excel.vue';
|
|
import api from '/@/api/device';
|
|
import api from '/@/api/device';
|
|
|
|
+import systemApi from '/@/api/system';
|
|
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
|
|
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
|
|
|
|
|
|
// 定义接口来定义对象的类型
|
|
// 定义接口来定义对象的类型
|
|
@@ -207,6 +229,7 @@ interface TableDataState {
|
|
productKey: string;
|
|
productKey: string;
|
|
status: string;
|
|
status: string;
|
|
deviceTypes: string[];
|
|
deviceTypes: string[];
|
|
|
|
+ deptIds: number[];
|
|
tags: string[];
|
|
tags: string[];
|
|
dateRange: string[];
|
|
dateRange: string[];
|
|
};
|
|
};
|
|
@@ -224,6 +247,7 @@ export default defineComponent({
|
|
const queryRef = ref();
|
|
const queryRef = ref();
|
|
const batchLoading = ref(false);
|
|
const batchLoading = ref(false);
|
|
const showMoreFilter = ref(false); // 控制是否显示更多筛选条件
|
|
const showMoreFilter = ref(false); // 控制是否显示更多筛选条件
|
|
|
|
+ const deptOptions = ref([]); // 部门树数据
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
const state = reactive<TableDataState>({
|
|
const state = reactive<TableDataState>({
|
|
keys: [],
|
|
keys: [],
|
|
@@ -240,6 +264,7 @@ export default defineComponent({
|
|
productKey: <string>route.query?.productKey || '',
|
|
productKey: <string>route.query?.productKey || '',
|
|
status: '',
|
|
status: '',
|
|
deviceTypes: [],
|
|
deviceTypes: [],
|
|
|
|
+ deptIds: [],
|
|
tags: [],
|
|
tags: [],
|
|
dateRange: [],
|
|
dateRange: [],
|
|
},
|
|
},
|
|
@@ -248,8 +273,8 @@ export default defineComponent({
|
|
// 初始化表格数据
|
|
// 初始化表格数据
|
|
const initTableData = () => {
|
|
const initTableData = () => {
|
|
typeList();
|
|
typeList();
|
|
- getProductList()
|
|
|
|
-
|
|
|
|
|
|
+ getProductList();
|
|
|
|
+ getDeptTree();
|
|
};
|
|
};
|
|
const typeList = () => {
|
|
const typeList = () => {
|
|
state.tableData.loading = true;
|
|
state.tableData.loading = true;
|
|
@@ -371,6 +396,7 @@ export default defineComponent({
|
|
formEl.resetFields();
|
|
formEl.resetFields();
|
|
state.tableData.param.tags = []; // 确保标签也被重置
|
|
state.tableData.param.tags = []; // 确保标签也被重置
|
|
state.tableData.param.deviceTypes = []; // 确保设备类型也被重置
|
|
state.tableData.param.deviceTypes = []; // 确保设备类型也被重置
|
|
|
|
+ state.tableData.param.deptIds = []; // 确保所属组织也被重置
|
|
typeList();
|
|
typeList();
|
|
};
|
|
};
|
|
// 多选框选中数据
|
|
// 多选框选中数据
|
|
@@ -391,6 +417,42 @@ export default defineComponent({
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 获取部门树
|
|
|
|
+ const getDeptTree = () => {
|
|
|
|
+ systemApi.dept.getList({status: -1}).then((res: any) => {
|
|
|
|
+ // 完整打印响应对象
|
|
|
|
+ console.log('部门树完整响应:', JSON.stringify(res));
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ // 尝试多种可能的数据访问路径
|
|
|
|
+ if (res && res.data && res.data.Data) {
|
|
|
|
+ deptOptions.value = res.data.Data;
|
|
|
|
+ console.log('路径1 - res.data.Data:', deptOptions.value);
|
|
|
|
+ } else if (res && res.Data) {
|
|
|
|
+ deptOptions.value = res.Data;
|
|
|
|
+ console.log('路径2 - res.Data:', deptOptions.value);
|
|
|
|
+ } else if (Array.isArray(res)) {
|
|
|
|
+ deptOptions.value = res;
|
|
|
|
+ console.log('路径3 - res是数组:', deptOptions.value);
|
|
|
|
+ } else {
|
|
|
|
+ // 尝试直接使用原始数据
|
|
|
|
+ console.log('找不到有效的部门数据路径,响应类型:', typeof res);
|
|
|
|
+ console.log('响应顶级属性:', Object.keys(res));
|
|
|
|
+ if (res && typeof res === 'object') {
|
|
|
|
+ for (const key in res) {
|
|
|
|
+ console.log(`res.${key} 类型:`, typeof res[key]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (err) {
|
|
|
|
+ console.error('处理部门数据时出错:', err);
|
|
|
|
+ }
|
|
|
|
+ }).catch(error => {
|
|
|
|
+ console.error('获取部门树出错:', error);
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
return {
|
|
return {
|
|
|
|
|
|
addDicRef,
|
|
addDicRef,
|
|
@@ -402,6 +464,7 @@ export default defineComponent({
|
|
onActionStatus,
|
|
onActionStatus,
|
|
batchLoading,
|
|
batchLoading,
|
|
showMoreFilter,
|
|
showMoreFilter,
|
|
|
|
+ deptOptions,
|
|
setDeviceStatus1,
|
|
setDeviceStatus1,
|
|
setDeviceStatus0,
|
|
setDeviceStatus0,
|
|
onOpenDetail,
|
|
onOpenDetail,
|