index.vue 266 KB

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