mirror of
https://github.com/himool/HimoolERP.git
synced 2024-11-10 08:55:40 +08:00
feat: 调整
This commit is contained in:
parent
ac4320b784
commit
a9ed92058a
6 changed files with 62 additions and 56 deletions
|
@ -124,6 +124,7 @@ class Account(Model):
|
||||||
name = CharField(max_length=64, verbose_name='名称')
|
name = CharField(max_length=64, verbose_name='名称')
|
||||||
type = CharField(max_length=32, choices=Type.choices, default=Type.CASH, verbose_name='账户类型')
|
type = CharField(max_length=32, choices=Type.choices, default=Type.CASH, verbose_name='账户类型')
|
||||||
holder = CharField(max_length=64, null=True, blank=True, verbose_name='开户人')
|
holder = CharField(max_length=64, null=True, blank=True, verbose_name='开户人')
|
||||||
|
card_number = CharField(max_length=64, null=True, blank=True, verbose_name='开户账号')
|
||||||
remark = CharField(max_length=256, null=True, blank=True, verbose_name='备注')
|
remark = CharField(max_length=256, null=True, blank=True, verbose_name='备注')
|
||||||
is_active = BooleanField(default=True, verbose_name='激活状态')
|
is_active = BooleanField(default=True, verbose_name='激活状态')
|
||||||
initial_balance_amount = AmountField(default=0, verbose_name='初期余额')
|
initial_balance_amount = AmountField(default=0, verbose_name='初期余额')
|
||||||
|
|
|
@ -144,7 +144,7 @@ class AccountSerializer(BaseSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Account
|
model = Account
|
||||||
read_only_fields = ['id', 'type_display', 'balance_amount', 'has_balance']
|
read_only_fields = ['id', 'type_display', 'balance_amount', 'has_balance']
|
||||||
fields = ['number', 'name', 'type', 'holder', 'remark', 'is_active',
|
fields = ['number', 'name', 'type', 'holder', 'card_number', 'remark', 'is_active',
|
||||||
'initial_balance_amount', *read_only_fields]
|
'initial_balance_amount', *read_only_fields]
|
||||||
|
|
||||||
def validate_number(self, value):
|
def validate_number(self, value):
|
||||||
|
@ -173,12 +173,13 @@ class AccountImportExportSerializer(BaseSerializer):
|
||||||
name = CharField(label='账户名称(必填唯一)')
|
name = CharField(label='账户名称(必填唯一)')
|
||||||
type = CharField(required=False, label='账户类型[cash/alipay/wechat/bank_account/other](默认: cash)')
|
type = CharField(required=False, label='账户类型[cash/alipay/wechat/bank_account/other](默认: cash)')
|
||||||
holder = CharField(required=False, label='开户人')
|
holder = CharField(required=False, label='开户人')
|
||||||
|
card_number = CharField(required=False, label='开户账号')
|
||||||
remark = CharField(required=False, label='备注')
|
remark = CharField(required=False, label='备注')
|
||||||
is_active = BooleanField(required=False, label='激活状态[TRUE/FALSE](默认: TRUE)')
|
is_active = BooleanField(required=False, label='激活状态[TRUE/FALSE](默认: TRUE)')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Account
|
model = Account
|
||||||
fields = ['number', 'name', 'type', 'holder', 'remark', 'is_active']
|
fields = ['number', 'name', 'type', 'holder', 'card_number', 'remark', 'is_active']
|
||||||
|
|
||||||
|
|
||||||
class ChargeItemSerializer(BaseSerializer):
|
class ChargeItemSerializer(BaseSerializer):
|
||||||
|
|
|
@ -296,7 +296,7 @@ class AccountViewSet(ModelViewSet, DataProtectMixin, ExportMixin, ImportMixin):
|
||||||
serializer_class = AccountSerializer
|
serializer_class = AccountSerializer
|
||||||
permission_classes = [IsAuthenticated, AccountPermission]
|
permission_classes = [IsAuthenticated, AccountPermission]
|
||||||
filterset_fields = ['type', 'is_active']
|
filterset_fields = ['type', 'is_active']
|
||||||
search_fields = ['number', 'name', 'contact', 'remark']
|
search_fields = ['number', 'name', 'remark']
|
||||||
ordering_fields = ['id', 'number', 'name']
|
ordering_fields = ['id', 'number', 'name']
|
||||||
ordering = ['id']
|
ordering = ['id']
|
||||||
queryset = Account.objects.all()
|
queryset = Account.objects.all()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<a-modal v-model="visible" :confirmLoading="loading" :maskClosable="false" @cancel="cancel" @ok="confirm">
|
<a-modal v-model="visible" :confirmLoading="loading" :maskClosable="false" @cancel="cancel" @ok="confirm">
|
||||||
<div slot="title">{{form.id ? '编辑结算账户' : '新增结算账户' }}</div>
|
<div slot="title">{{ form.id ? "编辑结算账户" : "新增结算账户" }}</div>
|
||||||
<div>
|
<div>
|
||||||
<a-form-model ref="form" :model="form" :rules="rules" :label-col="{ span: 4 }" :wrapper-col="{ span: 16 }">
|
<a-form-model ref="form" :model="form" :rules="rules" :label-col="{ span: 4 }" :wrapper-col="{ span: 16 }">
|
||||||
<a-form-model-item prop="name" label="账户名称">
|
<a-form-model-item prop="name" label="账户名称">
|
||||||
|
@ -20,6 +20,9 @@
|
||||||
<a-form-model-item prop="holder" label="开户人">
|
<a-form-model-item prop="holder" label="开户人">
|
||||||
<a-input v-model="form.holder" />
|
<a-input v-model="form.holder" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
|
<a-form-model-item prop="card_number" label="开户账号">
|
||||||
|
<a-input v-model="form.card_number" />
|
||||||
|
</a-form-model-item>
|
||||||
<a-form-model-item prop="remark" label="备注">
|
<a-form-model-item prop="remark" label="备注">
|
||||||
<a-textarea v-model="form.remark" allowClear :rows="4" />
|
<a-textarea v-model="form.remark" allowClear :rows="4" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
|
@ -39,54 +42,55 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { settlementAccountCreate, settlementAccountUpdate } from '@/api/basicData'
|
import { settlementAccountCreate, settlementAccountUpdate } from "@/api/basicData";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FormModal',
|
name: "FormModal",
|
||||||
props: ['visible', 'form'],
|
props: ["visible", "form"],
|
||||||
model: { prop: 'visible', event: 'cancel' },
|
model: { prop: "visible", event: "cancel" },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
typeOptions: [
|
typeOptions: [
|
||||||
{ id: 'cash', name: '现金'},
|
{ id: "cash", name: "现金" },
|
||||||
{ id: 'alipay', name: '支付宝'},
|
{ id: "alipay", name: "支付宝" },
|
||||||
{ id: 'wechat', name: '微信钱包'},
|
{ id: "wechat", name: "微信钱包" },
|
||||||
{ id: 'bank_account', name: '银行账户'},
|
{ id: "bank_account", name: "银行账户" },
|
||||||
{ id: 'other', name: '其他'},
|
{ id: "other", name: "其他" },
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
name: [{ required: true, message: "请输入账户名称", trigger: "change" }],
|
||||||
|
number: [{ required: true, message: "请输入账户编号", trigger: "change" }],
|
||||||
|
initial_balance_amount: [
|
||||||
|
{ pattern: new RegExp(/^\d{0,14}(?:\.\d{0,2})?$/), message: "初期余额格式不正确", trigger: "change" },
|
||||||
],
|
],
|
||||||
rules: {
|
},
|
||||||
name: [{ required: true, message: '请输入账户名称', trigger: 'change' }],
|
loading: false,
|
||||||
number: [{ required: true, message: '请输入账户编号', trigger: 'change' }],
|
};
|
||||||
initial_balance_amount: [
|
},
|
||||||
{ pattern: new RegExp(/^\d{0,14}(?:\.\d{0,2})?$/), message: '初期余额格式不正确', trigger: 'change' }
|
methods: {
|
||||||
],
|
confirm() {
|
||||||
},
|
this.$refs.form.validate((valid) => {
|
||||||
loading: false,
|
if (valid) {
|
||||||
};
|
this.loading = true;
|
||||||
},
|
let func = this.form.id ? settlementAccountUpdate : settlementAccountCreate;
|
||||||
methods: {
|
func(this.form)
|
||||||
confirm() {
|
.then((data) => {
|
||||||
this.$refs.form.validate(valid => {
|
this.$message.success(this.form.id ? "修改成功" : "新增成功");
|
||||||
if (valid) {
|
this.$emit(this.form.id ? "update" : "create", data);
|
||||||
this.loading = true;
|
|
||||||
let func = this.form.id ? settlementAccountUpdate : settlementAccountCreate;
|
|
||||||
func(this.form).then(data => {
|
|
||||||
this.$message.success(this.form.id ? '修改成功' : '新增成功');
|
|
||||||
this.$emit(this.form.id ? 'update' : 'create', data);
|
|
||||||
this.cancel();
|
this.cancel();
|
||||||
}).finally(() => {
|
})
|
||||||
|
.finally(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
cancel() {
|
|
||||||
this.$emit('cancel', false);
|
|
||||||
this.$refs.form.resetFields();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
cancel() {
|
||||||
|
this.$emit("cancel", false);
|
||||||
|
this.$refs.form.resetFields();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped></style>
|
||||||
</style>
|
|
||||||
|
|
|
@ -88,10 +88,6 @@
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '手机号',
|
|
||||||
dataIndex: 'phone',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
dataIndex: 'is_active',
|
dataIndex: 'is_active',
|
||||||
|
|
|
@ -88,12 +88,16 @@
|
||||||
sorter: true,
|
sorter: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '零售价',
|
title: '分类',
|
||||||
dataIndex: 'retail_price',
|
dataIndex: 'category_name',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '保质期天数',
|
title: '采购价',
|
||||||
dataIndex: 'shelf_life_days',
|
dataIndex: 'purchase_price',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '零售价',
|
||||||
|
dataIndex: 'retail_price',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
|
|
Loading…
Reference in a new issue