Zhangbw 2 miesięcy temu
rodzic
commit
22860f240b

+ 11 - 0
src/api/miniapp/user/index.ts

@@ -62,4 +62,15 @@ export function changeUserStatus(id: number, status: number) {
     method: 'put',
     params: { id, status }
   });
+}
+
+/**
+ * 修改用户密码
+ */
+export function changeUserPassword(id: number, password: string) {
+  return request({
+    url: '/miniapp/user/changePassword',
+    method: 'put',
+    params: { id, password }
+  });
 }

+ 12 - 0
src/api/stock/pool/index.ts

@@ -52,3 +52,15 @@ export function searchStock(keyword: string) {
     params: { keyword }
   });
 }
+
+/**
+ * 补全历史数据
+ * @param importDate 导入日期(格式:yyyy-MM-dd)
+ */
+export function completeHistory(importDate: string) {
+  return request({
+    url: '/stock/pool/completeHistory',
+    method: 'post',
+    params: { importDate }
+  });
+}

+ 32 - 12
src/views/miniapp/subscription/index.vue

@@ -35,7 +35,7 @@
       <template #header>
         <el-row :gutter="10">
           <el-col :span="1.5">
-            <el-button v-has-permi="['miniapp:subscription:edit']" type="success" plain icon="Edit" :disabled="single" @click="handleEditSelected">修改</el-button>
+            <el-button v-has-permi="['miniapp:subscription:edit']" type="success" plain icon="Edit" :disabled="multiple" @click="handleEditSelected">批量修改</el-button>
           </el-col>
           <el-col :span="1.5">
             <el-button v-has-permi="['miniapp:subscription:remove']" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDeleteSelected">删除</el-button>
@@ -97,7 +97,7 @@
     </el-card>
 
     <!-- 编辑对话框 -->
-    <el-dialog v-model="editDialog.visible" title="编辑订阅" width="500px" append-to-body>
+    <el-dialog v-model="editDialog.visible" :title="form.ids ? `批量修改订阅 (${form.ids.length}条)` : '编辑订阅'" width="500px" append-to-body>
       <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
         <el-form-item label="到期时间" prop="expireTime">
           <el-date-picker v-model="form.expireTime" type="datetime" placeholder="选择到期时间" style="width: 100%" />
@@ -153,8 +153,8 @@ const form = ref<any>({
 });
 
 const rules = reactive({
-  expireTime: [{ required: true, message: '请选择到期时间', trigger: 'change' }],
-  status: [{ required: true, message: '请选择状态', trigger: 'change' }]
+  expireTime: [{ required: false, message: '请选择到期时间', trigger: 'change' }],
+  status: [{ required: false, message: '请选择状态', trigger: 'change' }]
 });
 
 /** 查询列表 */
@@ -202,12 +202,14 @@ const handleSelectionChange = (selection: any[]) => {
   multiple.value = !selection.length;
 };
 
-/** 修改按钮(工具栏) */
+/** 批量修改按钮(工具栏) */
 const handleEditSelected = () => {
-  const row = dataList.value.find(item => item.id === ids.value[0]);
-  if (row) {
-    handleEdit(row);
-  }
+  form.value = {
+    ids: ids.value,
+    expireTime: '',
+    status: undefined
+  };
+  editDialog.value.visible = true;
 };
 
 /** 删除按钮(工具栏) */
@@ -225,7 +227,7 @@ const handleDeleteSelected = async () => {
 /** 编辑 */
 const handleEdit = (row: any) => {
   form.value = {
-    id: row.id,
+    ids: [row.id],
     expireTime: row.expireTime,
     status: row.status
   };
@@ -235,8 +237,26 @@ const handleEdit = (row: any) => {
 /** 提交表单 */
 const submitForm = async () => {
   await formRef.value?.validate();
-  await request.put('/miniapp/subscription', form.value);
-  proxy?.$modal.msgSuccess('修改成功');
+  const submitData = { ...form.value };
+  // 格式化日期为后端期望的格式
+  if (submitData.expireTime) {
+    const date = new Date(submitData.expireTime);
+    submitData.expireTime = date.getFullYear() + '-' +
+      String(date.getMonth() + 1).padStart(2, '0') + '-' +
+      String(date.getDate()).padStart(2, '0') + ' ' +
+      String(date.getHours()).padStart(2, '0') + ':' +
+      String(date.getMinutes()).padStart(2, '0') + ':' +
+      String(date.getSeconds()).padStart(2, '0');
+  }
+  if (submitData.ids) {
+    // 批量修改
+    await request.put('/miniapp/subscription/batch', submitData);
+    proxy?.$modal.msgSuccess(`成功修改${submitData.ids.length}条订阅记录`);
+  } else {
+    // 单个修改
+    await request.put('/miniapp/subscription/batch', submitData);
+    proxy?.$modal.msgSuccess('修改成功');
+  }
   editDialog.value.visible = false;
   getList();
 };

+ 73 - 22
src/views/miniapp/user/index.vue

@@ -58,7 +58,7 @@
           </template>
         </el-table-column>
         <el-table-column label="注册时间" align="center" prop="createTime" />
-        <el-table-column label="操作" align="center" width="280">
+        <el-table-column label="操作" align="center" width="320">
           <template #default="scope">
             <el-tooltip content="修改" placement="top">
               <el-button v-has-permi="['miniapp:user:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
@@ -66,32 +66,38 @@
             <el-tooltip content="删除" placement="top">
               <el-button v-has-permi="['miniapp:user:remove']" link type="danger" icon="Delete" @click="handleDelete(scope.row)"></el-button>
             </el-tooltip>
-            <el-button 
-              v-if="scope.row.status === 0" 
-              v-has-permi="['miniapp:user:edit']" 
-              link 
-              type="danger" 
+            <el-button
+              v-has-permi="['miniapp:user:edit']"
+              link
+              type="primary"
+              @click="handleChangePassword(scope.row)"
+            >修改密码</el-button>
+            <el-button
+              v-if="scope.row.status === 0"
+              v-has-permi="['miniapp:user:edit']"
+              link
+              type="danger"
               @click="handleDisable(scope.row)"
             >禁用</el-button>
-            <el-button 
-              v-if="scope.row.status === 1" 
-              v-has-permi="['miniapp:user:edit']" 
-              link 
-              type="success" 
+            <el-button
+              v-if="scope.row.status === 1"
+              v-has-permi="['miniapp:user:edit']"
+              link
+              type="success"
               @click="handleEnable(scope.row)"
             >启用</el-button>
-            <el-button 
-              v-if="scope.row.status === 0" 
-              v-has-permi="['miniapp:user:edit']" 
-              link 
-              type="warning" 
+            <el-button
+              v-if="scope.row.status === 0"
+              v-has-permi="['miniapp:user:edit']"
+              link
+              type="warning"
               @click="handleSetAdmin(scope.row)"
             >设为管理员</el-button>
-            <el-button 
-              v-if="scope.row.status === 2" 
-              v-has-permi="['miniapp:user:edit']" 
-              link 
-              type="info" 
+            <el-button
+              v-if="scope.row.status === 2"
+              v-has-permi="['miniapp:user:edit']"
+              link
+              type="info"
               @click="handleCancelAdmin(scope.row)"
             >取消管理员</el-button>
           </template>
@@ -145,12 +151,25 @@
         <el-button type="primary" @click="submitForm">确定</el-button>
       </template>
     </el-dialog>
+
+    <!-- 修改密码对话框 -->
+    <el-dialog v-model="passwordDialog.visible" title="修改密码" width="400px" append-to-body>
+      <el-form ref="passwordFormRef" :model="passwordForm" :rules="passwordRules" label-width="80px">
+        <el-form-item label="新密码" prop="password">
+          <el-input v-model="passwordForm.password" type="password" placeholder="请输入新密码" show-password />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <el-button @click="passwordDialog.visible = false">取消</el-button>
+        <el-button type="primary" @click="submitPasswordForm">确定</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
 <script setup name="MiniappUser" lang="ts">
 import { ref, onMounted, getCurrentInstance, reactive } from 'vue';
-import { listMiniappUser, getMiniappUser, updateMiniappUser, delMiniappUser, changeUserStatus } from '@/api/miniapp/user';
+import { listMiniappUser, getMiniappUser, updateMiniappUser, delMiniappUser, changeUserStatus, changeUserPassword } from '@/api/miniapp/user';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
@@ -166,6 +185,7 @@ const selectedRow = ref<any>({});
 
 const queryFormRef = ref<ElFormInstance>();
 const formRef = ref<ElFormInstance>();
+const passwordFormRef = ref<ElFormInstance>();
 
 const queryParams = ref({
   pageNum: 1,
@@ -184,6 +204,10 @@ const formDialog = ref({
   title: ''
 });
 
+const passwordDialog = ref({
+  visible: false
+});
+
 const form = ref<any>({
   id: undefined,
   nickname: '',
@@ -191,6 +215,11 @@ const form = ref<any>({
   status: 0
 });
 
+const passwordForm = ref<any>({
+  id: undefined,
+  password: ''
+});
+
 const rules = reactive({
   nickname: [{ required: true, message: '昵称不能为空', trigger: 'blur' }],
   phone: [
@@ -200,6 +229,10 @@ const rules = reactive({
   status: [{ required: true, message: '请选择状态', trigger: 'change' }]
 });
 
+const passwordRules = reactive({
+  password: [{ required: true, message: '密码不能为空', trigger: 'blur' }]
+});
+
 const currentUser = ref<any>({});
 
 /** 查询用户列表 */
@@ -397,6 +430,24 @@ const handleExport = () => {
   proxy?.download('miniapp/user/export', { ...queryParams.value }, `miniapp_user_${new Date().getTime()}.xlsx`);
 };
 
+/** 修改密码按钮操作 */
+const handleChangePassword = (row: any) => {
+  passwordForm.value = {
+    id: row.id,
+    password: ''
+  };
+  passwordDialog.value.visible = true;
+};
+
+/** 提交密码表单 */
+const submitPasswordForm = async () => {
+  await passwordFormRef.value?.validate();
+  await changeUserPassword(passwordForm.value.id, passwordForm.value.password);
+  proxy?.$modal.msgSuccess('密码修改成功');
+  passwordDialog.value.visible = false;
+  passwordForm.value = { id: undefined, password: '' };
+};
+
 onMounted(() => {
   getList();
 });

+ 6 - 3
src/views/stock/shortPool/index.vue

@@ -13,7 +13,8 @@
             </el-form-item>
             <el-form-item label="状态" prop="status">
               <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
-                <el-option label="有效" :value="1" />
+                <el-option label="当前有效" :value="2" />
+                <el-option label="历史有效" :value="1" />
                 <el-option label="已移除" :value="0" />
               </el-select>
             </el-form-item>
@@ -84,7 +85,9 @@
         <el-table-column label="入池日期" align="center" prop="addDate" />
         <el-table-column label="状态" align="center" prop="status">
           <template #default="scope">
-            <el-tag :type="scope.row.status === 1 ? 'success' : 'info'">{{ scope.row.status === 1 ? '有效' : '已移除' }}</el-tag>
+            <el-tag v-if="scope.row.status === 2" type="success">当前有效</el-tag>
+            <el-tag v-else-if="scope.row.status === 1" type="warning">历史有效</el-tag>
+            <el-tag v-else type="info">已移除</el-tag>
           </template>
         </el-table-column>
         <el-table-column label="操作" align="center" width="100">
@@ -128,7 +131,7 @@ const queryParams = ref({
   stockCode: '',
   stockName: '',
   poolType: 1,  // 固定为超短池
-  status: 1 as number | undefined,
+  status: undefined as number | undefined,
   startDate: undefined as string | undefined,
   endDate: undefined as string | undefined
 });

+ 6 - 3
src/views/stock/strongPool/index.vue

@@ -13,7 +13,8 @@
             </el-form-item>
             <el-form-item label="状态" prop="status">
               <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
-                <el-option label="有效" :value="1" />
+                <el-option label="当前有效" :value="2" />
+                <el-option label="历史有效" :value="1" />
                 <el-option label="已移除" :value="0" />
               </el-select>
             </el-form-item>
@@ -84,7 +85,9 @@
         <el-table-column label="入池日期" align="center" prop="addDate" />
         <el-table-column label="状态" align="center" prop="status">
           <template #default="scope">
-            <el-tag :type="scope.row.status === 1 ? 'success' : 'info'">{{ scope.row.status === 1 ? '有效' : '已移除' }}</el-tag>
+            <el-tag v-if="scope.row.status === 2" type="success">当前有效</el-tag>
+            <el-tag v-else-if="scope.row.status === 1" type="warning">历史有效</el-tag>
+            <el-tag v-else type="info">已移除</el-tag>
           </template>
         </el-table-column>
         <el-table-column label="操作" align="center" width="100">
@@ -128,7 +131,7 @@ const queryParams = ref({
   stockCode: '',
   stockName: '',
   poolType: 2,  // 固定为强势池
-  status: 1 as number | undefined,
+  status: undefined as number | undefined,
   startDate: undefined as string | undefined,
   endDate: undefined as string | undefined
 });