| | |
| | | children:[ |
| | | //sd模块 |
| | | { |
| | | path:'orderBasicData', |
| | | name: 'orderBasicData', |
| | | component: () => import('../views/sd/basicData/BasicData.vue'), |
| | | children:[ |
| | | { |
| | | path: 'searchBasicData', |
| | | name: 'searchBasicData', |
| | | component: () => import('../views/sd/basicData/SearchBasicData.vue') |
| | | }, |
| | | { |
| | | name: 'OrderBasicData', |
| | | path: '', |
| | | redirect:'/main/orderBasicData/searchBasicData' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | path: 'product',//产品 |
| | | name: 'product', |
| | | component: () => import('../views/sd/product/Product.vue'), |
New file |
| | |
| | | <script setup> |
| | | import {ArrowLeftBold, ArrowRight, Search} from "@element-plus/icons-vue" |
| | | import {useRouter,useRoute,onBeforeRouteUpdate} from "vue-router" |
| | | import {useI18n} from "vue-i18n" |
| | | const { t } = useI18n() |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | let indexFlag=$ref(1) |
| | | function changeRouter(index){ |
| | | indexFlag=index |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div id="main-div"> |
| | | <div id="div-title"> |
| | | <el-breadcrumb :separator-icon="ArrowRight"> |
| | | <el-breadcrumb-item @click="changeRouter(1)" :class="indexFlag===1?'indexTag':''" :to="{ path: '/main/orderBasicData/searchBasicData' }">基础数据</el-breadcrumb-item> |
| | | <el-breadcrumb-item v-show="false" :to="{ path: '/main/order/orderReport' }">报表</el-breadcrumb-item> |
| | | </el-breadcrumb> |
| | | </div> |
| | | |
| | | <div id="main-body"> |
| | | <router-view :key="route.fullPath" /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | #main-div{ |
| | | width: 99%; |
| | | height: 100%; |
| | | } |
| | | #div-title{ |
| | | height: 2%; |
| | | width: 100%; |
| | | } |
| | | #searchButton{ |
| | | margin-top: -5px; |
| | | margin-left: 1rem; |
| | | } |
| | | #searchButton1{ |
| | | //margin-left: 10rem; |
| | | } |
| | | /*main-body样式*/ |
| | | #main-body{ |
| | | width: 100%; |
| | | height: 95%; |
| | | margin-top: 1%; |
| | | } |
| | | #select{ |
| | | margin-left:0.5rem; |
| | | } |
| | | :deep(.indexTag .el-breadcrumb__inner){ |
| | | color: #5CADFE !important; |
| | | } |
| | | </style> |
New file |
| | |
| | | <script setup> |
| | | import request from "@/utils/request" |
| | | import {onMounted, ref, watch} from "vue"; |
| | | import {useI18n} from "vue-i18n" |
| | | import {ElMessage} from "element-plus" |
| | | import {useRouter,useRoute} from "vue-router" |
| | | const { t } = useI18n() |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | |
| | | |
| | | let basic = ref({ |
| | | basicType : ['',''], |
| | | input:'' |
| | | }) |
| | | let options=ref([ |
| | | { "label": "订单", |
| | | "value": "order", |
| | | "children": [ |
| | | { |
| | | "label": "订单类型", |
| | | "value": "orderType" |
| | | }, |
| | | { |
| | | "label": "订单分类", |
| | | "value": "orderClassify" |
| | | }, |
| | | { |
| | | "label": "商标选项", |
| | | "value": "icon" |
| | | }, |
| | | { |
| | | "label": "包装方式", |
| | | "value": "packType" |
| | | }, |
| | | { |
| | | "label": "铝条方式", |
| | | "value": "alType" |
| | | }, |
| | | { |
| | | "label": "业务员", |
| | | "value": "saleMan" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "label": "产品", |
| | | "value": "product", |
| | | "children": [ |
| | | { |
| | | "label": "材料厚度", |
| | | "value": "stuffThickness" |
| | | }, |
| | | { |
| | | "label": "材料颜色", |
| | | "value": "stuffColor" |
| | | }, |
| | | { |
| | | "label": "工艺属性", |
| | | "value": "stuffCraft" |
| | | }, |
| | | { |
| | | "label": "玻璃位置", |
| | | "value": "stuffPosition" |
| | | }, |
| | | { |
| | | "label": "lowe", |
| | | "value": "stuffLowE" |
| | | }, |
| | | { |
| | | "label": "夹胶厚度", |
| | | "value": "InterlayerThickness" |
| | | }, |
| | | { |
| | | "label": "夹胶类型", |
| | | "value": "InterlayerType" |
| | | }, |
| | | { |
| | | "label": "夹胶颜色", |
| | | "value": "InterlayerColor" |
| | | }, |
| | | { |
| | | "label": "工艺流程", |
| | | "value": "process" |
| | | }, |
| | | { |
| | | "label": "中空厚度", |
| | | "value": "hollowThickness" |
| | | }, |
| | | { |
| | | "label": "充气方式", |
| | | "value": "hollowGasType" |
| | | }, |
| | | { |
| | | "label": "封胶", |
| | | "value": "hollowType" |
| | | }, |
| | | { |
| | | "label": "默认胶深", |
| | | "value": "hollowGlueDepth" |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | "children": [ |
| | | { |
| | | "label": "付款条件", |
| | | "value": "paymentTerms" |
| | | }, |
| | | { |
| | | "label": "收款方式", |
| | | "value": "payMethod" |
| | | } |
| | | ], |
| | | "label": "送货", |
| | | "value": "delivery" |
| | | } |
| | | ]) |
| | | |
| | | let props = defineProps({ |
| | | rowIndex:{ |
| | | Object, |
| | | default: null |
| | | } |
| | | }) |
| | | onMounted(() =>{ |
| | | if(props.rowIndex){ |
| | | basic.value.basicType[0] = props.rowIndex.basicType |
| | | basic.value.basicType[1] = props.rowIndex.basicCategory |
| | | basic.value.input = props.rowIndex.basicName |
| | | } |
| | | }) |
| | | |
| | | const emit = defineEmits(['gaveParent']) |
| | | const saveBasicData = () =>{ |
| | | request.post(`/basicData/addBasicData`, basic.value).then(res => { |
| | | if (res.data) { |
| | | ElMessage.success('保存成功') |
| | | emit('gaveParent', true) |
| | | } |
| | | }) |
| | | } |
| | | const updateBasicData = () =>{ |
| | | let submitArr = props.rowIndex |
| | | submitArr.basicType = basic.value.basicType[0] |
| | | submitArr.basicCategory = basic.value.basicType[1] |
| | | submitArr.basicName = basic.value.input |
| | | request.post(`/basicData/updateBasicData`, submitArr).then(res => { |
| | | if (res.data) { |
| | | ElMessage.success('修改成功') |
| | | emit('gaveParent', true) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | const handleChange = (value) => { |
| | | const filterArr = options.value.filter((item) =>item.value === value[0] |
| | | ).map((item) =>item.children.filter((item) =>item.value === value[1])) |
| | | console.log(filterArr) |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <el-row> |
| | | <el-col :span="4">基础类型:</el-col> |
| | | <el-col :span="12"> |
| | | <el-cascader |
| | | v-model="basic.basicType" |
| | | @change="handleChange" |
| | | :options="options" |
| | | clearable |
| | | placeholder="" |
| | | :disabled="props.rowIndex" |
| | | /> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="4">名称:</el-col> |
| | | <el-col :span="12"> |
| | | <el-input v-model="basic.input"/> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="4"></el-col> |
| | | <el-col :span="12"> |
| | | <el-button v-show="!props.rowIndex" @click="saveBasicData" type="primary">新增</el-button> |
| | | <el-button v-show="props.rowIndex" @click="updateBasicData" type="primary">修改</el-button> |
| | | |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | div{ |
| | | text-align: center; |
| | | } |
| | | .el-row{ |
| | | margin-top: 10px; |
| | | } |
| | | </style> |
New file |
| | |
| | | <script setup> |
| | | import {reactive, ref} from "vue"; |
| | | import {VXETable} from "vxe-table"; |
| | | import {ElMessage} from "element-plus"; |
| | | import request from "@/utils/request" |
| | | import CreateBasicData from "@/views/sd/basicData/CreateBasicData.vue" |
| | | import {useRouter,useRoute} from "vue-router" |
| | | import {useI18n} from "vue-i18n" |
| | | const { t } = useI18n() |
| | | |
| | | let dialogTableVisible = ref(false) |
| | | const router = useRouter() |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮 |
| | | id: 'OrderList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | remote: true |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | }, |
| | | |
| | | //表头参数 |
| | | columns:[ |
| | | {title: t('basicData.operate'), width: 110, slots: { default: 'button_slot' },fixed:"left",}, |
| | | {type: 'seq', title: '序号', width: 80 ,fixed:"left",}, |
| | | {field:'basicName',title: '名称'}, |
| | | {field:'createTime',title: '创建日期'}, |
| | | |
| | | |
| | | ], |
| | | |
| | | //表头按钮 |
| | | toolbarConfig: { |
| | | buttons: [ |
| | | {'code': 'add', 'name': '新增',status: 'primary'}, |
| | | ], |
| | | |
| | | // import: false, |
| | | // export: true, |
| | | // print: true, |
| | | zoom: true, |
| | | custom: true |
| | | }, |
| | | |
| | | footerMethod ({ columns, data }) {//页脚函数 |
| | | return[ |
| | | columns.map((column, columnIndex) => { |
| | | // if (columnIndex === 0) { |
| | | // return t('basicData.total') |
| | | // } |
| | | // if (props.tableProp.footList.includes(column.field)) { |
| | | // return sumNum(data, column.field) |
| | | // } |
| | | return '' |
| | | }) |
| | | ] |
| | | } |
| | | |
| | | }) |
| | | const gridEvents = { |
| | | toolbarButtonClick ({ code }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'add': { |
| | | rowIndex.value = null |
| | | dialogTableVisible.value = true |
| | | break |
| | | } |
| | | |
| | | } |
| | | } |
| | | }, |
| | | menuClick ({ menu, row, column }) { |
| | | const $grid = xGrid.value |
| | | if ($grid) { |
| | | switch (menu.code) { |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | request.get('/basicData/getBasicData').then(res => { |
| | | if(res.code==='200'){ |
| | | xGrid.value.reloadData(res.data) |
| | | } |
| | | }) |
| | | |
| | | const getChildrenFunction = (flag) => { |
| | | if(flag){ |
| | | router.push({ |
| | | path:'/main/orderBasicData/searchBasicData', |
| | | query:{random:Math.random() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let rowIndex = ref(null) |
| | | const getTableRow = (row,type) => { |
| | | switch (type) { |
| | | case 'edit': { |
| | | rowIndex.value = row |
| | | dialogTableVisible.value = true |
| | | break |
| | | } |
| | | case 'delete': { |
| | | request.post(`/basicData/deleteBasicData`,row).then((res) => { |
| | | if(res.code==200){ |
| | | ElMessage.success(t('searchOrder.msgDeleteSuccess')) |
| | | router.push({ |
| | | path:'/main/orderBasicData/searchBasicData', |
| | | query:{random:Math.random() |
| | | } |
| | | }) |
| | | }else{ |
| | | ElMessage.warning(t('searchOrder.msgDeleteFail')) |
| | | } |
| | | }) |
| | | break |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <vxe-grid |
| | | style="width: 40vw;" |
| | | class="mytable-scrollbar" |
| | | max-height="500px" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | > |
| | | <template #button_slot="{ row }"> |
| | | <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">{{ $t('basicData.edit') }}</el-button> |
| | | <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')"> |
| | | <template #reference> |
| | | <el-button link type="primary" size="small">{{ $t('basicData.delete') }}</el-button> |
| | | </template> |
| | | </el-popconfirm> |
| | | </template> |
| | | |
| | | </vxe-grid> |
| | | <el-dialog |
| | | v-model="dialogTableVisible" |
| | | destroy-on-close |
| | | style="width: 30%;height:30% "> |
| | | <create-basic-data :rowIndex="rowIndex" @gaveParent='getChildrenFunction'/> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | package com.example.erp.controller.sd; |
| | | |
| | | import com.example.erp.common.Result; |
| | | import com.example.erp.entity.sd.BasicData; |
| | | import com.example.erp.service.sd.BasicDateService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | public Result getBasicDataByTypeAndChildType(@PathVariable String type,@PathVariable String childType){ |
| | | return Result.seccess(basicDateService.getBasicDataByTypeAndChildType(type,childType)); |
| | | } |
| | | @GetMapping("/getBasicData") |
| | | public Result getBasicData(){ |
| | | return Result.seccess(basicDateService.getBasicData()); |
| | | } |
| | | @GetMapping("/getBasicDataType") |
| | | public Result getBasicDataType(){ |
| | | return Result.seccess(basicDateService.getBasicDataType()); |
| | | } |
| | | |
| | | @PostMapping("addBasicData") |
| | | public Result addBasicData(@RequestBody Map<String,Object> map){ |
| | | return Result.seccess(basicDateService.addBasicData(map)); |
| | | } |
| | | @PostMapping("updateBasicData") |
| | | public Result updateBasicData(@RequestBody BasicData basicData){ |
| | | return Result.seccess(basicDateService.updateBasicData(basicData)); |
| | | } |
| | | |
| | | @PostMapping("deleteBasicData") |
| | | public Result deleteBasicData(@RequestBody BasicData basicData){ |
| | | return Result.seccess(basicDateService.deleteBasicData(basicData)); |
| | | } |
| | | } |
| | |
| | | package com.example.erp.mapper.sd; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.example.erp.entity.sd.BasicData; |
| | | import com.example.erp.entity.sd.Order; |
| | | import com.example.erp.service.sd.BasicDateService; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | public interface BasicDateMapper { |
| | | public interface BasicDateMapper extends BaseMapper<BasicData> { |
| | | |
| | | List<BasicData> getOrderBasicData(String type); |
| | | List<String> getOrderBasicDataType(String type); |
| | | |
| | | List<BasicData> getOrderBasicDataByTypeAndChildType(String type, String childType); |
| | | |
| | | List<BasicData> getBasicData(); |
| | | |
| | | List<BasicData> getBasicDataFirstType(); |
| | | |
| | | List<BasicData> getBasicDataLastType(); |
| | | } |
| | |
| | | return basicDateMapper.getOrderBasicDataByTypeAndChildType(type, childType); |
| | | |
| | | } |
| | | |
| | | public List<BasicData> getBasicData() { |
| | | return basicDateMapper.getBasicData(); |
| | | } |
| | | |
| | | public Object getBasicDataType() { |
| | | List<BasicData> lastType = basicDateMapper.getBasicDataLastType(); |
| | | List<BasicData> firstType= basicDateMapper.getBasicDataFirstType(); |
| | | List<Map<String,Object>> list = new ArrayList<>(); |
| | | if(!firstType.isEmpty()){ |
| | | firstType.forEach(item->{ |
| | | Map<String,Object> map = new HashMap<>(); |
| | | List<Map<String,String>> lastTypeList = new ArrayList<>(); |
| | | lastType.forEach(item1->{ |
| | | Map<String,String> map1 = new HashMap<>(); |
| | | if(Objects.equals(item.getBasicType(), item1.getBasicType())){ |
| | | map1.put("value",item1.getBasicCategory()); |
| | | map1.put("label",item1.getBasicCategory()); |
| | | lastTypeList.add(map1); |
| | | } |
| | | }); |
| | | map.put("children",lastTypeList); |
| | | map.put("value",item.getBasicType()); |
| | | map.put("label",item.getBasicType()); |
| | | list.add(map); |
| | | }); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public boolean addBasicData(Map<String, Object> map) { |
| | | List<String> basicTypeList = (List<String>) map.get("basicType"); |
| | | if(basicTypeList.size()==2){ |
| | | BasicData basicData = new BasicData(); |
| | | basicData.setBasicType(basicTypeList.get(0)); |
| | | basicData.setBasicCategory(basicTypeList.get(1)); |
| | | basicData.setBasicName(map.get("input").toString()); |
| | | basicDateMapper.insert(basicData); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public int deleteBasicData(BasicData basicData) { |
| | | |
| | | return basicDateMapper.deleteById(basicData.getId()); |
| | | } |
| | | |
| | | public int updateBasicData(BasicData basicData) { |
| | | return basicDateMapper.updateById(basicData); |
| | | } |
| | | } |
| | |
| | | group by a.basic_category |
| | | |
| | | </select> |
| | | |
| | | <select id="getBasicData"> |
| | | select * from basic_data |
| | | order by id desc |
| | | </select> |
| | | |
| | | <select id="getBasicDataFirstType"> |
| | | select * from basic_data |
| | | group by basic_type |
| | | </select> |
| | | <select id="getBasicDataLastType"> |
| | | select * from basic_data |
| | | group by basic_category |
| | | </select> |
| | | </mapper> |
| | |
| | | group by a.basic_category |
| | | |
| | | </select> |
| | | |
| | | <select id="getBasicData"> |
| | | select * from basic_data |
| | | order by id desc |
| | | </select> |
| | | |
| | | <select id="getBasicDataFirstType"> |
| | | select * from basic_data |
| | | group by basic_type |
| | | </select> |
| | | <select id="getBasicDataLastType"> |
| | | select * from basic_data |
| | | group by basic_category |
| | | </select> |
| | | </mapper> |