diff --git a/.env.development b/.env.development index 4a874b9..6359576 100644 --- a/.env.development +++ b/.env.development @@ -14,7 +14,7 @@ VITE_APP_BASE_API = 'http://192.168.110.149:8899' # 罗成 # VITE_APP_BASE_API = 'http://192.168.110.188:8899' # 朱银 -VITE_APP_BASE_API = 'http://192.168.110.149:8899' +# VITE_APP_BASE_API = 'http://192.168.110.149:8899' #曾涛 # VITE_APP_BASE_API = 'http://192.168.110.171:8899' diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 7449bde..1b5d412 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -9,7 +9,7 @@ import animate from '@/animate'; import { download as dl } from '@/utils/request'; import { useDict } from '@/utils/dict'; import { getConfigKey, updateConfigByKey } from '@/api/system/config'; -import { parseTime, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'; +import { parseTime, addDateRange, handleTree, selectDictLabel, selectDictLabels,formatPrice } from '@/utils/ruoyi'; import { downloadFile } from '@/utils/useFileDownload'; import { App } from 'vue'; @@ -42,4 +42,5 @@ export default function installPlugin(app: App) { app.config.globalProperties.selectDictLabels = selectDictLabels; app.config.globalProperties.animate = animate; app.config.globalProperties.downloadFile = downloadFile; + app.config.globalProperties.formatPrice = formatPrice; } diff --git a/src/utils/ruoyi.ts b/src/utils/ruoyi.ts index 8efd12c..c92994d 100644 --- a/src/utils/ruoyi.ts +++ b/src/utils/ruoyi.ts @@ -62,7 +62,23 @@ export const addDateRange = (params: any, dateRange: any[], propName?: string) = } return search; }; +// 价格格式化函数 +export const formatPrice = (price, show = true) => { + if ((!show && price == 0) || price == '' || price == undefined || price == null) return ''; + if (!price && price !== 0) return '0.0000'; + // 转换为数字并保留四位小数 + const num = Number(price); + if (isNaN(num)) return '0.0000'; + + const fixedNum = num.toFixed(4); + const [integer, decimal] = fixedNum.split('.'); + + // 千分位处理 + const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ','); + + return `${formattedInteger}.${decimal}`; +}; // 回显数据字典 export const selectDictLabel = (datas: any, value: number | string) => { if (value === undefined) { diff --git a/src/views/contract/bidCost/index.vue b/src/views/contract/bidCost/index.vue index a69eb4c..8df9d45 100644 --- a/src/views/contract/bidCost/index.vue +++ b/src/views/contract/bidCost/index.vue @@ -77,8 +77,8 @@ changePrice(scope.row); } " - :precision="2" - :step="0.1" + :min="0" + :precision="4" :controls="false" v-if="scope.row.quantity && scope.row.quantity != 0" /> @@ -86,7 +86,7 @@ diff --git a/src/views/contract/division/index.vue b/src/views/contract/division/index.vue index 1f085b2..23c50f5 100644 --- a/src/views/contract/division/index.vue +++ b/src/views/contract/division/index.vue @@ -25,7 +25,11 @@ - + + + - + + + + @@ -207,6 +217,7 @@ import { useUserStoreHook } from '@/store/modules/user'; import { getDicts } from '@/api/system/dict/data'; import { Plus } from '@element-plus/icons-vue'; import { FormInstance } from 'element-plus'; +const { proxy } = getCurrentInstance(); import { treeList, sheetList, diff --git a/src/views/contract/limitPrice/index.vue b/src/views/contract/limitPrice/index.vue index 505add3..dce5f23 100644 --- a/src/views/contract/limitPrice/index.vue +++ b/src/views/contract/limitPrice/index.vue @@ -79,18 +79,16 @@ changePrice(scope.row); } " - :precision="2" - :step="0.1" + :min="0" + :precision="4" :controls="false" v-if="scope.row.quantity && scope.row.quantity != 0" /> - + diff --git a/src/views/contract/limitPrice/indexEdit.vue b/src/views/contract/limitPrice/indexEdit.vue index facd683..4665f32 100644 --- a/src/views/contract/limitPrice/indexEdit.vue +++ b/src/views/contract/limitPrice/indexEdit.vue @@ -41,10 +41,14 @@ - - + + + + @@ -70,8 +74,12 @@ diff --git a/src/views/ctr/update/index.vue b/src/views/ctr/update/index.vue index 4908951..d813daf 100644 --- a/src/views/ctr/update/index.vue +++ b/src/views/ctr/update/index.vue @@ -1,79 +1,80 @@ diff --git a/src/views/design/designChange/indexEdit.vue b/src/views/design/designChange/indexEdit.vue index 9e6e857..7e0c7e5 100644 --- a/src/views/design/designChange/indexEdit.vue +++ b/src/views/design/designChange/indexEdit.vue @@ -145,7 +145,13 @@ > - diff --git a/src/views/out/constructionValue/index.vue b/src/views/out/constructionValue/index.vue index b6d49e0..50d0699 100644 --- a/src/views/out/constructionValue/index.vue +++ b/src/views/out/constructionValue/index.vue @@ -39,8 +39,16 @@ - - + + + + + +