Commit 0a3bd4b3 authored by tanghao's avatar tanghao

资源库页面调整

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