Merge branch 'master' of http://gitea.zianxin.com/zianxin/biz-pc-cloud
This commit is contained in:
commit
d0b5ab9f62
9 files changed
+355
-529
No files matched your search
+5
-5
@@ -8,18 +8,18 @@ VITE_OPEN = true
|
||||
ENV = 'development'
|
||||
|
||||
# ADMIN 服务地址
|
||||
# VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 线上
|
||||
VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 线上
|
||||
# VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/
|
||||
# VITE_ADMIN_PROXY_PATH = http://localhost:9999/
|
||||
VITE_ADMIN_PROXY_PATH = http://192.168.101.50:9999/ # 邓-本地
|
||||
|
||||
# VITE_ADMIN_PROXY_PATH = http://192.168.101.50:9999/ # 邓-本地
|
||||
# VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境
|
||||
|
||||
|
||||
# 图片访问基础地址
|
||||
# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # 线上
|
||||
VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # 线上
|
||||
# VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc
|
||||
# VITE_IMAGE_BASE_PATH = http://localhost:9999
|
||||
VITE_IMAGE_BASE_PATH = http://192.168.101.50:9999 # 邓-本地
|
||||
# VITE_IMAGE_BASE_PATH = http://192.168.101.50:9999 # 邓-本地
|
||||
# VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境
|
||||
|
||||
# 代码生成服务地址
|
||||
|
||||
@@ -55,3 +55,11 @@ export function getCgPlanSpuPage() {
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
// 获取简要商品列表
|
||||
export function getErpSpuSimpleAll() {
|
||||
return request({
|
||||
url: "/supermarket/supermarketSpu/SimpleAll",
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/supermarket/smErpInventoryRecordsItem/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/supermarket/smErpInventoryRecordsItem',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/supermarket/smErpInventoryRecordsItem/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/supermarket/smErpInventoryRecordsItem',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/supermarket/smErpInventoryRecordsItem',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -314,22 +314,22 @@ const print = async (row: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const adminRefund = async (row: any) => {
|
||||
let loading: any = null
|
||||
try {
|
||||
await useMessage().delConfirm("是否同意退款?")
|
||||
loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: "提交中",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
})
|
||||
await hardInvoice.adminRefund({ id: row.id })
|
||||
useMessage().success("操作成功")
|
||||
getDataList()
|
||||
} finally {
|
||||
setTimeout(() => loading.close(), 500)
|
||||
}
|
||||
}
|
||||
// const adminRefund = async (row: any) => {
|
||||
// let loading: any = null
|
||||
// try {
|
||||
// await useMessage().delConfirm("是否同意退款?")
|
||||
// loading = ElLoading.service({
|
||||
// lock: true,
|
||||
// text: "提交中",
|
||||
// background: "rgba(0, 0, 0, 0.7)",
|
||||
// })
|
||||
// await hardInvoice.adminRefund({ id: row.id })
|
||||
// useMessage().success("操作成功")
|
||||
// getDataList()
|
||||
// } finally {
|
||||
// setTimeout(() => loading.close(), 500)
|
||||
// }
|
||||
// }
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
行新增
|
||||
</el-button>
|
||||
<el-button @click="removeSelectRowEvent" :disabled="state.selectedRowsErpSpuIds.length <= 0">删除选中</el-button>
|
||||
<el-button @click="clearData">重置数据</el-button>
|
||||
<el-button @click="clearData">清空数据</el-button>
|
||||
<el-button @click="handleClickSpuSelect">商品选择</el-button>
|
||||
</el-row>
|
||||
|
||||
@@ -258,13 +258,14 @@ import { storePrice } from "/@/utils/formatMoney"
|
||||
|
||||
// 基本表单数据类型
|
||||
interface FormVO {
|
||||
id?: string
|
||||
planCode: string
|
||||
orderNumber: string
|
||||
planDate: string
|
||||
supplierId: string
|
||||
handlerUserId: string
|
||||
remark: string
|
||||
[key: string]: string
|
||||
[key: string]: string | undefined
|
||||
}
|
||||
|
||||
// 可编辑表格行数据类型
|
||||
@@ -289,6 +290,7 @@ const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
|
||||
|
||||
// 基本信息表单数据
|
||||
const baseDataForm = reactive<FormVO>({
|
||||
id: undefined,
|
||||
planCode: "",
|
||||
orderNumber: "",
|
||||
planDate: "",
|
||||
@@ -328,6 +330,7 @@ const validRules = ref<VxeTablePropTypes.EditRules<RowVO>>({
|
||||
|
||||
// 初始化数据
|
||||
const getInitData = async () => {
|
||||
baseDataForm.id = undefined
|
||||
const id = route.query.id as string
|
||||
if (id) {
|
||||
// 获取数据
|
||||
@@ -335,6 +338,7 @@ const getInitData = async () => {
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(baseDataForm, {
|
||||
id: res.data.id,
|
||||
planCode: res.data.planCode,
|
||||
orderNumber: res.data.orderNumber,
|
||||
planDate: res.data.planDate,
|
||||
@@ -347,6 +351,13 @@ const getInitData = async () => {
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
|
||||
// 获取货商选项 & 获取简要商品列表
|
||||
// const [supplierTypeOptions, planCode] = await Promise.allSettled([getSupplierTypeOptions(), getPlanCode()]).then((results) =>
|
||||
// results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
// )
|
||||
// supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data)
|
||||
// planCode && planCode.code === 0 && (baseDataForm.planCode = planCode.data)
|
||||
}
|
||||
|
||||
// 获取货商选项 & 获取采购计划编号
|
||||
@@ -541,11 +552,8 @@ const handleSelectDialogConfirm = () => {
|
||||
|
||||
// 整理数据
|
||||
const cgPlanSpuItems = computed(() => {
|
||||
const a = state.editableTableData
|
||||
return a.map((item: any) => {
|
||||
console.log("xxxx")
|
||||
|
||||
const unit = item.erpUnitVos.find((unitItem: any) => unitItem.id == item.unitId)
|
||||
return state.editableTableData.map((item: any) => {
|
||||
const unit = item.erpUnitVos.find((unitItem: any) => unitItem.id === item.unitId)
|
||||
return {
|
||||
id: "",
|
||||
erpSpuId: item.erpSpuId,
|
||||
@@ -640,7 +648,7 @@ const submitData = async () => {
|
||||
// 清空填写的数据 返回 true
|
||||
const clearData = () => {
|
||||
for (const key in baseDataForm) {
|
||||
if (key === "planCode") continue
|
||||
if (key === "planCode" || key === "id") continue
|
||||
baseDataForm[key] = ""
|
||||
}
|
||||
state.insertedRowNumber = 0
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
<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="采购id" prop="planId">
|
||||
<el-input v-model="form.planId" placeholder="请输入采购id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="库存商品id" prop="erpSpuId">
|
||||
<el-input v-model="form.erpSpuId" placeholder="请输入库存商品id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户编号" prop="merchantId">
|
||||
<el-input v-model="form.merchantId" placeholder="请输入商户编号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="部门id" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入部门id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input-number :min="1" :max="1000" v-model="form.quantity" placeholder="请输入数量"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="进价" prop="unitPrice">
|
||||
<el-input-number :min="1" :max="1000" v-model="form.unitPrice" placeholder="请输入进价"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="累计总金额" prop="totalAmount">
|
||||
<el-input-number :min="1" :max="1000" v-model="form.totalAmount" placeholder="请输入累计总金额"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="包装单位id" prop="unitId">
|
||||
<el-input v-model="form.unitId" placeholder="请输入包装单位id"/>
|
||||
</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="SmErpCgPlanItemDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/supermarket/smErpCgPlanItem'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id:'',
|
||||
planId: '',
|
||||
erpSpuId: '',
|
||||
merchantId: '',
|
||||
deptId: '',
|
||||
quantity: 0,
|
||||
unitPrice: 0,
|
||||
totalAmount: 0,
|
||||
remark: '',
|
||||
unitId: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
planId: [{required: true, message: '采购id不能为空', trigger: 'blur'}],
|
||||
erpSpuId: [{required: true, message: '库存商品id不能为空', trigger: 'blur'}],
|
||||
quantity: [{required: true, message: '数量不能为空', trigger: 'blur'}],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取smErpCgPlanItem信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getsmErpCgPlanItemData(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 getsmErpCgPlanItemData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -1,104 +0,0 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'supermarket_smErpCgPlanItem_add'"
|
||||
>
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'supermarket_smErpCgPlanItem_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'supermarket_smErpCgPlanItem_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<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="systemSmErpCgPlanItem">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, delObjs } from "/@/api/supermarket/smErpCgPlanItem"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = 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/smErpCgPlanItem/export",
|
||||
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||
"smErpCgPlanItem.xlsx",
|
||||
)
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
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>
|
||||
+142
-143
@@ -1,192 +1,191 @@
|
||||
<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="单据类型(字典inventory_type)" prop="inventoryType">
|
||||
<el-input v-model="form.inventoryType" placeholder="请输入单据类型(字典inventory_type)"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<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="单据类型(字典inventory_type)" prop="inventoryType">
|
||||
<el-input v-model="form.inventoryType" placeholder="请输入单据类型(字典inventory_type)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品id" prop="erpSpuId">
|
||||
<el-input v-model="form.erpSpuId" placeholder="请输入商品id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品id" prop="erpSpuId">
|
||||
<el-input v-model="form.erpSpuId" placeholder="请输入商品id" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户编号" prop="merchantId">
|
||||
<el-input v-model="form.merchantId" placeholder="请输入商户编号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户编号" prop="merchantId">
|
||||
<el-input v-model="form.merchantId" placeholder="请输入商户编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="部门id" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入部门id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="部门id" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入部门id" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="出入库数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入出入库数量"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="出入库数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入出入库数量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="单价" prop="unitPrice">
|
||||
<el-input v-model="form.unitPrice" placeholder="请输入单价"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="单价" prop="unitPrice">
|
||||
<el-input v-model="form.unitPrice" placeholder="请输入单价" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="总金额" prop="totalAmount">
|
||||
<el-input v-model="form.totalAmount" placeholder="请输入总金额"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="总金额" prop="totalAmount">
|
||||
<el-input v-model="form.totalAmount" placeholder="请输入总金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="税率%" prop="taxRate">
|
||||
<el-input v-model="form.taxRate" placeholder="请输入税率%"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="税率%" prop="taxRate">
|
||||
<el-input v-model="form.taxRate" placeholder="请输入税率%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="税前金额" prop="taxAmount">
|
||||
<el-input v-model="form.taxAmount" placeholder="请输入税前金额"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="税前金额" prop="taxAmount">
|
||||
<el-input v-model="form.taxAmount" placeholder="请输入税前金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<el-input v-model="form.supplierId" placeholder="请输入货商"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<el-input v-model="form.supplierId" placeholder="请输入货商" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="订单类型(1入库 2出库)" prop="orderType">
|
||||
<el-input v-model="form.orderType" placeholder="请输入订单类型(1入库 2出库)"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="订单类型(1入库 2出库)" prop="orderType">
|
||||
<el-input v-model="form.orderType" placeholder="请输入订单类型(1入库 2出库)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="包装单位id" prop="unitId">
|
||||
<el-input v-model="form.unitId" placeholder="请输入包装单位id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="出入库关联id" prop="inventoryId">
|
||||
<el-input v-model="form.inventoryId" placeholder="请输入出入库关联id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="包装单位id" prop="unitId">
|
||||
<el-input v-model="form.unitId" placeholder="请输入包装单位id" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="出入库关联id" prop="inventoryId">
|
||||
<el-input v-model="form.inventoryId" placeholder="请输入出入库关联id" />
|
||||
</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>
|
||||
</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="SmErpInventoryRecordsItemDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/supermarket/smErpInventoryRecordsItem'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpInventoryRecordsItem"
|
||||
import { rule } from "/@/utils/validate"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
const { erp_order_type,inventory_type } = useDict('erp_order_type','inventory_type')
|
||||
const { erp_order_type, inventory_type } = useDict("erp_order_type", "inventory_type")
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id:'',
|
||||
inventoryType: '',
|
||||
erpSpuId: '',
|
||||
merchantId: '',
|
||||
deptId: '',
|
||||
quantity: '',
|
||||
unitPrice: '',
|
||||
totalAmount: '',
|
||||
taxRate: '',
|
||||
taxAmount: '',
|
||||
supplierId: '',
|
||||
remark: '',
|
||||
orderType: '',
|
||||
unitId: '',
|
||||
inventoryId: '',
|
||||
});
|
||||
id: "",
|
||||
inventoryType: "",
|
||||
erpSpuId: "",
|
||||
merchantId: "",
|
||||
deptId: "",
|
||||
quantity: "",
|
||||
unitPrice: "",
|
||||
totalAmount: "",
|
||||
taxRate: "",
|
||||
taxAmount: "",
|
||||
supplierId: "",
|
||||
remark: "",
|
||||
orderType: "",
|
||||
unitId: "",
|
||||
inventoryId: "",
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
erpSpuId: [{required: true, message: '商品id不能为空', trigger: 'blur'}],
|
||||
quantity: [{required: true, message: '出入库数量不能为空', trigger: 'blur'}],
|
||||
unitId: [{required: true, message: '包装单位id不能为空', trigger: 'blur'}],
|
||||
erpSpuId: [{ required: true, message: "商品id不能为空", trigger: "blur" }],
|
||||
quantity: [{ required: true, message: "出入库数量不能为空", trigger: "blur" }],
|
||||
unitId: [{ required: true, message: "包装单位id不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
|
||||
// 获取smErpInventoryRecordsItem信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getsmErpInventoryRecordsItemData(id)
|
||||
}
|
||||
};
|
||||
// 获取smErpInventoryRecordsItem信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getsmErpInventoryRecordsItemData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
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');
|
||||
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);
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getsmErpInventoryRecordsItemData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
+127
-97
@@ -1,77 +1,110 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'supermarket_smErpInventoryRecordsItem_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'supermarket_smErpInventoryRecordsItem_del'" @click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'supermarket_smErpInventoryRecordsItem_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"
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'supermarket_smErpInventoryRecordsItem_add'"
|
||||
>
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
v-auth="'supermarket_smErpInventoryRecordsItem_del'"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'supermarket_smErpInventoryRecordsItem_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="inventoryType" label="单据类型(字典inventory_type)" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="inventory_type" :value="scope.row.inventoryType"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="erpSpuId" label="商品id" show-overflow-tooltip/>
|
||||
<el-table-column prop="merchantId" label="商户编号" show-overflow-tooltip/>
|
||||
<el-table-column prop="deptId" label="部门id" show-overflow-tooltip/>
|
||||
<el-table-column prop="quantity" label="出入库数量" show-overflow-tooltip/>
|
||||
<el-table-column prop="unitPrice" label="单价" show-overflow-tooltip/>
|
||||
<el-table-column prop="totalAmount" label="总金额" show-overflow-tooltip/>
|
||||
<el-table-column prop="taxRate" label="税率%" show-overflow-tooltip/>
|
||||
<el-table-column prop="taxAmount" label="税前金额" show-overflow-tooltip/>
|
||||
<el-table-column prop="supplierId" label="货商" show-overflow-tooltip/>
|
||||
<el-table-column prop="remark" label="备注" show-overflow-tooltip/>
|
||||
<el-table-column prop="orderType" label="订单类型(1入库 2出库)" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="erp_order_type" :value="scope.row.orderType"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unitId" label="包装单位id" show-overflow-tooltip/>
|
||||
<el-table-column prop="inventoryId" label="出入库关联id" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'supermarket_smErpInventoryRecordsItem_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'supermarket_smErpInventoryRecordsItem_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>
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="inventoryType" label="单据类型(字典inventory_type)" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="inventory_type" :value="scope.row.inventoryType"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="erpSpuId" label="商品id" show-overflow-tooltip />
|
||||
<el-table-column prop="merchantId" label="商户编号" show-overflow-tooltip />
|
||||
<el-table-column prop="deptId" label="部门id" show-overflow-tooltip />
|
||||
<el-table-column prop="quantity" label="出入库数量" show-overflow-tooltip />
|
||||
<el-table-column prop="unitPrice" label="单价" show-overflow-tooltip />
|
||||
<el-table-column prop="totalAmount" label="总金额" show-overflow-tooltip />
|
||||
<el-table-column prop="taxRate" label="税率%" show-overflow-tooltip />
|
||||
<el-table-column prop="taxAmount" label="税前金额" show-overflow-tooltip />
|
||||
<el-table-column prop="supplierId" label="货商" show-overflow-tooltip />
|
||||
<el-table-column prop="remark" label="备注" show-overflow-tooltip />
|
||||
<el-table-column prop="orderType" label="订单类型(1入库 2出库)" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="erp_order_type" :value="scope.row.orderType"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unitId" label="包装单位id" show-overflow-tooltip />
|
||||
<el-table-column prop="inventoryId" label="出入库关联id" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'supermarket_smErpInventoryRecordsItem_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'supermarket_smErpInventoryRecordsItem_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)" />
|
||||
|
||||
</div>
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemSmErpInventoryRecordsItem">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/supermarket/smErpInventoryRecordsItem";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpInventoryRecordsItem"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
// 定义查询字典
|
||||
|
||||
const { erp_order_type,inventory_type } = useDict('erp_order_type','inventory_type')
|
||||
const { erp_order_type, inventory_type } = useDict("erp_order_type", "inventory_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
@@ -82,54 +115,51 @@ const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/supermarket/smErpInventoryRecordsItem/export', Object.assign(state.queryForm, { ids: selectObjs }), 'smErpInventoryRecordsItem.xlsx')
|
||||
downBlobFile(
|
||||
"/supermarket/smErpInventoryRecordsItem/export",
|
||||
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||
"smErpInventoryRecordsItem.xlsx",
|
||||
)
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
try {
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user