diff --git a/.env.dev b/.env.dev index bcb46e7..e61740b 100644 --- a/.env.dev +++ b/.env.dev @@ -12,8 +12,8 @@ VITE_ROUTER_BASE=/ VITE_ROUTER_HISTORY=hash # api -#VITE_API_BASIC=https://api.hailin-keji.com -VITE_API_BASIC=http://10.10.1.6:8060 +VITE_API_BASIC=https://api.hailin-keji.com +# VITE_API_BASIC=http://10.10.1.6:8060 VITE_API_HTTP=/api/v1/ # storage VITE_STORAGE_NAMESPACE = gin-admin_local_ diff --git a/src/components/GxUpload/index.vue b/src/components/GxUpload/index.vue index 0e9516f..9cd39bd 100644 --- a/src/components/GxUpload/index.vue +++ b/src/components/GxUpload/index.vue @@ -53,7 +53,6 @@ const uploadUrl = config('http.apiBasic') + '/api/v1/upload' const fileList = ref([]); // 初始化文件列表 onMounted(() => { - console.log(' props.modelValue', props.modelValue) fileList.value = props.modelValue.map(url => ({ uid: `preview-${Date.now()}-${Math.random()}`, name: url.substring(url.lastIndexOf('/') + 1), diff --git a/src/views/dynamic/companyNews/components/EditDialog.vue b/src/views/dynamic/companyNews/components/EditDialog.vue index b80ac0a..8423659 100644 --- a/src/views/dynamic/companyNews/components/EditDialog.vue +++ b/src/views/dynamic/companyNews/components/EditDialog.vue @@ -103,7 +103,7 @@ const imgChange = (value) => { function handleCreate() { showModal({ type: 'create', - title: '添加公司动态', + title: '添加', }) formData.value.status = 'enabled' } diff --git a/src/views/dynamic/companyNews/index.vue b/src/views/dynamic/companyNews/index.vue index eb8da5d..5e63df6 100644 --- a/src/views/dynamic/companyNews/index.vue +++ b/src/views/dynamic/companyNews/index.vue @@ -39,7 +39,7 @@ - 新增动态 + 新增 { function handleCreate() { showModal({ type: 'create', - title: '添加公司动态', + title: '添加', }) formData.value.status = 'enabled' } diff --git a/src/views/dynamic/mediaReports/index.vue b/src/views/dynamic/mediaReports/index.vue index 59c8829..2704265 100644 --- a/src/views/dynamic/mediaReports/index.vue +++ b/src/views/dynamic/mediaReports/index.vue @@ -39,7 +39,7 @@ - 新增动态 + 新增 { function handleCreate() { showModal({ type: 'create', - title: '添加公司动态', + title: '添加', }) formData.value.status = 'enabled' } diff --git a/src/views/dynamic/videoCenter/index.vue b/src/views/dynamic/videoCenter/index.vue index eb3e500..561dae4 100644 --- a/src/views/dynamic/videoCenter/index.vue +++ b/src/views/dynamic/videoCenter/index.vue @@ -39,7 +39,7 @@ - 新增动态 + 新增 -
+ diff --git a/src/views/imgMgt/about/components/EditDialog.vue b/src/views/imgMgt/about/components/EditDialog.vue index 3c31c71..8ec99c9 100644 --- a/src/views/imgMgt/about/components/EditDialog.vue +++ b/src/views/imgMgt/about/components/EditDialog.vue @@ -74,7 +74,7 @@ function handleCreate() { showModal({ type: 'create', // 80对应about - title: '添加公司动态', + title: '添加', }) formData.value.status = 'enabled' } diff --git a/src/views/imgMgt/about/index.vue b/src/views/imgMgt/about/index.vue index ce727e3..8c38efc 100644 --- a/src/views/imgMgt/about/index.vue +++ b/src/views/imgMgt/about/index.vue @@ -34,14 +34,14 @@ - + diff --git a/src/views/imgMgt/corporateHonor/components/EditDialog.vue b/src/views/imgMgt/corporateHonor/components/EditDialog.vue index 3b2c135..9737fb4 100644 --- a/src/views/imgMgt/corporateHonor/components/EditDialog.vue +++ b/src/views/imgMgt/corporateHonor/components/EditDialog.vue @@ -74,7 +74,7 @@ function handleCreate() { showModal({ type: 'create', // 80对应about - title: '添加公司动态', + title: '添加', }) formData.value.status = 'enabled' } diff --git a/src/views/imgMgt/corporateHonor/index.vue b/src/views/imgMgt/corporateHonor/index.vue index 162677a..a89763d 100644 --- a/src/views/imgMgt/corporateHonor/index.vue +++ b/src/views/imgMgt/corporateHonor/index.vue @@ -39,7 +39,7 @@ - 新增动态 + 新增 - 新增动态 + 新增 - 新增动态 + 新增 - 新增动态 + 新增 - 新增动态 + 新增 { function handleCreate() { showModal({ type: 'create', - title: '添加公司动态', + title: '添加', }) formData.value.status = 'enabled' } diff --git a/src/views/importantEvents/index.vue b/src/views/importantEvents/index.vue index b9264f8..21715fb 100644 --- a/src/views/importantEvents/index.vue +++ b/src/views/importantEvents/index.vue @@ -39,7 +39,7 @@ - 新增动态 + 新增 - + style="width: 100%" tree-default-expand-all/> --> + - + @@ -139,13 +142,13 @@ const targetList = ref([]) const images = ref([]) const contentImage = ref([]) const childOpen = ref(false) - +const categoryIDs=[''] const activeKey = ref('1') formRules.value = { title: { required: true, message: '请输入产品类别名称' }, code: { required: true, message: '请输入产品名称' }, categoryIDs: { required: true, message: '请选择产品类别', trigger: 'change' }, - compose: { required: true, message: '请选择产品适用对象', trigger: 'change' }, + compose: { required: false, message: '请选择产品适用对象'}, feature: [{ required: true, message: '请输入产品功能特点', trigger: 'change' }], // feature: [{ required: true, message: '请输入产品功能特点' }], standard: [{ required: true, message: '请输入产品标准' }], @@ -183,7 +186,7 @@ function handleCreate() { // 初始化所有字段 formData.value = { title: '', - categoryIDs:'', + categoryIDs: [], compose: '', target: '', feature: [{ @@ -226,7 +229,7 @@ const handleCombinedOk = () => { * 编辑 */ async function handleEdit(record = {}) { - initData() + initData() showModal({ type: 'edit', title: t('pages.system.user.edit'), @@ -238,9 +241,8 @@ async function handleEdit(record = {}) { } formData.value = { ...data, - categoryIDs:data.categoryID, - categoryID:data.categoryID, - categoryRootID:data.categoryRootID, + categoryIDs: data.categoryID, + categoryRootID: data.categoryRootID, standard: data.standard || [{ label: '', val: '', @@ -252,7 +254,7 @@ async function handleEdit(record = {}) { data: [] }], // images:data.images || [''], - mainImage: data.images ? data.images.map(item=>config('http.apiBasic')+item):[''], + mainImage: data.images ? data.images.map(item => config('http.apiBasic') + item) : [''], } } @@ -266,8 +268,8 @@ function handleOk() { showLoading() const params = { ...values, - categoryID:formData.value.categoryID, - categoryRootID:formData.value.categoryRootID, + categoryID: formData.value.categoryIDs, + categoryRootID: formData.value.categoryRootID, standard: formData.value.standard || [{ label: '', @@ -276,8 +278,9 @@ function handleOk() { prx: '', }], feature: formData.value.feature, - images: formData.value.mainImage?formData.value.mainImage.map(item=>spliceUrl(item)):[''], + images: formData.value.mainImage ? formData.value.mainImage.map(item => spliceUrl(item)) : [''], } + console.log(params) let result = null switch (modal.value.type) { case 'create': @@ -366,16 +369,17 @@ const findNodePath = (tree, value, path = []) => { // 获取节点是否是叶子节点 const isLeafNode = (id) => { const node = findNodeById(categoryList.value, id); - if(node.children.length>0) return false; + if (node.children.length > 0) return false; else return true }; +//根据Id // 根据ID查找节点 const findNodeById = (tree, value) => { for (const node of tree) { - if (node.value === value) return node; - if(node.children){ - const found=findNodeById(node.children,value) - if(found) return found; + if (node.value == value) return node.value; + if (node.children) { + const found = findNodeById(node.children, value) + if (found) return found.value; } } return null; @@ -383,20 +387,45 @@ const findNodeById = (tree, value) => { // 处理选择事件 const handleTreeSelectChange = (value) => { // 验证是否叶子节点 - if (!isLeafNode(value)) { - message.warning('只能选择最后一级节点'); - formData.value.categoryID = null; // 清除非叶子选择 - return; - } - if (!value) return; + // if (!isLeafNode(value)) { + // message.warning('只能选择最后一级节点'); + // formData.value.categoryID = null; // 清除非叶子选择 + // return; + // } + // if (!value) return; const pathIds = findNodePath(categoryList.value, value); if (pathIds) { console.log('选中的路径ID数组:', pathIds); // 实际使用中,此处可提交 pathIds 到后端或进行其他操作 - formData.value.categoryID=pathIds[1] - formData.value.categoryRootID=pathIds[0] + formData.value.categoryID = pathIds[1] + formData.value.categoryRootID = pathIds[0] } }; +// 递归查找父节点 key 的函数 +const getParentKey = (key, tree) => { + for (const node of tree) { + if (node.children) { + if (node.children.some(child => child.value === key)) { + return node.value; // 返回直接父节点 key + } + const parentKey = getParentKey(key, node.children); + if (parentKey) return parentKey; + } + } + return null; +}; + +// 处理选择变化 +const handleChange = (selectedKeys) => { + if (selectedKeys.length > 0) { + const lastSelectedKey = selectedKeys[selectedKeys.length - 1]; + const parentKey = getParentKey(lastSelectedKey, categoryList.value); + + console.log('选中的父级值:', parentKey); + formData.value.categoryRootID=parentKey + // 使用父级值做其他操作... + } +}; diff --git a/src/views/product/index.vue b/src/views/product/index.vue index 9fbcd4e..af00da3 100644 --- a/src/views/product/index.vue +++ b/src/views/product/index.vue @@ -3,11 +3,11 @@