|
@@ -14,20 +14,22 @@
|
|
style="width: 200px"
|
|
style="width: 200px"
|
|
placeholder="搜索用户/手机号"
|
|
placeholder="搜索用户/手机号"
|
|
:prefix-icon="Search"
|
|
:prefix-icon="Search"
|
|
- />
|
|
|
|
- <el-button class="ml-10" size="large" type="primary" plain @click="downloadTemplate">下载模板</el-button>
|
|
|
|
|
|
+ />
|
|
|
|
+ <el-button class="ml-10" size="large" type="primary" plain @click="downloadTemplate"
|
|
|
|
+ >下载模板</el-button
|
|
|
|
+ >
|
|
<!-- <el-button size="large" type="primary" @click="uploadData">上传订单</el-button> -->
|
|
<!-- <el-button size="large" type="primary" @click="uploadData">上传订单</el-button> -->
|
|
<el-upload
|
|
<el-upload
|
|
v-model:file-list="fileList"
|
|
v-model:file-list="fileList"
|
|
class="upload-demo"
|
|
class="upload-demo"
|
|
:action="config.base_url + 'adm/import_lighten_card_offline'"
|
|
:action="config.base_url + 'adm/import_lighten_card_offline'"
|
|
multiple
|
|
multiple
|
|
- :data="{farmId: 766}"
|
|
|
|
|
|
+ :data="{ farmId: 766 }"
|
|
:headers="uploadHeaders"
|
|
:headers="uploadHeaders"
|
|
:on-success="handleUploadMsg"
|
|
:on-success="handleUploadMsg"
|
|
:on-error="handleUploadMsg"
|
|
:on-error="handleUploadMsg"
|
|
:limit="1"
|
|
:limit="1"
|
|
- >
|
|
|
|
|
|
+ >
|
|
<el-button class="ml-10" size="large" type="primary">上传订单</el-button>
|
|
<el-button class="ml-10" size="large" type="primary">上传订单</el-button>
|
|
</el-upload>
|
|
</el-upload>
|
|
<el-button class="ml-10" size="large" type="primary" plain>新建分组</el-button>
|
|
<el-button class="ml-10" size="large" type="primary" plain>新建分组</el-button>
|
|
@@ -36,52 +38,19 @@
|
|
</div>
|
|
</div>
|
|
<div class="user-btn-group">
|
|
<div class="user-btn-group">
|
|
<div class="btn-l">
|
|
<div class="btn-l">
|
|
- <el-button size="large" type="primary">优质用户</el-button>
|
|
|
|
|
|
+ <el-button size="large" type="primary">优质用户</el-button>
|
|
<el-button size="large" type="primary" plain>中等用户</el-button>
|
|
<el-button size="large" type="primary" plain>中等用户</el-button>
|
|
<el-button size="large" type="primary" plain>普通用户</el-button>
|
|
<el-button size="large" type="primary" plain>普通用户</el-button>
|
|
</div>
|
|
</div>
|
|
<div class="select-group">
|
|
<div class="select-group">
|
|
- <el-select
|
|
|
|
- v-model="cityVal"
|
|
|
|
- placeholder="选择省份"
|
|
|
|
- size="large"
|
|
|
|
- class="ml-10"
|
|
|
|
- style="width: 100px"
|
|
|
|
- >
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in cityOptions"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-select v-model="cityVal" placeholder="选择省份" size="large" class="ml-10" style="width: 100px">
|
|
|
|
+ <el-option v-for="item in cityOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
- <el-select
|
|
|
|
- v-model="groupVal"
|
|
|
|
- placeholder="选择分组"
|
|
|
|
- size="large"
|
|
|
|
- class="ml-10"
|
|
|
|
- style="width: 120px"
|
|
|
|
- >
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in groupOptions"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-select v-model="groupVal" placeholder="选择分组" size="large" class="ml-10" style="width: 120px">
|
|
|
|
+ <el-option v-for="item in groupOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
- <el-select
|
|
|
|
- v-model="levelVal"
|
|
|
|
- placeholder="守护等级"
|
|
|
|
- size="large"
|
|
|
|
- class="ml-10"
|
|
|
|
- style="width: 120px"
|
|
|
|
- >
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in levelOptions"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-select v-model="levelVal" placeholder="守护等级" size="large" class="ml-10" style="width: 120px">
|
|
|
|
+ <el-option v-for="item in levelOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -93,21 +62,23 @@
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<div class="user-info">
|
|
<div class="user-info">
|
|
<!-- <el-avatar :size="24" src="https://birdseye-img-ali-cdn.sysuimars.com/birdseye-look-mini/91754/1750583672619.png" /> -->
|
|
<!-- <el-avatar :size="24" src="https://birdseye-img-ali-cdn.sysuimars.com/birdseye-look-mini/91754/1750583672619.png" /> -->
|
|
- <el-avatar :size="24" :src="scope.row.icon || 'https://birdseye-img.sysuimars.com/dinggou-mini/defalut-icon.png'" />
|
|
|
|
|
|
+ <el-avatar
|
|
|
|
+ :size="24"
|
|
|
|
+ :src="
|
|
|
|
+ scope.row.icon || 'https://birdseye-img.sysuimars.com/dinggou-mini/defalut-icon.png'
|
|
|
|
+ "
|
|
|
|
+ />
|
|
<span class="ml-10">{{ scope.row.name }}</span>
|
|
<span class="ml-10">{{ scope.row.name }}</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column property="tel" label="联系电话" width="120" />
|
|
<el-table-column property="tel" label="联系电话" width="120" />
|
|
- <el-table-column
|
|
|
|
- property="address"
|
|
|
|
- label="具体住址"
|
|
|
|
- width="240"
|
|
|
|
- show-overflow-tooltip
|
|
|
|
- />
|
|
|
|
|
|
+ <el-table-column property="address" label="具体住址" width="240" show-overflow-tooltip />
|
|
<el-table-column label="守护等级">
|
|
<el-table-column label="守护等级">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <span :class="['level-tag', 'level-'+scope.row.level?.id]">{{ levelObj[scope.row.level?.id] }}</span>
|
|
|
|
|
|
+ <span :class="['level-tag', 'level-' + scope.row.level?.id]">{{
|
|
|
|
+ levelObj[scope.row.level?.id]
|
|
|
|
+ }}</span>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column property="fosterCode" label="守护树编号" />
|
|
<el-table-column property="fosterCode" label="守护树编号" />
|
|
@@ -116,21 +87,28 @@
|
|
<span :class="['status-text']">{{ scope.row.fosterStatus }}</span>
|
|
<span :class="['status-text']">{{ scope.row.fosterStatus }}</span>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="日期" sortable>
|
|
|
|
|
|
+ <!-- <el-table-column label="日期" sortable>
|
|
<template #default="scope">{{ scope.row.fosterDate }}</template>
|
|
<template #default="scope">{{ scope.row.fosterDate }}</template>
|
|
- </el-table-column>
|
|
|
|
|
|
+ </el-table-column> -->
|
|
|
|
+ <el-table-column property="fosterCode" label="守护树编号" />
|
|
<el-table-column label="操作" width="310">
|
|
<el-table-column label="操作" width="310">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<div class="action-btn">
|
|
<div class="action-btn">
|
|
- <el-button type="primary" @click="handleMsg(scope.row)"><el-icon class="el-icon--right"><Comment /></el-icon>发消息</el-button>
|
|
|
|
- <el-button type="primary" @click="handleMsg(scope.row)"><el-icon><Briefcase /></el-icon>发礼物</el-button>
|
|
|
|
- <el-button type="danger" @click="deleteUser(scope.row)"><el-icon><Delete /></el-icon>删除</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="handleMsg(scope.row)"
|
|
|
|
+ ><el-icon class="el-icon--right"><Comment /></el-icon>发消息</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button type="primary" @click="handleMsg(scope.row)"
|
|
|
|
+ ><el-icon><Briefcase /></el-icon>发礼物</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button type="danger" @click="deleteUser(scope.row)"
|
|
|
|
+ ><el-icon><Delete /></el-icon>删除</el-button
|
|
|
|
+ >
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
|
|
+
|
|
<div class="pagination-wrap">
|
|
<div class="pagination-wrap">
|
|
<el-pagination
|
|
<el-pagination
|
|
v-model:current-page="currentPage"
|
|
v-model:current-page="currentPage"
|
|
@@ -140,7 +118,7 @@
|
|
:total="totalVal"
|
|
:total="totalVal"
|
|
@size-change="handleSizeChange"
|
|
@size-change="handleSizeChange"
|
|
@current-change="getTableData"
|
|
@current-change="getTableData"
|
|
- />
|
|
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
<div class="put-btn" v-if="selectedRows.length">
|
|
<div class="put-btn" v-if="selectedRows.length">
|
|
<div class="btn-l">推送消息</div>
|
|
<div class="btn-l">推送消息</div>
|
|
@@ -150,14 +128,14 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { onMounted, ref } from 'vue';
|
|
|
|
-import { Search } from '@element-plus/icons-vue'
|
|
|
|
|
|
+import { onMounted, ref } from "vue";
|
|
|
|
+import { Search } from "@element-plus/icons-vue";
|
|
import config from "@/api/config.js";
|
|
import config from "@/api/config.js";
|
|
import { useStore } from "vuex";
|
|
import { useStore } from "vuex";
|
|
-import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
let store = useStore();
|
|
let store = useStore();
|
|
|
|
|
|
-const searchVal = ref(null)
|
|
|
|
|
|
+const searchVal = ref(null);
|
|
|
|
|
|
const levelObj = {
|
|
const levelObj = {
|
|
0: "平民",
|
|
0: "平民",
|
|
@@ -165,50 +143,50 @@ const levelObj = {
|
|
2: "白银守护",
|
|
2: "白银守护",
|
|
3: "赤金守护",
|
|
3: "赤金守护",
|
|
4: "星勋守护",
|
|
4: "星勋守护",
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
const statusObj = {
|
|
const statusObj = {
|
|
0: "未授权",
|
|
0: "未授权",
|
|
1: "待登录",
|
|
1: "待登录",
|
|
2: "待激活",
|
|
2: "待激活",
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
const tableData = ref([]);
|
|
const tableData = ref([]);
|
|
|
|
|
|
-const selectedRows = ref([])
|
|
|
|
|
|
+const selectedRows = ref([]);
|
|
function handleTableSelect(selection) {
|
|
function handleTableSelect(selection) {
|
|
- selectedRows.value = selection
|
|
|
|
|
|
+ selectedRows.value = selection;
|
|
}
|
|
}
|
|
function handleMsg(row) {
|
|
function handleMsg(row) {
|
|
- console.log('row');
|
|
|
|
|
|
+ console.log("row");
|
|
}
|
|
}
|
|
|
|
|
|
-const cityVal = ref("广东省")
|
|
|
|
|
|
+const cityVal = ref("广东省");
|
|
const cityOptions = ref([
|
|
const cityOptions = ref([
|
|
- {label: "广东省", value: "广东省"},
|
|
|
|
- {label: "湖北省", value: "湖北省"},
|
|
|
|
-])
|
|
|
|
|
|
+ { label: "广东省", value: "广东省" },
|
|
|
|
+ { label: "湖北省", value: "湖北省" },
|
|
|
|
+]);
|
|
|
|
|
|
-const groupVal = ref("分组101")
|
|
|
|
|
|
+const groupVal = ref("分组101");
|
|
const groupOptions = ref([
|
|
const groupOptions = ref([
|
|
- {label: "分组101", value: "分组101"},
|
|
|
|
- {label: "分组102", value: "分组102"},
|
|
|
|
-])
|
|
|
|
|
|
+ { label: "分组101", value: "分组101" },
|
|
|
|
+ { label: "分组102", value: "分组102" },
|
|
|
|
+]);
|
|
|
|
|
|
-const levelVal = ref("")
|
|
|
|
|
|
+const levelVal = ref("");
|
|
const levelOptions = ref([
|
|
const levelOptions = ref([
|
|
- {label: "平民", value: "平民"},
|
|
|
|
- {label: "青铜守护", value: "青铜守护"},
|
|
|
|
- {label: "白银守护", value: "白银守护"},
|
|
|
|
-])
|
|
|
|
|
|
+ { label: "平民", value: "平民" },
|
|
|
|
+ { label: "青铜守护", value: "青铜守护" },
|
|
|
|
+ { label: "白银守护", value: "白银守护" },
|
|
|
|
+]);
|
|
|
|
|
|
const currentPage = ref(1);
|
|
const currentPage = ref(1);
|
|
const pageSize = ref(20); // 每页显示20条数据
|
|
const pageSize = ref(20); // 每页显示20条数据
|
|
const totalVal = ref(0);
|
|
const totalVal = ref(0);
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- getTableData()
|
|
|
|
-})
|
|
|
|
|
|
+ getTableData();
|
|
|
|
+});
|
|
|
|
|
|
function handleSizeChange(newSize) {
|
|
function handleSizeChange(newSize) {
|
|
pageSize.value = newSize;
|
|
pageSize.value = newSize;
|
|
@@ -217,48 +195,57 @@ function handleSizeChange(newSize) {
|
|
}
|
|
}
|
|
|
|
|
|
function getTableData() {
|
|
function getTableData() {
|
|
- // 模拟获取数据
|
|
|
|
- VE_API.manage_interface.fetchUserList({farmId: 766, page: currentPage.value, limit: pageSize.value}).then(({data, count}) => {
|
|
|
|
- tableData.value = data;
|
|
|
|
- totalVal.value = count
|
|
|
|
- });
|
|
|
|
|
|
+ // 获取数据
|
|
|
|
+ VE_API.manage_interface
|
|
|
|
+ .fetchUserList({ farmId: 766, page: currentPage.value, limit: pageSize.value })
|
|
|
|
+ .then(({ data, count }) => {
|
|
|
|
+ tableData.value = data;
|
|
|
|
+ totalVal.value = count;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
// 下载模板
|
|
// 下载模板
|
|
function downloadTemplate() {
|
|
function downloadTemplate() {
|
|
- VE_API.manage_user.downloadTemplate().then((response) => {
|
|
|
|
- const blob = new Blob([response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
|
- const link = document.createElement('a');
|
|
|
|
- link.href = window.URL.createObjectURL(blob);
|
|
|
|
- link.download = '用户数据模板.xlsx';
|
|
|
|
- link.click();
|
|
|
|
- }).catch(error => {
|
|
|
|
- console.error('下载模板失败:', error);
|
|
|
|
- });
|
|
|
|
|
|
+ VE_API.manage_user
|
|
|
|
+ .downloadTemplate()
|
|
|
|
+ .then((response) => {
|
|
|
|
+ const blob = new Blob([response], {
|
|
|
|
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
+ });
|
|
|
|
+ const link = document.createElement("a");
|
|
|
|
+ link.href = window.URL.createObjectURL(blob);
|
|
|
|
+ link.download = "用户数据模板.xlsx";
|
|
|
|
+ link.click();
|
|
|
|
+ })
|
|
|
|
+ .catch((error) => {
|
|
|
|
+ console.error("下载模板失败:", error);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
const fileList = ref([]);
|
|
const fileList = ref([]);
|
|
const uploadHeaders = {
|
|
const uploadHeaders = {
|
|
- 'token': store.getters.token,
|
|
|
|
|
|
+ token: store.getters.token,
|
|
};
|
|
};
|
|
// 上传数据
|
|
// 上传数据
|
|
function handleUploadMsg(res) {
|
|
function handleUploadMsg(res) {
|
|
ElMessage.success(res.msg);
|
|
ElMessage.success(res.msg);
|
|
|
|
+ getTableData(); // 刷新表格数据
|
|
}
|
|
}
|
|
|
|
|
|
// 删除数据
|
|
// 删除数据
|
|
function deleteUser(item) {
|
|
function deleteUser(item) {
|
|
- ElMessageBox.confirm(`确认删除 ${item.name} 的守护权限吗?`, '提示', {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning',
|
|
|
|
|
|
+ ElMessageBox.confirm(`确认删除 ${item.name} 的守护权限吗?`, "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
}).then(() => {
|
|
}).then(() => {
|
|
- // 这里可以添加取消守护的逻辑
|
|
|
|
- ElMessage({
|
|
|
|
- type: 'success',
|
|
|
|
- message: `已删除 ${item.name}`,
|
|
|
|
|
|
+ VE_API.manage_user.deleteUser({ id: item.id }).then(({ code }) => {
|
|
|
|
+ if (code === 0) {
|
|
|
|
+ ElMessage.success("删除成功");
|
|
|
|
+ getTableData(); // 刷新表格数据
|
|
|
|
+ }
|
|
});
|
|
});
|
|
- }).catch(() => {});
|
|
|
|
|
|
+ });
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -336,29 +323,29 @@ function deleteUser(item) {
|
|
background: rgba(3, 178, 213, 0.2);
|
|
background: rgba(3, 178, 213, 0.2);
|
|
}
|
|
}
|
|
.level-1 {
|
|
.level-1 {
|
|
- color: #D88C4A;
|
|
|
|
|
|
+ color: #d88c4a;
|
|
background: rgba(200, 156, 117, 0.2);
|
|
background: rgba(200, 156, 117, 0.2);
|
|
}
|
|
}
|
|
.level-2 {
|
|
.level-2 {
|
|
- color: #6293C1;
|
|
|
|
|
|
+ color: #6293c1;
|
|
background: rgba(115, 193, 255, 0.2);
|
|
background: rgba(115, 193, 255, 0.2);
|
|
}
|
|
}
|
|
.level-3 {
|
|
.level-3 {
|
|
- color: #B18C0D;
|
|
|
|
|
|
+ color: #b18c0d;
|
|
background: rgba(243, 191, 48, 0.2);
|
|
background: rgba(243, 191, 48, 0.2);
|
|
}
|
|
}
|
|
.level-4 {
|
|
.level-4 {
|
|
- color: #BD6FE8;
|
|
|
|
|
|
+ color: #bd6fe8;
|
|
background: rgba(236, 125, 255, 0.2);
|
|
background: rgba(236, 125, 255, 0.2);
|
|
}
|
|
}
|
|
.status-text {
|
|
.status-text {
|
|
- color: #7D7D7D;
|
|
|
|
|
|
+ color: #7d7d7d;
|
|
}
|
|
}
|
|
.status-1 {
|
|
.status-1 {
|
|
- color: #FFAA00;
|
|
|
|
|
|
+ color: #ffaa00;
|
|
}
|
|
}
|
|
.status-2 {
|
|
.status-2 {
|
|
- color: #2199F8;
|
|
|
|
|
|
+ color: #2199f8;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.pagination-wrap {
|
|
.pagination-wrap {
|
|
@@ -376,7 +363,7 @@ function deleteUser(item) {
|
|
bottom: 10px;
|
|
bottom: 10px;
|
|
.btn-l {
|
|
.btn-l {
|
|
padding: 12px 44px;
|
|
padding: 12px 44px;
|
|
- background: #F0AC37;
|
|
|
|
|
|
+ background: #f0ac37;
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
color: #fff;
|
|
color: #fff;
|
|
@@ -384,7 +371,7 @@ function deleteUser(item) {
|
|
.btn-r {
|
|
.btn-r {
|
|
margin-left: 30px;
|
|
margin-left: 30px;
|
|
padding: 12px 36px;
|
|
padding: 12px 36px;
|
|
- background: #2199F8;
|
|
|
|
|
|
+ background: #2199f8;
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
color: #fff;
|
|
color: #fff;
|