300833d4cdc5f7280f55b8ffe70716a4b2a9bcf2.svn-base 275 KB

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