2daf8643c457cc092d1e5b4a413bebe58da6cf3e.svn-base 274 KB

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