index.vue 307 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <!-- 临时隐藏 -->
  5. <!-- <el-button v-if="isRoleEdit" class="successBorder" style="float: left;" @click="handleNutritional">营养评估</el-button> -->
  6. <!-- 临时隐藏 -->
  7. <div class="search">
  8. <el-select v-model="table.getdataListParm.parammaps.barid" clearable filterable placeholder="请选择栏舍" style="width: 180px;" class="filter-item">
  9. <el-option v-for="item in barList" :key="item.id" :label="item.bname" :value="item.id" />
  10. </el-select>
  11. <el-select v-model="table.getdataListParm.parammaps.tname" clearable filterable placeholder="请输入配方名称" style="width: 180px;" class="filter-item">
  12. <el-option v-for="(item,index) in tnameList" :key="index" :label="item.tname" :value="item.tname" />
  13. </el-select>
  14. <!-- <el-input v-model="table.getdataListParm.parammaps.tname" placeholder="请输入配方名称" style="width: 180px;" class="filter-item" /> -->
  15. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  16. </div>
  17. <el-button v-if="isRoleEdit" class="successBorder" style="float: left;" @click="handleDryMatterRegulation">干物质调节</el-button>
  18. <el-upload style="float: right;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
  19. <el-button v-if="isRoleEdit" class="import" icon="el-icon-download" style="float: right;">导入</el-button>
  20. </el-upload>
  21. <el-dropdown style="float: right;margin-right: 10px;">
  22. <el-button class="export" icon="el-icon-upload2">导出</el-button>
  23. <el-dropdown-menu slot="dropdown">
  24. <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
  25. <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
  26. </el-dropdown-menu>
  27. </el-dropdown>
  28. <el-button class="export" style="float: right;margin-right: 10px;" @click="handleHistoryRecords">历史记录</el-button>
  29. </div>
  30. <div class="search" />
  31. <div class="table">
  32. <el-table
  33. :key="table.tableKey"
  34. ref="table"
  35. v-loading="table.listLoading"
  36. element-loading-text="给我一点时间"
  37. :data="table.list"
  38. border
  39. fit
  40. highlight-current-row
  41. style="width: 100%;"
  42. :row-style="rowStyle"
  43. :cell-style="cellStyle"
  44. class="elTable table-fixed"
  45. :max-height="myHeight"
  46. @header-click="headerClick"
  47. @cell-click="cellClick"
  48. @selection-change="handleSelect"
  49. @cell-dblclick="celldblclick"
  50. >
  51. <el-table-column type="selection" width="50" />
  52. <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left" />
  53. <el-table-column label="栏舍名称" min-width="100px" align="center" class-name="small-padding fixed-width" fixed="left">
  54. <template slot-scope="scope">
  55. <span>{{ scope.row.barname }}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column :key="2" label="软件牛头数" min-width="70px" align="center">
  59. <template slot-scope="scope">
  60. <span>{{ scope.row.softccount }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column :key="3" label="实际牛头数" min-width="90px" align="center">
  64. <template slot-scope="scope">
  65. <span v-if="scope.row.NoEdit">{{ scope.row.ccount }}</span>
  66. <el-input v-if="scope.row.Edit" v-model="scope.row.ccount" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurCcount(scope.row)" />
  67. </template>
  68. </el-table-column>
  69. <el-table-column :key="4" label="系数(%)" min-width="85px" align="center">
  70. <template slot-scope="scope">
  71. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  72. <el-input v-if="scope.row.Edit" v-model="scope.row.ratio" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurRatio(scope.row)" />
  73. </template>
  74. </el-table-column>
  75. <el-table-column :key="5" label="系数头数" min-width="85px" align="center">
  76. <template slot-scope="scope">
  77. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  78. <el-input v-if="scope.row.Edit" v-model="scope.row.ccountratio" type="number" style="width:95%;padding:10px 0;" @blur="blurCcountratio(scope.row)" />
  79. </template>
  80. </el-table-column>
  81. <el-table-column :key="6" label="配方模板" min-width="130px" align="center">
  82. <template slot-scope="scope">
  83. <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
  84. <el-select v-if="scope.row.Edit" v-model="scope.row.ftid" filterable placeholder="配方模板" class="filter-item" style="width:99%;" @change="(value)=> {changeRecipeTemplate(value, scope.row)}">
  85. <el-option v-for="item in recipeTemplateList" :key="item.id" :label="item.tname" :value="item.id" />
  86. </el-select>
  87. </template>
  88. </el-table-column>
  89. <el-table-column v-if="table.isPtsfname" :key="7" label="补料配方" min-width="130px" align="center">
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.NoEdit">{{ scope.row.ptsfname }}</span>
  92. <el-select v-if="scope.row.Edit" v-model="scope.row.ptsfid" clearable filterable placeholder="补料配方" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeFeedingFormula(value, scope.row)}">
  93. <el-option v-for="item in feedingFormulaList" :key="item.id" :label="item.tname" :value="item.id" />
  94. </el-select>
  95. </template>
  96. </el-table-column>
  97. <el-table-column v-if="table.isRW1" :key="8" label="第一班比例(%)" min-width="80px" align="center">
  98. <template slot-scope="scope">
  99. <span v-if="scope.row.NoEdit">{{ scope.row.r1 }}</span>
  100. <el-input v-if="scope.row.Edit" v-model="scope.row.r1" :disabled="scope.row.isOneWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
  101. </template>
  102. </el-table-column>
  103. <el-table-column v-if="table.isRW1" :key="9" label="第一班重量" min-width="120px" align="center" :render-header="renderHeader">
  104. <template slot-scope="scope">
  105. <span v-if="scope.row.NoEdit">{{ scope.row.w1 }}</span>
  106. <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)" />
  107. </template>
  108. </el-table-column>
  109. <el-table-column v-if="table.isRW1 && table.isPtsfname" :key="10" label="第一班补料重量" min-width="120px" align="center">
  110. <template slot-scope="scope">
  111. <span v-if="scope.row.NoEdit">{{ scope.row.bw1 }}</span>
  112. <el-input v-if="scope.row.Edit" v-model="scope.row.bw1" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurBw(scope.row)" @focus="focusBw(scope.row)" />
  113. </template>
  114. </el-table-column>
  115. <el-table-column v-if="table.isRW2" :key="11" label="第二班比例(%)" min-width="80px" align="center">
  116. <template slot-scope="scope">
  117. <span v-if="scope.row.NoEdit">{{ scope.row.r2 }}</span>
  118. <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)" />
  119. </template>
  120. </el-table-column>
  121. <el-table-column v-if="table.isRW2" :key="12" label="第二班重量" min-width="120px" align="center" :render-header="renderHeader">
  122. <template slot-scope="scope">
  123. <span v-if="scope.row.NoEdit">{{ scope.row.w2 }}</span>
  124. <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)" />
  125. </template>
  126. </el-table-column>
  127. <el-table-column v-if="table.isRW2 && table.isPtsfname" :key="13" label="第二班补料重量" min-width="120px" align="center">
  128. <template slot-scope="scope">
  129. <span v-if="scope.row.NoEdit">{{ scope.row.bw2 }}</span>
  130. <el-input v-if="scope.row.Edit" v-model="scope.row.bw2" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurBw(scope.row)" @focus="focusBw(scope.row)" />
  131. </template>
  132. </el-table-column>
  133. <el-table-column v-if="table.isRW3" :key="14" label="第三班比例(%)" min-width="80px" align="center">
  134. <template slot-scope="scope">
  135. <span v-if="scope.row.NoEdit">{{ scope.row.r3 }}</span>
  136. <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)" />
  137. </template>
  138. </el-table-column>
  139. <el-table-column v-if="table.isRW3" :key="15" label="第三班重量" min-width="120px" align="center" :render-header="renderHeader">
  140. <template slot-scope="scope">
  141. <span v-if="scope.row.NoEdit">{{ scope.row.w3 }}</span>
  142. <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)" />
  143. </template>
  144. </el-table-column>
  145. <el-table-column v-if="table.isRW3 && table.isPtsfname" :key="16" label="第三班补料重量" min-width="120px" align="center">
  146. <template slot-scope="scope">
  147. <span v-if="scope.row.NoEdit">{{ scope.row.bw3 }}</span>
  148. <el-input v-if="scope.row.Edit" v-model="scope.row.bw3" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurBw(scope.row)" @focus="focusBw(scope.row)" />
  149. </template>
  150. </el-table-column>
  151. <el-table-column v-if="table.isRW4" :key="17" label="第四班比例(%)" min-width="80px" align="center">
  152. <template slot-scope="scope">
  153. <span v-if="scope.row.NoEdit">{{ scope.row.r4 }}</span>
  154. <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)" />
  155. </template>
  156. </el-table-column>
  157. <el-table-column v-if="table.isRW4" :key="18" label="第四班重量" min-width="120px" align="center" :render-header="renderHeader">
  158. <template slot-scope="scope">
  159. <span v-if="scope.row.NoEdit">{{ scope.row.w4 }}</span>
  160. <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)" />
  161. </template>
  162. </el-table-column>
  163. <el-table-column v-if="table.isRW4 && table.isPtsfname" :key="19" label="第四班补料重量" min-width="120px" align="center">
  164. <template slot-scope="scope">
  165. <span v-if="scope.row.NoEdit">{{ scope.row.bw4 }}</span>
  166. <el-input v-if="scope.row.Edit" v-model="scope.row.bw4" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurBw(scope.row)" @focus="focusBw(scope.row)" />
  167. </template>
  168. </el-table-column>
  169. <el-table-column :key="20" label="饲喂总比例(%)" min-width="80px" align="center">
  170. <template slot-scope="scope">
  171. <span>{{ scope.row.sumr }}</span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column :key="21" label="饲喂投喂量" min-width="80px" align="center">
  175. <template slot-scope="scope">
  176. <span>{{ scope.row.todayweight }}</span>
  177. </template>
  178. </el-table-column>
  179. <el-table-column :key="22" label="饲喂配方重量" min-width="70px" align="center">
  180. <template slot-scope="scope">
  181. <span>{{ scope.row.ftweight }}</span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column v-if="table.isPtsfname" :key="23" label="补料配方重量" min-width="100px" align="center">
  185. <template slot-scope="scope">
  186. <span>{{ scope.row.supplyweight }}</span>
  187. </template>
  188. </el-table-column>
  189. <!-- <el-table-column :key="22" label="投喂量" min-width="80px" align="center">
  190. <template slot-scope="scope">
  191. <span>{{ scope.row.feedweight }}</span>
  192. </template>
  193. </el-table-column> -->
  194. <el-table-column v-if="table.isPtsfname" :key="24" label="补料投喂量" min-width="70px" align="center">
  195. <template slot-scope="scope">
  196. <span>{{ scope.row.todaysupplement }}</span>
  197. </template>
  198. </el-table-column>
  199. <el-table-column :key="25" label="日投喂量" min-width="70px" align="center">
  200. <template slot-scope="scope">
  201. <span>{{ scope.row.todayfeed }}</span>
  202. </template>
  203. </el-table-column>
  204. <el-table-column :key="26" label="配方干物质" min-width="70px" align="center">
  205. <template slot-scope="scope">
  206. <span>{{ scope.row.dryweight }}</span>
  207. </template>
  208. </el-table-column>
  209. <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  210. <template slot-scope="{row}">
  211. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  212. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  213. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  214. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  215. </template>
  216. </el-table-column>
  217. </el-table>
  218. <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
  219. </div>
  220. <!-- 历史记录 -->
  221. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="history.dialogFormVisible" :close-on-click-modal="false" width="90%">
  222. <template slot="title">
  223. <div class="avue-crud__dialog__header">
  224. <span class="el-dialog__title">
  225. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  226. {{ textMap[history.dialogStatus] }}
  227. </span>
  228. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  229. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  230. <svg-icon v-else icon-class="fullscreen" />
  231. </div>
  232. </div>
  233. </template>
  234. <div class="app-history">
  235. <div class="search">
  236. <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" />
  237. <!-- <el-select v-model="history.getdataListParm.parammaps.barid" clearable filterable placeholder="请选择栏舍" style="width: 180px;" class="filter-item">
  238. <el-option v-for="item in barList" :key="item.id" :label="item.bname" :value="item.id" />
  239. </el-select>
  240. <el-input v-model="history.getdataListParm.parammaps.tname" placeholder="请输入配方名称" style="width: 180px;" class="filter-item" />
  241. <el-button class="successBorder" @click="handleHistorySearch">查询</el-button> -->
  242. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  243. </div>
  244. <div class="table">
  245. <el-table
  246. :key="history.tableKey"
  247. v-loading="history.listLoading"
  248. element-loading-text="给我一点时间"
  249. :data="history.list"
  250. border
  251. fit
  252. highlight-current-row
  253. style="width: 100%;"
  254. :row-style="rowStyle"
  255. :cell-style="cellStyle"
  256. class="elTable table-fixed"
  257. :span-method="objectSpanMethod"
  258. >
  259. <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left">
  260. <template slot-scope="scope">
  261. <span>{{ scope.$index + (history.pageNum-1) * history.pageSize + 1 }}</span>
  262. </template>
  263. </el-table-column>
  264. <el-table-column :key="2" label="栏舍名称" prop="barname" min-width="90px" align="center" class-name="small-padding fixed-width" fixed="left" />
  265. <el-table-column :key="3" label="班次" prop="times" min-width="90px" align="center" class-name="small-padding fixed-width" fixed="left" />
  266. <el-table-column :key="4" label="软件牛头数" prop="softccount" min-width="70px" align="center" />
  267. <el-table-column :key="5" label="实际牛头数" prop="ccount" min-width="70px" align="center" />
  268. <el-table-column :key="6" label="系数(%)" prop="ratio" min-width="70px" align="center" />
  269. <el-table-column :key="7" label="系数头数" prop="ccountratio" min-width="70px" align="center" />
  270. <el-table-column :key="8" label="配方模板" prop="ptname" min-width="70px" align="center" />
  271. <el-table-column v-if="table.isPtsfname" :key="9" label="补料配方" prop="ptsname" min-width="70px" align="center" />
  272. <el-table-column :key="10" label="班次比例" prop="tratio" min-width="70px" align="center" />
  273. <el-table-column :key="11" label="班次重量" prop="weight" min-width="70px" align="center" />
  274. <el-table-column :key="12" label="配方重量" prop="pweight" min-width="70px" align="center" />
  275. <el-table-column v-if="table.isPtsfname" :key="13" label="补料重量" prop="ptweight" min-width="70px" align="center" />
  276. <el-table-column :key="14" label="配方干物质量" prop="dryweight" min-width="70px" align="center" />
  277. <el-table-column :key="15" label="饲喂干物质量" prop="swdryw" min-width="70px" align="center" />
  278. <el-table-column :key="16" label="采样干物质量" prop="cydryw" min-width="70px" align="center" />
  279. <el-table-column :key="17" label="日投喂量" prop="sumweight" min-width="70px" align="center" />
  280. </el-table>
  281. <pagination2 v-show="history.total>0" :total="history.total" :page.sync="history.getdataListParm.offset" :limit.sync="history.getdataListParm.pagecount" @pagination="getHistoryList" />
  282. </div>
  283. </div>
  284. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  285. <el-button class="cancelClose cancelClose1" @click="history.dialogFormVisible = false; ">关闭</el-button>
  286. </div>
  287. </el-dialog>
  288. <!-- 营养评估 -->
  289. <el-dialog :fullscreen="dialogFull" :visible.sync="nutritional.dialogFormVisible" :close-on-click-modal="false" width="90%">
  290. <template slot="title">
  291. <div class="avue-crud__dialog__header">
  292. <span class="el-dialog__title">
  293. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  294. {{ textMap[nutritional.dialogStatus] }}
  295. </span>
  296. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  297. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  298. <svg-icon v-else icon-class="fullscreen" />
  299. </div>
  300. </div>
  301. </template>
  302. <div class="app-nutritional">
  303. <h4 style="position: absolute;top:-5px;left:140px;font:16px/30px '' ;color:#303133;">栏舍:{{ nutritional.tab1.temp.barname }}</h4>
  304. <el-tabs v-model="nutritional.activeName" @tab-click="handleNutritionalTab">
  305. <el-tab-pane label="营养评估" name="first">
  306. <el-form ref="temp" :rules="rules" :model="nutritional.tab1.temp" label-position="right" label-width="95px" style="width: 100%;margin-bottom:30px">
  307. <el-row>
  308. <el-col :span="4">
  309. <el-form-item label="类别" prop="cowclassid">
  310. <el-select v-model="nutritional.tab1.temp.cowclassid" :disabled="nutritional.tab1.disabledCowclass" filterable placeholder="" class="filter-item" style="width:100%;">
  311. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
  312. </el-select>
  313. </el-form-item>
  314. </el-col>
  315. <el-col :span="4">
  316. <el-form-item label="月龄" prop="avgmonthage">
  317. <el-input ref="avgmonthage" v-model="nutritional.tab1.temp.avgmonthage" class="filter-item" placeholder="" style="width:100%;" />
  318. </el-form-item>
  319. </el-col>
  320. <el-col :span="4">
  321. <el-form-item label="体重(kg)" prop="bw">
  322. <el-input ref="bw" v-model="nutritional.tab1.temp.bw" class="filter-item" placeholder="" style="width:100%;" />
  323. </el-form-item>
  324. </el-col>
  325. <el-col :span="4">
  326. <el-form-item label="日增重(kg)" prop="dayw">
  327. <el-input ref="dayw" v-model="nutritional.tab1.temp.dayw" class="filter-item" placeholder="" style="width:100%;" />
  328. </el-form-item>
  329. </el-col>
  330. <el-col :span="4">
  331. <el-form-item label="胎次(次)" prop="fetal">
  332. <el-input ref="fetal" v-model="nutritional.tab1.temp.fetal" class="filter-item" placeholder="" style="width:100%;" />
  333. </el-form-item>
  334. </el-col>
  335. <el-col :span="4">
  336. <el-form-item label="泌乳天数(天)" prop="avgdim">
  337. <el-input ref="avgdim" v-model="nutritional.tab1.temp.avgdim" class="filter-item" placeholder="" style="width:100%;" />
  338. </el-form-item>
  339. </el-col>
  340. </el-row>
  341. <el-row>
  342. <el-col :span="4">
  343. <el-form-item label="怀孕天数(天)" prop="dayspre">
  344. <el-input ref="dayspre" v-model="nutritional.tab1.temp.dayspre" class="filter-item" placeholder="" style="width:100%;" />
  345. </el-form-item>
  346. </el-col>
  347. <el-col :span="4">
  348. <el-form-item label="产奶量(kg)" prop="product">
  349. <el-input ref="product" v-model="nutritional.tab1.temp.product" class="filter-item" placeholder="" style="width:100%;" />
  350. </el-form-item>
  351. </el-col>
  352. <el-col :span="4">
  353. <el-form-item label="乳脂率(%)" prop="fat">
  354. <el-input ref="fat" v-model="nutritional.tab1.temp.fat" class="filter-item" placeholder="" style="width:100%;" />
  355. </el-form-item>
  356. </el-col>
  357. <el-col :span="4">
  358. <el-form-item label="乳蛋白率(%)" prop="pro">
  359. <el-input ref="pro" v-model="nutritional.tab1.temp.pro" class="filter-item" placeholder="" style="width:100%;" />
  360. </el-form-item>
  361. </el-col>
  362. <el-col :span="4">
  363. <el-form-item label="乳糖率(%)" prop="lactose">
  364. <el-input ref="lactose" v-model="nutritional.tab1.temp.lactose" class="filter-item" placeholder="" style="width:100%;" />
  365. </el-form-item>
  366. </el-col>
  367. <el-col :span="4">
  368. <el-form-item label="温度(℃)" prop="tem">
  369. <el-input ref="tem" v-model="nutritional.tab1.temp.tem" class="filter-item" placeholder="" style="width:100%;" />
  370. </el-form-item>
  371. </el-col>
  372. </el-row>
  373. </el-form>
  374. <div style="height: 50px;">
  375. <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;" />
  376. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  377. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  378. <el-button class="successBorder" :disabled="isokDisable" @click="assessmentData()">评估</el-button>
  379. </div>
  380. <div class="table">
  381. <el-table
  382. :key="nutritional.tab1.tableKey"
  383. v-loading="nutritional.tab1.listLoading"
  384. element-loading-text="给我一点时间"
  385. :data="nutritional.tab1.list"
  386. border
  387. fit
  388. highlight-current-row
  389. style="width: 100%;margin-bottom:60px;"
  390. :row-style="rowStyle"
  391. :cell-style="cellStyle"
  392. class="elTable table-fixed"
  393. :row-class-name="tableRowClassName"
  394. >
  395. <el-table-column label="序号" align="center" type="index" width="50px" />
  396. <el-table-column label="指标" min-width="130px" align="center">
  397. <template slot-scope="scope">
  398. <span>{{ scope.row.standard }}</span>
  399. </template>
  400. </el-table-column>
  401. <el-table-column label="奶牛需要" min-width="130px" align="center">
  402. <template slot-scope="scope">
  403. <span>{{ scope.row.cowneed }}</span>
  404. </template>
  405. </el-table-column>
  406. <el-table-column label="配方量" min-width="130px" align="center">
  407. <template slot-scope="scope">
  408. <span>{{ scope.row.ftpro }}</span>
  409. </template>
  410. </el-table-column>
  411. <el-table-column label="TMR料" min-width="130px" align="center">
  412. <template slot-scope="scope">
  413. <span>{{ scope.row.hprov }}</span>
  414. </template>
  415. </el-table-column>
  416. <el-table-column label="采食量" min-width="130px" align="center">
  417. <template slot-scope="scope">
  418. <span>{{ scope.row.sprov }}</span>
  419. </template>
  420. </el-table-column>
  421. </el-table>
  422. </div>
  423. </el-tab-pane>
  424. <el-tab-pane label="牛群评估" name="second">
  425. <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" />
  426. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  427. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  428. <el-row>
  429. <el-col :span="24">
  430. <h3 style="text-align: center;">宾州筛分析</h3>
  431. <div class="table">
  432. <el-table
  433. :key="nutritional.tab2.tableKey1"
  434. v-loading="nutritional.tab2.listLoading1"
  435. element-loading-text="给我一点时间"
  436. :data="nutritional.tab2.list1"
  437. border
  438. fit
  439. highlight-current-row
  440. style="width: 100%;margin-bottom:60px;"
  441. :row-style="rowStyle"
  442. :cell-style="cellStyle"
  443. class="elTable table-fixed"
  444. >
  445. <el-table-column label="日期" min-width="130px" align="center">
  446. <template slot-scope="scope">
  447. <span>{{ scope.row.operatetime }}</span>
  448. </template>
  449. </el-table-column>
  450. <el-table-column label="第一层重量(g)" min-width="130px" align="center">
  451. <template slot-scope="scope">
  452. <span>{{ scope.row.oneweight }}</span>
  453. </template>
  454. </el-table-column>
  455. <el-table-column label="第一层百分比" min-width="130px" align="center">
  456. <template slot-scope="scope">
  457. <span>{{ scope.row.onerate }}</span>
  458. </template>
  459. </el-table-column>
  460. <el-table-column label="第二层重量(g)" min-width="130px" align="center">
  461. <template slot-scope="scope">
  462. <span>{{ scope.row.twoweight }}</span>
  463. </template>
  464. </el-table-column>
  465. <el-table-column label="第二层百分比" min-width="130px" align="center">
  466. <template slot-scope="scope">
  467. <span>{{ scope.row.tworate }}</span>
  468. </template>
  469. </el-table-column>
  470. <el-table-column label="第三层重量(g)" min-width="130px" align="center">
  471. <template slot-scope="scope">
  472. <span>{{ scope.row.threeweight }}</span>
  473. </template>
  474. </el-table-column>
  475. <el-table-column label="第三层百分比" min-width="130px" align="center">
  476. <template slot-scope="scope">
  477. <span>{{ scope.row.threerate }}</span>
  478. </template>
  479. </el-table-column>
  480. <el-table-column label="第四层重量(g)" min-width="130px" align="center">
  481. <template slot-scope="scope">
  482. <span>{{ scope.row.fourweight }}</span>
  483. </template>
  484. </el-table-column>
  485. <el-table-column label="第四层百分比" min-width="130px" align="center">
  486. <template slot-scope="scope">
  487. <span>{{ scope.row.fourrate }}</span>
  488. </template>
  489. </el-table-column>
  490. <el-table-column label="参考标准" min-width="130px" align="center">
  491. <template slot-scope="scope">
  492. <span>{{ scope.row.standard }}</span>
  493. </template>
  494. </el-table-column>
  495. </el-table>
  496. </div>
  497. </el-col>
  498. </el-row>
  499. <el-row>
  500. <el-col :span="24">
  501. <h3 style="text-align: center;">粪便筛分析</h3>
  502. <div class="table">
  503. <el-table
  504. :key="nutritional.tab2.tableKey2"
  505. v-loading="nutritional.tab2.listLoading2"
  506. element-loading-text="给我一点时间"
  507. :data="nutritional.tab2.list2"
  508. border
  509. fit
  510. highlight-current-row
  511. style="width: 100%;margin-bottom:60px;"
  512. :row-style="rowStyle"
  513. :cell-style="cellStyle"
  514. class="elTable table-fixed"
  515. >
  516. <el-table-column label="日期" min-width="130px" align="center">
  517. <template slot-scope="scope">
  518. <span>{{ scope.row.operatetime }}</span>
  519. </template>
  520. </el-table-column>
  521. <el-table-column label="第一层重量(g)" min-width="130px" align="center">
  522. <template slot-scope="scope">
  523. <span>{{ scope.row.oneweight }}</span>
  524. </template>
  525. </el-table-column>
  526. <el-table-column label="第一层百分比" min-width="130px" align="center">
  527. <template slot-scope="scope">
  528. <span>{{ scope.row.onerate }}</span>
  529. </template>
  530. </el-table-column>
  531. <el-table-column label="第二层重量(g)" min-width="130px" align="center">
  532. <template slot-scope="scope">
  533. <span>{{ scope.row.twoweight }}</span>
  534. </template>
  535. </el-table-column>
  536. <el-table-column label="第二层百分比" min-width="130px" align="center">
  537. <template slot-scope="scope">
  538. <span>{{ scope.row.tworate }}</span>
  539. </template>
  540. </el-table-column>
  541. <el-table-column label="第三层重量(g)" min-width="130px" align="center">
  542. <template slot-scope="scope">
  543. <span>{{ scope.row.threeweight }}</span>
  544. </template>
  545. </el-table-column>
  546. <el-table-column label="第三层百分比" min-width="130px" align="center">
  547. <template slot-scope="scope">
  548. <span>{{ scope.row.threerate }}</span>
  549. </template>
  550. </el-table-column>
  551. <el-table-column label="参考标准" min-width="130px" align="center">
  552. <template slot-scope="scope">
  553. <span>{{ scope.row.standard }}</span>
  554. </template>
  555. </el-table-column>
  556. </el-table>
  557. </div>
  558. </el-col>
  559. </el-row>
  560. <el-row>
  561. <el-col :span="24">
  562. <h3 style="text-align: center;">BCS评分</h3>
  563. <div class="table">
  564. <el-table
  565. :key="nutritional.tab2.tableKey3"
  566. v-loading="nutritional.tab2.listLoading3"
  567. element-loading-text="给我一点时间"
  568. :data="nutritional.tab2.list3"
  569. border
  570. fit
  571. highlight-current-row
  572. style="width: 100%;margin-bottom:60px;"
  573. :row-style="rowStyle"
  574. :cell-style="cellStyle"
  575. class="elTable table-fixed"
  576. >
  577. <el-table-column label="日期" min-width="130px" align="center">
  578. <template slot-scope="scope">
  579. <span>{{ scope.row.operatetime }}</span>
  580. </template>
  581. </el-table-column>
  582. <el-table-column label="抽查样本数" min-width="130px" align="center">
  583. <template slot-scope="scope">
  584. <span>{{ scope.row.sumcowcount }}</span>
  585. </template>
  586. </el-table-column>
  587. <el-table-column label="单产(kg/头)" min-width="130px" align="center">
  588. <template slot-scope="scope">
  589. <span>{{ scope.row.product }}</span>
  590. </template>
  591. </el-table-column>
  592. <el-table-column label="干物质采食量(kg/头)" min-width="130px" align="center">
  593. <template slot-scope="scope">
  594. <span>{{ scope.row.cowneed }}</span>
  595. </template>
  596. </el-table-column>
  597. <el-table-column label="泌乳天数" min-width="130px" align="center">
  598. <template slot-scope="scope">
  599. <span>{{ scope.row.avgdim }}</span>
  600. </template>
  601. </el-table-column>
  602. <el-table-column label="标准分数" min-width="130px" align="center">
  603. <template slot-scope="scope">
  604. <span>{{ scope.row.standardscore }}</span>
  605. </template>
  606. </el-table-column>
  607. <el-table-column label="2.75-分(数量、百分比)" min-width="130px" align="center">
  608. <template slot-scope="scope">
  609. <span>{{ scope.row.score25 }}({{ scope.row.score25rate }}%)</span>
  610. </template>
  611. </el-table-column>
  612. <el-table-column label="2.75分(数量、百分比)" min-width="130px" align="center">
  613. <template slot-scope="scope">
  614. <span>{{ scope.row.score275 }}({{ scope.row.score275rate }}%)</span>
  615. </template>
  616. </el-table-column>
  617. <el-table-column label="3分(数量、百分比)" min-width="130px" align="center">
  618. <template slot-scope="scope">
  619. <span>{{ scope.row.score3 }}({{ scope.row.score3rate }}%)</span>
  620. </template>
  621. </el-table-column>
  622. <el-table-column label="3.25分(数量、百分比)" min-width="130px" align="center">
  623. <template slot-scope="scope">
  624. <span>{{ scope.row.score325 }}({{ scope.row.score325rate }}%)</span>
  625. </template>
  626. </el-table-column>
  627. <el-table-column label="3.5分(数量、百分比)" min-width="130px" align="center">
  628. <template slot-scope="scope">
  629. <span>{{ scope.row.score35 }}({{ scope.row.score35rate }}%)</span>
  630. </template>
  631. </el-table-column>
  632. <el-table-column label="3.75分(数量、百分比)" min-width="130px" align="center">
  633. <template slot-scope="scope">
  634. <span>{{ scope.row.score375 }}({{ scope.row.score375rate }}%)</span>
  635. </template>
  636. </el-table-column>
  637. <el-table-column label="4+分(数量、百分比)" min-width="130px" align="center">
  638. <template slot-scope="scope">
  639. <span>{{ scope.row.score4 }}({{ scope.row.score4rate }}%)</span>
  640. </template>
  641. </el-table-column>
  642. </el-table>
  643. </div>
  644. </el-col>
  645. </el-row>
  646. <el-row>
  647. <el-col :span="24">
  648. <h3 style="text-align: center;">粪便评分</h3>
  649. <div class="table">
  650. <el-table
  651. :key="nutritional.tab2.tableKey4"
  652. v-loading="nutritional.tab2.listLoading4"
  653. element-loading-text="给我一点时间"
  654. :data="nutritional.tab2.list4"
  655. border
  656. fit
  657. highlight-current-row
  658. style="width: 100%;margin-bottom:60px;"
  659. :row-style="rowStyle"
  660. :cell-style="cellStyle"
  661. class="elTable table-fixed"
  662. >
  663. <el-table-column label="日期" min-width="130px" align="center">
  664. <template slot-scope="scope">
  665. <span>{{ scope.row.operatetime }}</span>
  666. </template>
  667. </el-table-column>
  668. <el-table-column label="抽查样本数" min-width="130px" align="center">
  669. <template slot-scope="scope">
  670. <span>{{ scope.row.sumcowcount }}</span>
  671. </template>
  672. </el-table-column>
  673. <el-table-column label="单产(kg/头)" min-width="130px" align="center">
  674. <template slot-scope="scope">
  675. <span>{{ scope.row.product }}</span>
  676. </template>
  677. </el-table-column>
  678. <el-table-column label="干物质采食量(kg/头)" min-width="130px" align="center">
  679. <template slot-scope="scope">
  680. <span>{{ scope.row.cowneed }}</span>
  681. </template>
  682. </el-table-column>
  683. <el-table-column label="泌乳天数" min-width="130px" align="center">
  684. <template slot-scope="scope">
  685. <span>{{ scope.row.avgdim }}</span>
  686. </template>
  687. </el-table-column>
  688. <el-table-column label="标准分数" min-width="130px" align="center">
  689. <template slot-scope="scope">
  690. <span>{{ scope.row.cowneed }}</span>
  691. </template>
  692. </el-table-column>
  693. <el-table-column label="1分(数量、百分比)" min-width="130px" align="center">
  694. <template slot-scope="scope">
  695. <span>{{ scope.row.score1 }}({{ scope.row.score1rate }}%)</span>
  696. </template>
  697. </el-table-column>
  698. <el-table-column label="2分(数量、百分比)" min-width="130px" align="center">
  699. <template slot-scope="scope">
  700. <span>{{ scope.row.score2 }}({{ scope.row.score2rate }}%)</span>
  701. </template>
  702. </el-table-column>
  703. <el-table-column label="3分(数量、百分比)" min-width="130px" align="center">
  704. <template slot-scope="scope">
  705. <span>{{ scope.row.score3 }}({{ scope.row.score3rate }}%)</span>
  706. </template>
  707. </el-table-column>
  708. <el-table-column label="4分(数量、百分比)" min-width="130px" align="center">
  709. <template slot-scope="scope">
  710. <span>{{ scope.row.score4 }}({{ scope.row.score4rate }}%)</span>
  711. </template>
  712. </el-table-column>
  713. <el-table-column label="5分(数量、百分比)" min-width="130px" align="center">
  714. <template slot-scope="scope">
  715. <span>{{ scope.row.score5 }}({{ scope.row.score5rate }}%)</span>
  716. </template>
  717. </el-table-column>
  718. </el-table>
  719. </div>
  720. </el-col>
  721. </el-row>
  722. </el-tab-pane>
  723. </el-tabs>
  724. <div slot="footer" class="dialog-footer">
  725. <el-button class="cancelClose cancelClose1" @click="nutritional.dialogFormVisible = false; ">关闭</el-button>
  726. </div>
  727. </div>
  728. </el-dialog>
  729. <!-- 干物质调节 -->
  730. <DryMatterRegulation ref="mychild" :show.sync="isShowDialog" @getIsDisplay="getIsDisplay" />
  731. </div>
  732. </template>
  733. <script>
  734. import { GetDataByName, postJson, GetDataByNames, compareSort, ExecDataByConfig, failproccess, PostDataByName, formatNum, checkButtons } from '@/api/common'
  735. import Pagination from '@/components/Pagination'
  736. import Pagination2 from '@/components/Pagination2'
  737. import { parseTime, json2excel, handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  738. import { MessageBox } from 'element-ui'
  739. import Cookies from 'js-cookie'
  740. import axios from 'axios'
  741. import { getToken } from '@/utils/auth'
  742. import DryMatterRegulation from './dryMatterRegulation.vue'
  743. export default {
  744. inject: ['reload'],
  745. name: 'DhedFormula',
  746. components: { Pagination, Pagination2, DryMatterRegulation },
  747. data() {
  748. return {
  749. dialogFull: false,
  750. isRoleEdit: [],
  751. headerList: [],
  752. pickerMinDate: '',
  753. pickerOptions: {
  754. onPick: ({ maxDate, minDate }) => {
  755. this.pickerMinDate = minDate.getTime()
  756. if (maxDate) {
  757. this.pickerMinDate = ''
  758. }
  759. },
  760. // 限制不能选择今天之后的日期
  761. disabledDate: (time) => {
  762. if (this.pickerMinDate !== '') {
  763. const one = 31 * 24 * 3600 * 1000
  764. const minTime = this.pickerMinDate - one
  765. let maxTime = this.pickerMinDate + one
  766. if (maxTime > new Date()) {
  767. maxTime = new Date()
  768. }
  769. return time.getTime() < minTime - 8.64e7 || time.getTime() > maxTime - 8.64e7
  770. }
  771. return time.getTime() > Date.now() - 8.64e7
  772. }
  773. },
  774. requestParams: [
  775. { name: 'getFTSWLSList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  776. { name: 'getFTBLList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  777. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  778. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  779. ],
  780. getFeedTempletNameListParm: {
  781. name: 'getFeedTempletName',
  782. page: 1,
  783. offset: 1,
  784. // pagecount: parseInt(Cookies.get('pageCount')),
  785. pagecount: '',
  786. returntype: 'Map',
  787. parammaps: {}
  788. },
  789. tnameList: [], // 配方名 称
  790. recipeTemplateList: [], // 配方模板
  791. feedingFormulaList: [], // 补料配方
  792. livestockTypeList: [], // 类别
  793. barList: [],
  794. rules: {
  795. cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  796. },
  797. table: {
  798. getdataListParm: {
  799. name: 'getFPList',
  800. page: 1,
  801. offset: 1,
  802. // pagecount: parseInt(Cookies.get('pageCount')),
  803. pagecount: '',
  804. returntype: 'Map',
  805. parammaps: {
  806. pastureid: Cookies.get('pastureid'),
  807. enable: '',
  808. barid: '',
  809. tname: ''
  810. }
  811. },
  812. tableKey: 0,
  813. list: [],
  814. total: 0,
  815. listLoading: true,
  816. temp: {},
  817. rwList: [],
  818. isPtsfname: false, // 补料配方/补料重量
  819. getdataListParm2: {
  820. name: 'getSysoptEnable',
  821. page: 1,
  822. offset: 1,
  823. pagecount: 1,
  824. returntype: 'Map',
  825. parammaps: {
  826. pastureid: Cookies.get('pastureid'),
  827. inforname: 'isEnableSupplyFeed'
  828. }
  829. },
  830. isRW1: false, // 第一班
  831. isRW2: false, // 第二班
  832. isRW3: false, // 第三班
  833. isRW4: false, // 第四班
  834. getdataListParm3: {
  835. name: 'getSysoptEnable1',
  836. page: 1,
  837. offset: 1,
  838. pagecount: 1,
  839. returntype: 'Map',
  840. parammaps: {
  841. pastureid: Cookies.get('pastureid'),
  842. inforname: 'times'
  843. }
  844. },
  845. RWLength: '' // 班次长度
  846. },
  847. selectList: [],
  848. // 营养评估
  849. nutritional: {
  850. dialogFormVisible: false,
  851. dialogStatus: '',
  852. activeName: 'first ',
  853. tab1: {
  854. // inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  855. inputDatetime: [new Date(), new Date()],
  856. listLoading1: true,
  857. getdataListParm1: {
  858. name: 'getnurj',
  859. page: 1,
  860. offset: 1,
  861. pagecount: 10,
  862. returntype: 'Map',
  863. parammaps: {
  864. pastureid: '',
  865. barid: ''
  866. }
  867. },
  868. disabledCowclass: false,
  869. temp: {},
  870. tableKey: 0,
  871. list: [],
  872. total: 0,
  873. listLoading2: true,
  874. getdataListParm2: {
  875. name: 'GETNurJudge',
  876. page: 1,
  877. offset: 1,
  878. pagecount: 10,
  879. returntype: 'Map',
  880. parammaps: {
  881. pastureid: '',
  882. cowclassid: ''
  883. }
  884. }
  885. },
  886. tab2: {
  887. // inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  888. inputDatetime: [new Date(), new Date()],
  889. listLoading1: true,
  890. tableKey1: 0,
  891. list1: [],
  892. total1: 0,
  893. getdataListParm1: {
  894. name: 'getPennsieveList',
  895. page: 1,
  896. offset: 1,
  897. pagecount: 10,
  898. returntype: 'Map',
  899. parammaps: {
  900. pastureid: '',
  901. barid: '',
  902. startTime: '',
  903. stopTime: '',
  904. inputDatetime: ''
  905. }
  906. },
  907. listLoading2: true,
  908. tableKey2: 0,
  909. list2: [],
  910. total2: 0,
  911. getdataListParm2: {
  912. name: 'getDungsieveList',
  913. page: 1,
  914. offset: 1,
  915. pagecount: 10,
  916. returntype: 'Map',
  917. parammaps: {
  918. pastureid: '',
  919. barid: '',
  920. startTime: '',
  921. stopTime: '',
  922. inputDatetime: ''
  923. }
  924. },
  925. listLoading3: true,
  926. tableKey3: 0,
  927. list3: [],
  928. total3: 0,
  929. getdataListParm3: {
  930. name: 'getBodyscoreList',
  931. page: 1,
  932. offset: 1,
  933. pagecount: 10,
  934. returntype: 'Map',
  935. parammaps: {
  936. pastureid: '',
  937. barid: '',
  938. startTime: '',
  939. stopTime: '',
  940. inputDatetime: ''
  941. }
  942. },
  943. listLoading4: true,
  944. tableKey4: 0,
  945. list4: [],
  946. total4: 0,
  947. getdataListParm4: {
  948. name: 'getDungscoreList',
  949. page: 1,
  950. offset: 1,
  951. pagecount: 10,
  952. returntype: 'Map',
  953. parammaps: {
  954. pastureid: '',
  955. barid: '',
  956. startTime: '',
  957. stopTime: '',
  958. inputDatetime: ''
  959. }
  960. }
  961. }
  962. },
  963. history: {
  964. dialogFormVisible: false,
  965. dialogStatus: '',
  966. temp: {},
  967. rules: {},
  968. tableKey: 0,
  969. list: [],
  970. total: 0,
  971. listLoading: true,
  972. getdataListParm: {
  973. name: 'getPlanModifyFPlist',
  974. page: 1,
  975. offset: 1,
  976. pagecount: 12,
  977. returntype: 'Map',
  978. parammaps: {
  979. pastureid: Cookies.get('pastureid'),
  980. date: '',
  981. barid: '',
  982. tname: ''
  983. }
  984. },
  985. isPtsfname: false, // 补料配方/补料重量
  986. getdataListParm2: {
  987. name: 'getSysoptEnable',
  988. page: 1,
  989. offset: 1,
  990. pagecount: 1,
  991. returntype: 'Map',
  992. parammaps: {
  993. pastureid: Cookies.get('pastureid'),
  994. inforname: 'isEnableSupplyFeed'
  995. }
  996. },
  997. isRW1: false, // 第一班
  998. isRW2: false, // 第二班
  999. isRW3: false, // 第三班
  1000. isRW4: false, // 第四班
  1001. getdataListParm3: {
  1002. name: 'getSysoptEnable1',
  1003. page: 1,
  1004. offset: 1,
  1005. pagecount: 1,
  1006. returntype: 'Map',
  1007. parammaps: {
  1008. pastureid: Cookies.get('pastureid'),
  1009. inforname: 'times'
  1010. }
  1011. },
  1012. getdataDateParm: {
  1013. name: 'getFPMaxDate',
  1014. page: 1,
  1015. offset: 1,
  1016. pagecount: 10,
  1017. returntype: 'Map',
  1018. parammaps: {
  1019. pastureid: Cookies.get('pastureid')
  1020. }
  1021. }
  1022. },
  1023. textMap: {
  1024. Nutritional: '营养评估',
  1025. history: '历史记录'
  1026. },
  1027. focusWRow: {}, // 一班重量得到焦点暂存
  1028. focusWRow2: {}, // 2班重量得到焦点暂存
  1029. focusWRow3: {}, // 3班重量得到焦点暂存
  1030. focusWRow4: {}, // 4班重量得到焦点暂存
  1031. requestParam: {},
  1032. download: {
  1033. getdataListParm: {
  1034. name: 'getFPList',
  1035. page: 1,
  1036. offset: 1,
  1037. pagecount: 0,
  1038. returntype: 'Map',
  1039. parammaps: {
  1040. pastureid: Cookies.get('pastureid'),
  1041. enable: ''
  1042. }
  1043. },
  1044. list: []
  1045. },
  1046. spanObj: {},
  1047. mergekeys: ['barname', 'sumweight'],
  1048. isShowDialog: false,
  1049. isokDisable: false,
  1050. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  1051. cellStyle: { padding: 0 + 'px' },
  1052. myHeight: document.documentElement.clientHeight - 85 - 140,
  1053. oldRowList:{}
  1054. }
  1055. },
  1056. computed: {
  1057. // 设置请求头
  1058. headers() {
  1059. return {
  1060. token: getToken()
  1061. }
  1062. },
  1063. uploadData() {
  1064. return {
  1065. name: 'checkbarname,checkftsw,checkftbl,updateBigFPUpload,updateBigFPfeedweightUpload,updateBigFPDetailUpload,updateBigFPDetailUploadV1,updateBigFPDetailUploadV2,updateBigFPDetailUploadV3',
  1066. importParams: '栏舍名称,实际牛头数,系数(%),配方模板,补料配方,第一班比例(%),第二班比例(%),第三班比例(%)',
  1067. sheetname: 'Sheet1',
  1068. // 登录牧场
  1069. pastureid: Cookies.get('pastureid'),
  1070. // 日期参数
  1071. dateParams: '',
  1072. // 必填参数
  1073. requiredParams: '栏舍名称,实际牛头数,系数(%),配方模板,',
  1074. // 为数值的参数
  1075. numParams: '实际牛头数,系数(%),第一班比例(%),第二班比例(%),第三班比例(%),,第四班比例(%)'
  1076. }
  1077. },
  1078. // 设置上传地址
  1079. uploadExcelUrl() {
  1080. return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
  1081. }
  1082. },
  1083. created() {
  1084. this.getButtons()
  1085. this.getDownList()
  1086. this.getFeedTempletNameList()
  1087. },
  1088. methods: {
  1089. getButtons() {
  1090. const Edit = 'DhedFormula'
  1091. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  1092. this.isRoleEdit = isRoleEdit
  1093. },
  1094. getDownList() {
  1095. GetDataByNames(this.requestParams).then(response => {
  1096. this.recipeTemplateList = response.data.getFTSWLSList.list
  1097. this.feedingFormulaList = response.data.getFTBLList.list
  1098. this.livestockTypeList = response.data.getCowclassListEnable.list
  1099. this.barList = response.data.getBarListEnable.list
  1100. this.getIsDisplay()
  1101. })
  1102. },
  1103. getFeedTempletNameList() {
  1104. GetDataByName(this.getFeedTempletNameListParm).then(response => {
  1105. if (response.data.list !== null) {
  1106. this.tnameList = response.data.list
  1107. } else {
  1108. this.tnameList = []
  1109. }
  1110. })
  1111. },
  1112. getIsDisplay() {
  1113. GetDataByName(this.table.getdataListParm2).then(response => {
  1114. console.log(response.data.list[0].inforvalue)
  1115. if (response.data.list !== null) {
  1116. if (response.data.list[0].inforvalue == 0) {
  1117. this.table.isPtsfname = false
  1118. } else {
  1119. this.table.isPtsfname = true
  1120. }
  1121. }
  1122. })
  1123. GetDataByName(this.table.getdataListParm3).then(response => {
  1124. console.log(response.data.list[0].inforvalue)
  1125. if (response.data.list !== null) {
  1126. this.table.RWLength = response.data.list[0].inforvalue
  1127. if (response.data.list[0].inforvalue == 1) {
  1128. this.table.isRW1 = true
  1129. this.table.isRW2 = false
  1130. this.table.isRW3 = false
  1131. this.table.isRW4 = false
  1132. } else if (response.data.list[0].inforvalue == 2) {
  1133. this.table.isRW1 = true
  1134. this.table.isRW2 = true
  1135. this.table.isRW3 = false
  1136. this.table.isRW4 = false
  1137. } else if (response.data.list[0].inforvalue == 3) {
  1138. this.table.isRW1 = true
  1139. this.table.isRW2 = true
  1140. this.table.isRW3 = true
  1141. this.table.isRW4 = false
  1142. } else if (response.data.list[0].inforvalue == 4) {
  1143. this.table.isRW1 = true
  1144. this.table.isRW2 = true
  1145. this.table.isRW3 = true
  1146. this.table.isRW4 = true
  1147. }
  1148. } else {
  1149. this.table.isRW1 = false
  1150. this.table.isRW2 = false
  1151. this.table.isRW3 = false
  1152. this.table.isRW4 = false
  1153. }
  1154. })
  1155. this.getList()
  1156. },
  1157. getList() {
  1158. this.table.listLoading = true
  1159. GetDataByName(this.table.getdataListParm).then(response => {
  1160. console.log('table数据', response.data.list)
  1161. if (response.data.list !== null) {
  1162. for (let i = 0; i < response.data.list.length; i++) {
  1163. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1164. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1165. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1166. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1167. if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
  1168. if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
  1169. this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
  1170. } else {
  1171. this.$set(response.data.list[i], 'dryweight', '')
  1172. }
  1173. }
  1174. if (response.data.list[i].ftid == undefined || response.data.list[i].ftname == '') {
  1175. this.$set(response.data.list[i], 'ftid', '')
  1176. this.$set(response.data.list[i], 'ftname', '')
  1177. }
  1178. if (response.data.list[i].ptsfid == undefined || response.data.list[i].ptsfname == '') {
  1179. this.$set(response.data.list[i], 'ptsfid', '')
  1180. this.$set(response.data.list[i], 'ptsfname', '')
  1181. }
  1182. if (response.data.list[i].ccount == undefined) {
  1183. this.$set(response.data.list[i], 'ccount', '')
  1184. }
  1185. if (response.data.list[i].softccount == undefined) {
  1186. this.$set(response.data.list[i], 'softccount', '')
  1187. }
  1188. if (response.data.list[i].ratio == undefined) {
  1189. this.$set(response.data.list[i], 'ratio', 100)
  1190. }
  1191. if (response.data.list[i].ccountratio == undefined) {
  1192. this.$set(response.data.list[i], 'ccountratio', '')
  1193. }
  1194. if (response.data.list[i].r1 == undefined) {
  1195. this.$set(response.data.list[i], 'r1', '')
  1196. }
  1197. if (response.data.list[i].r2 == undefined) {
  1198. this.$set(response.data.list[i], 'r2', '')
  1199. }
  1200. if (response.data.list[i].r3 == undefined) {
  1201. this.$set(response.data.list[i], 'r3', '')
  1202. }
  1203. if (response.data.list[i].r4 == undefined) {
  1204. this.$set(response.data.list[i], 'r4', '')
  1205. }
  1206. if (response.data.list[i].w1 == undefined) {
  1207. this.$set(response.data.list[i], 'w1', '')
  1208. }
  1209. if (response.data.list[i].w2 == undefined) {
  1210. this.$set(response.data.list[i], 'w2', '')
  1211. }
  1212. if (response.data.list[i].w3 == undefined) {
  1213. this.$set(response.data.list[i], 'w3', '')
  1214. }
  1215. if (response.data.list[i].w4 == undefined) {
  1216. this.$set(response.data.list[i], 'w4', '')
  1217. }
  1218. if (response.data.list[i].supplyweight == undefined) {
  1219. this.$set(response.data.list[i], 'supplyweight', '')
  1220. }
  1221. if (response.data.list[i].feedweight == undefined || parseFloat(response.data.list[i].feedweight) == 0) {
  1222. this.$set(response.data.list[i], 'feedweight', '')
  1223. }
  1224. this.$set(response.data.list[i], 'dailyWeight', '')
  1225. if (response.data.list[i].Bfweight == undefined) {
  1226. this.$set(response.data.list[i], 'Bfweight', '')
  1227. }
  1228. if (response.data.list[i].Sfweight == undefined) {
  1229. this.$set(response.data.list[i], 'Sfweight', '')
  1230. }
  1231. if (response.data.list[i].isOneWeight == undefined) {
  1232. this.$set(response.data.list[i], 'isOneWeight', false)
  1233. }
  1234. if (response.data.list[i].isTwoWeight == undefined) {
  1235. this.$set(response.data.list[i], 'isTwoWeight', false)
  1236. }
  1237. if (response.data.list[i].isThreeWeight == undefined) {
  1238. this.$set(response.data.list[i], 'isThreeWeight', false)
  1239. }
  1240. if (response.data.list[i].isFourWeight == undefined) {
  1241. this.$set(response.data.list[i], 'isFourWeight', false)
  1242. }
  1243. if (response.data.list[i].timesopt !== undefined) {
  1244. var timesoptArr = response.data.list[i].timesopt.split(',')
  1245. for (let j = 0; j < timesoptArr.length; j++) {
  1246. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  1247. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  1248. }
  1249. }
  1250. if (response.data.list[i].bw1 == undefined) {
  1251. this.$set(response.data.list[i], 'bw1', '')
  1252. }
  1253. if (response.data.list[i].bw2 == undefined) {
  1254. this.$set(response.data.list[i], 'bw2', '')
  1255. }
  1256. if (response.data.list[i].bw3 == undefined) {
  1257. this.$set(response.data.list[i], 'bw3', '')
  1258. }
  1259. if (response.data.list[i].bw4 == undefined) {
  1260. this.$set(response.data.list[i], 'bw4', '')
  1261. }
  1262. if (response.data.list[i].supplement !== undefined) {
  1263. var supplementArr = response.data.list[i].supplement.split(',')
  1264. for (let j = 0; j < supplementArr.length; j++) {
  1265. response.data.list[i]['bw' + supplementArr[j].split(':')[0]] = supplementArr[j].split(':')[2]
  1266. }
  1267. }
  1268. }
  1269. // console.log(response.data.list, sumr)
  1270. for (let i = 0; i < response.data.list.length; i++) {
  1271. if (response.data.list[i].r1 == '') {
  1272. response.data.list[i].r1 = 0
  1273. response.data.list[i].w1 = 0
  1274. }
  1275. if (response.data.list[i].r2 == '') {
  1276. response.data.list[i].r2 = 0
  1277. response.data.list[i].w2 = 0
  1278. }
  1279. if (response.data.list[i].r3 == '') {
  1280. response.data.list[i].r3 = 0
  1281. response.data.list[i].w3 = 0
  1282. }
  1283. if (response.data.list[i].r4 == '') {
  1284. response.data.list[i].r4 = 0
  1285. response.data.list[i].w4 = 0
  1286. }
  1287. 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))
  1288. response.data.list[i].sumr = formatNum(response.data.list[i].sumr, parseInt(Cookies.get('decimal')))
  1289. // this.$set(response.data.list[i],'feedweight',formatNum(parseFloat(response.data.list[i].feedweight) * parseFloat(response.data.list[i].sumr)/100,2))
  1290. 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))
  1291. response.data.list[i].dailyWeight = formatNum(response.data.list[i].dailyWeight, parseInt(Cookies.get('decimal')))
  1292. }
  1293. this.table.list = response.data.list
  1294. console.log(this.table.list, 'this.table.list')
  1295. this.table.pageNum = response.data.pageNum
  1296. this.table.pageSize = response.data.pageSize
  1297. this.table.total = response.data.total
  1298. } else {
  1299. this.table.list = []
  1300. }
  1301. setTimeout(() => {
  1302. this.table.listLoading = false
  1303. }, 100)
  1304. })
  1305. },
  1306. handleSearch() {
  1307. this.getList()
  1308. },
  1309. renderHeader(h, { column, $index }) { // h即为cerateElement的简写,具体可看vue官方文档
  1310. return h(
  1311. 'div',
  1312. [
  1313. h('span', column.label),
  1314. h('i', {
  1315. class: 'el-icon-unlock',
  1316. ref: 'el-icon-unlock',
  1317. style: 'margin-left:5px;'
  1318. })
  1319. ]
  1320. )
  1321. },
  1322. headerClick(column, event) {
  1323. console.log(column, event)
  1324. this.headerList.push(event)
  1325. if (column.label == '第一班重量') {
  1326. for (let i = 0; i < this.table.list.length; i++) {
  1327. if (this.table.list[i].Edit == true) {
  1328. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1329. event.target.className = 'el-icon-lock'
  1330. this.$set(this.table.list[i], 'isOneWeight', true) // 锁住不可编辑
  1331. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1332. event.target.className = 'el-icon-unlock'
  1333. this.$set(this.table.list[i], 'isOneWeight', false) // 解锁可编辑
  1334. }
  1335. }
  1336. }
  1337. } else if (column.label == '第二班重量') {
  1338. for (let i = 0; i < this.table.list.length; i++) {
  1339. if (this.table.list[i].Edit == true) {
  1340. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1341. event.target.className = 'el-icon-lock'
  1342. this.$set(this.table.list[i], 'isTwoWeight', true) // 锁住不可编辑
  1343. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1344. event.target.className = 'el-icon-unlock'
  1345. this.$set(this.table.list[i], 'isTwoWeight', false) // 解锁可编辑
  1346. }
  1347. }
  1348. }
  1349. } else if (column.label == '第三班重量') {
  1350. for (let i = 0; i < this.table.list.length; i++) {
  1351. if (this.table.list[i].Edit == true) {
  1352. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1353. event.target.className = 'el-icon-lock'
  1354. this.$set(this.table.list[i], 'isThreeWeight', true) // 锁住不可编辑
  1355. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1356. event.target.className = 'el-icon-unlock'
  1357. this.$set(this.table.list[i], 'isThreeWeight', false) // 解锁可编辑
  1358. }
  1359. }
  1360. }
  1361. } else if (column.label == '第四班重量') {
  1362. for (let i = 0; i < this.table.list.length; i++) {
  1363. if (this.table.list[i].Edit == true) {
  1364. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1365. event.target.className = 'el-icon-lock'
  1366. this.$set(this.table.list[i], 'isFourWeight', true) // 锁住不可编辑
  1367. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1368. event.target.className = 'el-icon-unlock'
  1369. this.$set(this.table.list[i], 'isFourWeight', false) // 解锁可编辑
  1370. }
  1371. }
  1372. }
  1373. }
  1374. },
  1375. // 配方模板
  1376. changeRecipeTemplate(item, row) {
  1377. row.myccname = this.recipeTemplateList.find(obj => obj.id == item).ccname
  1378. if (row.bigcowclass !== row.myccname) {
  1379. this.$message({ type: 'warning', message: '所选配方模板牲畜类别与栏舍对应牲畜类别不一致', duration: 2000 })
  1380. }
  1381. console.log(row.supplyweight, 'row.supplyweight')
  1382. row.ftname = this.recipeTemplateList.find(obj => obj.id == item).tname
  1383. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == item).Sfweight// Sfweight
  1384. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == item).SfweightLock// SfweightLock
  1385. row.dryweight = this.recipeTemplateList.find(obj => obj.id == item).dryweight// SfweightLock
  1386. // 补料重量supplyweight
  1387. // 配方重量ftweight
  1388. // 系数头数ccountratio
  1389. // 投喂量feedweight
  1390. // 实际牛头数ccount
  1391. // 投喂量 = 配方重量 + 补料重量
  1392. // 配方重量 = Sfweight * 系数头数 + SfweightLock * 实际牛头数ccount
  1393. console.log(row.Sfweight, 'row.Sfweight')
  1394. console.log(row.ccountratio, '系数头数')
  1395. console.log(row.SfweightLock, 'SfweightLock')
  1396. console.log(row.ccount, '实际牛头数')
  1397. if (row.Sfweight !== '' && row.ccount !== '') {
  1398. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  1399. } else {
  1400. row.ftweight = ''
  1401. }
  1402. // console.log(row.ftweight, 'row.ftweight')
  1403. // console.log(row.supplyweight, 'row.supplyweight')
  1404. // console.log(this.table.isPtsfname, 'isPtsfname')
  1405. if (this.table.isPtsfname == false) {
  1406. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1407. } else {
  1408. if (row.supplyweight == 'NaN') {
  1409. row.supplyweight = 0
  1410. }
  1411. console.log(row.supplyweight)
  1412. if (row.supplyweight !== '' && row.ftweight !== '') {
  1413. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1414. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1415. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1416. } else if (row.supplyweight !== '' && row.ftweight !== '') {
  1417. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  1418. }
  1419. if (row.ccountratio !== '' && row.ftweight !== '') {
  1420. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1421. }
  1422. if (row.Sfweight !== '' && row.ccount !== '') {
  1423. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  1424. } else {
  1425. row.ftweight = ''
  1426. }
  1427. }
  1428. console.log(row.supplyweight)
  1429. if (row.supplyweight == 'NaN') { row.supplyweight = 0 }
  1430. if (row.r1 !== '') { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  1431. if (row.r2 !== '') { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  1432. if (row.r3 !== '') { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  1433. if (row.r4 !== '') { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  1434. if (row.w1 == '') { row.w1 = 0 }
  1435. if (row.w2 == '') { row.w2 = 0 }
  1436. if (row.w3 == '') { row.w3 = 0 }
  1437. if (row.w4 == '') { row.w4 = 0 }
  1438. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1439. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1440. },
  1441. // 补料配方
  1442. changeFeedingFormula(item, row) {
  1443. console.log(item, '=========')
  1444. if (item == '') {
  1445. row.bw1 = 0
  1446. row.bw2 = 0
  1447. row.bw3 = 0
  1448. row.bw4 = 0
  1449. }
  1450. // 补料重量supplyweight
  1451. // 配方重量ftweight
  1452. // 系数头数ccountratio
  1453. // 投喂量feedweight
  1454. // 实际牛头数ccount
  1455. // 投喂量 = 配方重量 + 补料重量
  1456. row.myccname = this.feedingFormulaList.find(obj => obj.id == item).ccname
  1457. if (row.bigcowclass !== row.myccname) {
  1458. this.$message({ type: 'warning', message: '所选补料配方与栏舍对应牲畜类别不一致', duration: 2000 })
  1459. }
  1460. if (item !== '') {
  1461. console.log(456)
  1462. row.ptsfname = this.feedingFormulaList.find(obj => obj.id == item).tname
  1463. row.BLweight = this.feedingFormulaList.find(obj => obj.id == item).Sfweight
  1464. row.BLSfweightLock = this.feedingFormulaList.find(obj => obj.id == item).SfweightLock
  1465. } else {
  1466. row.ptsfname = ''
  1467. row.BLweight = 0
  1468. row.BLSfweightLock = 0
  1469. }
  1470. // 配方重量 = 系数头数 * Sfweight
  1471. // if (row.ccountratio !== '' && row.ftweight !== '') {
  1472. // row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1473. // }
  1474. // 补料重量 = 系数头数 * BLweight
  1475. // console.log(row.ccountratio)
  1476. // console.log(row.ccount)
  1477. // console.log(row.BLweight)
  1478. // console.log(row.BLSfweightLock)
  1479. if (row.ccountratio !== '' && row.ccount !== '' && row.ccount.BLweight !== '' && row.BLSfweightLock !== '') {
  1480. this.$set(row, 'supplyweight', formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLSfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  1481. } else {
  1482. row.supplyweight = ''
  1483. }
  1484. if (this.table.isPtsfname == false) {
  1485. row.feedweight = parseFloat(row.ftweight)
  1486. } else {
  1487. if (row.supplyweight !== '' && row.ftweight !== '') {
  1488. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1489. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1490. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1491. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1492. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  1493. }
  1494. }
  1495. if (row.r1 !== '') { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  1496. if (row.r2 !== '') { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  1497. if (row.r3 !== '') { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  1498. if (row.r4 !== '') { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  1499. if (row.w1 == '') { row.w1 = 0 }
  1500. if (row.w2 == '') { row.w2 = 0 }
  1501. if (row.w3 == '') { row.w3 = 0 }
  1502. if (row.w4 == '') { row.w4 = 0 }
  1503. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1504. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1505. },
  1506. // 实际牛头数失去焦点计算
  1507. // ccount实际牛头数
  1508. // ratio系数
  1509. // ccountratio系数牛头数
  1510. blurCcount(row) { // 实际牛头数
  1511. console.log(row)
  1512. if (row.ftid !== '-1' && row.ftid !== '') {
  1513. console.log(this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight)
  1514. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1515. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1516. }
  1517. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  1518. // row.ptsfid = parseInt(row.ptsfid)
  1519. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), parseInt(Cookies.get('decimal')))
  1520. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), parseInt(Cookies.get('decimal')))
  1521. }
  1522. if (row.ptsfid == '') {
  1523. row.BLweight = 0
  1524. row.BLweightLock = 0
  1525. }
  1526. if (row.Sfweight !== '' && row.ccount !== '') {
  1527. // console.log(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount))
  1528. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1529. }
  1530. // 系数牛头数 = 实际牛头数 * 系数/100
  1531. if (row.ccount !== '' && row.ratio !== '') {
  1532. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  1533. } else if (row.ratio !== '' && row.ccountratio !== '') {
  1534. row.ccount = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  1535. } else if (row.ccount !== '' || row.ratio !== '') {
  1536. row.ccountratio = ''
  1537. }
  1538. // 补料重量
  1539. console.log(row.ccountratio, row.BLweight)
  1540. if (row.BLweight == 'undefined') {
  1541. this.$set(row, 'BLweight', '')
  1542. }
  1543. console.log('BLweight', row.BLweight)
  1544. console.log('ccountratio', row.ccountratio)
  1545. console.log('BLweightLock', row.BLweightLock)
  1546. console.log('ccount', row.ccount)
  1547. if (row.ccountratio !== '' && row.BLweight !== '') {
  1548. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1549. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1550. row.supplyweight = ''
  1551. row.feedweight = ''
  1552. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1553. row.supplyweight = ''
  1554. row.feedweight = ''
  1555. }
  1556. // 配方重量
  1557. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1558. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1559. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1560. row.ftweight = ''
  1561. row.feedweight = ''
  1562. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1563. row.ftweight = ''
  1564. row.feedweight = ''
  1565. }
  1566. if (this.table.isPtsfname == false) {
  1567. row.feedweight = parseFloat(row.ftweight)
  1568. } else {
  1569. if (row.supplyweight !== '' && row.ftweight !== '') {
  1570. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1571. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1572. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  1573. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1574. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1575. }
  1576. // 配方重量 = 系数头数 * Sfweight
  1577. if (row.ccountratio !== '' && row.ftweight !== '') {
  1578. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1579. }
  1580. // 补料重量 = 系数头数 * BLweight
  1581. if (row.ccountratio !== '' && row.BLweight !== '') {
  1582. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1583. }
  1584. }
  1585. console.log(row)
  1586. if (row.r1 !== '' && row.isOneWeight == false) { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  1587. if (row.r2 !== '' && row.isTwoWeight == false) { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  1588. if (row.r3 !== '' && row.isThreeWeight == false) { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  1589. if (row.r4 !== '' && row.isFourWeight == false) { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  1590. if (row.isOneWeight == true) {
  1591. this.$set(row, 'r1', formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1592. }
  1593. if (row.isTwoWeight == true) {
  1594. this.$set(row, 'r2', formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1595. }
  1596. if (row.isThreeWeight == true) {
  1597. this.$set(row, 'r3', formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1598. }
  1599. if (row.isFourWeight == true) {
  1600. this.$set(row, 'r4', formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1601. }
  1602. if (row.w1 == '') { row.w1 = 0 }
  1603. if (row.w2 == '') { row.w2 = 0 }
  1604. if (row.w3 == '') { row.w3 = 0 }
  1605. if (row.w4 == '') { row.w4 = 0 }
  1606. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1607. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1608. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1609. },
  1610. blurRatio(row) {
  1611. console.log(row, '--------------')
  1612. if (row.ftid !== '-1' && row.ftid !== '') {
  1613. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1614. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1615. }
  1616. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  1617. // row.ptsfid = parseInt(row.ptsfid)
  1618. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), parseInt(Cookies.get('decimal')))
  1619. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), parseInt(Cookies.get('decimal')))
  1620. }
  1621. if (row.ptsfid == '') {
  1622. row.BLweight = 0
  1623. row.BLweightLock = 0
  1624. }
  1625. // 系数
  1626. if (row.ccount !== '' && row.ratio !== '' && row.ccountratio !== '') {
  1627. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  1628. } else if (row.ccount !== '' && row.ccountratio !== '') {
  1629. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1630. } else if (row.ccount !== '' || row.ccountratio !== '') {
  1631. row.ratio = ''
  1632. }
  1633. // 补料重量
  1634. if (row.ccountratio !== '' && row.BLweight !== '') {
  1635. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1636. } else if (row.ccountratio !== '' && row.BLweight == '' || row.ccountratio == '' && row.BLweight !== '') {
  1637. row.supplyweight = ''
  1638. row.feedweight = ''
  1639. }
  1640. // 配方重量
  1641. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1642. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1643. } else if (row.ccountratio !== '' && row.Sfweight == '' || row.ccountratio == '' && row.Sfweight !== '') {
  1644. row.ftweight = ''
  1645. row.feedweight = ''
  1646. }
  1647. // 投喂量
  1648. if (row.supplyweight !== '' && row.ftweight !== '') {
  1649. row.feedweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1650. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1651. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1652. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1653. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  1654. }
  1655. console.log(row.supplyweight, '补料重量')
  1656. console.log(row.ftweight, '配方重量')
  1657. if (this.table.isPtsfname == false) {
  1658. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1659. } else {
  1660. // 投喂量
  1661. if (row.supplyweight !== '' && row.ftweight !== '') {
  1662. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1663. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1664. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1665. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1666. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  1667. }
  1668. // 补料重量
  1669. if (row.ccountratio !== '' && row.BLweight !== '') {
  1670. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1671. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1672. row.supplyweight = ''
  1673. row.feedweight = ''
  1674. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1675. row.supplyweight = ''
  1676. row.feedweight = ''
  1677. }
  1678. // 配方重量
  1679. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1680. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1681. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1682. row.ftweight = ''
  1683. row.feedweight = ''
  1684. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1685. row.ftweight = ''
  1686. row.feedweight = ''
  1687. }
  1688. }
  1689. if (row.r1 !== '' && row.isOneWeight == false) { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  1690. if (row.r2 !== '' && row.isTwoWeight == false) { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  1691. if (row.r3 !== '' && row.isThreeWeight == false) { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  1692. if (row.r4 !== '' && row.isFourWeight == false) { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  1693. if (row.isOneWeight == true) {
  1694. this.$set(row, 'r1', formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1695. }
  1696. if (row.isTwoWeight == true) {
  1697. this.$set(row, 'r2', formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1698. }
  1699. if (row.isThreeWeight == true) {
  1700. this.$set(row, 'r3', formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1701. }
  1702. if (row.isFourWeight == true) {
  1703. this.$set(row, 'r4', formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1704. }
  1705. if (row.w1 == '') { row.w1 = 0 }
  1706. if (row.w2 == '') { row.w2 = 0 }
  1707. if (row.w3 == '') { row.w3 = 0 }
  1708. if (row.w4 == '') { row.w4 = 0 }
  1709. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1710. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1711. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1712. },
  1713. blurCcountratio(row) {
  1714. if (row.ftid !== '-1' && row.ftid !== '') {
  1715. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1716. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1717. }
  1718. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  1719. // row.ptsfid = parseInt(row.ptsfid)
  1720. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), parseInt(Cookies.get('decimal')))
  1721. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), parseInt(Cookies.get('decimal')))
  1722. }
  1723. if (row.ptsfid == '') {
  1724. row.BLweight = 0
  1725. row.BLweightLock = 0
  1726. }
  1727. if (row.ptsfid == '') {
  1728. row.BLweight = 0
  1729. row.BLweightLock = 0
  1730. }
  1731. // ratio系数ccountratio系数头数ccount实际牛头数
  1732. // 系数头数
  1733. if (row.ccountratio !== '' && row.ccount !== '' && row.ratio !== '') {
  1734. if (row.ccountratio !== 0 && row.ccount !== 0) {
  1735. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1736. }
  1737. } else if (row.ccount !== '' && row.ratio !== '') {
  1738. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  1739. } else if (row.ccountratio !== '' && row.ccount !== '') {
  1740. if (row.ccountratio !== 0 && row.ccount !== 0) {
  1741. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1742. }
  1743. } else if (row.ccountratio !== '' && row.ratio !== '') {
  1744. row.ccount = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  1745. }
  1746. // 补料重量
  1747. if (row.ccountratio !== '' && row.BLweight !== '') {
  1748. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1749. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1750. row.supplyweight = ''
  1751. row.feedweight = ''
  1752. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1753. row.supplyweight = ''
  1754. row.feedweight = ''
  1755. }
  1756. // 配方重量
  1757. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1758. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1759. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1760. row.ftweight = ''
  1761. row.feedweight = ''
  1762. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1763. row.ftweight = ''
  1764. row.feedweight = ''
  1765. }
  1766. // 投喂量
  1767. if (row.supplyweight !== '' && row.ftweight !== '') {
  1768. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1769. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1770. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1771. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1772. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  1773. }
  1774. if (this.table.isPtsfname == false) {
  1775. console.log(row)
  1776. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1777. } else {
  1778. // 投喂量
  1779. if (row.supplyweight !== '' && row.ftweight !== '') {
  1780. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1781. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1782. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1783. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1784. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  1785. }
  1786. // 补料重量
  1787. if (row.ccountratio !== '' && row.BLweight !== '') {
  1788. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1789. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1790. row.supplyweight = ''
  1791. row.feedweight = ''
  1792. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1793. row.supplyweight = ''
  1794. row.feedweight = ''
  1795. }
  1796. // 配方重量
  1797. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1798. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1799. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1800. row.ftweight = ''
  1801. row.feedweight = ''
  1802. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1803. row.ftweight = ''
  1804. row.feedweight = ''
  1805. }
  1806. }
  1807. if (row.r1 !== '' && row.isOneWeight == false) {
  1808. this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal'))))
  1809. }
  1810. if (row.r2 !== '' && row.isTwoWeight == false) {
  1811. this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal'))))
  1812. }
  1813. if (row.r3 !== '' && row.isThreeWeight == false) {
  1814. this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal'))))
  1815. }
  1816. if (row.r4 !== '' && row.isFourWeight == false) {
  1817. this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal'))))
  1818. }
  1819. if (row.isOneWeight == true) {
  1820. this.$set(row, 'r1', formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1821. }
  1822. if (row.isTwoWeight == true) {
  1823. this.$set(row, 'r2', formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1824. }
  1825. if (row.isThreeWeight == true) {
  1826. this.$set(row, 'r3', formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1827. }
  1828. if (row.isFourWeight == true) {
  1829. this.$set(row, 'r4', formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  1830. }
  1831. if (row.w1 == '') { row.w1 = 0 }
  1832. if (row.w2 == '') { row.w2 = 0 }
  1833. if (row.w3 == '') { row.w3 = 0 }
  1834. if (row.w4 == '') { row.w4 = 0 }
  1835. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1836. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1837. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1838. },
  1839. // 总比例
  1840. blurR(row) {
  1841. if (row.r1 == '') { row.r1 = 0 }
  1842. if (row.r2 == '') { row.r2 = 0 }
  1843. if (row.r3 == '') { row.r3 = 0 }
  1844. if (row.r4 == '') { row.r4 = 0 }
  1845. if (row.r1 !== '') {
  1846. row.w1 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r1) / 100, parseInt(Cookies.get('decimal')))
  1847. }
  1848. if (row.r2 !== '') {
  1849. row.w2 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r2) / 100, parseInt(Cookies.get('decimal')))
  1850. }
  1851. if (row.r3 !== '') {
  1852. row.w3 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r3) / 100, parseInt(Cookies.get('decimal')))
  1853. }
  1854. if (row.r4 !== '') {
  1855. row.w4 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r4) / 100, parseInt(Cookies.get('decimal')))
  1856. }
  1857. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1858. if (row.w1 == '') { row.w1 = 0 }
  1859. if (row.w2 == '') { row.w2 = 0 }
  1860. if (row.w3 == '') { row.w3 = 0 }
  1861. if (row.w4 == '') { row.w4 = 0 }
  1862. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1863. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1864. },
  1865. // 一班重量得到焦点
  1866. focusW(row) {
  1867. console.log(row, '====')
  1868. this.focusWRow = Object.assign({}, row)
  1869. },
  1870. // 1班重量得到焦点
  1871. focusW2(row) {
  1872. this.focusWRow2 = Object.assign({}, row)
  1873. },
  1874. // 3班重量得到焦点
  1875. focusW3(row) {
  1876. this.focusWRow3 = Object.assign({}, row)
  1877. },
  1878. // 4班重量得到焦点
  1879. focusW4(row) {
  1880. this.focusWRow4 = Object.assign({}, row)
  1881. },
  1882. // 一班重量
  1883. blurW(row) {
  1884. if (row.w1 == '') {
  1885. row.w1 = 0
  1886. }
  1887. if (row.w2 == '') {
  1888. row.w2 = 0
  1889. }
  1890. if (row.w3 == '') {
  1891. row.w3 = 0
  1892. }
  1893. if (row.w4 == '') {
  1894. row.w4 = 0
  1895. }
  1896. if (row.r1 == '') {
  1897. row.r1 = 0
  1898. }
  1899. if (row.r2 == '') {
  1900. row.r2 = 0
  1901. }
  1902. if (row.r3 == '') {
  1903. row.r3 = 0
  1904. }
  1905. if (row.r4 == '') {
  1906. row.r4 = 0
  1907. }
  1908. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1909. console.log(row, '=======投喂量feedweight')
  1910. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1911. if (this.table.RWLength == 4) {
  1912. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1913. // 2班3班4班都锁定
  1914. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1915. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1916. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1917. }
  1918. // 2班3班锁定4班未锁定
  1919. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1920. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1921. row.w4 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  1922. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1923. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1924. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1925. }
  1926. // 2班4班锁定3班未锁定
  1927. if (row.isTwoWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1928. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1929. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1930. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1931. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1932. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1933. }
  1934. // 3班4班锁定2班未锁定
  1935. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1936. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1937. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1938. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1939. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1940. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1941. }
  1942. // 2班锁定,3班4班未锁
  1943. if (row.isTwoWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1944. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1945. if (row.r3 == 0 && row.r4 == 0) {
  1946. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  1947. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1948. row.w4 = row.w3
  1949. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1950. } else if (row.r3 == 0 && row.r4 !== 0) {
  1951. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1952. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1953. if (row.w1 == '') { row.w1 = 0 }
  1954. if (row.w2 == '') { row.w2 = 0 }
  1955. if (row.w3 == '') { row.w3 = 0 }
  1956. if (row.w4 == '') { row.w4 = 0 }
  1957. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1958. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1959. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1960. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1961. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1962. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1963. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1964. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1965. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1966. }
  1967. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1968. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1969. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1970. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1971. } else if (row.r3 !== 0 && row.r4 == 0) {
  1972. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1973. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1974. if (row.w1 == '') { row.w1 = 0 }
  1975. if (row.w2 == '') { row.w2 = 0 }
  1976. if (row.w3 == '') { row.w3 = 0 }
  1977. if (row.w4 == '') { row.w4 = 0 }
  1978. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1979. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1980. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1981. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1982. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1983. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1984. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1985. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1986. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1987. }
  1988. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1989. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1990. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1991. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1992. } else {
  1993. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1994. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1995. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1996. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1997. }
  1998. if (isNaN(row.w3)) {
  1999. row.w3 = 0
  2000. row.r3 = 0
  2001. }
  2002. if (isNaN(row.w4)) {
  2003. row.w4 = 0
  2004. row.r4 = 0
  2005. }
  2006. if (row.w3 <= 0) {
  2007. row.w3 = 0
  2008. row.r3 = 0
  2009. }
  2010. if (row.w4 <= 0) {
  2011. row.w4 = 0
  2012. row.r4 = 0
  2013. }
  2014. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2015. }
  2016. // 3班锁定,2班4班未锁
  2017. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  2018. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2019. if (row.r2 == 0 && row.r4 == 0) {
  2020. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2021. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2022. row.w4 = row.w2
  2023. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2024. } else if (row.r2 == 0 && row.r4 !== 0) {
  2025. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2026. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2027. if (row.w1 == '') { row.w1 = 0 }
  2028. if (row.w2 == '') { row.w2 = 0 }
  2029. if (row.w3 == '') { row.w3 = 0 }
  2030. if (row.w4 == '') { row.w4 = 0 }
  2031. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2032. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2033. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2034. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2035. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2036. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2037. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2038. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2039. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2040. }
  2041. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2042. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2043. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2044. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2045. } else if (row.r2 !== 0 && row.r4 == 0) {
  2046. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2047. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2048. if (row.w1 == '') { row.w1 = 0 }
  2049. if (row.w2 == '') { row.w2 = 0 }
  2050. if (row.w3 == '') { row.w3 = 0 }
  2051. if (row.w4 == '') { row.w4 = 0 }
  2052. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2053. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2054. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2055. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2056. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2057. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2058. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2059. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2060. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2061. }
  2062. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2063. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2064. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2065. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2066. } else {
  2067. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2068. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2069. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2070. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2071. }
  2072. if (isNaN(row.w2)) {
  2073. row.w2 = 0
  2074. row.r2 = 0
  2075. }
  2076. if (isNaN(row.w4)) {
  2077. row.w4 = 0
  2078. row.r4 = 0
  2079. }
  2080. if (row.w2 <= 0) {
  2081. row.w2 = 0
  2082. row.r2 = 0
  2083. }
  2084. if (row.w4 <= 0) {
  2085. row.w4 = 0
  2086. row.r4 = 0
  2087. }
  2088. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2089. }
  2090. // 4班锁定,2班3班未锁
  2091. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  2092. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2093. if (row.r2 == 0 && row.r3 == 0) {
  2094. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  2095. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2096. row.w3 = row.w2
  2097. row.r3 = row.r2
  2098. } else if (row.r2 == 0 && row.r3 !== 0) {
  2099. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2100. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2101. if (row.w1 == '') { row.w1 = 0 }
  2102. if (row.w2 == '') { row.w2 = 0 }
  2103. if (row.w3 == '') { row.w3 = 0 }
  2104. if (row.w4 == '') { row.w4 = 0 }
  2105. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2106. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2107. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2108. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2109. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2110. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2111. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2112. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2113. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2114. }
  2115. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2116. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2117. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2118. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2119. } else if (row.r2 !== 0 && row.r3 == 0) {
  2120. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2121. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2122. if (row.w1 == '') { row.w1 = 0 }
  2123. if (row.w2 == '') { row.w2 = 0 }
  2124. if (row.w3 == '') { row.w3 = 0 }
  2125. if (row.w4 == '') { row.w4 = 0 }
  2126. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2127. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2128. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2129. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2130. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2131. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2132. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2133. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2134. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2135. }
  2136. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2137. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2138. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2139. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2140. } else {
  2141. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2142. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2143. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2144. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2145. }
  2146. if (row.w2 <= 0) {
  2147. row.w2 = 0
  2148. row.r2 = 0
  2149. }
  2150. if (row.w3 <= 0) {
  2151. row.w3 = 0
  2152. row.r3 = 0
  2153. }
  2154. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2155. }
  2156. // 2班3班4班未锁
  2157. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  2158. console.log('1231234')
  2159. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2160. if (parseFloat(row.r2) == 0 && parseFloat(row.r3) == 0 && parseFloat(row.r4) == 0) {
  2161. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) / 3, parseInt(Cookies.get('decimal')))
  2162. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2163. row.w3 = row.w2
  2164. row.w4 = row.w2
  2165. row.r3 = row.r2
  2166. row.r4 = row.r2
  2167. } else if (parseFloat(row.r2) == 0 && parseFloat(row.r3) == 0 && parseFloat(row.r4) !== 0) {
  2168. row.w3 = formatNum(((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4))) / 2, parseInt(Cookies.get('decimal')))
  2169. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2170. row.w2 = row.w3
  2171. row.r2 = row.r3
  2172. if (row.w1 == '') { row.w1 = 0 }
  2173. if (row.w2 == '') { row.w2 = 0 }
  2174. if (row.w3 == '') { row.w3 = 0 }
  2175. if (row.w4 == '') { row.w4 = 0 }
  2176. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2177. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2178. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2179. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2180. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2181. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2182. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2183. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  2184. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2185. }
  2186. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2187. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2188. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2189. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2190. } else if (parseFloat(row.r2) == 0 && parseFloat(row.r3) !== 0 && parseFloat(row.r4) == 0) {
  2191. row.w2 = formatNum(((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3))) / 2, parseInt(Cookies.get('decimal')))
  2192. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2193. row.w4 = row.w2
  2194. row.r4 = row.r2
  2195. if (row.w1 == '') { row.w1 = 0 }
  2196. if (row.w2 == '') { row.w2 = 0 }
  2197. if (row.w3 == '') { row.w3 = 0 }
  2198. if (row.w4 == '') { row.w4 = 0 }
  2199. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2200. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2201. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2202. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2203. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2204. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2205. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2206. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  2207. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2208. }
  2209. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2210. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2211. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2212. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2213. } else if (parseFloat(row.r2) !== 0 && parseFloat(row.r3) == 0 && parseFloat(row.r4) == 0) {
  2214. row.w3 = formatNum(((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2))) / 2, parseInt(Cookies.get('decimal')))
  2215. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2216. row.w4 = row.w3
  2217. row.r4 = row.r3
  2218. if (row.w1 == '') { row.w1 = 0 }
  2219. if (row.w2 == '') { row.w2 = 0 }
  2220. if (row.w3 == '') { row.w3 = 0 }
  2221. if (row.w4 == '') { row.w4 = 0 }
  2222. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2223. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2224. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2225. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2226. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2227. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2228. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2229. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2230. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2231. }
  2232. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2233. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2234. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2235. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2236. } else if (row.r2 == 0 && row.r3 !== 0 && row.r4 !== 0) {
  2237. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2238. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2239. if (row.w1 == '') { row.w1 = 0 }
  2240. if (row.w2 == '') { row.w2 = 0 }
  2241. if (row.w3 == '') { row.w3 = 0 }
  2242. if (row.w4 == '') { row.w4 = 0 }
  2243. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2244. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2245. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2246. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2247. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2248. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2249. console.log(row.dailyWeight)
  2250. console.log(this.focusWRow.dailyWeight)
  2251. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2252. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  2253. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2254. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  2255. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2256. }
  2257. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2258. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2259. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2260. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2261. } else if (row.r2 !== 0 && row.r3 == 0 && row.r4 !== 0) {
  2262. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2263. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2264. if (row.w1 == '') { row.w1 = 0 }
  2265. if (row.w2 == '') { row.w2 = 0 }
  2266. if (row.w3 == '') { row.w3 = 0 }
  2267. if (row.w4 == '') { row.w4 = 0 }
  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. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2273. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2274. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2275. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2276. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2277. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  2278. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2279. }
  2280. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2281. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2282. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2283. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2284. } else if (row.r2 !== 0 && row.r3 !== 0 && row.r4 == 0) {
  2285. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2286. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2287. if (row.w1 == '') { row.w1 = 0 }
  2288. if (row.w2 == '') { row.w2 = 0 }
  2289. if (row.w3 == '') { row.w3 = 0 }
  2290. if (row.w4 == '') { row.w4 = 0 }
  2291. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2292. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2293. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2294. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2295. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2296. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2297. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2298. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2299. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2300. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  2301. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2302. }
  2303. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2304. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2305. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2306. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2307. } else {
  2308. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2309. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2310. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  2311. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2312. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  2313. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2314. }
  2315. if (isNaN(row.w2)) {
  2316. row.w2 = 0
  2317. row.r2 = 0
  2318. }
  2319. if (isNaN(row.w3)) {
  2320. row.w3 = 0
  2321. row.r3 = 0
  2322. }
  2323. if (isNaN(row.w4)) {
  2324. row.w4 = 0
  2325. row.r4 = 0
  2326. }
  2327. if (row.w2 <= 0) {
  2328. row.w2 = 0
  2329. row.r2 = 0
  2330. }
  2331. if (row.w3 <= 0) {
  2332. row.w3 = 0
  2333. row.r3 = 0
  2334. }
  2335. if (row.w4 <= 0) {
  2336. row.w4 = 0
  2337. row.r4 = 0
  2338. }
  2339. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2340. }
  2341. } else if (this.table.RWLength == 3) {
  2342. // 三班
  2343. // 2班/3班锁定
  2344. if (row.isTwoWeight == true && row.isThreeWeight == true) {
  2345. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2346. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2347. }
  2348. // 2班不锁3班锁
  2349. if (row.isTwoWeight == false && row.isThreeWeight == true) {
  2350. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2351. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2352. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2353. if (row.w2 <= 0) {
  2354. row.w2 = 0
  2355. row.r2 = 0
  2356. }
  2357. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2358. }
  2359. // 3班不锁2班锁
  2360. if (row.isTwoWeight == true && row.isThreeWeight == false) {
  2361. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2362. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2), parseInt(Cookies.get('decimal')))
  2363. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2364. if (row.w3 <= 0) {
  2365. row.w3 = 0
  2366. row.r3 = 0
  2367. }
  2368. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2369. }
  2370. // 2班3班都不锁
  2371. if (row.isTwoWeight == false && row.isThreeWeight == false) {
  2372. console.log(row.w1, 'w1----------')
  2373. console.log(row.feedweight, 'feedweight----------')
  2374. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2375. if (row.r2 == 0 && row.r3 == 0) {
  2376. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  2377. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2378. row.w3 = row.w2
  2379. row.r3 = row.r2
  2380. } else if (row.r2 == 0 && row.r3 !== 0) {
  2381. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2382. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2383. if (row.w1 == '') { row.w1 = 0 }
  2384. if (row.w2 == '') { row.w2 = 0 }
  2385. if (row.w3 == '') { row.w3 = 0 }
  2386. if (row.w4 == '') { row.w4 = 0 }
  2387. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2388. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2389. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2390. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2391. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2392. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2393. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2394. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  2395. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2396. }
  2397. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2398. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2399. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2400. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2401. } else if (row.r2 !== 0 && row.r3 == 0) {
  2402. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2403. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  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, parseInt(Cookies.get('decimal')))
  2414. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  2415. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  2416. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  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 {
  2423. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  2424. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2425. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  2426. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2427. console.log('我改了1')
  2428. }
  2429. if (isNaN(row.w2)) {
  2430. row.w2 = 0
  2431. row.r2 = 0
  2432. }
  2433. if (isNaN(row.w3)) {
  2434. row.w3 = 0
  2435. row.r3 = 0
  2436. }
  2437. if (row.w3 <= 0) {
  2438. row.w3 = 0
  2439. row.r3 = 0
  2440. }
  2441. if (row.w2 <= 0) {
  2442. row.w2 = 0
  2443. row.r2 = 0
  2444. }
  2445. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2446. }
  2447. } else if (this.table.RWLength == 2) {
  2448. // 两班isOneWeight,isTwoWeight
  2449. if (row.w1 == '') { row.w1 = 0 }
  2450. if (row.w2 == '') { row.w2 = 0 }
  2451. if (row.r1 == '') { row.r1 = 0 }
  2452. if (row.r2 == '') { row.r2 = 0 }
  2453. if (row.isTwoWeight == false) {
  2454. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2455. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1), parseInt(Cookies.get('decimal')))
  2456. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2457. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2458. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  2459. } else {
  2460. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2461. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  2462. }
  2463. } else {
  2464. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2465. this.$set(row, 'sumr', formatNum(parseFloat(row.r1), parseInt(Cookies.get('decimal'))))
  2466. }
  2467. if (row.w1 == '') { row.w1 = 0 }
  2468. if (row.w2 == '') { row.w2 = 0 }
  2469. if (row.w3 == '') { row.w3 = 0 }
  2470. if (row.w4 == '') { row.w4 = 0 }
  2471. if (isNaN(row.r1)) { row.r1 = 0 }
  2472. if (isNaN(row.r2)) { row.r2 = 0 }
  2473. if (isNaN(row.r3)) { row.r3 = 0 }
  2474. if (isNaN(row.r4)) { row.r4 = 0 }
  2475. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2476. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2477. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2478. },
  2479. blurW2(row) {
  2480. // 2班重量
  2481. if (row.w1 == '') {
  2482. row.w1 = 0
  2483. }
  2484. if (row.w2 == '') {
  2485. row.w2 = 0
  2486. }
  2487. if (row.w3 == '') {
  2488. row.w3 = 0
  2489. }
  2490. if (row.w4 == '') {
  2491. row.w4 = 0
  2492. }
  2493. if (row.r1 == '') {
  2494. row.r1 = 0
  2495. }
  2496. if (row.r2 == '') {
  2497. row.r2 = 0
  2498. }
  2499. if (row.r3 == '') {
  2500. row.r3 = 0
  2501. }
  2502. if (row.r4 == '') {
  2503. row.r4 = 0
  2504. }
  2505. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2506. console.log(row, '=======投喂量feedweight')
  2507. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2508. if (this.table.RWLength == 4) {
  2509. // 四班
  2510. // 1班3班4班都锁定
  2511. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  2512. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2513. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2514. }
  2515. // 1班3班锁定4班未锁定
  2516. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  2517. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2518. row.w4 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2519. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2520. if (row.w4 <= 0) {
  2521. row.w4 = 0
  2522. row.r4 = 0
  2523. }
  2524. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2525. }
  2526. // 1班4班锁定3班未锁定
  2527. if (row.isOneWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  2528. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2529. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2530. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2531. if (row.w3 <= 0) {
  2532. row.w3 = 0
  2533. row.r3 = 0
  2534. }
  2535. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2536. }
  2537. // 3班4班锁定1班未锁定
  2538. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  2539. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2540. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2541. row.r1 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2542. if (row.w1 <= 0) {
  2543. row.w1 = 0
  2544. row.r1 = 0
  2545. }
  2546. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2547. }
  2548. // 1班锁定,3班4班未锁
  2549. if (row.isOneWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  2550. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2551. if (row.r3 == 0 && row.r4 == 0) {
  2552. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2553. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2554. row.w4 = row.w3
  2555. row.r4 = row.r3
  2556. } else if (row.r3 == 0 && row.r4 !== 0) {
  2557. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2558. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2559. if (row.w1 == '') { row.w1 = 0 }
  2560. if (row.w2 == '') { row.w2 = 0 }
  2561. if (row.w3 == '') { row.w3 = 0 }
  2562. if (row.w4 == '') { row.w4 = 0 }
  2563. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2564. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2565. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2566. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2567. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2568. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2569. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2570. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2571. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2572. }
  2573. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2574. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2575. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2576. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2577. } else if (row.r3 !== 0 && row.r4 == 0) {
  2578. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2579. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2580. if (row.w1 == '') { row.w1 = 0 }
  2581. if (row.w2 == '') { row.w2 = 0 }
  2582. if (row.w3 == '') { row.w3 = 0 }
  2583. if (row.w4 == '') { row.w4 = 0 }
  2584. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2585. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2586. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2587. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2588. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2589. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2590. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2591. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2592. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2593. }
  2594. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2595. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2596. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2597. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2598. } else {
  2599. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2600. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2601. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2602. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2603. }
  2604. if (isNaN(row.w3)) {
  2605. row.w3 = 0
  2606. row.r3 = 0
  2607. }
  2608. if (isNaN(row.w4)) {
  2609. row.w4 = 0
  2610. row.r4 = 0
  2611. }
  2612. if (row.w3 <= 0) {
  2613. row.w3 = 0
  2614. row.r3 = 0
  2615. }
  2616. if (row.w4 <= 0) {
  2617. row.w4 = 0
  2618. row.r4 = 0
  2619. }
  2620. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2621. }
  2622. // 3班锁定,1班4班未锁
  2623. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  2624. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2625. if (row.r1 == 0 && row.r4 == 0) {
  2626. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2627. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2628. row.w4 = row.w1
  2629. row.r4 = row.r1
  2630. } else if (row.r1 == 0 && row.r4 !== 0) {
  2631. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2632. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2633. if (row.w1 == '') { row.w1 = 0 }
  2634. if (row.w2 == '') { row.w2 = 0 }
  2635. if (row.w3 == '') { row.w3 = 0 }
  2636. if (row.w4 == '') { row.w4 = 0 }
  2637. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2638. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2639. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2640. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2641. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2642. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2643. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2644. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2645. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2646. }
  2647. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2648. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2649. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2650. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2651. } else if (row.r1 !== 0 && row.r4 == 0) {
  2652. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2653. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2654. if (row.w1 == '') { row.w1 = 0 }
  2655. if (row.w2 == '') { row.w2 = 0 }
  2656. if (row.w3 == '') { row.w3 = 0 }
  2657. if (row.w4 == '') { row.w4 = 0 }
  2658. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2659. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2660. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2661. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2662. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2663. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2664. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2665. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2666. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2667. }
  2668. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2669. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2670. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2671. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2672. } else {
  2673. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2674. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2675. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2676. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2677. }
  2678. if (isNaN(row.w1)) {
  2679. row.w1 = 0
  2680. row.r1 = 0
  2681. }
  2682. if (isNaN(row.w4)) {
  2683. row.w4 = 0
  2684. row.r4 = 0
  2685. }
  2686. if (row.w1 <= 0) {
  2687. row.w1 = 0
  2688. row.r1 = 0
  2689. }
  2690. if (row.w4 <= 0) {
  2691. row.w4 = 0
  2692. row.r4 = 0
  2693. }
  2694. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2695. }
  2696. // 4班锁定,1班3班未锁
  2697. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  2698. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2699. if (row.r1 == 0 && row.r3 == 0) {
  2700. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2701. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2702. row.w3 = row.w1
  2703. row.r3 = row.r1
  2704. } else if (row.r1 == 0 && row.r3 !== 0) {
  2705. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2706. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2707. if (row.w1 == '') { row.w1 = 0 }
  2708. if (row.w2 == '') { row.w2 = 0 }
  2709. if (row.w3 == '') { row.w3 = 0 }
  2710. if (row.w4 == '') { row.w4 = 0 }
  2711. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2712. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2713. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2714. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2715. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2716. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2717. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2718. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow2.r1)), parseInt(Cookies.get('decimal')))
  2719. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2720. }
  2721. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2722. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2723. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2724. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2725. } else if (row.r1 !== 0 && row.r3 == 0) {
  2726. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2727. row.r3 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2728. if (row.w1 == '') { row.w1 = 0 }
  2729. if (row.w2 == '') { row.w2 = 0 }
  2730. if (row.w3 == '') { row.w3 = 0 }
  2731. if (row.w4 == '') { row.w4 = 0 }
  2732. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2733. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2734. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2735. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2736. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2737. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2738. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2739. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2740. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2741. }
  2742. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2743. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2744. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2745. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2746. } else {
  2747. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2748. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2749. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow2.r1)), parseInt(Cookies.get('decimal')))
  2750. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2751. }
  2752. if (isNaN(row.w1)) {
  2753. row.w1 = 0
  2754. row.r1 = 0
  2755. }
  2756. if (isNaN(row.w3)) {
  2757. row.w3 = 0
  2758. row.r3 = 0
  2759. }
  2760. if (row.w1 <= 0) {
  2761. row.w1 = 0
  2762. row.r1 = 0
  2763. }
  2764. if (row.w3 <= 0) {
  2765. row.w3 = 0
  2766. row.r3 = 0
  2767. }
  2768. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2769. }
  2770. // 1班3班4班未锁
  2771. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  2772. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2773. if (row.r1 == 0 && row.r3 == 0 && row.r4 == 0) {
  2774. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) / 3, parseInt(Cookies.get('decimal')))
  2775. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2776. row.w3 = row.w1
  2777. row.r3 = row.r1
  2778. row.w4 = row.w1
  2779. row.r4 = row.r1
  2780. } else if (row.r1 == 0 && row.r3 == 0 && row.r4 !== 0) {
  2781. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  2782. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2783. row.w3 = row.w1
  2784. row.r3 = row.r1
  2785. if (row.w1 == '') { row.w1 = 0 }
  2786. if (row.w2 == '') { row.w2 = 0 }
  2787. if (row.w3 == '') { row.w3 = 0 }
  2788. if (row.w4 == '') { row.w4 = 0 }
  2789. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2790. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2791. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2792. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2793. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2794. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2795. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2796. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2797. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2798. }
  2799. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2800. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2801. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2802. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2803. } else if (row.r1 == 0 && row.r3 !== 0 && row.r4 == 0) {
  2804. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2805. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2806. row.w4 = row.w1
  2807. row.r4 = row.r1
  2808. if (row.w1 == '') { row.w1 = 0 }
  2809. if (row.w2 == '') { row.w2 = 0 }
  2810. if (row.w3 == '') { row.w3 = 0 }
  2811. if (row.w4 == '') { row.w4 = 0 }
  2812. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2813. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2814. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2815. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2816. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2817. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2818. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2819. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2820. row.r3 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2821. }
  2822. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2823. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2824. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2825. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2826. } else if (row.r1 !== 0 && row.r3 == 0 && row.r4 == 0) {
  2827. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  2828. row.r3 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2829. row.w4 = row.w3
  2830. row.r4 = row.r3
  2831. if (row.w1 == '') { row.w1 = 0 }
  2832. if (row.w2 == '') { row.w2 = 0 }
  2833. if (row.w3 == '') { row.w3 = 0 }
  2834. if (row.w4 == '') { row.w4 = 0 }
  2835. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2836. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2837. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2838. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2839. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2840. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2841. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2842. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2843. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2844. }
  2845. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2846. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2847. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2848. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2849. } else if ((row.r1 !== 0 && row.r3 !== 0 && row.r4 == 0)) {
  2850. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2851. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2852. if (row.w1 == '') { row.w1 = 0 }
  2853. if (row.w2 == '') { row.w2 = 0 }
  2854. if (row.w3 == '') { row.w3 = 0 }
  2855. if (row.w4 == '') { row.w4 = 0 }
  2856. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2857. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2858. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2859. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2860. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2861. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2862. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2863. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2864. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2865. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2866. row.r3 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2867. }
  2868. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2869. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2870. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2871. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2872. } else if ((row.r1 !== 0 && row.r3 == 0 && row.r4 !== 0)) {
  2873. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2874. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2875. if (row.w1 == '') { row.w1 = 0 }
  2876. if (row.w2 == '') { row.w2 = 0 }
  2877. if (row.w3 == '') { row.w3 = 0 }
  2878. if (row.w4 == '') { row.w4 = 0 }
  2879. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2880. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2881. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2882. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2883. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2884. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2885. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2886. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2887. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2888. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2889. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2890. }
  2891. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2892. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2893. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2894. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2895. } else if ((row.r1 == 0 && row.r3 !== 0 && row.r4 !== 0)) {
  2896. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2897. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2898. if (row.w1 == '') { row.w1 = 0 }
  2899. if (row.w2 == '') { row.w2 = 0 }
  2900. if (row.w3 == '') { row.w3 = 0 }
  2901. if (row.w4 == '') { row.w4 = 0 }
  2902. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2903. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2904. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2905. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2906. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2907. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2908. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2909. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2910. row.r3 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2911. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2912. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2913. }
  2914. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2915. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2916. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2917. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2918. } else {
  2919. console.log('wolaile')
  2920. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2921. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2922. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2923. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2924. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2925. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2926. }
  2927. if (isNaN(row.w1)) {
  2928. row.w1 = 0
  2929. row.r1 = 0
  2930. }
  2931. if (isNaN(row.w3)) {
  2932. row.w3 = 0
  2933. row.r3 = 0
  2934. }
  2935. if (isNaN(row.w4)) {
  2936. row.w4 = 0
  2937. row.r4 = 0
  2938. }
  2939. if (row.w1 <= 0) {
  2940. row.w1 = 0
  2941. row.r1 = 0
  2942. }
  2943. if (row.w3 <= 0) {
  2944. row.w3 = 0
  2945. row.r3 = 0
  2946. }
  2947. if (row.w4 <= 0) {
  2948. row.w4 = 0
  2949. row.r4 = 0
  2950. }
  2951. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2952. }
  2953. } else if (this.table.RWLength == 3) {
  2954. // 三班
  2955. // 1班/3班锁定
  2956. if (row.isOneWeight == true && row.isThreeWeight == true) {
  2957. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2958. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2959. }
  2960. // 1班不锁3班锁
  2961. if (row.isOneWeight == false && row.isThreeWeight == true) {
  2962. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2963. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2964. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2965. if (row.w1 <= 0) {
  2966. row.w1 = 0
  2967. row.r1 = 0
  2968. }
  2969. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2970. }
  2971. // 3班不锁1班锁
  2972. if (row.isOneWeight == true && row.isThreeWeight == false) {
  2973. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2974. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2), parseInt(Cookies.get('decimal')))
  2975. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2976. if (row.w3 <= 0) {
  2977. row.w3 = 0
  2978. row.r3 = 0
  2979. }
  2980. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2981. }
  2982. // 1班3班都不锁
  2983. if (row.isOneWeight == false && row.isThreeWeight == false) {
  2984. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2985. if (row.r1 == 0 && row.r3 == 0) {
  2986. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2987. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2988. row.w3 = row.w1
  2989. row.r3 = row.r1
  2990. } else if (row.r1 == 0 && row.r3 !== 0) {
  2991. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2992. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2993. if (row.w1 == '') { row.w1 = 0 }
  2994. if (row.w2 == '') { row.w2 = 0 }
  2995. if (row.w3 == '') { row.w3 = 0 }
  2996. if (row.w4 == '') { row.w4 = 0 }
  2997. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2998. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2999. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3000. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3001. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3002. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3003. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  3004. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3005. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3006. }
  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. } else if (row.r1 !== 0 && row.r3 == 0) {
  3012. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  3013. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3014. if (row.w1 == '') { row.w1 = 0 }
  3015. if (row.w2 == '') { row.w2 = 0 }
  3016. if (row.w3 == '') { row.w3 = 0 }
  3017. if (row.w4 == '') { row.w4 = 0 }
  3018. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3019. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3020. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3021. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3022. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3023. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3024. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  3025. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3026. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3027. }
  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. } else {
  3033. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3034. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3035. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3036. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3037. }
  3038. if (isNaN(row.w1)) {
  3039. row.w1 = 0
  3040. row.r1 = 0
  3041. }
  3042. if (isNaN(row.w3)) {
  3043. row.w3 = 0
  3044. row.r3 = 0
  3045. }
  3046. if (row.w3 <= 0) {
  3047. row.w3 = 0
  3048. row.r3 = 0
  3049. }
  3050. if (row.w1 <= 0) {
  3051. row.w1 = 0
  3052. row.r1 = 0
  3053. }
  3054. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  3055. }
  3056. } else if (this.table.RWLength == 2) {
  3057. if (row.isOneWeight == false) {
  3058. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3059. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2), parseInt(Cookies.get('decimal')))
  3060. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3061. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3062. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  3063. } else {
  3064. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3065. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  3066. }
  3067. }
  3068. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3069. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3070. if (row.w1 == '') { row.w1 = 0 }
  3071. if (row.w2 == '') { row.w2 = 0 }
  3072. if (row.w3 == '') { row.w3 = 0 }
  3073. if (row.w4 == '') { row.w4 = 0 }
  3074. if (isNaN(row.r1)) { row.r1 = 0 }
  3075. if (isNaN(row.r2)) { row.r2 = 0 }
  3076. if (isNaN(row.r3)) { row.r3 = 0 }
  3077. if (isNaN(row.r4)) { row.r4 = 0 }
  3078. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3079. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3080. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3081. },
  3082. blurW3(row) {
  3083. // 3班重量
  3084. if (row.w1 == '') {
  3085. row.w1 = 0
  3086. }
  3087. if (row.w2 == '') {
  3088. row.w2 = 0
  3089. }
  3090. if (row.w3 == '') {
  3091. row.w3 = 0
  3092. }
  3093. if (row.w4 == '') {
  3094. row.w4 = 0
  3095. }
  3096. if (row.r1 == '') {
  3097. row.r1 = 0
  3098. }
  3099. if (row.r2 == '') {
  3100. row.r2 = 0
  3101. }
  3102. if (row.r3 == '') {
  3103. row.r3 = 0
  3104. }
  3105. if (row.r4 == '') {
  3106. row.r4 = 0
  3107. }
  3108. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  3109. console.log(row, '=======投喂量feedweight')
  3110. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  3111. if (this.table.RWLength == 4) {
  3112. // 四班
  3113. // 1班2班4班都锁定
  3114. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == true) {
  3115. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3116. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3117. }
  3118. // 1班2班锁定4班未锁定
  3119. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == false) {
  3120. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3121. row.w4 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  3122. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3123. if (row.w4 <= 0) {
  3124. row.w4 = 0
  3125. row.r4 = 0
  3126. }
  3127. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3128. }
  3129. // 2班4班锁定1班未锁定
  3130. if (row.isOneWeight == false && row.isTwoWeight == true && row.isFourWeight == true) {
  3131. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3132. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  3133. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3134. if (row.w1 <= 0) {
  3135. row.w1 = 0
  3136. row.r1 = 0
  3137. }
  3138. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3139. }
  3140. // 1班4班锁定2班未锁定
  3141. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == true) {
  3142. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3143. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  3144. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3145. if (row.w2 <= 0) {
  3146. row.w2 = 0
  3147. row.r2 = 0
  3148. }
  3149. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3150. }
  3151. // 2班锁定,1班4班未锁
  3152. if (row.isTwoWeight == true && row.isOneWeight == false && row.isFourWeight == false) {
  3153. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3154. if (row.r1 == 0 && row.r4 == 0) {
  3155. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  3156. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3157. row.w4 = row.w1
  3158. row.r4 = row.r1
  3159. } else if (row.r1 == 0 && row.r4 !== 0) {
  3160. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  3161. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3162. if (row.w1 == '') { row.w1 = 0 }
  3163. if (row.w2 == '') { row.w2 = 0 }
  3164. if (row.w3 == '') { row.w3 = 0 }
  3165. if (row.w4 == '') { row.w4 = 0 }
  3166. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3167. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3168. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3169. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3170. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3171. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3172. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3173. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3174. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3175. }
  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. } else if (row.r1 !== 0 && row.r4 == 0) {
  3181. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  3182. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3183. if (row.w1 == '') { row.w1 = 0 }
  3184. if (row.w2 == '') { row.w2 = 0 }
  3185. if (row.w3 == '') { row.w3 = 0 }
  3186. if (row.w4 == '') { row.w4 = 0 }
  3187. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3188. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3189. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3190. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3191. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3192. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3193. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3194. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3195. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3196. }
  3197. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3198. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3199. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3200. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3201. } else {
  3202. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3203. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3204. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3205. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3206. }
  3207. if (isNaN(row.w1)) {
  3208. row.w1 = 0
  3209. row.r1 = 0
  3210. }
  3211. if (isNaN(row.w4)) {
  3212. row.w4 = 0
  3213. row.r4 = 0
  3214. }
  3215. if (row.w1 <= 0) {
  3216. row.w1 = 0
  3217. row.r1 = 0
  3218. }
  3219. if (row.w4 <= 0) {
  3220. row.w4 = 0
  3221. row.r4 = 0
  3222. }
  3223. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3224. }
  3225. // 1班锁定,2班4班未锁
  3226. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == false) {
  3227. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3228. if (row.r2 == 0 && row.r4 == 0) {
  3229. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  3230. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3231. row.w4 = row.w2
  3232. row.r4 = row.r2
  3233. } else if (row.r2 == 0 && row.r4 !== 0) {
  3234. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  3235. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3236. if (row.w1 == '') { row.w1 = 0 }
  3237. if (row.w2 == '') { row.w2 = 0 }
  3238. if (row.w3 == '') { row.w3 = 0 }
  3239. if (row.w4 == '') { row.w4 = 0 }
  3240. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3241. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3242. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3243. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3244. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3245. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3246. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3247. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3248. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3249. }
  3250. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3251. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3252. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3253. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3254. } else if (row.r2 !== 0 && row.r4 == 0) {
  3255. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3256. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3257. if (row.w1 == '') { row.w1 = 0 }
  3258. if (row.w2 == '') { row.w2 = 0 }
  3259. if (row.w3 == '') { row.w3 = 0 }
  3260. if (row.w4 == '') { row.w4 = 0 }
  3261. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3262. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3263. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3264. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3265. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3266. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3267. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3268. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3269. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3270. }
  3271. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3272. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3273. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3274. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3275. } else {
  3276. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3277. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3278. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3279. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3280. }
  3281. if (isNaN(row.w2)) {
  3282. row.w2 = 0
  3283. row.r2 = 0
  3284. }
  3285. if (isNaN(row.w4)) {
  3286. row.w4 = 0
  3287. row.r4 = 0
  3288. }
  3289. if (row.w2 <= 0) {
  3290. row.w2 = 0
  3291. row.r2 = 0
  3292. }
  3293. if (row.w4 <= 0) {
  3294. row.w4 = 0
  3295. row.r4 = 0
  3296. }
  3297. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3298. }
  3299. // 4班锁定,2班1班未锁
  3300. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == true) {
  3301. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3302. if (row.r1 == 0 && row.r2 == 0) {
  3303. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  3304. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3305. row.w2 = row.w1
  3306. row.r2 = row.r1
  3307. } else if (row.r1 == 0 && row.r2 !== 0) {
  3308. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3309. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3310. if (row.w1 == '') { row.w1 = 0 }
  3311. if (row.w2 == '') { row.w2 = 0 }
  3312. if (row.w3 == '') { row.w3 = 0 }
  3313. if (row.w4 == '') { row.w4 = 0 }
  3314. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3315. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3316. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3317. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3318. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3319. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3320. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3321. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  3322. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3323. }
  3324. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3325. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3326. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3327. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3328. } else if (row.r1 !== 0 && row.r2 == 0) {
  3329. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  3330. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3331. if (row.w1 == '') { row.w1 = 0 }
  3332. if (row.w2 == '') { row.w2 = 0 }
  3333. if (row.w3 == '') { row.w3 = 0 }
  3334. if (row.w4 == '') { row.w4 = 0 }
  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. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3340. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3341. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3342. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  3343. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3344. }
  3345. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3346. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3347. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3348. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3349. } else {
  3350. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  3351. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3352. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  3353. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3354. }
  3355. if (isNaN(row.w1)) {
  3356. row.w1 = 0
  3357. row.r1 = 0
  3358. }
  3359. if (isNaN(row.w2)) {
  3360. row.w2 = 0
  3361. row.r2 = 0
  3362. }
  3363. if (row.w2 <= 0) {
  3364. row.w2 = 0
  3365. row.r2 = 0
  3366. }
  3367. if (row.w1 <= 0) {
  3368. row.w1 = 0
  3369. row.r1 = 0
  3370. }
  3371. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3372. }
  3373. // 2班1班4班未锁
  3374. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == false) {
  3375. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3376. if (row.r1 == 0 && row.r2 == 0 && row.r4 == 0) {
  3377. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) / 3, parseInt(Cookies.get('decimal')))
  3378. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3379. row.w2 = row.w1
  3380. row.r2 = row.r1
  3381. row.w4 = row.w1
  3382. row.r4 = row.r1
  3383. } else if (row.r1 == 0 && row.r2 == 0 && row.r4 !== 0) {
  3384. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  3385. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3386. row.w2 = row.w1
  3387. row.r2 = row.r1
  3388. if (row.w1 == '') { row.w1 = 0 }
  3389. if (row.w2 == '') { row.w2 = 0 }
  3390. if (row.w3 == '') { row.w3 = 0 }
  3391. if (row.w4 == '') { row.w4 = 0 }
  3392. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3393. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3394. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3395. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3396. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3397. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3398. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3399. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  3400. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3401. }
  3402. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3403. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3404. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3405. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3406. } else if (row.r1 == 0 && row.r2 !== 0 && row.r4 == 0) {
  3407. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  3408. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3409. row.w4 = row.w1
  3410. row.r4 = row.r1
  3411. if (row.w1 == '') { row.w1 = 0 }
  3412. if (row.w2 == '') { row.w2 = 0 }
  3413. if (row.w3 == '') { row.w3 = 0 }
  3414. if (row.w4 == '') { row.w4 = 0 }
  3415. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3416. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3417. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3418. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3419. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3420. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3421. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3422. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  3423. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3424. }
  3425. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3426. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3427. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3428. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3429. } else if (row.r1 !== 0 && row.r2 == 0 && row.r4 == 0) {
  3430. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  3431. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3432. row.w4 = row.w1
  3433. row.r4 = row.r1
  3434. if (row.w1 == '') { row.w1 = 0 }
  3435. if (row.w2 == '') { row.w2 = 0 }
  3436. if (row.w3 == '') { row.w3 = 0 }
  3437. if (row.w4 == '') { row.w4 = 0 }
  3438. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3439. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3440. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3441. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3442. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3443. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3444. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3445. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3446. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3447. }
  3448. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3449. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3450. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3451. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3452. } else if (row.r1 !== 0 && row.r2 !== 0 && row.r4 == 0) {
  3453. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3454. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3455. if (row.w1 == '') { row.w1 = 0 }
  3456. if (row.w2 == '') { row.w2 = 0 }
  3457. if (row.w3 == '') { row.w3 = 0 }
  3458. if (row.w4 == '') { row.w4 = 0 }
  3459. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3460. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3461. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3462. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3463. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3464. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3465. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3466. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3467. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3468. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  3469. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3470. }
  3471. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3472. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3473. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3474. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3475. } else if (row.r1 !== 0 && row.r2 == 0 && row.r4 !== 0) {
  3476. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  3477. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3478. if (row.w1 == '') { row.w1 = 0 }
  3479. if (row.w2 == '') { row.w2 = 0 }
  3480. if (row.w3 == '') { row.w3 = 0 }
  3481. if (row.w4 == '') { row.w4 = 0 }
  3482. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3483. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3484. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3485. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3486. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3487. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3488. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3489. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3490. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3491. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  3492. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3493. }
  3494. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3495. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3496. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3497. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3498. } else if (row.r1 == 0 && row.r2 !== 0 && row.r4 !== 0) {
  3499. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  3500. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3501. if (row.w1 == '') { row.w1 = 0 }
  3502. if (row.w2 == '') { row.w2 = 0 }
  3503. if (row.w3 == '') { row.w3 = 0 }
  3504. if (row.w4 == '') { row.w4 = 0 }
  3505. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3506. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3507. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3508. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3509. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3510. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3511. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3512. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  3513. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3514. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  3515. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3516. }
  3517. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3518. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3519. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3520. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3521. } else {
  3522. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  3523. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3524. row.w2 = formatNum((parseFloat(row.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  3525. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3526. row.w4 = formatNum((parseFloat(row.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  3527. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3528. }
  3529. if (isNaN(row.w1)) {
  3530. row.w1 = 0
  3531. row.r1 = 0
  3532. }
  3533. if (isNaN(row.w2)) {
  3534. row.w2 = 0
  3535. row.r2 = 0
  3536. }
  3537. if (isNaN(row.w4)) {
  3538. row.w4 = 0
  3539. row.r4 = 0
  3540. }
  3541. if (row.w1 <= 0) {
  3542. row.w1 = 0
  3543. row.r1 = 0
  3544. }
  3545. if (row.w2 <= 0) {
  3546. row.w2 = 0
  3547. row.r2 = 0
  3548. }
  3549. if (row.w4 <= 0) {
  3550. row.w4 = 0
  3551. row.r4 = 0
  3552. }
  3553. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3554. }
  3555. } else if (this.table.RWLength == 3) {
  3556. // 三班
  3557. // 1班/2班锁定
  3558. if (row.isOneWeight == true && row.isTwoWeight == true) {
  3559. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3560. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  3561. }
  3562. // 1班不锁2班锁
  3563. if (row.isOneWeight == false && row.isTwoWeight == true) {
  3564. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3565. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  3566. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3567. if (row.w1 <= 0) {
  3568. row.w1 = 0
  3569. row.r1 = 0
  3570. }
  3571. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  3572. }
  3573. // 3班不锁2班锁
  3574. // 2班不锁1班锁
  3575. if (row.isOneWeight == true && row.isTwoWeight == false) {
  3576. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3577. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  3578. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3579. if (row.w2 <= 0) {
  3580. row.w2 = 0
  3581. row.r2 = 0
  3582. }
  3583. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  3584. }
  3585. // 2班3班都不锁
  3586. // 1班2班都不锁
  3587. if (row.isOneWeight == false && row.isTwoWeight == false) {
  3588. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3589. if (row.r1 == 0 && row.r2 == 0) {
  3590. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  3591. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3592. row.w2 = row.w1
  3593. row.r2 = row.r1
  3594. } else if (row.r1 == 0 && row.r2 !== 0) {
  3595. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3596. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3597. if (row.w1 == '') { row.w1 = 0 }
  3598. if (row.w2 == '') { row.w2 = 0 }
  3599. if (row.w3 == '') { row.w3 = 0 }
  3600. if (row.w4 == '') { row.w4 = 0 }
  3601. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3602. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3603. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3604. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3605. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3606. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3607. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3608. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  3609. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3610. }
  3611. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3612. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3613. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3614. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3615. } else if (row.r1 !== 0 && row.r2 == 0) {
  3616. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  3617. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3618. if (row.w1 == '') { row.w1 = 0 }
  3619. if (row.w2 == '') { row.w2 = 0 }
  3620. if (row.w3 == '') { row.w3 = 0 }
  3621. if (row.w4 == '') { row.w4 = 0 }
  3622. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3623. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3624. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3625. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3626. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3627. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3628. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  3629. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  3630. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3631. }
  3632. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3633. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3634. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3635. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3636. } else {
  3637. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  3638. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3639. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  3640. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3641. }
  3642. if (isNaN(row.w1)) {
  3643. row.w1 = 0
  3644. row.r1 = 0
  3645. }
  3646. if (isNaN(row.w2)) {
  3647. row.w2 = 0
  3648. row.r2 = 0
  3649. }
  3650. if (row.w1 <= 0) {
  3651. row.w1 = 0
  3652. row.r1 = 0
  3653. }
  3654. if (row.w2 <= 0) {
  3655. row.w2 = 0
  3656. row.r2 = 0
  3657. }
  3658. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  3659. }
  3660. }
  3661. if (row.w1 == '') { row.w1 = 0 }
  3662. if (row.w2 == '') { row.w2 = 0 }
  3663. if (row.w3 == '') { row.w3 = 0 }
  3664. if (row.w4 == '') { row.w4 = 0 }
  3665. if (isNaN(row.r1)) { row.r1 = 0 }
  3666. if (isNaN(row.r2)) { row.r2 = 0 }
  3667. if (isNaN(row.r3)) { row.r3 = 0 }
  3668. if (isNaN(row.r4)) { row.r4 = 0 }
  3669. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3670. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3671. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3672. },
  3673. blurW4(row) {
  3674. if (row.w1 == '') {
  3675. row.w1 = 0
  3676. }
  3677. if (row.w2 == '') {
  3678. row.w2 = 0
  3679. }
  3680. if (row.w3 == '') {
  3681. row.w3 = 0
  3682. }
  3683. if (row.w4 == '') {
  3684. row.w4 = 0
  3685. }
  3686. if (row.r1 == '') {
  3687. row.r1 = 0
  3688. }
  3689. if (row.r2 == '') {
  3690. row.r2 = 0
  3691. }
  3692. if (row.r3 == '') {
  3693. row.r3 = 0
  3694. }
  3695. if (row.r4 == '') {
  3696. row.r4 = 0
  3697. }
  3698. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  3699. console.log(row, '=======投喂量feedweight')
  3700. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  3701. if (this.table.RWLength == 4) {
  3702. // 四班
  3703. // 1班2班3班都锁定
  3704. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == true) {
  3705. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3706. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3707. }
  3708. // 2班3班锁定1班未锁定
  3709. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == true) {
  3710. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3711. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  3712. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3713. if (row.w1 <= 0) {
  3714. row.w1 = 0
  3715. row.r1 = 0
  3716. }
  3717. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3718. }
  3719. // 2班1班锁定3班未锁定
  3720. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == false) {
  3721. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3722. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  3723. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3724. if (row.w3 <= 0) {
  3725. row.w3 = 0
  3726. row.r3 = 0
  3727. }
  3728. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3729. }
  3730. // 3班1班锁定2班未锁定
  3731. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == true) {
  3732. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3733. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  3734. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3735. if (row.w2 <= 0) {
  3736. row.w2 = 0
  3737. row.r2 = 0
  3738. }
  3739. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3740. }
  3741. // 2班锁定,3班1班未锁
  3742. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == false) {
  3743. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3744. if (row.r1 == 0 && row.r3 == 0) {
  3745. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  3746. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3747. row.w3 = row.w1
  3748. row.r3 = row.r1
  3749. } else if (row.r1 == 0 && row.r3 !== 0) {
  3750. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  3751. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3752. if (row.w1 == '') { row.w1 = 0 }
  3753. if (row.w2 == '') { row.w2 = 0 }
  3754. if (row.w3 == '') { row.w3 = 0 }
  3755. if (row.w4 == '') { row.w4 = 0 }
  3756. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3757. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3758. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3759. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3760. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3761. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3762. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3763. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  3764. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3765. }
  3766. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3767. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3768. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3769. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3770. } else if (row.r1 !== 0 && row.r3 == 0) {
  3771. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  3772. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3773. if (row.w1 == '') { row.w1 = 0 }
  3774. if (row.w2 == '') { row.w2 = 0 }
  3775. if (row.w3 == '') { row.w3 = 0 }
  3776. if (row.w4 == '') { row.w4 = 0 }
  3777. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3778. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3779. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3780. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3781. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3782. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3783. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3784. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3785. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3786. }
  3787. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3788. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3789. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3790. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3791. } else {
  3792. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3793. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3794. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  3795. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3796. }
  3797. if (isNaN(row.w1)) {
  3798. row.w1 = 0
  3799. row.r1 = 0
  3800. }
  3801. if (isNaN(row.w3)) {
  3802. row.w3 = 0
  3803. row.r3 = 0
  3804. }
  3805. if (row.w3 <= 0) {
  3806. row.w3 = 0
  3807. row.r3 = 0
  3808. }
  3809. if (row.w1 <= 0) {
  3810. row.w1 = 0
  3811. row.r1 = 0
  3812. }
  3813. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3814. }
  3815. // 3班锁定,2班1班未锁
  3816. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == true) {
  3817. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3818. if (row.r1 == 0 && row.r2 == 0) {
  3819. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  3820. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3821. row.w2 = row.w1
  3822. row.r2 = row.r1
  3823. } else if (row.r1 == 0 && row.r2 !== 0) {
  3824. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3825. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3826. if (row.w1 == '') { row.w1 = 0 }
  3827. if (row.w2 == '') { row.w2 = 0 }
  3828. if (row.w3 == '') { row.w3 = 0 }
  3829. if (row.w4 == '') { row.w4 = 0 }
  3830. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3831. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3832. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3833. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3834. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3835. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3836. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3837. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  3838. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3839. }
  3840. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3841. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3842. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3843. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3844. } else if (row.r1 !== 0 && row.r2 == 0) {
  3845. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  3846. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3847. if (row.w1 == '') { row.w1 = 0 }
  3848. if (row.w2 == '') { row.w2 = 0 }
  3849. if (row.w3 == '') { row.w3 = 0 }
  3850. if (row.w4 == '') { row.w4 = 0 }
  3851. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3852. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3853. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3854. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3855. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3856. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3857. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3858. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r2) + parseFloat(row.r1)), parseInt(Cookies.get('decimal')))
  3859. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3860. }
  3861. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3862. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3863. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3864. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3865. } else {
  3866. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r2) + parseFloat(row.r1)), parseInt(Cookies.get('decimal')))
  3867. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3868. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  3869. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3870. }
  3871. if (isNaN(row.w1)) {
  3872. row.w1 = 0
  3873. row.r1 = 0
  3874. }
  3875. if (isNaN(row.w2)) {
  3876. row.w2 = 0
  3877. row.r2 = 0
  3878. }
  3879. if (row.w2 <= 0) {
  3880. row.w2 = 0
  3881. row.r2 = 0
  3882. }
  3883. if (row.w1 <= 0) {
  3884. row.w1 = 0
  3885. row.r1 = 0
  3886. }
  3887. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3888. }
  3889. // 1班锁定,2班3班未锁
  3890. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == false) {
  3891. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3892. if (row.r2 == 0 && row.r3 == 0) {
  3893. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  3894. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3895. row.w3 = row.w2
  3896. row.r3 = row.r2
  3897. } else if (row.r2 == 0 && row.r3 !== 0) {
  3898. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  3899. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3900. if (row.w1 == '') { row.w1 = 0 }
  3901. if (row.w2 == '') { row.w2 = 0 }
  3902. if (row.w3 == '') { row.w3 = 0 }
  3903. if (row.w4 == '') { row.w4 = 0 }
  3904. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3905. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3906. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3907. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3908. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3909. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3910. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3911. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3912. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3913. }
  3914. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3915. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3916. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3917. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3918. } else if (row.r2 !== 0 && row.r3 == 0) {
  3919. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3920. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3921. if (row.w1 == '') { row.w1 = 0 }
  3922. if (row.w2 == '') { row.w2 = 0 }
  3923. if (row.w3 == '') { row.w3 = 0 }
  3924. if (row.w4 == '') { row.w4 = 0 }
  3925. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3926. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3927. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3928. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3929. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3930. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3931. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3932. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3933. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3934. }
  3935. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3936. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3937. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3938. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3939. } else {
  3940. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3941. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3942. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3943. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3944. }
  3945. if (isNaN(row.w2)) {
  3946. row.w2 = 0
  3947. row.r2 = 0
  3948. }
  3949. if (isNaN(row.w3)) {
  3950. row.w3 = 0
  3951. row.r3 = 0
  3952. }
  3953. if (row.w2 <= 0) {
  3954. row.w2 = 0
  3955. row.r2 = 0
  3956. }
  3957. if (row.w3 <= 0) {
  3958. row.w3 = 0
  3959. row.r3 = 0
  3960. }
  3961. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3962. }
  3963. // 2班3班1班未锁
  3964. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == false) {
  3965. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3966. if (row.r1 == 0 && row.r2 == 0 && row.r3 == 0) {
  3967. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) / 3, parseInt(Cookies.get('decimal')))
  3968. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3969. row.w2 = row.w1
  3970. row.r2 = row.r1
  3971. row.w3 = row.w1
  3972. row.r3 = row.r1
  3973. } else if (row.r1 == 0 && row.r2 == 0 && row.r3 !== 0) {
  3974. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  3975. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3976. row.w2 = row.w1
  3977. row.r2 = row.r1
  3978. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3979. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3980. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3981. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3982. if (row.w1 == '') { row.w1 = 0 }
  3983. if (row.w2 == '') { row.w2 = 0 }
  3984. if (row.w3 == '') { row.w3 = 0 }
  3985. if (row.w4 == '') { row.w4 = 0 }
  3986. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3987. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3988. console.log(row.dailyWeight)
  3989. console.log(this.focusWRow4.dailyWeight)
  3990. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3991. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3992. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3993. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3994. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3995. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3996. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3997. }
  3998. } else if (row.r1 == 0 && row.r2 !== 0 && row.r3 == 0) {
  3999. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  4000. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4001. row.w3 = row.w1
  4002. row.r3 = row.r1
  4003. if (row.w1 == '') { row.w1 = 0 }
  4004. if (row.w2 == '') { row.w2 = 0 }
  4005. if (row.w3 == '') { row.w3 = 0 }
  4006. if (row.w4 == '') { row.w4 = 0 }
  4007. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4008. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4009. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4010. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4011. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  4012. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  4013. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  4014. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  4015. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4016. }
  4017. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4018. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4019. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4020. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4021. } else if (row.r1 !== 0 && row.r2 == 0 && row.r3 == 0) {
  4022. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  4023. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4024. row.w3 = row.w1
  4025. row.r3 = row.r1
  4026. if (row.w1 == '') { row.w1 = 0 }
  4027. if (row.w2 == '') { row.w2 = 0 }
  4028. if (row.w3 == '') { row.w3 = 0 }
  4029. if (row.w4 == '') { row.w4 = 0 }
  4030. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4031. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4032. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4033. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4034. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  4035. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  4036. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  4037. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  4038. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4039. }
  4040. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4041. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4042. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4043. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4044. } else if (row.r1 !== 0 && row.r2 !== 0 && row.r3 == 0) {
  4045. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w1) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  4046. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4047. if (row.w1 == '') { row.w1 = 0 }
  4048. if (row.w2 == '') { row.w2 = 0 }
  4049. if (row.w3 == '') { row.w3 = 0 }
  4050. if (row.w4 == '') { row.w4 = 0 }
  4051. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4052. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4053. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4054. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4055. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  4056. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  4057. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  4058. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  4059. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4060. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  4061. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4062. }
  4063. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4064. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4065. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4066. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4067. } else if (row.r1 !== 0 && row.r2 == 0 && row.r3 !== 0) {
  4068. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w1) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  4069. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4070. if (row.w1 == '') { row.w1 = 0 }
  4071. if (row.w2 == '') { row.w2 = 0 }
  4072. if (row.w3 == '') { row.w3 = 0 }
  4073. if (row.w4 == '') { row.w4 = 0 }
  4074. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4075. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4076. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4077. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4078. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  4079. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  4080. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  4081. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  4082. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4083. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  4084. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4085. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4086. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4087. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4088. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4089. }
  4090. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4091. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4092. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4093. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4094. } else if (row.r1 == 0 && row.r2 !== 0 && row.r3 !== 0) {
  4095. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  4096. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4097. if (row.w1 == '') { row.w1 = 0 }
  4098. if (row.w2 == '') { row.w2 = 0 }
  4099. if (row.w3 == '') { row.w3 = 0 }
  4100. if (row.w4 == '') { row.w4 = 0 }
  4101. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4102. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4103. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4104. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4105. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  4106. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  4107. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  4108. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  4109. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4110. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  4111. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4112. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  4113. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  4114. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  4115. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  4116. }
  4117. } else {
  4118. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  4119. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4120. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  4121. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4122. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  4123. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  4124. }
  4125. if (isNaN(row.w1)) {
  4126. row.w1 = 0
  4127. row.r1 = 0
  4128. }
  4129. if (isNaN(row.w2)) {
  4130. row.w2 = 0
  4131. row.r2 = 0
  4132. }
  4133. if (isNaN(row.w3)) {
  4134. row.w3 = 0
  4135. row.r3 = 0
  4136. }
  4137. if (row.w1 <= 0) {
  4138. row.w1 = 0
  4139. row.r1 = 0
  4140. }
  4141. if (row.w2 <= 0) {
  4142. row.w2 = 0
  4143. row.r2 = 0
  4144. }
  4145. if (row.w3 <= 0) {
  4146. row.w3 = 0
  4147. row.r3 = 0
  4148. }
  4149. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  4150. }
  4151. }
  4152. if (row.w1 == '') { row.w1 = 0 }
  4153. if (row.w2 == '') { row.w2 = 0 }
  4154. if (row.w3 == '') { row.w3 = 0 }
  4155. if (row.w4 == '') { row.w4 = 0 }
  4156. if (isNaN(row.r1)) { row.r1 = 0 }
  4157. if (isNaN(row.r2)) { row.r2 = 0 }
  4158. if (isNaN(row.r3)) { row.r3 = 0 }
  4159. if (isNaN(row.r4)) { row.r4 = 0 }
  4160. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  4161. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  4162. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  4163. },
  4164. celldblclick(row, column, cell, event) {
  4165. console.log(row, '=====')
  4166. this.handleUpdate(row)
  4167. },
  4168. // 编辑
  4169. handleUpdate(row) {
  4170. console.log(row)
  4171. this.oldRowList = {...row}
  4172. for (let i = 0; i < this.table.list.length; i++) {
  4173. if (this.table.list[i].Edit == true) {
  4174. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  4175. return false
  4176. }
  4177. }
  4178. // 编辑true,不可编辑false
  4179. row.Edit = true
  4180. row.NoEdit = false
  4181. // 编辑false,编辑保存true
  4182. row.isUpdate = false
  4183. row.isUpdateSave = true
  4184. row.ftid = String(row.ftid)
  4185. if (row.ptsfid == '-1') {
  4186. row.ptsfid = ''
  4187. }
  4188. row.ptsfid = String(row.ptsfid)
  4189. // dryweight
  4190. this.table.temp.ftid = row.ftid
  4191. this.table.temp.ftname = row.ftname
  4192. this.table.temp.ptsfid = row.ptsfid
  4193. this.table.temp.ptsfname = row.ptsfname
  4194. },
  4195. updateData(row) {
  4196. if (row.r1 == 'NaN') { this.$set(row, 'r1', 0) }
  4197. if (row.r2 == 'NaN') { this.$set(row, 'r2', 0) }
  4198. if (row.r3 == 'NaN') { this.$set(row, 'r3', 0) }
  4199. if (row.r4 == 'NaN') { this.$set(row, 'r4', 0) }
  4200. if (row.w1 == 'NaN') { this.$set(row, 'w1', 0) }
  4201. if (row.w2 == 'NaN') { this.$set(row, 'w2', 0) }
  4202. if (row.w3 == 'NaN') { this.$set(row, 'w3', 0) }
  4203. if (row.w4 == 'NaN') { this.$set(row, 'w4', 0) }
  4204. if (row.bw1 == 'NaN') { this.$set(row, 'bw1', 0) }
  4205. if (row.bw2 == 'NaN') { this.$set(row, 'bw2', 0) }
  4206. if (row.bw3 == 'NaN') { this.$set(row, 'bw3', 0) }
  4207. if (row.bw4 == 'NaN') { this.$set(row, 'bw4', 0) }
  4208. var arr = []
  4209. for (let i = 1; i <= this.table.RWLength; i++) {
  4210. var obj = {}
  4211. obj['times'] = i
  4212. obj['pastureid'] = row.pastureid
  4213. obj['barid'] = row.barid
  4214. obj['cowcount'] = row.ccount
  4215. obj['ccountradio'] = row.ccountradio
  4216. obj['ptid'] = row.ftid
  4217. if (row.ptsfid !== '') {
  4218. obj['ptsid'] = row.ptsfid
  4219. } else {
  4220. obj['ptsid'] = '-1'
  4221. }
  4222. obj['weight'] = row['w' + i]
  4223. if(row['bw' + i] == ""){
  4224. obj['supplement'] = 0
  4225. }else{
  4226. obj['supplement'] = row['bw' + i]
  4227. }
  4228. obj['tratio'] = Math.round(row['r' + i])
  4229. obj['todaysupplement'] = row.todaysupplement
  4230. obj['todayweight'] = row.todayweight
  4231. arr.push(obj)
  4232. }
  4233. if (this.table.isPtsfname == 0) {
  4234. row.ptsfid = '-1'
  4235. row.ptsfname = ''
  4236. } else {
  4237. if (row.ptsfid == '') {
  4238. row.ptsfid = '-1'
  4239. row.ptsfname = ''
  4240. }
  4241. }
  4242. if (row.supplyweight == '') {
  4243. row.supplyweight = '0'
  4244. }
  4245. if (this.table.isPtsfname == false) {
  4246. row.supplyweight = '0'
  4247. }
  4248. console.log(row, '============')
  4249. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  4250. this.$set(row, 'ccountratio', Math.floor(parseFloat(row.ccountratio) * 100) / 100)
  4251. row.ccountratio = String(row.ccountratio)
  4252. row.sumr = Math.round(row.sumr)
  4253. // for(let i=0;i<arr.length;i++){
  4254. // if(arr[i].tratio == undefined ||arr[i].tratio =='' || arr[i].tratio == null){
  4255. // arr[i].tratio = 0
  4256. // }
  4257. // }
  4258. this.table.rwList = arr
  4259. console.log('点击了编辑保存', row)
  4260. this.table.temp.pastureid = row.pastureid
  4261. this.table.temp.id = row.id
  4262. this.table.temp.barname = row.barname
  4263. this.table.temp.barid = row.barid
  4264. this.table.temp.ccount = row.ccount
  4265. this.table.temp.ratio = row.ratio
  4266. this.table.temp.ccountratio = row.ccountratio
  4267. this.table.temp.ftid = row.ftid
  4268. this.table.temp.ftname = row.ftname
  4269. this.table.temp.ptsfid = row.ptsfid
  4270. this.table.temp.ptsfname = row.ptsfname
  4271. this.table.temp.ftweight = row.ftweight
  4272. this.table.temp.supplyweight = row.supplyweight
  4273. this.table.temp.feedweight = row.feedweight
  4274. this.table.temp.owner = row.owner
  4275. this.table.temp.sumr = row.sumr
  4276. if (row.softccount == '') {
  4277. row.softccount = 0
  4278. }
  4279. if (row.r1 == '') {
  4280. row.r1 = 0
  4281. }
  4282. if (row.r2 == '') {
  4283. row.r2 = 0
  4284. }
  4285. if (row.r3 == '') {
  4286. row.r3 = 0
  4287. }
  4288. if (row.r4 == '') {
  4289. row.r4 = 0
  4290. }
  4291. if (row.w1 == '') {
  4292. row.w1 = 0
  4293. }
  4294. if (row.w2 == '' || row.w4 == NaN) {
  4295. row.w2 = 0
  4296. }
  4297. if (row.w3 == '' || row.w4 == NaN) {
  4298. row.w3 = 0
  4299. }
  4300. if (row.w4 == '' || row.w4 == NaN) {
  4301. row.w4 = 0
  4302. }
  4303. console.log(row, '===========')
  4304. this.table.temp.softccount = row.softccount
  4305. this.table.temp.r1 = Math.round(row.r1)
  4306. this.table.temp.r2 = Math.round(row.r2)
  4307. this.table.temp.r3 = Math.round(row.r3)
  4308. this.table.temp.r4 = Math.round(row.r4)
  4309. this.table.temp.w1 = row.w1
  4310. this.table.temp.w2 = row.w2
  4311. this.table.temp.w3 = row.w3
  4312. this.table.temp.w4 = row.w4
  4313. var obj = {}
  4314. obj.pastureid = row.pastureid
  4315. obj.id = row.id
  4316. obj.data = []
  4317. if(this.oldRowList.w1 !== row.w1){
  4318. obj.data.push({'old':this.oldRowList.w1,'new':row.w1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  4319. }
  4320. if(this.oldRowList.w2 !== row.w2){
  4321. obj.data.push({'old':this.oldRowList.w2,'new':row.w2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  4322. }
  4323. if(this.oldRowList.w3 !== row.w3){
  4324. obj.data.push({'old':this.oldRowList.w3,'new':row.w3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  4325. }
  4326. if(this.oldRowList.bw1 !== row.bw1){
  4327. obj.data.push({'old':this.oldRowList.bw1,'new':row.bw1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  4328. }
  4329. if(this.oldRowList.bw2 !== row.bw2){
  4330. obj.data.push({'old':this.oldRowList.bw2,'new':row.bw2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  4331. }
  4332. if(this.oldRowList.bw3 !== row.bw3){
  4333. obj.data.push({'old':this.oldRowList.bw3,'new':row.bw3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  4334. }
  4335. if (this.table.temp.ccount == '' && this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  4336. this.$message({ type: 'error', message: '实际牛头数/系数/系数头数/配方模版不能为空', duration: 2000 })
  4337. return false
  4338. }
  4339. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  4340. this.$message({ type: 'error', message: '系数/系数头数/配方模版不能为空', duration: 2000 })
  4341. return false
  4342. }
  4343. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  4344. this.$message({ type: 'error', message: '系数头数/配方模版不能为空', duration: 2000 })
  4345. return false
  4346. }
  4347. console.log(this.table.temp.ccount, '实际牛头数不能为空')
  4348. if (this.table.temp.ccount === '') {
  4349. this.$message({ type: 'error', message: '实际牛头数不能为空', duration: 2000 })
  4350. return false
  4351. }
  4352. if (this.table.temp.ratio === '') {
  4353. this.$message({ type: 'error', message: '系数不能为空', duration: 2000 })
  4354. return false
  4355. }
  4356. if (this.table.temp.ccountratio === '') {
  4357. this.$message({ type: 'error', message: '系数头数不能为空', duration: 2000 })
  4358. return false
  4359. }
  4360. if (this.table.temp.ftid == '') {
  4361. this.$message({ type: 'error', message: '配方模版不能为空', duration: 2000 })
  4362. return false
  4363. }
  4364. const positiveInteger = /^[0-9]\d*$/
  4365. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  4366. this.$message({
  4367. type: 'error',
  4368. message: '实际牛头数请输入正整数',
  4369. duration: 2000
  4370. })
  4371. return false
  4372. }
  4373. this.isokDisable = true
  4374. setTimeout(() => {
  4375. this.isokDisable = false
  4376. }, 1000)
  4377. // this.requestParam.parammaps = this.table.temp
  4378. this.requestParam.common = {
  4379. 'returnmap': '0'
  4380. }
  4381. this.requestParam.data = []
  4382. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  4383. pastureid: row.pastureid,
  4384. id: row.id,
  4385. barname: row.barname,
  4386. barid: row.barid,
  4387. softccount: row.softccount,
  4388. ccount: row.ccount,
  4389. ratio: row.ratio,
  4390. ccountratio: row.ccountratio,
  4391. ftid: row.ftid,
  4392. ftname: row.ftname,
  4393. ptsfid: row.ptsfid,
  4394. ptsfname: row.ptsfname,
  4395. ftweight: row.ftweight,
  4396. supplyweight: row.supplyweight,
  4397. feedweight: row.feedweight,
  4398. owner: row.owner,
  4399. sumr: row.sumr
  4400. }}
  4401. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  4402. this.requestParam.data[1].children = []
  4403. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  4404. pastureid: '@insertSpotList.pastureid',
  4405. barname: row.barname,
  4406. barid: '@insertSpotList.barid',
  4407. times: '@insertSpotList.times',
  4408. tratio: '@insertSpotList.tratio',
  4409. weight: '@insertSpotList.weight',
  4410. cowcount: '@insertSpotList.cowcount',
  4411. ccountradio: row.ccountratio,
  4412. ptid: '@insertSpotList.ptid',
  4413. ptsid: '@insertSpotList.ptsid',
  4414. supplement: '@insertSpotList.supplement',
  4415. feedweight: row.feedweight,
  4416. supplyweight: row.supplyweight,
  4417. ratio: row.ratio
  4418. }}
  4419. this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  4420. pastureid: row.pastureid,
  4421. fpid: row.id
  4422. }}
  4423. ExecDataByConfig(this.requestParam).then(response => {
  4424. console.log('编辑保存发送参数', this.requestParam)
  4425. if (response.msg === 'fail') {
  4426. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  4427. } else {
  4428. if(obj.data.length>0){
  4429. const url = 'authdata/fpdetail/edit'
  4430. const data = obj
  4431. postJson(url, data).then(response => {
  4432. if(response.msg !== 'fail'){
  4433. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  4434. }
  4435. })
  4436. }else{
  4437. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  4438. }
  4439. this.getList()
  4440. for (let i = 0; i < this.headerList.length; i++) {
  4441. if (this.headerList[i].target.className == 'el-icon-lock') {
  4442. this.headerList[i].target.className = 'el-icon-unlock'
  4443. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  4444. }
  4445. }
  4446. }
  4447. })
  4448. },
  4449. updateCancel(row) {
  4450. console.log('点击了编辑取消')
  4451. // 编辑false,不可编辑true
  4452. row.Edit = false
  4453. row.NoEdit = true
  4454. // 编辑true,编辑保存false
  4455. row.isUpdate = true
  4456. row.isUpdateSave = false
  4457. // this.reload()
  4458. for (let i = 0; i < this.headerList.length; i++) {
  4459. if (this.headerList[i].target.className == 'el-icon-lock') {
  4460. this.headerList[i].target.className = 'el-icon-unlock'
  4461. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  4462. }
  4463. }
  4464. console.log(this.table.getdataListParm.offset)
  4465. this.table.getdataListParm.offset = this.table.getdataListParm.offset
  4466. this.getList()
  4467. // this.$router.push('/formulationPlan/dhedFormula')
  4468. },
  4469. cellClick(row, column, event) {
  4470. console.log(column)
  4471. },
  4472. handleSelect(val) {
  4473. console.log('勾选数据', val)
  4474. this.selectList = val
  4475. },
  4476. // 营养评估
  4477. handleNutritional() {
  4478. console.log('点击了营养评估')
  4479. this.dialogFull = false
  4480. if (this.selectList.length !== 1) {
  4481. this.$message({ type: 'error', message: '请选择一条栏舍信息进行营养评估', duration: 2000 })
  4482. return false
  4483. } else {
  4484. console.log(this.nutritional.temp)
  4485. this.nutritional.dialogStatus = 'Nutritional'
  4486. this.nutritional.activeName = 'first'
  4487. this.nutritional.dialogFormVisible = true
  4488. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  4489. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  4490. this.getNutritionalList()
  4491. this.nutritional.tab1.list = []
  4492. }
  4493. },
  4494. tableRowClassName({ row }) {
  4495. // console.log(row)
  4496. if (row.isColor == '0') {
  4497. return 'red-row'
  4498. } else {
  4499. return ''
  4500. }
  4501. },
  4502. handleNutritionalTab(item) {
  4503. if (item == 'first ') {
  4504. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  4505. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  4506. this.getNutritionalList()
  4507. this.nutritional.tab1.list = []
  4508. } else {
  4509. console.log('牛群评估')
  4510. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  4511. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  4512. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4513. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4514. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4515. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4516. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4517. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4518. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4519. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4520. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4521. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4522. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4523. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4524. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4525. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4526. this.getTab2NutritionalList1()
  4527. this.getTab2NutritionalList2()
  4528. this.getTab2NutritionalList3()
  4529. this.getTab2NutritionalList4()
  4530. }
  4531. },
  4532. changeTab2Date() {
  4533. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  4534. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  4535. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4536. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4537. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4538. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4539. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4540. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4541. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4542. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4543. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4544. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4545. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4546. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4547. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4548. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4549. this.getTab2NutritionalList1()
  4550. this.getTab2NutritionalList2()
  4551. this.getTab2NutritionalList3()
  4552. this.getTab2NutritionalList4()
  4553. },
  4554. handleBefore() {
  4555. if (this.nutritional.activeName == 'first') {
  4556. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  4557. var start = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() - 1))
  4558. var stop = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() - 1))
  4559. this.nutritional.tab1.inputDatetime.length = 0
  4560. this.nutritional.tab1.inputDatetime.push(start, stop)
  4561. this.$forceUpdate()
  4562. }
  4563. } else {
  4564. var start2 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() - 1))
  4565. var stop2 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() - 1))
  4566. this.nutritional.tab2.inputDatetime.length = 0
  4567. this.nutritional.tab2.inputDatetime.push(start2, stop2)
  4568. this.$forceUpdate()
  4569. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  4570. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  4571. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4572. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4573. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4574. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4575. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4576. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4577. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4578. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4579. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4580. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4581. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4582. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4583. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4584. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4585. this.getTab2NutritionalList1()
  4586. this.getTab2NutritionalList2()
  4587. this.getTab2NutritionalList3()
  4588. this.getTab2NutritionalList4()
  4589. }
  4590. },
  4591. handleNext() {
  4592. if (this.nutritional.activeName == 'first') {
  4593. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  4594. console.log(this.nutritional.tab1.inputDatetime)
  4595. var start3 = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() + 1))
  4596. var stop3 = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() + 1))
  4597. this.nutritional.tab1.inputDatetime.length = 0
  4598. this.nutritional.tab1.inputDatetime.push(start3, stop3)
  4599. this.$forceUpdate()
  4600. }
  4601. } else {
  4602. var start4 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() + 1))
  4603. var stop4 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() + 1))
  4604. this.nutritional.tab2.inputDatetime.length = 0
  4605. this.nutritional.tab2.inputDatetime.push(start4, stop4)
  4606. this.$forceUpdate()
  4607. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  4608. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  4609. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4610. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4611. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4612. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4613. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4614. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4615. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4616. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4617. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4618. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4619. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4620. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  4621. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  4622. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  4623. this.getTab2NutritionalList1()
  4624. this.getTab2NutritionalList2()
  4625. this.getTab2NutritionalList3()
  4626. this.getTab2NutritionalList4()
  4627. }
  4628. },
  4629. getNutritionalList() {
  4630. this.nutritional.tab1.listLoading1 = true
  4631. GetDataByName(this.nutritional.tab1.getdataListParm1).then(response => {
  4632. console.log('评估上方数据', response.data.list)
  4633. if (response.data.list !== null) {
  4634. response.data.list[0].cowclassid = String(response.data.list[0].cowclassid)
  4635. this.nutritional.tab1.temp = response.data.list[0]
  4636. this.nutritional.tab1.disabledCowclass = true
  4637. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  4638. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  4639. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  4640. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  4641. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  4642. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  4643. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  4644. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  4645. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  4646. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  4647. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  4648. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  4649. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  4650. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  4651. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  4652. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  4653. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  4654. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  4655. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  4656. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  4657. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  4658. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  4659. this.getNutritionalList2()
  4660. } else {
  4661. this.nutritional.tab1.temp = []
  4662. this.nutritional.tab1.disabledCowclass = false
  4663. }
  4664. setTimeout(() => {
  4665. this.nutritional.tab1.listLoading = false
  4666. }, 100)
  4667. })
  4668. },
  4669. assessmentData() {
  4670. console.log('评估保存')
  4671. this.$refs['temp'].validate(valid => {
  4672. if (valid) {
  4673. if (this.nutritional.tab1.inputDatetime == '' || this.nutritional.tab1.inputDatetime == null) {
  4674. this.$message({ type: 'error', message: '开始日期结束日期不能为空', duration: 2000 })
  4675. return false
  4676. } else {
  4677. // 牛头数
  4678. const positiveInteger = /^[1-9]\d*$/
  4679. if (this.nutritional.tab1.temp.cowsum !== '') {
  4680. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.cowsum))) {
  4681. this.$message({ type: 'error', message: '牛头数请输入正整数', duration: 2000 })
  4682. return false
  4683. }
  4684. }
  4685. const twoDecimalPlaces = /^\d+(\.\d{1,2})?$/
  4686. // 温度环境
  4687. if (this.nutritional.tab1.temp.tem !== '') {
  4688. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.tem))) {
  4689. this.$message({ type: 'error', message: '温度环境请保留两位小数', duration: 2000 })
  4690. return false
  4691. }
  4692. }
  4693. // 平均月龄
  4694. if (this.nutritional.tab1.temp.avgmonthage !== '') {
  4695. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.avgmonthage))) {
  4696. this.$message({ type: 'error', message: '平均月龄请保留两位小数', duration: 2000 })
  4697. return false
  4698. }
  4699. }
  4700. // 体重
  4701. if (this.nutritional.tab1.temp.bw !== '') {
  4702. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.bw))) {
  4703. this.$message({ type: 'error', message: '体重请保留两位小数', duration: 2000 })
  4704. return false
  4705. }
  4706. }
  4707. // 日增重
  4708. if (this.nutritional.tab1.temp.dayw !== '') {
  4709. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.dayw))) {
  4710. this.$message({ type: 'error', message: '日增重请保留两位小数', duration: 2000 })
  4711. return false
  4712. }
  4713. }
  4714. const dayspre = /^(([1-9]|([1-9]\d)|(1\d\d)|(2([0-7]\d|7[0-9]))))$/
  4715. // 怀孕天数
  4716. if (this.nutritional.tab1.temp.dayspre !== '') {
  4717. if (!dayspre.test(parseFloat(this.nutritional.tab1.temp.dayspre))) {
  4718. this.$message({ type: 'error', message: '怀孕天数请输入大于0小于280整数', duration: 2000 })
  4719. return false
  4720. }
  4721. }
  4722. const fetal = /^(?:[1-9]|1[0-9])$/
  4723. // 胎次
  4724. if (this.nutritional.tab1.temp.fetal !== '') {
  4725. if (!fetal.test(parseFloat(this.nutritional.tab1.temp.fetal))) {
  4726. this.$message({ type: 'error', message: '胎次请输入大于0小于20整数', duration: 2000 })
  4727. return false
  4728. }
  4729. }
  4730. // 平均泌乳
  4731. if (this.nutritional.tab1.temp.avgdim !== '') {
  4732. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.avgdim))) {
  4733. this.$message({ type: 'error', message: '平均泌乳天数请输入正整数', duration: 2000 })
  4734. return false
  4735. }
  4736. }
  4737. // 产奶量
  4738. if (this.nutritional.tab1.temp.product !== '') {
  4739. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.product))) {
  4740. this.$message({ type: 'error', message: '产奶量请保留两位小数', duration: 2000 })
  4741. return false
  4742. }
  4743. }
  4744. // 乳脂率
  4745. if (this.nutritional.tab1.temp.fat !== '') {
  4746. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.fat))) {
  4747. this.$message({ type: 'error', message: '乳脂率请保留两位小数', duration: 2000 })
  4748. return false
  4749. }
  4750. }
  4751. // 乳蛋白率
  4752. if (this.nutritional.tab1.temp.pro !== '') {
  4753. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.pro))) {
  4754. this.$message({ type: 'error', message: '乳蛋白率请保留两位小数', duration: 2000 })
  4755. return false
  4756. }
  4757. }
  4758. // 乳糖率
  4759. if (this.nutritional.tab1.temp.lactose !== '') {
  4760. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.lactose))) {
  4761. this.$message({ type: 'error', message: '乳糖率请保留两位小数', duration: 2000 })
  4762. return false
  4763. }
  4764. }
  4765. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  4766. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  4767. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  4768. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  4769. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  4770. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  4771. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  4772. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  4773. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  4774. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  4775. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  4776. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  4777. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  4778. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  4779. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  4780. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  4781. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  4782. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  4783. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  4784. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  4785. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  4786. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  4787. this.getNutritionalList2()
  4788. }
  4789. }
  4790. })
  4791. },
  4792. getNutritionalList2() {
  4793. this.nutritional.tab1.listLoading2 = true
  4794. const url = 'authdata/GETNurJudge'
  4795. const data = this.nutritional.tab1.getdataListParm2
  4796. postJson(url, data).then(response => {
  4797. if (response.msg !== 'fail') {
  4798. if (response.data.list !== null) {
  4799. for (let i = 0; i < response.data.length; i++) {
  4800. if (response.data[i].cowneed == null) {
  4801. response.data[i].cowneed = ''
  4802. }
  4803. var reg = RegExp(/>/)
  4804. var reg2 = RegExp(/</)
  4805. var reg3 = RegExp(/-/)
  4806. if (reg.test(response.data[i].cowneed) == true) {
  4807. const cowneed = response.data[i].cowneed.split('>')[1]
  4808. if ((parseFloat(response.data[i].ftpro) < parseFloat(cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(cowneed)) {
  4809. this.$set(response.data[i], 'isColor', '0')
  4810. } else {
  4811. this.$set(response.data[i], 'isColor', '')
  4812. }
  4813. } else if (reg2.test(response.data[i].cowneed) == true) {
  4814. const cowneed2 = response.data[i].cowneed.split('<')[1]
  4815. if ((parseFloat(response.data[i].ftpro) > parseFloat(cowneed2)) || (parseFloat(response.data[i].hprov) > parseFloat(cowneed2)) || parseFloat(response.data[i].sprov) > parseFloat(cowneed2)) {
  4816. this.$set(response.data[i], 'isColor', '0')
  4817. } else {
  4818. this.$set(response.data[i], 'isColor', '')
  4819. }
  4820. } else if (reg3.test(response.data[i].cowneed) == true) {
  4821. response.data[i].cowneed = String(response.data[i].cowneed)
  4822. if (response.data[i].cowneed.length == 1) {
  4823. const cowneed3 = response.data[i].cowneed.split('-')
  4824. console.log(cowneed3, 'cowneed3')
  4825. if (parseFloat(response.data[i].ftpro) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].ftpro) < parseFloat(cowneed3[1])) {
  4826. this.$set(response.data[i], 'isColor', '')
  4827. } else if (parseFloat(response.data[i].hprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].hprov) < parseFloat(cowneed3[1])) {
  4828. this.$set(response.data[i], 'isColor', '')
  4829. } else if (parseFloat(response.data[i].sprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].sprov) < parseFloat(cowneed3[1])) {
  4830. this.$set(response.data[i], 'isColor', '')
  4831. } else if (cowneed3[0] == '' && cowneed3[0] == '') {
  4832. this.$set(response.data[i], 'isColor', '')
  4833. } else {
  4834. this.$set(response.data[i], 'isColor', '0')
  4835. }
  4836. } else {
  4837. 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)) {
  4838. this.$set(response.data[i], 'isColor', '0')
  4839. } else {
  4840. this.$set(response.data[i], 'isColor', '')
  4841. }
  4842. }
  4843. } else {
  4844. response.data[i].cowneed = String(response.data[i].cowneed)
  4845. if (response.data[i].cowneed[0] !== '-') {
  4846. 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)) {
  4847. this.$set(response.data[i], 'isColor', '0')
  4848. } else {
  4849. this.$set(response.data[i], 'isColor', '')
  4850. }
  4851. } else {
  4852. this.$set(response.data[i], 'isColor', '')
  4853. }
  4854. }
  4855. }
  4856. console.log(response.data)
  4857. console.log('评估下方数据', response.data)
  4858. this.nutritional.tab1.list = response.data
  4859. this.nutritional.tab1.total = response.data.total
  4860. } else {
  4861. this.nutritional.tab1.list = []
  4862. }
  4863. } else {
  4864. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  4865. }
  4866. setTimeout(() => {
  4867. this.nutritional.tab1.listLoading2 = false
  4868. }, 100)
  4869. })
  4870. },
  4871. // 牛群评估
  4872. getTab2NutritionalList1() {
  4873. this.nutritional.tab2.listLoading1 = true
  4874. GetDataByName(this.nutritional.tab2.getdataListParm1).then(response => {
  4875. console.log('宾州筛分析', response.data.list)
  4876. if (response.data.list !== null) {
  4877. this.nutritional.tab2.list1 = response.data.list
  4878. this.nutritional.tab2.pageNum1 = response.data.pageNum
  4879. this.nutritional.tab2.pageSize1 = response.data.pageSize
  4880. this.nutritional.tab2.total1 = response.data.total
  4881. } else {
  4882. this.nutritional.tab2.list1 = []
  4883. }
  4884. setTimeout(() => {
  4885. this.nutritional.tab2.listLoading1 = false
  4886. }, 100)
  4887. })
  4888. },
  4889. getTab2NutritionalList2() {
  4890. this.nutritional.tab2.listLoading2 = true
  4891. GetDataByName(this.nutritional.tab2.getdataListParm2).then(response => {
  4892. console.log('粪便筛分析', response.data.list)
  4893. if (response.data.list !== null) {
  4894. this.nutritional.tab2.list2 = response.data.list
  4895. this.nutritional.tab2.pageNum2 = response.data.pageNum
  4896. this.nutritional.tab2.pageSize2 = response.data.pageSize
  4897. this.nutritional.tab2.total2 = response.data.total
  4898. } else {
  4899. this.nutritional.tab2.list2 = []
  4900. }
  4901. setTimeout(() => {
  4902. this.nutritional.tab2.listLoading2 = false
  4903. }, 100)
  4904. })
  4905. },
  4906. getTab2NutritionalList3() {
  4907. this.nutritional.tab2.listLoading3 = true
  4908. GetDataByName(this.nutritional.tab2.getdataListParm3).then(response => {
  4909. console.log('BCS评分', response.data.list)
  4910. if (response.data.list !== null) {
  4911. for (let i = 0; i < response.data.list.length; i++) {
  4912. this.$set(response.data.list[i], 'score25rate', (parseFloat(response.data.list[i].score25) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4913. this.$set(response.data.list[i], 'score275rate', (parseFloat(response.data.list[i].score275) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4914. this.$set(response.data.list[i], 'score3rate', (parseFloat(response.data.list[i].score3) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4915. this.$set(response.data.list[i], 'score325rate', (parseFloat(response.data.list[i].score325) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4916. this.$set(response.data.list[i], 'score35rate', (parseFloat(response.data.list[i].score35) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4917. this.$set(response.data.list[i], 'score375rate', (parseFloat(response.data.list[i].score375) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4918. this.$set(response.data.list[i], 'score4rate', (100 - response.data.list[i].score25rate - response.data.list[i].score275rate - response.data.list[i].score3rate - response.data.list[i].score325rate - response.data.list[i].score35rate - response.data.list[i].score375rate).toFixed(parseInt(Cookies.get('decimal'))))
  4919. }
  4920. this.nutritional.tab2.list3 = response.data.list
  4921. this.nutritional.tab2.pageNum3 = response.data.pageNum
  4922. this.nutritional.tab2.pageSize3 = response.data.pageSize
  4923. this.nutritional.tab2.total3 = response.data.total
  4924. } else {
  4925. this.nutritional.tab2.list3 = []
  4926. }
  4927. setTimeout(() => {
  4928. this.nutritional.tab2.listLoading3 = false
  4929. }, 100)
  4930. })
  4931. },
  4932. getTab2NutritionalList4() {
  4933. this.nutritional.tab2.listLoading4 = true
  4934. GetDataByName(this.nutritional.tab2.getdataListParm4).then(response => {
  4935. console.log('粪便评分', response.data.list)
  4936. if (response.data.list !== null) {
  4937. for (let i = 0; i < response.data.list.length; i++) {
  4938. this.$set(response.data.list[i], 'score1rate', (parseFloat(response.data.list[i].score1) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4939. this.$set(response.data.list[i], 'score2rate', (parseFloat(response.data.list[i].score2) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4940. this.$set(response.data.list[i], 'score3rate', (parseFloat(response.data.list[i].score3) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4941. this.$set(response.data.list[i], 'score4rate', (parseFloat(response.data.list[i].score4) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4942. this.$set(response.data.list[i], 'score5rate', (100 - response.data.list[i].score1rate - response.data.list[i].score2rate - response.data.list[i].score3rate - response.data.list[i].score4rate).toFixed(parseInt(Cookies.get('decimal'))))
  4943. }
  4944. this.nutritional.tab2.list4 = response.data.list
  4945. this.nutritional.tab2.pageNum4 = response.data.pageNum
  4946. this.nutritional.tab2.pageSize4 = response.data.pageSize
  4947. this.nutritional.tab2.total4 = response.data.total
  4948. } else {
  4949. this.nutritional.tab2.list4 = []
  4950. }
  4951. setTimeout(() => {
  4952. this.nutritional.tab2.listLoading4 = false
  4953. }, 100)
  4954. })
  4955. },
  4956. // 历史记录
  4957. handleHistoryRecords() {
  4958. console.log('点击了历史记录')
  4959. this.dialogFull = false
  4960. this.history.dialogStatus = 'history'
  4961. this.history.dialogFormVisible = true
  4962. this.getDateList()
  4963. },
  4964. // 历史时间
  4965. getDateList() {
  4966. GetDataByName(this.history.getdataDateParm).then(response => {
  4967. console.log('table数据', response.data.list)
  4968. if (response.data.list !== null) {
  4969. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  4970. this.getHistoryIsDisplay()
  4971. } else {
  4972. this.history.getdataListParm.parammaps.date = ''
  4973. }
  4974. })
  4975. },
  4976. getHistoryIsDisplay() {
  4977. GetDataByName(this.table.getdataListParm2).then(response => {
  4978. console.log(response.data.list[0].inforvalue)
  4979. if (response.data.list !== null) {
  4980. if (response.data.list[0].inforvalue == 0) {
  4981. this.table.isPtsfname = false
  4982. } else {
  4983. this.table.isPtsfname = true
  4984. }
  4985. }
  4986. })
  4987. GetDataByName(this.table.getdataListParm3).then(response => {
  4988. if (response.data.list !== null) {
  4989. if (response.data.list[0].inforvalue == 1) {
  4990. this.history.isRW1 = true
  4991. this.history.isRW2 = false
  4992. this.history.isRW3 = false
  4993. this.history.isRW4 = false
  4994. } else if (response.data.list[0].inforvalue == 2) {
  4995. this.history.isRW1 = true
  4996. this.history.isRW2 = true
  4997. this.history.isRW3 = false
  4998. this.history.isRW4 = false
  4999. } else if (response.data.list[0].inforvalue == 3) {
  5000. this.history.isRW1 = true
  5001. this.history.isRW2 = true
  5002. this.history.isRW3 = true
  5003. this.history.isRW4 = false
  5004. } else if (response.data.list[0].inforvalue == 4) {
  5005. this.history.isRW1 = true
  5006. this.history.isRW2 = true
  5007. this.history.isRW3 = true
  5008. this.history.isRW4 = true
  5009. }
  5010. } else {
  5011. this.history.isRW1 = false
  5012. this.history.isRW2 = false
  5013. this.history.isRW3 = false
  5014. this.history.isRW4 = false
  5015. }
  5016. })
  5017. this.getHistoryList()
  5018. },
  5019. getHistoryList() {
  5020. this.history.listLoading = true
  5021. GetDataByName(this.history.getdataListParm).then(response => {
  5022. console.log('table数据', response.data.list)
  5023. if (response.data.list !== null) {
  5024. console.log('table数据', response.data.list)
  5025. for (let i = 0; i < response.data.list.length; i++) {
  5026. if (response.data.list[i].ptid == undefined || response.data.list[i].ptname == '') {
  5027. this.$set(response.data.list[i], 'ptid', '')
  5028. this.$set(response.data.list[i], 'ptname', '')
  5029. }
  5030. }
  5031. this.history.list = response.data.list
  5032. this.handleSpan()
  5033. this.history.pageNum = response.data.pageNum
  5034. this.history.pageSize = response.data.pageSize
  5035. this.history.total = response.data.total
  5036. } else {
  5037. this.history.list = []
  5038. }
  5039. setTimeout(() => {
  5040. this.history.listLoading = false
  5041. }, 100)
  5042. })
  5043. },
  5044. handleSpan() {
  5045. this.mergekeys.forEach(key => {
  5046. this.spanObj[key] = []
  5047. let position = 0
  5048. this.history.list.forEach((item, index) => {
  5049. if (index === 0) {
  5050. this.spanObj[key].push(1)
  5051. position = 0
  5052. } else {
  5053. if (key == 'sumweight') {
  5054. if (this.history.list[index][key] === this.history.list[index - 1][key] && this.history.list[index]['barname'] === this.history.list[index - 1]['barname']) {
  5055. this.spanObj[key][position] += 1
  5056. this.spanObj[key].push(0)
  5057. } else {
  5058. this.spanObj[key].push(1)
  5059. position = index
  5060. }
  5061. } else {
  5062. if (this.history.list[index][key] === this.history.list[index - 1][key]) {
  5063. this.spanObj[key][position] += 1
  5064. this.spanObj[key].push(0)
  5065. } else {
  5066. this.spanObj[key].push(1)
  5067. position = index
  5068. }
  5069. }
  5070. }
  5071. })
  5072. })
  5073. },
  5074. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  5075. for (let i = 0; i < this.mergekeys.length; i++) {
  5076. if (column.property === this.mergekeys[i]) {
  5077. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  5078. const _col = _row > 0 ? 1 : 0
  5079. return {
  5080. rowspan: _row,
  5081. colspan: _col
  5082. }
  5083. }
  5084. }
  5085. },
  5086. changeDate() {
  5087. this.getHistoryList()
  5088. },
  5089. // 应用
  5090. handleApplication() {
  5091. console.log('点击了应用')
  5092. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  5093. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  5094. }).then(() => {
  5095. this.requestParam.name = 'applyFPdate'
  5096. this.requestParam.parammaps = {}
  5097. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  5098. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  5099. PostDataByName(this.requestParam).then(response => {
  5100. if (response.msg === 'fail') {
  5101. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  5102. } else {
  5103. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  5104. this.getHistoryIsDisplay()
  5105. this.getList()
  5106. }
  5107. })
  5108. }).catch(() => {
  5109. this.$message({ type: 'info', message: '已取消应用' })
  5110. })
  5111. },
  5112. // 导出
  5113. handleExport(item) {
  5114. if (item == 1) {
  5115. console.log('点击了导出模板')
  5116. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  5117. GetDataByName(this.download.getdataListParm).then(response => {
  5118. if (response.data.list !== null) {
  5119. this.download.list = response.data.list
  5120. } else {
  5121. this.download.list = []
  5122. }
  5123. var downloadList = [
  5124. { 'obj1': '1、文件类型为xlsx类型,对应表格文件名格式为:文件名称.xlsx;' },
  5125. { 'obj1': '2、底部工作表名称不可更改,默认为:Sheet1;' },
  5126. { 'obj1': '3、栏舍名称,实际牛头数,系数(%),系数头数,配方模板,补料配方字体为必填;' },
  5127. { 'obj1': '4、第一列栏舍名称默认为系统中栏舍,不可修改;' },
  5128. { 'obj1': '5、实际牛头数为正整数,系数为正数,至多保留俩位小数;' },
  5129. { 'obj1': '6、配方模板名称必须与系统中配方计划—配方模板中的饲喂配方匹配;若补料配方开启,需与配方模板中的补料配方匹配;' },
  5130. { 'obj1': '7、数据最多可导入200条,超过200条请分多个文件导入。' }
  5131. ]
  5132. var excelDatas = [
  5133. {
  5134. tHeader: ['栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '第四班比例(%)'],
  5135. filterVal: ['barname', '', '', '', '', '', '', '', ''],
  5136. tableDatas: this.download.list,
  5137. sheetName: 'Sheet1'
  5138. }, {
  5139. tHeader: ['填写规范:'],
  5140. filterVal: ['obj1'],
  5141. tableDatas: downloadList,
  5142. sheetName: 'Sheet2'
  5143. }
  5144. ]
  5145. json2excel(excelDatas, '栏舍配方导入模板', true, 'xlsx')
  5146. })
  5147. } else {
  5148. console.log('点击了导出数据')
  5149. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  5150. GetDataByName(this.download.getdataListParm).then(response => {
  5151. if (response.data.list !== null) {
  5152. for (let i = 0; i < response.data.list.length; i++) {
  5153. if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
  5154. if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
  5155. this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
  5156. } else {
  5157. this.$set(response.data.list[i], 'dryweight', '')
  5158. }
  5159. }
  5160. if (response.data.list[i].timesopt !== undefined) {
  5161. var timesoptArr = response.data.list[i].timesopt.split(',')
  5162. for (let j = 0; j < timesoptArr.length; j++) {
  5163. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  5164. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  5165. }
  5166. }
  5167. if (response.data.list[i].r1 == '' || response.data.list[i].r1 == undefined) {
  5168. response.data.list[i].r1 = 0
  5169. response.data.list[i].w1 = 0
  5170. }
  5171. if (response.data.list[i].r2 == '' || response.data.list[i].r2 == undefined) {
  5172. response.data.list[i].r2 = 0
  5173. response.data.list[i].w2 = 0
  5174. }
  5175. if (response.data.list[i].r3 == '' || response.data.list[i].r3 == undefined) {
  5176. response.data.list[i].r3 = 0
  5177. response.data.list[i].w3 = 0
  5178. }
  5179. if (response.data.list[i].r4 == '' || response.data.list[i].r4 == undefined) {
  5180. response.data.list[i].r4 = 0
  5181. response.data.list[i].w4 = 0
  5182. }
  5183. 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))
  5184. response.data.list[i].sumr = formatNum(response.data.list[i].sumr, parseInt(Cookies.get('decimal')))
  5185. 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))
  5186. response.data.list[i].dailyWeight = formatNum(response.data.list[i].dailyWeight, parseInt(Cookies.get('decimal')))
  5187. }
  5188. this.download.list = response.data.list
  5189. } else {
  5190. this.download.list = []
  5191. }
  5192. if (this.table.isRW1 == true && this.table.isRW2 == false && this.table.isRW3 == false && this.table.isRW4 == false) {
  5193. var excelDatas = [
  5194. {
  5195. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  5196. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  5197. tableDatas: this.download.list,
  5198. sheetName: 'Sheet1'
  5199. }
  5200. ]
  5201. } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == false && this.table.isRW4 == false) {
  5202. var excelDatas = [
  5203. {
  5204. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  5205. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  5206. tableDatas: this.download.list,
  5207. sheetName: 'Sheet1'
  5208. }
  5209. ]
  5210. } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == true && this.table.isRW4 == false) {
  5211. var excelDatas = [
  5212. {
  5213. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  5214. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  5215. tableDatas: this.download.list,
  5216. sheetName: 'Sheet1'
  5217. }
  5218. ]
  5219. } else {
  5220. var excelDatas = [
  5221. {
  5222. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  5223. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'r4', 'w4', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  5224. tableDatas: this.download.list,
  5225. sheetName: 'Sheet1'
  5226. }
  5227. ]
  5228. }
  5229. json2excel(excelDatas, '栏舍配方', true, 'xlsx')
  5230. })
  5231. }
  5232. },
  5233. beforeImport(file) {
  5234. const isLt2M = file.size / 1024 / 1024 < 2
  5235. if (!isLt2M) {
  5236. this.$message.error('上传文件大小不能超过 2MB!')
  5237. }
  5238. return isLt2M
  5239. },
  5240. handleImportSuccess(res, file) {
  5241. this.getList()
  5242. if (res.msg === 'ok') {
  5243. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  5244. if (res.data.err_count > 0) {
  5245. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  5246. import('@/vendor/Export2Excel').then(excel => {
  5247. const list1 = res.data.result
  5248. const tHeader = [
  5249. '栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '错误信息'
  5250. ]
  5251. const filterVal = [
  5252. '栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', 'error_msg'
  5253. ]
  5254. const data1 = this.formatJson(filterVal, list1)
  5255. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '栏舍配方导入报错信息', autoWidth: true, bookType: 'xlsx' })
  5256. })
  5257. }
  5258. } else {
  5259. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  5260. }
  5261. },
  5262. formatJson(filterVal, jsonData) {
  5263. return jsonData.map(v =>
  5264. filterVal.map(j => {
  5265. if (j === 'timestamp') {
  5266. return parseTime(v[j])
  5267. } else {
  5268. return v[j]
  5269. }
  5270. })
  5271. )
  5272. },
  5273. // 干物质调节
  5274. handleDryMatterRegulation() {
  5275. console.log('干物质调节')
  5276. this.isShowDialog = true
  5277. this.$refs.mychild.getBalconicFormula()
  5278. this.$refs.mychild.restTemp()
  5279. },
  5280. blurBw(row) {
  5281. console.log(row)
  5282. },
  5283. focusBw(row) {
  5284. console.log(row)
  5285. }
  5286. }
  5287. }
  5288. </script>
  5289. <style lang="scss" scoped>
  5290. .search {
  5291. clear: both;
  5292. }
  5293. .table {
  5294. margin-top: 10px;
  5295. }
  5296. </style>
  5297. <style lang="scss">
  5298. .red-row{
  5299. background: #fde2e2 !important;
  5300. }
  5301. </style>