Merge branch 'master' of https://gitea.zianxin.com/zax/biz-pc-cloud
This commit is contained in:
commit
a74ad47c98
25 files changed
+1013
-735
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/integrated/visitorUser/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/integrated/visitorUser',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/integrated/visitorUser/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/integrated/visitorUser',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/integrated/visitorUser',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ export function addObj(data?: object) {
|
||||
// 库存盘点修改
|
||||
export function putObj(data?: object) {
|
||||
return request({
|
||||
url: "/supermarket/smErpInventoryRecords/savePD",
|
||||
method: "post",
|
||||
url: "/supermarket/smErpInventoryRecords/updatePD",
|
||||
method: "put",
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -17,13 +17,12 @@
|
||||
<el-button circle icon="Download" @click="handleExport()" />
|
||||
</el-tooltip>
|
||||
|
||||
<slot></slot>
|
||||
|
||||
<!-- 刷新功能 -->
|
||||
<el-tooltip class="item" effect="dark" :content="$t('queryTree.refresh')" placement="top">
|
||||
<el-button circle icon="Refresh" @click="handleRefresh()" />
|
||||
</el-tooltip>
|
||||
|
||||
<!-- 插槽 -->
|
||||
<slot></slot>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { computed } from "vue"
|
||||
|
||||
const useComputed = (fn: Function) => {
|
||||
const map = new Map()
|
||||
|
||||
return (...args: any[]) => {
|
||||
const key = JSON.stringify(args)
|
||||
|
||||
if (map.has(key)) return map.get(key)
|
||||
|
||||
const comput = computed(() => fn(...args))
|
||||
map.set(key, comput)
|
||||
return comput
|
||||
}
|
||||
}
|
||||
|
||||
export default useComputed
|
||||
@@ -1,9 +1,20 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<el-form :model="state.queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList">
|
||||
<el-form-item label="手机号" prop="mobilePhone">
|
||||
<el-input placeholder="请输入手机号" v-model="state.queryForm.mobilePhone" />
|
||||
</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
|
||||
<!-- <el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@@ -11,7 +22,7 @@
|
||||
v-auth="'admin_userTrustedDevice_add'"
|
||||
>
|
||||
新 增
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
<el-button
|
||||
plain
|
||||
:disabled="multiple"
|
||||
@@ -52,14 +63,14 @@
|
||||
<el-table-column prop="expireTime" label="过期时间" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
<!-- <el-button
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'admin_userTrustedDevice_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
> -->
|
||||
<el-button icon="delete" text type="primary" v-auth="'admin_userTrustedDevice_del'" @click="handleDelete([scope.row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
|
||||
@@ -26,5 +26,6 @@ export default {
|
||||
index: '#',
|
||||
importSupplierTip: '导入货商',
|
||||
importErpSpuTip: '导入库存商品',
|
||||
importErpSpuForUpdateTip: '导入库存商品(覆盖导入)',
|
||||
}
|
||||
};
|
||||
@@ -21,17 +21,6 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="审核状态" prop="checkStatus">
|
||||
<el-input v-model="form.checkStatus" 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="isTemp">
|
||||
@@ -49,23 +38,11 @@
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="流程id" prop="processInstanceId">
|
||||
<el-input v-model="form.processInstanceId" placeholder="请输入流程id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="审核原因" prop="checkReason">
|
||||
<el-input v-model="form.checkReason" placeholder="请输入审核原因"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="用户id" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入用户id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="用户id" prop="userId">-->
|
||||
<!-- <el-input v-model="form.userId" placeholder="请输入用户id"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="车辆状态" prop="carStatus">
|
||||
@@ -174,4 +151,4 @@ const getcarInfoData = (id: string) => {
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
@@ -35,7 +35,7 @@
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border
|
||||
<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">
|
||||
@@ -49,16 +49,14 @@
|
||||
<dict-tag :options="check_status" :value="scope.row.checkStatus"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptId" label="部门id" show-overflow-tooltip/>
|
||||
<el-table-column prop="isTemp" label="是否是临时车" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="is_show" :value="scope.row.isTemp"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="tempDate" label="临时失效日期" show-overflow-tooltip/>
|
||||
<el-table-column prop="processInstanceId" label="流程id" show-overflow-tooltip/>
|
||||
<el-table-column prop="checkReason" label="审核原因" show-overflow-tooltip/>
|
||||
<el-table-column prop="userId" label="用户id" show-overflow-tooltip/>
|
||||
<!-- <el-table-column prop="userId" label="用户id" show-overflow-tooltip/>-->
|
||||
<el-table-column prop="carStatus" label="车辆状态" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="car_status" :value="scope.row.carStatus"></dict-tag>
|
||||
@@ -152,4 +150,4 @@ const handleDelete = async (ids: string[]) => {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
@@ -0,0 +1,135 @@
|
||||
<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="realName">
|
||||
<el-input v-model="form.realName" placeholder="请输入真实姓名"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="手机号码" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入手机号码"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="状态(0 正常,1禁用)" prop="status">
|
||||
<el-input v-model="form.status" placeholder="请输入状态(0 正常,1禁用)"/>
|
||||
</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="registerTime">
|
||||
<el-input v-model="form.registerTime" placeholder="请输入首次注册时间"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="最后登录日期" prop="lastLogin">
|
||||
<el-input v-model="form.lastLogin" placeholder="请输入最后登录日期"/>
|
||||
</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="VisitorUserDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/integrated/visitorUser'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
const { visitor_status } = useDict('visitor_status')
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id:'',
|
||||
realName: '',
|
||||
phone: '',
|
||||
status: '',
|
||||
deptId: '',
|
||||
registerTime: '',
|
||||
lastLogin: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
realName: [{required: true, message: '真实姓名不能为空', trigger: 'blur'}],
|
||||
phone: [{required: true, message: '手机号码不能为空', trigger: 'blur'}],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取visitorUser信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getvisitorUserData(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 getvisitorUserData = (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,139 @@
|
||||
<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="realName" >
|
||||
<el-input placeholder="请输入真实姓名" v-model="state.queryForm.realName" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop="phone" >
|
||||
<el-input placeholder="请输入手机号码" v-model="state.queryForm.phone" />
|
||||
</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()"
|
||||
v-auth="'integrated_visitorUser_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'integrated_visitorUser_del'" @click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'integrated_visitorUser_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="realName" label="真实姓名" show-overflow-tooltip/>
|
||||
<el-table-column prop="phone" label="手机号码" show-overflow-tooltip/>
|
||||
<el-table-column prop="status" label="状态(0 正常,1禁用)" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="visitor_status" :value="scope.row.status"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deptId" label="部门id" show-overflow-tooltip/>
|
||||
<el-table-column prop="registerTime" label="首次注册时间" show-overflow-tooltip/>
|
||||
<el-table-column prop="lastLogin" label="最后登录日期" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'integrated_visitorUser_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'integrated_visitorUser_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>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemVisitorUser">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/integrated/visitorUser";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
const { visitor_status } = useDict('visitor_status')
|
||||
// 定义变量内容
|
||||
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('/integrated/visitorUser/export', Object.assign(state.queryForm, { ids: selectObjs }), 'visitorUser.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>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="选择商品" width="80%" :close-on-click-modal="false" draggable @close="dialogVisible = false">
|
||||
<el-row>
|
||||
<el-form :model="queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList">
|
||||
<el-form :model="queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList(true)">
|
||||
<el-form-item label="商品名称" prop="productName">
|
||||
<el-input placeholder="请输入商品名称" v-model="queryForm.productName" />
|
||||
</el-form-item>
|
||||
@@ -12,7 +12,7 @@
|
||||
<el-input placeholder="请输入条码" v-model="queryForm.barcode" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
||||
<el-button icon="search" type="primary" @click="getDataList(true)">查询</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -49,6 +49,11 @@
|
||||
<div v-else class="text-gray-400">无包装单位</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="productNature" label="商品性质" show-overflow-tooltip align="center" width="150">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="supermarket_nature" :value="scope.row.productNature" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态" min-width="100px" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="status" :value="scope.row.status" />
|
||||
@@ -79,7 +84,7 @@ import { displayPrice } from "/@/utils/formatMoney"
|
||||
|
||||
const emit = defineEmits(["getSelectedRows"])
|
||||
|
||||
const { status } = useDict("status")
|
||||
const { supermarket_nature, status } = useDict("supermarket_nature", "status")
|
||||
const queryRef = ref()
|
||||
const tableRef = ref() // 对话框多选表格ref
|
||||
const loading = ref(false) // 对话框多选表格loading
|
||||
@@ -88,6 +93,8 @@ const queryForm = reactive<any>({
|
||||
productCode: "",
|
||||
barcode: "",
|
||||
productName: "",
|
||||
current: 1,
|
||||
size: 10,
|
||||
})
|
||||
const total = ref<number>(0)
|
||||
const dataList = ref<any[]>([]) // 对话框多选表格数据
|
||||
@@ -97,11 +104,14 @@ const dataList = ref<any[]>([]) // 对话框多选表格数据
|
||||
// 打开弹窗
|
||||
const openDialog = async () => {
|
||||
dialogVisible.value = true
|
||||
getDataList()
|
||||
getDataList(false)
|
||||
}
|
||||
|
||||
// 获取商品数据并且勾选
|
||||
const getDataList = async () => {
|
||||
const getDataList = async (isSearch = false) => {
|
||||
if (isSearch) {
|
||||
queryForm.current = 1
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
const { code, data } = await getErpSpuPage(queryForm)
|
||||
@@ -133,7 +143,7 @@ const currentChangeHandle = (val: number) => {
|
||||
|
||||
const resetQuery = () => {
|
||||
queryRef.value?.resetFields()
|
||||
getDataList()
|
||||
getDataList(true)
|
||||
}
|
||||
|
||||
// 商品选择对话框确认
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<span class="font-bold">单据日期:</span>
|
||||
<span>{{ baseDataForm.inventoryDate }}</span>
|
||||
</div>
|
||||
<div style="width: 33.33%; height: 28px; line-height: 28px">
|
||||
<!-- <div style="width: 33.33%; height: 28px; line-height: 28px">
|
||||
<span class="font-bold">经办人:</span>
|
||||
<SelectHandlerUser
|
||||
v-model.trim="baseDataForm.handlerUserId"
|
||||
@@ -19,7 +19,7 @@
|
||||
style="width: 200px"
|
||||
:isDisplayName="true"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
<div style="width: 33.33%; height: 28px; line-height: 28px">
|
||||
<span class="font-bold">关联补货申请:</span>
|
||||
<span>{{ baseDataForm.linkCode }}</span>
|
||||
@@ -53,14 +53,14 @@
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="经办人" prop="handlerUserId">
|
||||
<!-- <el-form-item label="经办人" prop="handlerUserId">
|
||||
<SelectHandlerUser
|
||||
v-model.trim="baseDataForm.handlerUserId"
|
||||
placeholder="请选择经办人"
|
||||
style="width: 200px"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<SelectSupermarketSupplier v-model="baseDataForm.supplierId" style="width: 200px" :disabled="disabled" />
|
||||
</el-form-item>
|
||||
@@ -97,29 +97,33 @@
|
||||
:column-config="{ resizable: true }"
|
||||
:row-config="{ isHover: true }"
|
||||
:resizable-config="{ dragMode: 'fixed' }"
|
||||
:checkbox-config="{ highlight: true, range: true }"
|
||||
:data="vxeTableData"
|
||||
:edit-rules="validRules"
|
||||
show-footer
|
||||
:footer-data="[{ seq: '合计', totalAmount }]"
|
||||
:merge-footer-items="[{ row: 0, col: 2, rowspan: 1, colspan: 6 }]"
|
||||
@checkbox-all=""
|
||||
@checkbox-change=""
|
||||
size="mini"
|
||||
align="center"
|
||||
>
|
||||
<vxe-column type="checkbox" width="40" fixed="left" />
|
||||
<vxe-column type="seq" width="50" fixed="left" />
|
||||
<vxe-column field="seq" type="seq" width="50" fixed="left" />
|
||||
<vxe-column field="productName" title="库存商品">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.productName">{{ row.productName }}</span>
|
||||
<span v-else>{{ row.erpSpuId && erpSpuSimpleAll.find((item: any) => item.id === row.erpSpuId)?.productName }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="productNature" title="商品性质">
|
||||
<template #default="{ row }">
|
||||
{{ supermarket_nature.find((item: any) => item.value == row.productNature)?.label || "" }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="selectedUnitObj" title="包装单位" :edit-render="{}">
|
||||
<template #edit="{ row, $rowIndex }">
|
||||
<el-select
|
||||
v-model="row.selectedUnitObj"
|
||||
value-key="id"
|
||||
placeholder="请选择包装单位"
|
||||
@change="reComputeTotalAmount(row, $rowIndex)"
|
||||
>
|
||||
<template #edit="{ row }">
|
||||
<el-select v-model="row.selectedUnitObj" value-key="id" placeholder="请选择包装单位" @change="onUnitChange(row)">
|
||||
<el-option
|
||||
v-for="item in row.erpUnitVos"
|
||||
:key="item.id"
|
||||
@@ -137,7 +141,14 @@
|
||||
</vxe-column>
|
||||
<vxe-column field="quantity" title="数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #edit="{ row, $rowIndex }">
|
||||
<el-input v-model.number="row.quantity" @change="reComputeTotalAmount(row, $rowIndex)" />
|
||||
<el-input-number
|
||||
v-if="row.productNature == '1'"
|
||||
v-model="row.quantity"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
@change="onRowValueChange(row, $rowIndex)"
|
||||
/>
|
||||
<el-input-number v-else v-model="row.quantity" :min="0" :precision="2" @change="onRowValueChange(row, $rowIndex)" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="purchasePrice" title="原进价">
|
||||
@@ -155,20 +166,20 @@
|
||||
v-model="row.selectedUnitObj.realPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
@change="reComputeTotalAmount(row, $rowIndex)"
|
||||
@change="onRowValueChange(row, $rowIndex)"
|
||||
/>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="totalAmount" title="累计总金额" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #default="{ row }">
|
||||
{{ row?.selectedUnitObj?.totalAmount }}
|
||||
<!-- <span v-if="row.selectedUnitObj && row.quantity">
|
||||
{{ Number((row.quantity * parseFloat(row.selectedUnitObj.realPrice || 0)).toFixed(2)) }}
|
||||
</span> -->
|
||||
</template>
|
||||
<template #edit="{ row }">
|
||||
<template #edit="{ row, $rowIndex }">
|
||||
<el-input-number v-if="row.selectedUnitObj" v-model="row.selectedUnitObj.totalAmount" :min="0" :precision="2" />
|
||||
</template>
|
||||
<template #footer="{ row }">
|
||||
<span style="color: #2e5cf6; font-weight: bold">{{ totalAmount }} 元</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="remark" title="备注" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #edit="{ row }">
|
||||
@@ -187,36 +198,30 @@
|
||||
<el-tooltip v-if="!disabled" effect="dark" content="保存并返回列表页面" placement="top">
|
||||
<el-button type="primary" plain @click="onSave">保存</el-button>
|
||||
</el-tooltip>
|
||||
<!-- <el-tooltip v-if="disabled" effect="dark" content="打印清单" placement="top">
|
||||
<!-- <el-tooltip effect="dark" content="打印清单" placement="top">
|
||||
<el-button type="success" plain @click="printEvent">打印</el-button>
|
||||
</el-tooltip> -->
|
||||
</el-row>
|
||||
|
||||
<!-- 商品选择对话框 -->
|
||||
<select-dialog ref="erpSpuSelectDialogRef" @getSelectedRows="getSelectedRows" />
|
||||
|
||||
<!-- <link-code-dialog
|
||||
ref="linkCodeDialogRef"
|
||||
title="关联采购订单"
|
||||
:getTableData="getCgddPage"
|
||||
@getSelectedLinkCode="getSelectedLinkCode"
|
||||
/> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted } from "vue"
|
||||
import { ref, reactive, computed, onMounted, defineAsyncComponent } from "vue"
|
||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpInventoryRecords"
|
||||
import { getPlanCode, getErpSpuSimpleAll, getCgddPage } from "/@/api/supermarketerp/common"
|
||||
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
||||
import { VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
// import LinkCodeDialog from "/@/views/supermarketerp/components/link-code-dialog.vue"
|
||||
import { displayPrice, storePrice } from "/@/utils/formatMoney"
|
||||
import { tablePrint } from "../../supermarketUtils"
|
||||
import { useSmProcessFormAction } from "/@/hooks/smProcessFormAction"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
const SelectDialog = defineAsyncComponent(() => import("/@/views/supermarketerp/components/select-dialog.vue"))
|
||||
const { supermarket_nature } = useDict("supermarket_nature")
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -233,15 +238,14 @@ const emit = defineEmits(["close"])
|
||||
const loading = ref(false)
|
||||
const disabled = ref(false)
|
||||
const erpSpuSelectDialogRef = ref()
|
||||
// const linkCodeDialogRef = ref()
|
||||
const baseFormRef = ref()
|
||||
const vxeTableRef = ref<VxeTableInstance<any>>()
|
||||
const baseInfoRef = ref()
|
||||
|
||||
const baseDataForm = reactive<any>({
|
||||
id: "",
|
||||
inventoryCode: "",
|
||||
inventoryDate: formatDate(new Date(), "YYYY-mm-dd"),
|
||||
handlerUserId: "",
|
||||
supplierId: "",
|
||||
remark: "",
|
||||
inventoryType: "3",
|
||||
@@ -250,21 +254,24 @@ const baseDataForm = reactive<any>({
|
||||
const vxeTableData = ref<any>([])
|
||||
const erpSpuSimpleAll = ref<any>([])
|
||||
|
||||
// 基本信息表单校验规则
|
||||
const dataRules = ref({
|
||||
inventoryCode: [{ required: true, message: "编号不能为空", trigger: "blur" }],
|
||||
inventoryDate: [{ required: true, message: "单据日期不能为空", trigger: "blur" }],
|
||||
supplierId: [{ required: true, message: "货商不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 可编辑表格校验规则
|
||||
const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
selectedUnitObj: [{ required: true, message: "必须选择" }],
|
||||
quantity: [{ required: true, type: "number", min: 1, message: "必需大于等于0" }],
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getInitData()
|
||||
// 合计总金额
|
||||
const totalAmount = computed(() =>
|
||||
vxeTableData.value.reduce((sum: any, row: any) => sum + Number(row.selectedUnitObj?.totalAmount || 0), 0).toFixed(2),
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
await getInitData()
|
||||
})
|
||||
|
||||
// 初始化数据
|
||||
@@ -309,58 +316,33 @@ const getInitData = async () => {
|
||||
erpSpuSimpleAllData && erpSpuSimpleAllData.code === 0 && (erpSpuSimpleAll.value = erpSpuSimpleAllData.data)
|
||||
}
|
||||
|
||||
// 点击商品选择
|
||||
// 商品选择
|
||||
const handleClickSpuSelect = () => erpSpuSelectDialogRef.value.openDialog()
|
||||
|
||||
// 点击关联采购申请编号
|
||||
// const handleClickLinkCode = () => linkCodeDialogRef.value.openLinkCodeDialog(2)
|
||||
// 商品选择回调
|
||||
const getSelectedRows = (selectionRows: any[]) => {
|
||||
console.log("selectionRows", selectionRows)
|
||||
|
||||
// 获取选择的采购申请
|
||||
// const getSelectedLinkCode = (selectionRows: any) => {
|
||||
// console.log("被选择的关联数据", selectionRows)
|
||||
|
||||
// baseDataForm.linkCode = selectionRows.code
|
||||
// vxeTableData.value = selectionRows.items.map((item: any) => ({
|
||||
// ...item,
|
||||
// selectedUnitObj: {},
|
||||
// realPrice: displayPrice(item.purchasePrice, ""),
|
||||
// }))
|
||||
// }
|
||||
|
||||
// 获取被选择的商品行
|
||||
const getSelectedRows = (selectionRows: any) => {
|
||||
console.log("被选择的商品行", selectionRows)
|
||||
|
||||
// 筛选新勾选的项
|
||||
// 只添加新商品
|
||||
const addedItems = selectionRows
|
||||
.filter((item: any) => !vxeTableData.value.some((vxeTableItem: any) => vxeTableItem.erpSpuId === item.erpSpuId))
|
||||
.map((addItem: any) => {
|
||||
// const index = state.erpSpuItemsMemo.findIndex((item: any) => item.erpSpuId === addItem.erpSpuId)
|
||||
// if (index !== -1) return state.erpSpuItemsMemo[index]
|
||||
const firstUnit = addItem.erpUnitVos[0]
|
||||
return {
|
||||
...addItem,
|
||||
erpUnitVos: addItem.erpUnitVos.map((item: any) => ({ ...item, realPrice: Number(displayPrice(item.purchasePrice, "")) })),
|
||||
selectedUnitObj: {
|
||||
...addItem.erpUnitVos[0],
|
||||
realPrice: parseFloat(displayPrice(addItem.erpUnitVos[0].purchasePrice, "")),
|
||||
totalAmount: 1 * parseFloat(displayPrice(addItem.erpUnitVos[0].purchasePrice, "")),
|
||||
...firstUnit,
|
||||
realPrice: Number(displayPrice(firstUnit.purchasePrice, "")),
|
||||
totalAmount: 1 * Number(displayPrice(firstUnit.purchasePrice, "")),
|
||||
},
|
||||
unitId: addItem.erpUnitVos[0].id,
|
||||
unitId: firstUnit.id,
|
||||
quantity: 1,
|
||||
isNew: true,
|
||||
}
|
||||
})
|
||||
// 仅添加新勾选的项
|
||||
vxeTableData.value.push(...addedItems)
|
||||
|
||||
// 筛选取消勾选的项
|
||||
// const removedItems = vxeTableData.value.filter(
|
||||
// (item: any) => !selectionRows.some((selectedItem: any) => selectedItem.erpSpuId === item.erpSpuId),
|
||||
// )
|
||||
// 仅移除取消勾选的项
|
||||
// vxeTableData.value = vxeTableData.value.filter(
|
||||
// (item: any) => !removedItems.some((removeItem: any) => removeItem.erpSpuId === item.erpSpuId),
|
||||
// )
|
||||
console.log("vxeTableData.value", vxeTableData.value)
|
||||
}
|
||||
|
||||
@@ -375,9 +357,19 @@ const removeRow = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 重新计算累计总金额
|
||||
const reComputeTotalAmount = (row: any, index: number) => {
|
||||
vxeTableData.value[index].selectedUnitObj.totalAmount = Number((row.quantity * parseFloat(row.selectedUnitObj.realPrice || 0)).toFixed(2))
|
||||
// 包装单位选择联动
|
||||
const onUnitChange = (row: any) => {
|
||||
// 更新 unitId
|
||||
row.unitId = row.selectedUnitObj.id
|
||||
// 更新 realPrice
|
||||
row.selectedUnitObj.realPrice = Number(displayPrice(row.realPrice ?? row.selectedUnitObj.purchasePrice, ""))
|
||||
// 重新计算行内累计总金额
|
||||
row.selectedUnitObj.totalAmount = Number((row.quantity * Number(row.selectedUnitObj.realPrice || 0)).toFixed(2))
|
||||
}
|
||||
|
||||
// 数量、进价变动联动
|
||||
const onRowValueChange = (row: any, $rowIndex: number) => {
|
||||
row.selectedUnitObj.totalAmount = Number((row.quantity * Number(row.selectedUnitObj.realPrice || 0)).toFixed(2))
|
||||
}
|
||||
|
||||
// 整理table数据
|
||||
@@ -388,6 +380,7 @@ const settledTableItems = computed(() => {
|
||||
id: item.isNew ? "" : item.id,
|
||||
erpSpuId: item.erpSpuId,
|
||||
quantity: item.quantity,
|
||||
productNature: item.productNature,
|
||||
unitPrice: selectedUnitObj.purchasePrice ? Number(selectedUnitObj?.purchasePrice) : 0,
|
||||
realPrice: selectedUnitObj.realPrice ? storePrice(selectedUnitObj?.realPrice) : 0,
|
||||
totalAmount: storePrice(Number(selectedUnitObj?.totalAmount || 0)),
|
||||
@@ -419,10 +412,10 @@ const onSave = async () => {
|
||||
emit("close")
|
||||
}
|
||||
|
||||
// 清空填写的数据
|
||||
// 清空数据
|
||||
const clearData = () => {
|
||||
for (const key in baseDataForm) {
|
||||
if (key === "id" || key === "inventoryCode" || key === "inventoryDate" || key === "inventoryType" || key === "orderType") continue
|
||||
if (["id", "inventoryCode", "inventoryDate", "inventoryType", "orderType"].includes(key)) continue
|
||||
baseDataForm[key] = ""
|
||||
}
|
||||
vxeTableData.value = []
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="经办人" prop="handlerUserId">
|
||||
<!-- <el-form-item label="经办人" prop="handlerUserId">
|
||||
<SelectHandlerUser v-model.trim="state.queryForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
@@ -40,14 +40,16 @@
|
||||
>
|
||||
删 除
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'supermarket_smErpInventoryRecords_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
/>
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10 mr20" style="float: right" @queryTable="getDataList">
|
||||
<div class="mx-3" v-auth="'supermarket_smErpInventoryRecords_export'">
|
||||
<el-tooltip effect="dark" content="导出明细" placement="top">
|
||||
<el-button circle icon="Download" @click="exportExcel" />
|
||||
</el-tooltip>
|
||||
<el-tooltip effect="dark" content="导出汇总" placement="top">
|
||||
<el-button circle icon="Download" @click="handleExportSummary" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
@@ -65,7 +67,7 @@
|
||||
<el-table-column prop="inventoryCode" label="单据编号" show-overflow-tooltip />
|
||||
<el-table-column prop="inventoryDate" label="单据日期" show-overflow-tooltip />
|
||||
<el-table-column prop="productName" label="入库商品" show-overflow-tooltip />
|
||||
<el-table-column prop="handlerUserName" label="经办人" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="handlerUserName" label="经办人" show-overflow-tooltip /> -->
|
||||
<el-table-column prop="supplierName" label="货商" show-overflow-tooltip />
|
||||
<el-table-column prop="remark" label="备注" show-overflow-tooltip />
|
||||
<el-table-column prop="totalAmount" label="入库总金额" show-overflow-tooltip>
|
||||
@@ -171,7 +173,16 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarket/smErpInventoryRecords/export", Object.assign(state.queryForm, { ids: selectObjs }), "采购入库.xlsx")
|
||||
downBlobFile("/supermarket/smErpInventoryRecords/export", Object.assign(state.queryForm, { ids: selectObjs }), "采购入库-导出明细.xlsx")
|
||||
}
|
||||
|
||||
// 全部数据导出excel
|
||||
const handleExportSummary = () => {
|
||||
downBlobFile(
|
||||
"/supermarket/smErpInventoryRecords/exportSummary",
|
||||
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||
"采购入库-导出汇总.xlsx",
|
||||
)
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
<span class="font-bold">单据日期:</span>
|
||||
<span>{{ baseDataForm.inventoryDate }}</span>
|
||||
</div>
|
||||
<div style="width: 33.33%; height: 28px; line-height: 28px">
|
||||
<!-- <div style="width: 33.33%; height: 28px; line-height: 28px">
|
||||
<span class="font-bold">经办人:</span>
|
||||
<span>{{ baseDataForm.handlerUserId }}</span>
|
||||
</div>
|
||||
</div> -->
|
||||
<div style="width: 33.33%; height: 28px; line-height: 28px">
|
||||
<span class="font-bold">货商:</span>
|
||||
<span>{{ baseDataForm.supplierId }}</span>
|
||||
@@ -33,14 +33,14 @@
|
||||
<el-form-item label="单据日期" prop="inventoryDate">
|
||||
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" :disabled="disabled" />
|
||||
</el-form-item>
|
||||
<el-form-item label="经办人" prop="handlerUserId">
|
||||
<!-- <el-form-item label="经办人" prop="handlerUserId">
|
||||
<SelectHandlerUser
|
||||
v-model.trim="baseDataForm.handlerUserId"
|
||||
placeholder="请选择经办人"
|
||||
style="width: 200px"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<SelectSupermarketSupplier v-model="baseDataForm.supplierId" style="width: 200px" :disabled="disabled" />
|
||||
</el-form-item>
|
||||
@@ -79,6 +79,7 @@
|
||||
:column-config="{ resizable: true }"
|
||||
:row-config="{ isHover: true }"
|
||||
:resizable-config="{ dragMode: 'fixed' }"
|
||||
:checkbox-config="{ highlight: true, range: true }"
|
||||
:data="vxeTableData"
|
||||
:edit-rules="validRules"
|
||||
@checkbox-all=""
|
||||
@@ -212,7 +213,6 @@ const baseDataForm = reactive<any>({
|
||||
id: "",
|
||||
inventoryCode: "",
|
||||
inventoryDate: formatDate(new Date(), "YYYY-mm-dd"),
|
||||
handlerUserId: "",
|
||||
supplierId: "",
|
||||
remark: "",
|
||||
orderType: "2",
|
||||
@@ -283,17 +283,8 @@ const getSelectedRows = (selectionRows: any) => {
|
||||
// if (index !== -1) return vxeTableDataMemo.value[index]
|
||||
return { ...addItem, unitId: addItem.erpUnitVos[0].id, quantity: 1, isNew: true }
|
||||
})
|
||||
// 仅添加新勾选的项
|
||||
vxeTableData.value.push(...addedItems)
|
||||
|
||||
// 筛选取消勾选的项
|
||||
// const removedItems = vxeTableData.value.filter(
|
||||
// (item: any) => !selectionRows.some((selectedItem: any) => selectedItem.erpSpuId === item.erpSpuId),
|
||||
// )
|
||||
// 仅移除取消勾选的项
|
||||
// vxeTableData.value = vxeTableData.value.filter(
|
||||
// (item: any) => !removedItems.some((removeItem: any) => removeItem.erpSpuId === item.erpSpuId),
|
||||
// )
|
||||
console.log("vxeTableData.value", vxeTableData.value)
|
||||
}
|
||||
|
||||
@@ -352,7 +343,7 @@ const onSave = async () => {
|
||||
// 清空填写的数据
|
||||
const clearData = () => {
|
||||
for (const key in baseDataForm) {
|
||||
if (key === "id" || key === "inventoryCode" || key === "inventoryDate" || key === "inventoryType" || key === "orderType") continue
|
||||
if (["id", "inventoryCode", "inventoryDate", "inventoryType", "orderType"].includes(key)) continue
|
||||
baseDataForm[key] = ""
|
||||
}
|
||||
vxeTableData.value = []
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="经办人" prop="handlerUserId">
|
||||
<!-- <el-form-item label="经办人" prop="handlerUserId">
|
||||
<SelectHandlerUser v-model.trim="state.queryForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
@@ -65,7 +65,7 @@
|
||||
<el-table-column prop="inventoryCode" label="单据编号" show-overflow-tooltip />
|
||||
<el-table-column prop="inventoryDate" label="单据日期" show-overflow-tooltip />
|
||||
<el-table-column prop="productName" label="商品名称" show-overflow-tooltip />
|
||||
<el-table-column prop="handlerUserName" label="经办人" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="handlerUserName" label="经办人" show-overflow-tooltip /> -->
|
||||
<el-table-column prop="supplierName" label="货商" show-overflow-tooltip />
|
||||
<el-table-column prop="remark" label="备注" show-overflow-tooltip />
|
||||
<el-table-column prop="totalAmount" label="总金额" show-overflow-tooltip>
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
ref="excelUploadRef"
|
||||
:title="$t('supermarket.importSupplierTip')"
|
||||
url="/supermarket/smErpSupplier/import"
|
||||
@refreshDataList="getDataList"
|
||||
@refreshDataList="refreshDataList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -158,14 +158,19 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 获取货商类别
|
||||
onMounted(async () => {
|
||||
onMounted(() => {
|
||||
getSupplierType()
|
||||
})
|
||||
|
||||
// 获取货商类别
|
||||
const getSupplierType = async () => {
|
||||
try {
|
||||
const res = await getSupplierTypeSimpleAll()
|
||||
supplierType.value = res.data.filter((item: any) => item.id)
|
||||
} catch (error) {
|
||||
supplierType.value = []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
@@ -181,6 +186,12 @@ const exportExcel = () => {
|
||||
downBlobFile("/supermarketerp/smErpSupplier/export", Object.assign(state.queryForm, { ids: selectObjs }), "货商管理.xlsx")
|
||||
}
|
||||
|
||||
// 导入成功刷新数据
|
||||
const refreshDataList = () => {
|
||||
getDataList()
|
||||
getSupplierType()
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { supplierId: string }[]) => {
|
||||
selectObjs.value = objs.map(({ supplierId }) => supplierId)
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-model="visible" title="条码录入" width="60%" :close-on-click-modal="false" draggable @close="">
|
||||
<!-- <el-row>
|
||||
<el-form :inline="true" @keyup.enter="getDataList">
|
||||
<el-form-item label="商品名称" prop="name">
|
||||
<el-input placeholder="请输入商品名称" v-model="state.queryForm.productName" />
|
||||
</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-table v-loading="state.loading" :data="state.dataList" @row-click="handleRowClick" :row-style="{ cursor: 'pointer' }">
|
||||
<el-table-column type="index" label="#" width="50" align="center" />
|
||||
<el-table-column prop="productName" label="商品名称" width="100px" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="brandId" label="商品品牌" width="100px" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="categoryId" label="商品分类" width="100px" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="merchantId" label="商户" width="100px" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="sliderPicUrls" label="商品轮播图" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<preview-image @click.stop :src="scope.row.sliderPicUrls" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="上架状态" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="spu_status" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="barcode" label="商品条码" width="100px" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="supplierId" label="供货商" width="100px" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="sort" label="排序字段" align="center" show-overflow-tooltip /> -->
|
||||
|
||||
<!-- <el-table-column prop="price" label="商品价格" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ displayPrice(scope.row.price) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="marketPrice" label="市场价" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ displayPrice(scope.row.marketPrice) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="costPrice" label="成本价" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="stock" label="库存" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="salesCount" label="商品销量" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="创建时间" align="center" show-overflow-tooltip /> -->
|
||||
<!-- </el-table> -->
|
||||
|
||||
<!-- <pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" /> -->
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="SmSpuDialog">
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { getObj } from "/@/api/supermarket/smSpu"
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
const { spu_status } = useDict("spu_status")
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: "",
|
||||
erpSpuId: "",
|
||||
description: "<p></p>",
|
||||
sliderPicUrls: "",
|
||||
sort: "",
|
||||
status: "0",
|
||||
giveIntegral: 0,
|
||||
deptId: "",
|
||||
salesCount: "",
|
||||
erpSpuName: "",
|
||||
})
|
||||
const dialogVisible = ref(false)
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
sliderPicUrls: [{ required: true, message: "请上传轮播图", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
|
||||
dataFormRef.value?.resetFields()
|
||||
|
||||
// 获取smSpu信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
// getsmSpuData(id)
|
||||
}
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
// console.log(form)
|
||||
// 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 getsmSpuData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
// pageList: getOnlineSpuPage,
|
||||
})
|
||||
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
const resetQuery = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 点击选择库存商品
|
||||
const handleClickSelectSpu = () => {
|
||||
loading.value = true
|
||||
resetQuery()
|
||||
dialogVisible.value = true
|
||||
try {
|
||||
getDataList()
|
||||
} catch (error) {
|
||||
state.dataList = []
|
||||
loading.value = false
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
// 线上商品列表表格行点击
|
||||
const handleRowClick = (row: any) => {
|
||||
dialogVisible.value = false
|
||||
form.erpSpuId = row.id
|
||||
form.erpSpuName = row.productName
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-loading="loading" class="w-full h-full">
|
||||
<div v-if="baseDataForm.inventoryCode" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
|
||||
<div v-if="disabled" ref="baseDataInfoRef">
|
||||
<div v-if="disabled" ref="baseInfoRef">
|
||||
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279; display: flex; flex-wrap: wrap">
|
||||
<div style="width: 33.33%; height: 28px; line-height: 28px">
|
||||
<span class="font-bold">单据编号:</span>
|
||||
@@ -11,17 +11,13 @@
|
||||
<span class="font-bold">单据日期:</span>
|
||||
<span>{{ baseDataForm.inventoryDate }}</span>
|
||||
</div>
|
||||
<div style="width: 33.33%; height: 28px; line-height: 28px">
|
||||
<span class="font-bold">经办人:</span>
|
||||
<span>{{ baseDataForm.handlerUserId }}</span>
|
||||
</div>
|
||||
<div style="width: 33.33%; height: 28px; line-height: 28px">
|
||||
<span class="font-bold">备注:</span>
|
||||
<span>{{ baseDataForm.remark }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-form v-else ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
|
||||
<el-form v-else ref="baseFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
|
||||
<div class="flex flex-wrap">
|
||||
<el-form-item label="单据编号" prop="inventoryCode">
|
||||
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" :disabled="disabled" />
|
||||
@@ -29,14 +25,14 @@
|
||||
<el-form-item label="单据日期" prop="inventoryDate">
|
||||
<el-input v-model="baseDataForm.inventoryDate" readonly style="width: 200px" :disabled="disabled" />
|
||||
</el-form-item>
|
||||
<el-form-item label="经办人" prop="handlerUserId">
|
||||
<!-- <el-form-item label="经办人" prop="handlerUserId">
|
||||
<SelectHandlerUser
|
||||
v-model.trim="baseDataForm.handlerUserId"
|
||||
placeholder="请选择经办人"
|
||||
style="width: 200px"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" :disabled="disabled" />
|
||||
</el-form-item>
|
||||
@@ -45,13 +41,12 @@
|
||||
|
||||
<el-row v-if="!disabled" class="my-3">
|
||||
<el-button type="primary" plain @click="handleClickSpuSelect">商品选择</el-button>
|
||||
<el-button @click="removeSelectRowEvent" :disabled="state.selectedRowsErpSpuIds.length <= 0">删除选中</el-button>
|
||||
<el-button @click="removeRow">删除选中</el-button>
|
||||
<el-button type="danger" plain @click="clearData">清空数据</el-button>
|
||||
<!-- <el-button @click="handleClickBarCodeEnter">条码录入</el-button> -->
|
||||
</el-row>
|
||||
|
||||
<vxe-table
|
||||
ref="editableTableRef"
|
||||
ref="vxeTableRef"
|
||||
border
|
||||
:loading="loading"
|
||||
max-height="410"
|
||||
@@ -70,7 +65,8 @@
|
||||
:column-config="{ resizable: true }"
|
||||
:row-config="{ isHover: true }"
|
||||
:resizable-config="{ dragMode: 'fixed' }"
|
||||
:data="state.editableTableData"
|
||||
:checkbox-config="{ highlight: true, range: true }"
|
||||
:data="vxeTableData"
|
||||
:edit-rules="validRules"
|
||||
class="editableTable-style"
|
||||
:cell-class-name="
|
||||
@@ -81,24 +77,28 @@
|
||||
return null
|
||||
}
|
||||
"
|
||||
@checkbox-all="selectChangeEvent"
|
||||
@checkbox-change="selectChangeEvent"
|
||||
@checkbox-all=""
|
||||
@checkbox-change=""
|
||||
@edit-change="handleEditChange"
|
||||
size="mini"
|
||||
align="center"
|
||||
>
|
||||
<vxe-column type="checkbox" width="40" fixed="left" />
|
||||
<vxe-column type="seq" width="50" fixed="left" />
|
||||
<vxe-column field="productCode" title="货号编码" />
|
||||
<vxe-column field="productCode" title="货号" />
|
||||
<vxe-column field="productName" title="商品名称">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.productName">{{ row.productName }}</span>
|
||||
<span v-else>{{ row.erpSpuId && state.erpSpuSimpleAll.find((item: any) => item.id === row.erpSpuId)?.productName }}</span>
|
||||
<span v-else>{{ row.erpSpuId && erpSpuSimpleAll.find((item: any) => item.id === row.erpSpuId)?.productName }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="unitId" title="包装单位" min-width="60">
|
||||
<vxe-column field="unitId" title="包装单位" min-width="60" width="auto">
|
||||
<template #default="{ row }">
|
||||
<div v-for="(item, index) in row.erpUnitVos" :key="index">单位:{{ item.unit }} 装数:{{ item.packageNum }}</div>
|
||||
<div v-for="(item, index) in row.erpUnitVos" :key="index">
|
||||
单位:{{ item.unit }} 装数:{{ item.packageNum }} 进价:{{ displayPrice(item.purchasePrice, "元") }}
|
||||
规格:{{ item.spec }}
|
||||
<hr />
|
||||
</div>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="accountNumber" title="账面数量">
|
||||
@@ -108,6 +108,16 @@
|
||||
</div>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="unitPrice" title="账面总进价">
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
displayPrice(
|
||||
row.erpUnitVos.reduce((pre: any, cur: any) => pre + cur.purchasePrice * Number(cur.accountNumber), 0),
|
||||
"",
|
||||
)
|
||||
}}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="realNumber" title="实际数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }" min-width="30">
|
||||
<template #edit="{ row }">
|
||||
<el-input
|
||||
@@ -136,31 +146,21 @@
|
||||
{{ computeLoss(row) }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="unitPrice" title="账面进价">
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
displayPrice(
|
||||
row.erpUnitVos.reduce((pre: any, cur: any) => pre + cur.purchasePrice * Number(cur.accountNumber), 0),
|
||||
"",
|
||||
)
|
||||
}}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="pdPrice" title="盘点单价" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #edit="{ row }">
|
||||
<el-input v-model="row.pdPrice" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="pdTotalNum" title="盘后总数">
|
||||
<vxe-column field="totalNumber" title="盘后总数">
|
||||
<template #default="{ row }">
|
||||
{{ row.erpUnitVos.reduce((pre: any, cur: any) => pre + Number(cur.realNumber) * cur.packageNum, 0) || 0 }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="pdTotalAmount" title="盘后总金额">
|
||||
<vxe-column field="pdPrice" title="盘点单价" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #edit="{ row }">
|
||||
<el-input-number v-model="row.pdPrice" :min="0" :precision="2" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="totalAmount" title="盘后总金额">
|
||||
<template #default="{ row }">
|
||||
{{
|
||||
(
|
||||
parseFloat(row.pdPrice || 0) *
|
||||
Number(row.pdPrice || 0) *
|
||||
(row.erpUnitVos.reduce((pre: any, cur: any) => pre + Number(cur.realNumber) * cur.packageNum, 0) || 0)
|
||||
).toFixed(2) || 0
|
||||
}}
|
||||
@@ -183,15 +183,10 @@
|
||||
<el-tooltip v-if="!disabled" effect="dark" content="保存并返回列表页面" placement="top">
|
||||
<el-button type="primary" plain @click="onSave">保存</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip v-if="disabled" effect="dark" content="打印清单" placement="top">
|
||||
<el-button type="success" plain @click="printEvent">打印</el-button>
|
||||
</el-tooltip>
|
||||
</el-row>
|
||||
|
||||
<!-- 商品选择对话框 -->
|
||||
<select-dialog ref="erpSpuSelectDialogRef" @getSelectedRows="getSelectedRows" />
|
||||
|
||||
<barCodeEnter ref="barCodeEnterRef" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -200,9 +195,8 @@
|
||||
import { ref, reactive, computed, onMounted } from "vue"
|
||||
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
||||
import { getStockTakingDeatil, addObj, putObj } from "/@/api/supermarketerp/stockTaking"
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import barCodeEnter from "./barCodeEnter.vue"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { tablePrint } from "../supermarketUtils"
|
||||
import { useSmProcessFormAction } from "/@/hooks/smProcessFormAction"
|
||||
@@ -211,89 +205,105 @@ const SelectDialog = defineAsyncComponent(() => import("/@/views/supermarketerp/
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
formId: string | undefined
|
||||
formId: string
|
||||
disabled: boolean
|
||||
}>(),
|
||||
{
|
||||
formId: undefined,
|
||||
disabled: true,
|
||||
formId: "",
|
||||
disabled: false,
|
||||
},
|
||||
)
|
||||
const emit = defineEmits(["close"])
|
||||
|
||||
const loading = ref(false) // 采购计划加载
|
||||
const loading = ref(false)
|
||||
const disabled = ref(false)
|
||||
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const barCodeEnterRef = ref() // 条码录入对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const baseDataInfoRef = ref() // 基本信息ref
|
||||
// 基本信息表单数据
|
||||
const baseFormRef = ref() // 基本表单ref
|
||||
const vxeTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const baseInfoRef = ref() // 基本信息ref
|
||||
const baseDataForm = reactive<any>({
|
||||
id: "",
|
||||
inventoryCode: "",
|
||||
inventoryDate: formatDate(new Date(), "YYYY-mm-dd"),
|
||||
handlerUserId: "",
|
||||
remark: "",
|
||||
inventoryType: "7",
|
||||
orderType: "",
|
||||
})
|
||||
const state = reactive<{
|
||||
editableTableData: any[]
|
||||
erpSpuItemsMemo: any[]
|
||||
selectedRowsErpSpuIds: string[]
|
||||
erpSpuSimpleAll: any
|
||||
}>({
|
||||
editableTableData: [], // 可编辑表格数据
|
||||
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
|
||||
selectedRowsErpSpuIds: [], // 可编辑表格已选行的ErpSpuId
|
||||
erpSpuSimpleAll: [], // 简要商品列表
|
||||
})
|
||||
const vxeTableData = ref<any>([])
|
||||
const erpSpuSimpleAll = ref<any>([])
|
||||
|
||||
// 基本信息表单校验规则
|
||||
const dataRules = ref({
|
||||
inventoryCode: [{ required: true, message: "单据编号不能为空", trigger: "blur" }],
|
||||
inventoryDate: [{ required: true, message: "单据日期不能为空", trigger: "blur" }],
|
||||
handlerUserId: [{ required: true, message: "经办人不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 可编辑表格校验规则
|
||||
const validRules = ref<VxeTablePropTypes.EditRules<any>>({
|
||||
pdPrice: [{ required: true, message: "请输入" }],
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getInitData()
|
||||
})
|
||||
|
||||
// 初始化数据
|
||||
const getInitData = async () => {
|
||||
baseDataForm.id = undefined
|
||||
baseDataForm.id = ""
|
||||
const id = props.formId
|
||||
disabled.value = props.disabled
|
||||
if (id) {
|
||||
loading.value = true
|
||||
// 获取清单数据
|
||||
const [cgPlanData] = await Promise.allSettled([getStockTakingDeatil({ id })])
|
||||
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
.finally(() => (loading.value = false))
|
||||
const [cgPlanData] = await Promise.allSettled([getStockTakingDeatil({ id })]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
|
||||
if (cgPlanData && cgPlanData.code === 0) {
|
||||
Object.assign(baseDataForm, cgPlanData.data)
|
||||
state.editableTableData = cgPlanData.data.items
|
||||
state.erpSpuItemsMemo = cgPlanData.data.items
|
||||
vxeTableData.value = cgPlanData.data.items
|
||||
}
|
||||
} else {
|
||||
// 获取采购入库编号
|
||||
const [planCode] = await Promise.allSettled([getPlanCode({ type: 7 })])
|
||||
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
.finally(() => (loading.value = false))
|
||||
|
||||
const [planCode] = await Promise.allSettled([getPlanCode({ type: 7 })]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
|
||||
}
|
||||
|
||||
// 获取简要商品列表
|
||||
loading.value = true
|
||||
const [erpSpuSimpleAll] = await Promise.allSettled([getErpSpuSimpleAll()])
|
||||
const [erpSpuSimpleAllData] = await Promise.allSettled([getErpSpuSimpleAll()])
|
||||
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
.finally(() => (loading.value = false))
|
||||
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
|
||||
erpSpuSimpleAllData && erpSpuSimpleAllData.code === 0 && (erpSpuSimpleAll.value = erpSpuSimpleAllData.data)
|
||||
}
|
||||
|
||||
// 点击商品选择
|
||||
const handleClickSpuSelect = () => erpSpuSelectDialogRef.value.openDialog()
|
||||
|
||||
// 获取被选择的商品行
|
||||
const getSelectedRows = (selectionRows: any) => {
|
||||
console.log("被选择的商品行", selectionRows)
|
||||
|
||||
// 筛选新勾选的项
|
||||
const addedItems = selectionRows
|
||||
.filter((item: any) => !vxeTableData.value.some((vxeTableItem: any) => vxeTableItem.erpSpuId === item.erpSpuId))
|
||||
.map((addItem: any) => {
|
||||
// const index = vxeTableDataMemo.value.findIndex((item: any) => item.erpSpuId === addItem.erpSpuId)
|
||||
// if (index !== -1) return vxeTableDataMemo.value[index]
|
||||
return { ...addItem, isNew: true }
|
||||
})
|
||||
vxeTableData.value.push(...addedItems)
|
||||
|
||||
console.log("vxeTableData.value", vxeTableData.value)
|
||||
}
|
||||
|
||||
// 删除选中的行
|
||||
const removeRow = () => {
|
||||
const $table = vxeTableRef.value
|
||||
if ($table) {
|
||||
const selectRecords = $table.getCheckboxRecords()
|
||||
if (selectRecords.length > 0) {
|
||||
vxeTableData.value = vxeTableData.value.filter((item: any) => !selectRecords.some((row) => row.erpSpuId === item.erpSpuId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 计算账面数量
|
||||
@@ -333,7 +343,7 @@ const computeProfit = (row: any) => {
|
||||
|
||||
row._cachedProfit = diff > 0 ? diff : 0
|
||||
}
|
||||
return row._cachedProfit
|
||||
return row._cachedProfit.toFixed(2)
|
||||
}
|
||||
// 计算亏
|
||||
const computeLoss = (row: any) => {
|
||||
@@ -348,7 +358,7 @@ const computeLoss = (row: any) => {
|
||||
|
||||
row._cachedLoss = diff > 0 ? diff : 0
|
||||
}
|
||||
return row._cachedLoss
|
||||
return row._cachedLoss.toFixed(2)
|
||||
}
|
||||
|
||||
// 当编辑实际数量时清除缓存使其重新计算
|
||||
@@ -357,131 +367,6 @@ const handleRealNumberChange = (row: any) => {
|
||||
row._cachedLoss = null
|
||||
}
|
||||
|
||||
// 删除选中的行
|
||||
const removeSelectRowEvent = () => {
|
||||
const $table = editableTableRef.value
|
||||
if ($table) {
|
||||
const selectRecords = $table.getCheckboxRecords()
|
||||
if (selectRecords.length > 0) {
|
||||
state.editableTableData = state.editableTableData.filter((item) => !selectRecords.some((row) => row.erpSpuId === item.erpSpuId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 可编辑表格行勾选
|
||||
const selectChangeEvent: VxeTableEvents.CheckboxChange<any> = ({ checked }) => {
|
||||
const $table = editableTableRef.value
|
||||
if ($table) {
|
||||
const records = $table.getCheckboxRecords()
|
||||
console.log(checked ? "勾选事件" : "取消事件", records)
|
||||
state.selectedRowsErpSpuIds = records.map((item) => item.erpSpuId)
|
||||
}
|
||||
}
|
||||
|
||||
// 点击商品选择
|
||||
const handleClickSpuSelect = () => erpSpuSelectDialogRef.value.openDialog()
|
||||
|
||||
// 点击条码录入
|
||||
const handleClickBarCodeEnter = () => barCodeEnterRef.value.openDialog()
|
||||
|
||||
// 获取被选择的商品行
|
||||
const getSelectedRows = (selectionRows: any) => {
|
||||
console.log("被选择的商品行", selectionRows)
|
||||
|
||||
// 筛选新勾选的项
|
||||
const addedItems = selectionRows
|
||||
.filter((item: any) => !state.editableTableData.some((editableTableItem: any) => editableTableItem.erpSpuId === item.erpSpuId))
|
||||
.map((addItem: any) => {
|
||||
const index = state.erpSpuItemsMemo.findIndex((item: any) => item.erpSpuId === addItem.erpSpuId)
|
||||
if (index !== -1) return state.erpSpuItemsMemo[index]
|
||||
return { ...addItem, isNew: true }
|
||||
})
|
||||
// 仅添加新勾选的项
|
||||
state.editableTableData = [...state.editableTableData, ...addedItems]
|
||||
|
||||
// 筛选取消勾选的项
|
||||
const removedItems = state.editableTableData.filter(
|
||||
(item: any) => !selectionRows.some((selectedItem: any) => selectedItem.erpSpuId === item.erpSpuId),
|
||||
)
|
||||
// 仅移除取消勾选的项
|
||||
state.editableTableData = state.editableTableData.filter(
|
||||
(item: any) => !removedItems.some((removeItem: any) => removeItem.erpSpuId === item.erpSpuId),
|
||||
)
|
||||
// state.editableTableData.push(item)
|
||||
// nextTick(() => {
|
||||
// const $table = editableTableRef.value
|
||||
// if ($table) {
|
||||
// $table.setRow(item)
|
||||
// }
|
||||
// })
|
||||
console.log("state.editableTableData", state.editableTableData)
|
||||
}
|
||||
|
||||
// 整理数据
|
||||
const pdPlanItems = computed(() => {
|
||||
return state.editableTableData.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
unitPrice: Number(
|
||||
displayPrice(
|
||||
item.erpUnitVos.reduce((pre: any, cur: any) => pre + cur.purchasePrice * Number(cur.accountNumber), 0),
|
||||
"",
|
||||
),
|
||||
),
|
||||
realPrice: Number(
|
||||
displayPrice(
|
||||
item.erpUnitVos.reduce((pre: any, cur: any) => pre + cur.purchasePrice * Number(cur.realNumber), 0),
|
||||
"",
|
||||
),
|
||||
),
|
||||
profit: item._cachedProfit,
|
||||
loss: item._cachedLoss,
|
||||
totalNumber: item.erpUnitVos.reduce((pre: any, cur: any) => pre + Number(cur.realNumber) * cur.packageNum, 0) || 0,
|
||||
totalAmount: Number(
|
||||
(
|
||||
parseFloat(item.pdPrice || 0) *
|
||||
(item.erpUnitVos.reduce((pre: any, cur: any) => pre + Number(cur.realNumber) * cur.packageNum, 0) || 0)
|
||||
).toFixed(2) || 0,
|
||||
),
|
||||
// 盘盈就是1,盘亏就是2
|
||||
orderType: item._cachedProfit === item._cachedLoss ? "0" : item._cachedProfit > item._cachedLoss ? "1" : "2",
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const { formValidate, submitData } = useSmProcessFormAction()
|
||||
|
||||
// 点击继续添加
|
||||
const onContinueAdd = async () => {
|
||||
console.log("baseDataForm", baseDataForm)
|
||||
console.log("state.editableTableData", state.editableTableData)
|
||||
;(await formValidate(baseDataFormRef, editableTableRef, state.editableTableData.length)) &&
|
||||
(await submitData(baseDataForm, pdPlanItems, loading, putObj, addObj)) &&
|
||||
clearData()
|
||||
}
|
||||
|
||||
// 点击保存
|
||||
const onSave = async () => {
|
||||
console.log("baseDataForm", baseDataForm)
|
||||
console.log("state.editableTableData", state.editableTableData)
|
||||
;(await formValidate(baseDataFormRef, editableTableRef, state.editableTableData.length)) &&
|
||||
(await submitData(baseDataForm, pdPlanItems, loading, putObj, addObj)) &&
|
||||
clearData() &&
|
||||
emit("close")
|
||||
}
|
||||
|
||||
// 清空填写的数据 返回 true
|
||||
const clearData = () => {
|
||||
for (const key in baseDataForm) {
|
||||
if (key === "id" || key === "inventoryCode" || key === "inventoryDate" || key === "inventoryType" || key === "orderType") continue
|
||||
baseDataForm[key] = ""
|
||||
}
|
||||
state.editableTableData = []
|
||||
state.erpSpuItemsMemo = []
|
||||
state.selectedRowsErpSpuIds = []
|
||||
return true
|
||||
}
|
||||
|
||||
// 计算行数据
|
||||
// const computeRowData = (row: any) => {
|
||||
// // 计算盘点总数
|
||||
@@ -493,7 +378,7 @@ const clearData = () => {
|
||||
// const loss = diff < 0 ? Math.abs(diff) : 0
|
||||
|
||||
// // 计算总金额
|
||||
// const pdTotalAmount = parseFloat(row.pdPrice) * pdTotalNum
|
||||
// const pdTotalAmount = Number(row.pdPrice) * pdTotalNum
|
||||
|
||||
// return {
|
||||
// pdTotalNum,
|
||||
@@ -511,22 +396,86 @@ const handleEditChange = ({ row, column }: any) => {
|
||||
// row._cachedLoss = null
|
||||
// // 更新盘点总数和总金额
|
||||
// row.pdTotalNum = row.erpUnitVos.reduce((pre: any, cur: any) => pre + Number(cur.realNumber) * cur.packageNum, 0)
|
||||
// row.pdTotalAmount = parseFloat(row.pdPrice) * row.pdTotalNum
|
||||
// row.pdTotalAmount = Number(row.pdPrice) * row.pdTotalNum
|
||||
// }
|
||||
// if (column.field === "pdPrice") {
|
||||
// // 更新盘点总金额
|
||||
// row.pdTotalAmount = parseFloat(row.pdPrice) * row.pdTotalNum
|
||||
// row.pdTotalAmount = Number(row.pdPrice) * row.pdTotalNum
|
||||
// }
|
||||
}
|
||||
|
||||
// 点击打印
|
||||
const printEvent = () => {
|
||||
tablePrint(editableTableRef.value, baseDataInfoRef.value, state.editableTableData, 23, "库存盘点")
|
||||
// 整理数据
|
||||
const settledTableItems = computed(() => {
|
||||
return vxeTableData.value.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
erpSpuId: item.erpSpuId,
|
||||
profit: item._cachedProfit,
|
||||
loss: item._cachedLoss,
|
||||
// 盘盈就是1,盘亏就是2
|
||||
orderType: item._cachedProfit === item._cachedLoss ? "0" : item._cachedProfit > item._cachedLoss ? "1" : "2",
|
||||
accountNumber: item.stock,
|
||||
realNumber: item.erpUnitVos.reduce((prev: number, curr: any) => prev + Number(curr.realNumber), 0),
|
||||
unitPrice: Number(
|
||||
displayPrice(
|
||||
item.erpUnitVos.reduce((pre: any, cur: any) => pre + cur.purchasePrice * Number(cur.accountNumber), 0),
|
||||
"",
|
||||
),
|
||||
),
|
||||
realPrice: item.pdPrice,
|
||||
// realPrice: Number(
|
||||
// displayPrice(
|
||||
// item.erpUnitVos.reduce((pre: any, cur: any) => pre + cur.purchasePrice * Number(cur.realNumber), 0),
|
||||
// "",
|
||||
// ),
|
||||
// ),
|
||||
totalNumber: item.erpUnitVos.reduce((pre: any, cur: any) => pre + Number(cur.realNumber) * cur.packageNum, 0) || 0,
|
||||
totalAmount: Number(
|
||||
(
|
||||
Number(item.pdPrice || 0) *
|
||||
(item.erpUnitVos.reduce((pre: any, cur: any) => pre + Number(cur.realNumber) * cur.packageNum, 0) || 0)
|
||||
).toFixed(2) || 0,
|
||||
),
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const { formValidate, submitData } = useSmProcessFormAction()
|
||||
|
||||
// 点击继续添加
|
||||
const onContinueAdd = async () => {
|
||||
console.log("baseDataForm", baseDataForm)
|
||||
console.log("vxeTableData", vxeTableData.value)
|
||||
;(await formValidate(baseFormRef, vxeTableRef, vxeTableData.value.length)) &&
|
||||
(await submitData(baseDataForm, settledTableItems.value, loading, putObj, addObj)) &&
|
||||
clearData()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getInitData()
|
||||
})
|
||||
// 点击保存
|
||||
const onSave = async () => {
|
||||
console.log("baseDataForm", baseDataForm)
|
||||
console.log("vxeTableData", vxeTableData.value)
|
||||
console.log("settledTableItems", settledTableItems.value)
|
||||
;(await formValidate(baseFormRef, vxeTableRef, vxeTableData.value.length)) &&
|
||||
(await submitData(baseDataForm, settledTableItems.value, loading, putObj, addObj)) &&
|
||||
clearData() &&
|
||||
emit("close")
|
||||
}
|
||||
|
||||
// 清空填写的数据
|
||||
const clearData = () => {
|
||||
for (const key in baseDataForm) {
|
||||
if (["id", "inventoryCode", "inventoryDate", "inventoryType", "orderType"].includes(key)) continue
|
||||
baseDataForm[key] = ""
|
||||
}
|
||||
vxeTableData.value = []
|
||||
return true
|
||||
}
|
||||
|
||||
// 点击打印
|
||||
// const printEvent = () => {
|
||||
// tablePrint(vxeTableRef.value, baseInfoRef.value, vxeTableData.value, 23, "库存盘点")
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div v-if="!processFormState.showForm" class="layout-padding-auto layout-padding-view">
|
||||
<div v-if="!showForm" 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="inventoryCode">
|
||||
@@ -15,14 +15,9 @@
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="经办人" prop="handlerUserId">
|
||||
<!-- <el-form-item label="经办人" prop="handlerUserId">
|
||||
<SelectHandlerUser v-model.trim="state.queryForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审批状态" prop="checkStatus">
|
||||
<el-select v-model="state.queryForm.checkStatus" placeholder="请选择审批状态">
|
||||
<el-option :label="item.label" :value="item.value" v-for="(item, index) in check_status" :key="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
@@ -31,7 +26,7 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="create()">新 增</el-button>
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="create">新 增</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" @click="handleDelete(selectObjs)">删 除</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@@ -57,83 +52,83 @@
|
||||
<el-table-column prop="inventoryCode" label="单据编号" show-overflow-tooltip />
|
||||
<el-table-column prop="inventoryDate" label="单据日期" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="productName" label="入库商品" show-overflow-tooltip /> -->
|
||||
<el-table-column prop="handlerUserName" label="经办人" show-overflow-tooltip />
|
||||
<el-table-column prop="checkStatus" label="审批状态" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="check_status" :value="row.checkStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="handlerUserName" 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="totalAmount" label="入库总金额" show-overflow-tooltip /> -->
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="scope.row.checkStatus == '2' || scope.row.checkStatus == '3'"
|
||||
icon="MessageBox"
|
||||
text
|
||||
type="success"
|
||||
@click="edit(scope.row)"
|
||||
>
|
||||
详情
|
||||
</el-button>
|
||||
<el-button v-else icon="edit-pen" text type="primary" @click="edit(scope.row)">编辑</el-button>
|
||||
<el-button icon="edit-pen" text type="primary" @click="edit(scope.row)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
v-if="scope.row.checkStatus == '1' && scope.row.taskId"
|
||||
link
|
||||
icon="VideoPlay"
|
||||
@click="deal(scope.row)"
|
||||
>
|
||||
开始处理
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<sm-form v-else :formId="processFormState.formId" :disabled="processFormState.formDisabled" @close="formClose" />
|
||||
|
||||
<!-- 审批抽屉 -->
|
||||
<process-drawer ref="processDrawerRef" @task-submit-event="taskSubmitEvent" />
|
||||
<sm-form v-else :formId="formId" :disabled="formDisabled" @close="formClose" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { fetchList } from "/@/api/supermarketerp/smErpInventoryRecords"
|
||||
import ProcessDrawer from "/@/components/processDrawer/index.vue"
|
||||
import { tableRow, useSmProcessTableAction } from "/@/hooks/smProcessTableAction"
|
||||
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpInventoryRecords"
|
||||
|
||||
const SmForm = defineAsyncComponent(() => import("./form.vue"))
|
||||
|
||||
const { check_status } = useDict("check_status")
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
const processFormState = reactive<{ formId: string | undefined; formDisabled: boolean; showForm: boolean }>({
|
||||
formId: undefined,
|
||||
formDisabled: true,
|
||||
showForm: false,
|
||||
})
|
||||
const processDrawerRef = ref<InstanceType<typeof ProcessDrawer> | null>(null)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
inventoryType: "7",
|
||||
},
|
||||
pageList: fetchList,
|
||||
})
|
||||
const showForm = ref(false)
|
||||
const formDisabled = ref(false)
|
||||
const formId = ref("")
|
||||
|
||||
// 新增
|
||||
const create = () => {
|
||||
formDisabled.value = false
|
||||
formId.value = ""
|
||||
showForm.value = true
|
||||
}
|
||||
|
||||
// 删除
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const edit = (row: any) => {
|
||||
if (!row.id) return useMessage().warning("清单id不存在")
|
||||
formId.value = row.id
|
||||
showForm.value = true
|
||||
}
|
||||
|
||||
// 表单关闭
|
||||
const formClose = () => {
|
||||
showForm.value = false
|
||||
formId.value = ""
|
||||
formDisabled.value = false
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
@@ -147,7 +142,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
// downBlobFile("/supermarket/smErpInventoryRecords/export", Object.assign(state.queryForm, { ids: selectObjs }), "采购入库.xlsx")
|
||||
// downBlobFile("/supermarket/smErpInventoryRecords/export", Object.assign(state.queryForm, { ids: selectObjs }), "库存盘点.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
@@ -155,37 +150,4 @@ const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
const { create, edit, close } = useSmProcessTableAction(processFormState)
|
||||
|
||||
const formClose = () => {
|
||||
close()
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 点击开始处理
|
||||
const deal = (row: tableRow) => {
|
||||
if (!row.processInstanceId) return useMessage().warning("流程id不存在")
|
||||
processDrawerRef.value && processDrawerRef.value.openProcessDrawer(row)
|
||||
}
|
||||
// 审批提交事件
|
||||
const taskSubmitEvent = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
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>
|
||||
@@ -53,7 +53,7 @@
|
||||
<el-input-number v-model="form.grossMargin" :min="0" :precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="mb20">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商品封面图" prop="picUrl">
|
||||
<upload-img v-model:imageUrl="form.picUrl" />
|
||||
</el-form-item>
|
||||
@@ -63,10 +63,11 @@
|
||||
<el-input v-model.trim="form.origin" placeholder="请输入商品产地" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<!-- <el-col :span="24" class="mb20">
|
||||
<hr />
|
||||
</el-col>
|
||||
<el-col :span="8" class="mb20">
|
||||
</el-col> -->
|
||||
|
||||
<!-- <el-col :span="8" class="mb20">
|
||||
<el-form-item label="条码" prop="barCode">
|
||||
<el-input v-model.trim="form.barCode" />
|
||||
</el-form-item>
|
||||
@@ -113,7 +114,7 @@
|
||||
<el-radio label="1" border>停销</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -95,11 +95,11 @@
|
||||
<el-input-number v-model="row.promotionPrice" controls-position="right" :min="0" :precision="2" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="costPrice" title="成本价(元)" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<!-- <vxe-column field="costPrice" title="成本价(元)" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #edit="{ row }">
|
||||
<el-input-number v-model="row.costPrice" controls-position="right" :min="0" :precision="2" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-column> -->
|
||||
<vxe-column title="操作">
|
||||
<template #default="scope">
|
||||
<el-popconfirm title="是否删除?" @confirm="removeRow(scope.$rowIndex)">
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
<!-- excel 导入组件 -->
|
||||
<template>
|
||||
<el-dialog :title="prop.title" v-model="state.upload.open" :close-on-click-modal="false" draggable>
|
||||
<el-upload
|
||||
v-loading="state.upload.isUploading"
|
||||
ref="uploadRef"
|
||||
:limit="1"
|
||||
accept=".xlsx, .xls"
|
||||
:headers="headers"
|
||||
:action="baseURL + other.adaptationUrl(url)"
|
||||
:disabled="state.upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess"
|
||||
:on-error="handleFileError"
|
||||
:auto-upload="false"
|
||||
drag
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">
|
||||
{{ $t("excel.operationNotice") }}
|
||||
<em>{{ $t("excel.clickUpload") }}</em>
|
||||
</div>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip text-center">
|
||||
<span>{{ $t("excel.fileFormat") }}</span>
|
||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="downExcelTemp" v-if="tempUrl"
|
||||
>{{ $t("excel.downloadTemplate") }}
|
||||
</el-link>
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click="submitFileForm" :disabled="state.upload.isUploading">
|
||||
{{ $t("common.confirmButtonText") }}
|
||||
</el-button>
|
||||
<el-button @click="state.upload.open = false">{{ $t("common.cancelButtonText") }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!--校验失败错误数据-->
|
||||
<el-dialog :title="$t('excel.validationFailureData')" v-model="state.errorVisible" :close-on-click-modal="false" draggable>
|
||||
<el-table :data="state.errorData">
|
||||
<el-table-column property="row" align="center" :label="$t('excel.lineNumbers')" width="100" />
|
||||
<el-table-column property="reasons" align="center" :label="$t('excel.misDescription')" show-overflow-tooltip>
|
||||
<template v-slot="scope">
|
||||
<el-tag type="danger" v-for="error in scope.row.reasons" :key="error">{{ error }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="upload-excel">
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import other from "/@/utils/other"
|
||||
import { Session } from "/@/utils/storage"
|
||||
|
||||
const emit = defineEmits(["sizeChange", "refreshDataList"])
|
||||
const prop = defineProps({
|
||||
url: {
|
||||
type: String,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
},
|
||||
tempUrl: {
|
||||
type: String,
|
||||
},
|
||||
})
|
||||
|
||||
const uploadRef = ref()
|
||||
|
||||
const state = reactive({
|
||||
errorVisible: false,
|
||||
errorData: [],
|
||||
dialog: {
|
||||
title: "",
|
||||
isShowDialog: false,
|
||||
},
|
||||
upload: {
|
||||
open: false,
|
||||
isUploading: false,
|
||||
},
|
||||
})
|
||||
|
||||
/**
|
||||
* 下载模板文件
|
||||
*/
|
||||
const downExcelTemp = async () => {
|
||||
try {
|
||||
await other.downBlobFile(other.adaptationUrl(prop.tempUrl), {}, "temp.xlsx")
|
||||
} catch (error) {
|
||||
useMessage().error("模板下载失败,请先维护模板文件")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传进度条变化事件
|
||||
*/
|
||||
const handleFileUploadProgress = () => {
|
||||
state.upload.isUploading = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传失败事件处理
|
||||
*/
|
||||
const handleFileError = () => {
|
||||
useMessage().error("上传失败,数据格式不合法!")
|
||||
state.upload.open = false
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传成功事件处理
|
||||
* @param {any} response - 上传成功的响应结果
|
||||
*/
|
||||
const handleFileSuccess = (response: any) => {
|
||||
state.upload.isUploading = false
|
||||
state.upload.open = false
|
||||
uploadRef.value.clearFiles()
|
||||
|
||||
// 校验失败
|
||||
if (response.code === 1) {
|
||||
useMessage().error(response.msg ? response.msg : "导入失败,以下数据不合法")
|
||||
state.errorVisible = true
|
||||
state.errorData = response.data?.errors
|
||||
uploadRef.value.clearFiles()
|
||||
// 刷新表格
|
||||
emit?.("refreshDataList")
|
||||
} else {
|
||||
useMessage().success(response.msg ? response.msg : "导入成功")
|
||||
// 刷新表格
|
||||
emit?.("refreshDataList")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交表单,触发上传
|
||||
*/
|
||||
const submitFileForm = () => {
|
||||
state.upload.isUploading = true
|
||||
uploadRef.value.submit()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示上传文件对话框,并清除上传信息
|
||||
*/
|
||||
const show = () => {
|
||||
state.upload.isUploading = false
|
||||
state.upload.open = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算请求头部信息
|
||||
*/
|
||||
const headers = computed(() => {
|
||||
return {
|
||||
Authorization: "Bearer " + Session.getToken(),
|
||||
"TENANT-ID": Session.getTenant(),
|
||||
}
|
||||
})
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
show,
|
||||
})
|
||||
</script>
|
||||
@@ -11,11 +11,16 @@
|
||||
<el-option v-for="item in supermarketCategory" :key="item?.id" :label="item?.name" :value="item?.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品性质" prop="productNature">
|
||||
<el-select v-model="state.queryForm.productNature" placeholder="请选择商品性质">
|
||||
<el-option v-for="item in supermarket_nature" :key="item?.id" :label="item?.label" :value="item?.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="货号" prop="productCode">
|
||||
<el-input placeholder="请输入货号" v-model="state.queryForm.productCode" />
|
||||
</el-form-item>
|
||||
<el-form-item label="条码" prop="barcode">
|
||||
<el-input placeholder="条码" v-model="state.queryForm.barcode" />
|
||||
<el-form-item label="条码" prop="barCode">
|
||||
<el-input placeholder="条码" v-model="state.queryForm.barCode" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
|
||||
@@ -61,8 +66,20 @@
|
||||
type="primary"
|
||||
@click="excelUploadRef.show()"
|
||||
>
|
||||
{{ $t("common.importBtn") }}
|
||||
导入
|
||||
</el-button>
|
||||
<el-tooltip effect="dark" content="覆盖导入会覆盖已经存在的商品数据" placement="top">
|
||||
<el-button
|
||||
plain
|
||||
v-auth="'supermarket_supermarketSpu_import'"
|
||||
class="ml10"
|
||||
icon="upload-filled"
|
||||
type="primary"
|
||||
@click="excelUploadUpdateRef.show()"
|
||||
>
|
||||
覆盖导入
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
@@ -77,7 +94,7 @@
|
||||
<el-table-column type="selection" width="40" fixed="left" />
|
||||
<el-table-column type="index" label="#" width="50" fixed="left" />
|
||||
<el-table-column prop="productCode" label="货号" show-overflow-tooltip min-width="160" />
|
||||
<!-- <el-table-column prop="barcode" label="自编码/条码" show-overflow-tooltip width="100" /> -->
|
||||
<!-- <el-table-column prop="barCode" label="自编码/条码" show-overflow-tooltip width="100" /> -->
|
||||
<el-table-column prop="productName" label="商品名称" show-overflow-tooltip min-width="160" />
|
||||
<el-table-column prop="unit" label="单位" show-overflow-tooltip />
|
||||
<el-table-column prop="categoryId" label="商品分类" show-overflow-tooltip width="100">
|
||||
@@ -85,14 +102,9 @@
|
||||
<el-tag>{{ supermarketCategory?.find((item: any) => item.id === scope.row.categoryId)?.name }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="supplierId" label="货商" show-overflow-tooltip>
|
||||
<el-table-column prop="productNature" label="商品性质" show-overflow-tooltip width="150">
|
||||
<template #default="scope">
|
||||
{{ supermarketSupplier?.find((item: any) => item.supplierId == scope.row.supplierId)?.supplierName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="brandId" label="品牌" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ supermarketBrand?.find((item: any) => item.id === scope.row.brandId)?.name }}
|
||||
<dict-tag :options="supermarket_nature" :value="scope.row.productNature" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="picUrl" label="封面图" width="100">
|
||||
@@ -100,18 +112,28 @@
|
||||
<preview-image :src="scope.row.picUrl" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="商品状态" width="100">
|
||||
<el-table-column prop="supplierId" label="货商" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="status" :value="scope.row.status" />
|
||||
{{ supermarketSupplier?.find((item: any) => item.supplierId == scope.row.supplierId)?.supplierName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="brandId" label="品牌" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ supermarketBrand?.find((item: any) => item.id === scope.row.brandId)?.name }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column prop="costPrice" label="成本单价(元)" show-overflow-tooltip width="120">
|
||||
<template #default="{ row }">{{ displayPrice(row.costPrice, "") }}</template>
|
||||
<template #default="{ row }">{{ row.costPrice }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="retailPrice" label="零售价(元)" show-overflow-tooltip width="120">
|
||||
<template #default="{ row }">{{ displayPrice(row.retailPrice, "") }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="stock" label="剩余总库存" show-overflow-tooltip />
|
||||
<el-table-column prop="status" label="商品状态" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="status" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="giveIntegral" label="赠送积分" show-overflow-tooltip /> -->
|
||||
<!-- <el-table-column prop="merchantId" label="商户编号" show-overflow-tooltip /> -->
|
||||
<!-- <el-table-column prop="specification" label="规格" show-overflow-tooltip /> -->
|
||||
@@ -119,18 +141,13 @@
|
||||
<!-- <el-table-column prop="purchasePrice" label="进价)" show-overflow-tooltip /> -->
|
||||
<!-- <el-table-column prop="retailPrice" label="零售价" show-overflow-tooltip /> -->
|
||||
<!-- <el-table-column prop="promotionPrice" label="促销价" show-overflow-tooltip /> -->
|
||||
<el-table-column prop="productNature" label="商品性质" show-overflow-tooltip width="150">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="supermarket_nature" :value="scope.row.productNature" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="inventoryUpperLimit" label="库存上限" show-overflow-tooltip /> -->
|
||||
<!-- <el-table-column prop="inventoryLowerLimit" label="库存下限" show-overflow-tooltip /> -->
|
||||
<el-table-column prop="salesCount" label="售卖数量" show-overflow-tooltip min-width="100" />
|
||||
<el-table-column prop="grossMargin" label="毛利率" show-overflow-tooltip>
|
||||
<!-- <el-table-column prop="salesCount" label="售卖数量" show-overflow-tooltip min-width="100" /> -->
|
||||
<!-- <el-table-column prop="grossMargin" label="毛利率" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ displayPrice(row.grossMargin, "") }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="origin" label="产地" show-overflow-tooltip />
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column prop="origin" label="产地" show-overflow-tooltip /> -->
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@@ -156,9 +173,16 @@
|
||||
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
:title="$t('supermarket.importErpSpuTip')"
|
||||
url="/supermarket/supermarketSpu/import"
|
||||
@refreshDataList="getDataList"
|
||||
title="导入库存商品"
|
||||
url="/supermarket/supermarketSpu/importNew"
|
||||
@refreshDataList="refreshDataList"
|
||||
/>
|
||||
|
||||
<upload-excel
|
||||
ref="excelUploadUpdateRef"
|
||||
title="覆盖导入库存商品"
|
||||
url="/supermarket/supermarketSpu/importNewUpdate"
|
||||
@refreshDataList="refreshDataList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -175,6 +199,7 @@ import { getSupplierSimpleAll } from "/@/api/supermarketerp/smErpSupplier"
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
const excelUploadRef = ref()
|
||||
const excelUploadUpdateRef = ref()
|
||||
const { supermarket_nature, status } = useDict("supermarket_nature", "status")
|
||||
const formDialogRef = ref() // 对话框ref引用
|
||||
const queryRef = ref() // 搜索表单ref引用
|
||||
@@ -182,7 +207,7 @@ const showSearch = ref(true)
|
||||
const selectObjs = ref([]) as any // 表格行选中的数据
|
||||
const multiple = ref(true) // 是否已经多选
|
||||
const supermarketCategory = ref<any>([]) // 商品分类
|
||||
const supermarketBrand = ref<any>([]) // 商品品牌
|
||||
// const supermarketBrand = ref<any>([]) // 商品品牌
|
||||
const supermarketSupplier = ref<any>([]) // 货商
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
@@ -203,7 +228,13 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarket/supermarketSpu/export", Object.assign(state.queryForm, { ids: selectObjs }), "库存商品.xlsx")
|
||||
downBlobFile("/supermarket/supermarketSpu/exportNew", Object.assign(state.queryForm, { ids: selectObjs }), "库存商品.xlsx")
|
||||
}
|
||||
|
||||
// 导入成功刷新数据
|
||||
const refreshDataList = () => {
|
||||
getDataList()
|
||||
getSupplierAll()
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
@@ -238,18 +269,29 @@ onMounted(async () => {
|
||||
supermarketCategory.value = []
|
||||
}
|
||||
// 获取商品品牌
|
||||
try {
|
||||
const res = await getSupermarketBrand()
|
||||
supermarketBrand.value = res.data
|
||||
} catch (error) {
|
||||
supermarketBrand.value = []
|
||||
}
|
||||
// try {
|
||||
// const res = await getSupermarketBrand()
|
||||
// supermarketBrand.value = res.data
|
||||
// } catch (error) {
|
||||
// supermarketBrand.value = []
|
||||
// }
|
||||
// 获取货商
|
||||
// try {
|
||||
// const res = await getSupplierSimpleAll()
|
||||
// supermarketSupplier.value = res.data
|
||||
// } catch (error) {
|
||||
// supermarketSupplier.value = []
|
||||
// }
|
||||
getSupplierAll()
|
||||
})
|
||||
|
||||
// 获取货商
|
||||
const getSupplierAll = async () => {
|
||||
try {
|
||||
const res = await getSupplierSimpleAll()
|
||||
supermarketSupplier.value = res.data
|
||||
} catch (error) {
|
||||
supermarketSupplier.value = []
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -14,19 +14,13 @@ function chunk<T>(array: T[], size: number): T[][] {
|
||||
}
|
||||
|
||||
// 表格分页 + 表单信息 打印
|
||||
export const tablePrint = (
|
||||
editableTableRef: any,
|
||||
baseDataInfoRef: any,
|
||||
editableTableData: any,
|
||||
tableChunkSize: number = 20,
|
||||
printTitle: string = "",
|
||||
) => {
|
||||
const $table = editableTableRef
|
||||
const formPrintHtml = baseDataInfoRef ? baseDataInfoRef.innerHTML : ""
|
||||
export const tablePrint = (vxeTableRef: any, baseInfoRef: any, vxeTableData: any, tableChunkSize: number = 20, printTitle: string = "") => {
|
||||
const $table = vxeTableRef
|
||||
const formPrintHtml = baseInfoRef ? baseInfoRef.innerHTML : ""
|
||||
if ($table && formPrintHtml) {
|
||||
// 分割每页20条
|
||||
Promise.all(
|
||||
chunk(editableTableData, tableChunkSize).map((pageData: any, index: number) => {
|
||||
chunk(vxeTableData, tableChunkSize).map((pageData: any, index: number) => {
|
||||
return $table
|
||||
.getPrintHtml({
|
||||
data: pageData,
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
<template>
|
||||
<el-dialog v-model="visible" title="预览" width="800px" :close-on-click-modal="false" draggable destroy-on-close>
|
||||
<div v-loading="loading" id="receiptRef" ref="receiptRef"
|
||||
class="w-[17.5cm] h-[9.5cm] border border-gray-400 p-6 bg-[#EBE1C622]">
|
||||
<div v-loading="loading" id="receiptRef" ref="receiptRef" class="w-[17.5cm] h-[9.5cm] border border-gray-400 p-6 bg-[#EBE1C622]">
|
||||
<div class="text-center mx-auto w-[10cm] text-3xl font-bold">浦江县行政事业单位食堂统一收款收据</div>
|
||||
|
||||
<div class="flex justify-between items-end mb-1">
|
||||
<div></div>
|
||||
<div>
|
||||
{{ formatDate(new Date(receiptData.time), "YYYY年 mm月 dd日") || " 年 月 日".replace(/ /g, " ")
|
||||
}}
|
||||
{{ formatDate(new Date(receiptData.time), "YYYY年 mm月 dd日") || " 年 月 日".replace(/ /g, " ") }}
|
||||
</div>
|
||||
<span>
|
||||
<span>No. </span>
|
||||
@@ -21,9 +19,13 @@
|
||||
<tr>
|
||||
<td class="border border-gray-600 px-2 w-3/12 h-[0.75cm]">交款单位(或个人)</td>
|
||||
<td class="border border-gray-600 px-2 w-9/12 h-[0.75cm] text-sm text-blue-800" colspan="4">
|
||||
<input type="text" v-model="receiptData.deptOrUser"
|
||||
class="caret-red-600 w-full h-full bg-transparent text-center" ref="deptOrUserInput"
|
||||
maxlength="30" />
|
||||
<input
|
||||
type="text"
|
||||
v-model="receiptData.deptOrUser"
|
||||
class="caret-red-600 w-full h-full bg-transparent text-center"
|
||||
ref="deptOrUserInput"
|
||||
maxlength="30"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -60,10 +62,14 @@
|
||||
<td class="border border-gray-600 px-2 w-1/6 h-[0.75cm]">收款单位<br />(盖章)</td>
|
||||
<td class="border border-gray-600 px-2 text-left w-1/6 h-[0.75cm] text-sm text-blue-800">
|
||||
<!-- <input type="text" v-model="receiptData.payeeDept" class="w-full h-full bg-transparent" /> -->
|
||||
<img v-if="receiptData.stampPicUrl && visibleStampPic"
|
||||
class="w-[2.5cm] h-[2.5cm] absolute -top-2 left-[140px]" draggable="false"
|
||||
<img
|
||||
v-if="receiptData.stampPicUrl && visibleStampPic"
|
||||
class="w-[2.5cm] h-[2.5cm] absolute -top-2 left-[140px]"
|
||||
draggable="false"
|
||||
style="-webkit-user-drag: none; user-select: none; pointer-events: none"
|
||||
oncontextmenu="return false" src="/@/assets/receiptStamp.png" />
|
||||
oncontextmenu="return false"
|
||||
src="/@/assets/receiptStamp.png"
|
||||
/>
|
||||
</td>
|
||||
<td class="border border-gray-600 px-2 w-1/6 h-[0.75cm]">开票人<br />(签名)</td>
|
||||
<td class="border border-gray-600 px-2 text-left w-1/6 h-[0.75cm] text-sm text-blue-800">
|
||||
@@ -73,8 +79,11 @@
|
||||
<td class="border border-gray-600 px-2 text-left align-text-top w-1/3 h-[0.75cm]">
|
||||
<div class="flex">
|
||||
<span class="whitespace-nowrap">备注:</span>
|
||||
<textarea v-model="receiptData.remark" maxlength="12"
|
||||
class="flex-1 text-sm text-blue-800 w-full h-full bg-transparent resize-none overflow-y-hidden" />
|
||||
<textarea
|
||||
v-model="receiptData.remark"
|
||||
maxlength="12"
|
||||
class="flex-1 text-sm text-blue-800 w-full h-full bg-transparent resize-none overflow-y-hidden"
|
||||
/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -90,20 +99,48 @@
|
||||
<template #footer>
|
||||
<el-button @click="handleClose" :disabled="loading">关闭</el-button>
|
||||
<!-- ['2', '3'].includes(receiptData.processStatus!) && !['6'].includes(receiptData.status!) -->
|
||||
<el-button v-if="['2', '3'].includes(receiptData.processStatus!)" v-auth="'wallet_walletRechargeApply_back'"
|
||||
type="primary" plain @click="backInvoice" :disabled="loading">
|
||||
<el-button
|
||||
v-if="['2', '3'].includes(receiptData.processStatus!)"
|
||||
v-auth="'wallet_walletRechargeApply_back'"
|
||||
type="primary"
|
||||
plain
|
||||
@click="backInvoice"
|
||||
:disabled="loading"
|
||||
>
|
||||
作废
|
||||
</el-button>
|
||||
<el-button v-if="!receiptData.processStatus && !['6'].includes(receiptData.status!)" type="primary"
|
||||
:disabled="loading" @click="applyStamp">申请审批</el-button>
|
||||
<el-button v-if="receiptData.processStatus == undefined && !['6'].includes(receiptData.status!)"
|
||||
v-auth="'wallet_walletRechargeApply_receiptSave'" type="primary" @click="saveReceipt"
|
||||
:disabled="loading">保存</el-button>
|
||||
<el-button v-if="receiptData.stampPicUrl && !['6'].includes(receiptData.status!)" type="warning"
|
||||
@click="handlePrint" :disabled="loading">打印</el-button>
|
||||
<el-button v-auth="'wallet_invoice_refresh'"
|
||||
v-if="receiptData.stampPicUrl && !['6'].includes(receiptData.status!)" type="primary" plain
|
||||
icon="RefreshRight" @click="refreshInvoice" :disabled="refreshLoading">重新生成发票</el-button>
|
||||
<el-button
|
||||
v-if="!receiptData.processStatus && !['6'].includes(receiptData.status!)"
|
||||
type="primary"
|
||||
:disabled="loading"
|
||||
@click="applyStamp"
|
||||
>申请审批</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="receiptData.processStatus == undefined && !['6'].includes(receiptData.status!)"
|
||||
v-auth="'wallet_walletRechargeApply_receiptSave'"
|
||||
type="primary"
|
||||
@click="saveReceipt"
|
||||
:disabled="loading"
|
||||
>保存</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="receiptData.stampPicUrl && !['6'].includes(receiptData.status!)"
|
||||
type="warning"
|
||||
@click="handlePrint"
|
||||
:disabled="loading"
|
||||
>打印</el-button
|
||||
>
|
||||
<el-button
|
||||
v-auth="'wallet_invoice_refresh'"
|
||||
v-if="receiptData.stampPicUrl && !['6'].includes(receiptData.status!)"
|
||||
type="primary"
|
||||
plain
|
||||
icon="RefreshRight"
|
||||
@click="refreshInvoice"
|
||||
:disabled="refreshLoading"
|
||||
>重新生成发票</el-button
|
||||
>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -116,10 +153,9 @@ import request from "/@/utils/request"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import printJS from "print-js"
|
||||
import * as WalletRechargeInvoiceApi from "/@/api/wallet/wallet-recharge-invoice"
|
||||
import * as WalletRechargeInvoiceApi from "/@/api/wallet/wallet-recharge-invoice"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
|
||||
interface ReceiptData {
|
||||
id: string
|
||||
itemJson: string
|
||||
@@ -202,20 +238,21 @@ const refreshInvoice = async () => {
|
||||
visibleStampPic.value = false
|
||||
// 申请审批
|
||||
const blob = await genImage()
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000))
|
||||
if (!blob) return useMessage().error("图片生成失败")
|
||||
const picUrl = await uploadImage(blob)
|
||||
if (!picUrl) return useMessage().error("图片上传失败")
|
||||
|
||||
const _data = {
|
||||
id: receiptData.value.id,
|
||||
picUrl: picUrl
|
||||
picUrl: picUrl,
|
||||
}
|
||||
await WalletRechargeInvoiceApi.refreshInvoice(_data)
|
||||
useMessage().success("重新生成发票成功")
|
||||
emit("refresh")
|
||||
visible.value = false
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
console.error(err)
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
refreshLoading.value = false
|
||||
@@ -251,7 +288,7 @@ const genImage = async (): Promise<Blob | void | null> => {
|
||||
pixelRatio: 6,
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
console.error(error)
|
||||
return useMessage().error("图片生成错误")
|
||||
})
|
||||
return blob
|
||||
@@ -315,6 +352,7 @@ const applyStamp = async () => {
|
||||
// 申请审批
|
||||
const blob = await genImage()
|
||||
if (!blob) return useMessage().error("图片生成失败")
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000))
|
||||
const picUrl = await uploadImage(blob)
|
||||
if (!picUrl) return useMessage().error("图片上传失败")
|
||||
|
||||
|
||||
Reference in new issue
Block a user