增加包装单位页面。完善商品新增的分布表单。
This commit is contained in:
1 parent
457db7c690
commit
b8e8416e65
8 files changed
+549
-165
No files matched your search
@@ -0,0 +1,40 @@
|
|||||||
|
import request from '/@/utils/request';
|
||||||
|
|
||||||
|
export function fetchList(query?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/supermarket/supermarketUnit/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/supermarket/supermarketUnit',
|
||||||
|
method: 'post',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getObj(id?: string) {
|
||||||
|
return request({
|
||||||
|
url: '/supermarket/supermarketUnit/' + id,
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function delObjs(ids?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/supermarket/supermarketUnit',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function putObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: '/supermarket/supermarketUnit',
|
||||||
|
method: 'put',
|
||||||
|
data: obj,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
{{ t('sysmenu.permission') }}
|
{{ t('sysmenu.permission') }}
|
||||||
<tip content="对应后台接口@PreAuthorize注解入参字符串"></tip>
|
<tip content="对应后台接口@PreAuthorize注解入参字符串"></tip>
|
||||||
</template>
|
</template>
|
||||||
<el-input v-model="state.ruleForm.permission" maxlength="30" :placeholder="$t('sysmenu.inputPermissionTip')" />
|
<el-input v-model="state.ruleForm.permission" maxlength="40" :placeholder="$t('sysmenu.inputPermissionTip')" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('sysmenu.sortOrder')" prop="sortOrder">
|
<el-form-item :label="$t('sysmenu.sortOrder')" prop="sortOrder">
|
||||||
<el-input-number v-model="state.ruleForm.sortOrder" :min="0" controls-position="right" />
|
<el-input-number v-model="state.ruleForm.sortOrder" :min="0" controls-position="right" />
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
supermarket_supermarketAuxiliaryCode_ supermarket_supermarketAuxiliaryCode_export
|
||||||
<script setup lang="ts" name="systemFormHistoryDialog">
|
<script setup lang="ts" name="systemFormHistoryDialog">
|
||||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||||
import { delFormObj, fetchFormList } from '/@/api/gen/table';
|
import { delFormObj, fetchFormList } from '/@/api/gen/table';
|
||||||
@@ -57,9 +57,9 @@ const handleRollback = (id: string) => {
|
|||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = () => {
|
const openDialog = () => {
|
||||||
const { tableName, dsName } = route.query;
|
const { tableName, dsName } = route.query;
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
state.queryForm.dsName = dsName;
|
state.queryForm.dsName = dsName;
|
||||||
state.queryForm.tableName = tableName;
|
state.queryForm.tableName = tableName;
|
||||||
getDataList();
|
getDataList();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,74 +1,71 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||||
:close-on-click-modal="false" draggable>
|
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
<el-row :gutter="24">
|
||||||
<el-row :gutter="24">
|
<el-col :span="12" class="mb20">
|
||||||
<el-col :span="12" class="mb20">
|
<el-form-item label="条码" prop="barCode">
|
||||||
<el-form-item label="条码" prop="barCode">
|
<el-input v-model="form.barCode" placeholder="请输入条码" />
|
||||||
<el-input v-model="form.barCode" placeholder="请输入条码"/>
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
</el-col>
|
|
||||||
|
|
||||||
<el-col :span="12" class="mb20">
|
|
||||||
<el-form-item label="spuID" prop="spuId">
|
|
||||||
<el-select v-model="form.spuId" placeholder="请选择spuID">
|
|
||||||
<el-option label="请选择">0</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
|
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="spuID" prop="spuId">
|
||||||
|
<el-select v-model="form.spuId" placeholder="请选择spuID">
|
||||||
|
<el-option label="1234" value="1234"></el-option>
|
||||||
|
<el-option label="5678" value="5678"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="visible = false">取消</el-button>
|
<el-button @click="visible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="SupermarketAuxiliaryCodeDialog">
|
<script setup lang="ts" name="SupermarketAuxiliaryCodeDialog">
|
||||||
import { useDict } from '/@/hooks/dict';
|
import { useMessage } from '/@/hooks/message';
|
||||||
import { useMessage } from "/@/hooks/message";
|
import { getObj, addObj, putObj } from '/@/api/supermarket/supermarketAuxiliaryCode';
|
||||||
import { getObj, addObj, putObj } from '/@/api/supermarket/supermarketAuxiliaryCode'
|
|
||||||
import { rule } from '/@/utils/validate';
|
|
||||||
const emit = defineEmits(['refresh']);
|
const emit = defineEmits(['refresh']);
|
||||||
|
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
const dataFormRef = ref();
|
const dataFormRef = ref();
|
||||||
const visible = ref(false)
|
const visible = ref(false);
|
||||||
const loading = ref(false)
|
const loading = ref(false);
|
||||||
// 定义字典
|
// 定义字典
|
||||||
|
|
||||||
// 提交表单数据
|
// 提交表单数据
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
id:'',
|
id: '',
|
||||||
barCode: '',
|
barCode: '',
|
||||||
spuId: '',
|
spuId: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
// 定义校验规则
|
// 定义校验规则
|
||||||
const dataRules = ref({
|
const dataRules = ref({
|
||||||
barCode: [{required: true, message: '条码不能为空', trigger: 'blur'}],
|
barCode: [{ required: true, message: '条码不能为空', trigger: 'blur' }],
|
||||||
spuId: [{required: true, message: 'spuID不能为空', trigger: 'blur'}],
|
spuId: [{ required: true, message: 'spuID不能为空', trigger: 'blur' }],
|
||||||
})
|
});
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = (id: string) => {
|
const openDialog = (id: string) => {
|
||||||
visible.value = true
|
visible.value = true;
|
||||||
form.id = ''
|
form.id = '';
|
||||||
|
|
||||||
// 重置表单数据
|
// 重置表单数据
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
dataFormRef.value?.resetFields();
|
dataFormRef.value?.resetFields();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取supermarketAuxiliaryCode信息
|
// 获取supermarketAuxiliaryCode信息
|
||||||
if (id) {
|
if (id) {
|
||||||
form.id = id
|
form.id = id;
|
||||||
getsupermarketAuxiliaryCodeData(id)
|
getsupermarketAuxiliaryCodeData(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
@@ -77,7 +74,7 @@ const onSubmit = async () => {
|
|||||||
if (!valid) return false;
|
if (!valid) return false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
form.id ? await putObj(form) : await addObj(form);
|
form.id ? await putObj(form) : await addObj(form);
|
||||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
@@ -85,24 +82,25 @@ const onSubmit = async () => {
|
|||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
useMessage().error(err.msg);
|
useMessage().error(err.msg);
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 初始化表单数据
|
// 初始化表单数据
|
||||||
const getsupermarketAuxiliaryCodeData = (id: string) => {
|
const getsupermarketAuxiliaryCodeData = (id: string) => {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
loading.value = true
|
loading.value = true;
|
||||||
getObj(id).then((res: any) => {
|
getObj(id)
|
||||||
Object.assign(form, res.data)
|
.then((res: any) => {
|
||||||
}).finally(() => {
|
Object.assign(form, res.data);
|
||||||
loading.value = false
|
})
|
||||||
})
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 暴露变量
|
// 暴露变量
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openDialog
|
openDialog,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -1,132 +1,149 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="layout-padding">
|
<div class="layout-padding">
|
||||||
<div class="layout-padding-auto layout-padding-view">
|
<div class="layout-padding-auto layout-padding-view">
|
||||||
<el-row v-show="showSearch">
|
<el-row v-show="showSearch">
|
||||||
<el-form :model="state.queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList">
|
<el-form :model="state.queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList">
|
||||||
<el-form-item label="条码" prop="barCode" >
|
<el-form-item label="条码" prop="barCode">
|
||||||
<el-input placeholder="请输入条码" v-model="state.queryForm.barCode" />
|
<el-input placeholder="请输入条码" v-model="state.queryForm.barCode" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="spuID" prop="spuId">
|
<el-form-item label="spuID" prop="spuId">
|
||||||
<el-select v-model="state.queryForm.spuId" placeholder="请选择spuID">
|
<el-select v-model="state.queryForm.spuId" placeholder="请选择spuID">
|
||||||
<el-option label="请选择">0</el-option>
|
<el-option label="请选择">0</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button icon="search" type="primary" @click="getDataList">
|
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
||||||
查询
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-button>
|
</el-form-item>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
</el-form>
|
||||||
</el-form-item>
|
</el-row>
|
||||||
</el-form>
|
<el-row>
|
||||||
</el-row>
|
<div class="mb8" style="width: 100%">
|
||||||
<el-row>
|
<el-button
|
||||||
<div class="mb8" style="width: 100%">
|
icon="folder-add"
|
||||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
type="primary"
|
||||||
v-auth="'supermarket_supermarketAuxiliaryCode_add'">
|
class="ml10"
|
||||||
新 增
|
@click="formDialogRef.openDialog()"
|
||||||
</el-button>
|
v-auth="'supermarket_supermarketAuxiliaryCode_add'"
|
||||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
>
|
||||||
v-auth="'supermarket_supermarketAuxiliaryCode_del'" @click="handleDelete(selectObjs)">
|
新 增
|
||||||
删除
|
</el-button>
|
||||||
</el-button>
|
<el-button
|
||||||
<right-toolbar v-model:showSearch="showSearch" :export="'supermarket_supermarketAuxiliaryCode_export'"
|
plain
|
||||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
:disabled="multiple"
|
||||||
@queryTable="getDataList"></right-toolbar>
|
icon="Delete"
|
||||||
</div>
|
type="primary"
|
||||||
</el-row>
|
v-auth="'supermarket_supermarketAuxiliaryCode_del'"
|
||||||
<el-table :data="state.dataList" v-loading="state.loading" border
|
@click="handleDelete(selectObjs)"
|
||||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
|
>
|
||||||
|
删 除
|
||||||
|
</el-button>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
:export="'supermarket_supermarketAuxiliaryCode_export'"
|
||||||
|
@exportExcel="exportExcel"
|
||||||
|
class="ml10 mr20"
|
||||||
|
style="float: right"
|
||||||
|
@queryTable="getDataList"
|
||||||
|
></right-toolbar>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
<el-table
|
||||||
|
:data="state.dataList"
|
||||||
|
v-loading="state.loading"
|
||||||
|
border
|
||||||
|
:cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle"
|
||||||
@selection-change="selectionChangHandle"
|
@selection-change="selectionChangHandle"
|
||||||
@sort-change="sortChangeHandle">
|
@sort-change="sortChangeHandle"
|
||||||
<el-table-column type="selection" width="40" align="center" />
|
>
|
||||||
<el-table-column type="index" label="#" width="40" />
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
<el-table-column prop="barCode" label="条码" show-overflow-tooltip/>
|
<el-table-column type="index" label="#" width="40" />
|
||||||
<el-table-column prop="spuId" label="spuID" show-overflow-tooltip/>
|
<el-table-column prop="barCode" label="条码" show-overflow-tooltip />
|
||||||
<el-table-column label="操作" width="150">
|
<el-table-column prop="spuId" label="spuID" show-overflow-tooltip />
|
||||||
<template #default="scope">
|
<el-table-column label="操作" width="150">
|
||||||
<el-button icon="edit-pen" text type="primary" v-auth="'supermarket_supermarketAuxiliaryCode_edit'"
|
<template #default="scope">
|
||||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
<el-button
|
||||||
<el-button icon="delete" text type="primary" v-auth="'supermarket_supermarketAuxiliaryCode_del'" @click="handleDelete([scope.row.id])">删除</el-button>
|
icon="edit-pen"
|
||||||
</template>
|
text
|
||||||
</el-table-column>
|
type="primary"
|
||||||
</el-table>
|
v-auth="'supermarket_supermarketAuxiliaryCode_edit'"
|
||||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
@click="formDialogRef.openDialog(scope.row.id)"
|
||||||
</div>
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="delete" text type="primary" v-auth="'supermarket_supermarketAuxiliaryCode_del'" @click="handleDelete([scope.row.id])"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 编辑、新增 -->
|
<!-- 编辑、新增 -->
|
||||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||||
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="systemSupermarketAuxiliaryCode">
|
<script setup lang="ts" name="systemSupermarketAuxiliaryCode">
|
||||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||||
import { fetchList, delObjs } from "/@/api/supermarket/supermarketAuxiliaryCode";
|
import { fetchList, delObjs } from '/@/api/supermarket/supermarketAuxiliaryCode';
|
||||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||||
import { useDict } from '/@/hooks/dict';
|
|
||||||
|
|
||||||
// 引入组件
|
// 引入组件
|
||||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||||
// 定义查询字典
|
|
||||||
|
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
const formDialogRef = ref()
|
const formDialogRef = ref();
|
||||||
// 搜索变量
|
// 搜索变量
|
||||||
const queryRef = ref()
|
const queryRef = ref();
|
||||||
const showSearch = ref(true)
|
const showSearch = ref(true);
|
||||||
// 多选变量
|
// 多选变量
|
||||||
const selectObjs = ref([]) as any
|
const selectObjs = ref([]) as any;
|
||||||
const multiple = ref(true)
|
const multiple = ref(true);
|
||||||
|
|
||||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
queryForm: {},
|
queryForm: {},
|
||||||
pageList: fetchList
|
pageList: fetchList,
|
||||||
})
|
});
|
||||||
|
|
||||||
// table hook
|
// table hook
|
||||||
const {
|
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||||
getDataList,
|
|
||||||
currentChangeHandle,
|
|
||||||
sizeChangeHandle,
|
|
||||||
sortChangeHandle,
|
|
||||||
downBlobFile,
|
|
||||||
tableStyle
|
|
||||||
} = useTable(state)
|
|
||||||
|
|
||||||
// 清空搜索条件
|
// 清空搜索条件
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
// 清空搜索条件
|
// 清空搜索条件
|
||||||
queryRef.value?.resetFields()
|
queryRef.value?.resetFields();
|
||||||
// 清空多选
|
// 清空多选
|
||||||
selectObjs.value = []
|
selectObjs.value = [];
|
||||||
getDataList()
|
getDataList();
|
||||||
}
|
};
|
||||||
|
|
||||||
// 导出excel
|
// 导出excel
|
||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
downBlobFile('/supermarket/supermarketAuxiliaryCode/export', Object.assign(state.queryForm, { ids: selectObjs }), 'supermarketAuxiliaryCode.xlsx')
|
downBlobFile('/supermarket/supermarketAuxiliaryCode/export', Object.assign(state.queryForm, { ids: selectObjs }), 'supermarketAuxiliaryCode.xlsx');
|
||||||
}
|
};
|
||||||
|
|
||||||
// 多选事件
|
// 多选事件
|
||||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||||
selectObjs.value = objs.map(({ id }) => id);
|
selectObjs.value = objs.map(({ id }) => id);
|
||||||
multiple.value = !objs.length;
|
multiple.value = !objs.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除操作
|
// 删除操作
|
||||||
const handleDelete = async (ids: string[]) => {
|
const handleDelete = async (ids: string[]) => {
|
||||||
try {
|
try {
|
||||||
await useMessageBox().confirm('此操作将永久删除');
|
await useMessageBox().confirm('此操作将永久删除');
|
||||||
} catch {
|
} catch {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await delObjs(ids);
|
await delObjs(ids);
|
||||||
getDataList();
|
getDataList();
|
||||||
useMessage().success('删除成功');
|
useMessage().success('删除成功');
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
useMessage().error(err.msg);
|
useMessage().error(err.msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -158,7 +158,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" class="mb20">
|
<el-col :span="24" class="mb20">
|
||||||
<el-form-item label="商品简介" prop="introduction">
|
<el-form-item label="商品简介" prop="introduction">
|
||||||
<el-input type="textarea" v-model="form.introduction" rows="3" placeholder="请输入商品简介" maxlength="200" show-word-limit />
|
<el-input type="textarea" v-model="form.introduction" rows="4" placeholder="请输入商品简介" maxlength="400" show-word-limit />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" class="mb20">
|
<el-col :span="24" class="mb20">
|
||||||
@@ -183,8 +183,25 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="包装单位" name="包装单位" disabled style="overflow-y: scroll; height: 50vh">Config</el-tab-pane>
|
<el-tab-pane label="包装单位" name="包装单位" disabled style="overflow-y: scroll; height: 50vh"> aaaa </el-tab-pane>
|
||||||
<el-tab-pane label="辅助条码" name="辅助条码" disabled style="overflow-y: scroll; height: 50vh">Role</el-tab-pane>
|
<el-tab-pane label="辅助条码" name="辅助条码" disabled style="overflow-y: scroll; height: 50vh">
|
||||||
|
<el-table
|
||||||
|
ref="auxiliaryCodeTableRef"
|
||||||
|
:data="auxiliaryCodeState.dataList"
|
||||||
|
v-loading="auxiliaryCodeState.loading"
|
||||||
|
border
|
||||||
|
:cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle"
|
||||||
|
:row-style="{ cursor: 'pointer' }"
|
||||||
|
@selection-change="auxiliaryCodeSelectionChangHandle"
|
||||||
|
@row-click="HandleAuxiliaryCodeRowClick"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
|
<el-table-column type="index" label="#" width="40" />
|
||||||
|
<el-table-column prop="barCode" label="条码" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="spuId" label="spuID" show-overflow-tooltip />
|
||||||
|
</el-table>
|
||||||
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@@ -204,6 +221,8 @@ import { useDict } from '/@/hooks/dict';
|
|||||||
import { useMessage } from '/@/hooks/message';
|
import { useMessage } from '/@/hooks/message';
|
||||||
import { getObj, addObj, putObj, getSupermarketCategory, getSupermarketBrand } from '/@/api/supermarket/supermarketSpu';
|
import { getObj, addObj, putObj, getSupermarketCategory, getSupermarketBrand } from '/@/api/supermarket/supermarketSpu';
|
||||||
import { rule } from '/@/utils/validate';
|
import { rule } from '/@/utils/validate';
|
||||||
|
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||||
|
import { fetchList } from '/@/api/supermarket/supermarketAuxiliaryCode';
|
||||||
const emit = defineEmits(['refresh']);
|
const emit = defineEmits(['refresh']);
|
||||||
|
|
||||||
const tabPaneEnum = ['基础信息', '包装单位', '辅助条码'];
|
const tabPaneEnum = ['基础信息', '包装单位', '辅助条码'];
|
||||||
@@ -267,6 +286,24 @@ const { supermarket_nature, status } = useDict('supermarket_nature', 'status');
|
|||||||
const categoryOptions = ref<any>([]); // 商品分类的下拉选项
|
const categoryOptions = ref<any>([]); // 商品分类的下拉选项
|
||||||
const brandOptions = ref<any>([]); // 超市品牌的下拉选项
|
const brandOptions = ref<any>([]); // 超市品牌的下拉选项
|
||||||
|
|
||||||
|
// 辅助条码state
|
||||||
|
const auxiliaryCodeState: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
queryForm: {},
|
||||||
|
pageList: fetchList,
|
||||||
|
});
|
||||||
|
const auxiliaryCodeTableRef = ref();
|
||||||
|
// 辅助条码多选变量
|
||||||
|
const auxiliaryCodeSelectObjs = ref([]) as any;
|
||||||
|
const { getDataList: getAuxiliaryCodeList, tableStyle } = useTable(auxiliaryCodeState);
|
||||||
|
// 辅助条码多选事件
|
||||||
|
const auxiliaryCodeSelectionChangHandle = (objs: { id: string }[]) => {
|
||||||
|
auxiliaryCodeSelectObjs.value = objs;
|
||||||
|
};
|
||||||
|
// 表格行点击事件
|
||||||
|
const HandleAuxiliaryCodeRowClick = (row: any) => {
|
||||||
|
auxiliaryCodeTableRef.value.toggleRowSelection(row);
|
||||||
|
};
|
||||||
|
|
||||||
// 初始化表单数据
|
// 初始化表单数据
|
||||||
const getsupermarketSpuData = (id: string) => {
|
const getsupermarketSpuData = (id: string) => {
|
||||||
// 获取数据
|
// 获取数据
|
||||||
@@ -296,6 +333,7 @@ const openDialog = async (id: string) => {
|
|||||||
getsupermarketSpuData(id);
|
getsupermarketSpuData(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取分类选项
|
||||||
if (categoryOptions.value.length <= 0) {
|
if (categoryOptions.value.length <= 0) {
|
||||||
try {
|
try {
|
||||||
const res = await getSupermarketCategory();
|
const res = await getSupermarketCategory();
|
||||||
@@ -305,6 +343,7 @@ const openDialog = async (id: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取品牌选项
|
||||||
if (brandOptions.value.length <= 0) {
|
if (brandOptions.value.length <= 0) {
|
||||||
try {
|
try {
|
||||||
const res = await getSupermarketBrand();
|
const res = await getSupermarketBrand();
|
||||||
@@ -313,6 +352,9 @@ const openDialog = async (id: string) => {
|
|||||||
brandOptions.value = [];
|
brandOptions.value = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取辅助条码列表
|
||||||
|
getAuxiliaryCodeList();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||||
|
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="条码" prop="barCode">
|
||||||
|
<el-input placeholder="请输入条码" v-model="form.barCode" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="规格" prop="spec">
|
||||||
|
<el-input placeholder="请输入规格" v-model="form.spec" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="单位" prop="unit">
|
||||||
|
<el-input placeholder="请输入单位" v-model="form.unit" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="form.status" placeholder="请选择状态">
|
||||||
|
<el-option label="正常" :value="0"></el-option>
|
||||||
|
<el-option label="停销" :value="1"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="内装数量" prop="packageNum">
|
||||||
|
<el-input-number v-model="form.packageNum" placeholder="请输入内装数量" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12" class="mb20">
|
||||||
|
<el-form-item label="spuId" prop="spuId">
|
||||||
|
<el-input placeholder="请输入spuId" v-model="form.spuId" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="SupermarketAuxiliaryCodeDialog">
|
||||||
|
import { useMessage } from '/@/hooks/message';
|
||||||
|
import { getObj, addObj, putObj } from '/@/api/supermarket/supermarketUnit';
|
||||||
|
const emit = defineEmits(['refresh']);
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const dataFormRef = ref();
|
||||||
|
const visible = ref(false);
|
||||||
|
const loading = ref(false);
|
||||||
|
// 定义字典
|
||||||
|
|
||||||
|
// 提交表单数据
|
||||||
|
const form = reactive({
|
||||||
|
id: '',
|
||||||
|
barCode: '',
|
||||||
|
spec: '',
|
||||||
|
unit: '',
|
||||||
|
status: '',
|
||||||
|
packageNum: '',
|
||||||
|
spuId: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
// 定义校验规则
|
||||||
|
const dataRules = ref({
|
||||||
|
barCode: [{ required: true, message: '条码不能为空', trigger: 'blur' }],
|
||||||
|
spec: [{ required: true, message: 'spec不能为空', trigger: 'blur' }],
|
||||||
|
unit: [{ required: true, message: '单位不能为空', trigger: 'blur' }],
|
||||||
|
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
|
||||||
|
packageNum: [{ required: true, message: '内装数量不能为空', trigger: 'blur' }],
|
||||||
|
spuId: [{ required: true, message: 'spuId不能为空', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
const openDialog = (id: string) => {
|
||||||
|
visible.value = true;
|
||||||
|
form.id = '';
|
||||||
|
|
||||||
|
// 重置表单数据
|
||||||
|
nextTick(() => {
|
||||||
|
dataFormRef.value?.resetFields();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取supermarketAuxiliaryCode信息
|
||||||
|
if (id) {
|
||||||
|
form.id = id;
|
||||||
|
getSupermarketUnitData(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
const onSubmit = async () => {
|
||||||
|
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||||
|
if (!valid) return false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
form.id ? await putObj(form) : await addObj(form);
|
||||||
|
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||||
|
visible.value = false;
|
||||||
|
emit('refresh');
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg);
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 初始化表单数据
|
||||||
|
const getSupermarketUnitData = (id: string) => {
|
||||||
|
// 获取数据
|
||||||
|
loading.value = true;
|
||||||
|
getObj(id)
|
||||||
|
.then((res: any) => {
|
||||||
|
Object.assign(form, res.data);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 暴露变量
|
||||||
|
defineExpose({
|
||||||
|
openDialog,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
<template>
|
||||||
|
<div class="layout-padding">
|
||||||
|
<div class="layout-padding-auto layout-padding-view">
|
||||||
|
<el-row v-show="showSearch">
|
||||||
|
<el-form :model="state.queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList">
|
||||||
|
<el-form-item label="条码" prop="barCode">
|
||||||
|
<el-input placeholder="请输入条码" v-model="state.queryForm.barCode" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格" prop="spec">
|
||||||
|
<el-input placeholder="请输入规格" v-model="state.queryForm.spec" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单位" prop="unit">
|
||||||
|
<el-input placeholder="请输入单位" v-model="state.queryForm.unit" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="state.queryForm.status" placeholder="请选择状态">
|
||||||
|
<el-option label="正常" :value="0" />
|
||||||
|
<el-option label="停销" :value="1" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="内装数量" prop="packageNum">
|
||||||
|
<el-input placeholder="请输入内装数量" v-model="state.queryForm.packageNum" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="spuId" prop="spuId">
|
||||||
|
<el-input placeholder="请输入spuId" v-model="state.queryForm.spuId" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<div class="mb8" style="width: 100%">
|
||||||
|
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()">新 增</el-button>
|
||||||
|
<el-button plain :disabled="multiple" icon="Delete" type="primary" @click="handleDelete(selectObjs)">删 除</el-button>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
:export="'supermarket_supermarketUnit_export'"
|
||||||
|
@exportExcel="exportExcel"
|
||||||
|
class="ml10 mr20"
|
||||||
|
style="float: right"
|
||||||
|
@queryTable="getDataList"
|
||||||
|
></right-toolbar>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
<el-table
|
||||||
|
:data="state.dataList"
|
||||||
|
v-loading="state.loading"
|
||||||
|
border
|
||||||
|
:cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle"
|
||||||
|
@selection-change="selectionChangHandle"
|
||||||
|
@sort-change="sortChangeHandle"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
|
<el-table-column type="index" label="#" width="40" />
|
||||||
|
<el-table-column prop="barCode" label="条码" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="spec" label="规格" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="unit" label="单位" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="status" label="状态" show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag v-if="scope.row.status == 0" type="success">正常</el-tag>
|
||||||
|
<el-tag v-if="scope.row.status == 1" type="danger">停销</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="packageNum" label="内装数量" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="purchasePrice" label="进价/单位分" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="retailPrice" label="零售价/单位分" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="spuId" label="spuId" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="promotionPrice" label="促销价" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="costPrice" label="成本价" show-overflow-tooltip />
|
||||||
|
<el-table-column label="操作" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button icon="edit-pen" text type="primary" @click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||||
|
<el-button icon="delete" text type="primary" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 编辑、新增 -->
|
||||||
|
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="systemSupermarketAuxiliaryCode">
|
||||||
|
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||||
|
import { fetchList, delObjs } from '/@/api/supermarket/supermarketUnit';
|
||||||
|
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||||
|
|
||||||
|
// 引入组件
|
||||||
|
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const formDialogRef = ref();
|
||||||
|
// 搜索变量
|
||||||
|
const queryRef = ref();
|
||||||
|
const showSearch = ref(true);
|
||||||
|
// 多选变量
|
||||||
|
const selectObjs = ref([]) as any;
|
||||||
|
const multiple = ref(true);
|
||||||
|
|
||||||
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
queryForm: {},
|
||||||
|
pageList: fetchList,
|
||||||
|
});
|
||||||
|
|
||||||
|
// table hook
|
||||||
|
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||||
|
|
||||||
|
// 清空搜索条件
|
||||||
|
const resetQuery = () => {
|
||||||
|
// 清空搜索条件
|
||||||
|
queryRef.value?.resetFields();
|
||||||
|
// 清空多选
|
||||||
|
selectObjs.value = [];
|
||||||
|
getDataList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 导出excel
|
||||||
|
const exportExcel = () => {
|
||||||
|
downBlobFile('/supermarket/supermarketUnit/export', Object.assign(state.queryForm, { ids: selectObjs }), 'supermarketUnit.xlsx');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 多选事件
|
||||||
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||||
|
selectObjs.value = objs.map(({ id }) => id);
|
||||||
|
multiple.value = !objs.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除操作
|
||||||
|
const handleDelete = async (ids: string[]) => {
|
||||||
|
try {
|
||||||
|
await useMessageBox().confirm('此操作将永久删除');
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await delObjs(ids);
|
||||||
|
getDataList();
|
||||||
|
useMessage().success('删除成功');
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Reference in new issue
Block a user