mirror of
https://github.com/himool/HimoolERP.git
synced 2026-01-06 01:04:46 +08:00
feat: update
This commit is contained in:
parent
3e8bf45c3e
commit
12187c5826
4 changed files with 228 additions and 173 deletions
|
|
@ -160,8 +160,19 @@ class ClientViewSet(ModelViewSet, ExportMixin, ImportMixin):
|
|||
validated_data = request_serializer.validated_data
|
||||
|
||||
import_serializer = self.load_data(validated_data['file'], ClientImportExportSerializer)
|
||||
# if not import_serializer.is_valid(raise_exception=False):
|
||||
# raise ValidationError('数据错误')
|
||||
|
||||
# import_serializer = self.load_data(validated_data['file'], WarehouseImportExportSerializer)
|
||||
if not import_serializer.is_valid(raise_exception=False):
|
||||
raise ValidationError('数据错误')
|
||||
error_messages = []
|
||||
for row_index, error in enumerate(import_serializer.errors, 2):
|
||||
for error_details in error.values():
|
||||
for error_detail in error_details:
|
||||
error_messages.append(f'第 {row_index} 行数据错误: {error_detail}')
|
||||
|
||||
return Response(data=error_messages, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
client_items = import_serializer.validated_data
|
||||
client_numbers = {item['number'] for item in client_items}
|
||||
|
|
|
|||
|
|
@ -2,19 +2,35 @@
|
|||
<div>
|
||||
<a-card title="员工账号">
|
||||
<a-row gutter="16">
|
||||
<a-col :span="24" :md="8" :xl="6" style="margin-bottom: 12px;">
|
||||
<a-col :span="24" :md="8" :xl="6" style="margin-bottom: 12px">
|
||||
<a-input-search v-model="searchForm.search" placeholder="用户名, 名称, 电话" allowClear @search="search" />
|
||||
</a-col>
|
||||
|
||||
<div style="margin-bottom: 12px; float: right;">
|
||||
<a-button type="primary" icon="plus" style="margin: 0 8px;" @click="targetItem = {...form}; visible = true;">
|
||||
新增账号</a-button>
|
||||
<div style="margin-bottom: 12px; float: right">
|
||||
<a-button
|
||||
type="primary"
|
||||
icon="plus"
|
||||
style="margin: 0 8px"
|
||||
@click="
|
||||
targetItem = { ...form };
|
||||
visible = true;
|
||||
"
|
||||
>
|
||||
新增账号</a-button
|
||||
>
|
||||
</div>
|
||||
</a-row>
|
||||
|
||||
<a-row style="margin-top: 12px;">
|
||||
<a-table rowKey="id" size="small" :columns="columns" :dataSource="items" :loading="loading" :pagination="pagination"
|
||||
@change="tableChange">
|
||||
<a-row style="margin-top: 12px">
|
||||
<a-table
|
||||
rowKey="id"
|
||||
size="small"
|
||||
:columns="columns"
|
||||
:dataSource="items"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
@change="tableChange"
|
||||
>
|
||||
<div slot="is_active" slot-scope="value">
|
||||
<template v-if="value">
|
||||
<a-badge status="success" />
|
||||
|
|
@ -25,14 +41,22 @@
|
|||
<span>禁用</span>
|
||||
</template>
|
||||
</div>
|
||||
<div slot="role_names" slot-scope="roleNames">
|
||||
<a-tag v-for="role in roleNames" :key="role" color="#2db7f5">
|
||||
{{role}}
|
||||
<div slot="role_names" slot-scope="value, item">
|
||||
<a-tag v-for="roleItem in item.role_items" :key="roleItem.id" color="#2db7f5">
|
||||
{{ roleItem.name }}
|
||||
</a-tag>
|
||||
</div>
|
||||
<div slot="action" slot-scope="value, item">
|
||||
<a-button-group>
|
||||
<a-button icon="edit" size="small" @click="targetItem = {...item}; visible = true;">编辑</a-button>
|
||||
<a-button
|
||||
icon="edit"
|
||||
size="small"
|
||||
@click="
|
||||
targetItem = { ...item };
|
||||
visible = true;
|
||||
"
|
||||
>编辑</a-button
|
||||
>
|
||||
<a-popconfirm title="确定重置吗? 密码: 123456" @confirm="resetPassword(item.id)">
|
||||
<a-button size="small" type="primary" icon="sync">重置密码</a-button>
|
||||
</a-popconfirm>
|
||||
|
|
@ -56,87 +80,92 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { userList, userDestroy, userResetPassword } from '@/api/account'
|
||||
import { roleOption } from '@/api/option'
|
||||
import { permissions } from '@/permissions.js'
|
||||
import columns from './columns.js'
|
||||
import { userList, userDestroy, userResetPassword } from "@/api/account";
|
||||
import { roleOption } from "@/api/option";
|
||||
import { permissions } from "@/permissions.js";
|
||||
import columns from "./columns.js";
|
||||
|
||||
export default {
|
||||
name: 'Account',
|
||||
components: {
|
||||
FormModal: () => import('./FormModal.vue'),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
columns,
|
||||
permissions,
|
||||
searchForm: { search: '', page: 1, ordering: undefined, page_size: 16 },
|
||||
pagination: { current: 1, total: 0, pageSize: 16 },
|
||||
loading: false,
|
||||
items: [],
|
||||
roleItems: [],
|
||||
visible: false,
|
||||
targetItem: {},
|
||||
form: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
initialize() {
|
||||
this.list();
|
||||
export default {
|
||||
name: "Account",
|
||||
components: {
|
||||
FormModal: () => import("./FormModal.vue"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
columns,
|
||||
permissions,
|
||||
searchForm: { search: "", page: 1, ordering: undefined, page_size: 16 },
|
||||
pagination: { current: 1, total: 0, pageSize: 16 },
|
||||
loading: false,
|
||||
items: [],
|
||||
roleItems: [],
|
||||
visible: false,
|
||||
targetItem: {},
|
||||
form: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
initialize() {
|
||||
this.list();
|
||||
|
||||
roleOption({ page_size: 999999 }).then(data => {
|
||||
this.roleItems = data.results;
|
||||
});
|
||||
},
|
||||
list() {
|
||||
this.loading = true;
|
||||
userList(this.searchForm).then(data => {
|
||||
roleOption({ page_size: 999999 }).then((data) => {
|
||||
this.roleItems = data.results;
|
||||
});
|
||||
},
|
||||
list() {
|
||||
this.loading = true;
|
||||
userList(this.searchForm)
|
||||
.then((data) => {
|
||||
this.pagination.total = data.count;
|
||||
this.items = data.results;
|
||||
}).finally(() => {
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
create(item) {
|
||||
// this.items.splice(0, 0, item);
|
||||
this.list();
|
||||
},
|
||||
update(item) {
|
||||
this.items.splice(this.items.findIndex(i => i.id == item.id), 1, item);
|
||||
},
|
||||
destroy(id) {
|
||||
userDestroy({ id }).then(() => {
|
||||
// this.items.splice(this.items.findIndex(item => item.id == id), 1);
|
||||
this.$message.success('删除成功');
|
||||
this.list();
|
||||
});
|
||||
},
|
||||
resetPassword(id) {
|
||||
userResetPassword({ id }).then(() => {
|
||||
this.$message.success('重置成功');
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.searchForm.page = 1;
|
||||
this.pagination.current = 1;
|
||||
this.list();
|
||||
},
|
||||
tableChange(pagination, filters, sorter) {
|
||||
this.searchForm.page = pagination.current;
|
||||
this.pagination.current = pagination.current;
|
||||
this.searchForm.ordering = `${sorter.order == 'descend' ? '-' : ''}${sorter.field}`;
|
||||
this.list();
|
||||
},
|
||||
openFormModal(item) {
|
||||
this.targetItem = { ...item };
|
||||
this.visible = true;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initialize();
|
||||
create(item) {
|
||||
// this.items.splice(0, 0, item);
|
||||
this.list();
|
||||
},
|
||||
}
|
||||
update(item) {
|
||||
this.items.splice(
|
||||
this.items.findIndex((i) => i.id == item.id),
|
||||
1,
|
||||
item
|
||||
);
|
||||
},
|
||||
destroy(id) {
|
||||
userDestroy({ id }).then(() => {
|
||||
// this.items.splice(this.items.findIndex(item => item.id == id), 1);
|
||||
this.$message.success("删除成功");
|
||||
this.list();
|
||||
});
|
||||
},
|
||||
resetPassword(id) {
|
||||
userResetPassword({ id }).then(() => {
|
||||
this.$message.success("重置成功");
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.searchForm.page = 1;
|
||||
this.pagination.current = 1;
|
||||
this.list();
|
||||
},
|
||||
tableChange(pagination, filters, sorter) {
|
||||
this.searchForm.page = pagination.current;
|
||||
this.pagination.current = pagination.current;
|
||||
this.searchForm.ordering = `${sorter.order == "descend" ? "-" : ""}${sorter.field}`;
|
||||
this.list();
|
||||
},
|
||||
openFormModal(item) {
|
||||
this.targetItem = { ...item };
|
||||
this.visible = true;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initialize();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
<style scoped></style>
|
||||
|
|
|
|||
|
|
@ -2,18 +2,17 @@
|
|||
<div>
|
||||
<a-card title="临期预警">
|
||||
<a-row gutter="16">
|
||||
<a-col :span="24" :md="6" :xl="4" style="max-width: 256px; margin-bottom: 12px;">
|
||||
<a-col :span="24" :md="6" :xl="4" style="max-width: 256px; margin-bottom: 12px">
|
||||
<a-input-search v-model="searchForm.search" placeholder="产品编号/名称" allowClear @search="search" />
|
||||
</a-col>
|
||||
<a-col :span="24" :md="8" :xl="6" style="max-width: 256px; margin-bottom: 12px;">
|
||||
<a-select v-model="searchForm.warehouse" placeholder="仓库" allowClear style="width: 100%;" @change="search">
|
||||
<a-select-option v-for="item in warehouseItems" :key="item.id" :value="item.id">{{item.name}}
|
||||
</a-select-option>
|
||||
<a-col :span="24" :md="8" :xl="6" style="max-width: 256px; margin-bottom: 12px">
|
||||
<a-select v-model="searchForm.warehouse" placeholder="仓库" allowClear style="width: 100%" @change="search">
|
||||
<a-select-option v-for="item in warehouseItems" :key="item.id" :value="item.id">{{ item.name }} </a-select-option>
|
||||
</a-select>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row style="margin-top: 12px;">
|
||||
<a-row style="margin-top: 12px">
|
||||
<a-table
|
||||
size="small"
|
||||
:columns="columns"
|
||||
|
|
@ -33,13 +32,12 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { warehousesOption } from '@/api/option'
|
||||
import { batchsReportList, } from '@/api/report'
|
||||
import { warehousesOption } from "@/api/option";
|
||||
import { batchsReportList } from "@/api/report";
|
||||
|
||||
export default {
|
||||
name: "Warehouse",
|
||||
components: {
|
||||
},
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
columns: [
|
||||
|
|
@ -94,12 +92,17 @@ export default {
|
|||
pagination: { current: 1, total: 0, pageSize: 16 },
|
||||
loading: false,
|
||||
items: [],
|
||||
warehouseItems: [],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
initialize() {
|
||||
this.list();
|
||||
|
||||
warehousesOption({ page_size: 999999, is_active: true }).then((data) => {
|
||||
this.warehouseItems = data.results;
|
||||
});
|
||||
},
|
||||
list() {
|
||||
this.loading = true;
|
||||
|
|
|
|||
|
|
@ -2,18 +2,25 @@
|
|||
<div>
|
||||
<a-card title="角色管理">
|
||||
<a-row gutter="16">
|
||||
<a-col :span="24" :md="8" :xl="6" style="margin-bottom: 12px;">
|
||||
<a-col :span="24" :md="8" :xl="6" style="margin-bottom: 12px">
|
||||
<a-input-search v-model="searchForm.search" placeholder="名称, 备注" allowClear @search="search" />
|
||||
</a-col>
|
||||
|
||||
<div style="margin-bottom: 12px; float: right;">
|
||||
<a-button type="primary" icon="plus" style="margin: 0 8px;" @click="openFormModal(form)">新增角色</a-button>
|
||||
<div style="margin-bottom: 12px; float: right">
|
||||
<a-button type="primary" icon="plus" style="margin: 0 8px" @click="openFormModal(form)">新增角色</a-button>
|
||||
</div>
|
||||
</a-row>
|
||||
|
||||
<a-row style="margin-top: 12px;">
|
||||
<a-table size="small" rowKey="id" :columns="columns" :dataSource="items" :loading="loading" :pagination="pagination"
|
||||
@change="tableChange">
|
||||
<a-row style="margin-top: 12px">
|
||||
<a-table
|
||||
size="small"
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="items"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
@change="tableChange"
|
||||
>
|
||||
<div slot="action" slot-scope="value, item">
|
||||
<a-button-group>
|
||||
<a-button icon="edit" size="small" @click="openFormModal(item)">编辑</a-button>
|
||||
|
|
@ -31,84 +38,89 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { roleList, roleDestroy } from '@/api/account'
|
||||
import { permissionList } from '@/api/system';
|
||||
import { permissions } from '@/permissions.js'
|
||||
import columns from './columns.js'
|
||||
import { roleList, roleDestroy } from "@/api/account";
|
||||
import { permissionList } from "@/api/system";
|
||||
import { permissions } from "@/permissions.js";
|
||||
import columns from "./columns.js";
|
||||
|
||||
export default {
|
||||
name: 'Role',
|
||||
components: {
|
||||
FormModal: () => import('./FormModal.vue'),
|
||||
export default {
|
||||
name: "Role",
|
||||
components: {
|
||||
FormModal: () => import("./FormModal"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
columns,
|
||||
permissions,
|
||||
searchForm: { search: "", page: 1, ordering: undefined, page_size: 16 },
|
||||
pagination: { current: 1, total: 0, pageSize: 16 },
|
||||
loading: false,
|
||||
items: [],
|
||||
|
||||
visible: false,
|
||||
targetItem: {},
|
||||
form: { permissions: [] },
|
||||
|
||||
permissionItems: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
initialize() {
|
||||
this.list();
|
||||
|
||||
permissionList().then((data) => {
|
||||
this.permissionItems = data;
|
||||
});
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
columns,
|
||||
permissions,
|
||||
searchForm: { search: '', page: 1, ordering: undefined, page_size: 16 },
|
||||
pagination: { current: 1, total: 0, pageSize: 16 },
|
||||
loading: false,
|
||||
items: [],
|
||||
|
||||
visible: false,
|
||||
targetItem: {},
|
||||
form: {},
|
||||
|
||||
permissionItems: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
initialize() {
|
||||
this.list();
|
||||
|
||||
permissionList().then(data => {
|
||||
this.permissionItems = data;
|
||||
});
|
||||
},
|
||||
list() {
|
||||
this.loading = true;
|
||||
roleList(this.searchForm).then(data => {
|
||||
list() {
|
||||
this.loading = true;
|
||||
roleList(this.searchForm)
|
||||
.then((data) => {
|
||||
this.pagination.total = data.count;
|
||||
this.items = data.results;
|
||||
}).finally(() => {
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
create(item) {
|
||||
// this.items.splice(0, 0, item);
|
||||
this.list();
|
||||
},
|
||||
update(item) {
|
||||
this.items.splice(this.items.findIndex(i => i.id == item.id), 1, item);
|
||||
},
|
||||
destroy(id) {
|
||||
roleDestroy({ id }).then(() => {
|
||||
// this.items.splice(this.items.findIndex(item => item.id == id), 1);
|
||||
this.$message.success('删除成功');
|
||||
this.list();
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.searchForm.page = 1;
|
||||
this.pagination.current = 1;
|
||||
this.list();
|
||||
},
|
||||
tableChange(pagination, filters, sorter) {
|
||||
this.searchForm.page = pagination.current;
|
||||
this.pagination.current = pagination.current;
|
||||
this.searchForm.ordering = `${sorter.order == 'descend' ? '-' : ''}${sorter.field}`;
|
||||
this.list();
|
||||
},
|
||||
openFormModal(item) {
|
||||
this.targetItem = { ...item };
|
||||
this.visible = true;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initialize();
|
||||
create(item) {
|
||||
// this.items.splice(0, 0, item);
|
||||
this.list();
|
||||
},
|
||||
}
|
||||
update(item) {
|
||||
this.items.splice(
|
||||
this.items.findIndex((i) => i.id == item.id),
|
||||
1,
|
||||
item
|
||||
);
|
||||
},
|
||||
destroy(id) {
|
||||
roleDestroy({ id }).then(() => {
|
||||
// this.items.splice(this.items.findIndex(item => item.id == id), 1);
|
||||
this.$message.success("删除成功");
|
||||
this.list();
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.searchForm.page = 1;
|
||||
this.pagination.current = 1;
|
||||
this.list();
|
||||
},
|
||||
tableChange(pagination, filters, sorter) {
|
||||
this.searchForm.page = pagination.current;
|
||||
this.pagination.current = pagination.current;
|
||||
this.searchForm.ordering = `${sorter.order == "descend" ? "-" : ""}${sorter.field}`;
|
||||
this.list();
|
||||
},
|
||||
openFormModal(item) {
|
||||
this.targetItem = { ...item };
|
||||
this.visible = true;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initialize();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
<style scoped></style>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue