|
|
@@ -13,16 +13,25 @@
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</pane> -->
|
|
|
- <pane size="84">
|
|
|
+ <pane size="100">
|
|
|
<el-col>
|
|
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
- <el-form-item label="名称" prop="name">
|
|
|
- <el-input
|
|
|
- v-model=" queryParams.name"
|
|
|
- placeholder="请输入代理商名称"
|
|
|
+ <el-form-item label="代理商" prop="agentId">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.agentId"
|
|
|
+ placeholder="请选择或搜索代理商"
|
|
|
+ filterable
|
|
|
clearable
|
|
|
+ style="width: 240px"
|
|
|
@keyup.enter="handleQuery"
|
|
|
- />
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in flatAgentOptions"
|
|
|
+ :key="item.agentId"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.agentId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item label="联系电话" prop="phonenumber">
|
|
|
<el-input
|
|
|
@@ -59,6 +68,15 @@
|
|
|
@click="toggleExpandAll"
|
|
|
>展开/折叠</el-button>
|
|
|
</el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="Download"
|
|
|
+ @click="handleExport"
|
|
|
+ v-hasPermi="['dz:agent:export']"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
@@ -69,10 +87,12 @@
|
|
|
row-key="agentId"
|
|
|
:default-expand-all="isExpandAll"
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
+ :row-style="getRowStyle"
|
|
|
>
|
|
|
<!-- <el-table-column label="用户ID" prop="userId" />-->
|
|
|
<el-table-column label="名称" align="center" prop="name" />
|
|
|
<el-table-column label="账号/邀请码" align="center" prop="agentId" />
|
|
|
+ <el-table-column label="密码" align="center" prop="password2" />
|
|
|
<!-- <el-table-column label="机构" align="center" prop="deptId" />-->
|
|
|
<el-table-column label="归属机构" align="center" key="deptName" prop="dept.deptName" :show-overflow-tooltip="true" />
|
|
|
<!-- <el-table-column label="联系电话" align="center" prop="phonenumber" /> -->
|
|
|
@@ -160,6 +180,7 @@ const appStore = useAppStore()
|
|
|
|
|
|
const agentList = ref([])
|
|
|
const agentOptions = ref([])
|
|
|
+const flatAgentOptions = ref([])
|
|
|
const open = ref(false)
|
|
|
const loading = ref(true)
|
|
|
const showSearch = ref(true)
|
|
|
@@ -175,6 +196,7 @@ const data = reactive({
|
|
|
form: {},
|
|
|
queryParams: {
|
|
|
userId: null,
|
|
|
+ agentId: null,
|
|
|
name: null,
|
|
|
deptId: null,
|
|
|
phonenumber: null,
|
|
|
@@ -196,14 +218,22 @@ const filterNode = (value, data) => {
|
|
|
|
|
|
/** 根据名称筛选机构树 */
|
|
|
watch(deptName, val => {
|
|
|
- proxy.$refs["deptTreeRef"].filter(val)
|
|
|
+ if (proxy.$refs["deptTreeRef"]) {
|
|
|
+ proxy.$refs["deptTreeRef"].filter(val)
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
/** 查询机构代理列表 */
|
|
|
function getList() {
|
|
|
loading.value = true
|
|
|
listAgent(queryParams.value).then(response => {
|
|
|
- agentList.value = proxy.handleTree(response.data, "agentId", "parentId")
|
|
|
+ const dataList = response.data || []
|
|
|
+ agentList.value = proxy.handleTree(dataList, "agentId", "parentId")
|
|
|
+ // 从原始数据中提取代理商列表用于下拉选择
|
|
|
+ flatAgentOptions.value = dataList.map(item => ({
|
|
|
+ agentId: item.agentId,
|
|
|
+ name: item.name
|
|
|
+ }))
|
|
|
loading.value = false
|
|
|
})
|
|
|
}
|
|
|
@@ -276,10 +306,14 @@ function handleQuery() {
|
|
|
function resetQuery() {
|
|
|
// 清空机构ID
|
|
|
queryParams.value.deptId = undefined
|
|
|
+ // 清空代理商ID
|
|
|
+ queryParams.value.agentId = undefined
|
|
|
// 清空机构名称
|
|
|
deptName.value = ""
|
|
|
- // 取消树节点的选中状态
|
|
|
- proxy.$refs.deptTreeRef.setCurrentKey(null)
|
|
|
+ // 取消树节点的选中状态(如果树组件存在)
|
|
|
+ if (proxy.$refs.deptTreeRef) {
|
|
|
+ proxy.$refs.deptTreeRef.setCurrentKey(null)
|
|
|
+ }
|
|
|
proxy.resetForm("queryRef")
|
|
|
handleQuery()
|
|
|
}
|
|
|
@@ -308,6 +342,16 @@ function toggleExpandAll() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+/** 设置表格行样式 */
|
|
|
+function getRowStyle({ row }) {
|
|
|
+ if (row.parentId != null && row.parentId !== 0) {
|
|
|
+ return {
|
|
|
+ backgroundColor: '#C4E7F8'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {}
|
|
|
+}
|
|
|
+
|
|
|
/** 修改按钮操作 */
|
|
|
async function handleUpdate(row) {
|
|
|
reset()
|
|
|
@@ -364,6 +408,13 @@ function handleDelete(row) {
|
|
|
}).catch(() => {})
|
|
|
}
|
|
|
|
|
|
+/** 导出按钮操作 */
|
|
|
+function handleExport() {
|
|
|
+ proxy.download('dz/agent/export', {
|
|
|
+ ...queryParams.value
|
|
|
+ }, `agent_${new Date().getTime()}.xlsx`)
|
|
|
+}
|
|
|
+
|
|
|
// getList()
|
|
|
|
|
|
onMounted(() => {
|