index.vue 279 KB

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