guoyuji
2024-10-23 19b9d7966ba986d788463af7784e274263648aa7
上传价格计算查询功能与删除功能
7个文件已修改
1个文件已添加
231 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/router/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/glassPrice/GlassPrice.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/glassPrice/GlassPriceList.vue 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/glassPrice/GlassPriceSet.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/glassPrice/ProducePriceCompute.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/sd/GlassPriceBasicController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/GlassPriceBasicService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/router/index.js
@@ -100,6 +100,11 @@
              component: () => import('../views/sd/glassPrice/GlassPriceSet.vue')
            },
            {
              path: 'glassPriceList',
              name: 'glassPriceList',
              component: () => import('../views/sd/glassPrice/GlassPriceList.vue')
            },
            {
              name: 'GlassPrice1',
              path: '',
              redirect:'/main/glassPrice/producePriceCompute'
north-glass-erp/northglass-erp/src/views/sd/glassPrice/GlassPrice.vue
@@ -22,6 +22,7 @@
      <el-breadcrumb :separator-icon="ArrowRight">
        <el-breadcrumb-item @click="changeRouter(1)" :class="indexFlag===1?'indexTag':''" :to="{ path: '/main/glassPrice/producePriceCompute' }">{{'玻璃报价'}}</el-breadcrumb-item>
        <el-breadcrumb-item @click="changeRouter(2)" :class="indexFlag===2?'indexTag':''" :to="{ path: '/main/glassPrice/glassPriceSet' }">{{'价格设置'}}</el-breadcrumb-item>
        <el-breadcrumb-item @click="changeRouter(3)" :class="indexFlag===3?'indexTag':''" :to="{ path: '/main/glassPrice/glassPriceList' }">{{'价格列表'}}</el-breadcrumb-item>
        <!--       <el-breadcrumb-item :to="{ path: '/main/product/test' }">测试</el-breadcrumb-item>-->
        <!--       <el-breadcrumb-item :to="{ path: '/main/product/testSort11' }">测试</el-breadcrumb-item>-->
        <el-breadcrumb-item v-show="false"  />
north-glass-erp/northglass-erp/src/views/sd/glassPrice/GlassPriceList.vue
New file
@@ -0,0 +1,153 @@
<script setup>
import {onMounted, reactive, ref} from "vue"
import {useI18n} from "vue-i18n";
import {changeFilterEvent, filterChanged} from "@/hook";
import {useRouter,useRoute} from "vue-router"
import request from "@/utils/request";
import {ElMessage, ElMessageBox} from "element-plus";
const router = useRouter()
const route = useRoute()
const { t } = useI18n()
const xGrid = ref()
const gridOptions = reactive({
  loading:false,
  showHeaderOverflow: false,
  showFooterOverflow: false,
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮
  //virtualScroll: true, // 开启虚拟滚动功能
  id: 'glassPriceList',
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  showOverflow:true,
  columnConfig: {
    resizable: true,
    useKey: true
  },
  filterConfig: {   //筛选配置项
    //remote: true  //远端筛选
  },
  customConfig: {
    storage: true
  },
  mouseConfig:{selected: true},//鼠标选中
  keyboardConfig:{
    isArrow: true,
    isDel: true,
    isEnter: true,
    isTab: true,
    isEdit: true,
    isChecked: true
  },
  editConfig: {
    trigger: 'dblclick',
    mode: 'cell',
    showStatus: true,
    showIcon:false
  },//表头参数
  columns:[
    {title: t('basicData.operate'), width: 110, slots: { default: 'button_slot' },fixed:"left",},
    {type: 'seq',fixed:"left", title: t('basicData.Number'), width: 80 },
    {field: 'type',  title: '类型',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged},
    {field: 'name',  title: '名称',editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged},
    {field: 'price',  title: '价格' ,editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged},
    {field: 'createTime',  title: '创建时间',editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged}
  ],
  toolbarConfig: {
    zoom: true,
    custom: true
  }
})
onMounted(() => {
  request.post('/glassPriceBasic/searchGlassPrice').then(res => {
    xGrid.value.reloadData(res.data)
  })
})
const getTableRow =  (row,type) => {
  switch (type) {
    case 'edit': {
      ElMessageBox.prompt( '', {
        confirmButtonText: t('basicData.save'),
        cancelButtonText: t('basicData.cancelButtonText'),
        inputPattern:/^.{1,20}$/,
        inputErrorMessage: t('components.message')
      }).then(({ value }) => {
        alert(value)
      })
      break
    }
    case 'delete': {
      request.post(`/glassPriceBasic/deleteGlassPriceById/${row.id}`).then((res) => {
        if(res.code==200){
          ElMessage.success(t('searchOrder.msgDeleteSuccess'))
          router.push({path:'/main/glassPrice/glassPriceList',query:{random:Math.random()}})
        }else{
          ElMessage.warning(t('searchOrder.msgDeleteFail'))
        }
      })
      break
    }
  }
}
</script>
<template>
  <div id="main-div">
    <vxe-grid
        height="100%"
        class="mytable-scrollbar"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
    >
      <template #num1_filter="{ column, $panel }">
        <div>
          <div v-for="(option, index) in column.filters" :key="index">
            <input type="text"
                   v-model="option.data"
                   @keyup.enter.native="$panel.confirmFilter()"
                   @input="changeFilterEvent($event, option, $panel)"/>
          </div>
        </div>
      </template>
      <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>
  </div>
</template>
<style scoped>
#main-div{
  width: 100%;
  height: 100%;
}
</style>
north-glass-erp/northglass-erp/src/views/sd/glassPrice/GlassPriceSet.vue
@@ -5,6 +5,7 @@
import {onMounted, ref} from "vue";
import request from "@/utils/request";
import {ElMessage} from "element-plus";
import {useRouter,useRoute} from "vue-router"
let BasicData = ref({
  stuffColor:null,
  stuffCraft:null,
@@ -25,6 +26,8 @@
})
let tabsValue = ref(1)
const router = useRouter()
const route = useRoute()
onMounted( async () => {
  await request.get(`/basicData/BasicDataByType/product`).then((res) => {
@@ -47,6 +50,7 @@
  request.post(`/glassPriceBasic/save`,value).then((res) => {
    if(res.code==='200' && res.data===true){
      ElMessage.success("数据保存成功")
      router.push({path:'/main/glassPrice/glassPriceList'})
    }else{
      ElMessage.warning("此膜系已经存在,请重新选择")
    }
north-glass-erp/northglass-erp/src/views/sd/glassPrice/ProducePriceCompute.vue
@@ -20,31 +20,11 @@
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮
  //virtualScroll: true, // 开启虚拟滚动功能
  id: 'CreateOrder',
  id: 'CreateOrder123',
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  showOverflow:true,
  menuConfig: {
    body: {
      options: [
        [
          { code: 'addRow', name: t('basicData.add'), prefixIcon: 'vxe-icon-square-plus', visible: true, disabled: false },
          { code: 'deleteRow', name: t('basicData.delete'), prefixIcon: 'vxe-icon-delete', visible: true, disabled: false },
          { code: 'copyChecked', name: t('basicData.selectSame'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false },
          { code: 'copyAll', name: t('basicData.sameAfterwards'), prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false },
          { code: 'clearChecked', name: t('basicData.clearSelection'), prefixIcon: 'vxe-icon-indicator', visible: true, disabled: false },
          { code: 'computedMoney', name: t('basicData.calculateAmount'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: true },
          { code: 'incrementalAll', name: t('basicData.incrementalAll'), prefixIcon: 'vxe-icon-feedback', visible: true, disabled: false },
          { code: 'incrementalChecked', name: t('basicData.incrementalChecked'), prefixIcon: 'vxe-icon-copy', visible: true, disabled: false },
          { code: 'errorArea', name: t('basicData.errorSettlementArea'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: false },
          { code: 'otherMoney', name: t('basicData.otherAmounts'), prefixIcon: 'vxe-icon-chart-bar-x', visible: true, disabled: false },
          { code: 'sizeCheck', name: t('basicData.sizeReview'), prefixIcon: 'vxe-icon-eye-fill', visible: true, disabled: false },
          { code: 'updateOrderId', name: '修改订单号', prefixIcon: 'vxe-icon-eye-fill', visible: true, disabled: false }
        ]
      ]
    }
  },
  columnConfig: {
    resizable: true,
    useKey: true
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
@@ -744,9 +744,9 @@
  //启用表格拖动选中
  addListener(xGrid.value,gridOptions)
  const productData = JSON.parse(route.query.produceList)
  if (typeof productData !== 'undefined' || productData !== null || productData !== '' || productData !== '\n' || productData !== '\r'){
    xGrid.value.insertAt(productData)
  let productData = route.query.produceList
  if (!(typeof productData === 'undefined' || productData == null || productData === '' || productData === '\n' || productData === '\r')){
    xGrid.value.insertAt(JSON.parse(productData))
  }
  const str = route.query.orderId || history.state.orderId
north-glass-erp/src/main/java/com/example/erp/controller/sd/GlassPriceBasicController.java
@@ -1,6 +1,7 @@
package com.example.erp.controller.sd;
import com.example.erp.common.Result;
import com.example.erp.entity.sd.GlassPriceBasic;
import com.example.erp.service.sd.GlassPriceBasicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -35,4 +36,24 @@
        return Result.seccess(glassPriceBasicService.glassPriceComputed(productId));
    }
    @ApiOperation("玻璃价格查询")
    @PostMapping("/searchGlassPrice")
    public Result searchGlassPrice(){
        return Result.seccess(glassPriceBasicService.searchGlassPrice());
    }
    @ApiOperation("玻璃价格修改")
    @PostMapping("/updateGlassPriceById")
    public Result updateGlassPriceById(@RequestBody GlassPriceBasic glassPriceBasic){
        return Result.seccess(glassPriceBasicService.updateGlassPriceById(glassPriceBasic));
    }
    @ApiOperation("玻璃价格删除")
    @PostMapping("/deleteGlassPriceById/{id}")
    public Result deleteGlassPriceById(@PathVariable String id){
        return Result.seccess(glassPriceBasicService.deleteGlassPriceById(id));
    }
}
north-glass-erp/src/main/java/com/example/erp/service/sd/GlassPriceBasicService.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.example.erp.entity.sd.GlassPriceBasic;
import com.example.erp.entity.sd.ProductDetail;
import com.example.erp.mapper.sd.GlassPriceBasicMapper;
@@ -84,8 +85,24 @@
                return;
            }
            money[0] += glassPriceBasic.getPrice();
        });
        return money[0];
    }
    public List<GlassPriceBasic> searchGlassPrice() {
        return glassPriceBasicMapper.selectList(null);
    }
    public Boolean updateGlassPriceById(GlassPriceBasic glassPriceBasic) {
        return glassPriceBasicMapper.update(
                null,
                new LambdaUpdateWrapper<>(GlassPriceBasic.class)
                        .setSql("price = " + glassPriceBasic.getPrice())
                        .eq(GlassPriceBasic::getId, glassPriceBasic.getId())
                )>0;
    }
    public Boolean deleteGlassPriceById(String id) {
        return glassPriceBasicMapper.deleteById(id)>0;
    }
}