个人数据修改

main
zsk 2 years ago
parent 2d2aad731b
commit 054a14ccae

@ -13,6 +13,15 @@ export function getUserListApi (data) {
}); });
} }
// 获取用户列表
export function getStockUserListApi (data) {
console.log(data);
return request({
url: `/admin/user/stock/${data.page}/${data.limit}?keyword=${data.keyword}`,
method: "get",
});
}
// 用户状态变更 // 用户状态变更
export function updateUserStatusApi (data) { export function updateUserStatusApi (data) {
return request({ return request({
@ -29,6 +38,14 @@ export function addUserApi (data) {
data data
}); });
} }
// 新增个人数据
export function addStockUserApi (data) {
return request({
url: `/admin/user/stock/save`,
method: "post",
data
});
}
// 更新用户 // 更新用户
export function updateUserApi (data) { export function updateUserApi (data) {
return request({ return request({

@ -303,9 +303,9 @@ const getTable = () => {
}; };
const openAdd = () =>{ const openAdd = () =>{
showAdd.value = true showAdd.value = true
modalInfo.value.title = "新增用户"
modalInfo.value.id = 0; modalInfo.value.id = 0;
modalInfo.value = { modalInfo.value = {
title : "新增用户",
form:{ form:{
name:"", name:"",
username:'', username:'',

@ -9,7 +9,7 @@
</div> </div>
<div> <div>
<!-- <a-button type="primary" @click="openAdd" :icon="h(PlusOutlined)">新增用户</a-button> --> <a-button type="primary" @click="openAdd" :icon="h(PlusOutlined)">新增用户</a-button>
<!-- <a-button type="" class="g_border_d g_ml_16" @click="handleToForm('add', { id: 0 })" :icon="h(DownloadOutlined)">导出模版</a-button> --> <!-- <a-button type="" class="g_border_d g_ml_16" @click="handleToForm('add', { id: 0 })" :icon="h(DownloadOutlined)">导出模版</a-button> -->
<!-- <!--
<a-dropdown :trigger="['click']"> <a-dropdown :trigger="['click']">
@ -27,7 +27,7 @@
</div> </div>
</div> </div>
<div class="m-table g_mt_20 antd-table"> <div class="m-table g_mt_20 antd-table">
<a-table sticky :columns="columns" :data-source="tableData.records" size="middle" :pagination="false" :loading="tableData.loading" class="g_clear_scroll" style="max-width: calc(100% - 0px)"> <a-table sticky :columns="columns" :scroll="{x:1000}" :data-source="tableData.records" size="middle" :pagination="false" :loading="tableData.loading" class="g_clear_scroll" style="max-width: calc(100% - 0px)">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'job'"> <template v-if="column.key === 'job'">
<!-- @click="goDetail(record)" --> <!-- @click="goDetail(record)" -->
@ -125,10 +125,22 @@
}" }"
> >
<div class="g_pt_8 g_pb_16" style=" overflow-y: auto"> <div class="g_pt_8 g_pb_16" style=" overflow-y: auto">
<!-- <a-button class="g_float_right"> <div class="g_float_right">
新增职位
<a-button class="g_mr_12">
<template #icon>
<DownloadOutlined />
</template>
导出模板
</a-button>
<a-button type="primary">
<template #icon>
<PlusOutlined />
</template>
导入文件
</a-button> </a-button>
<div class="g_float_none"></div> --> </div>
<div class="g_float_none"></div>
<div class="g_mt_16 g_clear_scroll" style="max-height: calc(100vh - 464px); overflow-y: auto"> <div class="g_mt_16 g_clear_scroll" style="max-height: calc(100vh - 464px); overflow-y: auto">
<a-table :columns="tableDetail.columns" :data-source="tableDetail.list" size="middle" :pagination="false"> <a-table :columns="tableDetail.columns" :data-source="tableDetail.list" size="middle" :pagination="false">
@ -161,16 +173,19 @@
class="g_ml_51" class="g_ml_51"
> >
<a-form-item label="姓名" name="name" required> <a-form-item label="姓名" name="name" required>
<a-input style="width: 100%" placeholder="请输入姓名" v-model:value="modalInfo.form.name" /> <!-- <a-input style="width: 100%" placeholder="请输入姓名" v-model:value="modalInfo.form.name" /> -->
<a-select ref="select" v-model:value="modalInfo.form.name" placeholder="请选择用户" @focus="focus" @change="handleChange">
<a-select-option v-for="item in userList" :value="item.id" :title="item.id">{{ item.name }}</a-select-option>
</a-select>
</a-form-item> </a-form-item>
<a-form-item label="持股数" name="name" required> <a-form-item label="持股数" name="num" required>
<a-input style="width: 100%" placeholder="请输入持股数" v-model:value="modalInfo.form.shares" /> <a-input style="width: 100%" placeholder="请输入持股数" v-model:value="modalInfo.form.num" />
</a-form-item> </a-form-item>
<a-form-item label="持股比例" name="name" required> <a-form-item label="持股比例" name="percent" required>
<a-input style="width: 100%" placeholder="请输入持股比例" v-model:value="modalInfo.form.idcard" /> <a-input style="width: 100%" placeholder="请输入持股比例" v-model:value="modalInfo.form.percent" />
</a-form-item> </a-form-item>
<a-form-item label="持股价值(元)" name="name" required> <a-form-item label="持股价值(元)" name="amount" required>
<a-input style="width: 100%" placeholder="请输入持股价值" v-model:value="modalInfo.form.description" /> <a-input style="width: 100%" placeholder="请输入持股价值" v-model:value="modalInfo.form.amount" />
</a-form-item> </a-form-item>
<!-- <a-form-item label="备注" name="desp"> <!-- <a-form-item label="备注" name="desp">
@ -191,7 +206,7 @@ import { ref, onMounted, getCurrentInstance, h, watch } from "vue";
import { PlusOutlined, EllipsisOutlined, UploadOutlined, DownOutlined } from "@ant-design/icons-vue"; import { PlusOutlined, EllipsisOutlined, UploadOutlined, DownOutlined } from "@ant-design/icons-vue";
import { Modal, message } from "ant-design-vue"; import { Modal, message } from "ant-design-vue";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { getUserListApi, updateUserStatusApi, addUserApi, delUserApi,updateUserApi } from "../../api/userList/userList"; import { getUserListApi, updateUserStatusApi, addUserApi, delUserApi,updateUserApi,getStockUserListApi,addStockUserApi} from "../../api/userList/userList";
import { DownloadOutlined } from "@ant-design/icons-vue"; import { DownloadOutlined } from "@ant-design/icons-vue";
import idCardPanel from "../components/upload/image.vue"; import idCardPanel from "../components/upload/image.vue";
@ -201,6 +216,16 @@ const route = useRoute();
const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G; const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G;
const speed = ref(0); const speed = ref(0);
const showAdd = ref(0); const showAdd = ref(0);
const userList = ref([]);
const userId = ref(0);
const handleChange = value => {
console.log(`selected ${value}`);
modalInfo.value.form.userId = value
};
onMounted(() => { onMounted(() => {
getTable(); getTable();
}); });
@ -224,27 +249,7 @@ const handleViewDetail = (item) => {
page: 1, page: 1,
size: 50, size: 50,
count: 0, count: 0,
list: [{ list: [],
rank:1,
userName:"老股转让",
storeJobName:'轻舟',
time:'12,234'
},{
rank:2,
userName:"老股转让",
storeJobName:'轻舟',
time:'12,234'
},{
rank:3,
userName:"老股转让",
storeJobName:'轻舟',
time:'12,234'
},{
rank:4,
userName:"老股转让",
storeJobName:'轻舟',
time:'12,234'
}],
speed: -1, speed: -1,
isShow: true, isShow: true,
keys: "", keys: "",
@ -312,34 +317,33 @@ const handleChangeSearch = (e) => {
} }
}; };
const modalInfo = ref({ const modalInfo = ref({
title:'新增用户', title:'新增个人数据',
id:0, id:0,
form:{ form:{
name:"", name:null,
username:'', num:'',
idcard:'', percent:'',
description:'' amount:'',
} }
}) })
const submitForm = ()=>{ const submitForm = ()=>{
let url = '',params = {}; let url = '',params = {};
params = {
name:modalInfo.value.form.name,
username:modalInfo.value.form.username,
idcard:modalInfo.value.form.idcard,
description:modalInfo.value.form.description,
password:'123456',
id:modalInfo.value.id
}
console.log(userList.value);
console.log(modalInfo.value.form.userId);
let obj = userList.value.find(item => item.id === modalInfo.value.form.userId)
if (!commonJS.regular(modalInfo.value.form.username, 'tel')) { console.log(obj);
message.warning('请输入正确的手机号')
return false
}
params = {
name:obj.name,
num:modalInfo.value.form.num,
percent:modalInfo.value.form.percent,
amount:modalInfo.value.form.amount,
userId:modalInfo.value.form.userId,
}
if(modalInfo.value.id){ if(modalInfo.value.id){
delete params.password; delete params.password;
@ -349,7 +353,7 @@ const submitForm = ()=>{
getTable(); getTable();
}); });
}else{ }else{
addUserApi(params).then((res)=>{ addStockUserApi(params).then((res)=>{
showAdd.value = false; showAdd.value = false;
message.success("新增成功"); message.success("新增成功");
getTable(); getTable();
@ -423,31 +427,33 @@ const tableData = ref({
const getTable = () => { const getTable = () => {
console.log(tableData.value); console.log(tableData.value);
tableData.value.loading = true; tableData.value.loading = true;
getUserListApi({ limit: tableData.value.limit, page: tableData.value.page, keyword: tableData.value.keyword }).then((res) => { getStockUserListApi({ limit: tableData.value.limit, page: tableData.value.page, keyword: tableData.value.keyword }).then((res) => {
console.log(res); console.log(res);
tableData.value = { ...res.data, keyword: tableData.value.keyword, page: res.data.current, limit: res.data.size,shares:'123' }; tableData.value = { ...res.data, keyword: tableData.value.keyword, page: res.data.current, limit: res.data.size };
tableData.value.records.forEach((item, index) => { tableData.value.records.forEach((item, index) => {
item.shares = "12,345"
item.sharesScale = "3.1345%"
item.sharesValue = "23,1345.00"
item.rank = index + 1; item.rank = index + 1;
}); });
}); });
}; };
const openAdd = () =>{ const openAdd = () =>{
showAdd.value = true showAdd.value = true
modalInfo.value.title = "新增用户"
modalInfo.value.id = 0; modalInfo.value.id = 0;
modalInfo.value = { modalInfo.value = {
title:"新增个人数据",
form:{ form:{
name:"", name:null,
username:'', username:'',
idcard:'', idcard:'',
description:'' description:''
} }
} }
} getUserListApi({ limit:100, page: 1, keyword:""}).then((res)=>{
userList.value = res.data.records
// modalInfo.value.name = res.data.records[0].name
console.log(res);
});
};
const columns = ref([ const columns = ref([
{ {
title: "序号", title: "序号",
@ -464,23 +470,23 @@ const columns = ref([
{ {
title: "持股数", title: "持股数",
key: "shares", key: "num",
dataIndex: "shares", dataIndex: "num",
ellipsis: true, ellipsis: true,
width: "240px", width: "240px",
}, },
{ {
title: "持股比例", title: "持股比例",
key: "sharesScale", key: "percent",
dataIndex: "sharesScale", dataIndex: "percent",
width: "240px", width: "240px",
ellipsis: true, ellipsis: true,
}, },
{ {
title: "持股价值(元)", title: "持股价值(元)",
key: "sharesValue", key: "amount",
dataIndex: "sharesValue", dataIndex: "amount",
ellipsis: true, ellipsis: true,
width: "240px", width: "240px",
}, },

Loading…
Cancel
Save