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/index.vue b/src/views/basic/operator/index.vue new file mode 100644 index 0000000..120bf2c --- /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/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 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 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