货商与货商类别相关调整
This commit is contained in:
1 parent
469e0584f4
commit
8d3629e66e
13 files changed
+245
-188
No files matched your search
@@ -38,3 +38,12 @@ export function putObj(obj?: Object) {
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
|
||||
// 获取货商下拉列表
|
||||
export function getSupplierSimpleAll(params: any): any {
|
||||
return request({
|
||||
url: "/supermarket/smErpSupplier/selectSimpleAll",
|
||||
method: "get",
|
||||
params,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="state.selectId"
|
||||
:placeholder="props.placeholder"
|
||||
clearable
|
||||
remote-show-suffix
|
||||
filterable
|
||||
remote
|
||||
:remote-method="remoteSearch"
|
||||
:loading="state.loading"
|
||||
@visible-change="(e: boolean) => e && getOptions()"
|
||||
>
|
||||
<el-option v-for="v in state.options" :key="v.id" :label="`${v.typeName}`" :value="v.id">
|
||||
<!-- <div class="flex items-center">
|
||||
<div class="color-primary">{{ v.name }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<el-tag size="small">
|
||||
{{ v.deptName }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div> -->
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="SelectSupplier">
|
||||
import { reactive } from "vue"
|
||||
import { getSupplierSimpleAll } from "/@/api/supermarketerp/smErpSupplier"
|
||||
|
||||
const selectId = defineModel()
|
||||
|
||||
export type Props = {
|
||||
placeholder?: string
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
placeholder: "请选择",
|
||||
})
|
||||
|
||||
const queryForm = reactive<any>({})
|
||||
|
||||
const state = reactive<any>({
|
||||
loading: true,
|
||||
selectId: selectId,
|
||||
options: [],
|
||||
})
|
||||
|
||||
watch(
|
||||
selectId,
|
||||
(newVal, oldValue) => {
|
||||
if (newVal == oldValue) return
|
||||
state.selectId = newVal
|
||||
getOptions()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
async function getOptions() {
|
||||
try {
|
||||
state.loading = true
|
||||
const _pa = {
|
||||
...queryForm,
|
||||
}
|
||||
const { data } = await getSupplierSimpleAll(_pa)
|
||||
state.options = data ? data.filter((item: any) => item.id) : []
|
||||
} finally {
|
||||
setTimeout(() => (state.loading = false), 500)
|
||||
}
|
||||
}
|
||||
|
||||
function remoteSearch(params: string) {
|
||||
if (params != queryForm.name) {
|
||||
queryForm.name = params
|
||||
getOptions()
|
||||
}
|
||||
}
|
||||
|
||||
function clear() {
|
||||
state.selectId = null
|
||||
getOptions()
|
||||
}
|
||||
</script>
|
||||
@@ -23,6 +23,7 @@ import SelectCtcg from "/@/components/Select/SelectCtcg.vue"
|
||||
import SelectCtcgol from "/@/components/Select/SelectCtcgol.vue"
|
||||
import SelectHardGroup from "/@/components/Select/selectHardGroup.vue"
|
||||
import SelectHandlerUser from "/@/components/Select/SelectHandlerUser.vue"
|
||||
import SelectSupplier from "/@/components/Select/SelectSupplier.vue"
|
||||
|
||||
// 第三方组件
|
||||
import ElementPlus from "element-plus"
|
||||
@@ -68,6 +69,7 @@ export default {
|
||||
app.component("SelectCtcgol", SelectCtcgol)
|
||||
app.component("SelectHardGroup", SelectHardGroup)
|
||||
app.component("SelectHandlerUser", SelectHandlerUser)
|
||||
app.component("SelectSupplier", SelectSupplier)
|
||||
|
||||
// 导入全部的elmenet-plus的图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
<SelectHandlerUser v-model.trim="baseDataForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<el-select v-model="baseDataForm.supplierId" placeholder="请选择货商" style="width: 200px">
|
||||
<el-option v-for="item in supplierTypeDict" :key="item?.id" :label="item?.typeName" :value="item?.id" />
|
||||
</el-select>
|
||||
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
|
||||
@@ -177,7 +175,6 @@ import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgBack"
|
||||
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
|
||||
@@ -192,7 +189,6 @@ const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
|
||||
// 基本信息表单数据
|
||||
const baseDataForm = reactive<any>({
|
||||
id: "",
|
||||
@@ -261,14 +257,11 @@ const getInitData = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取货商选项 & 获取采购退货编号
|
||||
const [erpSpuSimpleAll, supplierTypeOptions, planCode] = await Promise.allSettled([
|
||||
getErpSpuSimpleAll(),
|
||||
getSupplierTypeOptions(),
|
||||
getPlanCode({ type: 4 }),
|
||||
]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
// 获取采购退货编号
|
||||
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 4 })]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
|
||||
supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data)
|
||||
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<el-select v-model="baseDataForm.supplierId" placeholder="请选择货商" style="width: 200px">
|
||||
<el-option v-for="item in supplierTypeDict" :key="item?.id" :label="item?.typeName" :value="item?.id" />
|
||||
</el-select>
|
||||
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
|
||||
@@ -182,7 +180,6 @@ import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgDd"
|
||||
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
|
||||
@@ -198,7 +195,6 @@ const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
|
||||
const { check_status } = useDict("check_status")
|
||||
// 基本信息表单数据
|
||||
const baseDataForm = reactive<any>({
|
||||
@@ -268,14 +264,11 @@ const getInitData = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取货商选项 & 获取采购订单编号
|
||||
const [erpSpuSimpleAll, supplierTypeOptions, planCode] = await Promise.allSettled([
|
||||
getErpSpuSimpleAll(),
|
||||
getSupplierTypeOptions(),
|
||||
getPlanCode({ type: 2 }),
|
||||
]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
// 获取采购订单编号
|
||||
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 2 })]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
|
||||
supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data)
|
||||
planCode && planCode.code === 0 && (baseDataForm.code = planCode.data)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<el-select v-model="baseDataForm.supplierId" placeholder="请选择货商" style="width: 200px">
|
||||
<el-option v-for="item in supplierTypeDict" :key="item?.id" :label="item?.typeName" :value="item?.id" />
|
||||
</el-select>
|
||||
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
|
||||
@@ -182,7 +180,6 @@ import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgInventory"
|
||||
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
|
||||
@@ -198,7 +195,6 @@ const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
|
||||
const { check_status } = useDict("check_status")
|
||||
// 基本信息表单数据
|
||||
const baseDataForm = reactive<any>({
|
||||
@@ -268,14 +264,11 @@ const getInitData = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取货商选项 & 获取采购入库编号
|
||||
const [erpSpuSimpleAll, supplierTypeOptions, planCode] = await Promise.allSettled([
|
||||
getErpSpuSimpleAll(),
|
||||
getSupplierTypeOptions(),
|
||||
getPlanCode({ type: 3 }),
|
||||
]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
// 获取采购入库编号
|
||||
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 3 })]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
|
||||
supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data)
|
||||
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,6 @@ import { ref, reactive, computed, onMounted } from "vue"
|
||||
import { useRouter, useRoute } from "vue-router"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
|
||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgPlan"
|
||||
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
||||
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
|
||||
@@ -173,7 +172,6 @@ const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const loading = ref(false) // 采购计划加载
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
|
||||
// 基本信息表单数据
|
||||
const baseDataForm = reactive<any>({
|
||||
id: undefined,
|
||||
@@ -230,11 +228,10 @@ const getInitData = async () => {
|
||||
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
|
||||
}
|
||||
|
||||
// 获取货商选项 & 获取采购计划编号
|
||||
const [supplierTypeOptions, planCode] = await Promise.allSettled([getSupplierTypeOptions(), getPlanCode({ type: 1 })]).then((results) =>
|
||||
// 获取采购计划编号
|
||||
const [planCode] = await Promise.allSettled([getPlanCode({ type: 1 })]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data)
|
||||
planCode && planCode.code === 0 && (baseDataForm.planCode = planCode.data)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<el-select v-model="baseDataForm.supplierId" placeholder="请选择货商" style="width: 200px">
|
||||
<el-option v-for="item in supplierTypeDict" :key="item?.id" :label="item?.typeName" :value="item?.id" />
|
||||
</el-select>
|
||||
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
|
||||
@@ -206,7 +204,6 @@ import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "../../../api/supermarketerp/smErpCgInventory"
|
||||
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
|
||||
@@ -222,7 +219,6 @@ const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
|
||||
const { check_status } = useDict("check_status")
|
||||
// 基本信息表单数据
|
||||
const baseDataForm = reactive<any>({
|
||||
@@ -305,14 +301,11 @@ const getInitData = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取货商选项 & 获取采购入库编号
|
||||
const [erpSpuSimpleAll, supplierTypeOptions, planCode] = await Promise.allSettled([
|
||||
getErpSpuSimpleAll(),
|
||||
getSupplierTypeOptions(),
|
||||
getPlanCode({ type: 6 }),
|
||||
]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
// 获取采购入库编号
|
||||
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 6 })]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
|
||||
supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data)
|
||||
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<el-select v-model="baseDataForm.supplierId" placeholder="请选择货商" style="width: 200px">
|
||||
<el-option v-for="item in supplierTypeDict" :key="item?.id" :label="item?.typeName" :value="item?.id" />
|
||||
</el-select>
|
||||
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
|
||||
@@ -206,7 +204,6 @@ import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "../../../api/supermarketerp/smErpCgInventory"
|
||||
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
|
||||
@@ -222,7 +219,6 @@ const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
|
||||
const { check_status } = useDict("check_status")
|
||||
// 基本信息表单数据
|
||||
const baseDataForm = reactive<any>({
|
||||
@@ -305,14 +301,11 @@ const getInitData = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取货商选项 & 获取采购入库编号
|
||||
const [erpSpuSimpleAll, supplierTypeOptions, planCode] = await Promise.allSettled([
|
||||
getErpSpuSimpleAll(),
|
||||
getSupplierTypeOptions(),
|
||||
getPlanCode({ type: 5 }),
|
||||
]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
// 获取采购入库编号
|
||||
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 5 })]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
|
||||
supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data)
|
||||
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
|
||||
}
|
||||
|
||||
|
||||
@@ -95,105 +95,103 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="SmErpSupplierDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import { getObj, addObj, putObj, getSupplierTypeOptions } from '/@/api/supermarketerp/smErpSupplier';
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpSupplier"
|
||||
import { getSupplierTypeSimpleAll } from "/@/api/supermarketerp/smErpSupplierType"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false);
|
||||
const loading = ref(false);
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
const { status } = useDict('status');
|
||||
const supplierTypeOptions = ref<any>([]); // 货商类别管理下拉选项
|
||||
const { status } = useDict("status")
|
||||
const supplierTypeOptions = ref<any>([]) // 货商类别管理下拉选项
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
supplierId: '',
|
||||
supplierName: '',
|
||||
address: '',
|
||||
phone: '',
|
||||
tax: '',
|
||||
linkName: '',
|
||||
openAccount: '',
|
||||
email: '',
|
||||
deptId: '',
|
||||
supplierType: '',
|
||||
supplierArea: '',
|
||||
passwordModifyTime: '',
|
||||
openName: '',
|
||||
contractNumber: '',
|
||||
status: '0',
|
||||
pinyinCod: '',
|
||||
});
|
||||
supplierId: "",
|
||||
supplierName: "",
|
||||
address: "",
|
||||
phone: "",
|
||||
tax: "",
|
||||
linkName: "",
|
||||
openAccount: "",
|
||||
email: "",
|
||||
deptId: "",
|
||||
supplierType: "",
|
||||
supplierArea: "",
|
||||
passwordModifyTime: "",
|
||||
openName: "",
|
||||
contractNumber: "",
|
||||
status: "0",
|
||||
pinyinCod: "",
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
supplierName: [{ required: true, message: '货商名称不能为空', trigger: 'blur' }],
|
||||
supplierType: [{ required: true, message: '货商类别不能为空', trigger: 'blur' }],
|
||||
});
|
||||
supplierName: [{ required: true, message: "货商名称不能为空", trigger: "blur" }],
|
||||
supplierType: [{ required: true, message: "货商类别不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async (id: string) => {
|
||||
visible.value = true;
|
||||
form.supplierId = '';
|
||||
visible.value = true
|
||||
form.supplierId = ""
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
dataFormRef.value?.resetFields()
|
||||
|
||||
// 获取smErpSupplier信息
|
||||
if (id) {
|
||||
form.supplierId = id;
|
||||
getsmErpSupplierData(id);
|
||||
form.supplierId = id
|
||||
getsmErpSupplierData(id)
|
||||
}
|
||||
|
||||
if (supplierTypeOptions.value.length <= 0) {
|
||||
try {
|
||||
const res = await getSupplierTypeOptions();
|
||||
supplierTypeOptions.value = res.data;
|
||||
const res = await getSupplierTypeSimpleAll()
|
||||
supplierTypeOptions.value = res.data
|
||||
} catch (error) {
|
||||
supplierTypeOptions.value = [];
|
||||
supplierTypeOptions.value = []
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.supplierId ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.supplierId ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
loading.value = true
|
||||
form.supplierId ? await putObj(form) : await addObj(form)
|
||||
useMessage().success(form.supplierId ? "修改成功" : "添加成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getsmErpSupplierData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
getObj(id)
|
||||
.then((res: any) => {
|
||||
Object.assign(form, res.data);
|
||||
Object.assign(form, res.data)
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog,
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@@ -20,7 +20,13 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()" v-auth="'supermarketerp_smErpSupplier_add'">
|
||||
<el-button
|
||||
icon="folder-add"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'supermarketerp_smErpSupplier_add'"
|
||||
>
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button
|
||||
@@ -41,9 +47,9 @@
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
></right-toolbar>
|
||||
<el-button plain v-auth="'sys_user_add'" class="ml10" icon="upload-filled" type="primary" @click="excelUploadRef.show()">
|
||||
{{ $t("common.importBtn") }}
|
||||
</el-button>
|
||||
<el-button plain v-auth="'sys_user_add'" class="ml10" icon="upload-filled" type="primary" @click="excelUploadRef.show()">
|
||||
{{ $t("common.importBtn") }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
@@ -88,7 +94,13 @@
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'supermarketerp_smErpSupplier_del'" @click="handleDelete([scope.row.supplierId])">
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'supermarketerp_smErpSupplier_del'"
|
||||
@click="handleDelete([scope.row.supplierId])"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -99,88 +111,86 @@
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<!-- temp-url="/admin/sys-file/local/file/user.xlsx"-->
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
:title="$t('supermarket.importSupplierTip')"
|
||||
url="/supermarket/smErpSupplier/import"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
<!-- temp-url="/admin/sys-file/local/file/user.xlsx"-->
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
:title="$t('supermarket.importSupplierTip')"
|
||||
url="/supermarket/smErpSupplier/import"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemSmErpSupplier">
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { fetchList, delObjs, getSupplierTypeOptions } from '/@/api/supermarketerp/smErpSupplier';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpSupplier"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import FormDialog from "./form.vue"
|
||||
import { getSupplierTypeSimpleAll } from "/@/api/supermarketerp/smErpSupplierType"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
const { status } = useDict('status');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const { status } = useDict("status")
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
const supplierType = ref<any>([]); // 货商类别
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
const supplierType = ref<any>([]) // 货商类别
|
||||
const excelUploadRef = ref()
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
});
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 获取货商类别
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const res = await getSupplierTypeOptions();
|
||||
supplierType.value = res.data;
|
||||
const res = await getSupplierTypeSimpleAll()
|
||||
supplierType.value = res.data.filter((item: any) => item.id)
|
||||
} catch (error) {
|
||||
supplierType.value = [];
|
||||
supplierType.value = []
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields();
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/supermarketerp/smErpSupplier/export', Object.assign(state.queryForm, { ids: selectObjs }), 'smErpSupplier.xlsx');
|
||||
};
|
||||
downBlobFile("/supermarketerp/smErpSupplier/export", Object.assign(state.queryForm, { ids: selectObjs }), "smErpSupplier.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { supplierId: string }[]) => {
|
||||
selectObjs.value = objs.map(({ supplierId }) => supplierId);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ supplierId }) => supplierId)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@@ -93,7 +93,7 @@
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="costPrice" title="成本价(元)" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #costPriceDefault="{ row }">
|
||||
<template #edit="{ row }">
|
||||
<el-input-number v-model="row.costPrice" controls-position="right" :min="0" :precision="2" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<el-tabs v-model="tabPaneActiveName" @tab-change="handleTabChange">
|
||||
<el-tab-pane label="基础信息" name="基础信息" style="overflow-y: auto; height: 60vh">
|
||||
<el-row>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="商户" prop="merchantId">-->
|
||||
<!-- <select-mch v-model="form.merchantId" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="商户" prop="merchantId">-->
|
||||
<!-- <select-mch v-model="form.merchantId" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货号" prop="productCode">
|
||||
<el-input v-model.trim="form.productCode" placeholder="请输入货号" />
|
||||
@@ -26,9 +26,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<el-select v-model="form.supplierId" placeholder="请选择货商">
|
||||
<el-option v-for="item in supplierTypeOptions" :key="item?.id" :label="item?.typeName" :value="item?.id" />
|
||||
</el-select>
|
||||
<select-supplier v-model="form.supplierId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
@@ -231,7 +229,6 @@ const dataRules = {
|
||||
const { supermarket_nature, status } = useDict("supermarket_nature", "status")
|
||||
const categoryOptions = ref<any>([]) // 商品分类的下拉选项
|
||||
const brandOptions = ref<any>([]) // 超市品牌的下拉选项
|
||||
const supplierTypeOptions = ref<any>([]) // 货商的下拉选项
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async (id: string) => {
|
||||
@@ -251,16 +248,13 @@ const openDialog = async (id: string) => {
|
||||
supermarketUnitEntityListRef.value.setRadioRow(form.smErpUnitEntityList.findIndex((item: any) => item.isBase))
|
||||
}
|
||||
|
||||
// 获取分类下拉选项 & 获取品牌下拉选项 & 获取货商类型下拉选项
|
||||
const [categoryDict, brandDict, supplierTypeDict] = await Promise.allSettled([
|
||||
getSupermarketCategory(),
|
||||
getSupermarketBrand(),
|
||||
getSupplierTypeSimpleAll(),
|
||||
]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
// 获取分类下拉选项 & 获取品牌下拉选项
|
||||
const [categoryDict, brandDict] = await Promise.allSettled([getSupermarketCategory(), getSupermarketBrand()]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
|
||||
categoryDict && categoryDict.code === 0 && (categoryOptions.value = categoryDict.data)
|
||||
brandDict && brandDict.code === 0 && (brandOptions.value = brandDict.data)
|
||||
supplierTypeDict && supplierTypeDict.code === 0 && (supplierTypeOptions.value = supplierTypeDict.data)
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
|
||||
Reference in new issue
Block a user