275847763335e38c438cbf26ac7bab809aeecb7c.svn-base 273 KB

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