| src/util/mathHandler.js | ●●●●● patch | view | raw | blame | history | |
| src/views/farmplant/farmproductstock.vue | ●●●●● patch | view | raw | blame | history | |
| src/views/farmplant/process.vue | ●●●●● patch | view | raw | blame | history | |
| src/views/land/cs.vue | ●●●●● patch | view | raw | blame | history | |
| src/views/stock/stockmanage.vue | ●●●●● patch | view | raw | blame | history | |
| src/views/stock/stockout.vue | ●●●●● patch | view | raw | blame | history | |
| src/views/wel/index.vue | ●●●●● patch | view | raw | blame | history |
src/util/mathHandler.js
New file @@ -0,0 +1,12 @@ /** * 单位转换,如果大于10000 按1.0W显示 * @param num 需要转化的值 * @returns {*} 转化过的值 */ function fixedNum (num) { return (num > 9999) ? (num / 10000).toFixed(2) + '万' : num } export default { fixedNum } src/views/farmplant/farmproductstock.vue
@@ -40,7 +40,7 @@ <div class="cai">{{ item.strainName }}</div> <div class="area"> 库存量: <span>{{ item.weight>10000?(item.weight/10000).toFixed(2)+"万":item.weight }}</span>公斤 <span>{{ item.weight }}</span>公斤 </div> <div class="btn"> <el-button @@ -346,6 +346,7 @@ import { mapGetters } from "vuex" import { regionData } from 'element-china-area-data' import { click } from 'ol/events/condition' import fixed from "@/util/mathHandler" export default { data () { @@ -1204,6 +1205,9 @@ this.data = data.records.filter((e)=>{ return e.weight !=0 }) this.data.forEach((e)=>{ e.weight = fixed.fixedNum(e.weight) }) this.loading = false // this.selectionClear() }) src/views/farmplant/process.vue
@@ -28,7 +28,7 @@ <div class="cai">{{ item.processName }}</div> <div class="area"> 库存量: <span>{{ item.productInventoryNum>10000?(item.productInventoryNum/10000).toFixed(2)+"万":item.productInventoryNum }}</span>公斤 <span>{{ item.productInventoryNum }}</span>公斤 </div> <div class="area"> 原材料: @@ -265,6 +265,7 @@ } from "@/api/process/process" import { mapGetters } from "vuex" import { regionData } from 'element-china-area-data' import fixed from "@/util/mathHandler" export default { data () { @@ -954,8 +955,11 @@ this.data = data.records.filter((e)=>{ return e.productInventoryNum != 0 }) this.data.forEach((e)=>{ e.productInventoryNum = fixed.fixedNum(e.productInventoryNum) }) this.loading = false this.selectionClear() // this.selectionClear() }) }, }, src/views/land/cs.vue
@@ -80,7 +80,7 @@ <div class="text"> <div class="land-name">{{ item.landName }}</div> <div class="land-area"> <div class="box">{{ item.landArea>10000?(item.landArea/10000).toFixed(2)+"万":item.landArea}} {{ item.dica }}</div> <div class="box">{{ item.landArea}} {{ item.dica }}</div> </div> </div> </div> @@ -93,6 +93,7 @@ import { mapGetters } from "vuex" import { getList } from "@/api/land/land" import landAdd from "./landAdd" import fixed from "@/util/mathHandler" export default { components: { landAdd, @@ -201,6 +202,9 @@ const data = res.data.data this.page.total = data.total this.farmPlanList = data.records this.farmPlanList.forEach((e)=>{ e.landArea = fixed.fixedNum(e.landArea) }) }) }, //进入地图模式 src/views/stock/stockmanage.vue
@@ -76,8 +76,8 @@ </div> <div class="right"> <div class="spec"> <span class="num">{{ item.amount>10000?(item.amount/10000).toFixed(2)+"万":item.amount }}</span >{{ item.dic2 }}<span class="num1"> (共{{ item.cnum>10000?(item.cnum/10000).toFixed(2)+"万":item.cnum }}{{ item.dic1 }})</span> <span class="num">{{ item.amount }}</span >{{ item.dic2 }}<span class="num1"> (共{{ item.cnum }}{{ item.dic1 }})</span> </div> <div class="btn"> <div class="in" @click="modifiedGrades(item)"> @@ -182,6 +182,7 @@ import {getList, getDetail, add, update, remove} from "@/api/stock/stock"; import {add1} from "@/api/stockrecord/stockrecord"; import {mapGetters} from "vuex"; import fixed from "@/util/mathHandler" export default { data() { @@ -1023,6 +1024,10 @@ const data = res.data.data; this.page.total = data.total; this.data = data.records; this.data.forEach((e)=>{ e.amount = fixed.fixedNum(e.amount) e.cnum = fixed.fixedNum(e.cnum) }) this.loading = false; // this.selectionClear(); }); src/views/stock/stockout.vue
@@ -104,6 +104,7 @@ <script> import {getList, getDetail, add, update, remove,Updateout} from "@/api/soldr/soldr"; import {mapGetters} from "vuex"; import fixed from "@/util/mathHandler" export default { data() { @@ -436,6 +437,10 @@ const data = res.data.data; this.page.total = data.total; this.data = data.records; this.data.forEach((e)=>{ e.amount1 = fixed.fixedNum(e.cnum) e.cnum = fixed.fixedNum(e.cnum) }) this.loading = false; // this.selectionClear(); }); src/views/wel/index.vue
@@ -37,13 +37,13 @@ <div class="land-statis"> <div class="land-title">地块总面积</div> <div class="land-num"> <span>{{ landInfo.zarea>10000?(landInfo.zarea/10000).toFixed(2)+"万":landInfo.zarea }}</span> 亩 <span>{{ landInfo.zarea }}</span> 亩 </div> </div> <div class="land-statis"> <div class="land-title">当前种养面积</div> <div class="land-num"> <span>{{ landInfo.sarea>10000?(landInfo.sarea/10000).toFixed(2)+"万":landInfo.sarea }}</span> 亩 <span>{{ landInfo.sarea }}</span> 亩 </div> </div> <div class="land-statis"> @@ -69,7 +69,7 @@ <div class="cai">{{ item.strainName }}</div> <div class="area"> 种植面积: <span>{{ item.area>10000?(item.area/10000).toFixed(2)+"万":item.area }}</span>亩 <span>{{ item.area }}</span>亩 </div> <div class="btn"> <el-button plain size="small" @click="recovery(item)"> @@ -161,7 +161,7 @@ <div class="detail-title">{{ item.name}}</div> <div class="detail-number"> 剩余库存 <span>{{ item.val>10000?(item.val/10000).toFixed(2)+"万":item.val}}</span>公斤 <span>{{ item.val}}</span>公斤 </div> </div> </div> @@ -195,6 +195,7 @@ import plant from "./plant.vue" import farming from "./farming.vue" import stock from "./stock.vue" import fixed from "@/util/mathHandler" export default { components: { recovery, @@ -320,8 +321,11 @@ StockCount () { var that = this StockCount(this.$farmId).then((res) => { that.stockList = res.data.data.filter((e)=>{ that.stockList = res.data.data.filter((e)=>{ return e.val != 0 }) that.stockList.forEach((e)=>{ e.val = fixed.fixedNum(e.val) }) }) }, @@ -331,6 +335,8 @@ selectCount(this.farm.id).then((res) => { var data = res.data.data that.landInfo = data that.landInfo.zarea = fixed.fixedNum(that.landInfo.zarea) that.landInfo.sarea = fixed.fixedNum(that.landInfo.sarea) }) }, handleChange (val) { @@ -343,9 +349,12 @@ } params['tenantId'] = this.userInfo.tenant_id params['farmId'] = this.farm.id getStrainCount(1, 10, Object.assign(params)).then((res) => { getStrainCount(1, 100, Object.assign(params)).then((res) => { const data = res.data.data.records this.farmPlanList = data this.farmPlanList.forEach((e)=>{ e.area = fixed.fixedNum(e.area) }) }) }, //采收 @@ -430,7 +439,6 @@ }, //本年农事操作明细--有参 farmPlantDetails (item) { console.log(item, 11111) const data = { type: item.value, activeName: "tab2",