| | |
| | | <script setup> |
| | | import {computed, onMounted, reactive, ref, watch} from "vue" |
| | | import {computed, onMounted, reactive, ref, watch,h} from "vue" |
| | | import {filterChanged} from "@/hook" |
| | | import {useI18n} from "vue-i18n" |
| | | import {ElMessage, ElMessageBox,} from "element-plus" |
| | | import {ElInput, ElMessage, ElMessageBox,} from "element-plus" |
| | | import request from "@/utils/request" |
| | | import {useRouter,useRoute} from "vue-router" |
| | | const emits = defineEmits(['addNewCustomColumn','deleteCustomColumn']) |
| | | const { t } = useI18n() |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | |
| | | {'code': 'add', 'name': t('basicData.insert'),status: 'primary'}, |
| | | {'code': 'delete', 'name': t('basicData.delete'),status: 'primary'} |
| | | ], |
| | | slots: { |
| | | tools: 'toolbar_buttons' |
| | | }, |
| | | |
| | | |
| | | // import: false, |
| | | // export: true, |
| | | // print: true, |
| | | // zoom: true, |
| | | // custom: true |
| | | } |
| | | , |
| | | //table body实际数据 |
| | |
| | | ElMessage.warning(t('components.pleaseClickToSelectARowFirst')) |
| | | return |
| | | } |
| | | deleteColum(rowClickIndex.value.id) |
| | | deleteColum(rowClickIndex.value) |
| | | rowClickIndex.value = null |
| | | break |
| | | } |
| | |
| | | }) |
| | | return count.toFixed(2)==='NaN' ? null : parseFloat(count.toFixed(2)) |
| | | } |
| | | let radio1 = ref(1) |
| | | |
| | | //用于接收父组件参数 |
| | | let prop = defineProps({ |
| | | otherMoney:{} |
| | | }) |
| | | onMounted(()=>{ |
| | | console.log(prop.otherMoney) |
| | | if(Object.keys(prop.otherMoney).length === 0){ |
| | | return |
| | | } |
| | | xGrid.value.reloadData(prop.otherMoney.filter(item => item.column.indexOf('M')>-1)) |
| | | xGrid.value.reloadData(prop.otherMoney.filter(item => item.column===null || item.column.startsWith('M'))) |
| | | }) |
| | | watch(prop,(newVal)=>{ |
| | | console.log(prop.otherMoney) |
| | | if(Object.keys(prop.otherMoney).length === 0){ |
| | | return |
| | | } |
| | | xGrid.value.reloadData(prop.otherMoney.filter(item => item.column.indexOf('M')>-1)) |
| | | xGrid.value.reloadData(prop.otherMoney.filter(item => item.column===null || item.column.startsWith('M'))) |
| | | }) |
| | | |
| | | const countAmount = (row) => { |
| | |
| | | defineExpose({ |
| | | validate |
| | | }) |
| | | const state = reactive({ |
| | | alias: null, |
| | | price: null, |
| | | quantity: null, |
| | | }) |
| | | |
| | | |
| | | const vNode = () => { |
| | | return h('div', {}, [ |
| | | h('div', { style: 'margin-bottom: 10px;' }, [ |
| | | h('div', {}, '列名'), |
| | | h(ElInput, { |
| | | modelValue: state.alias, |
| | | 'onUpdate:modelValue': ($event) => { |
| | | state.alias = $event; |
| | | }, |
| | | }), |
| | | ]), |
| | | h('div', {}, [ |
| | | h('div', {}, '单价'), |
| | | h(ElInput, { |
| | | modelValue: state.price, |
| | | 'onUpdate:modelValue': ($event) => { |
| | | state.price = $event; |
| | | }, |
| | | }), |
| | | ]), |
| | | h('div', {}, [ |
| | | h('div', {}, '数量'), |
| | | h(ElInput, { |
| | | modelValue: state.quantity, |
| | | 'onUpdate:modelValue': ($event) => { |
| | | state.quantity = $event; |
| | | }, |
| | | }), |
| | | ]), |
| | | ]); |
| | | } |
| | | const addColumn = () => { |
| | | ElMessageBox.prompt( t('components.addColumnNames')+':', { |
| | | confirmButtonText: t('basicData.insert'), |
| | | cancelButtonText: t('basicData.cancelButtonText'), |
| | | inputPattern:/^.{1,20}$/, |
| | | inputErrorMessage: t('components.message'), |
| | | }) |
| | | .then(({ value }) => { |
| | | request.post('/basicOtherMoney/save',{alias:value}).then(res=>{ |
| | | if (res.code==='200' && res.data!==false){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | setTimeout(()=>{ |
| | | window.location.reload() |
| | | },1500) |
| | | if(radio1.value===1){ |
| | | ElMessageBox({ |
| | | title: t('components.addColumnNames'), |
| | | message: () => vNode(), |
| | | // 不允许点击遮罩层关闭 |
| | | 'close-on-click-modal': false, |
| | | }).then(() => { |
| | | if(!(/^.{1,20}$/.test(state.alias))){ |
| | | ElMessage.error(t('components.message')) |
| | | return |
| | | } |
| | | if(!(/^(0(\.\d{1,2})?|([1-9]\d{0,4})(\.\d{1,2})?|99999(\.9{1,2})?)$/.test(state.price))){ |
| | | ElMessage.warning(t('basicData.msg.range99999Dec2')) |
| | | return |
| | | } |
| | | if(!(/^[1-9]\d*$/.test(state.quantity))){ |
| | | ElMessage.warning(t('basicData.msg.greater0')) |
| | | return |
| | | } |
| | | |
| | | }else{ |
| | | ElMessage.error(t('basicData.msg.saveFail')) |
| | | } |
| | | }) |
| | | |
| | | emits('addNewCustomColumn', state) |
| | | }) |
| | | }else{ |
| | | ElMessageBox.prompt( t('components.addColumnNames')+':', { |
| | | confirmButtonText: t('basicData.insert'), |
| | | cancelButtonText: t('basicData.cancelButtonText'), |
| | | inputPattern:/^.{1,20}$/, |
| | | inputErrorMessage: t('components.message'), |
| | | }) |
| | | .then(({ value }) => { |
| | | request.post('/basicOtherMoney/save',{alias:value.trim()}).then(res=>{ |
| | | if (res.code==='200' && res.data!==false){ |
| | | ElMessage.success(t('basicData.msg.saveSuccess')) |
| | | setTimeout(()=>{ |
| | | window.location.reload() |
| | | },1500) |
| | | }else{ |
| | | ElMessage.error(t('basicData.msg.saveFail')) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | const deleteColum = (id) => { |
| | | const deleteColum = (row) => { |
| | | ElMessageBox.confirm( |
| | | t('searchOrder.deleteConfirm'), |
| | | 'Warning', |
| | |
| | | } |
| | | ) |
| | | .then(() => { |
| | | request.post(`/basicOtherMoney/deleteById/${id}`,).then(res=>{ |
| | | if (res.code==='200' && res.data!==false){ |
| | | ElMessage.success(t('basicData.msg.deleteSuccess')) |
| | | setTimeout(()=>{ |
| | | window.location.reload() |
| | | },1500) |
| | | }else{ |
| | | ElMessage.error(t('basicData.msg.deleteFail')) |
| | | if(radio1.value===1){ |
| | | if(row.deliveryState ===1 && !row.column){ |
| | | ElMessage.warning('已创建发货单,无法删除') |
| | | return |
| | | } |
| | | }) |
| | | emits('deleteCustomColumn', row.id) |
| | | }else{ |
| | | request.post(`/basicOtherMoney/deleteById/${id}`,).then(res=>{ |
| | | if (res.code==='200' && res.data!==false){ |
| | | ElMessage.success(t('basicData.msg.deleteSuccess')) |
| | | setTimeout(()=>{ |
| | | window.location.reload() |
| | | },1500) |
| | | }else{ |
| | | ElMessage.error(t('basicData.msg.deleteFail')) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | }) |
| | | |
| | | } |
| | |
| | | <template #default="{ row }"> |
| | | <span>{{ countAmount(row) }} </span> |
| | | </template> |
| | | <template #toolbar_buttons> |
| | | <el-select v-model="radio1" placeholder="" style="width: 240px"> |
| | | <el-option |
| | | :label="$t('components.customColumn')" |
| | | :value="1" |
| | | /> |
| | | |
| | | <el-option |
| | | :label="$t('components.systemColumn')" |
| | | :value="2" |
| | | /> |
| | | |
| | | </el-select> |
| | | <!-- <el-radio-group >--> |
| | | <!-- <el-radio :value="1">{{$t('components.customColumn')}}</el-radio>--> |
| | | <!-- <el-radio :label="2">{{}}</el-radio>--> |
| | | <!-- </el-radio-group>--> |
| | | </template> |
| | | |
| | | </vxe-grid> |
| | | |
| | | </div> |
| | |
| | | components:{ |
| | | addNewSignature :'أضف اسم جديد', |
| | | addColumnNames :'أضف اسم العمود', |
| | | customColumn:'自定义列', |
| | | systemColumn:'系统列', |
| | | addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)', |
| | | message :'الرجاء إدخال الأحرف ضمن 20 حرفاً، لايمكن ان يكون فارغاً', |
| | | activeName :'قائمة الأسماء', |
| | | orderHeader :'رأس الطلب', |
| | |
| | | components:{ |
| | | addNewSignature :'Add label name', |
| | | addColumnNames :'New column name', |
| | | customColumn:'自定义列', |
| | | systemColumn:'系统列', |
| | | addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)', |
| | | message :'Please enter a non-empty character with a maximum of 20 characters', |
| | | activeName :'Tag list', |
| | | orderHeader :'Order header', |
| | |
| | | components:{ |
| | | addNewSignature :'라벨명 추가', |
| | | addColumnNames :'열 이름 추가', |
| | | customColumn:'自定义列', |
| | | systemColumn:'系统列', |
| | | addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)', |
| | | message :'공백이 아닌 20자 이내의 문자를 입력하세요', |
| | | activeName :'라벨 목록', |
| | | orderHeader :'주문 상단', |
| | |
| | | components:{ |
| | | addNewSignature :'Добавить имя метки', |
| | | addColumnNames :'Добавление в перечень', |
| | | customColumn:'自定义列', |
| | | systemColumn:'系统列', |
| | | addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)', |
| | | message :'Введите не пустые символы в пределах 20 символов.', |
| | | activeName :'Список меток', |
| | | orderHeader :'Заголовок заказа', |
| | |
| | | components:{ |
| | | addNewSignature :'新增标签名', |
| | | addColumnNames :'新增列名', |
| | | customColumn:'自定义列', |
| | | systemColumn:'系统列', |
| | | addColumnRemark :'(注:若新增系统列,订单未保存时自定义列将清空)', |
| | | message :'请输入20个字符以内的且不为空的字符', |
| | | activeName :'标签列表', |
| | | orderHeader :'订单表头', |
| | |
| | | processAttributeVisible.value = false |
| | | } |
| | | |
| | | const addNewCustomColumn = (column) => { |
| | | |
| | | //先对数组里的column属性进行去重,去除S开头的属性 |
| | | const uniqueColumns = Array.from(new Set(otherMoney.value.filter(item => !(item.column && item.column.startsWith('S'))))); |
| | | const isDuplicate = uniqueColumns.some(item => { |
| | | // 确保item存在且有alias属性 |
| | | if (!item || typeof item.alias !== 'string') { |
| | | return false; |
| | | } |
| | | // 比较时忽略大小写和前后空格 |
| | | return item.alias.trim().toLowerCase() === column.alias.trim(); |
| | | }); |
| | | if(isDuplicate){ |
| | | ElMessage.error('列名存在') |
| | | return |
| | | } |
| | | otherMoney.value.push({ |
| | | "id": null, |
| | | "column": null, |
| | | "alias": column.alias.trim(), |
| | | "quantity": column.quantity, |
| | | "price": column.price, |
| | | "state": true |
| | | }) |
| | | |
| | | } |
| | | |
| | | const deleteCustomColumn = (id) => { |
| | | otherMoney.value= Array.from(new Set(otherMoney.value.filter(item => !(!item.column && item.id===id)))) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <order-other-money |
| | | ref="refOtherMoney" |
| | | :otherMoney="otherMoney" |
| | | @addNewCustomColumn = "addNewCustomColumn" |
| | | @deleteCustomColumn = 'deleteCustomColumn' |
| | | style="width: 100%;height: 100%" /> |
| | | </el-dialog> |
| | | <!--异形导入--> |
| | |
| | | :close-on-click-modal="false" |
| | | :title="$t('order.orderTransfer')" |
| | | destroy-on-close width="500"> |
| | | <order-number-report-transfer :transferData="transferData" @orderNumberTransfer="orderNumberTransfer"/> |
| | | <order-number-report-transfer |
| | | :transferData="transferData" |
| | | @orderNumberTransfer="orderNumberTransfer"/> |
| | | </el-dialog> |
| | | |
| | | <el-dialog id="loadDWG" |
| | |
| | | private Double quantity; |
| | | private Double price; |
| | | private Double money; |
| | | @TableField(select = false,exist= false) |
| | | private String alias; |
| | | private Integer deliveryState; |
| | | private LocalDateTime createTime; |
| | | } |
| | |
| | | private Double quantity; |
| | | private Double price; |
| | | private Double money; |
| | | @TableField(select = false,exist= false) |
| | | private String alias; |
| | | private Integer deliveryState; |
| | | private LocalDateTime createTime; |
| | | } |
| | |
| | | List<OrderDetail> OrderDetails = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("detail")), OrderDetail.class); |
| | | List<OrderOtherMoney> orderOtherMoneyList = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("otherMoney")), OrderOtherMoney.class); |
| | | if(orderOtherMoneyList != null ){ |
| | | orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn().indexOf("M")==0).collect(Collectors.toList()); |
| | | orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn()==null || o.getColumn().indexOf("M")==0).collect(Collectors.toList()); |
| | | } |
| | | |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | |
| | | //先把其他金额副表的金额与数量置0 |
| | | if(orderOtherMoneyList!=null){ |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | orderOtherMoney.setQuantity(0.0); |
| | | if(orderOtherMoney.getColumn()!=null){ |
| | | orderOtherMoney.setQuantity(0.0); |
| | | }else{ |
| | | orderOtherMoney.setMoney(orderOtherMoney.getPrice()*orderOtherMoney.getQuantity()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | List<OrderOtherMoney> orderOtherMoneyList = JSONArray.parseArray(JSONObject.toJSONString(jsonObject.get("otherMoney")), OrderOtherMoney.class); |
| | | |
| | | if(orderOtherMoneyList != null ){ |
| | | orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn().indexOf("M")==0).collect(Collectors.toList()); |
| | | orderOtherMoneyList = orderOtherMoneyList.stream().filter(o -> o.getColumn()==null || o.getColumn().indexOf("M")==0).collect(Collectors.toList()); |
| | | } |
| | | if(orderOtherMoneyList!=null){ |
| | | orderOtherMoneyList.forEach(orderOtherMoney -> { |
| | | orderOtherMoney.setQuantity(0.0); |
| | | if(orderOtherMoney.getColumn()!=null){ |
| | | orderOtherMoney.setQuantity(0.0); |
| | | }else{ |
| | | orderOtherMoney.setMoney(orderOtherMoney.getPrice()*orderOtherMoney.getQuantity()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | a.money, |
| | | a.create_time, |
| | | b.alias, |
| | | b.id |
| | | b.id, |
| | | a.delivery_state |
| | | from basic_other_money as b |
| | | left join order_other_money as a |
| | | on a.`column` = b.`column` and a.order_id = #{orderId} |
| | | where b.`column` like 'M%' and b.state=1 |
| | | |
| | | UNION ALL |
| | | |
| | | -- 查询 order_other_money 表中 column 为空的记录 |
| | | SELECT |
| | | a.order_id, |
| | | null AS `column`, |
| | | a.quantity, |
| | | a.price, |
| | | a.money, |
| | | a.create_time, |
| | | a.alias, -- 使用 order_other_money 表中的别名 |
| | | a.id, |
| | | a.delivery_state |
| | | FROM order_other_money AS a |
| | | WHERE a.order_id = #{orderId} |
| | | AND (a.`column` IS NULL OR a.`column` = '') |
| | | </select> |
| | | |
| | | <select id="selectGrossAmount"> |
| | | select ifnull(sum(money),0) from order_other_money where order_id = #{orderId} |
| | | |
| | | </select> |
| | | |
| | | |