5aadd4ca2ffa35bd40361210b1633bd60e412f79.svn-base 276 KB

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