8fbf98f9a63cd2a1235b545d8bf17b1e7ca8d1fe.svn-base 275 KB

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