index.vue 249 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate1">设置推料时间</el-button>
  5. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate">设置允许误差时间</el-button>
  6. <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" style="float: left;" @click="handleTakeEffect">启用</el-button>
  7. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" style="float: left;" @click="handleDisable">禁用</el-button>
  8. <el-button v-if="isRoleEdit" class="success" style="float: left;" @click="handleCheck">校验</el-button>
  9. </div>
  10. <div class="table">
  11. <el-table
  12. :key="table.tableKey"
  13. ref="table"
  14. v-loading="table.listLoading"
  15. element-loading-text="给我一点时间"
  16. :data="table.list"
  17. border
  18. fit
  19. highlight-current-row
  20. style="width: 100%;"
  21. :row-style="rowStyle"
  22. :cell-style="cellStyle"
  23. class="elTable table-fixed"
  24. :max-height="myHeight"
  25. @header-click="headerClick"
  26. @cell-click="cellClick"
  27. @selection-change="handleSelect"
  28. @cell-dblclick="celldblclick"
  29. >
  30. <el-table-column type="selection" width="50" />
  31. <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left" />
  32. <el-table-column label="栏舍名称" min-width="100px" align="center" class-name="small-padding fixed-width" fixed="left">
  33. <template slot-scope="scope">
  34. <span>{{ scope.row.barname }}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column :key="2" label="推料车名称" min-width="70px" align="center">
  38. <template slot-scope="scope">
  39. <span>{{ scope.row.softccount }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column :key="3" label="推料车编号" min-width="90px" align="center">
  43. <template slot-scope="scope">
  44. <span v-if="scope.row.NoEdit">{{ scope.row.ccount }}</span>
  45. <el-input v-if="scope.row.Edit" v-model="scope.row.ccount" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurCcount(scope.row)" />
  46. </template>
  47. </el-table-column>
  48. <el-table-column :key="4" label="推料时间(每天)" min-width="85px" align="center">
  49. <template slot-scope="scope">
  50. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  51. <el-input v-if="scope.row.Edit" v-model="scope.row.ratio" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurRatio(scope.row)" />
  52. </template>
  53. </el-table-column>
  54. <el-table-column :key="5" label="允许误差时间(分钟)" min-width="85px" align="center">
  55. <template slot-scope="scope">
  56. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  57. <el-input v-if="scope.row.Edit" v-model="scope.row.ccountratio" type="number" style="width:95%;padding:10px 0;" @blur="blurCcountratio(scope.row)" />
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  61. <template slot-scope="{row}">
  62. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  63. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  64. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  65. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
  70. </div>
  71. </div>
  72. </template>
  73. <script>
  74. import { GetDataByName, postJson, GetDataByNames, compareSort, ExecDataByConfig, failproccess, PostDataByName, formatNum, checkButtons } from '@/api/common'
  75. import Pagination from '@/components/Pagination'
  76. import Pagination2 from '@/components/Pagination2'
  77. import { parseTime, json2excel, handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  78. import { MessageBox } from 'element-ui'
  79. import Cookies from 'js-cookie'
  80. import axios from 'axios'
  81. import { getToken } from '@/utils/auth'
  82. export default {
  83. inject: ['reload'],
  84. name: 'PushMaterialPlan',
  85. components: { Pagination, Pagination2 },
  86. data() {
  87. return {
  88. dialogFull: false,
  89. isRoleEdit: [],
  90. headerList: [],
  91. pickerMinDate: '',
  92. pickerOptions: {
  93. onPick: ({ maxDate, minDate }) => {
  94. this.pickerMinDate = minDate.getTime()
  95. if (maxDate) {
  96. this.pickerMinDate = ''
  97. }
  98. },
  99. // 限制不能选择今天之后的日期
  100. disabledDate: (time) => {
  101. if (this.pickerMinDate !== '') {
  102. const one = 31 * 24 * 3600 * 1000
  103. const minTime = this.pickerMinDate - one
  104. let maxTime = this.pickerMinDate + one
  105. if (maxTime > new Date()) {
  106. maxTime = new Date()
  107. }
  108. return time.getTime() < minTime - 8.64e7 || time.getTime() > maxTime - 8.64e7
  109. }
  110. return time.getTime() > Date.now() - 8.64e7
  111. }
  112. },
  113. requestParams: [
  114. { name: 'getFTSWLSList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  115. { name: 'getFTBLList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  116. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  117. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  118. ],
  119. getFeedTempletNameListParm: {
  120. name: 'getFeedTempletName',
  121. page: 1,
  122. offset: 1,
  123. // pagecount: parseInt(Cookies.get('pageCount')),
  124. pagecount: '',
  125. returntype: 'Map',
  126. parammaps: {}
  127. },
  128. tnameList: [], // 配方名 称
  129. recipeTemplateList: [], // 配方模板
  130. feedingFormulaList: [], // 补料配方
  131. livestockTypeList: [], // 类别
  132. barList: [],
  133. rules: {
  134. cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  135. },
  136. table: {
  137. getdataListParm: {
  138. name: 'getFPList',
  139. page: 1,
  140. offset: 1,
  141. // pagecount: parseInt(Cookies.get('pageCount')),
  142. pagecount: '',
  143. returntype: 'Map',
  144. parammaps: {
  145. pastureid: Cookies.get('pastureid'),
  146. enable: '',
  147. barid: '',
  148. tname: ''
  149. }
  150. },
  151. tableKey: 0,
  152. list: [],
  153. total: 0,
  154. listLoading: true,
  155. temp: {},
  156. rwList: [],
  157. isPtsfname: false, // 补料配方/补料重量
  158. getdataListParm2: {
  159. name: 'getSysoptEnable',
  160. page: 1,
  161. offset: 1,
  162. pagecount: 1,
  163. returntype: 'Map',
  164. parammaps: {
  165. pastureid: Cookies.get('pastureid'),
  166. inforname: 'isEnableSupplyFeed'
  167. }
  168. },
  169. getdataListParm3: {
  170. name: 'getSysoptEnable1',
  171. page: 1,
  172. offset: 1,
  173. pagecount: 1,
  174. returntype: 'Map',
  175. parammaps: {
  176. pastureid: Cookies.get('pastureid'),
  177. inforname: 'times'
  178. }
  179. },
  180. RWLength: '' // 班次长度
  181. },
  182. selectList: [],
  183. textMap: {
  184. Nutritional: '营养评估',
  185. history: '历史记录'
  186. },
  187. focusWRow: {}, // 一班重量得到焦点暂存
  188. focusWRow2: {}, // 2班重量得到焦点暂存
  189. focusWRow3: {}, // 3班重量得到焦点暂存
  190. focusWRow4: {}, // 4班重量得到焦点暂存
  191. requestParam: {},
  192. download: {
  193. getdataListParm: {
  194. name: 'getFPList',
  195. page: 1,
  196. offset: 1,
  197. pagecount: 0,
  198. returntype: 'Map',
  199. parammaps: {
  200. pastureid: Cookies.get('pastureid'),
  201. enable: ''
  202. }
  203. },
  204. list: []
  205. },
  206. spanObj: {},
  207. mergekeys: ['barname', 'sumweight'],
  208. isShowDialog: false,
  209. isokDisable: false,
  210. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  211. cellStyle: { padding: 0 + 'px' },
  212. myHeight: document.documentElement.clientHeight - 85 - 140,
  213. oldRowList:{},
  214. create1: {
  215. dialogFormVisible: false,
  216. dialogStatus: '',
  217. temp: { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '', sort: '' },
  218. rules: {
  219. // fname: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  220. // fclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  221. // feedcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  222. }
  223. },
  224. }
  225. },
  226. computed: {
  227. },
  228. created() {
  229. this.getButtons()
  230. this.getDownList()
  231. this.getFeedTempletNameList()
  232. },
  233. methods: {
  234. getButtons() {
  235. const Edit = 'DhedFormula'
  236. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  237. this.isRoleEdit = isRoleEdit
  238. },
  239. getDownList() {
  240. GetDataByNames(this.requestParams).then(response => {
  241. this.recipeTemplateList = response.data.getFTSWLSList.list
  242. this.feedingFormulaList = response.data.getFTBLList.list
  243. this.livestockTypeList = response.data.getCowclassListEnable.list
  244. this.barList = response.data.getBarListEnable.list
  245. this.getIsDisplay()
  246. })
  247. },
  248. // 新增
  249. handleCreate1() {
  250. console.log('点击了新增')
  251. this.resetTemp1()
  252. this.dialogFull = false
  253. this.create1.dialogStatus = 'create'
  254. this.create1.dialogFormVisible = true
  255. },
  256. getFeedTempletNameList() {
  257. GetDataByName(this.getFeedTempletNameListParm).then(response => {
  258. if (response.data.list !== null) {
  259. this.tnameList = response.data.list
  260. } else {
  261. this.tnameList = []
  262. }
  263. })
  264. },
  265. getIsDisplay() {
  266. GetDataByName(this.table.getdataListParm2).then(response => {
  267. console.log(response.data.list[0].inforvalue)
  268. if (response.data.list !== null) {
  269. if (response.data.list[0].inforvalue == 0) {
  270. this.table.isPtsfname = false
  271. } else {
  272. this.table.isPtsfname = true
  273. }
  274. }
  275. })
  276. GetDataByName(this.table.getdataListParm3).then(response => {
  277. console.log(response.data.list[0].inforvalue)
  278. if (response.data.list !== null) {
  279. this.table.RWLength = response.data.list[0].inforvalue
  280. if (response.data.list[0].inforvalue == 1) {
  281. this.table.isRW1 = true
  282. this.table.isRW2 = false
  283. this.table.isRW3 = false
  284. this.table.isRW4 = false
  285. } else if (response.data.list[0].inforvalue == 2) {
  286. this.table.isRW1 = true
  287. this.table.isRW2 = true
  288. this.table.isRW3 = false
  289. this.table.isRW4 = false
  290. } else if (response.data.list[0].inforvalue == 3) {
  291. this.table.isRW1 = true
  292. this.table.isRW2 = true
  293. this.table.isRW3 = true
  294. this.table.isRW4 = false
  295. } else if (response.data.list[0].inforvalue == 4) {
  296. this.table.isRW1 = true
  297. this.table.isRW2 = true
  298. this.table.isRW3 = true
  299. this.table.isRW4 = true
  300. }
  301. } else {
  302. this.table.isRW1 = false
  303. this.table.isRW2 = false
  304. this.table.isRW3 = false
  305. this.table.isRW4 = false
  306. }
  307. })
  308. this.getList()
  309. },
  310. getList() {
  311. this.table.listLoading = true
  312. GetDataByName(this.table.getdataListParm).then(response => {
  313. console.log('table数据', response.data.list)
  314. if (response.data.list !== null) {
  315. for (let i = 0; i < response.data.list.length; i++) {
  316. this.$set(response.data.list[i], 'Edit', false) // 编辑
  317. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  318. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  319. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  320. if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
  321. if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
  322. this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
  323. } else {
  324. this.$set(response.data.list[i], 'dryweight', '')
  325. }
  326. }
  327. if (response.data.list[i].ftid == undefined || response.data.list[i].ftname == '') {
  328. this.$set(response.data.list[i], 'ftid', '')
  329. this.$set(response.data.list[i], 'ftname', '')
  330. }
  331. if (response.data.list[i].ptsfid == undefined || response.data.list[i].ptsfname == '') {
  332. this.$set(response.data.list[i], 'ptsfid', '')
  333. this.$set(response.data.list[i], 'ptsfname', '')
  334. }
  335. if (response.data.list[i].ccount == undefined) {
  336. this.$set(response.data.list[i], 'ccount', '')
  337. }
  338. if (response.data.list[i].softccount == undefined) {
  339. this.$set(response.data.list[i], 'softccount', '')
  340. }
  341. if (response.data.list[i].ratio == undefined) {
  342. this.$set(response.data.list[i], 'ratio', 100)
  343. }
  344. if (response.data.list[i].ccountratio == undefined) {
  345. this.$set(response.data.list[i], 'ccountratio', '')
  346. }
  347. if (response.data.list[i].r1 == undefined) {
  348. this.$set(response.data.list[i], 'r1', '')
  349. }
  350. if (response.data.list[i].r2 == undefined) {
  351. this.$set(response.data.list[i], 'r2', '')
  352. }
  353. if (response.data.list[i].r3 == undefined) {
  354. this.$set(response.data.list[i], 'r3', '')
  355. }
  356. if (response.data.list[i].r4 == undefined) {
  357. this.$set(response.data.list[i], 'r4', '')
  358. }
  359. if (response.data.list[i].w1 == undefined) {
  360. this.$set(response.data.list[i], 'w1', '')
  361. }
  362. if (response.data.list[i].w2 == undefined) {
  363. this.$set(response.data.list[i], 'w2', '')
  364. }
  365. if (response.data.list[i].w3 == undefined) {
  366. this.$set(response.data.list[i], 'w3', '')
  367. }
  368. if (response.data.list[i].w4 == undefined) {
  369. this.$set(response.data.list[i], 'w4', '')
  370. }
  371. if (response.data.list[i].supplyweight == undefined) {
  372. this.$set(response.data.list[i], 'supplyweight', '')
  373. }
  374. if (response.data.list[i].feedweight == undefined || parseFloat(response.data.list[i].feedweight) == 0) {
  375. this.$set(response.data.list[i], 'feedweight', '')
  376. }
  377. this.$set(response.data.list[i], 'dailyWeight', '')
  378. if (response.data.list[i].Bfweight == undefined) {
  379. this.$set(response.data.list[i], 'Bfweight', '')
  380. }
  381. if (response.data.list[i].Sfweight == undefined) {
  382. this.$set(response.data.list[i], 'Sfweight', '')
  383. }
  384. if (response.data.list[i].isOneWeight == undefined) {
  385. this.$set(response.data.list[i], 'isOneWeight', false)
  386. }
  387. if (response.data.list[i].isTwoWeight == undefined) {
  388. this.$set(response.data.list[i], 'isTwoWeight', false)
  389. }
  390. if (response.data.list[i].isThreeWeight == undefined) {
  391. this.$set(response.data.list[i], 'isThreeWeight', false)
  392. }
  393. if (response.data.list[i].isFourWeight == undefined) {
  394. this.$set(response.data.list[i], 'isFourWeight', false)
  395. }
  396. if (response.data.list[i].timesopt !== undefined) {
  397. var timesoptArr = response.data.list[i].timesopt.split(',')
  398. for (let j = 0; j < timesoptArr.length; j++) {
  399. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  400. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  401. }
  402. }
  403. if (response.data.list[i].bw1 == undefined) {
  404. this.$set(response.data.list[i], 'bw1', '')
  405. }
  406. if (response.data.list[i].bw2 == undefined) {
  407. this.$set(response.data.list[i], 'bw2', '')
  408. }
  409. if (response.data.list[i].bw3 == undefined) {
  410. this.$set(response.data.list[i], 'bw3', '')
  411. }
  412. if (response.data.list[i].bw4 == undefined) {
  413. this.$set(response.data.list[i], 'bw4', '')
  414. }
  415. if (response.data.list[i].supplement !== undefined) {
  416. var supplementArr = response.data.list[i].supplement.split(',')
  417. for (let j = 0; j < supplementArr.length; j++) {
  418. response.data.list[i]['bw' + supplementArr[j].split(':')[0]] = supplementArr[j].split(':')[2]
  419. }
  420. }
  421. }
  422. // console.log(response.data.list, sumr)
  423. for (let i = 0; i < response.data.list.length; i++) {
  424. if (response.data.list[i].r1 == '') {
  425. response.data.list[i].r1 = 0
  426. response.data.list[i].w1 = 0
  427. }
  428. if (response.data.list[i].r2 == '') {
  429. response.data.list[i].r2 = 0
  430. response.data.list[i].w2 = 0
  431. }
  432. if (response.data.list[i].r3 == '') {
  433. response.data.list[i].r3 = 0
  434. response.data.list[i].w3 = 0
  435. }
  436. if (response.data.list[i].r4 == '') {
  437. response.data.list[i].r4 = 0
  438. response.data.list[i].w4 = 0
  439. }
  440. this.$set(response.data.list[i], 'sumr', parseFloat(response.data.list[i].r1) + parseFloat(response.data.list[i].r2) + parseFloat(response.data.list[i].r3) + parseFloat(response.data.list[i].r4))
  441. response.data.list[i].sumr = formatNum(response.data.list[i].sumr, parseInt(Cookies.get('decimal')))
  442. // this.$set(response.data.list[i],'feedweight',formatNum(parseFloat(response.data.list[i].feedweight) * parseFloat(response.data.list[i].sumr)/100,2))
  443. this.$set(response.data.list[i], 'dailyWeight', parseFloat(response.data.list[i].w1) + parseFloat(response.data.list[i].w2) + parseFloat(response.data.list[i].w3) + parseFloat(response.data.list[i].w4))
  444. response.data.list[i].dailyWeight = formatNum(response.data.list[i].dailyWeight, parseInt(Cookies.get('decimal')))
  445. }
  446. this.table.list = response.data.list
  447. console.log(this.table.list, 'this.table.list')
  448. this.table.pageNum = response.data.pageNum
  449. this.table.pageSize = response.data.pageSize
  450. this.table.total = response.data.total
  451. } else {
  452. this.table.list = []
  453. }
  454. setTimeout(() => {
  455. this.table.listLoading = false
  456. }, 100)
  457. })
  458. },
  459. handleSearch() {
  460. this.getList()
  461. },
  462. renderHeader(h, { column, $index }) { // h即为cerateElement的简写,具体可看vue官方文档
  463. return h(
  464. 'div',
  465. [
  466. h('span', column.label),
  467. h('i', {
  468. class: 'el-icon-unlock',
  469. ref: 'el-icon-unlock',
  470. style: 'margin-left:5px;'
  471. })
  472. ]
  473. )
  474. },
  475. headerClick(column, event) {
  476. console.log(column, event)
  477. this.headerList.push(event)
  478. if (column.label == '第一班重量') {
  479. for (let i = 0; i < this.table.list.length; i++) {
  480. if (this.table.list[i].Edit == true) {
  481. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  482. event.target.className = 'el-icon-lock'
  483. this.$set(this.table.list[i], 'isOneWeight', true) // 锁住不可编辑
  484. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  485. event.target.className = 'el-icon-unlock'
  486. this.$set(this.table.list[i], 'isOneWeight', false) // 解锁可编辑
  487. }
  488. }
  489. }
  490. } else if (column.label == '第二班重量') {
  491. for (let i = 0; i < this.table.list.length; i++) {
  492. if (this.table.list[i].Edit == true) {
  493. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  494. event.target.className = 'el-icon-lock'
  495. this.$set(this.table.list[i], 'isTwoWeight', true) // 锁住不可编辑
  496. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  497. event.target.className = 'el-icon-unlock'
  498. this.$set(this.table.list[i], 'isTwoWeight', false) // 解锁可编辑
  499. }
  500. }
  501. }
  502. } else if (column.label == '第三班重量') {
  503. for (let i = 0; i < this.table.list.length; i++) {
  504. if (this.table.list[i].Edit == true) {
  505. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  506. event.target.className = 'el-icon-lock'
  507. this.$set(this.table.list[i], 'isThreeWeight', true) // 锁住不可编辑
  508. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  509. event.target.className = 'el-icon-unlock'
  510. this.$set(this.table.list[i], 'isThreeWeight', false) // 解锁可编辑
  511. }
  512. }
  513. }
  514. } else if (column.label == '第四班重量') {
  515. for (let i = 0; i < this.table.list.length; i++) {
  516. if (this.table.list[i].Edit == true) {
  517. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  518. event.target.className = 'el-icon-lock'
  519. this.$set(this.table.list[i], 'isFourWeight', true) // 锁住不可编辑
  520. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  521. event.target.className = 'el-icon-unlock'
  522. this.$set(this.table.list[i], 'isFourWeight', false) // 解锁可编辑
  523. }
  524. }
  525. }
  526. }
  527. },
  528. // 配方模板
  529. changeRecipeTemplate(item, row) {
  530. row.myccname = this.recipeTemplateList.find(obj => obj.id == item).ccname
  531. if (row.bigcowclass !== row.myccname) {
  532. this.$message({ type: 'warning', message: '所选配方模板牲畜类别与栏舍对应牲畜类别不一致', duration: 2000 })
  533. }
  534. console.log(row.supplyweight, 'row.supplyweight')
  535. row.ftname = this.recipeTemplateList.find(obj => obj.id == item).tname
  536. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == item).Sfweight// Sfweight
  537. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == item).SfweightLock// SfweightLock
  538. row.dryweight = this.recipeTemplateList.find(obj => obj.id == item).dryweight// SfweightLock
  539. // 补料重量supplyweight
  540. // 配方重量ftweight
  541. // 系数头数ccountratio
  542. // 投喂量feedweight
  543. // 实际牛头数ccount
  544. // 投喂量 = 配方重量 + 补料重量
  545. // 配方重量 = Sfweight * 系数头数 + SfweightLock * 实际牛头数ccount
  546. console.log(row.Sfweight, 'row.Sfweight')
  547. console.log(row.ccountratio, '系数头数')
  548. console.log(row.SfweightLock, 'SfweightLock')
  549. console.log(row.ccount, '实际牛头数')
  550. if (row.Sfweight !== '' && row.ccount !== '') {
  551. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  552. } else {
  553. row.ftweight = ''
  554. }
  555. // console.log(row.ftweight, 'row.ftweight')
  556. // console.log(row.supplyweight, 'row.supplyweight')
  557. // console.log(this.table.isPtsfname, 'isPtsfname')
  558. if (this.table.isPtsfname == false) {
  559. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  560. } else {
  561. if (row.supplyweight == 'NaN') {
  562. row.supplyweight = 0
  563. }
  564. console.log(row.supplyweight)
  565. if (row.supplyweight !== '' && row.ftweight !== '') {
  566. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  567. } else if (row.supplyweight == '' && row.ftweight !== '') {
  568. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  569. } else if (row.supplyweight !== '' && row.ftweight !== '') {
  570. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  571. }
  572. if (row.ccountratio !== '' && row.ftweight !== '') {
  573. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  574. }
  575. if (row.Sfweight !== '' && row.ccount !== '') {
  576. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  577. } else {
  578. row.ftweight = ''
  579. }
  580. }
  581. console.log(row.supplyweight)
  582. if (row.supplyweight == 'NaN') { row.supplyweight = 0 }
  583. if (row.r1 !== '') { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  584. if (row.r2 !== '') { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  585. if (row.r3 !== '') { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  586. if (row.r4 !== '') { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  587. if (row.w1 == '') { row.w1 = 0 }
  588. if (row.w2 == '') { row.w2 = 0 }
  589. if (row.w3 == '') { row.w3 = 0 }
  590. if (row.w4 == '') { row.w4 = 0 }
  591. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  592. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  593. },
  594. // 实际牛头数失去焦点计算
  595. // ccount实际牛头数
  596. // ratio系数
  597. // ccountratio系数牛头数
  598. blurCcount(row) { // 实际牛头数
  599. console.log(row)
  600. if (row.ftid !== '-1' && row.ftid !== '') {
  601. console.log(this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight)
  602. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  603. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  604. }
  605. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  606. // row.ptsfid = parseInt(row.ptsfid)
  607. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), parseInt(Cookies.get('decimal')))
  608. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), parseInt(Cookies.get('decimal')))
  609. }
  610. if (row.ptsfid == '') {
  611. row.BLweight = 0
  612. row.BLweightLock = 0
  613. }
  614. if (row.Sfweight !== '' && row.ccount !== '') {
  615. // console.log(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount))
  616. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  617. }
  618. // 系数牛头数 = 实际牛头数 * 系数/100
  619. if (row.ccount !== '' && row.ratio !== '') {
  620. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  621. } else if (row.ratio !== '' && row.ccountratio !== '') {
  622. row.ccount = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  623. } else if (row.ccount !== '' || row.ratio !== '') {
  624. row.ccountratio = ''
  625. }
  626. // 补料重量
  627. console.log(row.ccountratio, row.BLweight)
  628. if (row.BLweight == 'undefined') {
  629. this.$set(row, 'BLweight', '')
  630. }
  631. console.log('BLweight', row.BLweight)
  632. console.log('ccountratio', row.ccountratio)
  633. console.log('BLweightLock', row.BLweightLock)
  634. console.log('ccount', row.ccount)
  635. if (row.ccountratio !== '' && row.BLweight !== '') {
  636. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  637. } else if (row.ccountratio !== '' && row.BLweight == '') {
  638. row.supplyweight = ''
  639. row.feedweight = ''
  640. } else if (row.ccountratio == '' && row.BLweight !== '') {
  641. row.supplyweight = ''
  642. row.feedweight = ''
  643. }
  644. // 配方重量
  645. if (row.ccountratio !== '' && row.Sfweight !== '') {
  646. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  647. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  648. row.ftweight = ''
  649. row.feedweight = ''
  650. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  651. row.ftweight = ''
  652. row.feedweight = ''
  653. }
  654. if (this.table.isPtsfname == false) {
  655. row.feedweight = parseFloat(row.ftweight)
  656. } else {
  657. if (row.supplyweight !== '' && row.ftweight !== '') {
  658. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  659. } else if (row.supplyweight !== '' && row.ftweight == '') {
  660. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  661. } else if (row.supplyweight == '' && row.ftweight !== '') {
  662. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  663. }
  664. // 配方重量 = 系数头数 * Sfweight
  665. if (row.ccountratio !== '' && row.ftweight !== '') {
  666. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  667. }
  668. // 补料重量 = 系数头数 * BLweight
  669. if (row.ccountratio !== '' && row.BLweight !== '') {
  670. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  671. }
  672. }
  673. console.log(row)
  674. if (row.r1 !== '' && row.isOneWeight == false) { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  675. if (row.r2 !== '' && row.isTwoWeight == false) { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  676. if (row.r3 !== '' && row.isThreeWeight == false) { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  677. if (row.r4 !== '' && row.isFourWeight == false) { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  678. if (row.isOneWeight == true) {
  679. this.$set(row, 'r1', formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  680. }
  681. if (row.isTwoWeight == true) {
  682. this.$set(row, 'r2', formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  683. }
  684. if (row.isThreeWeight == true) {
  685. this.$set(row, 'r3', formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  686. }
  687. if (row.isFourWeight == true) {
  688. this.$set(row, 'r4', formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  689. }
  690. if (row.w1 == '') { row.w1 = 0 }
  691. if (row.w2 == '') { row.w2 = 0 }
  692. if (row.w3 == '') { row.w3 = 0 }
  693. if (row.w4 == '') { row.w4 = 0 }
  694. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  695. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  696. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  697. },
  698. blurRatio(row) {
  699. console.log(row, '--------------')
  700. if (row.ftid !== '-1' && row.ftid !== '') {
  701. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  702. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  703. }
  704. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  705. // row.ptsfid = parseInt(row.ptsfid)
  706. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), parseInt(Cookies.get('decimal')))
  707. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), parseInt(Cookies.get('decimal')))
  708. }
  709. if (row.ptsfid == '') {
  710. row.BLweight = 0
  711. row.BLweightLock = 0
  712. }
  713. // 系数
  714. if (row.ccount !== '' && row.ratio !== '' && row.ccountratio !== '') {
  715. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  716. } else if (row.ccount !== '' && row.ccountratio !== '') {
  717. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  718. } else if (row.ccount !== '' || row.ccountratio !== '') {
  719. row.ratio = ''
  720. }
  721. // 补料重量
  722. if (row.ccountratio !== '' && row.BLweight !== '') {
  723. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  724. } else if (row.ccountratio !== '' && row.BLweight == '' || row.ccountratio == '' && row.BLweight !== '') {
  725. row.supplyweight = ''
  726. row.feedweight = ''
  727. }
  728. // 配方重量
  729. if (row.ccountratio !== '' && row.Sfweight !== '') {
  730. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  731. } else if (row.ccountratio !== '' && row.Sfweight == '' || row.ccountratio == '' && row.Sfweight !== '') {
  732. row.ftweight = ''
  733. row.feedweight = ''
  734. }
  735. // 投喂量
  736. if (row.supplyweight !== '' && row.ftweight !== '') {
  737. row.feedweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  738. } else if (row.supplyweight == '' && row.ftweight !== '') {
  739. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  740. } else if (row.supplyweight !== '' && row.ftweight == '') {
  741. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  742. }
  743. console.log(row.supplyweight, '补料重量')
  744. console.log(row.ftweight, '配方重量')
  745. if (this.table.isPtsfname == false) {
  746. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  747. } else {
  748. // 投喂量
  749. if (row.supplyweight !== '' && row.ftweight !== '') {
  750. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  751. } else if (row.supplyweight == '' && row.ftweight !== '') {
  752. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  753. } else if (row.supplyweight !== '' && row.ftweight == '') {
  754. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  755. }
  756. // 补料重量
  757. if (row.ccountratio !== '' && row.BLweight !== '') {
  758. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  759. } else if (row.ccountratio !== '' && row.BLweight == '') {
  760. row.supplyweight = ''
  761. row.feedweight = ''
  762. } else if (row.ccountratio == '' && row.BLweight !== '') {
  763. row.supplyweight = ''
  764. row.feedweight = ''
  765. }
  766. // 配方重量
  767. if (row.ccountratio !== '' && row.Sfweight !== '') {
  768. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  769. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  770. row.ftweight = ''
  771. row.feedweight = ''
  772. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  773. row.ftweight = ''
  774. row.feedweight = ''
  775. }
  776. }
  777. if (row.r1 !== '' && row.isOneWeight == false) { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  778. if (row.r2 !== '' && row.isTwoWeight == false) { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  779. if (row.r3 !== '' && row.isThreeWeight == false) { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  780. if (row.r4 !== '' && row.isFourWeight == false) { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  781. if (row.isOneWeight == true) {
  782. this.$set(row, 'r1', formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  783. }
  784. if (row.isTwoWeight == true) {
  785. this.$set(row, 'r2', formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  786. }
  787. if (row.isThreeWeight == true) {
  788. this.$set(row, 'r3', formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  789. }
  790. if (row.isFourWeight == true) {
  791. this.$set(row, 'r4', formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  792. }
  793. if (row.w1 == '') { row.w1 = 0 }
  794. if (row.w2 == '') { row.w2 = 0 }
  795. if (row.w3 == '') { row.w3 = 0 }
  796. if (row.w4 == '') { row.w4 = 0 }
  797. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  798. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  799. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  800. },
  801. blurCcountratio(row) {
  802. if (row.ftid !== '-1' && row.ftid !== '') {
  803. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  804. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  805. }
  806. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  807. // row.ptsfid = parseInt(row.ptsfid)
  808. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), parseInt(Cookies.get('decimal')))
  809. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), parseInt(Cookies.get('decimal')))
  810. }
  811. if (row.ptsfid == '') {
  812. row.BLweight = 0
  813. row.BLweightLock = 0
  814. }
  815. if (row.ptsfid == '') {
  816. row.BLweight = 0
  817. row.BLweightLock = 0
  818. }
  819. // ratio系数ccountratio系数头数ccount实际牛头数
  820. // 系数头数
  821. if (row.ccountratio !== '' && row.ccount !== '' && row.ratio !== '') {
  822. if (row.ccountratio !== 0 && row.ccount !== 0) {
  823. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  824. }
  825. } else if (row.ccount !== '' && row.ratio !== '') {
  826. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  827. } else if (row.ccountratio !== '' && row.ccount !== '') {
  828. if (row.ccountratio !== 0 && row.ccount !== 0) {
  829. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  830. }
  831. } else if (row.ccountratio !== '' && row.ratio !== '') {
  832. row.ccount = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  833. }
  834. // 补料重量
  835. if (row.ccountratio !== '' && row.BLweight !== '') {
  836. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  837. } else if (row.ccountratio !== '' && row.BLweight == '') {
  838. row.supplyweight = ''
  839. row.feedweight = ''
  840. } else if (row.ccountratio == '' && row.BLweight !== '') {
  841. row.supplyweight = ''
  842. row.feedweight = ''
  843. }
  844. // 配方重量
  845. if (row.ccountratio !== '' && row.Sfweight !== '') {
  846. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  847. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  848. row.ftweight = ''
  849. row.feedweight = ''
  850. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  851. row.ftweight = ''
  852. row.feedweight = ''
  853. }
  854. // 投喂量
  855. if (row.supplyweight !== '' && row.ftweight !== '') {
  856. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  857. } else if (row.supplyweight == '' && row.ftweight !== '') {
  858. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  859. } else if (row.supplyweight !== '' && row.ftweight == '') {
  860. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  861. }
  862. if (this.table.isPtsfname == false) {
  863. console.log(row)
  864. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  865. } else {
  866. // 投喂量
  867. if (row.supplyweight !== '' && row.ftweight !== '') {
  868. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  869. } else if (row.supplyweight == '' && row.ftweight !== '') {
  870. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  871. } else if (row.supplyweight !== '' && row.ftweight == '') {
  872. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  873. }
  874. // 补料重量
  875. if (row.ccountratio !== '' && row.BLweight !== '') {
  876. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  877. } else if (row.ccountratio !== '' && row.BLweight == '') {
  878. row.supplyweight = ''
  879. row.feedweight = ''
  880. } else if (row.ccountratio == '' && row.BLweight !== '') {
  881. row.supplyweight = ''
  882. row.feedweight = ''
  883. }
  884. // 配方重量
  885. if (row.ccountratio !== '' && row.Sfweight !== '') {
  886. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  887. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  888. row.ftweight = ''
  889. row.feedweight = ''
  890. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  891. row.ftweight = ''
  892. row.feedweight = ''
  893. }
  894. }
  895. if (row.r1 !== '' && row.isOneWeight == false) {
  896. this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal'))))
  897. }
  898. if (row.r2 !== '' && row.isTwoWeight == false) {
  899. this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal'))))
  900. }
  901. if (row.r3 !== '' && row.isThreeWeight == false) {
  902. this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal'))))
  903. }
  904. if (row.r4 !== '' && row.isFourWeight == false) {
  905. this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal'))))
  906. }
  907. if (row.isOneWeight == true) {
  908. this.$set(row, 'r1', formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  909. }
  910. if (row.isTwoWeight == true) {
  911. this.$set(row, 'r2', formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  912. }
  913. if (row.isThreeWeight == true) {
  914. this.$set(row, 'r3', formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  915. }
  916. if (row.isFourWeight == true) {
  917. this.$set(row, 'r4', formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  918. }
  919. if (row.w1 == '') { row.w1 = 0 }
  920. if (row.w2 == '') { row.w2 = 0 }
  921. if (row.w3 == '') { row.w3 = 0 }
  922. if (row.w4 == '') { row.w4 = 0 }
  923. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  924. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  925. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  926. },
  927. // 总比例
  928. blurR(row) {
  929. if (row.r1 == '') { row.r1 = 0 }
  930. if (row.r2 == '') { row.r2 = 0 }
  931. if (row.r3 == '') { row.r3 = 0 }
  932. if (row.r4 == '') { row.r4 = 0 }
  933. if (row.r1 !== '') {
  934. row.w1 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r1) / 100, parseInt(Cookies.get('decimal')))
  935. }
  936. if (row.r2 !== '') {
  937. row.w2 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r2) / 100, parseInt(Cookies.get('decimal')))
  938. }
  939. if (row.r3 !== '') {
  940. row.w3 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r3) / 100, parseInt(Cookies.get('decimal')))
  941. }
  942. if (row.r4 !== '') {
  943. row.w4 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r4) / 100, parseInt(Cookies.get('decimal')))
  944. }
  945. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  946. if (row.w1 == '') { row.w1 = 0 }
  947. if (row.w2 == '') { row.w2 = 0 }
  948. if (row.w3 == '') { row.w3 = 0 }
  949. if (row.w4 == '') { row.w4 = 0 }
  950. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  951. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  952. },
  953. // 一班重量得到焦点
  954. focusW(row) {
  955. console.log(row, '====')
  956. this.focusWRow = Object.assign({}, row)
  957. },
  958. // 1班重量得到焦点
  959. focusW2(row) {
  960. this.focusWRow2 = Object.assign({}, row)
  961. },
  962. // 3班重量得到焦点
  963. focusW3(row) {
  964. this.focusWRow3 = Object.assign({}, row)
  965. },
  966. // 4班重量得到焦点
  967. focusW4(row) {
  968. this.focusWRow4 = Object.assign({}, row)
  969. },
  970. // 一班重量
  971. blurW(row) {
  972. if (row.w1 == '') {
  973. row.w1 = 0
  974. }
  975. if (row.w2 == '') {
  976. row.w2 = 0
  977. }
  978. if (row.w3 == '') {
  979. row.w3 = 0
  980. }
  981. if (row.w4 == '') {
  982. row.w4 = 0
  983. }
  984. if (row.r1 == '') {
  985. row.r1 = 0
  986. }
  987. if (row.r2 == '') {
  988. row.r2 = 0
  989. }
  990. if (row.r3 == '') {
  991. row.r3 = 0
  992. }
  993. if (row.r4 == '') {
  994. row.r4 = 0
  995. }
  996. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  997. console.log(row, '=======投喂量feedweight')
  998. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  999. if (this.table.RWLength == 4) {
  1000. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1001. // 2班3班4班都锁定
  1002. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1003. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1004. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1005. }
  1006. // 2班3班锁定4班未锁定
  1007. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1008. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1009. row.w4 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  1010. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1011. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1012. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1013. }
  1014. // 2班4班锁定3班未锁定
  1015. if (row.isTwoWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1016. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1017. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1018. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1019. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1020. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1021. }
  1022. // 3班4班锁定2班未锁定
  1023. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1024. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1025. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1026. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1027. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1028. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1029. }
  1030. // 2班锁定,3班4班未锁
  1031. if (row.isTwoWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1032. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1033. if (row.r3 == 0 && row.r4 == 0) {
  1034. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  1035. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1036. row.w4 = row.w3
  1037. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1038. } else if (row.r3 == 0 && row.r4 !== 0) {
  1039. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1040. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1041. if (row.w1 == '') { row.w1 = 0 }
  1042. if (row.w2 == '') { row.w2 = 0 }
  1043. if (row.w3 == '') { row.w3 = 0 }
  1044. if (row.w4 == '') { row.w4 = 0 }
  1045. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1046. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1047. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1048. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1049. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1050. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1051. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1052. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1053. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1054. }
  1055. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1056. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1057. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1058. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1059. } else if (row.r3 !== 0 && row.r4 == 0) {
  1060. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1061. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1062. if (row.w1 == '') { row.w1 = 0 }
  1063. if (row.w2 == '') { row.w2 = 0 }
  1064. if (row.w3 == '') { row.w3 = 0 }
  1065. if (row.w4 == '') { row.w4 = 0 }
  1066. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1067. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1068. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1069. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1070. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1071. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1072. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1073. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1074. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1075. }
  1076. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1077. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1078. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1079. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1080. } else {
  1081. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1082. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1083. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1084. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1085. }
  1086. if (isNaN(row.w3)) {
  1087. row.w3 = 0
  1088. row.r3 = 0
  1089. }
  1090. if (isNaN(row.w4)) {
  1091. row.w4 = 0
  1092. row.r4 = 0
  1093. }
  1094. if (row.w3 <= 0) {
  1095. row.w3 = 0
  1096. row.r3 = 0
  1097. }
  1098. if (row.w4 <= 0) {
  1099. row.w4 = 0
  1100. row.r4 = 0
  1101. }
  1102. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1103. }
  1104. // 3班锁定,2班4班未锁
  1105. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1106. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1107. if (row.r2 == 0 && row.r4 == 0) {
  1108. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  1109. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1110. row.w4 = row.w2
  1111. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1112. } else if (row.r2 == 0 && row.r4 !== 0) {
  1113. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1114. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1115. if (row.w1 == '') { row.w1 = 0 }
  1116. if (row.w2 == '') { row.w2 = 0 }
  1117. if (row.w3 == '') { row.w3 = 0 }
  1118. if (row.w4 == '') { row.w4 = 0 }
  1119. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1120. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1121. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1122. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1123. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1124. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1125. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1126. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1127. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1128. }
  1129. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1130. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1131. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1132. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1133. } else if (row.r2 !== 0 && row.r4 == 0) {
  1134. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  1135. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1136. if (row.w1 == '') { row.w1 = 0 }
  1137. if (row.w2 == '') { row.w2 = 0 }
  1138. if (row.w3 == '') { row.w3 = 0 }
  1139. if (row.w4 == '') { row.w4 = 0 }
  1140. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1141. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1142. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1143. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1144. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1145. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1146. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1147. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1148. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1149. }
  1150. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1151. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1152. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1153. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1154. } else {
  1155. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1156. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1157. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1158. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1159. }
  1160. if (isNaN(row.w2)) {
  1161. row.w2 = 0
  1162. row.r2 = 0
  1163. }
  1164. if (isNaN(row.w4)) {
  1165. row.w4 = 0
  1166. row.r4 = 0
  1167. }
  1168. if (row.w2 <= 0) {
  1169. row.w2 = 0
  1170. row.r2 = 0
  1171. }
  1172. if (row.w4 <= 0) {
  1173. row.w4 = 0
  1174. row.r4 = 0
  1175. }
  1176. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1177. }
  1178. // 4班锁定,2班3班未锁
  1179. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1180. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1181. if (row.r2 == 0 && row.r3 == 0) {
  1182. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  1183. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1184. row.w3 = row.w2
  1185. row.r3 = row.r2
  1186. } else if (row.r2 == 0 && row.r3 !== 0) {
  1187. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1188. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1189. if (row.w1 == '') { row.w1 = 0 }
  1190. if (row.w2 == '') { row.w2 = 0 }
  1191. if (row.w3 == '') { row.w3 = 0 }
  1192. if (row.w4 == '') { row.w4 = 0 }
  1193. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1194. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1195. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1196. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1197. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1198. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1199. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1200. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1201. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1202. }
  1203. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1204. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1205. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1206. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1207. } else if (row.r2 !== 0 && row.r3 == 0) {
  1208. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  1209. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1210. if (row.w1 == '') { row.w1 = 0 }
  1211. if (row.w2 == '') { row.w2 = 0 }
  1212. if (row.w3 == '') { row.w3 = 0 }
  1213. if (row.w4 == '') { row.w4 = 0 }
  1214. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1215. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1216. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1217. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1218. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1219. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1220. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1221. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1222. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1223. }
  1224. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1225. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1226. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1227. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1228. } else {
  1229. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1230. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1231. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1232. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1233. }
  1234. if (row.w2 <= 0) {
  1235. row.w2 = 0
  1236. row.r2 = 0
  1237. }
  1238. if (row.w3 <= 0) {
  1239. row.w3 = 0
  1240. row.r3 = 0
  1241. }
  1242. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1243. }
  1244. // 2班3班4班未锁
  1245. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1246. console.log('1231234')
  1247. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1248. if (parseFloat(row.r2) == 0 && parseFloat(row.r3) == 0 && parseFloat(row.r4) == 0) {
  1249. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) / 3, parseInt(Cookies.get('decimal')))
  1250. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1251. row.w3 = row.w2
  1252. row.w4 = row.w2
  1253. row.r3 = row.r2
  1254. row.r4 = row.r2
  1255. } else if (parseFloat(row.r2) == 0 && parseFloat(row.r3) == 0 && parseFloat(row.r4) !== 0) {
  1256. row.w3 = formatNum(((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4))) / 2, parseInt(Cookies.get('decimal')))
  1257. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1258. row.w2 = row.w3
  1259. row.r2 = row.r3
  1260. if (row.w1 == '') { row.w1 = 0 }
  1261. if (row.w2 == '') { row.w2 = 0 }
  1262. if (row.w3 == '') { row.w3 = 0 }
  1263. if (row.w4 == '') { row.w4 = 0 }
  1264. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1265. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1266. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1267. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1268. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1269. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1270. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1271. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1272. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1273. }
  1274. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1275. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1276. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1277. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1278. } else if (parseFloat(row.r2) == 0 && parseFloat(row.r3) !== 0 && parseFloat(row.r4) == 0) {
  1279. row.w2 = formatNum(((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3))) / 2, parseInt(Cookies.get('decimal')))
  1280. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1281. row.w4 = row.w2
  1282. row.r4 = row.r2
  1283. if (row.w1 == '') { row.w1 = 0 }
  1284. if (row.w2 == '') { row.w2 = 0 }
  1285. if (row.w3 == '') { row.w3 = 0 }
  1286. if (row.w4 == '') { row.w4 = 0 }
  1287. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1288. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1289. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1290. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1291. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1292. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1293. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1294. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1295. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1296. }
  1297. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1298. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1299. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1300. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1301. } else if (parseFloat(row.r2) !== 0 && parseFloat(row.r3) == 0 && parseFloat(row.r4) == 0) {
  1302. row.w3 = formatNum(((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2))) / 2, parseInt(Cookies.get('decimal')))
  1303. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1304. row.w4 = row.w3
  1305. row.r4 = row.r3
  1306. if (row.w1 == '') { row.w1 = 0 }
  1307. if (row.w2 == '') { row.w2 = 0 }
  1308. if (row.w3 == '') { row.w3 = 0 }
  1309. if (row.w4 == '') { row.w4 = 0 }
  1310. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1311. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1312. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1313. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1314. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1315. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1316. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1317. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1318. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1319. }
  1320. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1321. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1322. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1323. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1324. } else if (row.r2 == 0 && row.r3 !== 0 && row.r4 !== 0) {
  1325. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1326. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1327. if (row.w1 == '') { row.w1 = 0 }
  1328. if (row.w2 == '') { row.w2 = 0 }
  1329. if (row.w3 == '') { row.w3 = 0 }
  1330. if (row.w4 == '') { row.w4 = 0 }
  1331. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1332. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1333. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1334. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1335. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1336. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1337. console.log(row.dailyWeight)
  1338. console.log(this.focusWRow.dailyWeight)
  1339. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1340. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1341. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1342. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1343. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1344. }
  1345. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1346. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1347. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1348. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1349. } else if (row.r2 !== 0 && row.r3 == 0 && row.r4 !== 0) {
  1350. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1351. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1352. if (row.w1 == '') { row.w1 = 0 }
  1353. if (row.w2 == '') { row.w2 = 0 }
  1354. if (row.w3 == '') { row.w3 = 0 }
  1355. if (row.w4 == '') { row.w4 = 0 }
  1356. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1357. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1358. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1359. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1360. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1361. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1362. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1363. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1364. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1365. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1366. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1367. }
  1368. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1369. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1370. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1371. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1372. } else if (row.r2 !== 0 && row.r3 !== 0 && row.r4 == 0) {
  1373. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1374. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1375. if (row.w1 == '') { row.w1 = 0 }
  1376. if (row.w2 == '') { row.w2 = 0 }
  1377. if (row.w3 == '') { row.w3 = 0 }
  1378. if (row.w4 == '') { row.w4 = 0 }
  1379. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1380. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1381. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1382. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1383. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1384. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1385. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1386. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1387. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1388. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1389. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1390. }
  1391. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1392. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1393. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1394. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1395. } else {
  1396. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1397. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1398. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1399. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1400. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1401. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1402. }
  1403. if (isNaN(row.w2)) {
  1404. row.w2 = 0
  1405. row.r2 = 0
  1406. }
  1407. if (isNaN(row.w3)) {
  1408. row.w3 = 0
  1409. row.r3 = 0
  1410. }
  1411. if (isNaN(row.w4)) {
  1412. row.w4 = 0
  1413. row.r4 = 0
  1414. }
  1415. if (row.w2 <= 0) {
  1416. row.w2 = 0
  1417. row.r2 = 0
  1418. }
  1419. if (row.w3 <= 0) {
  1420. row.w3 = 0
  1421. row.r3 = 0
  1422. }
  1423. if (row.w4 <= 0) {
  1424. row.w4 = 0
  1425. row.r4 = 0
  1426. }
  1427. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1428. }
  1429. } else if (this.table.RWLength == 3) {
  1430. // 三班
  1431. // 2班/3班锁定
  1432. if (row.isTwoWeight == true && row.isThreeWeight == true) {
  1433. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1434. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  1435. }
  1436. // 2班不锁3班锁
  1437. if (row.isTwoWeight == false && row.isThreeWeight == true) {
  1438. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1439. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  1440. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1441. if (row.w2 <= 0) {
  1442. row.w2 = 0
  1443. row.r2 = 0
  1444. }
  1445. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  1446. }
  1447. // 3班不锁2班锁
  1448. if (row.isTwoWeight == true && row.isThreeWeight == false) {
  1449. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1450. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2), parseInt(Cookies.get('decimal')))
  1451. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1452. if (row.w3 <= 0) {
  1453. row.w3 = 0
  1454. row.r3 = 0
  1455. }
  1456. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  1457. }
  1458. // 2班3班都不锁
  1459. if (row.isTwoWeight == false && row.isThreeWeight == false) {
  1460. console.log(row.w1, 'w1----------')
  1461. console.log(row.feedweight, 'feedweight----------')
  1462. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1463. if (row.r2 == 0 && row.r3 == 0) {
  1464. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  1465. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1466. row.w3 = row.w2
  1467. row.r3 = row.r2
  1468. } else if (row.r2 == 0 && row.r3 !== 0) {
  1469. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1470. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1471. if (row.w1 == '') { row.w1 = 0 }
  1472. if (row.w2 == '') { row.w2 = 0 }
  1473. if (row.w3 == '') { row.w3 = 0 }
  1474. if (row.w4 == '') { row.w4 = 0 }
  1475. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1476. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1477. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1478. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1479. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1480. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1481. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1482. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  1483. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1484. }
  1485. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1486. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1487. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1488. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1489. } else if (row.r2 !== 0 && row.r3 == 0) {
  1490. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  1491. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1492. if (row.w1 == '') { row.w1 = 0 }
  1493. if (row.w2 == '') { row.w2 = 0 }
  1494. if (row.w3 == '') { row.w3 = 0 }
  1495. if (row.w4 == '') { row.w4 = 0 }
  1496. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1497. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1498. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1499. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1500. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1501. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1502. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1503. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  1504. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1505. }
  1506. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1507. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1508. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1509. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1510. } else {
  1511. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  1512. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1513. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  1514. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1515. console.log('我改了1')
  1516. }
  1517. if (isNaN(row.w2)) {
  1518. row.w2 = 0
  1519. row.r2 = 0
  1520. }
  1521. if (isNaN(row.w3)) {
  1522. row.w3 = 0
  1523. row.r3 = 0
  1524. }
  1525. if (row.w3 <= 0) {
  1526. row.w3 = 0
  1527. row.r3 = 0
  1528. }
  1529. if (row.w2 <= 0) {
  1530. row.w2 = 0
  1531. row.r2 = 0
  1532. }
  1533. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  1534. }
  1535. } else if (this.table.RWLength == 2) {
  1536. // 两班isOneWeight,isTwoWeight
  1537. if (row.w1 == '') { row.w1 = 0 }
  1538. if (row.w2 == '') { row.w2 = 0 }
  1539. if (row.r1 == '') { row.r1 = 0 }
  1540. if (row.r2 == '') { row.r2 = 0 }
  1541. if (row.isTwoWeight == false) {
  1542. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1543. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1), parseInt(Cookies.get('decimal')))
  1544. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1545. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1546. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  1547. } else {
  1548. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1549. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  1550. }
  1551. } else {
  1552. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1553. this.$set(row, 'sumr', formatNum(parseFloat(row.r1), parseInt(Cookies.get('decimal'))))
  1554. }
  1555. if (row.w1 == '') { row.w1 = 0 }
  1556. if (row.w2 == '') { row.w2 = 0 }
  1557. if (row.w3 == '') { row.w3 = 0 }
  1558. if (row.w4 == '') { row.w4 = 0 }
  1559. if (isNaN(row.r1)) { row.r1 = 0 }
  1560. if (isNaN(row.r2)) { row.r2 = 0 }
  1561. if (isNaN(row.r3)) { row.r3 = 0 }
  1562. if (isNaN(row.r4)) { row.r4 = 0 }
  1563. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1564. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1565. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1566. },
  1567. blurW2(row) {
  1568. // 2班重量
  1569. if (row.w1 == '') {
  1570. row.w1 = 0
  1571. }
  1572. if (row.w2 == '') {
  1573. row.w2 = 0
  1574. }
  1575. if (row.w3 == '') {
  1576. row.w3 = 0
  1577. }
  1578. if (row.w4 == '') {
  1579. row.w4 = 0
  1580. }
  1581. if (row.r1 == '') {
  1582. row.r1 = 0
  1583. }
  1584. if (row.r2 == '') {
  1585. row.r2 = 0
  1586. }
  1587. if (row.r3 == '') {
  1588. row.r3 = 0
  1589. }
  1590. if (row.r4 == '') {
  1591. row.r4 = 0
  1592. }
  1593. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1594. console.log(row, '=======投喂量feedweight')
  1595. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1596. if (this.table.RWLength == 4) {
  1597. // 四班
  1598. // 1班3班4班都锁定
  1599. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1600. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1601. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1602. }
  1603. // 1班3班锁定4班未锁定
  1604. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1605. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1606. row.w4 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  1607. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1608. if (row.w4 <= 0) {
  1609. row.w4 = 0
  1610. row.r4 = 0
  1611. }
  1612. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1613. }
  1614. // 1班4班锁定3班未锁定
  1615. if (row.isOneWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1616. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1617. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1618. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1619. if (row.w3 <= 0) {
  1620. row.w3 = 0
  1621. row.r3 = 0
  1622. }
  1623. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1624. }
  1625. // 3班4班锁定1班未锁定
  1626. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1627. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1628. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1629. row.r1 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1630. if (row.w1 <= 0) {
  1631. row.w1 = 0
  1632. row.r1 = 0
  1633. }
  1634. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1635. }
  1636. // 1班锁定,3班4班未锁
  1637. if (row.isOneWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1638. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1639. if (row.r3 == 0 && row.r4 == 0) {
  1640. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  1641. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1642. row.w4 = row.w3
  1643. row.r4 = row.r3
  1644. } else if (row.r3 == 0 && row.r4 !== 0) {
  1645. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1646. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1647. if (row.w1 == '') { row.w1 = 0 }
  1648. if (row.w2 == '') { row.w2 = 0 }
  1649. if (row.w3 == '') { row.w3 = 0 }
  1650. if (row.w4 == '') { row.w4 = 0 }
  1651. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1652. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1653. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1654. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1655. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1656. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1657. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1658. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1659. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1660. }
  1661. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1662. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1663. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1664. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1665. } else if (row.r3 !== 0 && row.r4 == 0) {
  1666. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1667. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1668. if (row.w1 == '') { row.w1 = 0 }
  1669. if (row.w2 == '') { row.w2 = 0 }
  1670. if (row.w3 == '') { row.w3 = 0 }
  1671. if (row.w4 == '') { row.w4 = 0 }
  1672. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1673. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1674. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1675. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1676. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1677. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1678. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1679. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1680. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1681. }
  1682. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1683. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1684. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1685. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1686. } else {
  1687. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1688. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1689. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1690. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1691. }
  1692. if (isNaN(row.w3)) {
  1693. row.w3 = 0
  1694. row.r3 = 0
  1695. }
  1696. if (isNaN(row.w4)) {
  1697. row.w4 = 0
  1698. row.r4 = 0
  1699. }
  1700. if (row.w3 <= 0) {
  1701. row.w3 = 0
  1702. row.r3 = 0
  1703. }
  1704. if (row.w4 <= 0) {
  1705. row.w4 = 0
  1706. row.r4 = 0
  1707. }
  1708. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1709. }
  1710. // 3班锁定,1班4班未锁
  1711. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1712. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1713. if (row.r1 == 0 && row.r4 == 0) {
  1714. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  1715. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1716. row.w4 = row.w1
  1717. row.r4 = row.r1
  1718. } else if (row.r1 == 0 && row.r4 !== 0) {
  1719. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1720. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1721. if (row.w1 == '') { row.w1 = 0 }
  1722. if (row.w2 == '') { row.w2 = 0 }
  1723. if (row.w3 == '') { row.w3 = 0 }
  1724. if (row.w4 == '') { row.w4 = 0 }
  1725. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1726. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1727. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1728. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1729. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1730. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1731. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1732. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1733. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1734. }
  1735. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1736. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1737. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1738. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1739. } else if (row.r1 !== 0 && row.r4 == 0) {
  1740. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  1741. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1742. if (row.w1 == '') { row.w1 = 0 }
  1743. if (row.w2 == '') { row.w2 = 0 }
  1744. if (row.w3 == '') { row.w3 = 0 }
  1745. if (row.w4 == '') { row.w4 = 0 }
  1746. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1747. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1748. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1749. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1750. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1751. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1752. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1753. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1754. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1755. }
  1756. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1757. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1758. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1759. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1760. } else {
  1761. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1762. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1763. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1764. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1765. }
  1766. if (isNaN(row.w1)) {
  1767. row.w1 = 0
  1768. row.r1 = 0
  1769. }
  1770. if (isNaN(row.w4)) {
  1771. row.w4 = 0
  1772. row.r4 = 0
  1773. }
  1774. if (row.w1 <= 0) {
  1775. row.w1 = 0
  1776. row.r1 = 0
  1777. }
  1778. if (row.w4 <= 0) {
  1779. row.w4 = 0
  1780. row.r4 = 0
  1781. }
  1782. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1783. }
  1784. // 4班锁定,1班3班未锁
  1785. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1786. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1787. if (row.r1 == 0 && row.r3 == 0) {
  1788. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  1789. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1790. row.w3 = row.w1
  1791. row.r3 = row.r1
  1792. } else if (row.r1 == 0 && row.r3 !== 0) {
  1793. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1794. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1795. if (row.w1 == '') { row.w1 = 0 }
  1796. if (row.w2 == '') { row.w2 = 0 }
  1797. if (row.w3 == '') { row.w3 = 0 }
  1798. if (row.w4 == '') { row.w4 = 0 }
  1799. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1800. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1801. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1802. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1803. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1804. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1805. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1806. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow2.r1)), parseInt(Cookies.get('decimal')))
  1807. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1808. }
  1809. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1810. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1811. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1812. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1813. } else if (row.r1 !== 0 && row.r3 == 0) {
  1814. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  1815. row.r3 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1816. if (row.w1 == '') { row.w1 = 0 }
  1817. if (row.w2 == '') { row.w2 = 0 }
  1818. if (row.w3 == '') { row.w3 = 0 }
  1819. if (row.w4 == '') { row.w4 = 0 }
  1820. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1821. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1822. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1823. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1824. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1825. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1826. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1827. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1828. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1829. }
  1830. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1831. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1832. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1833. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1834. } else {
  1835. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1836. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1837. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow2.r1)), parseInt(Cookies.get('decimal')))
  1838. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1839. }
  1840. if (isNaN(row.w1)) {
  1841. row.w1 = 0
  1842. row.r1 = 0
  1843. }
  1844. if (isNaN(row.w3)) {
  1845. row.w3 = 0
  1846. row.r3 = 0
  1847. }
  1848. if (row.w1 <= 0) {
  1849. row.w1 = 0
  1850. row.r1 = 0
  1851. }
  1852. if (row.w3 <= 0) {
  1853. row.w3 = 0
  1854. row.r3 = 0
  1855. }
  1856. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1857. }
  1858. // 1班3班4班未锁
  1859. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1860. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1861. if (row.r1 == 0 && row.r3 == 0 && row.r4 == 0) {
  1862. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) / 3, parseInt(Cookies.get('decimal')))
  1863. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1864. row.w3 = row.w1
  1865. row.r3 = row.r1
  1866. row.w4 = row.w1
  1867. row.r4 = row.r1
  1868. } else if (row.r1 == 0 && row.r3 == 0 && row.r4 !== 0) {
  1869. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  1870. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1871. row.w3 = row.w1
  1872. row.r3 = row.r1
  1873. if (row.w1 == '') { row.w1 = 0 }
  1874. if (row.w2 == '') { row.w2 = 0 }
  1875. if (row.w3 == '') { row.w3 = 0 }
  1876. if (row.w4 == '') { row.w4 = 0 }
  1877. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1878. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1879. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1880. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1881. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1882. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1883. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1884. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  1885. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1886. }
  1887. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1888. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1889. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1890. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1891. } else if (row.r1 == 0 && row.r3 !== 0 && row.r4 == 0) {
  1892. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  1893. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1894. row.w4 = row.w1
  1895. row.r4 = row.r1
  1896. if (row.w1 == '') { row.w1 = 0 }
  1897. if (row.w2 == '') { row.w2 = 0 }
  1898. if (row.w3 == '') { row.w3 = 0 }
  1899. if (row.w4 == '') { row.w4 = 0 }
  1900. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1901. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1902. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1903. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1904. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1905. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1906. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1907. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  1908. row.r3 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1909. }
  1910. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1911. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1912. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1913. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1914. } else if (row.r1 !== 0 && row.r3 == 0 && row.r4 == 0) {
  1915. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  1916. row.r3 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1917. row.w4 = row.w3
  1918. row.r4 = row.r3
  1919. if (row.w1 == '') { row.w1 = 0 }
  1920. if (row.w2 == '') { row.w2 = 0 }
  1921. if (row.w3 == '') { row.w3 = 0 }
  1922. if (row.w4 == '') { row.w4 = 0 }
  1923. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1924. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1925. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1926. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1927. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1928. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1929. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1930. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1931. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1932. }
  1933. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1934. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1935. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1936. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1937. } else if ((row.r1 !== 0 && row.r3 !== 0 && row.r4 == 0)) {
  1938. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1939. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1940. if (row.w1 == '') { row.w1 = 0 }
  1941. if (row.w2 == '') { row.w2 = 0 }
  1942. if (row.w3 == '') { row.w3 = 0 }
  1943. if (row.w4 == '') { row.w4 = 0 }
  1944. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1945. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1946. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1947. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1948. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1949. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1950. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1951. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1952. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1953. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  1954. row.r3 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1955. }
  1956. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1957. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1958. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1959. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1960. } else if ((row.r1 !== 0 && row.r3 == 0 && row.r4 !== 0)) {
  1961. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1962. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1963. if (row.w1 == '') { row.w1 = 0 }
  1964. if (row.w2 == '') { row.w2 = 0 }
  1965. if (row.w3 == '') { row.w3 = 0 }
  1966. if (row.w4 == '') { row.w4 = 0 }
  1967. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1968. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1969. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1970. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1971. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1972. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1973. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1974. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1975. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1976. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  1977. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1978. }
  1979. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1980. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1981. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1982. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1983. } else if ((row.r1 == 0 && row.r3 !== 0 && row.r4 !== 0)) {
  1984. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1985. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1986. if (row.w1 == '') { row.w1 = 0 }
  1987. if (row.w2 == '') { row.w2 = 0 }
  1988. if (row.w3 == '') { row.w3 = 0 }
  1989. if (row.w4 == '') { row.w4 = 0 }
  1990. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1991. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1992. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1993. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1994. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1995. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1996. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1997. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  1998. row.r3 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1999. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2000. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2001. }
  2002. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2003. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2004. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2005. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2006. } else {
  2007. console.log('wolaile')
  2008. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2009. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2010. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2011. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2012. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2013. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2014. }
  2015. if (isNaN(row.w1)) {
  2016. row.w1 = 0
  2017. row.r1 = 0
  2018. }
  2019. if (isNaN(row.w3)) {
  2020. row.w3 = 0
  2021. row.r3 = 0
  2022. }
  2023. if (isNaN(row.w4)) {
  2024. row.w4 = 0
  2025. row.r4 = 0
  2026. }
  2027. if (row.w1 <= 0) {
  2028. row.w1 = 0
  2029. row.r1 = 0
  2030. }
  2031. if (row.w3 <= 0) {
  2032. row.w3 = 0
  2033. row.r3 = 0
  2034. }
  2035. if (row.w4 <= 0) {
  2036. row.w4 = 0
  2037. row.r4 = 0
  2038. }
  2039. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2040. }
  2041. } else if (this.table.RWLength == 3) {
  2042. // 三班
  2043. // 1班/3班锁定
  2044. if (row.isOneWeight == true && row.isThreeWeight == true) {
  2045. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2046. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2047. }
  2048. // 1班不锁3班锁
  2049. if (row.isOneWeight == false && row.isThreeWeight == true) {
  2050. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2051. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2052. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2053. if (row.w1 <= 0) {
  2054. row.w1 = 0
  2055. row.r1 = 0
  2056. }
  2057. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2058. }
  2059. // 3班不锁1班锁
  2060. if (row.isOneWeight == true && row.isThreeWeight == false) {
  2061. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2062. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2), parseInt(Cookies.get('decimal')))
  2063. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2064. if (row.w3 <= 0) {
  2065. row.w3 = 0
  2066. row.r3 = 0
  2067. }
  2068. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2069. }
  2070. // 1班3班都不锁
  2071. if (row.isOneWeight == false && row.isThreeWeight == false) {
  2072. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2073. if (row.r1 == 0 && row.r3 == 0) {
  2074. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2075. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2076. row.w3 = row.w1
  2077. row.r3 = row.r1
  2078. } else if (row.r1 == 0 && row.r3 !== 0) {
  2079. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2080. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2081. if (row.w1 == '') { row.w1 = 0 }
  2082. if (row.w2 == '') { row.w2 = 0 }
  2083. if (row.w3 == '') { row.w3 = 0 }
  2084. if (row.w4 == '') { row.w4 = 0 }
  2085. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2086. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2087. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2088. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2089. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2090. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2091. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2092. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2093. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2094. }
  2095. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2096. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2097. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2098. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2099. } else if (row.r1 !== 0 && row.r3 == 0) {
  2100. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2101. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2102. if (row.w1 == '') { row.w1 = 0 }
  2103. if (row.w2 == '') { row.w2 = 0 }
  2104. if (row.w3 == '') { row.w3 = 0 }
  2105. if (row.w4 == '') { row.w4 = 0 }
  2106. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2107. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2108. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2109. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2110. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2111. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2112. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2113. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2114. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2115. }
  2116. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2117. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2118. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2119. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2120. } else {
  2121. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2122. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2123. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2124. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2125. }
  2126. if (isNaN(row.w1)) {
  2127. row.w1 = 0
  2128. row.r1 = 0
  2129. }
  2130. if (isNaN(row.w3)) {
  2131. row.w3 = 0
  2132. row.r3 = 0
  2133. }
  2134. if (row.w3 <= 0) {
  2135. row.w3 = 0
  2136. row.r3 = 0
  2137. }
  2138. if (row.w1 <= 0) {
  2139. row.w1 = 0
  2140. row.r1 = 0
  2141. }
  2142. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2143. }
  2144. } else if (this.table.RWLength == 2) {
  2145. if (row.isOneWeight == false) {
  2146. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2147. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2), parseInt(Cookies.get('decimal')))
  2148. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2149. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2150. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  2151. } else {
  2152. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2153. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  2154. }
  2155. }
  2156. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2157. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2158. if (row.w1 == '') { row.w1 = 0 }
  2159. if (row.w2 == '') { row.w2 = 0 }
  2160. if (row.w3 == '') { row.w3 = 0 }
  2161. if (row.w4 == '') { row.w4 = 0 }
  2162. if (isNaN(row.r1)) { row.r1 = 0 }
  2163. if (isNaN(row.r2)) { row.r2 = 0 }
  2164. if (isNaN(row.r3)) { row.r3 = 0 }
  2165. if (isNaN(row.r4)) { row.r4 = 0 }
  2166. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2167. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2168. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2169. },
  2170. blurW3(row) {
  2171. // 3班重量
  2172. if (row.w1 == '') {
  2173. row.w1 = 0
  2174. }
  2175. if (row.w2 == '') {
  2176. row.w2 = 0
  2177. }
  2178. if (row.w3 == '') {
  2179. row.w3 = 0
  2180. }
  2181. if (row.w4 == '') {
  2182. row.w4 = 0
  2183. }
  2184. if (row.r1 == '') {
  2185. row.r1 = 0
  2186. }
  2187. if (row.r2 == '') {
  2188. row.r2 = 0
  2189. }
  2190. if (row.r3 == '') {
  2191. row.r3 = 0
  2192. }
  2193. if (row.r4 == '') {
  2194. row.r4 = 0
  2195. }
  2196. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2197. console.log(row, '=======投喂量feedweight')
  2198. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2199. if (this.table.RWLength == 4) {
  2200. // 四班
  2201. // 1班2班4班都锁定
  2202. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == true) {
  2203. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2204. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2205. }
  2206. // 1班2班锁定4班未锁定
  2207. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == false) {
  2208. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2209. row.w4 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2210. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2211. if (row.w4 <= 0) {
  2212. row.w4 = 0
  2213. row.r4 = 0
  2214. }
  2215. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2216. }
  2217. // 2班4班锁定1班未锁定
  2218. if (row.isOneWeight == false && row.isTwoWeight == true && row.isFourWeight == true) {
  2219. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2220. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2221. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2222. if (row.w1 <= 0) {
  2223. row.w1 = 0
  2224. row.r1 = 0
  2225. }
  2226. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2227. }
  2228. // 1班4班锁定2班未锁定
  2229. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == true) {
  2230. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2231. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2232. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2233. if (row.w2 <= 0) {
  2234. row.w2 = 0
  2235. row.r2 = 0
  2236. }
  2237. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2238. }
  2239. // 2班锁定,1班4班未锁
  2240. if (row.isTwoWeight == true && row.isOneWeight == false && row.isFourWeight == false) {
  2241. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2242. if (row.r1 == 0 && row.r4 == 0) {
  2243. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2244. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2245. row.w4 = row.w1
  2246. row.r4 = row.r1
  2247. } else if (row.r1 == 0 && row.r4 !== 0) {
  2248. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2249. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2250. if (row.w1 == '') { row.w1 = 0 }
  2251. if (row.w2 == '') { row.w2 = 0 }
  2252. if (row.w3 == '') { row.w3 = 0 }
  2253. if (row.w4 == '') { row.w4 = 0 }
  2254. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2255. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2256. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2257. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2258. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2259. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2260. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2261. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2262. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2263. }
  2264. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2265. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2266. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2267. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2268. } else if (row.r1 !== 0 && row.r4 == 0) {
  2269. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2270. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2271. if (row.w1 == '') { row.w1 = 0 }
  2272. if (row.w2 == '') { row.w2 = 0 }
  2273. if (row.w3 == '') { row.w3 = 0 }
  2274. if (row.w4 == '') { row.w4 = 0 }
  2275. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2276. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2277. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2278. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2279. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2280. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2281. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2282. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2283. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2284. }
  2285. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2286. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2287. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2288. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2289. } else {
  2290. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2291. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2292. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2293. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2294. }
  2295. if (isNaN(row.w1)) {
  2296. row.w1 = 0
  2297. row.r1 = 0
  2298. }
  2299. if (isNaN(row.w4)) {
  2300. row.w4 = 0
  2301. row.r4 = 0
  2302. }
  2303. if (row.w1 <= 0) {
  2304. row.w1 = 0
  2305. row.r1 = 0
  2306. }
  2307. if (row.w4 <= 0) {
  2308. row.w4 = 0
  2309. row.r4 = 0
  2310. }
  2311. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2312. }
  2313. // 1班锁定,2班4班未锁
  2314. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == false) {
  2315. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2316. if (row.r2 == 0 && row.r4 == 0) {
  2317. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2318. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2319. row.w4 = row.w2
  2320. row.r4 = row.r2
  2321. } else if (row.r2 == 0 && row.r4 !== 0) {
  2322. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2323. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2324. if (row.w1 == '') { row.w1 = 0 }
  2325. if (row.w2 == '') { row.w2 = 0 }
  2326. if (row.w3 == '') { row.w3 = 0 }
  2327. if (row.w4 == '') { row.w4 = 0 }
  2328. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2329. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2330. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2331. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2332. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2333. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2334. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2335. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2336. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2337. }
  2338. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2339. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2340. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2341. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2342. } else if (row.r2 !== 0 && row.r4 == 0) {
  2343. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2344. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2345. if (row.w1 == '') { row.w1 = 0 }
  2346. if (row.w2 == '') { row.w2 = 0 }
  2347. if (row.w3 == '') { row.w3 = 0 }
  2348. if (row.w4 == '') { row.w4 = 0 }
  2349. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2350. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2351. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2352. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2353. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2354. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2355. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2356. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2357. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2358. }
  2359. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2360. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2361. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2362. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2363. } else {
  2364. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2365. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2366. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2367. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2368. }
  2369. if (isNaN(row.w2)) {
  2370. row.w2 = 0
  2371. row.r2 = 0
  2372. }
  2373. if (isNaN(row.w4)) {
  2374. row.w4 = 0
  2375. row.r4 = 0
  2376. }
  2377. if (row.w2 <= 0) {
  2378. row.w2 = 0
  2379. row.r2 = 0
  2380. }
  2381. if (row.w4 <= 0) {
  2382. row.w4 = 0
  2383. row.r4 = 0
  2384. }
  2385. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2386. }
  2387. // 4班锁定,2班1班未锁
  2388. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == true) {
  2389. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2390. if (row.r1 == 0 && row.r2 == 0) {
  2391. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  2392. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2393. row.w2 = row.w1
  2394. row.r2 = row.r1
  2395. } else if (row.r1 == 0 && row.r2 !== 0) {
  2396. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2397. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2398. if (row.w1 == '') { row.w1 = 0 }
  2399. if (row.w2 == '') { row.w2 = 0 }
  2400. if (row.w3 == '') { row.w3 = 0 }
  2401. if (row.w4 == '') { row.w4 = 0 }
  2402. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2403. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2404. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2405. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2406. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2407. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2408. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2409. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2410. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2411. }
  2412. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2413. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2414. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2415. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2416. } else if (row.r1 !== 0 && row.r2 == 0) {
  2417. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2418. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2419. if (row.w1 == '') { row.w1 = 0 }
  2420. if (row.w2 == '') { row.w2 = 0 }
  2421. if (row.w3 == '') { row.w3 = 0 }
  2422. if (row.w4 == '') { row.w4 = 0 }
  2423. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2424. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2425. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2426. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2427. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2428. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2429. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2430. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2431. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2432. }
  2433. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2434. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2435. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2436. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2437. } else {
  2438. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2439. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2440. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2441. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2442. }
  2443. if (isNaN(row.w1)) {
  2444. row.w1 = 0
  2445. row.r1 = 0
  2446. }
  2447. if (isNaN(row.w2)) {
  2448. row.w2 = 0
  2449. row.r2 = 0
  2450. }
  2451. if (row.w2 <= 0) {
  2452. row.w2 = 0
  2453. row.r2 = 0
  2454. }
  2455. if (row.w1 <= 0) {
  2456. row.w1 = 0
  2457. row.r1 = 0
  2458. }
  2459. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2460. }
  2461. // 2班1班4班未锁
  2462. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == false) {
  2463. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2464. if (row.r1 == 0 && row.r2 == 0 && row.r4 == 0) {
  2465. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) / 3, parseInt(Cookies.get('decimal')))
  2466. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2467. row.w2 = row.w1
  2468. row.r2 = row.r1
  2469. row.w4 = row.w1
  2470. row.r4 = row.r1
  2471. } else if (row.r1 == 0 && row.r2 == 0 && row.r4 !== 0) {
  2472. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  2473. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2474. row.w2 = row.w1
  2475. row.r2 = row.r1
  2476. if (row.w1 == '') { row.w1 = 0 }
  2477. if (row.w2 == '') { row.w2 = 0 }
  2478. if (row.w3 == '') { row.w3 = 0 }
  2479. if (row.w4 == '') { row.w4 = 0 }
  2480. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2481. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2482. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2483. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2484. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2485. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2486. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2487. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2488. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2489. }
  2490. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2491. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2492. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2493. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2494. } else if (row.r1 == 0 && row.r2 !== 0 && row.r4 == 0) {
  2495. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2496. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2497. row.w4 = row.w1
  2498. row.r4 = row.r1
  2499. if (row.w1 == '') { row.w1 = 0 }
  2500. if (row.w2 == '') { row.w2 = 0 }
  2501. if (row.w3 == '') { row.w3 = 0 }
  2502. if (row.w4 == '') { row.w4 = 0 }
  2503. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2504. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2505. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2506. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2507. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2508. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2509. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2510. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2511. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2512. }
  2513. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2514. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2515. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2516. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2517. } else if (row.r1 !== 0 && row.r2 == 0 && row.r4 == 0) {
  2518. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  2519. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2520. row.w4 = row.w1
  2521. row.r4 = row.r1
  2522. if (row.w1 == '') { row.w1 = 0 }
  2523. if (row.w2 == '') { row.w2 = 0 }
  2524. if (row.w3 == '') { row.w3 = 0 }
  2525. if (row.w4 == '') { row.w4 = 0 }
  2526. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2527. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2528. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2529. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2530. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2531. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2532. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2533. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2534. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2535. }
  2536. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2537. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2538. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2539. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2540. } else if (row.r1 !== 0 && row.r2 !== 0 && row.r4 == 0) {
  2541. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2542. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2543. if (row.w1 == '') { row.w1 = 0 }
  2544. if (row.w2 == '') { row.w2 = 0 }
  2545. if (row.w3 == '') { row.w3 = 0 }
  2546. if (row.w4 == '') { row.w4 = 0 }
  2547. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2548. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2549. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2550. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2551. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2552. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2553. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2554. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2555. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2556. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2557. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2558. }
  2559. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2560. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2561. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2562. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2563. } else if (row.r1 !== 0 && row.r2 == 0 && row.r4 !== 0) {
  2564. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2565. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2566. if (row.w1 == '') { row.w1 = 0 }
  2567. if (row.w2 == '') { row.w2 = 0 }
  2568. if (row.w3 == '') { row.w3 = 0 }
  2569. if (row.w4 == '') { row.w4 = 0 }
  2570. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2571. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2572. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2573. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2574. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2575. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2576. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2577. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2578. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2579. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2580. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2581. }
  2582. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2583. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2584. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2585. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2586. } else if (row.r1 == 0 && row.r2 !== 0 && row.r4 !== 0) {
  2587. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2588. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2589. if (row.w1 == '') { row.w1 = 0 }
  2590. if (row.w2 == '') { row.w2 = 0 }
  2591. if (row.w3 == '') { row.w3 = 0 }
  2592. if (row.w4 == '') { row.w4 = 0 }
  2593. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2594. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2595. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2596. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2597. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2598. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2599. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2600. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2601. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2602. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2603. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2604. }
  2605. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2606. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2607. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2608. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2609. } else {
  2610. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2611. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2612. row.w2 = formatNum((parseFloat(row.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2613. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2614. row.w4 = formatNum((parseFloat(row.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2615. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2616. }
  2617. if (isNaN(row.w1)) {
  2618. row.w1 = 0
  2619. row.r1 = 0
  2620. }
  2621. if (isNaN(row.w2)) {
  2622. row.w2 = 0
  2623. row.r2 = 0
  2624. }
  2625. if (isNaN(row.w4)) {
  2626. row.w4 = 0
  2627. row.r4 = 0
  2628. }
  2629. if (row.w1 <= 0) {
  2630. row.w1 = 0
  2631. row.r1 = 0
  2632. }
  2633. if (row.w2 <= 0) {
  2634. row.w2 = 0
  2635. row.r2 = 0
  2636. }
  2637. if (row.w4 <= 0) {
  2638. row.w4 = 0
  2639. row.r4 = 0
  2640. }
  2641. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2642. }
  2643. } else if (this.table.RWLength == 3) {
  2644. // 三班
  2645. // 1班/2班锁定
  2646. if (row.isOneWeight == true && row.isTwoWeight == true) {
  2647. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2648. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2649. }
  2650. // 1班不锁2班锁
  2651. if (row.isOneWeight == false && row.isTwoWeight == true) {
  2652. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2653. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2654. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2655. if (row.w1 <= 0) {
  2656. row.w1 = 0
  2657. row.r1 = 0
  2658. }
  2659. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2660. }
  2661. // 3班不锁2班锁
  2662. // 2班不锁1班锁
  2663. if (row.isOneWeight == true && row.isTwoWeight == false) {
  2664. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2665. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2666. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2667. if (row.w2 <= 0) {
  2668. row.w2 = 0
  2669. row.r2 = 0
  2670. }
  2671. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2672. }
  2673. // 2班3班都不锁
  2674. // 1班2班都不锁
  2675. if (row.isOneWeight == false && row.isTwoWeight == false) {
  2676. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2677. if (row.r1 == 0 && row.r2 == 0) {
  2678. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2679. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2680. row.w2 = row.w1
  2681. row.r2 = row.r1
  2682. } else if (row.r1 == 0 && row.r2 !== 0) {
  2683. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2684. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2685. if (row.w1 == '') { row.w1 = 0 }
  2686. if (row.w2 == '') { row.w2 = 0 }
  2687. if (row.w3 == '') { row.w3 = 0 }
  2688. if (row.w4 == '') { row.w4 = 0 }
  2689. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2690. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2691. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2692. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2693. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2694. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2695. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2696. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2697. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2698. }
  2699. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2700. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2701. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2702. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2703. } else if (row.r1 !== 0 && row.r2 == 0) {
  2704. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2705. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2706. if (row.w1 == '') { row.w1 = 0 }
  2707. if (row.w2 == '') { row.w2 = 0 }
  2708. if (row.w3 == '') { row.w3 = 0 }
  2709. if (row.w4 == '') { row.w4 = 0 }
  2710. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2711. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2712. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2713. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2714. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2715. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2716. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2717. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2718. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2719. }
  2720. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2721. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2722. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2723. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2724. } else {
  2725. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2726. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2727. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2728. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2729. }
  2730. if (isNaN(row.w1)) {
  2731. row.w1 = 0
  2732. row.r1 = 0
  2733. }
  2734. if (isNaN(row.w2)) {
  2735. row.w2 = 0
  2736. row.r2 = 0
  2737. }
  2738. if (row.w1 <= 0) {
  2739. row.w1 = 0
  2740. row.r1 = 0
  2741. }
  2742. if (row.w2 <= 0) {
  2743. row.w2 = 0
  2744. row.r2 = 0
  2745. }
  2746. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2747. }
  2748. }
  2749. if (row.w1 == '') { row.w1 = 0 }
  2750. if (row.w2 == '') { row.w2 = 0 }
  2751. if (row.w3 == '') { row.w3 = 0 }
  2752. if (row.w4 == '') { row.w4 = 0 }
  2753. if (isNaN(row.r1)) { row.r1 = 0 }
  2754. if (isNaN(row.r2)) { row.r2 = 0 }
  2755. if (isNaN(row.r3)) { row.r3 = 0 }
  2756. if (isNaN(row.r4)) { row.r4 = 0 }
  2757. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2758. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2759. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2760. },
  2761. blurW4(row) {
  2762. if (row.w1 == '') {
  2763. row.w1 = 0
  2764. }
  2765. if (row.w2 == '') {
  2766. row.w2 = 0
  2767. }
  2768. if (row.w3 == '') {
  2769. row.w3 = 0
  2770. }
  2771. if (row.w4 == '') {
  2772. row.w4 = 0
  2773. }
  2774. if (row.r1 == '') {
  2775. row.r1 = 0
  2776. }
  2777. if (row.r2 == '') {
  2778. row.r2 = 0
  2779. }
  2780. if (row.r3 == '') {
  2781. row.r3 = 0
  2782. }
  2783. if (row.r4 == '') {
  2784. row.r4 = 0
  2785. }
  2786. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2787. console.log(row, '=======投喂量feedweight')
  2788. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2789. if (this.table.RWLength == 4) {
  2790. // 四班
  2791. // 1班2班3班都锁定
  2792. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == true) {
  2793. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2794. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2795. }
  2796. // 2班3班锁定1班未锁定
  2797. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == true) {
  2798. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2799. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2800. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2801. if (row.w1 <= 0) {
  2802. row.w1 = 0
  2803. row.r1 = 0
  2804. }
  2805. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2806. }
  2807. // 2班1班锁定3班未锁定
  2808. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == false) {
  2809. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2810. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2811. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2812. if (row.w3 <= 0) {
  2813. row.w3 = 0
  2814. row.r3 = 0
  2815. }
  2816. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2817. }
  2818. // 3班1班锁定2班未锁定
  2819. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == true) {
  2820. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2821. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2822. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2823. if (row.w2 <= 0) {
  2824. row.w2 = 0
  2825. row.r2 = 0
  2826. }
  2827. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2828. }
  2829. // 2班锁定,3班1班未锁
  2830. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == false) {
  2831. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2832. if (row.r1 == 0 && row.r3 == 0) {
  2833. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2834. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2835. row.w3 = row.w1
  2836. row.r3 = row.r1
  2837. } else if (row.r1 == 0 && row.r3 !== 0) {
  2838. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2839. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2840. if (row.w1 == '') { row.w1 = 0 }
  2841. if (row.w2 == '') { row.w2 = 0 }
  2842. if (row.w3 == '') { row.w3 = 0 }
  2843. if (row.w4 == '') { row.w4 = 0 }
  2844. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2845. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2846. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2847. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2848. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2849. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2850. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  2851. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  2852. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2853. }
  2854. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2855. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2856. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2857. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2858. } else if (row.r1 !== 0 && row.r3 == 0) {
  2859. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2860. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2861. if (row.w1 == '') { row.w1 = 0 }
  2862. if (row.w2 == '') { row.w2 = 0 }
  2863. if (row.w3 == '') { row.w3 = 0 }
  2864. if (row.w4 == '') { row.w4 = 0 }
  2865. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2866. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2867. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2868. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2869. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2870. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2871. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  2872. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2873. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2874. }
  2875. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2876. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2877. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2878. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2879. } else {
  2880. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2881. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2882. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  2883. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2884. }
  2885. if (isNaN(row.w1)) {
  2886. row.w1 = 0
  2887. row.r1 = 0
  2888. }
  2889. if (isNaN(row.w3)) {
  2890. row.w3 = 0
  2891. row.r3 = 0
  2892. }
  2893. if (row.w3 <= 0) {
  2894. row.w3 = 0
  2895. row.r3 = 0
  2896. }
  2897. if (row.w1 <= 0) {
  2898. row.w1 = 0
  2899. row.r1 = 0
  2900. }
  2901. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2902. }
  2903. // 3班锁定,2班1班未锁
  2904. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == true) {
  2905. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2906. if (row.r1 == 0 && row.r2 == 0) {
  2907. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2908. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2909. row.w2 = row.w1
  2910. row.r2 = row.r1
  2911. } else if (row.r1 == 0 && row.r2 !== 0) {
  2912. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2913. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2914. if (row.w1 == '') { row.w1 = 0 }
  2915. if (row.w2 == '') { row.w2 = 0 }
  2916. if (row.w3 == '') { row.w3 = 0 }
  2917. if (row.w4 == '') { row.w4 = 0 }
  2918. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2919. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2920. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2921. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2922. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2923. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2924. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  2925. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  2926. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2927. }
  2928. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2929. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2930. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2931. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2932. } else if (row.r1 !== 0 && row.r2 == 0) {
  2933. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2934. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2935. if (row.w1 == '') { row.w1 = 0 }
  2936. if (row.w2 == '') { row.w2 = 0 }
  2937. if (row.w3 == '') { row.w3 = 0 }
  2938. if (row.w4 == '') { row.w4 = 0 }
  2939. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2940. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2941. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2942. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2943. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2944. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2945. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  2946. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r2) + parseFloat(row.r1)), parseInt(Cookies.get('decimal')))
  2947. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2948. }
  2949. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2950. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2951. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2952. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2953. } else {
  2954. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r2) + parseFloat(row.r1)), parseInt(Cookies.get('decimal')))
  2955. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2956. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  2957. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2958. }
  2959. if (isNaN(row.w1)) {
  2960. row.w1 = 0
  2961. row.r1 = 0
  2962. }
  2963. if (isNaN(row.w2)) {
  2964. row.w2 = 0
  2965. row.r2 = 0
  2966. }
  2967. if (row.w2 <= 0) {
  2968. row.w2 = 0
  2969. row.r2 = 0
  2970. }
  2971. if (row.w1 <= 0) {
  2972. row.w1 = 0
  2973. row.r1 = 0
  2974. }
  2975. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2976. }
  2977. // 1班锁定,2班3班未锁
  2978. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == false) {
  2979. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2980. if (row.r2 == 0 && row.r3 == 0) {
  2981. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  2982. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2983. row.w3 = row.w2
  2984. row.r3 = row.r2
  2985. } else if (row.r2 == 0 && row.r3 !== 0) {
  2986. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2987. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2988. if (row.w1 == '') { row.w1 = 0 }
  2989. if (row.w2 == '') { row.w2 = 0 }
  2990. if (row.w3 == '') { row.w3 = 0 }
  2991. if (row.w4 == '') { row.w4 = 0 }
  2992. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2993. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2994. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2995. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2996. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2997. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2998. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  2999. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3000. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3001. }
  3002. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3003. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3004. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3005. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3006. } else if (row.r2 !== 0 && row.r3 == 0) {
  3007. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3008. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3009. if (row.w1 == '') { row.w1 = 0 }
  3010. if (row.w2 == '') { row.w2 = 0 }
  3011. if (row.w3 == '') { row.w3 = 0 }
  3012. if (row.w4 == '') { row.w4 = 0 }
  3013. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3014. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3015. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3016. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3017. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3018. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3019. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3020. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3021. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3022. }
  3023. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3024. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3025. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3026. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3027. } else {
  3028. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3029. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3030. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3031. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3032. }
  3033. if (isNaN(row.w2)) {
  3034. row.w2 = 0
  3035. row.r2 = 0
  3036. }
  3037. if (isNaN(row.w3)) {
  3038. row.w3 = 0
  3039. row.r3 = 0
  3040. }
  3041. if (row.w2 <= 0) {
  3042. row.w2 = 0
  3043. row.r2 = 0
  3044. }
  3045. if (row.w3 <= 0) {
  3046. row.w3 = 0
  3047. row.r3 = 0
  3048. }
  3049. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3050. }
  3051. // 2班3班1班未锁
  3052. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == false) {
  3053. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3054. if (row.r1 == 0 && row.r2 == 0 && row.r3 == 0) {
  3055. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) / 3, parseInt(Cookies.get('decimal')))
  3056. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3057. row.w2 = row.w1
  3058. row.r2 = row.r1
  3059. row.w3 = row.w1
  3060. row.r3 = row.r1
  3061. } else if (row.r1 == 0 && row.r2 == 0 && row.r3 !== 0) {
  3062. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  3063. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3064. row.w2 = row.w1
  3065. row.r2 = row.r1
  3066. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3067. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3068. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3069. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3070. if (row.w1 == '') { row.w1 = 0 }
  3071. if (row.w2 == '') { row.w2 = 0 }
  3072. if (row.w3 == '') { row.w3 = 0 }
  3073. if (row.w4 == '') { row.w4 = 0 }
  3074. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3075. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3076. console.log(row.dailyWeight)
  3077. console.log(this.focusWRow4.dailyWeight)
  3078. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3079. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3080. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3081. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3082. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3083. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3084. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3085. }
  3086. } else if (row.r1 == 0 && row.r2 !== 0 && row.r3 == 0) {
  3087. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  3088. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3089. row.w3 = row.w1
  3090. row.r3 = row.r1
  3091. if (row.w1 == '') { row.w1 = 0 }
  3092. if (row.w2 == '') { row.w2 = 0 }
  3093. if (row.w3 == '') { row.w3 = 0 }
  3094. if (row.w4 == '') { row.w4 = 0 }
  3095. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3096. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3097. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3098. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3099. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3100. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3101. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3102. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3103. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3104. }
  3105. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3106. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3107. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3108. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3109. } else if (row.r1 !== 0 && row.r2 == 0 && row.r3 == 0) {
  3110. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  3111. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3112. row.w3 = row.w1
  3113. row.r3 = row.r1
  3114. if (row.w1 == '') { row.w1 = 0 }
  3115. if (row.w2 == '') { row.w2 = 0 }
  3116. if (row.w3 == '') { row.w3 = 0 }
  3117. if (row.w4 == '') { row.w4 = 0 }
  3118. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3119. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3120. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3121. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3122. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3123. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3124. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3125. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3126. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3127. }
  3128. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3129. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3130. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3131. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3132. } else if (row.r1 !== 0 && row.r2 !== 0 && row.r3 == 0) {
  3133. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w1) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3134. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3135. if (row.w1 == '') { row.w1 = 0 }
  3136. if (row.w2 == '') { row.w2 = 0 }
  3137. if (row.w3 == '') { row.w3 = 0 }
  3138. if (row.w4 == '') { row.w4 = 0 }
  3139. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3140. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3141. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3142. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3143. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3144. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3145. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3146. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3147. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3148. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3149. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3150. }
  3151. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3152. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3153. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3154. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3155. } else if (row.r1 !== 0 && row.r2 == 0 && row.r3 !== 0) {
  3156. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w1) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  3157. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3158. if (row.w1 == '') { row.w1 = 0 }
  3159. if (row.w2 == '') { row.w2 = 0 }
  3160. if (row.w3 == '') { row.w3 = 0 }
  3161. if (row.w4 == '') { row.w4 = 0 }
  3162. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3163. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3164. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3165. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3166. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3167. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3168. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3169. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3170. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3171. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3172. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3173. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3174. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3175. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3176. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3177. }
  3178. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3179. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3180. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3181. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3182. } else if (row.r1 == 0 && row.r2 !== 0 && row.r3 !== 0) {
  3183. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  3184. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3185. if (row.w1 == '') { row.w1 = 0 }
  3186. if (row.w2 == '') { row.w2 = 0 }
  3187. if (row.w3 == '') { row.w3 = 0 }
  3188. if (row.w4 == '') { row.w4 = 0 }
  3189. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3190. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3191. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3192. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3193. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3194. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3195. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3196. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3197. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3198. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3199. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3200. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3201. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3202. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3203. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3204. }
  3205. } else {
  3206. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3207. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3208. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3209. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3210. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3211. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3212. }
  3213. if (isNaN(row.w1)) {
  3214. row.w1 = 0
  3215. row.r1 = 0
  3216. }
  3217. if (isNaN(row.w2)) {
  3218. row.w2 = 0
  3219. row.r2 = 0
  3220. }
  3221. if (isNaN(row.w3)) {
  3222. row.w3 = 0
  3223. row.r3 = 0
  3224. }
  3225. if (row.w1 <= 0) {
  3226. row.w1 = 0
  3227. row.r1 = 0
  3228. }
  3229. if (row.w2 <= 0) {
  3230. row.w2 = 0
  3231. row.r2 = 0
  3232. }
  3233. if (row.w3 <= 0) {
  3234. row.w3 = 0
  3235. row.r3 = 0
  3236. }
  3237. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3238. }
  3239. }
  3240. if (row.w1 == '') { row.w1 = 0 }
  3241. if (row.w2 == '') { row.w2 = 0 }
  3242. if (row.w3 == '') { row.w3 = 0 }
  3243. if (row.w4 == '') { row.w4 = 0 }
  3244. if (isNaN(row.r1)) { row.r1 = 0 }
  3245. if (isNaN(row.r2)) { row.r2 = 0 }
  3246. if (isNaN(row.r3)) { row.r3 = 0 }
  3247. if (isNaN(row.r4)) { row.r4 = 0 }
  3248. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3249. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3250. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3251. },
  3252. celldblclick(row, column, cell, event) {
  3253. console.log(row, '=====')
  3254. this.handleUpdate(row)
  3255. },
  3256. // 编辑
  3257. handleUpdate(row) {
  3258. console.log(row)
  3259. this.oldRowList = {...row}
  3260. for (let i = 0; i < this.table.list.length; i++) {
  3261. if (this.table.list[i].Edit == true) {
  3262. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  3263. return false
  3264. }
  3265. }
  3266. // 编辑true,不可编辑false
  3267. row.Edit = true
  3268. row.NoEdit = false
  3269. // 编辑false,编辑保存true
  3270. row.isUpdate = false
  3271. row.isUpdateSave = true
  3272. row.ftid = String(row.ftid)
  3273. if (row.ptsfid == '-1') {
  3274. row.ptsfid = ''
  3275. }
  3276. row.ptsfid = String(row.ptsfid)
  3277. // dryweight
  3278. this.table.temp.ftid = row.ftid
  3279. this.table.temp.ftname = row.ftname
  3280. this.table.temp.ptsfid = row.ptsfid
  3281. this.table.temp.ptsfname = row.ptsfname
  3282. },
  3283. updateData(row) {
  3284. if (row.r1 == 'NaN') { this.$set(row, 'r1', 0) }
  3285. if (row.r2 == 'NaN') { this.$set(row, 'r2', 0) }
  3286. if (row.r3 == 'NaN') { this.$set(row, 'r3', 0) }
  3287. if (row.r4 == 'NaN') { this.$set(row, 'r4', 0) }
  3288. if (row.w1 == 'NaN') { this.$set(row, 'w1', 0) }
  3289. if (row.w2 == 'NaN') { this.$set(row, 'w2', 0) }
  3290. if (row.w3 == 'NaN') { this.$set(row, 'w3', 0) }
  3291. if (row.w4 == 'NaN') { this.$set(row, 'w4', 0) }
  3292. if (row.bw1 == 'NaN') { this.$set(row, 'bw1', 0) }
  3293. if (row.bw2 == 'NaN') { this.$set(row, 'bw2', 0) }
  3294. if (row.bw3 == 'NaN') { this.$set(row, 'bw3', 0) }
  3295. if (row.bw4 == 'NaN') { this.$set(row, 'bw4', 0) }
  3296. var arr = []
  3297. for (let i = 1; i <= this.table.RWLength; i++) {
  3298. var obj = {}
  3299. obj['times'] = i
  3300. obj['pastureid'] = row.pastureid
  3301. obj['barid'] = row.barid
  3302. obj['cowcount'] = row.ccount
  3303. obj['ccountradio'] = row.ccountradio
  3304. obj['ptid'] = row.ftid
  3305. if (row.ptsfid !== '') {
  3306. obj['ptsid'] = row.ptsfid
  3307. } else {
  3308. obj['ptsid'] = '-1'
  3309. }
  3310. obj['weight'] = row['w' + i]
  3311. if(row['bw' + i] == ""){
  3312. obj['supplement'] = 0
  3313. }else{
  3314. obj['supplement'] = row['bw' + i]
  3315. }
  3316. obj['tratio'] = Math.round(row['r' + i])
  3317. obj['todaysupplement'] = row.todaysupplement
  3318. obj['todayweight'] = row.todayweight
  3319. arr.push(obj)
  3320. }
  3321. if (this.table.isPtsfname == 0) {
  3322. row.ptsfid = '-1'
  3323. row.ptsfname = ''
  3324. } else {
  3325. if (row.ptsfid == '') {
  3326. row.ptsfid = '-1'
  3327. row.ptsfname = ''
  3328. }
  3329. }
  3330. if (row.supplyweight == '') {
  3331. row.supplyweight = '0'
  3332. }
  3333. if (this.table.isPtsfname == false) {
  3334. row.supplyweight = '0'
  3335. }
  3336. console.log(row, '============')
  3337. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  3338. this.$set(row, 'ccountratio', Math.floor(parseFloat(row.ccountratio) * 100) / 100)
  3339. row.ccountratio = String(row.ccountratio)
  3340. row.sumr = Math.round(row.sumr)
  3341. // for(let i=0;i<arr.length;i++){
  3342. // if(arr[i].tratio == undefined ||arr[i].tratio =='' || arr[i].tratio == null){
  3343. // arr[i].tratio = 0
  3344. // }
  3345. // }
  3346. this.table.rwList = arr
  3347. console.log('点击了编辑保存', row)
  3348. this.table.temp.pastureid = row.pastureid
  3349. this.table.temp.id = row.id
  3350. this.table.temp.barname = row.barname
  3351. this.table.temp.barid = row.barid
  3352. this.table.temp.ccount = row.ccount
  3353. this.table.temp.ratio = row.ratio
  3354. this.table.temp.ccountratio = row.ccountratio
  3355. this.table.temp.ftid = row.ftid
  3356. this.table.temp.ftname = row.ftname
  3357. this.table.temp.ptsfid = row.ptsfid
  3358. this.table.temp.ptsfname = row.ptsfname
  3359. this.table.temp.ftweight = row.ftweight
  3360. this.table.temp.supplyweight = row.supplyweight
  3361. this.table.temp.feedweight = row.feedweight
  3362. this.table.temp.owner = row.owner
  3363. this.table.temp.sumr = row.sumr
  3364. if (row.softccount == '') {
  3365. row.softccount = 0
  3366. }
  3367. if (row.r1 == '') {
  3368. row.r1 = 0
  3369. }
  3370. if (row.r2 == '') {
  3371. row.r2 = 0
  3372. }
  3373. if (row.r3 == '') {
  3374. row.r3 = 0
  3375. }
  3376. if (row.r4 == '') {
  3377. row.r4 = 0
  3378. }
  3379. if (row.w1 == '') {
  3380. row.w1 = 0
  3381. }
  3382. if (row.w2 == '' || row.w4 == NaN) {
  3383. row.w2 = 0
  3384. }
  3385. if (row.w3 == '' || row.w4 == NaN) {
  3386. row.w3 = 0
  3387. }
  3388. if (row.w4 == '' || row.w4 == NaN) {
  3389. row.w4 = 0
  3390. }
  3391. console.log(row, '===========')
  3392. this.table.temp.softccount = row.softccount
  3393. this.table.temp.r1 = Math.round(row.r1)
  3394. this.table.temp.r2 = Math.round(row.r2)
  3395. this.table.temp.r3 = Math.round(row.r3)
  3396. this.table.temp.r4 = Math.round(row.r4)
  3397. this.table.temp.w1 = row.w1
  3398. this.table.temp.w2 = row.w2
  3399. this.table.temp.w3 = row.w3
  3400. this.table.temp.w4 = row.w4
  3401. var obj = {}
  3402. obj.pastureid = row.pastureid
  3403. obj.id = row.id
  3404. obj.data = []
  3405. if(this.oldRowList.w1 !== row.w1){
  3406. obj.data.push({'old':this.oldRowList.w1,'new':row.w1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  3407. }
  3408. if(this.oldRowList.w2 !== row.w2){
  3409. obj.data.push({'old':this.oldRowList.w2,'new':row.w2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  3410. }
  3411. if(this.oldRowList.w3 !== row.w3){
  3412. obj.data.push({'old':this.oldRowList.w3,'new':row.w3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  3413. }
  3414. if(this.oldRowList.bw1 !== row.bw1){
  3415. obj.data.push({'old':this.oldRowList.bw1,'new':row.bw1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  3416. }
  3417. if(this.oldRowList.bw2 !== row.bw2){
  3418. obj.data.push({'old':this.oldRowList.bw2,'new':row.bw2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  3419. }
  3420. if(this.oldRowList.bw3 !== row.bw3){
  3421. obj.data.push({'old':this.oldRowList.bw3,'new':row.bw3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  3422. }
  3423. if (this.table.temp.ccount == '' && this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  3424. this.$message({ type: 'error', message: '实际牛头数/系数/系数头数/配方模版不能为空', duration: 2000 })
  3425. return false
  3426. }
  3427. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  3428. this.$message({ type: 'error', message: '系数/系数头数/配方模版不能为空', duration: 2000 })
  3429. return false
  3430. }
  3431. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  3432. this.$message({ type: 'error', message: '系数头数/配方模版不能为空', duration: 2000 })
  3433. return false
  3434. }
  3435. console.log(this.table.temp.ccount, '实际牛头数不能为空')
  3436. if (this.table.temp.ccount === '') {
  3437. this.$message({ type: 'error', message: '实际牛头数不能为空', duration: 2000 })
  3438. return false
  3439. }
  3440. if (this.table.temp.ratio === '') {
  3441. this.$message({ type: 'error', message: '系数不能为空', duration: 2000 })
  3442. return false
  3443. }
  3444. if (this.table.temp.ccountratio === '') {
  3445. this.$message({ type: 'error', message: '系数头数不能为空', duration: 2000 })
  3446. return false
  3447. }
  3448. if (this.table.temp.ftid == '') {
  3449. this.$message({ type: 'error', message: '配方模版不能为空', duration: 2000 })
  3450. return false
  3451. }
  3452. const positiveInteger = /^[0-9]\d*$/
  3453. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  3454. this.$message({
  3455. type: 'error',
  3456. message: '实际牛头数请输入正整数',
  3457. duration: 2000
  3458. })
  3459. return false
  3460. }
  3461. this.isokDisable = true
  3462. setTimeout(() => {
  3463. this.isokDisable = false
  3464. }, 1000)
  3465. // this.requestParam.parammaps = this.table.temp
  3466. this.requestParam.common = {
  3467. 'returnmap': '0'
  3468. }
  3469. this.requestParam.data = []
  3470. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  3471. pastureid: row.pastureid,
  3472. id: row.id,
  3473. barname: row.barname,
  3474. barid: row.barid,
  3475. softccount: row.softccount,
  3476. ccount: row.ccount,
  3477. ratio: row.ratio,
  3478. ccountratio: row.ccountratio,
  3479. ftid: row.ftid,
  3480. ftname: row.ftname,
  3481. ptsfid: row.ptsfid,
  3482. ptsfname: row.ptsfname,
  3483. ftweight: row.ftweight,
  3484. supplyweight: row.supplyweight,
  3485. feedweight: row.feedweight,
  3486. owner: row.owner,
  3487. sumr: row.sumr
  3488. }}
  3489. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  3490. this.requestParam.data[1].children = []
  3491. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  3492. pastureid: '@insertSpotList.pastureid',
  3493. barname: row.barname,
  3494. barid: '@insertSpotList.barid',
  3495. times: '@insertSpotList.times',
  3496. tratio: '@insertSpotList.tratio',
  3497. weight: '@insertSpotList.weight',
  3498. cowcount: '@insertSpotList.cowcount',
  3499. ccountradio: row.ccountratio,
  3500. ptid: '@insertSpotList.ptid',
  3501. ptsid: '@insertSpotList.ptsid',
  3502. supplement: '@insertSpotList.supplement',
  3503. feedweight: row.feedweight,
  3504. supplyweight: row.supplyweight,
  3505. ratio: row.ratio
  3506. }}
  3507. this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  3508. pastureid: row.pastureid,
  3509. fpid: row.id
  3510. }}
  3511. ExecDataByConfig(this.requestParam).then(response => {
  3512. console.log('编辑保存发送参数', this.requestParam)
  3513. if (response.msg === 'fail') {
  3514. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3515. } else {
  3516. if(obj.data.length>0){
  3517. const url = 'authdata/fpdetail/edit'
  3518. const data = obj
  3519. postJson(url, data).then(response => {
  3520. if(response.msg !== 'fail'){
  3521. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3522. }
  3523. })
  3524. }else{
  3525. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3526. }
  3527. this.getList()
  3528. for (let i = 0; i < this.headerList.length; i++) {
  3529. if (this.headerList[i].target.className == 'el-icon-lock') {
  3530. this.headerList[i].target.className = 'el-icon-unlock'
  3531. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  3532. }
  3533. }
  3534. }
  3535. })
  3536. },
  3537. updateCancel(row) {
  3538. console.log('点击了编辑取消')
  3539. // 编辑false,不可编辑true
  3540. row.Edit = false
  3541. row.NoEdit = true
  3542. // 编辑true,编辑保存false
  3543. row.isUpdate = true
  3544. row.isUpdateSave = false
  3545. // this.reload()
  3546. for (let i = 0; i < this.headerList.length; i++) {
  3547. if (this.headerList[i].target.className == 'el-icon-lock') {
  3548. this.headerList[i].target.className = 'el-icon-unlock'
  3549. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  3550. }
  3551. }
  3552. console.log(this.table.getdataListParm.offset)
  3553. this.table.getdataListParm.offset = this.table.getdataListParm.offset
  3554. this.getList()
  3555. // this.$router.push('/formulationPlan/dhedFormula')
  3556. },
  3557. cellClick(row, column, event) {
  3558. console.log(column)
  3559. },
  3560. handleSelect(val) {
  3561. console.log('勾选数据', val)
  3562. this.selectList = val
  3563. },
  3564. // 营养评估
  3565. handleNutritional() {
  3566. console.log('点击了营养评估')
  3567. this.dialogFull = false
  3568. if (this.selectList.length !== 1) {
  3569. this.$message({ type: 'error', message: '请选择一条栏舍信息进行营养评估', duration: 2000 })
  3570. return false
  3571. } else {
  3572. console.log(this.nutritional.temp)
  3573. this.nutritional.dialogStatus = 'Nutritional'
  3574. this.nutritional.activeName = 'first'
  3575. this.nutritional.dialogFormVisible = true
  3576. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3577. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3578. this.getNutritionalList()
  3579. this.nutritional.tab1.list = []
  3580. }
  3581. },
  3582. tableRowClassName({ row }) {
  3583. // console.log(row)
  3584. if (row.isColor == '0') {
  3585. return 'red-row'
  3586. } else {
  3587. return ''
  3588. }
  3589. },
  3590. handleNutritionalTab(item) {
  3591. if (item == 'first ') {
  3592. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3593. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3594. this.getNutritionalList()
  3595. this.nutritional.tab1.list = []
  3596. } else {
  3597. console.log('牛群评估')
  3598. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3599. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3600. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3601. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3602. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3603. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3604. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3605. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3606. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3607. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3608. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3609. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3610. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3611. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3612. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3613. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3614. this.getTab2NutritionalList1()
  3615. this.getTab2NutritionalList2()
  3616. this.getTab2NutritionalList3()
  3617. this.getTab2NutritionalList4()
  3618. }
  3619. },
  3620. changeTab2Date() {
  3621. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3622. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3623. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3624. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3625. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3626. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3627. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3628. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3629. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3630. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3631. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3632. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3633. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3634. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3635. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3636. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3637. this.getTab2NutritionalList1()
  3638. this.getTab2NutritionalList2()
  3639. this.getTab2NutritionalList3()
  3640. this.getTab2NutritionalList4()
  3641. },
  3642. handleBefore() {
  3643. if (this.nutritional.activeName == 'first') {
  3644. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  3645. var start = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() - 1))
  3646. var stop = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() - 1))
  3647. this.nutritional.tab1.inputDatetime.length = 0
  3648. this.nutritional.tab1.inputDatetime.push(start, stop)
  3649. this.$forceUpdate()
  3650. }
  3651. } else {
  3652. var start2 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() - 1))
  3653. var stop2 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() - 1))
  3654. this.nutritional.tab2.inputDatetime.length = 0
  3655. this.nutritional.tab2.inputDatetime.push(start2, stop2)
  3656. this.$forceUpdate()
  3657. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3658. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3659. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3660. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3661. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3662. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3663. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3664. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3665. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3666. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3667. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3668. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3669. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3670. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3671. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3672. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3673. this.getTab2NutritionalList1()
  3674. this.getTab2NutritionalList2()
  3675. this.getTab2NutritionalList3()
  3676. this.getTab2NutritionalList4()
  3677. }
  3678. },
  3679. handleNext() {
  3680. if (this.nutritional.activeName == 'first') {
  3681. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  3682. console.log(this.nutritional.tab1.inputDatetime)
  3683. var start3 = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() + 1))
  3684. var stop3 = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() + 1))
  3685. this.nutritional.tab1.inputDatetime.length = 0
  3686. this.nutritional.tab1.inputDatetime.push(start3, stop3)
  3687. this.$forceUpdate()
  3688. }
  3689. } else {
  3690. var start4 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() + 1))
  3691. var stop4 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() + 1))
  3692. this.nutritional.tab2.inputDatetime.length = 0
  3693. this.nutritional.tab2.inputDatetime.push(start4, stop4)
  3694. this.$forceUpdate()
  3695. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3696. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3697. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3698. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3699. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3700. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3701. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3702. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3703. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3704. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3705. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3706. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3707. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3708. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3709. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3710. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3711. this.getTab2NutritionalList1()
  3712. this.getTab2NutritionalList2()
  3713. this.getTab2NutritionalList3()
  3714. this.getTab2NutritionalList4()
  3715. }
  3716. },
  3717. getNutritionalList() {
  3718. this.nutritional.tab1.listLoading1 = true
  3719. GetDataByName(this.nutritional.tab1.getdataListParm1).then(response => {
  3720. console.log('评估上方数据', response.data.list)
  3721. if (response.data.list !== null) {
  3722. response.data.list[0].cowclassid = String(response.data.list[0].cowclassid)
  3723. this.nutritional.tab1.temp = response.data.list[0]
  3724. this.nutritional.tab1.disabledCowclass = true
  3725. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  3726. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  3727. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  3728. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  3729. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  3730. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  3731. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  3732. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  3733. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  3734. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  3735. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  3736. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  3737. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  3738. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  3739. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  3740. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  3741. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  3742. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  3743. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  3744. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  3745. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  3746. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  3747. this.getNutritionalList2()
  3748. } else {
  3749. this.nutritional.tab1.temp = []
  3750. this.nutritional.tab1.disabledCowclass = false
  3751. }
  3752. setTimeout(() => {
  3753. this.nutritional.tab1.listLoading = false
  3754. }, 100)
  3755. })
  3756. },
  3757. assessmentData() {
  3758. console.log('评估保存')
  3759. this.$refs['temp'].validate(valid => {
  3760. if (valid) {
  3761. if (this.nutritional.tab1.inputDatetime == '' || this.nutritional.tab1.inputDatetime == null) {
  3762. this.$message({ type: 'error', message: '开始日期结束日期不能为空', duration: 2000 })
  3763. return false
  3764. } else {
  3765. // 牛头数
  3766. const positiveInteger = /^[1-9]\d*$/
  3767. if (this.nutritional.tab1.temp.cowsum !== '') {
  3768. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.cowsum))) {
  3769. this.$message({ type: 'error', message: '牛头数请输入正整数', duration: 2000 })
  3770. return false
  3771. }
  3772. }
  3773. const twoDecimalPlaces = /^\d+(\.\d{1,2})?$/
  3774. // 温度环境
  3775. if (this.nutritional.tab1.temp.tem !== '') {
  3776. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.tem))) {
  3777. this.$message({ type: 'error', message: '温度环境请保留两位小数', duration: 2000 })
  3778. return false
  3779. }
  3780. }
  3781. // 平均月龄
  3782. if (this.nutritional.tab1.temp.avgmonthage !== '') {
  3783. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.avgmonthage))) {
  3784. this.$message({ type: 'error', message: '平均月龄请保留两位小数', duration: 2000 })
  3785. return false
  3786. }
  3787. }
  3788. // 体重
  3789. if (this.nutritional.tab1.temp.bw !== '') {
  3790. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.bw))) {
  3791. this.$message({ type: 'error', message: '体重请保留两位小数', duration: 2000 })
  3792. return false
  3793. }
  3794. }
  3795. // 日增重
  3796. if (this.nutritional.tab1.temp.dayw !== '') {
  3797. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.dayw))) {
  3798. this.$message({ type: 'error', message: '日增重请保留两位小数', duration: 2000 })
  3799. return false
  3800. }
  3801. }
  3802. const dayspre = /^(([1-9]|([1-9]\d)|(1\d\d)|(2([0-7]\d|7[0-9]))))$/
  3803. // 怀孕天数
  3804. if (this.nutritional.tab1.temp.dayspre !== '') {
  3805. if (!dayspre.test(parseFloat(this.nutritional.tab1.temp.dayspre))) {
  3806. this.$message({ type: 'error', message: '怀孕天数请输入大于0小于280整数', duration: 2000 })
  3807. return false
  3808. }
  3809. }
  3810. const fetal = /^(?:[1-9]|1[0-9])$/
  3811. // 胎次
  3812. if (this.nutritional.tab1.temp.fetal !== '') {
  3813. if (!fetal.test(parseFloat(this.nutritional.tab1.temp.fetal))) {
  3814. this.$message({ type: 'error', message: '胎次请输入大于0小于20整数', duration: 2000 })
  3815. return false
  3816. }
  3817. }
  3818. // 平均泌乳
  3819. if (this.nutritional.tab1.temp.avgdim !== '') {
  3820. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.avgdim))) {
  3821. this.$message({ type: 'error', message: '平均泌乳天数请输入正整数', duration: 2000 })
  3822. return false
  3823. }
  3824. }
  3825. // 产奶量
  3826. if (this.nutritional.tab1.temp.product !== '') {
  3827. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.product))) {
  3828. this.$message({ type: 'error', message: '产奶量请保留两位小数', duration: 2000 })
  3829. return false
  3830. }
  3831. }
  3832. // 乳脂率
  3833. if (this.nutritional.tab1.temp.fat !== '') {
  3834. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.fat))) {
  3835. this.$message({ type: 'error', message: '乳脂率请保留两位小数', duration: 2000 })
  3836. return false
  3837. }
  3838. }
  3839. // 乳蛋白率
  3840. if (this.nutritional.tab1.temp.pro !== '') {
  3841. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.pro))) {
  3842. this.$message({ type: 'error', message: '乳蛋白率请保留两位小数', duration: 2000 })
  3843. return false
  3844. }
  3845. }
  3846. // 乳糖率
  3847. if (this.nutritional.tab1.temp.lactose !== '') {
  3848. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.lactose))) {
  3849. this.$message({ type: 'error', message: '乳糖率请保留两位小数', duration: 2000 })
  3850. return false
  3851. }
  3852. }
  3853. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  3854. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  3855. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  3856. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  3857. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  3858. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  3859. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  3860. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  3861. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  3862. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  3863. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  3864. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  3865. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  3866. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  3867. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  3868. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  3869. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  3870. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  3871. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  3872. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  3873. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  3874. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  3875. this.getNutritionalList2()
  3876. }
  3877. }
  3878. })
  3879. },
  3880. getNutritionalList2() {
  3881. this.nutritional.tab1.listLoading2 = true
  3882. const url = 'authdata/GETNurJudge'
  3883. const data = this.nutritional.tab1.getdataListParm2
  3884. postJson(url, data).then(response => {
  3885. if (response.msg !== 'fail') {
  3886. if (response.data.list !== null) {
  3887. for (let i = 0; i < response.data.length; i++) {
  3888. if (response.data[i].cowneed == null) {
  3889. response.data[i].cowneed = ''
  3890. }
  3891. var reg = RegExp(/>/)
  3892. var reg2 = RegExp(/</)
  3893. var reg3 = RegExp(/-/)
  3894. if (reg.test(response.data[i].cowneed) == true) {
  3895. const cowneed = response.data[i].cowneed.split('>')[1]
  3896. if ((parseFloat(response.data[i].ftpro) < parseFloat(cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(cowneed)) {
  3897. this.$set(response.data[i], 'isColor', '0')
  3898. } else {
  3899. this.$set(response.data[i], 'isColor', '')
  3900. }
  3901. } else if (reg2.test(response.data[i].cowneed) == true) {
  3902. const cowneed2 = response.data[i].cowneed.split('<')[1]
  3903. if ((parseFloat(response.data[i].ftpro) > parseFloat(cowneed2)) || (parseFloat(response.data[i].hprov) > parseFloat(cowneed2)) || parseFloat(response.data[i].sprov) > parseFloat(cowneed2)) {
  3904. this.$set(response.data[i], 'isColor', '0')
  3905. } else {
  3906. this.$set(response.data[i], 'isColor', '')
  3907. }
  3908. } else if (reg3.test(response.data[i].cowneed) == true) {
  3909. response.data[i].cowneed = String(response.data[i].cowneed)
  3910. if (response.data[i].cowneed.length == 1) {
  3911. const cowneed3 = response.data[i].cowneed.split('-')
  3912. console.log(cowneed3, 'cowneed3')
  3913. if (parseFloat(response.data[i].ftpro) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].ftpro) < parseFloat(cowneed3[1])) {
  3914. this.$set(response.data[i], 'isColor', '')
  3915. } else if (parseFloat(response.data[i].hprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].hprov) < parseFloat(cowneed3[1])) {
  3916. this.$set(response.data[i], 'isColor', '')
  3917. } else if (parseFloat(response.data[i].sprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].sprov) < parseFloat(cowneed3[1])) {
  3918. this.$set(response.data[i], 'isColor', '')
  3919. } else if (cowneed3[0] == '' && cowneed3[0] == '') {
  3920. this.$set(response.data[i], 'isColor', '')
  3921. } else {
  3922. this.$set(response.data[i], 'isColor', '0')
  3923. }
  3924. } else {
  3925. if ((parseFloat(response.data[i].ftpro) < parseFloat(response.data[i].cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(response.data[i].cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(response.data[i].cowneed)) {
  3926. this.$set(response.data[i], 'isColor', '0')
  3927. } else {
  3928. this.$set(response.data[i], 'isColor', '')
  3929. }
  3930. }
  3931. } else {
  3932. response.data[i].cowneed = String(response.data[i].cowneed)
  3933. if (response.data[i].cowneed[0] !== '-') {
  3934. if ((parseFloat(response.data[i].ftpro) < parseFloat(response.data[i].cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(response.data[i].cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(response.data[i].cowneed)) {
  3935. this.$set(response.data[i], 'isColor', '0')
  3936. } else {
  3937. this.$set(response.data[i], 'isColor', '')
  3938. }
  3939. } else {
  3940. this.$set(response.data[i], 'isColor', '')
  3941. }
  3942. }
  3943. }
  3944. console.log(response.data)
  3945. console.log('评估下方数据', response.data)
  3946. this.nutritional.tab1.list = response.data
  3947. this.nutritional.tab1.total = response.data.total
  3948. } else {
  3949. this.nutritional.tab1.list = []
  3950. }
  3951. } else {
  3952. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  3953. }
  3954. setTimeout(() => {
  3955. this.nutritional.tab1.listLoading2 = false
  3956. }, 100)
  3957. })
  3958. },
  3959. // 牛群评估
  3960. getTab2NutritionalList1() {
  3961. this.nutritional.tab2.listLoading1 = true
  3962. GetDataByName(this.nutritional.tab2.getdataListParm1).then(response => {
  3963. console.log('宾州筛分析', response.data.list)
  3964. if (response.data.list !== null) {
  3965. this.nutritional.tab2.list1 = response.data.list
  3966. this.nutritional.tab2.pageNum1 = response.data.pageNum
  3967. this.nutritional.tab2.pageSize1 = response.data.pageSize
  3968. this.nutritional.tab2.total1 = response.data.total
  3969. } else {
  3970. this.nutritional.tab2.list1 = []
  3971. }
  3972. setTimeout(() => {
  3973. this.nutritional.tab2.listLoading1 = false
  3974. }, 100)
  3975. })
  3976. },
  3977. getTab2NutritionalList2() {
  3978. this.nutritional.tab2.listLoading2 = true
  3979. GetDataByName(this.nutritional.tab2.getdataListParm2).then(response => {
  3980. console.log('粪便筛分析', response.data.list)
  3981. if (response.data.list !== null) {
  3982. this.nutritional.tab2.list2 = response.data.list
  3983. this.nutritional.tab2.pageNum2 = response.data.pageNum
  3984. this.nutritional.tab2.pageSize2 = response.data.pageSize
  3985. this.nutritional.tab2.total2 = response.data.total
  3986. } else {
  3987. this.nutritional.tab2.list2 = []
  3988. }
  3989. setTimeout(() => {
  3990. this.nutritional.tab2.listLoading2 = false
  3991. }, 100)
  3992. })
  3993. },
  3994. getTab2NutritionalList3() {
  3995. this.nutritional.tab2.listLoading3 = true
  3996. GetDataByName(this.nutritional.tab2.getdataListParm3).then(response => {
  3997. console.log('BCS评分', response.data.list)
  3998. if (response.data.list !== null) {
  3999. for (let i = 0; i < response.data.list.length; i++) {
  4000. this.$set(response.data.list[i], 'score25rate', (parseFloat(response.data.list[i].score25) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4001. this.$set(response.data.list[i], 'score275rate', (parseFloat(response.data.list[i].score275) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4002. this.$set(response.data.list[i], 'score3rate', (parseFloat(response.data.list[i].score3) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4003. this.$set(response.data.list[i], 'score325rate', (parseFloat(response.data.list[i].score325) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4004. this.$set(response.data.list[i], 'score35rate', (parseFloat(response.data.list[i].score35) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4005. this.$set(response.data.list[i], 'score375rate', (parseFloat(response.data.list[i].score375) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4006. this.$set(response.data.list[i], 'score4rate', (100 - response.data.list[i].score25rate - response.data.list[i].score275rate - response.data.list[i].score3rate - response.data.list[i].score325rate - response.data.list[i].score35rate - response.data.list[i].score375rate).toFixed(parseInt(Cookies.get('decimal'))))
  4007. }
  4008. this.nutritional.tab2.list3 = response.data.list
  4009. this.nutritional.tab2.pageNum3 = response.data.pageNum
  4010. this.nutritional.tab2.pageSize3 = response.data.pageSize
  4011. this.nutritional.tab2.total3 = response.data.total
  4012. } else {
  4013. this.nutritional.tab2.list3 = []
  4014. }
  4015. setTimeout(() => {
  4016. this.nutritional.tab2.listLoading3 = false
  4017. }, 100)
  4018. })
  4019. },
  4020. getTab2NutritionalList4() {
  4021. this.nutritional.tab2.listLoading4 = true
  4022. GetDataByName(this.nutritional.tab2.getdataListParm4).then(response => {
  4023. console.log('粪便评分', response.data.list)
  4024. if (response.data.list !== null) {
  4025. for (let i = 0; i < response.data.list.length; i++) {
  4026. this.$set(response.data.list[i], 'score1rate', (parseFloat(response.data.list[i].score1) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4027. this.$set(response.data.list[i], 'score2rate', (parseFloat(response.data.list[i].score2) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4028. this.$set(response.data.list[i], 'score3rate', (parseFloat(response.data.list[i].score3) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4029. this.$set(response.data.list[i], 'score4rate', (parseFloat(response.data.list[i].score4) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4030. this.$set(response.data.list[i], 'score5rate', (100 - response.data.list[i].score1rate - response.data.list[i].score2rate - response.data.list[i].score3rate - response.data.list[i].score4rate).toFixed(parseInt(Cookies.get('decimal'))))
  4031. }
  4032. this.nutritional.tab2.list4 = response.data.list
  4033. this.nutritional.tab2.pageNum4 = response.data.pageNum
  4034. this.nutritional.tab2.pageSize4 = response.data.pageSize
  4035. this.nutritional.tab2.total4 = response.data.total
  4036. } else {
  4037. this.nutritional.tab2.list4 = []
  4038. }
  4039. setTimeout(() => {
  4040. this.nutritional.tab2.listLoading4 = false
  4041. }, 100)
  4042. })
  4043. },
  4044. getHistoryIsDisplay() {
  4045. GetDataByName(this.table.getdataListParm2).then(response => {
  4046. console.log(response.data.list[0].inforvalue)
  4047. if (response.data.list !== null) {
  4048. if (response.data.list[0].inforvalue == 0) {
  4049. this.table.isPtsfname = false
  4050. } else {
  4051. this.table.isPtsfname = true
  4052. }
  4053. }
  4054. })
  4055. GetDataByName(this.table.getdataListParm3).then(response => {
  4056. if (response.data.list !== null) {
  4057. if (response.data.list[0].inforvalue == 1) {
  4058. this.history.isRW1 = true
  4059. this.history.isRW2 = false
  4060. this.history.isRW3 = false
  4061. this.history.isRW4 = false
  4062. } else if (response.data.list[0].inforvalue == 2) {
  4063. this.history.isRW1 = true
  4064. this.history.isRW2 = true
  4065. this.history.isRW3 = false
  4066. this.history.isRW4 = false
  4067. } else if (response.data.list[0].inforvalue == 3) {
  4068. this.history.isRW1 = true
  4069. this.history.isRW2 = true
  4070. this.history.isRW3 = true
  4071. this.history.isRW4 = false
  4072. } else if (response.data.list[0].inforvalue == 4) {
  4073. this.history.isRW1 = true
  4074. this.history.isRW2 = true
  4075. this.history.isRW3 = true
  4076. this.history.isRW4 = true
  4077. }
  4078. } else {
  4079. this.history.isRW1 = false
  4080. this.history.isRW2 = false
  4081. this.history.isRW3 = false
  4082. this.history.isRW4 = false
  4083. }
  4084. })
  4085. this.getHistoryList()
  4086. },
  4087. getHistoryList() {
  4088. this.history.listLoading = true
  4089. GetDataByName(this.history.getdataListParm).then(response => {
  4090. console.log('table数据', response.data.list)
  4091. if (response.data.list !== null) {
  4092. console.log('table数据', response.data.list)
  4093. for (let i = 0; i < response.data.list.length; i++) {
  4094. if (response.data.list[i].ptid == undefined || response.data.list[i].ptname == '') {
  4095. this.$set(response.data.list[i], 'ptid', '')
  4096. this.$set(response.data.list[i], 'ptname', '')
  4097. }
  4098. }
  4099. this.history.list = response.data.list
  4100. this.handleSpan()
  4101. this.history.pageNum = response.data.pageNum
  4102. this.history.pageSize = response.data.pageSize
  4103. this.history.total = response.data.total
  4104. } else {
  4105. this.history.list = []
  4106. }
  4107. setTimeout(() => {
  4108. this.history.listLoading = false
  4109. }, 100)
  4110. })
  4111. },
  4112. handleSpan() {
  4113. this.mergekeys.forEach(key => {
  4114. this.spanObj[key] = []
  4115. let position = 0
  4116. this.history.list.forEach((item, index) => {
  4117. if (index === 0) {
  4118. this.spanObj[key].push(1)
  4119. position = 0
  4120. } else {
  4121. if (key == 'sumweight') {
  4122. if (this.history.list[index][key] === this.history.list[index - 1][key] && this.history.list[index]['barname'] === this.history.list[index - 1]['barname']) {
  4123. this.spanObj[key][position] += 1
  4124. this.spanObj[key].push(0)
  4125. } else {
  4126. this.spanObj[key].push(1)
  4127. position = index
  4128. }
  4129. } else {
  4130. if (this.history.list[index][key] === this.history.list[index - 1][key]) {
  4131. this.spanObj[key][position] += 1
  4132. this.spanObj[key].push(0)
  4133. } else {
  4134. this.spanObj[key].push(1)
  4135. position = index
  4136. }
  4137. }
  4138. }
  4139. })
  4140. })
  4141. },
  4142. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  4143. for (let i = 0; i < this.mergekeys.length; i++) {
  4144. if (column.property === this.mergekeys[i]) {
  4145. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  4146. const _col = _row > 0 ? 1 : 0
  4147. return {
  4148. rowspan: _row,
  4149. colspan: _col
  4150. }
  4151. }
  4152. }
  4153. },
  4154. changeDate() {
  4155. this.getHistoryList()
  4156. },
  4157. // 应用
  4158. handleApplication() {
  4159. console.log('点击了应用')
  4160. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  4161. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  4162. }).then(() => {
  4163. this.requestParam.name = 'applyFPdate'
  4164. this.requestParam.parammaps = {}
  4165. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  4166. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  4167. PostDataByName(this.requestParam).then(response => {
  4168. if (response.msg === 'fail') {
  4169. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  4170. } else {
  4171. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  4172. this.getHistoryIsDisplay()
  4173. this.getList()
  4174. }
  4175. })
  4176. }).catch(() => {
  4177. this.$message({ type: 'info', message: '已取消应用' })
  4178. })
  4179. },
  4180. formatJson(filterVal, jsonData) {
  4181. return jsonData.map(v =>
  4182. filterVal.map(j => {
  4183. if (j === 'timestamp') {
  4184. return parseTime(v[j])
  4185. } else {
  4186. return v[j]
  4187. }
  4188. })
  4189. )
  4190. },
  4191. blurBw(row) {
  4192. console.log(row)
  4193. },
  4194. focusBw(row) {
  4195. console.log(row)
  4196. }
  4197. }
  4198. }
  4199. </script>
  4200. <style lang="scss" scoped>
  4201. .search {
  4202. clear: both;
  4203. }
  4204. .table {
  4205. margin-top: 10px;
  4206. }
  4207. </style>
  4208. <style lang="scss">
  4209. .red-row{
  4210. background: #fde2e2 !important;
  4211. }
  4212. </style>