From 4c89d00851bc8a982af9e6c1b55453456c9a2f91 Mon Sep 17 00:00:00 2001 From: zhouhaibin Date: Mon, 20 May 2024 12:24:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86=E5=88=9D?= =?UTF-8?q?=E6=AD=A5=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 2 +- package.json | 1 + src/main.ts | 13 +- src/mixin/referenceMixin_copy.js | 236 ++++++++++++++++ src/modules/costMode/api/index.ts | 90 +++++++ .../supplierInformationComponents.vue | 132 +++++++++ src/modules/productManagement/api/index.ts | 126 +++++++++ .../components/productModelComponents.vue | 251 ++++++++++++++++++ .../productModelSelectComponents.vue | 141 ++++++++++ .../productModelTemplateComponents.vue | 220 +++++++++++++++ .../supplierInformationComponents.vue | 145 ++++++++++ .../view/companyProducts/index.vue | 209 +++++++++++++++ .../view/personProducts/index.vue | 208 +++++++++++++++ .../view/productModelTemplate/index.vue | 167 ++++++++++++ .../view/supplierInformation/add.vue | 69 +++++ .../view/supplierInformation/index.vue | 148 +++++++++++ .../view/supplierInformation/modify.vue | 69 +++++ .../view/supplierInformation/view.vue | 55 ++++ .../view/supplierProducts/index.vue | 220 +++++++++++++++ vite.config.ts | 2 +- 20 files changed, 2500 insertions(+), 4 deletions(-) create mode 100644 src/mixin/referenceMixin_copy.js create mode 100644 src/modules/costMode/api/index.ts create mode 100644 src/modules/costMode/components/supplierInformationComponents.vue create mode 100644 src/modules/productManagement/api/index.ts create mode 100644 src/modules/productManagement/components/productModelComponents.vue create mode 100644 src/modules/productManagement/components/productModelSelectComponents.vue create mode 100644 src/modules/productManagement/components/productModelTemplateComponents.vue create mode 100644 src/modules/productManagement/components/supplierInformationComponents.vue create mode 100644 src/modules/productManagement/view/companyProducts/index.vue create mode 100644 src/modules/productManagement/view/personProducts/index.vue create mode 100644 src/modules/productManagement/view/productModelTemplate/index.vue create mode 100644 src/modules/productManagement/view/supplierInformation/add.vue create mode 100644 src/modules/productManagement/view/supplierInformation/index.vue create mode 100644 src/modules/productManagement/view/supplierInformation/modify.vue create mode 100644 src/modules/productManagement/view/supplierInformation/view.vue create mode 100644 src/modules/productManagement/view/supplierProducts/index.vue diff --git a/.eslintrc.js b/.eslintrc.js index 98bba99..0dfee3a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -42,7 +42,7 @@ module.exports = defineConfig({ 'no-unused-vars': 'off', "vue/no-unused-components": "off", 'space-before-function-paren': 'off', - + 'prettier/prettier': 'off', 'vue/attributes-order': 'off', 'vue/one-component-per-file': 'off', 'vue/html-closing-bracket-newline': 'off', diff --git a/package.json b/package.json index faca1f6..259e602 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@form-create/element-ui": "^3.1.24", "@iconify/iconify": "^3.1.0", "@iconify/vue": "^4.1.1", + "@smallwei/avue": "^3.4.2", "@vueuse/core": "^9.13.0", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "^5.1.10", diff --git a/src/main.ts b/src/main.ts index 4812884..b305ac9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -28,7 +28,9 @@ import { setupRouter } from './router' import { setupPermission } from './directives' import { createApp } from 'vue' - +//新增第三方组件 +import Avue from '@smallwei/avue'; +import '@smallwei/avue/lib/index.css'; import App from './App.vue' import './permission' @@ -109,7 +111,14 @@ const setupAll = async () => { // 全量注册element-plus组件 app.use(ElementPlus) - + // 全量注册avue组件 + app.use(Avue,{ + crudOption:{ + index: true, //是否展示序号列 + indexLabel: '序号', //序号列名称 + indexWidth: 60, //序号列宽度 + } + }); // 自定义表单 app.use(FormCreate) app.use(FcDesigner) diff --git a/src/mixin/referenceMixin_copy.js b/src/mixin/referenceMixin_copy.js new file mode 100644 index 0000000..f7b8dfc --- /dev/null +++ b/src/mixin/referenceMixin_copy.js @@ -0,0 +1,236 @@ +/** + * 参照页面混入 + */ +import { Dialog } from '@/components/abc/Dialog' +import CollapseTab from '@/components/abc/CollapseTab/index.vue' +import QueryText from '@/components/abc/QueryText/index.vue' +import QueryButton from '@/components/abc/QueryButton/index.vue' +import { ContentWrap } from '@/components/abc/ContentWrap' +import ListPager from '@/components/abc/ListPager/index.vue' +import ColumnsController from '@/components/abc/ColumnsController/index.vue' +import DictionarySelect from '@/components/abc/DictionarySelect/DictionarySelect.vue' +import DictionaryRadioGroup from '@/components/abc/DictionarySelect/DictionaryRadioGroup.vue' +import OrganizationSingleSelect from '@/modules/system/view/organization/treeReference.vue' +import OrganizationMultipleSelect from '@/modules/system/view/organization/treeMultipleSelect.vue' +import UserSingleSelect from '@/modules/system/view/user/treeListReference.vue' +import IconPicker from '@/components/abc/IconPicker/index.vue' + +export const referenceMixin_copy = { + emits: ['update:modelValue', 'my-change'], + components: { + Dialog, + ContentWrap, + CollapseTab, + QueryText, + QueryButton, + ListPager, + ColumnsController, + DictionarySelect, + DictionaryRadioGroup, + OrganizationSingleSelect, + OrganizationMultipleSelect, + UserSingleSelect, + IconPicker + }, + props: { + modelValue: { + type: String, + default: '', + required: false + }, + disabled: { + type: Boolean, + required: false, + default: false + } + }, + data() { + return { + // 表格数据 + tableData: [], + // 加载中 + loading: false, + // 当前行 + currentId: this.$constant.NO_ITEM_SELECTED, + // 分页信息 + pageInfo: { + // 页码 + pageNum: this.$constant.DEFAULT_PAGE_NUM, + // 页码大小 + pageSize: this.$constant.DEFAULT_PAGE_SIZE + }, + // 排序信息 + sortInfo: { + sort_field: 'orderNo', + sort_sortType: 'ascending' + }, + // 总页数 + pageTotal: 0, + queryCondition: { + // 默认值处理 + }, + visible: false, + // 显示名称 + displayName: '' + } + }, + watch: { + modelValue: { + immediate: true, + handler: 'getSelectedName' + } + }, + computed: { + showCols() { + return this.columnList.filter((item) => item.show) + }, + tableKey() { + const { path } = this.$route + return `${path}/table` + } + }, + methods: { + // 初始化 + init(param) { + if (this.beforeInit != null) { + this.beforeInit(param) + } + this.loadData().then((res) => { + if (this.afterInit) { + this.afterInit(param) + } + this.visible = true + }) + }, + // 确认选择 + confirm() { + if (!this.checkSelectedRowExist()) { + return + } + const selectedRow = this.getRow(this.currentId) + + this.displayName = selectedRow.name + // 更新父组件绑定值 + this.$emit('update:modelValue', selectedRow.id) + this.$emit('my-change', selectedRow.id, selectedRow) + this.visible = false + if (this.afterConfirm!=null) { + this.afterConfirm(selectedRow) + } + }, + // 关闭 + close() { + this.visible = false + }, + // 清空选择 + clear() { + this.displayName = '' + this.$emit('update:modelValue', '') + this.$emit('my-change', '') + }, + // 获取选中的名称 + getSelectedName() { + if (this.modelValue) { + this.api.get(this.modelValue).then((res) => { + this.displayName = res.data[this.nameKey] + }) + } + }, + // 加载数据 + loadData() { + return new Promise((resolve) => { + this.loading = true + const params = Object.assign(this.queryCondition, this.pageInfo, this.sortInfo) + this.api + .page(params) + .then((res) => { + this.tableData = res.data.records + this.pageTotal = res.data.total + resolve() + }) + .finally(() => { + this.loading = false + this.currentId = this.$constant.NO_ITEM_SELECTED + }) + }) + }, + // 查看 + view(id) { + if (this.$refs.viewPage) { + this.$refs.viewPage.init(id) + } + }, + // 刷新 + refresh() { + this.loadData() + }, + // 处理排序 + // eslint-disable-next-line no-unused-vars + sortChange({ column, prop, order }) { + this.sortInfo.sort_field = prop + this.sortInfo.sort_sortType = order + this.refresh() + }, + // 当前行变化 + rowChange(currentRow) { + this.currentId = currentRow ? currentRow.id : this.$constant.NO_ITEM_SELECTED + }, + // 获取行记录 + getRow(id) { + if (id && id !== this.$constant.NO_ITEM_SELECTED) { + if (this.tableData && this.tableData.length > 0) { + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].id === id) { + return this.tableData[i] + } + } + } + } + return undefined + }, + // 获取名称 + getName(id) { + const row = this.getRow(id) + if (row) { + return row[this.nameKey] + } + return undefined + }, + // 验证是否有选中行 + checkSelectedRowExist() { + if (this.currentId === this.$constant.NO_ITEM_SELECTED) { + this.$message.info('当前无选中行') + return false + } + return true + }, + // 双击事件 + rowDoubleClick(row) { + this.view(row.id) + }, + // 处理查询 + query() { + // 查询之前,将当前页置为1 + this.pageInfo.pageNum = 1 + this.refresh() + }, + // 处理分页变化 + pageChange(value) { + this.pageInfo.pageNum = value + this.refresh() + }, + // 处理分页大小变化 + pageSizeChange(value) { + this.pageInfo.pageSize = value + this.refresh() + } + }, + provide() { + return { + query: this.query, + view: this.view, + pageChange: this.pageChange, + pageSizeChange: this.pageSizeChange + } + } +} diff --git a/src/modules/costMode/api/index.ts b/src/modules/costMode/api/index.ts new file mode 100644 index 0000000..7131639 --- /dev/null +++ b/src/modules/costMode/api/index.ts @@ -0,0 +1,90 @@ +import { COMMON_METHOD } from '@/constant/common' +import request from '@/config/axios' + +const moduleName = 'costMode' + +// 系统参数 +// export const param = Object.assign({}, COMMON_METHOD, { +// serveUrl: '/' + moduleName + '/' + 'param' + '/' +// }) + +// 供应商管理 +// export const supplierInformation = { +// serveUrl: '/' + moduleName + '/' + 'supplierInformation' + '/', + +// page(params) { +// return request.get({ url: this.serveUrl + 'page', params }) +// }, +// get(id) { +// return request.get({ url: this.serveUrl + id }) +// } +// } + + + +// 个人产品 +export const personProducts = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'personProducts' + '/', + +}) + +// 字典类型 +export const dictionaryType = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'dictionaryType' + '/', + tree() { + return request.get({ url: this.serveUrl + 'tree' }) + }, + + // 通过编码获取数据 + getByCode(param) { + return request.get({ url: this.serveUrl + 'getByCode/' + param }) + }, + // 批量保存 + saveItem(id, itemList) { + return request.post({ url: this.serveUrl + id + '/item', data: itemList }) + }, + // 通过编码获取字典项,转换为列表项数据结构,用于公用选择控件 + getItem(code) { + return request.get({ url: this.serveUrl + 'getItem?code=' + code }) + } +}) + +// 字典项 +export const dictionaryItem = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'dictionaryItem' + '/', + enable(id) { + return request.put({ url: this.serveUrl + id + '/enable' }) + }, + disable(id) { + return request.put({ url: this.serveUrl + id + '/disable' }) + } +}) +// 用户设置 +export const userProfile = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'userProfile' + '/', + get() { + return request.get({ url: this.serveUrl }) + } +}) + +// 系统管理 +export const systemManage = Object.assign( + {}, + { + serveUrl: '/' + moduleName + '/' + 'systemManage' + '/', + // 重建系统缓存 + rebuildSystemCache() { + return request.put({ url: this.serveUrl + 'rebuildSystemCache' }) + }, + // 获取唯一性标识 + getUniqueId() { + // 获取唯一性标识 + return request.get({ url: this.serveUrl + 'getUniqueId' }) + } + } +) + +// 模块 +export const module = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'module' + '/' +}) diff --git a/src/modules/costMode/components/supplierInformationComponents.vue b/src/modules/costMode/components/supplierInformationComponents.vue new file mode 100644 index 0000000..05f9f8a --- /dev/null +++ b/src/modules/costMode/components/supplierInformationComponents.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/src/modules/productManagement/api/index.ts b/src/modules/productManagement/api/index.ts new file mode 100644 index 0000000..e114ec1 --- /dev/null +++ b/src/modules/productManagement/api/index.ts @@ -0,0 +1,126 @@ +import { COMMON_METHOD } from '@/constant/common' +import request from '@/config/axios' + +const moduleName = 'productManagement' + +// 系统参数 +// export const param = Object.assign({}, COMMON_METHOD, { +// serveUrl: '/' + moduleName + '/' + 'param' + '/' +// }) + +// 供应商管理 +// export const supplierInformation = { +// serveUrl: '/' + moduleName + '/' + 'supplierInformation' + '/', + +// page(params) { +// return request.get({ url: this.serveUrl + 'page', params }) +// }, +// get(id) { +// return request.get({ url: this.serveUrl + id }) +// } +// } + +// 供应商管理 +export const supplierInformation = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'supplierInformation' + '/' +}) + +// 厂商产品管理 +export const supplierProducts = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'supplierProducts' + '/' +}) + +// 公司产品 +export const companyProducts = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'companyProducts' + '/' +}) +// 个人产品 +export const personProducts = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'personProducts' + '/' +}) +// 供应商产品型号 +export const supplierProductModel = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'supplierProductModel' + '/', + addModel(params) { + return request.post({ url: this.serveUrl + 'addModel', data: params }) + }, + modifyModel(params) { + return request.put({ url: this.serveUrl + 'modifyModel', data: params }) + }, + getModelDetails(modelId) { + return request.get({ url: this.serveUrl + 'getModelDetails/' + modelId }) + } +}) +// 公司产品型号 +export const companyProductModel = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'companyProductModel' + '/', + addModel(params) { + return request.post({ url: this.serveUrl + 'addModel', data: params }) + }, + modifyModel(params) { + return request.put({ url: this.serveUrl + 'modifyModel', data: params }) + }, + getModelDetails(modelId) { + return request.get({ url: this.serveUrl + 'getModelDetails/' + modelId }) + } +}) +// 个人产品型号 +export const personProductModel = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'personProductModel' + '/', + addModel(params) { + return request.post({ url: this.serveUrl + 'addModel', data: params }) + }, + modifyModel(params) { + return request.put({ url: this.serveUrl + 'modifyModel', data: params }) + }, + getModelDetails(modelId) { + return request.get({ url: this.serveUrl + 'getModelDetails/' + modelId }) + } +}) +// 产品型号管理 +export const productModelTemplate = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'productModelTemplate' + '/' +}) +// 产品型号规格管理 +export const productModelTemplateDetails = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'productModelTemplateDetails' + '/', + + addList(params) { + return request.post({ url: this.serveUrl + 'addList', data: params }) + }, + modifyList(params) { + return request.put({ url: this.serveUrl + 'modifyList', data: params }) + } + +}) + + + + + +// 用户设置 +export const userProfile = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'userProfile' + '/' +}) + +// 系统管理 +export const systemManage = Object.assign( + {}, + { + serveUrl: '/' + moduleName + '/' + 'systemManage' + '/', + // 重建系统缓存 + rebuildSystemCache() { + return request.put({ url: this.serveUrl + 'rebuildSystemCache' }) + }, + // 获取唯一性标识 + getUniqueId() { + // 获取唯一性标识 + return request.get({ url: this.serveUrl + 'getUniqueId' }) + } + } +) + +// 模块 +export const module = Object.assign({}, COMMON_METHOD, { + serveUrl: '/' + moduleName + '/' + 'module' + '/' +}) diff --git a/src/modules/productManagement/components/productModelComponents.vue b/src/modules/productManagement/components/productModelComponents.vue new file mode 100644 index 0000000..2997a73 --- /dev/null +++ b/src/modules/productManagement/components/productModelComponents.vue @@ -0,0 +1,251 @@ + + + + + diff --git a/src/modules/productManagement/components/productModelSelectComponents.vue b/src/modules/productManagement/components/productModelSelectComponents.vue new file mode 100644 index 0000000..1821f4e --- /dev/null +++ b/src/modules/productManagement/components/productModelSelectComponents.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/src/modules/productManagement/components/productModelTemplateComponents.vue b/src/modules/productManagement/components/productModelTemplateComponents.vue new file mode 100644 index 0000000..552fe73 --- /dev/null +++ b/src/modules/productManagement/components/productModelTemplateComponents.vue @@ -0,0 +1,220 @@ + + + + + diff --git a/src/modules/productManagement/components/supplierInformationComponents.vue b/src/modules/productManagement/components/supplierInformationComponents.vue new file mode 100644 index 0000000..746b415 --- /dev/null +++ b/src/modules/productManagement/components/supplierInformationComponents.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/src/modules/productManagement/view/companyProducts/index.vue b/src/modules/productManagement/view/companyProducts/index.vue new file mode 100644 index 0000000..9e1821b --- /dev/null +++ b/src/modules/productManagement/view/companyProducts/index.vue @@ -0,0 +1,209 @@ + + + diff --git a/src/modules/productManagement/view/personProducts/index.vue b/src/modules/productManagement/view/personProducts/index.vue new file mode 100644 index 0000000..874408f --- /dev/null +++ b/src/modules/productManagement/view/personProducts/index.vue @@ -0,0 +1,208 @@ + + + diff --git a/src/modules/productManagement/view/productModelTemplate/index.vue b/src/modules/productManagement/view/productModelTemplate/index.vue new file mode 100644 index 0000000..94d6ad8 --- /dev/null +++ b/src/modules/productManagement/view/productModelTemplate/index.vue @@ -0,0 +1,167 @@ + + + diff --git a/src/modules/productManagement/view/supplierInformation/add.vue b/src/modules/productManagement/view/supplierInformation/add.vue new file mode 100644 index 0000000..5dfc8c7 --- /dev/null +++ b/src/modules/productManagement/view/supplierInformation/add.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/modules/productManagement/view/supplierInformation/index.vue b/src/modules/productManagement/view/supplierInformation/index.vue new file mode 100644 index 0000000..ab6351c --- /dev/null +++ b/src/modules/productManagement/view/supplierInformation/index.vue @@ -0,0 +1,148 @@ + + + diff --git a/src/modules/productManagement/view/supplierInformation/modify.vue b/src/modules/productManagement/view/supplierInformation/modify.vue new file mode 100644 index 0000000..bfbb9e4 --- /dev/null +++ b/src/modules/productManagement/view/supplierInformation/modify.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/modules/productManagement/view/supplierInformation/view.vue b/src/modules/productManagement/view/supplierInformation/view.vue new file mode 100644 index 0000000..fc869e9 --- /dev/null +++ b/src/modules/productManagement/view/supplierInformation/view.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/src/modules/productManagement/view/supplierProducts/index.vue b/src/modules/productManagement/view/supplierProducts/index.vue new file mode 100644 index 0000000..6453d2e --- /dev/null +++ b/src/modules/productManagement/view/supplierProducts/index.vue @@ -0,0 +1,220 @@ + + + diff --git a/vite.config.ts b/vite.config.ts index 827e597..1489694 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -112,7 +112,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { } }, server: { - port: 4000, + port: 3100, proxy: { // 选项写法 '/base': {