|
@@ -0,0 +1,169 @@
|
|
|
+<template>
|
|
|
+ <div class="dataShare-userInfo-container layout-pd">
|
|
|
+ <el-card shadow="never">
|
|
|
+ <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
|
|
|
+ <el-form-item label="平台名称" prop="Keyword">
|
|
|
+ <el-input v-model="state.queryParams.Keyword" placeholder="平台名称" clearable @keyup.enter="handleQuery" class="keyword-input" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label-width="0">
|
|
|
+ <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
|
|
|
+ <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
|
|
|
+ <SvgIcon name="ele-Refresh" class="mr5" />重置
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
+ <el-card shadow="never">
|
|
|
+ <ProTable
|
|
|
+ ref="proTableRef"
|
|
|
+ :columns="columns"
|
|
|
+ :data="state.tableData"
|
|
|
+ @updateTable="queryList"
|
|
|
+ :loading="state.loading"
|
|
|
+ :total="state.total"
|
|
|
+ v-model:page-index="state.queryParams.PageIndex"
|
|
|
+ v-model:page-size="state.queryParams.PageSize"
|
|
|
+ :key="Math.random()"
|
|
|
+ >
|
|
|
+ <template #tableHeader="scope">
|
|
|
+ <el-button type="primary" @click="onAdd(false)" :loading="state.loading" title="新增账号">
|
|
|
+ <SvgIcon name="ele-Plus" class="mr5" />新增账号
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </ProTable>
|
|
|
+ </el-card>
|
|
|
+ <el-dialog title="新增账号" v-model="state.dialogVisible" destroy-on-close append-to-body draggable>
|
|
|
+ <el-form :model="state.form" ref="formRef" label-width="120px">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
|
|
|
+ <el-form-item label="账号" prop="accountId" :rules="[{ required: true, message: '请填写账号', trigger: 'blur' }]">
|
|
|
+ <el-input v-model="state.form.accountId" placeholder="请填写账号" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
|
|
|
+ <el-form-item label="密码" prop="accountSecret" :rules="[{ required: true, message: '请填写密码', trigger: 'blur' }]">
|
|
|
+ <el-input v-model="state.form.accountSecret" placeholder="请填写密码" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
|
|
|
+ <el-form-item label="所属平台code" prop="platformSource" :rules="[{ required: true, message: '请填写所属平台code', trigger: 'blur' }]">
|
|
|
+ <el-input v-model="state.form.platformSource" placeholder="请填写所属平台code" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
|
|
|
+ <el-form-item
|
|
|
+ label="所属平台名称"
|
|
|
+ prop="platformSourceName"
|
|
|
+ :rules="[{ required: true, message: '请填写所属平台名称', trigger: 'blur' }]"
|
|
|
+ >
|
|
|
+ <el-input v-model="state.form.platformSourceName" placeholder="请填写所属平台名称" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
+ <el-form-item label="备注" prop="remark" :rules="[{ required: false, message: '请填写备注', trigger: 'blur' }]">
|
|
|
+ <el-input v-model="state.form.remark" placeholder="请填写备注" type="textarea" :autosize="{ minRows: 4, maxRows: 8 }"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="state.dialogVisible = false" class="default-button">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit(formRef)" :loading="state.loading">确 定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ <edit-record ref="editRecordRef" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup lang="tsx" name="dataShareUserInfo">
|
|
|
+import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
|
|
+import type { FormInstance } from 'element-plus';
|
|
|
+import { useRoute, useRouter } from 'vue-router';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import { getUserList, platformSourceAddUser } from '@/api/dataShare';
|
|
|
+
|
|
|
+// 引入组件
|
|
|
+const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
|
|
|
+const EditRecord = defineAsyncComponent(() => import('@/views/dataShare/RecordDialog.vue')); // 修改记录弹窗
|
|
|
+
|
|
|
+// 定义变量内容
|
|
|
+const state = reactive<any>({
|
|
|
+ queryParams: {
|
|
|
+ PageIndex: 1, // 当前页
|
|
|
+ PageSize: 10, // 每页条数
|
|
|
+ },
|
|
|
+ tableData: [], //表单
|
|
|
+ loading: false, // 加载
|
|
|
+ total: 0, // 总数
|
|
|
+ dialogVisible: false,
|
|
|
+ form: {},
|
|
|
+});
|
|
|
+const ruleFormRef = ref<RefType>(); // 表单ref
|
|
|
+const route = useRoute(); // 路由
|
|
|
+const router = useRouter(); // 路由
|
|
|
+const proTableRef = ref<RefType>(); // 表格ref
|
|
|
+// 表格配置项
|
|
|
+const columns = ref<any[]>([
|
|
|
+ { prop: 'accountId', label: '账号', align: 'center' },
|
|
|
+ { prop: 'accountSecret', label: '密码', align: 'center' },
|
|
|
+ { prop: 'platformSource', label: '所属平台code', align: 'center' },
|
|
|
+ { prop: 'platformSourceName', label: '所属平台名称', align: 'center' },
|
|
|
+ {
|
|
|
+ prop: 'state',
|
|
|
+ label: '状态',
|
|
|
+ width: 150,
|
|
|
+ render: (scope) => {
|
|
|
+ return <span>{scope.row.state === '0' ? '未启用' : scope.row.state === '1' ? '正常' : '禁用'}</span>;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ { prop: 'remark', label: '备注' },
|
|
|
+]);
|
|
|
+// 手动查询,将页码设置为1
|
|
|
+const handleQuery = () => {
|
|
|
+ state.queryParams.PageIndex = 1;
|
|
|
+ queryList();
|
|
|
+};
|
|
|
+/** 获取列表 */
|
|
|
+const queryList = () => {
|
|
|
+ state.loading = true;
|
|
|
+ getUserList(state.queryParams)
|
|
|
+ .then((response: any) => {
|
|
|
+ state.tableData = response?.result.items ?? [];
|
|
|
+ state.total = response?.result.total;
|
|
|
+ state.loading = false;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
+};
|
|
|
+/** 重置按钮操作 */
|
|
|
+const resetQuery = (formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return;
|
|
|
+ formEl.resetFields();
|
|
|
+ queryList();
|
|
|
+};
|
|
|
+// 新增账号
|
|
|
+const onAdd = (row: any) => {
|
|
|
+ state.dialogVisible = true;
|
|
|
+};
|
|
|
+const formRef = ref<RefType>();
|
|
|
+const onSubmit = (formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return;
|
|
|
+ formEl.validate((valid: boolean) => {
|
|
|
+ if (!valid) return;
|
|
|
+ state.loading = true;
|
|
|
+ platformSourceAddUser(state.form)
|
|
|
+ .then(() => {
|
|
|
+ state.loading = false;
|
|
|
+ state.dialogVisible = false;
|
|
|
+ queryList();
|
|
|
+ ElMessage.success('操作成功');
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+onMounted(() => {
|
|
|
+ queryList();
|
|
|
+});
|
|
|
+</script>
|