feat:硬件分组查询
This commit is contained in:
1 parent
3262e2cbd2
commit
6e32c1d4d7
9 files changed
+433
-19
No files matched your search
@@ -22,14 +22,14 @@
|
||||
<el-button circle icon="Refresh" @click="handleRefresh()" />
|
||||
</el-tooltip>
|
||||
|
||||
<!-- 插槽 -->
|
||||
<slot></slot>
|
||||
</el-row>
|
||||
<!-- 插槽 -->
|
||||
<slot></slot>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="right-toolbar">
|
||||
import { auth } from '/@/utils/authFunction';
|
||||
import { auth } from "/@/utils/authFunction"
|
||||
|
||||
/**
|
||||
* 通过 defineProps 函数定义组件 props
|
||||
@@ -63,43 +63,43 @@ const props = defineProps({
|
||||
type: Number,
|
||||
default: 10,
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
const emits = defineEmits(['update:showSearch', 'queryTable', 'exportExcel']);
|
||||
const emits = defineEmits(["update:showSearch", "queryTable", "exportExcel"])
|
||||
|
||||
const style = computed(() => {
|
||||
const ret = {};
|
||||
const ret = {}
|
||||
// 如果props中有传入gutter属性,则计算出marginRight
|
||||
if (props.gutter) {
|
||||
ret.marginRight = `${props.gutter / 2}px`;
|
||||
ret.marginRight = `${props.gutter / 2}px`
|
||||
}
|
||||
return ret; // 返回计算后的样式对象
|
||||
});
|
||||
return ret // 返回计算后的样式对象
|
||||
})
|
||||
|
||||
// 搜索
|
||||
const toggleSearch = () => {
|
||||
emits('update:showSearch', !props.showSearch);
|
||||
};
|
||||
emits("update:showSearch", !props.showSearch)
|
||||
}
|
||||
|
||||
// 刷新
|
||||
const handleRefresh = () => {
|
||||
emits('queryTable');
|
||||
};
|
||||
emits("queryTable")
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const handleExport = () => {
|
||||
emits('exportExcel');
|
||||
};
|
||||
emits("exportExcel")
|
||||
}
|
||||
|
||||
// 是否导出
|
||||
const isExport = () => {
|
||||
if (props.export === true) {
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
|
||||
// 字符串鉴权
|
||||
return props.export && auth(props.export);
|
||||
};
|
||||
return props.export && auth(props.export)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="state.selectId"
|
||||
:placeholder="props.placeholder"
|
||||
clearable
|
||||
remote-show-suffix
|
||||
filterable
|
||||
remote
|
||||
:remote-method="remoteSearch"
|
||||
:loading="state.loading"
|
||||
@visible-change="(e: boolean) => e && getOptions()"
|
||||
>
|
||||
<el-option v-for="v in state.options" :key="v.id" :label="`${v.name}`" :value="v.id">
|
||||
<div class="flex items-center">
|
||||
<div class="color-primary">{{ v.name }}</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="select-hard-group">
|
||||
import { reactive, defineModel, withDefaults, defineProps } from "vue"
|
||||
import * as hardGroup from "/@/api/hard/hard-group"
|
||||
|
||||
const selectId = defineModel()
|
||||
|
||||
export type Props = {
|
||||
placeholder?: string
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
placeholder: "请选择",
|
||||
})
|
||||
|
||||
const queryForm = reactive<any>({
|
||||
name: null,
|
||||
current: 1,
|
||||
size: 10,
|
||||
})
|
||||
|
||||
const state = reactive<any>({
|
||||
loading: true,
|
||||
selectId: selectId,
|
||||
options: [],
|
||||
})
|
||||
|
||||
watch(
|
||||
selectId,
|
||||
(newVal, oldValue) => {
|
||||
if (newVal == oldValue) return
|
||||
state.selectId = newVal
|
||||
getOptions()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
async function getOptions() {
|
||||
try {
|
||||
state.loading = true
|
||||
const _pa = {
|
||||
...queryForm,
|
||||
}
|
||||
const { data } = await hardGroup.pageJoin(_pa)
|
||||
state.options = data.records ?? []
|
||||
} finally {
|
||||
setTimeout(() => (state.loading = false), 500)
|
||||
}
|
||||
}
|
||||
|
||||
function remoteSearch(params: string) {
|
||||
if (params != queryForm.name) {
|
||||
queryForm.name = params
|
||||
getOptions()
|
||||
}
|
||||
}
|
||||
|
||||
function clear() {
|
||||
state.selectId = null
|
||||
getOptions()
|
||||
}
|
||||
</script>
|
||||
@@ -20,6 +20,7 @@ import SelectMch from "/@/components/Select/SelectMch.vue"
|
||||
import SelectDept from "/@/components/Select/SelectDept.vue"
|
||||
import SelectCtcg from "/@/components/Select/SelectCtcg.vue"
|
||||
import SelectCtcgol from "/@/components/Select/SelectCtcgol.vue"
|
||||
import SelectHardGroup from "/@/components/Select/selectHardGroup.vue"
|
||||
|
||||
// 第三方组件
|
||||
import ElementPlus from "element-plus"
|
||||
@@ -61,6 +62,7 @@ export default {
|
||||
app.component("SelectDept", SelectDept)
|
||||
app.component("SelectCtcg", SelectCtcg)
|
||||
app.component("SelectCtcgol", SelectCtcgol)
|
||||
app.component("SelectHardGroup", SelectHardGroup)
|
||||
|
||||
// 导入全部的elmenet-plus的图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
|
||||
Reference in new issue
Block a user