540dfd5ce3d8b8c1dbeaa3b47e6ace8ba9089498.svn-base 273 KB

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