From 42c21819b30dc1538872d4ef042fcf5d810e2b70 Mon Sep 17 00:00:00 2001 From: jameszow Date: Mon, 16 Oct 2023 22:25:29 +0800 Subject: [PATCH 1/4] update name wallah -> operator --- src/views/basic/operator/index.vue | 147 +++++++++++++++++++++++++++++ src/views/basic/wallah/index.vue | 7 -- 2 files changed, 147 insertions(+), 7 deletions(-) create mode 100644 src/views/basic/operator/index.vue delete mode 100644 src/views/basic/wallah/index.vue diff --git a/src/views/basic/operator/index.vue b/src/views/basic/operator/index.vue new file mode 100644 index 0000000..e98e14f --- /dev/null +++ b/src/views/basic/operator/index.vue @@ -0,0 +1,147 @@ + +
+
+ + \ No newline at end of file diff --git a/src/views/basic/wallah/index.vue b/src/views/basic/wallah/index.vue deleted file mode 100644 index 5ff38f5..0000000 --- a/src/views/basic/wallah/index.vue +++ /dev/null @@ -1,7 +0,0 @@ - - - \ No newline at end of file From 7fbcba08a73690a63b395c477d6b4ea7a8616c3a Mon Sep 17 00:00:00 2001 From: jameszow Date: Mon, 16 Oct 2023 22:25:39 +0800 Subject: [PATCH 2/4] Add operator api and views --- src/api/basic/model/operatorModel.ts | 23 ++++ src/api/basic/operator.ts | 63 ++++++++++ .../operator/components/OperatorModal.vue | 76 ++++++++++++ src/views/basic/operator/operator.data.ts | 116 ++++++++++++++++++ 4 files changed, 278 insertions(+) create mode 100644 src/api/basic/model/operatorModel.ts create mode 100644 src/api/basic/operator.ts create mode 100644 src/views/basic/operator/components/OperatorModal.vue create mode 100644 src/views/basic/operator/operator.data.ts diff --git a/src/api/basic/model/operatorModel.ts b/src/api/basic/model/operatorModel.ts new file mode 100644 index 0000000..b832694 --- /dev/null +++ b/src/api/basic/model/operatorModel.ts @@ -0,0 +1,23 @@ +export interface OperatorResp { + id: number | string; + name: string; + type: string; + status: number; + sort: number; + remark: string; + createTime: string; +} + +export interface AddOrUpdateOperatorReq { + id: number | string | undefined; + name: string; + type: number; + status: number; + remark: string; + sort: number; +} + +export interface QueryOperatorReq { + name: string; + type: string; +} \ No newline at end of file diff --git a/src/api/basic/operator.ts b/src/api/basic/operator.ts new file mode 100644 index 0000000..9e7d621 --- /dev/null +++ b/src/api/basic/operator.ts @@ -0,0 +1,63 @@ +import {defHttp} from '/@/utils/http/axios'; +import { ErrorMessageMode } from '/#/axios'; +import {BaseDataResp, BaseResp} from "@/api/model/baseModel"; +import { + OperatorResp, + AddOrUpdateOperatorReq, + QueryOperatorReq +} from "@/api/basic/model/operatorModel"; + + +enum API { + List = '/basic/operator/list', + AddOrUpdateOperator = '/basic/operator/addOrUpdate', + DeleteBatch = '/basic/operator/delete', + UpdateStatus = '/basic/operator/updateStatus', +} + +export function getOperatorList(params: QueryOperatorReq, mode: ErrorMessageMode = 'notice') { + return defHttp.post>( + { + url: API.List, + params, + }, + { + errorMessageMode: mode, + successMessageMode: mode, + }, + ); +} + +export function addOrUpdateOperator(params: AddOrUpdateOperatorReq, mode: ErrorMessageMode = 'notice') { + return defHttp.post( + { + url: API.AddOrUpdateOperator, + params, + }, + { + errorMessageMode: mode, + }, + ); +} + +export function updateOperatorStatus(ids: number[], status: number, mode: ErrorMessageMode = 'notice') { + return defHttp.post( + { + url: `${API.UpdateStatus}?ids=${ids}&status=${status}` + }, + { + errorMessageMode: mode, + }, + ); +} + +export function deleteBatchOperator(ids: number[], mode: ErrorMessageMode = 'notice') { + return defHttp.delete( + { + url: `${API.DeleteBatch}?ids=${ids}` + }, + { + errorMessageMode: mode, + }, + ); +} \ No newline at end of file diff --git a/src/views/basic/operator/components/OperatorModal.vue b/src/views/basic/operator/components/OperatorModal.vue new file mode 100644 index 0000000..3946039 --- /dev/null +++ b/src/views/basic/operator/components/OperatorModal.vue @@ -0,0 +1,76 @@ + + + \ No newline at end of file diff --git a/src/views/basic/operator/operator.data.ts b/src/views/basic/operator/operator.data.ts new file mode 100644 index 0000000..da08db5 --- /dev/null +++ b/src/views/basic/operator/operator.data.ts @@ -0,0 +1,116 @@ +import {FormSchema} from "@/components/Form"; +import {BasicColumn} from "@/components/Table"; +import { h } from 'vue'; +import {Switch} from "ant-design-vue"; +import {useMessage} from "@/hooks/web/useMessage"; +import {useI18n} from "@/hooks/web/useI18n"; +import {updateOperatorStatus} from "@/api/basic/operator"; + +const { t } = useI18n(); + +export const columns: BasicColumn[] = [ + { + title: '姓名', + dataIndex: 'name', + width: 90, + }, + { + title: '类型', + dataIndex: 'type', + width: 120, + }, + { + title: '状态', + dataIndex: 'status', + width: 100, + customRender: ({ record }) => { + if (!Reflect.has(record, 'pendingStatus')) { + record.pendingStatus = false; + } + return h(Switch, { + checked: record.status === 0, + checkedChildren: t('common.on'), + unCheckedChildren: t('common.off'), + loading: record.pendingStatus, + onChange(checked, _) { + const {createMessage} = useMessage(); + if (record.id == 1) { + createMessage.warn(t('common.notice')); + return; + } + record.pendingStatus = true; + const newStatus = checked ? 0 : 1; + updateOperatorStatus([record.id], newStatus ) + .then(() => { + record.status = newStatus; + }) + .finally(() => { + record.pendingStatus = false; + }); + }, + }); + } + }, + { + title: '排序', + dataIndex: 'sort', + width: 80, + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 150, + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '姓名', + field: 'name', + component: 'Input', + colProps: { span: 5 }, + }, + { + label: '类型', + field: 'type', + component: 'Select', + colProps: { span: 5 }, + componentProps: { + options: [ + { label: '业务员', value: '业务员', key: 0 }, + { label: '财务员', value: '财务员', key: 1 }, + ], + }, + } +] + +export const formSchema: FormSchema[] = [ + { + label: '姓名', + field: 'name', + component: 'Input', + required: true, + }, + { + label: '类型', + field: 'type', + component: 'Select', + componentProps: { + options: [ + { label: '业务员', value: '业务员', key: 0 }, + { label: '财务员', value: '财务员', key: 1 }, + ], + }, + required: true, + }, + { + label: '排序', + field: 'sort', + component: 'InputNumber', + }, + { + label: '备注', + field: 'remark', + component: 'InputTextArea', + } +] \ No newline at end of file From 478eaf8c4ad66b5282c330a3c9476c9a887c9b56 Mon Sep 17 00:00:00 2001 From: jameszow Date: Tue, 17 Oct 2023 20:33:56 +0800 Subject: [PATCH 3/4] Update component name Operator --- src/views/basic/operator/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/basic/operator/index.vue b/src/views/basic/operator/index.vue index e98e14f..120bf2c 100644 --- a/src/views/basic/operator/index.vue +++ b/src/views/basic/operator/index.vue @@ -45,7 +45,7 @@ import {getOperatorList, deleteBatchOperator, updateOperatorStatus} from "@/api/ import OperatorModal from "@/views/basic/operator/components/OperatorModal.vue"; export default defineComponent({ - name: 'financialAccount', + name: 'Operator', components: {TableAction, BasicTable, OperatorModal }, setup() { const [registerModal, {openModal}] = useModal(); From a64cbf427f04d721f4e6fb7e7235c45c11a249a3 Mon Sep 17 00:00:00 2001 From: jameszow Date: Tue, 17 Oct 2023 20:34:14 +0800 Subject: [PATCH 4/4] Add Product and modal views --- .../info/components/ProductInfoModal.vue | 601 ++++++++++++++++++ src/views/product/info/index.vue | 125 ++++ src/views/product/info/info.data.ts | 215 +++++++ 3 files changed, 941 insertions(+) create mode 100644 src/views/product/info/components/ProductInfoModal.vue create mode 100644 src/views/product/info/index.vue create mode 100644 src/views/product/info/info.data.ts diff --git a/src/views/product/info/components/ProductInfoModal.vue b/src/views/product/info/components/ProductInfoModal.vue new file mode 100644 index 0000000..592bc31 --- /dev/null +++ b/src/views/product/info/components/ProductInfoModal.vue @@ -0,0 +1,601 @@ + + + + + \ No newline at end of file diff --git a/src/views/product/info/index.vue b/src/views/product/info/index.vue new file mode 100644 index 0000000..8593504 --- /dev/null +++ b/src/views/product/info/index.vue @@ -0,0 +1,125 @@ + +
+
+ + \ No newline at end of file diff --git a/src/views/product/info/info.data.ts b/src/views/product/info/info.data.ts new file mode 100644 index 0000000..255bd29 --- /dev/null +++ b/src/views/product/info/info.data.ts @@ -0,0 +1,215 @@ +import {FormSchema} from "@/components/Form"; +import {BasicColumn} from "@/components/Table"; +import { h } from 'vue'; +import {Switch} from "ant-design-vue"; +import {useMessage} from "@/hooks/web/useMessage"; +import {useI18n} from "@/hooks/web/useI18n"; +import {updateOperatorStatus} from "@/api/basic/operator"; + +const { t } = useI18n(); + +export const columns: BasicColumn[] = [ + { + title: '条码', + dataIndex: 'name', + width: 80, + }, + { + title: '名称', + dataIndex: 'type', + width: 100, + }, + { + title: '规格', + dataIndex: 'type', + width: 80, + }, + { + title: '型号', + dataIndex: 'type', + width: 100, + }, + { + title: '颜色', + dataIndex: 'type', + width: 60, + }, + { + title: '类别', + dataIndex: 'type', + width: 80, + }, + { + title: '单位', + dataIndex: 'type', + width: 80, + }, + { + title: '库存', + dataIndex: 'type', + width: 60, + }, + { + title: '采购价', + dataIndex: 'type', + width: 60, + }, + { + title: '零售价', + dataIndex: 'type', + width: 60, + }, + { + title: '销售价', + dataIndex: 'type', + width: 60, + }, + { + title: '最低售价', + dataIndex: 'type', + width: 60, + }, + { + title: '状态', + dataIndex: 'status', + width: 80, + customRender: ({ record }) => { + if (!Reflect.has(record, 'pendingStatus')) { + record.pendingStatus = false; + } + return h(Switch, { + checked: record.status === 0, + checkedChildren: t('common.on'), + unCheckedChildren: t('common.off'), + loading: record.pendingStatus, + onChange(checked, _) { + const {createMessage} = useMessage(); + if (record.id == 1) { + createMessage.warn(t('common.notice')); + return; + } + record.pendingStatus = true; + const newStatus = checked ? 0 : 1; + updateOperatorStatus([record.id], newStatus ) + .then(() => { + record.status = newStatus; + }) + .finally(() => { + record.pendingStatus = false; + }); + }, + }); + } + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 80, + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '类别', + field: 'type', + component: 'Select', + colProps: { + xl: 8, + xxl: 8, + }, + }, + { + label: '关键词', + field: 'name', + component: 'Input', + colProps: { + xl: 8, + xxl: 8, + }, + }, + { + label: '颜色', + field: 'name', + component: 'Input', + colProps: { + xl: 8, + xxl: 8, + }, + }, + { + label: '状态', + field: 'name', + component: 'Input', + colProps: { + xl: 12, + xxl: 8, + }, + }, + { + label: '序列号', + field: 'name', + component: 'Input', + colProps: { + xl: 12, + xxl: 8, + }, + }, + { + label: '批次号', + field: 'name', + component: 'Input', + colProps: { + xl: 12, + xxl: 8, + }, + }, + { + label: '仓位货架', + field: 'name', + component: 'Input', + colProps: { + xl: 12, + xxl: 8, + }, + }, + { + label: '扩展信息', + field: 'name', + component: 'Input', + colProps: { + xl: 12, + xxl: 8, + }, + }, + { + label: '基础重量', + field: 'name', + component: 'Input', + colProps: { + xl: 12, + xxl: 8, + }, + }, + { + label: '保质期', + field: 'name', + component: 'Input', + colProps: { + xl: 12, + xxl: 8, + }, + }, + { + label: '备注', + field: 'name', + component: 'Input', + colProps: { + xl: 12, + xxl: 8, + }, + }, +] + +export const formSchema: FormSchema[] = [ + +] \ No newline at end of file