Commit 0a3bd4b3 authored by tanghao's avatar tanghao

资源库页面调整

parent a68e3b96
......@@ -176,6 +176,19 @@ export const routes = [
title: '产品对照'
}
},
]
},
{
path: '/customer-excel',
name: 'CustomerExcel',
component: Layout,
meta: {
title: '资料库'
},
children: [
// 客户资料管理相关菜单
{
path: '/customer-excel',
......@@ -188,6 +201,7 @@ export const routes = [
{
path: '/customer-excel-list',
name: 'CustomerExcelList',
hidden: true,
meta: {
title: '客户资料'
},
......@@ -195,6 +209,7 @@ export const routes = [
},
]
},
{
path: '/online-excel',
name: 'OnlineExcel',
......
<template>
<div class="w-full h-full bg-white p-4">
<p class="font-bold text-lg leading-10 border-b-2">资料库管理</p>
<el-form class="pt-4" ref="formRef" :model="form" inline>
<el-form-item v-for="(item, index) in formColumn" :label="item" :key="index" :prop="item">
<el-input v-model="form[item]" placeholder="" clearable />
</el-form-item>
<el-form-item>
<el-button type="default" @click="onReset">重置</el-button>
<el-button type="primary" @click="onSearch">查询</el-button>
<el-button type="primary" @click="onCopy">查询参数</el-button>
</el-form-item>
</el-form>
<p class="font-bold text-lg leading-10 border-b-2">{{ route.query.informationType }}</p>
<vxe-form
title-overflow
title-colon
title-width="120"
title-align="right"
:data="form"
@submit="onSearch"
@reset="onReset">
<vxe-form-item v-for="(item, index) in formColumn" :key="index" :field="item" :title="item" span="6" :item-render="item">
<template #default>
<vxe-input v-model="form[item]"></vxe-input>
</template>
</vxe-form-item>
<vxe-form-item align="right" span="24" :item-render="{}">
<template #default>
<vxe-button type="submit" status="primary" content="查询"></vxe-button>
<vxe-button type="reset" content="重置"></vxe-button>
<vxe-button type="primary" @click="onCopy">查询参数</vxe-button>
</template>
</vxe-form-item>
</vxe-form>
<div>
<vxe-toolbar>
<template #buttons>
......@@ -19,7 +33,8 @@
<!-- <el-button type="danger" @click="handleDel">删除</el-button> -->
</template>
</vxe-toolbar>
<vxe-table ref="xTable" size="small" min-height="460" border :loading="loading" :data="tableData">
<vxe-table ref="xTable" min-height="460" border :loading="loading" :data="tableData" :row-config="{keyField:'id'}">
<vxe-column field="id" title="ID" width="100"></vxe-column>
<vxe-column v-for="(row, index) in tableColumn" :field="row" min-width="150" :title="row" :key="index" />
<vxe-column title="操作" width="100" fixed="right">
<template #default="{ row }">
......@@ -52,6 +67,8 @@ const loading = ref(false)
const formRef = ref<FormInstance>()
const formColumn = ref([])
const form = ref<any>({})
const defualtForm = ref<any>({})
const total = ref(0)
const xTable = ref<VxeTableInstance>()
const tableData = ref([])
......@@ -81,6 +98,7 @@ const initData = async () => {
})
formColumn.value.forEach((ele: any) => {
form.value[ele] = ""
defualtForm.value[ele]=""
});
getInformationListApi(params).then((res) => {
if (res.data?.code == 200) {
......@@ -156,18 +174,20 @@ const onChange = (type: any) => {
if (type != 'close') {
onReset()
}
onReset()
}
const handleAdd = () => {
visible.value = true
title.value = "新增资料"
informationInfo.value = form.value
informationInfo.value = defualtForm.value
}
const handleUpdate = (row: any) => {
visible.value = true
title.value = "修改资料"
informationInfo.value = Object.assign(form.value, row)
informationInfo.value = row
//Object.assign(form.value, row)
}
const handleDel = async (row: any) => {
......
<template>
<vxe-modal v-model="show" :z-index="1006" @hide="onClose" :title="title" width="600" esc-closable mask-closable
<vxe-modal v-model="show" :z-index="1006" @hide="onClose" :title="title" width="800" esc-closable mask-closable
show-footer>
<template #default>
<el-form ref="formRef" :model="form" inline label-position="right">
<template v-for="(item, index) in formColumn" :key="index">
<el-form-item v-if="!['id', '_X_ROW_KEY'].includes(item)" :label="item" :prop="item">
<el-input v-model="form[item]" placeholder="" clearable />
</el-form-item>
<vxe-form
title-overflow
title-colon
title-width="120"
title-align="right"
ref="formRef"
:data="form"
>
<vxe-form-item v-for="(item, index) in formColumn" :key="index" :field="item" :title="item" span="12" :item-render="item">
<template #default>
<vxe-input v-model="form[item]"></vxe-input>
</template>
</el-form>
</vxe-form-item>
</vxe-form>
</template>
<template #footer>
<el-button type="primary" @click="onSubmit">确认</el-button>
......@@ -69,6 +77,8 @@ const addInformationInfo = async () => {
}
}
const updateInformationInfo = async () => {
delete form.value['_X_ROW_KEY']
const params = {
......
......@@ -2,7 +2,19 @@
<vxe-modal v-model="show" :z-index="1006" @hide="onClose" title="导入" width="600" esc-closable mask-closable
show-footer>
<template #default>
<el-form ref="formRef" :model="form" :rules="rules">
<el-form ref="formRef" :model="form" :rules="rules" label-position="left" label-width="100px">
<el-form-item label="品牌编码" prop="brandCode">
<el-input v-model="form.brandCode" clearable />
</el-form-item>
<el-form-item label="客户编码" prop="customerCode">
<el-input v-model="form.customerCode" disabled>
<template #append>
<el-button :icon="MoreFilled" @click="customerVisible = true" />
</template>
</el-input>
</el-form-item>
<el-form-item label="资料类型" prop="informationType">
<el-input v-model="form.informationType" :disabled="!!route.query.informationType" clearable />
</el-form-item>
......@@ -47,6 +59,8 @@
<el-button type="primary" @click="onSubmit">确认</el-button>
</template>
</vxe-modal>
<CustomerModal v-model:visible="customerVisible" @confirm="confirmCustomer" />
</template>
<script lang="ts" setup name="UploadInformationInfoDialog">
......@@ -54,9 +68,12 @@ import { ref, reactive, watch } from 'vue'
import { useRoute } from 'vue-router'
import { uploadFile } from '@/api/excel'
import { importInformationApi } from '@/api/customer'
import { MoreFilled } from '@element-plus/icons-vue'
import CustomerModal from '@/components/CustomerModal/CustomerModal.vue'
import { ElMessage, genFileId, type FormInstance, type UploadInstance } from 'element-plus'
const route = useRoute()
const customerVisible = ref(false)
const props = defineProps({
visible: {
......@@ -91,6 +108,11 @@ watch(
}
}
)
const confirmCustomer = (list: any) => {
const [item] = list
if (!item) return
form.customerCode = item.customerCode
}
const importInformation = async () => {
const temp = tableData.value.reduce((acc: any, cur: any) => {
......@@ -99,6 +121,8 @@ const importInformation = async () => {
}, {})
const params = {
informationType: form.informationType,
customerCode:form.customerCode,
brandCode:form.brandCode,
filePath: form.filePath,
defaultJson: temp
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment