个人数据修改

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) {
return request({
@ -29,6 +38,14 @@ export function addUserApi (data) {
data
});
}
// 新增个人数据
export function addStockUserApi (data) {
return request({
url: `/admin/user/stock/save`,
method: "post",
data
});
}
// 更新用户
export function updateUserApi (data) {
return request({

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

@ -9,7 +9,7 @@
</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-dropdown :trigger="['click']">
@ -27,7 +27,7 @@
</div>
</div>
<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 v-if="column.key === 'job'">
<!-- @click="goDetail(record)" -->
@ -125,10 +125,22 @@
}"
>
<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>
<div class="g_float_none"></div> -->
<a-button type="primary">
<template #icon>
<PlusOutlined />
</template>
导入文件
</a-button>
</div>
<div class="g_float_none"></div>
<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">
@ -161,16 +173,19 @@
class="g_ml_51"
>
<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 label="持股数" name="name" required>
<a-input style="width: 100%" placeholder="请输入持股数" v-model:value="modalInfo.form.shares" />
<a-form-item label="持股数" name="num" required>
<a-input style="width: 100%" placeholder="请输入持股数" v-model:value="modalInfo.form.num" />
</a-form-item>
<a-form-item label="持股比例" name="name" required>
<a-input style="width: 100%" placeholder="请输入持股比例" v-model:value="modalInfo.form.idcard" />
<a-form-item label="持股比例" name="percent" required>
<a-input style="width: 100%" placeholder="请输入持股比例" v-model:value="modalInfo.form.percent" />
</a-form-item>
<a-form-item label="持股价值(元)" name="name" required>
<a-input style="width: 100%" placeholder="请输入持股价值" v-model:value="modalInfo.form.description" />
<a-form-item label="持股价值(元)" name="amount" required>
<a-input style="width: 100%" placeholder="请输入持股价值" v-model:value="modalInfo.form.amount" />
</a-form-item>
<!-- <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 { Modal, message } from "ant-design-vue";
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 idCardPanel from "../components/upload/image.vue";
@ -201,6 +216,16 @@ const route = useRoute();
const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G;
const speed = 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(() => {
getTable();
});
@ -224,27 +249,7 @@ const handleViewDetail = (item) => {
page: 1,
size: 50,
count: 0,
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'
}],
list: [],
speed: -1,
isShow: true,
keys: "",
@ -312,34 +317,33 @@ const handleChangeSearch = (e) => {
}
};
const modalInfo = ref({
title:'新增用户',
title:'新增个人数据',
id:0,
form:{
name:"",
username:'',
idcard:'',
description:''
name:null,
num:'',
percent:'',
amount:'',
}
})
const submitForm = ()=>{
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')) {
message.warning('请输入正确的手机号')
return false
}
console.log(obj);
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){
delete params.password;
@ -349,7 +353,7 @@ const submitForm = ()=>{
getTable();
});
}else{
addUserApi(params).then((res)=>{
addStockUserApi(params).then((res)=>{
showAdd.value = false;
message.success("新增成功");
getTable();
@ -423,31 +427,33 @@ const tableData = ref({
const getTable = () => {
console.log(tableData.value);
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);
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) => {
item.shares = "12,345"
item.sharesScale = "3.1345%"
item.sharesValue = "23,1345.00"
item.rank = index + 1;
});
});
};
const openAdd = () =>{
showAdd.value = true
modalInfo.value.title = "新增用户"
modalInfo.value.id = 0;
modalInfo.value = {
title:"新增个人数据",
form:{
name:"",
name:null,
username:'',
idcard:'',
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([
{
title: "序号",
@ -464,23 +470,23 @@ const columns = ref([
{
title: "持股数",
key: "shares",
dataIndex: "shares",
key: "num",
dataIndex: "num",
ellipsis: true,
width: "240px",
},
{
title: "持股比例",
key: "sharesScale",
dataIndex: "sharesScale",
key: "percent",
dataIndex: "percent",
width: "240px",
ellipsis: true,
},
{
title: "持股价值(元)",
key: "sharesValue",
dataIndex: "sharesValue",
key: "amount",
dataIndex: "amount",
ellipsis: true,
width: "240px",
},

Loading…
Cancel
Save