index.vue 214 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <!-- 临时隐藏 -->
  5. <!-- <el-button v-if="isRoleEdit" class="successBorder" style="float: left;" @click="handleNutritional">营养评估</el-button> -->
  6. <!-- 临时隐藏 -->
  7. <div class="search">
  8. <el-select
  9. v-model="table.getdataListParm.parammaps.barid"
  10. clearable
  11. filterable
  12. :placeholder="$t('formulationEvaluation.xzls')"
  13. style="width: 180px"
  14. class="filter-item"
  15. >
  16. <el-option
  17. v-for="item in barList"
  18. :key="item.id"
  19. :label="item.bname"
  20. :value="item.id"
  21. />
  22. </el-select>
  23. <el-select
  24. v-model="table.getdataListParm.parammaps.tname"
  25. clearable
  26. filterable
  27. :placeholder="$t('formulationEvaluation.qsrpfmc')"
  28. style="width: 180px"
  29. class="filter-item"
  30. >
  31. <el-option
  32. v-for="(item, index) in tnameList"
  33. :key="index"
  34. :label="item.tname"
  35. :value="item.tname"
  36. />
  37. </el-select>
  38. <!-- <el-input v-model="table.getdataListParm.parammaps.tname" :placeholder="$t('formulationEvaluation.qsrpfmc')" style="width: 180px;" class="filter-item" /> -->
  39. <el-button class="successBorder" @click="form_search">{{
  40. $t('common.query')
  41. }}</el-button>
  42. <el-button
  43. v-if="isRoleEdit"
  44. class="successBorder"
  45. @click="handleDryMatterRegulation"
  46. >{{ $t('dhedFormula.gwztj') }}</el-button
  47. >
  48. <el-button
  49. v-if="isRoleEdit && isSynchronous"
  50. class="successBorder"
  51. @click="handleSynchronous"
  52. >{{ $t('dhedFormula.rjntstb') }}</el-button
  53. >
  54. <el-button
  55. v-if="isRoleEdit && !isproportion"
  56. class="successBorder"
  57. @click="handle_batchEdit"
  58. >{{ $t('dhedFormula.plbj') }}</el-button
  59. >
  60. <el-button
  61. v-if="isRoleEdit && isproportion"
  62. icon="el-icon-folder-checked"
  63. class="success"
  64. @click="handle_batchEdit_save"
  65. >{{ $t('formulationEvaluation.save') }}</el-button
  66. >
  67. <el-button
  68. v-if="isRoleEdit && isproportion"
  69. icon="el-icon-close"
  70. class="sortCancel"
  71. @click="cancelChangeEdit"
  72. >{{ $t('formulationEvaluation.cancel') }}</el-button
  73. >
  74. <el-upload
  75. style="float: right"
  76. :headers="headers"
  77. :data="uploadData"
  78. :action="uploadExcelUrl"
  79. :show-file-list="false"
  80. :before-upload="beforeImport"
  81. :on-success="handleImportSuccess"
  82. >
  83. <el-button
  84. v-if="isRoleEdit"
  85. class="import"
  86. icon="el-icon-download"
  87. style="float: right"
  88. >{{ $t('formulationEvaluation.enter') }}</el-button
  89. >
  90. </el-upload>
  91. <el-dropdown style="float: right; margin-right: 10px">
  92. <el-button class="export" icon="el-icon-upload2">{{
  93. $t('formulationEvaluation.out')
  94. }}</el-button>
  95. <el-dropdown-menu slot="dropdown">
  96. <el-dropdown-item @click.native="handleExport(1)">{{
  97. $t('formulationEvaluation.outmb')
  98. }}</el-dropdown-item>
  99. <el-dropdown-item @click.native="handleExport(2)">{{
  100. $t('formulationEvaluation.outsj')
  101. }}</el-dropdown-item>
  102. </el-dropdown-menu>
  103. </el-dropdown>
  104. <el-button
  105. class="export"
  106. style="margin-top: 10px"
  107. @click="handleHistoryRecords"
  108. >{{ $t('dhedFormula.lsjl') }}</el-button
  109. >
  110. </div>
  111. </div>
  112. <div class="search" />
  113. <div class="table">
  114. <el-table
  115. :key="table.tableKey"
  116. ref="table"
  117. v-loading="table.listLoading"
  118. :element-loading-text="$t('common.tableMsg')"
  119. :data="table.list"
  120. border
  121. fit
  122. highlight-current-row
  123. style="width: 100%"
  124. :row-style="rowStyle"
  125. :cell-style="cellStyle"
  126. class="elTable table-fixed"
  127. :max-height="myHeight"
  128. @header-click="headerClick"
  129. @selection-change="handleSelect"
  130. @cell-dblclick="celldblclick"
  131. >
  132. <el-table-column type="selection" width="40" />
  133. <el-table-column
  134. :key="1"
  135. :label="$t('formulationEvaluation.xh')"
  136. align="center"
  137. type="index"
  138. width="50px"
  139. class-name="small-padding fixed-width"
  140. fixed="left"
  141. />
  142. <el-table-column
  143. :label="$t('errorAnalysis.isHouseName')"
  144. min-width="60px"
  145. align="center"
  146. class-name="small-padding fixed-width"
  147. fixed="left"
  148. >
  149. <template slot-scope="scope">
  150. <span>{{ scope.row.barname }}</span>
  151. </template>
  152. </el-table-column>
  153. <el-table-column
  154. :key="2"
  155. :label="$t('dhedFormula.rjnts')"
  156. min-width="60px"
  157. align="center"
  158. >
  159. <template slot-scope="scope">
  160. <span>{{ scope.row.softccount }}</span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column
  164. :key="3"
  165. :label="$t('feedingEfficiency.sjnts')"
  166. min-width="80px"
  167. align="center"
  168. >
  169. <template slot-scope="scope">
  170. <span v-if="scope.row.NoEdit && !isproportion">{{
  171. scope.row.ccount
  172. }}</span>
  173. <el-input
  174. v-if="scope.row.Edit || isproportion"
  175. v-model="scope.row.ccount"
  176. step="0.01"
  177. type="number"
  178. style="width: 100%; padding: 10px 0"
  179. @blur="blurCcount(scope.row)"
  180. :placeholder="scope.row.placeholder_ccount"
  181. @focus="focusData(scope.row)"
  182. />
  183. </template>
  184. </el-table-column>
  185. <el-table-column
  186. :key="4"
  187. :label="$t('dhedFormula.xs')"
  188. min-width="85px"
  189. align="center"
  190. >
  191. <template slot-scope="scope">
  192. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  193. <el-input
  194. v-if="scope.row.Edit"
  195. v-model="scope.row.ratio"
  196. step="0.01"
  197. type="number"
  198. style="width: 100%; padding: 10px 0"
  199. @blur="blurRatio(scope.row)"
  200. :placeholder="scope.row.placeholder_ratio"
  201. />
  202. </template>
  203. </el-table-column>
  204. <el-table-column
  205. :key="5"
  206. :label="$t('dhedFormula.xsts')"
  207. min-width="85px"
  208. align="center"
  209. >
  210. <template slot-scope="scope">
  211. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  212. <el-input
  213. v-if="scope.row.Edit"
  214. v-model="scope.row.ccountratio"
  215. type="number"
  216. style="width: 100%; padding: 10px 0"
  217. @blur="blurCcountratio(scope.row)"
  218. :placeholder="scope.row.placeholder_ccountratio"
  219. />
  220. </template>
  221. </el-table-column>
  222. <el-table-column
  223. :key="6"
  224. :label="$t('feedingEfficiency.pfmb')"
  225. min-width="100px"
  226. align="center"
  227. >
  228. <template slot-scope="scope">
  229. <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
  230. <el-select
  231. v-if="scope.row.Edit"
  232. v-model="scope.row.ftid"
  233. filterable
  234. :placeholder="$t('feedingEfficiency.pfmb')"
  235. class="filter-item"
  236. style="width: 99%"
  237. @change="
  238. (value) => {
  239. changeRecipeTemplate(value, scope.row)
  240. }
  241. "
  242. >
  243. <el-option
  244. v-for="item in recipeTemplateList"
  245. :key="item.id"
  246. :label="item.tname"
  247. :value="item.id"
  248. />
  249. </el-select>
  250. </template>
  251. </el-table-column>
  252. <el-table-column
  253. v-if="table.isPtsfname"
  254. :key="7"
  255. :label="$t('dhedFormula.blpf')"
  256. min-width="100px"
  257. align="center"
  258. >
  259. <template slot-scope="scope">
  260. <span v-if="scope.row.NoEdit">{{ scope.row.ptsfname }}</span>
  261. <el-select
  262. v-if="scope.row.Edit"
  263. v-model="scope.row.ptsfid"
  264. clearable
  265. filterable
  266. :placeholder="$t('dhedFormula.blpf')"
  267. class="filter-item"
  268. style="width: 100%; padding: 10px 0"
  269. @change="
  270. (value) => {
  271. changeFeedingFormula(value, scope.row)
  272. }
  273. "
  274. >
  275. <el-option
  276. v-for="item in feedingFormulaList"
  277. :key="item.id"
  278. :label="item.tname"
  279. :value="item.id"
  280. />
  281. </el-select>
  282. </template>
  283. </el-table-column>
  284. <el-table-column
  285. v-if="table.isRW1"
  286. :key="8"
  287. :label="$t('dhedFormula.dybbl1')"
  288. min-width="85px"
  289. align="center"
  290. >
  291. <template slot-scope="scope">
  292. <span v-if="scope.row.NoEdit && !isproportion">{{
  293. scope.row.r1
  294. }}</span>
  295. <el-input
  296. v-if="scope.row.Edit || isproportion"
  297. v-model="scope.row.r1"
  298. :disabled="scope.row.isOneWeight"
  299. step="0.01"
  300. type="number"
  301. style="width: 100%; padding: 10px 0"
  302. @blur="blurR(scope.row, 1)"
  303. :placeholder="scope.row.placeholder_r1"
  304. @focus="focusData(scope.row)"
  305. />
  306. </template>
  307. </el-table-column>
  308. <el-table-column
  309. v-if="table.isRW1"
  310. :key="9"
  311. :label="$t('dhedFormula.dybzl1')"
  312. min-width="100px"
  313. align="center"
  314. :render-header="renderHeader"
  315. >
  316. <template slot-scope="scope">
  317. <span v-if="scope.row.NoEdit">{{ scope.row.w1 }}</span>
  318. <el-input
  319. v-if="scope.row.Edit"
  320. v-model="scope.row.w1"
  321. :disabled="scope.row.isOneWeight"
  322. step="0.01"
  323. type="number"
  324. style="width: 100%; padding: 10px 0"
  325. @blur="blurWeight(scope.row, 1)"
  326. :placeholder="scope.row.placeholder_w1"
  327. />
  328. </template>
  329. </el-table-column>
  330. <el-table-column
  331. v-if="table.isRW1 && table.isPtsfname"
  332. :key="10"
  333. label="第一班补料重量"
  334. min-width="100px"
  335. align="center"
  336. >
  337. <template slot-scope="scope">
  338. <span v-if="scope.row.NoEdit && !isproportion">{{
  339. scope.row.bw1
  340. }}</span>
  341. <el-input
  342. v-if="scope.row.Edit"
  343. v-model="scope.row.bw1"
  344. :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''"
  345. step="0.01"
  346. type="number"
  347. style="width: 100%; padding: 10px 0"
  348. @blur="blurBw(scope.row)"
  349. :placeholder="scope.row.placeholder_bw1"
  350. />
  351. </template>
  352. </el-table-column>
  353. <el-table-column
  354. v-if="table.isRW2"
  355. :key="11"
  356. :label="$t('dhedFormula.dybbl2')"
  357. min-width="85px"
  358. align="center"
  359. >
  360. <template slot-scope="scope">
  361. <span v-if="scope.row.NoEdit && !isproportion">{{
  362. scope.row.r2
  363. }}</span>
  364. <el-input
  365. v-if="scope.row.Edit || isproportion"
  366. v-model="scope.row.r2"
  367. step="0.01"
  368. type="number"
  369. :disabled="scope.row.isTwoWeight"
  370. style="width: 100%; padding: 10px 0"
  371. @blur="blurR(scope.row, 2)"
  372. :placeholder="scope.row.placeholder_r2"
  373. @focus="focusData(scope.row)"
  374. />
  375. </template>
  376. </el-table-column>
  377. <el-table-column
  378. v-if="table.isRW2"
  379. :key="12"
  380. :label="$t('dhedFormula.dybzl2')"
  381. min-width="100px"
  382. align="center"
  383. :render-header="renderHeader"
  384. >
  385. <template slot-scope="scope">
  386. <span v-if="scope.row.NoEdit">{{ scope.row.w2 }}</span>
  387. <el-input
  388. v-if="scope.row.Edit"
  389. v-model="scope.row.w2"
  390. :disabled="scope.row.isTwoWeight"
  391. step="0.01"
  392. type="number"
  393. style="width: 100%; padding: 10px 0"
  394. @blur="blurWeight(scope.row, 2)"
  395. :placeholder="scope.row.placeholder_w2"
  396. />
  397. </template>
  398. </el-table-column>
  399. <el-table-column
  400. v-if="table.isRW2 && table.isPtsfname"
  401. :key="13"
  402. label="第二班补料重量"
  403. min-width="100px"
  404. align="center"
  405. >
  406. <template slot-scope="scope">
  407. <span v-if="scope.row.NoEdit">{{ scope.row.bw2 }}</span>
  408. <el-input
  409. v-if="scope.row.Edit"
  410. v-model="scope.row.bw2"
  411. :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''"
  412. step="0.01"
  413. type="number"
  414. style="width: 100%; padding: 10px 0"
  415. @blur="blurBw(scope.row)"
  416. :placeholder="scope.row.placeholder_bw2"
  417. />
  418. </template>
  419. </el-table-column>
  420. <el-table-column
  421. v-if="table.isRW3"
  422. :key="14"
  423. :label="$t('dhedFormula.dybbl3')"
  424. min-width="85px"
  425. align="center"
  426. >
  427. <template slot-scope="scope">
  428. <span v-if="scope.row.NoEdit && !isproportion">{{
  429. scope.row.r3
  430. }}</span>
  431. <el-input
  432. v-if="scope.row.Edit || isproportion"
  433. v-model="scope.row.r3"
  434. step="0.01"
  435. type="number"
  436. :disabled="scope.row.isThreeWeight"
  437. style="width: 100%; padding: 10px 0"
  438. @blur="blurR(scope.row, 3)"
  439. :placeholder="scope.row.placeholder_r3"
  440. @focus="focusData(scope.row)"
  441. />
  442. </template>
  443. </el-table-column>
  444. <el-table-column
  445. v-if="table.isRW3"
  446. :key="15"
  447. :label="$t('dhedFormula.dybzl3')"
  448. min-width="100px"
  449. align="center"
  450. :render-header="renderHeader"
  451. >
  452. <template slot-scope="scope">
  453. <span v-if="scope.row.NoEdit">{{ scope.row.w3 }}</span>
  454. <el-input
  455. v-if="scope.row.Edit"
  456. v-model="scope.row.w3"
  457. :disabled="scope.row.isThreeWeight"
  458. step="0.01"
  459. type="number"
  460. style="width: 100%; padding: 10px 0"
  461. @blur="blurWeight(scope.row, 3)"
  462. :placeholder="scope.row.placeholder_w3"
  463. />
  464. </template>
  465. </el-table-column>
  466. <el-table-column
  467. v-if="table.isRW3 && table.isPtsfname"
  468. :key="16"
  469. label="第三班补料重量"
  470. min-width="100px"
  471. align="center"
  472. >
  473. <template slot-scope="scope">
  474. <span v-if="scope.row.NoEdit">{{ scope.row.bw3 }}</span>
  475. <el-input
  476. v-if="scope.row.Edit"
  477. v-model="scope.row.bw3"
  478. :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''"
  479. step="0.01"
  480. type="number"
  481. style="width: 100%; padding: 10px 0"
  482. @blur="blurBw(scope.row)"
  483. :placeholder="scope.row.placeholder_bw3"
  484. />
  485. </template>
  486. </el-table-column>
  487. <el-table-column
  488. v-if="table.isRW4"
  489. :key="17"
  490. :label="$t('dhedFormula.dybbl4')"
  491. min-width="85px"
  492. align="center"
  493. >
  494. <template slot-scope="scope">
  495. <span v-if="scope.row.NoEdit && !isproportion">{{
  496. scope.row.r4
  497. }}</span>
  498. <el-input
  499. v-if="scope.row.Edit || isproportion"
  500. v-model="scope.row.r4"
  501. step="0.01"
  502. type="number"
  503. :disabled="scope.row.isFourWeight"
  504. style="width: 100%; padding: 10px 0"
  505. @blur="blurR(scope.row, 4)"
  506. :placeholder="scope.row.placeholder_r4"
  507. @focus="focusData(scope.row)"
  508. />
  509. </template>
  510. </el-table-column>
  511. <el-table-column
  512. v-if="table.isRW4"
  513. :key="18"
  514. :label="$t('dhedFormula.dybzl4')"
  515. min-width="100px"
  516. align="center"
  517. :render-header="renderHeader"
  518. >
  519. <template slot-scope="scope">
  520. <span v-if="scope.row.NoEdit">{{ scope.row.w4 }}</span>
  521. <el-input
  522. v-if="scope.row.Edit"
  523. v-model="scope.row.w4"
  524. :disabled="scope.row.isFourWeight"
  525. step="0.01"
  526. type="number"
  527. style="width: 100%; padding: 10px 0; padding: 10px 0"
  528. @blur="blurWeight(scope.row, 4)"
  529. :placeholder="scope.row.placeholder_w4"
  530. />
  531. </template>
  532. </el-table-column>
  533. <el-table-column
  534. v-if="table.isRW4 && table.isPtsfname"
  535. :key="19"
  536. label="第四班补料重量"
  537. min-width="90px"
  538. align="center"
  539. >
  540. <template slot-scope="scope">
  541. <span v-if="scope.row.NoEdit">{{ scope.row.bw4 }}</span>
  542. <el-input
  543. v-if="scope.row.Edit"
  544. v-model="scope.row.bw4"
  545. :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''"
  546. step="0.01"
  547. type="number"
  548. style="width: 100%; padding: 10px 0"
  549. @blur="blurBw(scope.row)"
  550. :placeholder="scope.row.placeholder_bw4"
  551. />
  552. </template>
  553. </el-table-column>
  554. <el-table-column
  555. v-if="table.isRW5"
  556. :key="20"
  557. label="第五班比例(%)"
  558. min-width="85px"
  559. align="center"
  560. >
  561. <template slot-scope="scope">
  562. <span v-if="scope.row.NoEdit && !isproportion">{{
  563. scope.row.r5
  564. }}</span>
  565. <el-input
  566. v-if="scope.row.Edit || isproportion"
  567. v-model="scope.row.r5"
  568. step="0.01"
  569. type="number"
  570. :disabled="scope.row.isFiveWeight"
  571. style="width: 100%; padding: 10px 0"
  572. @blur="blurR(scope.row, 5)"
  573. :placeholder="scope.row.placeholder_r5"
  574. @focus="focusData(scope.row)"
  575. />
  576. </template>
  577. </el-table-column>
  578. <el-table-column
  579. v-if="table.isRW5"
  580. :key="21"
  581. label="第五班重量"
  582. min-width="100px"
  583. align="center"
  584. :render-header="renderHeader"
  585. >
  586. <template slot-scope="scope">
  587. <span v-if="scope.row.NoEdit">{{ scope.row.w5 }}</span>
  588. <el-input
  589. v-if="scope.row.Edit"
  590. v-model="scope.row.w5"
  591. :disabled="scope.row.isFiveWeight"
  592. step="0.01"
  593. type="number"
  594. style="width: 100%; padding: 10px 0; padding: 10px 0"
  595. @blur="blurWeight(scope.row, 5)"
  596. :placeholder="scope.row.placeholder_w5"
  597. />
  598. </template>
  599. </el-table-column>
  600. <el-table-column
  601. v-if="table.isRW5 && table.isPtsfname"
  602. :key="22"
  603. label="第五班补料重量"
  604. min-width="90px"
  605. align="center"
  606. >
  607. <template slot-scope="scope">
  608. <span v-if="scope.row.NoEdit">{{ scope.row.bw5 }}</span>
  609. <el-input
  610. v-if="scope.row.Edit"
  611. v-model="scope.row.bw5"
  612. :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''"
  613. step="0.01"
  614. type="number"
  615. style="width: 100%; padding: 10px 0"
  616. @blur="blurBw(scope.row)"
  617. :placeholder="scope.row.placeholder_bw5"
  618. />
  619. </template>
  620. </el-table-column>
  621. <el-table-column
  622. v-if="table.isRW6"
  623. :key="23"
  624. label="第六班比例(%)"
  625. min-width="85px"
  626. align="center"
  627. >
  628. <template slot-scope="scope">
  629. <span v-if="scope.row.NoEdit && !isproportion">{{
  630. scope.row.r6
  631. }}</span>
  632. <el-input
  633. v-if="scope.row.Edit || isproportion"
  634. v-model="scope.row.r6"
  635. step="0.01"
  636. type="number"
  637. :disabled="scope.row.isSixWeight"
  638. style="width: 100%; padding: 10px 0"
  639. @blur="blurR(scope.row, 6)"
  640. :placeholder="scope.row.placeholder_r6"
  641. @focus="focusData(scope.row)"
  642. />
  643. </template>
  644. </el-table-column>
  645. <el-table-column
  646. v-if="table.isRW6"
  647. :key="24"
  648. label="第六班重量"
  649. min-width="100px"
  650. align="center"
  651. :render-header="renderHeader"
  652. >
  653. <template slot-scope="scope">
  654. <span v-if="scope.row.NoEdit">{{ scope.row.w6 }}</span>
  655. <el-input
  656. v-if="scope.row.Edit"
  657. v-model="scope.row.w6"
  658. :disabled="scope.row.isSixWeight"
  659. step="0.01"
  660. type="number"
  661. style="width: 100%; padding: 10px 0; padding: 10px 0"
  662. @blur="blurWeight(scope.row, 6)"
  663. :placeholder="scope.row.placeholder_w6"
  664. />
  665. </template>
  666. </el-table-column>
  667. <el-table-column
  668. v-if="table.isRW6 && table.isPtsfname"
  669. :key="25"
  670. label="第六班补料重量"
  671. min-width="90px"
  672. align="center"
  673. >
  674. <template slot-scope="scope">
  675. <span v-if="scope.row.NoEdit">{{ scope.row.bw6 }}</span>
  676. <el-input
  677. v-if="scope.row.Edit"
  678. v-model="scope.row.bw6"
  679. :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''"
  680. step="0.01"
  681. type="number"
  682. style="width: 100%; padding: 10px 0"
  683. @blur="blurBw(scope.row)"
  684. :placeholder="scope.row.placeholder_bw6"
  685. />
  686. </template>
  687. </el-table-column>
  688. <el-table-column
  689. :key="26"
  690. :label="$t('dhedFormula.swzbl')"
  691. min-width="60px"
  692. align="center"
  693. >
  694. <template slot-scope="scope">
  695. <span>{{ scope.row.sumr }}</span>
  696. </template>
  697. </el-table-column>
  698. <el-table-column
  699. :key="27"
  700. :label="$t('dhedFormula.swtwl')"
  701. min-width="60px"
  702. align="center"
  703. >
  704. <template slot-scope="scope">
  705. <span>{{ scope.row.todayweight }}</span>
  706. </template>
  707. </el-table-column>
  708. <el-table-column
  709. :key="28"
  710. :label="$t('dhedFormula.swpfzl')"
  711. min-width="60px"
  712. align="center"
  713. >
  714. <template slot-scope="scope">
  715. <span>{{ scope.row.ftweight }}</span>
  716. </template>
  717. </el-table-column>
  718. <el-table-column
  719. v-if="table.isPtsfname"
  720. :key="29"
  721. :label="$t('dhedFormula.blpfzl')"
  722. min-width="60px"
  723. align="center"
  724. >
  725. <template slot-scope="scope">
  726. <span>{{ scope.row.supplyweight }}</span>
  727. </template>
  728. </el-table-column>
  729. <!-- <el-table-column :key="22" label="投喂量" min-width="80px" align="center">
  730. <template slot-scope="scope">
  731. <span>{{ scope.row.feedweight }}</span>
  732. </template>
  733. </el-table-column> -->
  734. <el-table-column
  735. v-if="table.isPtsfname"
  736. :key="30"
  737. :label="$t('dhedFormula.bltwl')"
  738. min-width="60px"
  739. align="center"
  740. >
  741. <template slot-scope="scope">
  742. <span>{{ scope.row.todaysupplement }}</span>
  743. </template>
  744. </el-table-column>
  745. <el-table-column
  746. :key="31"
  747. :label="$t('dhedFormula.rtwl')"
  748. min-width="60px"
  749. align="center"
  750. >
  751. <template slot-scope="scope">
  752. <span>{{ scope.row.todayfeed }}</span>
  753. </template>
  754. </el-table-column>
  755. <el-table-column
  756. :key="32"
  757. :label="$t('dhedFormula.pfgwzzl')"
  758. min-width="60px"
  759. align="center"
  760. >
  761. <template slot-scope="scope">
  762. <span>{{ scope.row.dryweight }}</span>
  763. </template>
  764. </el-table-column>
  765. <el-table-column
  766. :label="$t('errorAnalysis.cz')"
  767. align="center"
  768. width="80"
  769. class-name="small-padding fixed-width"
  770. fixed="right"
  771. >
  772. <template slot-scope="{ row }">
  773. <el-button
  774. v-if="row.isUpdate && isRoleEdit"
  775. :disabled="isproportion"
  776. class="miniSuccess"
  777. icon="el-icon-edit-outline"
  778. @click="handleUpdate(row)"
  779. />
  780. <el-button
  781. v-if="row.isUpdateSave && isRoleEdit"
  782. :disabled="isokDisable"
  783. icon="el-icon-folder-checked"
  784. class="miniSuccess"
  785. @click="updateData(row)"
  786. />
  787. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan"
  788. >|</span
  789. >
  790. <el-button
  791. v-if="row.isUpdateSave && isRoleEdit"
  792. class="minCancel"
  793. icon="el-icon-close"
  794. @click="updateCancel(row)"
  795. />
  796. </template>
  797. </el-table-column>
  798. </el-table>
  799. <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
  800. </div>
  801. <!-- 历史记录 -->
  802. <el-dialog
  803. :fullscreen="dialogFull"
  804. :destroy-on-close="true"
  805. :visible.sync="history.dialogFormVisible"
  806. :close-on-click-modal="false"
  807. width="90%"
  808. >
  809. <template slot="title">
  810. <div class="avue-crud__dialog__header">
  811. <span class="el-dialog__title">
  812. <span
  813. style="
  814. display: inline-block;
  815. width: 3px;
  816. height: 20px;
  817. margin-right: 5px;
  818. float: left;
  819. margin-top: 2px;
  820. "
  821. />
  822. {{ textMap[history.dialogStatus] }}
  823. </span>
  824. <div
  825. class="avue-crud__dialog__menu"
  826. @click="dialogFull ? (dialogFull = false) : (dialogFull = true)"
  827. >
  828. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  829. <svg-icon v-else icon-class="fullscreen" />
  830. </div>
  831. </div>
  832. </template>
  833. <div class="app-history">
  834. <div class="search">
  835. <el-date-picker
  836. v-model="history.getdataListParm.parammaps.date"
  837. type="date"
  838. :placeholder="$t('formulationEvaluation.lssjjl')"
  839. :clearable="false"
  840. style="width: 180px"
  841. format="yyyy-MM-dd"
  842. value-format="yyyy-MM-dd"
  843. @change="changeDate"
  844. />
  845. <!-- <el-select v-model="history.getdataListParm.parammaps.barid" clearable filterable :placeholder="$t('formulationEvaluation.xzls')" style="width: 180px;" class="filter-item">
  846. <el-option v-for="item in barList" :key="item.id" :label="item.bname" :value="item.id" />
  847. </el-select>
  848. <el-input v-model="history.getdataListParm.parammaps.tname" :placeholder="$t('formulationEvaluation.qsrpfmc')" style="width: 180px;" class="filter-item" />
  849. <el-button class="successBorder" @click="handleHistorySearch">{{$t('common.query')}}</el-button> -->
  850. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  851. </div>
  852. <div class="table">
  853. <u-table
  854. :key="history.tableKey"
  855. v-loading="history.listLoading"
  856. :element-loading-text="$t('common.tableMsg')"
  857. :data="history.list"
  858. border
  859. fit
  860. highlight-current-row
  861. style="width: 100%"
  862. :row-style="rowStyle"
  863. :cell-style="cellStyle"
  864. class="elTable table-fixed"
  865. :span-method="objectSpanMethod"
  866. :max-height="500"
  867. >
  868. <u-table-column>
  869. <template slot="empty">
  870. <span style="color: #969799">No Data</span>
  871. </template>
  872. </u-table-column>
  873. <u-table-column
  874. :key="1"
  875. :label="$t('formulationEvaluation.xh')"
  876. align="center"
  877. type="index"
  878. width="50px"
  879. class-name="small-padding fixed-width"
  880. fixed="left"
  881. />
  882. <!-- <u-table-column :key="1" :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left">
  883. <template slot-scope="scope">
  884. <span>{{ scope.$index + (history.pageNum-1) * history.pageSize + 1 }}</span>
  885. </template>
  886. </u-table-column> -->
  887. <u-table-column
  888. :key="2"
  889. :label="$t('errorAnalysis.isHouseName')"
  890. prop="barname"
  891. min-width="90px"
  892. align="center"
  893. class-name="small-padding fixed-width"
  894. fixed="left"
  895. />
  896. <u-table-column
  897. :key="3"
  898. :label="$t('errorAnalysis.isTrainNumber')"
  899. prop="times"
  900. min-width="90px"
  901. align="center"
  902. class-name="small-padding fixed-width"
  903. fixed="left"
  904. />
  905. <u-table-column
  906. :key="4"
  907. :label="$t('dhedFormula.rjnts')"
  908. prop="softccount"
  909. min-width="70px"
  910. align="center"
  911. />
  912. <u-table-column
  913. :key="5"
  914. :label="$t('feedingEfficiency.sjnts')"
  915. prop="ccount"
  916. min-width="70px"
  917. align="center"
  918. />
  919. <u-table-column
  920. :key="6"
  921. :label="$t('dhedFormula.xs')"
  922. prop="ratio"
  923. min-width="70px"
  924. align="center"
  925. />
  926. <u-table-column
  927. :key="7"
  928. :label="$t('dhedFormula.xsts')"
  929. prop="ccountratio"
  930. min-width="70px"
  931. align="center"
  932. />
  933. <u-table-column
  934. :key="8"
  935. :label="$t('feedingEfficiency.pfmb')"
  936. prop="ptname"
  937. min-width="70px"
  938. align="center"
  939. />
  940. <u-table-column
  941. v-if="table.isPtsfname"
  942. :key="9"
  943. :label="$t('dhedFormula.blpf')"
  944. prop="ptsname"
  945. min-width="70px"
  946. align="center"
  947. />
  948. <u-table-column
  949. :key="10"
  950. :label="$t('dhedFormula.bcbl')"
  951. prop="tratio"
  952. min-width="70px"
  953. align="center"
  954. />
  955. <u-table-column
  956. :key="11"
  957. :label="$t('dhedFormula.bczl')"
  958. prop="weight"
  959. min-width="70px"
  960. align="center"
  961. />
  962. <u-table-column
  963. :key="12"
  964. :label="$t('dhedFormula.pfzl')"
  965. prop="pweight"
  966. min-width="70px"
  967. align="center"
  968. />
  969. <u-table-column
  970. v-if="table.isPtsfname"
  971. :key="13"
  972. :label="$t('dhedFormula.blzl')"
  973. prop="ptweight"
  974. min-width="70px"
  975. align="center"
  976. />
  977. <u-table-column
  978. :key="14"
  979. :label="$t('dhedFormula.pfgwzzl')"
  980. prop="dryweight"
  981. min-width="70px"
  982. align="center"
  983. />
  984. <u-table-column
  985. :key="15"
  986. :label="$t('dhedFormula.swgwzl')"
  987. prop="swdryw"
  988. min-width="70px"
  989. align="center"
  990. />
  991. <u-table-column
  992. :key="16"
  993. :label="$t('dhedFormula.cygwzl')"
  994. prop="cydryw"
  995. min-width="70px"
  996. align="center"
  997. />
  998. <u-table-column
  999. :key="17"
  1000. :label="$t('dhedFormula.rtwl')"
  1001. prop="sumweight"
  1002. min-width="70px"
  1003. align="center"
  1004. />
  1005. <u-table-column
  1006. :key="18"
  1007. :label="$t('errorAnalysis.cz')"
  1008. prop="sumweight"
  1009. align="center"
  1010. width="80"
  1011. class-name="small-padding fixed-width"
  1012. fixed="right"
  1013. >
  1014. <template slot-scope="scope">
  1015. <span style="color: blue" @click="handleRestore(scope.row)"
  1016. >{{ $t('message.msg334') }}</span
  1017. >
  1018. </template>
  1019. </u-table-column>
  1020. </u-table>
  1021. <!-- <pagination2 v-show="history.total>0" :total="history.total" :page.sync="history.getdataListParm.offset" :limit.sync="history.getdataListParm.pagecount" @pagination="getHistoryList" /> -->
  1022. </div>
  1023. </div>
  1024. <div slot="footer" class="dialog-footer" style="bottom: 10px">
  1025. <el-button
  1026. class="cancelClose cancelClose1"
  1027. @click="
  1028. history.dialogFormVisible = false
  1029. getList()
  1030. "
  1031. >{{ $t('common.closed') }}</el-button
  1032. >
  1033. </div>
  1034. </el-dialog>
  1035. <!-- 营养评估 -->
  1036. <el-dialog
  1037. :fullscreen="dialogFull"
  1038. :visible.sync="nutritional.dialogFormVisible"
  1039. :close-on-click-modal="false"
  1040. width="90%"
  1041. >
  1042. <template slot="title">
  1043. <div class="avue-crud__dialog__header">
  1044. <span class="el-dialog__title">
  1045. <span
  1046. style="
  1047. display: inline-block;
  1048. width: 3px;
  1049. height: 20px;
  1050. margin-right: 5px;
  1051. float: left;
  1052. margin-top: 2px;
  1053. "
  1054. />
  1055. {{ textMap[nutritional.dialogStatus] }}
  1056. </span>
  1057. <div
  1058. class="avue-crud__dialog__menu"
  1059. @click="dialogFull ? (dialogFull = false) : (dialogFull = true)"
  1060. >
  1061. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  1062. <svg-icon v-else icon-class="fullscreen" />
  1063. </div>
  1064. </div>
  1065. </template>
  1066. <div class="app-nutritional">
  1067. <h4
  1068. style="
  1069. position: absolute;
  1070. top: -5px;
  1071. left: 140px;
  1072. font: 16px/30px '';
  1073. color: #303133;
  1074. "
  1075. >
  1076. 栏舍:{{ nutritional.tab1.temp.barname }}
  1077. </h4>
  1078. <el-tabs
  1079. v-model="nutritional.activeName"
  1080. @tab-click="handleNutritionalTab"
  1081. >
  1082. <el-tab-pane :label="$t('dhedFormula.yypg')" name="first">
  1083. <el-form
  1084. ref="temp"
  1085. :rules="rules"
  1086. :model="nutritional.tab1.temp"
  1087. label-position="right"
  1088. label-width="95px"
  1089. style="width: 100%; margin-bottom: 30px"
  1090. >
  1091. <el-row>
  1092. <el-col :span="4">
  1093. <el-form-item :label="$t('dhedFormula.lb')" prop="cowclassid">
  1094. <el-select
  1095. v-model="nutritional.tab1.temp.cowclassid"
  1096. :disabled="nutritional.tab1.disabledCowclass"
  1097. filterable
  1098. placeholder=""
  1099. class="filter-item"
  1100. style="width: 100%"
  1101. >
  1102. <el-option
  1103. v-for="item in livestockTypeList"
  1104. :key="item.id"
  1105. :label="item.mixname"
  1106. :value="item.id"
  1107. />
  1108. </el-select>
  1109. </el-form-item>
  1110. </el-col>
  1111. <el-col :span="4">
  1112. <el-form-item
  1113. :label="$t('dhedFormula.yl')"
  1114. prop="avgmonthage"
  1115. >
  1116. <el-input
  1117. ref="avgmonthage"
  1118. v-model="nutritional.tab1.temp.avgmonthage"
  1119. class="filter-item"
  1120. placeholder=""
  1121. style="width: 100%"
  1122. />
  1123. </el-form-item>
  1124. </el-col>
  1125. <el-col :span="4">
  1126. <el-form-item :label="$t('dhedFormula.tz')" prop="bw">
  1127. <el-input
  1128. ref="bw"
  1129. v-model="nutritional.tab1.temp.bw"
  1130. class="filter-item"
  1131. placeholder=""
  1132. style="width: 100%"
  1133. />
  1134. </el-form-item>
  1135. </el-col>
  1136. <el-col :span="4">
  1137. <el-form-item :label="$t('dhedFormula.rzz')" prop="dayw">
  1138. <el-input
  1139. ref="dayw"
  1140. v-model="nutritional.tab1.temp.dayw"
  1141. class="filter-item"
  1142. placeholder=""
  1143. style="width: 100%"
  1144. />
  1145. </el-form-item>
  1146. </el-col>
  1147. <el-col :span="4">
  1148. <el-form-item :label="$t('dhedFormula.tcc')" prop="fetal">
  1149. <el-input
  1150. ref="fetal"
  1151. v-model="nutritional.tab1.temp.fetal"
  1152. class="filter-item"
  1153. placeholder=""
  1154. style="width: 100%"
  1155. />
  1156. </el-form-item>
  1157. </el-col>
  1158. <el-col :span="4">
  1159. <el-form-item :label="$t('dhedFormula.mrtst')" prop="avgdim">
  1160. <el-input
  1161. ref="avgdim"
  1162. v-model="nutritional.tab1.temp.avgdim"
  1163. class="filter-item"
  1164. placeholder=""
  1165. style="width: 100%"
  1166. />
  1167. </el-form-item>
  1168. </el-col>
  1169. </el-row>
  1170. <el-row>
  1171. <el-col :span="4">
  1172. <el-form-item :label="$t('dhedFormula.hytst')" prop="dayspre">
  1173. <el-input
  1174. ref="dayspre"
  1175. v-model="nutritional.tab1.temp.dayspre"
  1176. class="filter-item"
  1177. placeholder=""
  1178. style="width: 100%"
  1179. />
  1180. </el-form-item>
  1181. </el-col>
  1182. <el-col :span="4">
  1183. <el-form-item label="产奶量(kg)" prop="product">
  1184. <el-input
  1185. ref="product"
  1186. v-model="nutritional.tab1.temp.product"
  1187. class="filter-item"
  1188. placeholder=""
  1189. style="width: 100%"
  1190. />
  1191. </el-form-item>
  1192. </el-col>
  1193. <el-col :span="4">
  1194. <el-form-item :label="$t('dhedFormula.rzl')" prop="fat">
  1195. <el-input
  1196. ref="fat"
  1197. v-model="nutritional.tab1.temp.fat"
  1198. class="filter-item"
  1199. placeholder=""
  1200. style="width: 100%"
  1201. />
  1202. </el-form-item>
  1203. </el-col>
  1204. <el-col :span="4">
  1205. <el-form-item :label="$t('dhedFormula.rzdbl')" prop="pro">
  1206. <el-input
  1207. ref="pro"
  1208. v-model="nutritional.tab1.temp.pro"
  1209. class="filter-item"
  1210. placeholder=""
  1211. style="width: 100%"
  1212. />
  1213. </el-form-item>
  1214. </el-col>
  1215. <el-col :span="4">
  1216. <el-form-item :label="$t('dhedFormula.rtl')" prop="lactose">
  1217. <el-input
  1218. ref="lactose"
  1219. v-model="nutritional.tab1.temp.lactose"
  1220. class="filter-item"
  1221. placeholder=""
  1222. style="width: 100%"
  1223. />
  1224. </el-form-item>
  1225. </el-col>
  1226. <el-col :span="4">
  1227. <el-form-item :label="$t('dhedFormula.wd')" prop="tem">
  1228. <el-input
  1229. ref="tem"
  1230. v-model="nutritional.tab1.temp.tem"
  1231. class="filter-item"
  1232. placeholder=""
  1233. style="width: 100%"
  1234. />
  1235. </el-form-item>
  1236. </el-col>
  1237. </el-row>
  1238. </el-form>
  1239. <div style="height: 50px">
  1240. <el-date-picker
  1241. v-model="nutritional.tab1.inputDatetime"
  1242. :picker-options="pickerOptions"
  1243. class="inputDatetime filter-item"
  1244. :clearable="false"
  1245. type="daterange"
  1246. :range-separator="$t('common.to')"
  1247. :start-placeholder="$t('common.startTime')"
  1248. :end-placeholder="$t('common.endTime')"
  1249. style="width: 250px; margin-right: 10px"
  1250. />
  1251. <el-button
  1252. class="el-icon-arrow-left elIconArrowLeft"
  1253. @click="handleBefore"
  1254. />
  1255. <el-button
  1256. class="el-icon-arrow-right elIconArrowRight"
  1257. @click="handleNext"
  1258. />
  1259. <el-button
  1260. class="successBorder"
  1261. :disabled="isokDisable"
  1262. @click="assessmentData()"
  1263. >{{ $t('dhedFormula.pg') }}</el-button
  1264. >
  1265. </div>
  1266. <div class="table">
  1267. <el-table
  1268. :key="nutritional.tab1.tableKey"
  1269. v-loading="nutritional.tab1.listLoading"
  1270. :element-loading-text="$t('common.tableMsg')"
  1271. :data="nutritional.tab1.list"
  1272. border
  1273. fit
  1274. highlight-current-row
  1275. style="width: 100%; margin-bottom: 60px"
  1276. :row-style="rowStyle"
  1277. :cell-style="cellStyle"
  1278. class="elTable table-fixed"
  1279. :row-class-name="tableRowClassName"
  1280. >
  1281. <el-table-column
  1282. :label="$t('formulationEvaluation.xh')"
  1283. align="center"
  1284. type="index"
  1285. width="50px"
  1286. />
  1287. <el-table-column label="指标" min-width="130px" align="center">
  1288. <template slot-scope="scope">
  1289. <span>{{ scope.row.standard }}</span>
  1290. </template>
  1291. </el-table-column>
  1292. <el-table-column
  1293. :label="$t('formulationEvaluation.nnxq')"
  1294. min-width="130px"
  1295. align="center"
  1296. >
  1297. <template slot-scope="scope">
  1298. <span>{{ scope.row.cowneed }}</span>
  1299. </template>
  1300. </el-table-column>
  1301. <el-table-column
  1302. :label="$t('formulationEvaluation.pfl')"
  1303. min-width="130px"
  1304. align="center"
  1305. >
  1306. <template slot-scope="scope">
  1307. <span>{{ scope.row.ftpro }}</span>
  1308. </template>
  1309. </el-table-column>
  1310. <el-table-column
  1311. :label="$t('formulationEvaluation.tmrl')"
  1312. min-width="130px"
  1313. align="center"
  1314. >
  1315. <template slot-scope="scope">
  1316. <span>{{ scope.row.hprov }}</span>
  1317. </template>
  1318. </el-table-column>
  1319. <el-table-column
  1320. :label="$t('formulationEvaluation.csl')"
  1321. min-width="130px"
  1322. align="center"
  1323. >
  1324. <template slot-scope="scope">
  1325. <span>{{ scope.row.sprov }}</span>
  1326. </template>
  1327. </el-table-column>
  1328. </el-table>
  1329. </div>
  1330. </el-tab-pane>
  1331. <el-tab-pane :label="$t('feedingEfficiency.nxpg')" name="second">
  1332. <el-date-picker
  1333. v-model="nutritional.tab2.inputDatetime"
  1334. :picker-options="pickerOptions"
  1335. :clearable="false"
  1336. class="inputDatetime filter-item"
  1337. type="daterange"
  1338. :range-separator="$t('common.to')"
  1339. :start-placeholder="$t('common.startTime')"
  1340. :end-placeholder="$t('common.endTime')"
  1341. style="width: 250px; margin-right: 10px"
  1342. @change="changeTab2Date"
  1343. />
  1344. <el-button
  1345. class="el-icon-arrow-left elIconArrowLeft"
  1346. @click="handleBefore"
  1347. />
  1348. <el-button
  1349. class="el-icon-arrow-right elIconArrowRight"
  1350. @click="handleNext"
  1351. />
  1352. <el-row>
  1353. <el-col :span="24">
  1354. <h3 style="text-align: center">
  1355. {{ $t('dhedFormula.bzsfx') }}
  1356. </h3>
  1357. <div class="table">
  1358. <el-table
  1359. :key="nutritional.tab2.tableKey1"
  1360. v-loading="nutritional.tab2.listLoading1"
  1361. :element-loading-text="$t('common.tableMsg')"
  1362. :data="nutritional.tab2.list1"
  1363. border
  1364. fit
  1365. highlight-current-row
  1366. style="width: 100%; margin-bottom: 60px"
  1367. :row-style="rowStyle"
  1368. :cell-style="cellStyle"
  1369. class="elTable table-fixed"
  1370. >
  1371. <el-table-column
  1372. :label="$t('errorAnalysis.date')"
  1373. min-width="130px"
  1374. align="center"
  1375. >
  1376. <template slot-scope="scope">
  1377. <span>{{ scope.row.operatetime }}</span>
  1378. </template>
  1379. </el-table-column>
  1380. <el-table-column
  1381. :label="$t('dhedFormula.dyczl1')"
  1382. min-width="130px"
  1383. align="center"
  1384. >
  1385. <template slot-scope="scope">
  1386. <span>{{ scope.row.oneweight }}</span>
  1387. </template>
  1388. </el-table-column>
  1389. <el-table-column
  1390. :label="$t('feedingEfficiency.dcbfb1')"
  1391. min-width="130px"
  1392. align="center"
  1393. >
  1394. <template slot-scope="scope">
  1395. <span>{{ scope.row.onerate }}</span>
  1396. </template>
  1397. </el-table-column>
  1398. <el-table-column
  1399. :label="$t('dhedFormula.dyczl2')"
  1400. min-width="130px"
  1401. align="center"
  1402. >
  1403. <template slot-scope="scope">
  1404. <span>{{ scope.row.twoweight }}</span>
  1405. </template>
  1406. </el-table-column>
  1407. <el-table-column
  1408. :label="$t('feedingEfficiency.dcbfb2')"
  1409. min-width="130px"
  1410. align="center"
  1411. >
  1412. <template slot-scope="scope">
  1413. <span>{{ scope.row.tworate }}</span>
  1414. </template>
  1415. </el-table-column>
  1416. <el-table-column
  1417. :label="$t('dhedFormula.dyczl3')"
  1418. min-width="130px"
  1419. align="center"
  1420. >
  1421. <template slot-scope="scope">
  1422. <span>{{ scope.row.threeweight }}</span>
  1423. </template>
  1424. </el-table-column>
  1425. <el-table-column
  1426. :label="$t('feedingEfficiency.dcbfb3')"
  1427. min-width="130px"
  1428. align="center"
  1429. >
  1430. <template slot-scope="scope">
  1431. <span>{{ scope.row.threerate }}</span>
  1432. </template>
  1433. </el-table-column>
  1434. <el-table-column
  1435. :label="$t('dhedFormula.dyczl4')"
  1436. min-width="130px"
  1437. align="center"
  1438. >
  1439. <template slot-scope="scope">
  1440. <span>{{ scope.row.fourweight }}</span>
  1441. </template>
  1442. </el-table-column>
  1443. <el-table-column
  1444. :label="$t('feedingEfficiency.dcbfb4')"
  1445. min-width="130px"
  1446. align="center"
  1447. >
  1448. <template slot-scope="scope">
  1449. <span>{{ scope.row.fourrate }}</span>
  1450. </template>
  1451. </el-table-column>
  1452. <el-table-column
  1453. :label="$t('feedingEfficiency.ckbz')"
  1454. min-width="130px"
  1455. align="center"
  1456. >
  1457. <template slot-scope="scope">
  1458. <span>{{ scope.row.standard }}</span>
  1459. </template>
  1460. </el-table-column>
  1461. </el-table>
  1462. </div>
  1463. </el-col>
  1464. </el-row>
  1465. <el-row>
  1466. <el-col :span="24">
  1467. <h3 style="text-align: center">
  1468. {{ $t('feedingEfficiency.fbsfx') }}
  1469. </h3>
  1470. <div class="table">
  1471. <el-table
  1472. :key="nutritional.tab2.tableKey2"
  1473. v-loading="nutritional.tab2.listLoading2"
  1474. :element-loading-text="$t('common.tableMsg')"
  1475. :data="nutritional.tab2.list2"
  1476. border
  1477. fit
  1478. highlight-current-row
  1479. style="width: 100%; margin-bottom: 60px"
  1480. :row-style="rowStyle"
  1481. :cell-style="cellStyle"
  1482. class="elTable table-fixed"
  1483. >
  1484. <el-table-column
  1485. :label="$t('errorAnalysis.date')"
  1486. min-width="130px"
  1487. align="center"
  1488. >
  1489. <template slot-scope="scope">
  1490. <span>{{ scope.row.operatetime }}</span>
  1491. </template>
  1492. </el-table-column>
  1493. <el-table-column
  1494. :label="$t('dhedFormula.dyczl1')"
  1495. min-width="130px"
  1496. align="center"
  1497. >
  1498. <template slot-scope="scope">
  1499. <span>{{ scope.row.oneweight }}</span>
  1500. </template>
  1501. </el-table-column>
  1502. <el-table-column
  1503. :label="$t('feedingEfficiency.dcbfb1')"
  1504. min-width="130px"
  1505. align="center"
  1506. >
  1507. <template slot-scope="scope">
  1508. <span>{{ scope.row.onerate }}</span>
  1509. </template>
  1510. </el-table-column>
  1511. <el-table-column
  1512. :label="$t('dhedFormula.dyczl2')"
  1513. min-width="130px"
  1514. align="center"
  1515. >
  1516. <template slot-scope="scope">
  1517. <span>{{ scope.row.twoweight }}</span>
  1518. </template>
  1519. </el-table-column>
  1520. <el-table-column
  1521. :label="$t('feedingEfficiency.dcbfb2')"
  1522. min-width="130px"
  1523. align="center"
  1524. >
  1525. <template slot-scope="scope">
  1526. <span>{{ scope.row.tworate }}</span>
  1527. </template>
  1528. </el-table-column>
  1529. <el-table-column
  1530. :label="$t('dhedFormula.dyczl3')"
  1531. min-width="130px"
  1532. align="center"
  1533. >
  1534. <template slot-scope="scope">
  1535. <span>{{ scope.row.threeweight }}</span>
  1536. </template>
  1537. </el-table-column>
  1538. <el-table-column
  1539. :label="$t('feedingEfficiency.dcbfb3')"
  1540. min-width="130px"
  1541. align="center"
  1542. >
  1543. <template slot-scope="scope">
  1544. <span>{{ scope.row.threerate }}</span>
  1545. </template>
  1546. </el-table-column>
  1547. <el-table-column
  1548. :label="$t('feedingEfficiency.ckbz')"
  1549. min-width="130px"
  1550. align="center"
  1551. >
  1552. <template slot-scope="scope">
  1553. <span>{{ scope.row.standard }}</span>
  1554. </template>
  1555. </el-table-column>
  1556. </el-table>
  1557. </div>
  1558. </el-col>
  1559. </el-row>
  1560. <el-row>
  1561. <el-col :span="24">
  1562. <h3 style="text-align: center">BCS评分</h3>
  1563. <div class="table">
  1564. <el-table
  1565. :key="nutritional.tab2.tableKey3"
  1566. v-loading="nutritional.tab2.listLoading3"
  1567. :element-loading-text="$t('common.tableMsg')"
  1568. :data="nutritional.tab2.list3"
  1569. border
  1570. fit
  1571. highlight-current-row
  1572. style="width: 100%; margin-bottom: 60px"
  1573. :row-style="rowStyle"
  1574. :cell-style="cellStyle"
  1575. class="elTable table-fixed"
  1576. >
  1577. <el-table-column
  1578. :label="$t('errorAnalysis.date')"
  1579. min-width="130px"
  1580. align="center"
  1581. >
  1582. <template slot-scope="scope">
  1583. <span>{{ scope.row.operatetime }}</span>
  1584. </template>
  1585. </el-table-column>
  1586. <el-table-column
  1587. :label="$t('feedingEfficiency.czybs')"
  1588. min-width="130px"
  1589. align="center"
  1590. >
  1591. <template slot-scope="scope">
  1592. <span>{{ scope.row.sumcowcount }}</span>
  1593. </template>
  1594. </el-table-column>
  1595. <el-table-column
  1596. :label="$t('message.msg75')"
  1597. min-width="130px"
  1598. align="center"
  1599. >
  1600. <template slot-scope="scope">
  1601. <span>{{ scope.row.product }}</span>
  1602. </template>
  1603. </el-table-column>
  1604. <el-table-column
  1605. :label="$t('message.msg76')"
  1606. min-width="130px"
  1607. align="center"
  1608. >
  1609. <template slot-scope="scope">
  1610. <span>{{ scope.row.cowneed }}</span>
  1611. </template>
  1612. </el-table-column>
  1613. <el-table-column
  1614. :label="$t('feedingEfficiency.mrts')"
  1615. min-width="130px"
  1616. align="center"
  1617. >
  1618. <template slot-scope="scope">
  1619. <span>{{ scope.row.avgdim }}</span>
  1620. </template>
  1621. </el-table-column>
  1622. <el-table-column
  1623. :label="$t('feedingEfficiency.bzfs')"
  1624. min-width="130px"
  1625. align="center"
  1626. >
  1627. <template slot-scope="scope">
  1628. <span>{{ scope.row.standardscore }}</span>
  1629. </template>
  1630. </el-table-column>
  1631. <el-table-column
  1632. :label="$t('message.msg77')"
  1633. min-width="130px"
  1634. align="center"
  1635. >
  1636. <template slot-scope="scope">
  1637. <span
  1638. >{{ scope.row.score25 }}({{
  1639. scope.row.score25rate
  1640. }}%)</span
  1641. >
  1642. </template>
  1643. </el-table-column>
  1644. <el-table-column
  1645. :label="$t('message.msg78')"
  1646. min-width="130px"
  1647. align="center"
  1648. >
  1649. <template slot-scope="scope">
  1650. <span
  1651. >{{ scope.row.score275 }}({{
  1652. scope.row.score275rate
  1653. }}%)</span
  1654. >
  1655. </template>
  1656. </el-table-column>
  1657. <el-table-column
  1658. :label="$t('message.msg79')"
  1659. min-width="130px"
  1660. align="center"
  1661. >
  1662. <template slot-scope="scope">
  1663. <span
  1664. >{{ scope.row.score3 }}({{
  1665. scope.row.score3rate
  1666. }}%)</span
  1667. >
  1668. </template>
  1669. </el-table-column>
  1670. <el-table-column
  1671. :label="$t('message.msg80')"
  1672. min-width="130px"
  1673. align="center"
  1674. >
  1675. <template slot-scope="scope">
  1676. <span
  1677. >{{ scope.row.score325 }}({{
  1678. scope.row.score325rate
  1679. }}%)</span
  1680. >
  1681. </template>
  1682. </el-table-column>
  1683. <el-table-column
  1684. :label="$t('message.msg81')"
  1685. min-width="130px"
  1686. align="center"
  1687. >
  1688. <template slot-scope="scope">
  1689. <span
  1690. >{{ scope.row.score35 }}({{
  1691. scope.row.score35rate
  1692. }}%)</span
  1693. >
  1694. </template>
  1695. </el-table-column>
  1696. <el-table-column
  1697. :label="$t('message.msg82')"
  1698. min-width="130px"
  1699. align="center"
  1700. >
  1701. <template slot-scope="scope">
  1702. <span
  1703. >{{ scope.row.score375 }}({{
  1704. scope.row.score375rate
  1705. }}%)</span
  1706. >
  1707. </template>
  1708. </el-table-column>
  1709. <el-table-column
  1710. :label="$t('message.msg83')"
  1711. min-width="130px"
  1712. align="center"
  1713. >
  1714. <template slot-scope="scope">
  1715. <span
  1716. >{{ scope.row.score4 }}({{
  1717. scope.row.score4rate
  1718. }}%)</span
  1719. >
  1720. </template>
  1721. </el-table-column>
  1722. </el-table>
  1723. </div>
  1724. </el-col>
  1725. </el-row>
  1726. <el-row>
  1727. <el-col :span="24">
  1728. <h3 style="text-align: center">
  1729. {{ $t('feedingEfficiency.fbpf') }}
  1730. </h3>
  1731. <div class="table">
  1732. <el-table
  1733. :key="nutritional.tab2.tableKey4"
  1734. v-loading="nutritional.tab2.listLoading4"
  1735. :element-loading-text="$t('common.tableMsg')"
  1736. :data="nutritional.tab2.list4"
  1737. border
  1738. fit
  1739. highlight-current-row
  1740. style="width: 100%; margin-bottom: 60px"
  1741. :row-style="rowStyle"
  1742. :cell-style="cellStyle"
  1743. class="elTable table-fixed"
  1744. >
  1745. <el-table-column
  1746. :label="$t('errorAnalysis.date')"
  1747. min-width="130px"
  1748. align="center"
  1749. >
  1750. <template slot-scope="scope">
  1751. <span>{{ scope.row.operatetime }}</span>
  1752. </template>
  1753. </el-table-column>
  1754. <el-table-column
  1755. :label="$t('feedingEfficiency.czybs')"
  1756. min-width="130px"
  1757. align="center"
  1758. >
  1759. <template slot-scope="scope">
  1760. <span>{{ scope.row.sumcowcount }}</span>
  1761. </template>
  1762. </el-table-column>
  1763. <el-table-column
  1764. :label="$t('message.msg75')"
  1765. min-width="130px"
  1766. align="center"
  1767. >
  1768. <template slot-scope="scope">
  1769. <span>{{ scope.row.product }}</span>
  1770. </template>
  1771. </el-table-column>
  1772. <el-table-column
  1773. :label="$t('message.msg76')"
  1774. min-width="130px"
  1775. align="center"
  1776. >
  1777. <template slot-scope="scope">
  1778. <span>{{ scope.row.cowneed }}</span>
  1779. </template>
  1780. </el-table-column>
  1781. <el-table-column
  1782. :label="$t('feedingEfficiency.mrts')"
  1783. min-width="130px"
  1784. align="center"
  1785. >
  1786. <template slot-scope="scope">
  1787. <span>{{ scope.row.avgdim }}</span>
  1788. </template>
  1789. </el-table-column>
  1790. <el-table-column
  1791. :label="$t('feedingEfficiency.bzfs')"
  1792. min-width="130px"
  1793. align="center"
  1794. >
  1795. <template slot-scope="scope">
  1796. <span>{{ scope.row.cowneed }}</span>
  1797. </template>
  1798. </el-table-column>
  1799. <el-table-column
  1800. :label="$t('message.msg84')"
  1801. min-width="130px"
  1802. align="center"
  1803. >
  1804. <template slot-scope="scope">
  1805. <span
  1806. >{{ scope.row.score1 }}({{
  1807. scope.row.score1rate
  1808. }}%)</span
  1809. >
  1810. </template>
  1811. </el-table-column>
  1812. <el-table-column
  1813. :label="$t('message.msg85')"
  1814. min-width="130px"
  1815. align="center"
  1816. >
  1817. <template slot-scope="scope">
  1818. <span
  1819. >{{ scope.row.score2 }}({{
  1820. scope.row.score2rate
  1821. }}%)</span
  1822. >
  1823. </template>
  1824. </el-table-column>
  1825. <el-table-column
  1826. :label="$t('message.msg79')"
  1827. min-width="130px"
  1828. align="center"
  1829. >
  1830. <template slot-scope="scope">
  1831. <span
  1832. >{{ scope.row.score3 }}({{
  1833. scope.row.score3rate
  1834. }}%)</span
  1835. >
  1836. </template>
  1837. </el-table-column>
  1838. <el-table-column
  1839. :label="$t('message.msg86')"
  1840. min-width="130px"
  1841. align="center"
  1842. >
  1843. <template slot-scope="scope">
  1844. <span
  1845. >{{ scope.row.score4 }}({{
  1846. scope.row.score4rate
  1847. }}%)</span
  1848. >
  1849. </template>
  1850. </el-table-column>
  1851. <el-table-column
  1852. :label="$t('message.msg87')"
  1853. min-width="130px"
  1854. align="center"
  1855. >
  1856. <template slot-scope="scope">
  1857. <span
  1858. >{{ scope.row.score5 }}({{
  1859. scope.row.score5rate
  1860. }}%)</span
  1861. >
  1862. </template>
  1863. </el-table-column>
  1864. </el-table>
  1865. </div>
  1866. </el-col>
  1867. </el-row>
  1868. </el-tab-pane>
  1869. </el-tabs>
  1870. <div slot="footer" class="dialog-footer">
  1871. <el-button
  1872. class="cancelClose cancelClose1"
  1873. @click="nutritional.dialogFormVisible = false"
  1874. >{{ $t('common.closed') }}</el-button
  1875. >
  1876. </div>
  1877. </div>
  1878. </el-dialog>
  1879. <!-- 干物质调节 -->
  1880. <DryMatterRegulation
  1881. ref="mychild"
  1882. :show.sync="isShowDialog"
  1883. @getIsDisplay="getIsDisplay"
  1884. />
  1885. </div>
  1886. </template>
  1887. <script>
  1888. import {
  1889. GetDataByName,
  1890. postJson,
  1891. GetDataByNames,
  1892. compareSort,
  1893. ExecDataByConfig,
  1894. failproccess,
  1895. PostDataByName,
  1896. formatNum,
  1897. checkButtons
  1898. } from '@/api/common'
  1899. import Pagination from '@/components/Pagination'
  1900. import Pagination2 from '@/components/Pagination2'
  1901. import {
  1902. parseTime,
  1903. json2excel,
  1904. handleTableSpan,
  1905. handleObjectSpanMethod
  1906. } from '@/utils/index.js'
  1907. import { MessageBox } from 'element-ui'
  1908. import Cookies from 'js-cookie'
  1909. import axios from 'axios'
  1910. import { getToken } from '@/utils/auth'
  1911. import DryMatterRegulation from './dryMatterRegulation.vue'
  1912. export default {
  1913. inject: ['reload'],
  1914. name: 'DhedFormula',
  1915. components: { Pagination, Pagination2, DryMatterRegulation },
  1916. data() {
  1917. return {
  1918. isproportion: false,
  1919. dialogFull: false,
  1920. isRoleEdit: [],
  1921. isSynchronous: [],
  1922. headerList: [],
  1923. pickerMinDate: '',
  1924. pickerOptions: {
  1925. onPick: ({ maxDate, minDate }) => {
  1926. this.pickerMinDate = minDate.getTime()
  1927. if (maxDate) {
  1928. this.pickerMinDate = ''
  1929. }
  1930. },
  1931. // 限制不能选择今天之后的日期
  1932. disabledDate: (time) => {
  1933. if (this.pickerMinDate !== '') {
  1934. const one = 31 * 24 * 3600 * 1000
  1935. const minTime = this.pickerMinDate - one
  1936. let maxTime = this.pickerMinDate + one
  1937. if (maxTime > new Date()) {
  1938. maxTime = new Date()
  1939. }
  1940. return (
  1941. time.getTime() < minTime - 8.64e7 ||
  1942. time.getTime() > maxTime - 8.64e7
  1943. )
  1944. }
  1945. return time.getTime() > Date.now() - 8.64e7
  1946. }
  1947. },
  1948. requestParams: [
  1949. {
  1950. name: 'getFTSWLSList',
  1951. offset: 0,
  1952. pagecount: 0,
  1953. parammaps: { pastureid: Cookies.get('pastureid') }
  1954. },
  1955. {
  1956. name: 'getFTBLList',
  1957. offset: 0,
  1958. pagecount: 0,
  1959. parammaps: { pastureid: Cookies.get('pastureid') }
  1960. },
  1961. {
  1962. name: 'getCowclassListEnable',
  1963. offset: 0,
  1964. pagecount: 0,
  1965. parammaps: { pastureid: Cookies.get('pastureid') }
  1966. },
  1967. {
  1968. name: 'getBarListEnable',
  1969. offset: 0,
  1970. pagecount: 0,
  1971. parammaps: { pastureid: Cookies.get('pastureid') }
  1972. },
  1973. {
  1974. name: 'getSysoptEnable',
  1975. offset: 0,
  1976. pagecount: 0,
  1977. parammaps: {
  1978. pastureid: Cookies.get('pastureid'),
  1979. inforname: 'udFeedpSync'
  1980. }
  1981. }
  1982. ],
  1983. getFeedTempletNameListParm: {
  1984. name: 'getFeedTempletName',
  1985. page: 1,
  1986. offset: 1,
  1987. // pagecount: parseInt(Cookies.get('pageCount')),
  1988. pagecount: '',
  1989. returntype: 'Map',
  1990. parammaps: {
  1991. pastureid: Cookies.get('pastureid')
  1992. }
  1993. },
  1994. tnameList: [], // 配方名 称
  1995. recipeTemplateList: [], // 配方模板
  1996. feedingFormulaList: [], // 补料配方
  1997. livestockTypeList: [], // 类别
  1998. barList: [],
  1999. rules: {
  2000. cowclassid: [
  2001. {
  2002. type: 'string',
  2003. required: true,
  2004. message: this.$t('hardwareTest.bt'),
  2005. trigger: 'blur'
  2006. }
  2007. ]
  2008. },
  2009. table: {
  2010. getdataListParm: {
  2011. name: 'getFPList',
  2012. page: 1,
  2013. offset: 1,
  2014. // pagecount: parseInt(Cookies.get('pageCount')),
  2015. pagecount: '',
  2016. returntype: 'Map',
  2017. parammaps: {
  2018. pastureid: Cookies.get('pastureid'),
  2019. enable: '',
  2020. barid: '',
  2021. tname: ''
  2022. }
  2023. },
  2024. tableKey: 0,
  2025. list: [],
  2026. total: 0,
  2027. listLoading: true,
  2028. temp: {},
  2029. rwList: [],
  2030. isPtsfname: false, // 补料配方/补料重量
  2031. getdataListParm2: {
  2032. name: 'getSysoptEnable',
  2033. page: 1,
  2034. offset: 1,
  2035. pagecount: 1,
  2036. returntype: 'Map',
  2037. parammaps: {
  2038. pastureid: Cookies.get('pastureid'),
  2039. inforname: 'isEnableSupplyFeed'
  2040. }
  2041. },
  2042. isRW1: false, // 第一班
  2043. isRW2: false, // 第二班
  2044. isRW3: false, // 第三班
  2045. isRW4: false, // 第四班
  2046. isRW5: false, // 第五班
  2047. isRW6: false, // 第六班
  2048. getdataListParm3: {
  2049. name: 'getSysoptEnable1',
  2050. page: 1,
  2051. offset: 1,
  2052. pagecount: 1,
  2053. returntype: 'Map',
  2054. parammaps: {
  2055. pastureid: Cookies.get('pastureid'),
  2056. inforname: 'times'
  2057. }
  2058. },
  2059. RWLength: '' // 班次长度
  2060. },
  2061. selectList: [],
  2062. // 营养评估
  2063. nutritional: {
  2064. dialogFormVisible: false,
  2065. dialogStatus: '',
  2066. activeName: 'first ',
  2067. tab1: {
  2068. // inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  2069. inputDatetime: [new Date(), new Date()],
  2070. listLoading1: true,
  2071. getdataListParm1: {
  2072. name: 'getnurj',
  2073. page: 1,
  2074. offset: 1,
  2075. pagecount: 10,
  2076. returntype: 'Map',
  2077. parammaps: {
  2078. pastureid: '',
  2079. barid: ''
  2080. }
  2081. },
  2082. disabledCowclass: false,
  2083. temp: {},
  2084. tableKey: 0,
  2085. list: [],
  2086. total: 0,
  2087. listLoading2: true,
  2088. getdataListParm2: {
  2089. name: 'GETNurJudge',
  2090. page: 1,
  2091. offset: 1,
  2092. pagecount: 10,
  2093. returntype: 'Map',
  2094. parammaps: {
  2095. pastureid: '',
  2096. cowclassid: ''
  2097. }
  2098. }
  2099. },
  2100. tab2: {
  2101. // inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  2102. inputDatetime: [new Date(), new Date()],
  2103. listLoading1: true,
  2104. tableKey1: 0,
  2105. list1: [],
  2106. total1: 0,
  2107. getdataListParm1: {
  2108. name: 'getPennsieveList',
  2109. page: 1,
  2110. offset: 1,
  2111. pagecount: 10,
  2112. returntype: 'Map',
  2113. parammaps: {
  2114. pastureid: '',
  2115. barid: '',
  2116. startTime: '',
  2117. stopTime: '',
  2118. inputDatetime: ''
  2119. }
  2120. },
  2121. listLoading2: true,
  2122. tableKey2: 0,
  2123. list2: [],
  2124. total2: 0,
  2125. getdataListParm2: {
  2126. name: 'getDungsieveList',
  2127. page: 1,
  2128. offset: 1,
  2129. pagecount: 10,
  2130. returntype: 'Map',
  2131. parammaps: {
  2132. pastureid: '',
  2133. barid: '',
  2134. startTime: '',
  2135. stopTime: '',
  2136. inputDatetime: ''
  2137. }
  2138. },
  2139. listLoading3: true,
  2140. tableKey3: 0,
  2141. list3: [],
  2142. total3: 0,
  2143. getdataListParm3: {
  2144. name: 'getBodyscoreList',
  2145. page: 1,
  2146. offset: 1,
  2147. pagecount: 10,
  2148. returntype: 'Map',
  2149. parammaps: {
  2150. pastureid: '',
  2151. barid: '',
  2152. startTime: '',
  2153. stopTime: '',
  2154. inputDatetime: ''
  2155. }
  2156. },
  2157. listLoading4: true,
  2158. tableKey4: 0,
  2159. list4: [],
  2160. total4: 0,
  2161. getdataListParm4: {
  2162. name: 'getDungscoreList',
  2163. page: 1,
  2164. offset: 1,
  2165. pagecount: 10,
  2166. returntype: 'Map',
  2167. parammaps: {
  2168. pastureid: '',
  2169. barid: '',
  2170. startTime: '',
  2171. stopTime: '',
  2172. inputDatetime: ''
  2173. }
  2174. }
  2175. }
  2176. },
  2177. history: {
  2178. dialogFormVisible: false,
  2179. dialogStatus: '',
  2180. temp: {},
  2181. rules: {},
  2182. tableKey: 0,
  2183. list: [],
  2184. total: 0,
  2185. listLoading: true,
  2186. getdataListParm: {
  2187. name: 'getPlanModifyFPlist',
  2188. page: 1,
  2189. offset: 1,
  2190. // pagecount: 12,
  2191. pagecount: '',
  2192. returntype: 'Map',
  2193. parammaps: {
  2194. pastureid: Cookies.get('pastureid'),
  2195. date: '',
  2196. barid: '',
  2197. tname: ''
  2198. }
  2199. },
  2200. isPtsfname: false, // 补料配方/补料重量
  2201. getdataListParm2: {
  2202. name: 'getSysoptEnable',
  2203. page: 1,
  2204. offset: 1,
  2205. pagecount: 1,
  2206. returntype: 'Map',
  2207. parammaps: {
  2208. pastureid: Cookies.get('pastureid'),
  2209. inforname: 'isEnableSupplyFeed'
  2210. }
  2211. },
  2212. isRW1: false, // 第一班
  2213. isRW2: false, // 第二班
  2214. isRW3: false, // 第三班
  2215. isRW4: false, // 第四班
  2216. isRW5: false, // 第五班
  2217. isRW6: false, // 第六班
  2218. getdataListParm3: {
  2219. name: 'getSysoptEnable1',
  2220. page: 1,
  2221. offset: 1,
  2222. pagecount: 1,
  2223. returntype: 'Map',
  2224. parammaps: {
  2225. pastureid: Cookies.get('pastureid'),
  2226. inforname: 'times'
  2227. }
  2228. },
  2229. getdataDateParm: {
  2230. name: 'getFPMaxDate',
  2231. page: 1,
  2232. offset: 1,
  2233. pagecount: 10,
  2234. returntype: 'Map',
  2235. parammaps: {
  2236. pastureid: Cookies.get('pastureid')
  2237. }
  2238. }
  2239. },
  2240. textMap: {
  2241. Nutritional: '营养评估',
  2242. history: this.$t('message.msg34')
  2243. },
  2244. requestParam: {},
  2245. download: {
  2246. getdataListParm: {
  2247. name: 'getFPList',
  2248. page: 1,
  2249. offset: 1,
  2250. pagecount: 0,
  2251. returntype: 'Map',
  2252. parammaps: {
  2253. pastureid: Cookies.get('pastureid'),
  2254. enable: ''
  2255. }
  2256. },
  2257. list: []
  2258. },
  2259. spanObj: {},
  2260. mergekeys: ['barname', 'sumweight'],
  2261. isShowDialog: false,
  2262. isokDisable: false,
  2263. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  2264. cellStyle: { padding: 0 + 'px' },
  2265. myHeight: document.documentElement.clientHeight - 85 - 140,
  2266. oldRowList: {},
  2267. oldList: [],
  2268. decimal: parseInt(Cookies.get('decimal')),
  2269. decimalr: parseInt(Cookies.get('decimalr'))
  2270. }
  2271. },
  2272. computed: {
  2273. // 设置请求头
  2274. headers() {
  2275. return {
  2276. token: getToken()
  2277. }
  2278. },
  2279. uploadData() {
  2280. return {
  2281. name: 'checkbarname,checkftsw,checkftbl',
  2282. importParams:this.$t('message.dhedform.importParams'),
  2283. sheetname: 'Sheet1',
  2284. // 登录牧场
  2285. pastureid: Cookies.get('pastureid'),
  2286. // 日期参数
  2287. dateParams: '',
  2288. // 必填参数
  2289. requiredParams: this.$t('message.dhedform.requiredParams'),
  2290. // 为数值的参数
  2291. numParams:this.$t('message.dhedform.numParams')
  2292. }
  2293. },
  2294. // 设置上传地址
  2295. uploadExcelUrl() {
  2296. return Cookies.get('url') + 'authdata/fpdimportexcel'
  2297. }
  2298. },
  2299. created() {
  2300. this.getButtons()
  2301. this.getDownList()
  2302. this.getFeedTempletNameList()
  2303. },
  2304. methods: {
  2305. getButtons() {
  2306. const Edit = 'DhedFormula'
  2307. const isRoleEdit = checkButtons(
  2308. JSON.parse(sessionStorage.getItem('buttons')),
  2309. Edit
  2310. )
  2311. this.isRoleEdit = isRoleEdit
  2312. },
  2313. getDownList() {
  2314. GetDataByNames(this.requestParams).then((response) => {
  2315. if (response.data.getSysoptEnable.list[0].inforvalue == 1) {
  2316. this.isSynchronous = true
  2317. } else {
  2318. this.isSynchronous = false
  2319. }
  2320. this.recipeTemplateList = response.data.getFTSWLSList.list
  2321. this.feedingFormulaList = response.data.getFTBLList.list
  2322. this.livestockTypeList = response.data.getCowclassListEnable.list
  2323. this.barList = response.data.getBarListEnable.list
  2324. this.getIsDisplay()
  2325. })
  2326. },
  2327. getFeedTempletNameList() {
  2328. GetDataByName(this.getFeedTempletNameListParm).then((response) => {
  2329. if (response.data.list !== null) {
  2330. this.tnameList = response.data.list
  2331. } else {
  2332. this.tnameList = []
  2333. }
  2334. })
  2335. },
  2336. getIsDisplay() {
  2337. GetDataByName(this.table.getdataListParm2).then((response) => {
  2338. console.log(response.data.list[0].inforvalue)
  2339. if (response.data.list !== null) {
  2340. if (response.data.list[0].inforvalue == 0) {
  2341. this.table.isPtsfname = false
  2342. } else {
  2343. this.table.isPtsfname = true
  2344. }
  2345. }
  2346. })
  2347. GetDataByName(this.table.getdataListParm3).then((response) => {
  2348. console.log(response.data.list[0].inforvalue)
  2349. if (response.data.list !== null) {
  2350. this.table.RWLength = response.data.list[0].inforvalue
  2351. if (response.data.list[0].inforvalue == 1) {
  2352. this.table.isRW1 = true
  2353. this.table.isRW2 = false
  2354. this.table.isRW3 = false
  2355. this.table.isRW4 = false
  2356. this.table.isRW5 = false
  2357. this.table.isRW6 = false
  2358. } else if (response.data.list[0].inforvalue == 2) {
  2359. this.table.isRW1 = true
  2360. this.table.isRW2 = true
  2361. this.table.isRW3 = false
  2362. this.table.isRW4 = false
  2363. this.table.isRW5 = false
  2364. this.table.isRW6 = false
  2365. } else if (response.data.list[0].inforvalue == 3) {
  2366. this.table.isRW1 = true
  2367. this.table.isRW2 = true
  2368. this.table.isRW3 = true
  2369. this.table.isRW4 = false
  2370. this.table.isRW5 = false
  2371. this.table.isRW6 = false
  2372. } else if (response.data.list[0].inforvalue == 4) {
  2373. this.table.isRW1 = true
  2374. this.table.isRW2 = true
  2375. this.table.isRW3 = true
  2376. this.table.isRW4 = true
  2377. this.table.isRW5 = false
  2378. this.table.isRW6 = false
  2379. } else if (response.data.list[0].inforvalue == 5) {
  2380. this.table.isRW1 = true
  2381. this.table.isRW2 = true
  2382. this.table.isRW3 = true
  2383. this.table.isRW4 = true
  2384. this.table.isRW5 = true
  2385. this.table.isRW6 = false
  2386. } else if (response.data.list[0].inforvalue == 6) {
  2387. this.table.isRW1 = true
  2388. this.table.isRW2 = true
  2389. this.table.isRW3 = true
  2390. this.table.isRW4 = true
  2391. this.table.isRW5 = true
  2392. this.table.isRW6 = true
  2393. }
  2394. } else {
  2395. this.table.isRW1 = false
  2396. this.table.isRW2 = false
  2397. this.table.isRW3 = false
  2398. this.table.isRW4 = false
  2399. this.table.isRW5 = false
  2400. this.table.isRW6 = false
  2401. }
  2402. })
  2403. this.getList()
  2404. },
  2405. getList() {
  2406. this.table.listLoading = true
  2407. GetDataByName(this.table.getdataListParm).then((response) => {
  2408. console.log('table数据', response.data.list)
  2409. if (response.data.list !== null) {
  2410. for (let i = 0; i < response.data.list.length; i++) {
  2411. this.$set(response.data.list[i], 'Edit', false) // 编辑
  2412. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  2413. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  2414. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  2415. // if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
  2416. // if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
  2417. // this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
  2418. // } else {
  2419. // this.$set(response.data.list[i], 'dryweight', '')
  2420. // }
  2421. // }
  2422. if (
  2423. response.data.list[i].ftid == undefined ||
  2424. response.data.list[i].ftname == ''
  2425. ) {
  2426. this.$set(response.data.list[i], 'ftid', '')
  2427. this.$set(response.data.list[i], 'ftname', '')
  2428. }
  2429. if (
  2430. response.data.list[i].ptsfid == undefined ||
  2431. response.data.list[i].ptsfname == ''
  2432. ) {
  2433. this.$set(response.data.list[i], 'ptsfid', '')
  2434. this.$set(response.data.list[i], 'ptsfname', '')
  2435. }
  2436. if (response.data.list[i].ccount == undefined) {
  2437. this.$set(response.data.list[i], 'ccount', '')
  2438. }
  2439. if (response.data.list[i].softccount == undefined) {
  2440. this.$set(response.data.list[i], 'softccount', '')
  2441. }
  2442. if (response.data.list[i].ratio == undefined) {
  2443. this.$set(response.data.list[i], 'ratio', 100)
  2444. }
  2445. if (response.data.list[i].ccountratio == undefined) {
  2446. this.$set(response.data.list[i], 'ccountratio', '')
  2447. }
  2448. if (response.data.list[i].r1 == undefined) {
  2449. this.$set(response.data.list[i], 'r1', '')
  2450. }
  2451. if (response.data.list[i].r2 == undefined) {
  2452. this.$set(response.data.list[i], 'r2', '')
  2453. }
  2454. if (response.data.list[i].r3 == undefined) {
  2455. this.$set(response.data.list[i], 'r3', '')
  2456. }
  2457. if (response.data.list[i].r4 == undefined) {
  2458. this.$set(response.data.list[i], 'r4', '')
  2459. }
  2460. if (response.data.list[i].r5 == undefined) {
  2461. this.$set(response.data.list[i], 'r5', '')
  2462. }
  2463. if (response.data.list[i].r6 == undefined) {
  2464. this.$set(response.data.list[i], 'r6', '')
  2465. }
  2466. if (response.data.list[i].w1 == undefined) {
  2467. this.$set(response.data.list[i], 'w1', '')
  2468. }
  2469. if (response.data.list[i].w2 == undefined) {
  2470. this.$set(response.data.list[i], 'w2', '')
  2471. }
  2472. if (response.data.list[i].w3 == undefined) {
  2473. this.$set(response.data.list[i], 'w3', '')
  2474. }
  2475. if (response.data.list[i].w4 == undefined) {
  2476. this.$set(response.data.list[i], 'w4', '')
  2477. }
  2478. if (response.data.list[i].w5 == undefined) {
  2479. this.$set(response.data.list[i], 'w5', '')
  2480. }
  2481. if (response.data.list[i].w6 == undefined) {
  2482. this.$set(response.data.list[i], 'w6', '')
  2483. }
  2484. if (response.data.list[i].supplyweight == undefined) {
  2485. this.$set(response.data.list[i], 'supplyweight', '')
  2486. }
  2487. if (
  2488. response.data.list[i].feedweight == undefined ||
  2489. parseFloat(response.data.list[i].feedweight) == 0
  2490. ) {
  2491. this.$set(response.data.list[i], 'feedweight', '')
  2492. }
  2493. this.$set(response.data.list[i], 'dailyWeight', '')
  2494. if (response.data.list[i].Bfweight == undefined) {
  2495. this.$set(response.data.list[i], 'Bfweight', '')
  2496. }
  2497. if (response.data.list[i].Sfweight == undefined) {
  2498. this.$set(response.data.list[i], 'Sfweight', '')
  2499. }
  2500. if (response.data.list[i].isOneWeight == undefined) {
  2501. this.$set(response.data.list[i], 'isOneWeight', false)
  2502. }
  2503. if (response.data.list[i].isTwoWeight == undefined) {
  2504. this.$set(response.data.list[i], 'isTwoWeight', false)
  2505. }
  2506. if (response.data.list[i].isThreeWeight == undefined) {
  2507. this.$set(response.data.list[i], 'isThreeWeight', false)
  2508. }
  2509. if (response.data.list[i].isFourWeight == undefined) {
  2510. this.$set(response.data.list[i], 'isFourWeight', false)
  2511. }
  2512. if (response.data.list[i].isFiveWeight == undefined) {
  2513. this.$set(response.data.list[i], 'isFiveWeight', false)
  2514. }
  2515. if (response.data.list[i].isSixWeight == undefined) {
  2516. this.$set(response.data.list[i], 'isSixWeight', false)
  2517. }
  2518. if (response.data.list[i].timesopt !== undefined) {
  2519. var timesoptArr = response.data.list[i].timesopt.split(',')
  2520. for (let j = 0; j < timesoptArr.length; j++) {
  2521. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] =
  2522. timesoptArr[j].split(':')[1]
  2523. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] =
  2524. timesoptArr[j].split(':')[2]
  2525. }
  2526. }
  2527. if (response.data.list[i].bw1 == undefined) {
  2528. this.$set(response.data.list[i], 'bw1', '')
  2529. }
  2530. if (response.data.list[i].bw2 == undefined) {
  2531. this.$set(response.data.list[i], 'bw2', '')
  2532. }
  2533. if (response.data.list[i].bw3 == undefined) {
  2534. this.$set(response.data.list[i], 'bw3', '')
  2535. }
  2536. if (response.data.list[i].bw4 == undefined) {
  2537. this.$set(response.data.list[i], 'bw4', '')
  2538. }
  2539. if (response.data.list[i].bw5 == undefined) {
  2540. this.$set(response.data.list[i], 'bw5', '')
  2541. }
  2542. if (response.data.list[i].bw6 == undefined) {
  2543. this.$set(response.data.list[i], 'bw6', '')
  2544. }
  2545. if (response.data.list[i].supplement !== undefined) {
  2546. var supplementArr = response.data.list[i].supplement.split(',')
  2547. for (let j = 0; j < supplementArr.length; j++) {
  2548. response.data.list[i]['bw' + supplementArr[j].split(':')[0]] =
  2549. supplementArr[j].split(':')[2]
  2550. }
  2551. }
  2552. }
  2553. // console.log(response.data.list, sumr)
  2554. for (let i = 0; i < response.data.list.length; i++) {
  2555. if (response.data.list[i].r1 == '') {
  2556. response.data.list[i].r1 = 0
  2557. response.data.list[i].w1 = 0
  2558. }
  2559. if (response.data.list[i].r2 == '') {
  2560. response.data.list[i].r2 = 0
  2561. response.data.list[i].w2 = 0
  2562. }
  2563. if (response.data.list[i].r3 == '') {
  2564. response.data.list[i].r3 = 0
  2565. response.data.list[i].w3 = 0
  2566. }
  2567. if (response.data.list[i].r4 == '') {
  2568. response.data.list[i].r4 = 0
  2569. response.data.list[i].w4 = 0
  2570. }
  2571. if (response.data.list[i].r5 == '') {
  2572. response.data.list[i].r5 = 0
  2573. response.data.list[i].w5 = 0
  2574. }
  2575. if (response.data.list[i].r6 == '') {
  2576. response.data.list[i].r6 = 0
  2577. response.data.list[i].w6 = 0
  2578. }
  2579. // 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))
  2580. // response.data.list[i].sumr = formatNum(response.data.list[i].sumr, parseInt(Cookies.get('decimalr')))
  2581. var sumr = 0
  2582. if (response.data.list[i].r1 && !isNaN(response.data.list[i].r1)) {
  2583. sumr += parseFloat(response.data.list[i].r1)
  2584. }
  2585. if (response.data.list[i].r2 && !isNaN(response.data.list[i].r2)) {
  2586. sumr += parseFloat(response.data.list[i].r2)
  2587. }
  2588. if (response.data.list[i].r3 && !isNaN(response.data.list[i].r3)) {
  2589. sumr += parseFloat(response.data.list[i].r3)
  2590. }
  2591. if (response.data.list[i].r4 && !isNaN(response.data.list[i].r4)) {
  2592. sumr += parseFloat(response.data.list[i].r4)
  2593. }
  2594. if (response.data.list[i].r5 && !isNaN(response.data.list[i].r5)) {
  2595. sumr += parseFloat(response.data.list[i].r5)
  2596. }
  2597. if (response.data.list[i].r6 && !isNaN(response.data.list[i].r6)) {
  2598. sumr += parseFloat(response.data.list[i].r6)
  2599. }
  2600. console.log(sumr, 'sumr')
  2601. response.data.list[i].sumr = formatNum(
  2602. sumr,
  2603. parseInt(Cookies.get('decimalr'))
  2604. )
  2605. // this.$set(response.data.list[i],'feedweight',formatNum(parseFloat(response.data.list[i].feedweight) * parseFloat(response.data.list[i].sumr)/100,2))
  2606. this.$set(
  2607. response.data.list[i],
  2608. 'dailyWeight',
  2609. parseFloat(response.data.list[i].w1) +
  2610. parseFloat(response.data.list[i].w2) +
  2611. parseFloat(response.data.list[i].w3) +
  2612. parseFloat(response.data.list[i].w4)
  2613. )
  2614. response.data.list[i].dailyWeight = formatNum(
  2615. response.data.list[i].dailyWeight,
  2616. parseInt(Cookies.get('decimal'))
  2617. )
  2618. }
  2619. this.table.list = response.data.list
  2620. console.log(this.table.list, 'this.table.list')
  2621. this.table.pageNum = response.data.pageNum
  2622. this.table.pageSize = response.data.pageSize
  2623. this.table.total = response.data.total
  2624. } else {
  2625. this.table.list = []
  2626. }
  2627. setTimeout(() => {
  2628. this.table.listLoading = false
  2629. }, 100)
  2630. })
  2631. },
  2632. form_search() {
  2633. this.getList()
  2634. },
  2635. renderHeader(h, { column, $index }) {
  2636. // h即为cerateElement的简写,具体可看vue官方文档
  2637. return h('div', [
  2638. h('span', column.label),
  2639. h('i', {
  2640. class: 'el-icon-unlock',
  2641. ref: 'el-icon-unlock',
  2642. style: 'margin-left:5px;'
  2643. })
  2644. ])
  2645. },
  2646. headerClick(column, event) {
  2647. console.log(column, event)
  2648. this.headerList.push(event)
  2649. if (column.label == '第一班重量') {
  2650. for (let i = 0; i < this.table.list.length; i++) {
  2651. if (this.table.list[i].Edit == true) {
  2652. if (
  2653. event.target.outerHTML ==
  2654. '<i class="el-icon-unlock" style="margin-left: 5px;"></i>'
  2655. ) {
  2656. event.target.className = 'el-icon-lock'
  2657. this.$set(this.table.list[i], 'isOneWeight', true) // 锁住不可编辑
  2658. } else if (
  2659. event.target.outerHTML ==
  2660. '<i class="el-icon-lock" style="margin-left: 5px;"></i>'
  2661. ) {
  2662. event.target.className = 'el-icon-unlock'
  2663. this.$set(this.table.list[i], 'isOneWeight', false) // 解锁可编辑
  2664. }
  2665. }
  2666. }
  2667. } else if (column.label == '第二班重量') {
  2668. for (let i = 0; i < this.table.list.length; i++) {
  2669. if (this.table.list[i].Edit == true) {
  2670. if (
  2671. event.target.outerHTML ==
  2672. '<i class="el-icon-unlock" style="margin-left: 5px;"></i>'
  2673. ) {
  2674. event.target.className = 'el-icon-lock'
  2675. this.$set(this.table.list[i], 'isTwoWeight', true) // 锁住不可编辑
  2676. } else if (
  2677. event.target.outerHTML ==
  2678. '<i class="el-icon-lock" style="margin-left: 5px;"></i>'
  2679. ) {
  2680. event.target.className = 'el-icon-unlock'
  2681. this.$set(this.table.list[i], 'isTwoWeight', false) // 解锁可编辑
  2682. }
  2683. }
  2684. }
  2685. } else if (column.label == '第三班重量') {
  2686. for (let i = 0; i < this.table.list.length; i++) {
  2687. if (this.table.list[i].Edit == true) {
  2688. if (
  2689. event.target.outerHTML ==
  2690. '<i class="el-icon-unlock" style="margin-left: 5px;"></i>'
  2691. ) {
  2692. event.target.className = 'el-icon-lock'
  2693. this.$set(this.table.list[i], 'isThreeWeight', true) // 锁住不可编辑
  2694. } else if (
  2695. event.target.outerHTML ==
  2696. '<i class="el-icon-lock" style="margin-left: 5px;"></i>'
  2697. ) {
  2698. event.target.className = 'el-icon-unlock'
  2699. this.$set(this.table.list[i], 'isThreeWeight', false) // 解锁可编辑
  2700. }
  2701. }
  2702. }
  2703. } else if (column.label == '第四班重量') {
  2704. for (let i = 0; i < this.table.list.length; i++) {
  2705. if (this.table.list[i].Edit == true) {
  2706. if (
  2707. event.target.outerHTML ==
  2708. '<i class="el-icon-unlock" style="margin-left: 5px;"></i>'
  2709. ) {
  2710. event.target.className = 'el-icon-lock'
  2711. this.$set(this.table.list[i], 'isFourWeight', true) // 锁住不可编辑
  2712. } else if (
  2713. event.target.outerHTML ==
  2714. '<i class="el-icon-lock" style="margin-left: 5px;"></i>'
  2715. ) {
  2716. event.target.className = 'el-icon-unlock'
  2717. this.$set(this.table.list[i], 'isFourWeight', false) // 解锁可编辑
  2718. }
  2719. }
  2720. }
  2721. } else if (column.label == '第五班重量') {
  2722. for (let i = 0; i < this.table.list.length; i++) {
  2723. if (this.table.list[i].Edit == true) {
  2724. if (
  2725. event.target.outerHTML ==
  2726. '<i class="el-icon-unlock" style="margin-left: 5px;"></i>'
  2727. ) {
  2728. event.target.className = 'el-icon-lock'
  2729. this.$set(this.table.list[i], 'isFiveWeight', true) // 锁住不可编辑
  2730. } else if (
  2731. event.target.outerHTML ==
  2732. '<i class="el-icon-lock" style="margin-left: 5px;"></i>'
  2733. ) {
  2734. event.target.className = 'el-icon-unlock'
  2735. this.$set(this.table.list[i], 'isFiveWeight', false) // 解锁可编辑
  2736. }
  2737. }
  2738. }
  2739. } else if (column.label == '第六班重量') {
  2740. for (let i = 0; i < this.table.list.length; i++) {
  2741. if (this.table.list[i].Edit == true) {
  2742. if (
  2743. event.target.outerHTML ==
  2744. '<i class="el-icon-unlock" style="margin-left: 5px;"></i>'
  2745. ) {
  2746. event.target.className = 'el-icon-lock'
  2747. this.$set(this.table.list[i], 'isSixWeight', true) // 锁住不可编辑
  2748. } else if (
  2749. event.target.outerHTML ==
  2750. '<i class="el-icon-lock" style="margin-left: 5px;"></i>'
  2751. ) {
  2752. event.target.className = 'el-icon-unlock'
  2753. this.$set(this.table.list[i], 'isSixWeight', false) // 解锁可编辑
  2754. }
  2755. }
  2756. }
  2757. }
  2758. },
  2759. // 配方模板
  2760. changeRecipeTemplate(item, row) {
  2761. row.myccname = this.recipeTemplateList.find(
  2762. (obj) => obj.id == item
  2763. ).ccname
  2764. if (row.bigcowclass !== row.myccname) {
  2765. this.$message({
  2766. type: 'warning',
  2767. message: this.$t('message.msg116'),
  2768. duration: 2000
  2769. })
  2770. }
  2771. console.log(row.supplyweight, 'row.supplyweight')
  2772. row.ftname = this.recipeTemplateList.find((obj) => obj.id == item).tname
  2773. row.Sfweight = this.recipeTemplateList.find(
  2774. (obj) => obj.id == item
  2775. ).Sfweight // Sfweight
  2776. row.SfweightLock = this.recipeTemplateList.find(
  2777. (obj) => obj.id == item
  2778. ).SfweightLock // SfweightLock
  2779. row.dryweight = this.recipeTemplateList.find(
  2780. (obj) => obj.id == item
  2781. ).dryweight // SfweightLock
  2782. // 补料重量supplyweight
  2783. // 配方重量ftweight
  2784. // 系数头数ccountratio
  2785. // 投喂量feedweight
  2786. // 实际牛头数ccount
  2787. // 投喂量 = 配方重量 + 补料重量
  2788. // 配方重量 = Sfweight * 系数头数 + SfweightLock * 实际牛头数ccount
  2789. console.log(row.Sfweight, 'row.Sfweight')
  2790. console.log(row.ccountratio, '系数头数')
  2791. console.log(row.SfweightLock, 'SfweightLock')
  2792. console.log(row.ccount, '实际牛头数')
  2793. if (row.Sfweight !== '' && row.ccount !== '') {
  2794. this.$set(
  2795. row,
  2796. 'ftweight',
  2797. formatNum(
  2798. parseFloat(row.Sfweight) * parseFloat(row.ccountratio) +
  2799. parseFloat(row.SfweightLock) * parseFloat(row.ccount),
  2800. parseInt(Cookies.get('decimal'))
  2801. )
  2802. )
  2803. } else {
  2804. row.ftweight = ''
  2805. }
  2806. // console.log(row.ftweight, 'row.ftweight')
  2807. // console.log(row.supplyweight, 'row.supplyweight')
  2808. // console.log(this.table.isPtsfname, 'isPtsfname')
  2809. if (this.table.isPtsfname == false) {
  2810. row.feedweight = formatNum(
  2811. parseFloat(row.ftweight),
  2812. parseInt(Cookies.get('decimal'))
  2813. )
  2814. } else {
  2815. if (row.supplyweight == 'NaN') {
  2816. row.supplyweight = 0
  2817. }
  2818. console.log(row.supplyweight)
  2819. if (row.supplyweight !== '' && row.ftweight !== '') {
  2820. row.feedweight = formatNum(
  2821. parseFloat(row.supplyweight) + parseFloat(row.ftweight),
  2822. parseInt(Cookies.get('decimal'))
  2823. )
  2824. } else if (row.supplyweight == '' && row.ftweight !== '') {
  2825. row.feedweight = formatNum(
  2826. parseFloat(row.ftweight),
  2827. parseInt(Cookies.get('decimal'))
  2828. )
  2829. } else if (row.supplyweight !== '' && row.ftweight !== '') {
  2830. row.feedweight = formatNum(
  2831. parseFloat(row.supplyweight),
  2832. parseInt(Cookies.get('decimal'))
  2833. )
  2834. }
  2835. if (row.ccountratio !== '' && row.ftweight !== '') {
  2836. row.ftweight = formatNum(
  2837. parseFloat(row.Sfweight) * parseFloat(row.ccountratio) +
  2838. parseFloat(row.SfweightLock) * parseFloat(row.ccount),
  2839. parseInt(Cookies.get('decimal'))
  2840. )
  2841. }
  2842. if (row.Sfweight !== '' && row.ccount !== '') {
  2843. this.$set(
  2844. row,
  2845. 'ftweight',
  2846. formatNum(
  2847. parseFloat(row.Sfweight) * parseFloat(row.ccountratio) +
  2848. parseFloat(row.SfweightLock) * parseFloat(row.ccount),
  2849. parseInt(Cookies.get('decimal'))
  2850. )
  2851. )
  2852. } else {
  2853. row.ftweight = ''
  2854. }
  2855. }
  2856. console.log(row.supplyweight)
  2857. if (row.supplyweight == 'NaN') {
  2858. row.supplyweight = 0
  2859. }
  2860. if (row.r1 !== '') {
  2861. this.$set(
  2862. row,
  2863. 'w1',
  2864. formatNum(
  2865. parseFloat(row.feedweight) * (parseFloat(row.r1) / 100),
  2866. parseInt(Cookies.get('decimal'))
  2867. )
  2868. )
  2869. }
  2870. if (row.r2 !== '') {
  2871. this.$set(
  2872. row,
  2873. 'w2',
  2874. formatNum(
  2875. parseFloat(row.feedweight) * (parseFloat(row.r2) / 100),
  2876. parseInt(Cookies.get('decimal'))
  2877. )
  2878. )
  2879. }
  2880. if (row.r3 !== '') {
  2881. this.$set(
  2882. row,
  2883. 'w3',
  2884. formatNum(
  2885. parseFloat(row.feedweight) * (parseFloat(row.r3) / 100),
  2886. parseInt(Cookies.get('decimal'))
  2887. )
  2888. )
  2889. }
  2890. if (row.r4 !== '') {
  2891. this.$set(
  2892. row,
  2893. 'w4',
  2894. formatNum(
  2895. parseFloat(row.feedweight) * (parseFloat(row.r4) / 100),
  2896. parseInt(Cookies.get('decimal'))
  2897. )
  2898. )
  2899. }
  2900. if (row.r5 !== '') {
  2901. this.$set(
  2902. row,
  2903. 'w5',
  2904. formatNum(
  2905. parseFloat(row.feedweight) * (parseFloat(row.r5) / 100),
  2906. parseInt(Cookies.get('decimal'))
  2907. )
  2908. )
  2909. }
  2910. if (row.r6 !== '') {
  2911. this.$set(
  2912. row,
  2913. 'w6',
  2914. formatNum(
  2915. parseFloat(row.feedweight) * (parseFloat(row.r6) / 100),
  2916. parseInt(Cookies.get('decimal'))
  2917. )
  2918. )
  2919. }
  2920. if (row.w1 == '') {
  2921. row.w1 = 0
  2922. }
  2923. if (row.w2 == '') {
  2924. row.w2 = 0
  2925. }
  2926. if (row.w3 == '') {
  2927. row.w3 = 0
  2928. }
  2929. if (row.w4 == '') {
  2930. row.w4 = 0
  2931. }
  2932. if (row.w5 == '') {
  2933. row.w5 = 0
  2934. }
  2935. if (row.w6 == '') {
  2936. row.w6 = 0
  2937. }
  2938. this.$set(
  2939. row,
  2940. 'dailyWeight',
  2941. parseFloat(row.w1) +
  2942. parseFloat(row.w2) +
  2943. parseFloat(row.w3) +
  2944. parseFloat(row.w4) +
  2945. parseFloat(row.w5) +
  2946. parseFloat(row.w6)
  2947. )
  2948. row.dailyWeight = formatNum(
  2949. row.dailyWeight,
  2950. parseInt(Cookies.get('decimal'))
  2951. )
  2952. },
  2953. // 补料配方
  2954. changeFeedingFormula(item, row) {
  2955. console.log(item, '=========')
  2956. if (item == '') {
  2957. row.bw1 = 0
  2958. row.bw2 = 0
  2959. row.bw3 = 0
  2960. row.bw4 = 0
  2961. row.bw5 = 0
  2962. row.bw6 = 0
  2963. }
  2964. // 补料重量supplyweight
  2965. // 配方重量ftweight
  2966. // 系数头数ccountratio
  2967. // 投喂量feedweight
  2968. // 实际牛头数ccount
  2969. // 投喂量 = 配方重量 + 补料重量
  2970. row.myccname = this.feedingFormulaList.find(
  2971. (obj) => obj.id == item
  2972. ).ccname
  2973. if (row.bigcowclass !== row.myccname) {
  2974. this.$message({
  2975. type: 'warning',
  2976. message: this.$t('message.msg117'),
  2977. duration: 2000
  2978. })
  2979. }
  2980. if (item !== '') {
  2981. console.log(456)
  2982. row.ptsfname = this.feedingFormulaList.find(
  2983. (obj) => obj.id == item
  2984. ).tname
  2985. row.BLweight = this.feedingFormulaList.find(
  2986. (obj) => obj.id == item
  2987. ).Sfweight
  2988. row.BLSfweightLock = this.feedingFormulaList.find(
  2989. (obj) => obj.id == item
  2990. ).SfweightLock
  2991. } else {
  2992. row.ptsfname = ''
  2993. row.BLweight = 0
  2994. row.BLSfweightLock = 0
  2995. }
  2996. // 配方重量 = 系数头数 * Sfweight
  2997. // if (row.ccountratio !== '' && row.ftweight !== '') {
  2998. // row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  2999. // }
  3000. // 补料重量 = 系数头数 * BLweight
  3001. // console.log(row.ccountratio)
  3002. // console.log(row.ccount)
  3003. // console.log(row.BLweight)
  3004. // console.log(row.BLSfweightLock)
  3005. if (
  3006. row.ccountratio !== '' &&
  3007. row.ccount !== '' &&
  3008. row.ccount.BLweight !== '' &&
  3009. row.BLSfweightLock !== ''
  3010. ) {
  3011. this.$set(
  3012. row,
  3013. 'supplyweight',
  3014. formatNum(
  3015. parseFloat(row.BLweight) * parseFloat(row.ccountratio) +
  3016. parseFloat(row.BLSfweightLock) * parseFloat(row.ccount),
  3017. parseInt(Cookies.get('decimal'))
  3018. )
  3019. )
  3020. } else {
  3021. row.supplyweight = ''
  3022. }
  3023. if (this.table.isPtsfname == false) {
  3024. row.feedweight = parseFloat(row.ftweight)
  3025. } else {
  3026. if (row.supplyweight !== '' && row.ftweight !== '') {
  3027. row.feedweight = formatNum(
  3028. parseFloat(row.supplyweight) + parseFloat(row.ftweight),
  3029. parseInt(Cookies.get('decimal'))
  3030. )
  3031. } else if (row.supplyweight == '' && row.ftweight !== '') {
  3032. row.feedweight = formatNum(
  3033. parseFloat(row.ftweight),
  3034. parseInt(Cookies.get('decimal'))
  3035. )
  3036. } else if (row.supplyweight !== '' && row.ftweight == '') {
  3037. row.feedweight = formatNum(
  3038. parseFloat(row.supplyweight),
  3039. parseInt(Cookies.get('decimal'))
  3040. )
  3041. }
  3042. }
  3043. if (row.r1 !== '') {
  3044. this.$set(
  3045. row,
  3046. 'w1',
  3047. formatNum(
  3048. parseFloat(row.feedweight) * (parseFloat(row.r1) / 100),
  3049. parseInt(Cookies.get('decimal'))
  3050. )
  3051. )
  3052. }
  3053. if (row.r2 !== '') {
  3054. this.$set(
  3055. row,
  3056. 'w2',
  3057. formatNum(
  3058. parseFloat(row.feedweight) * (parseFloat(row.r2) / 100),
  3059. parseInt(Cookies.get('decimal'))
  3060. )
  3061. )
  3062. }
  3063. if (row.r3 !== '') {
  3064. this.$set(
  3065. row,
  3066. 'w3',
  3067. formatNum(
  3068. parseFloat(row.feedweight) * (parseFloat(row.r3) / 100),
  3069. parseInt(Cookies.get('decimal'))
  3070. )
  3071. )
  3072. }
  3073. if (row.r4 !== '') {
  3074. this.$set(
  3075. row,
  3076. 'w4',
  3077. formatNum(
  3078. parseFloat(row.feedweight) * (parseFloat(row.r4) / 100),
  3079. parseInt(Cookies.get('decimal'))
  3080. )
  3081. )
  3082. }
  3083. if (row.r5 !== '') {
  3084. this.$set(
  3085. row,
  3086. 'w5',
  3087. formatNum(
  3088. parseFloat(row.feedweight) * (parseFloat(row.r5) / 100),
  3089. parseInt(Cookies.get('decimal'))
  3090. )
  3091. )
  3092. }
  3093. if (row.r6 !== '') {
  3094. this.$set(
  3095. row,
  3096. 'w6',
  3097. formatNum(
  3098. parseFloat(row.feedweight) * (parseFloat(row.r6) / 100),
  3099. parseInt(Cookies.get('decimal'))
  3100. )
  3101. )
  3102. }
  3103. if (row.w1 == '') {
  3104. row.w1 = 0
  3105. }
  3106. if (row.w2 == '') {
  3107. row.w2 = 0
  3108. }
  3109. if (row.w3 == '') {
  3110. row.w3 = 0
  3111. }
  3112. if (row.w4 == '') {
  3113. row.w4 = 0
  3114. }
  3115. if (row.w5 == '') {
  3116. row.w5 = 0
  3117. }
  3118. if (row.w6 == '') {
  3119. row.w6 = 0
  3120. }
  3121. this.$set(
  3122. row,
  3123. 'dailyWeight',
  3124. parseFloat(row.w1) +
  3125. parseFloat(row.w2) +
  3126. parseFloat(row.w3) +
  3127. parseFloat(row.w4) +
  3128. parseFloat(row.w5) +
  3129. parseFloat(row.w6)
  3130. )
  3131. row.dailyWeight = formatNum(
  3132. row.dailyWeight,
  3133. parseInt(Cookies.get('decimal'))
  3134. )
  3135. },
  3136. // 实际牛头数失去焦点计算
  3137. // ccount实际牛头数
  3138. // ratio系数
  3139. // ccountratio系数牛头数
  3140. blurCcount(row) {
  3141. // 实际牛头数
  3142. if (row.ftid !== '-1' && row.ftid !== '') {
  3143. row.Sfweight = this.recipeTemplateList.find(
  3144. (obj) => obj.id == row.ftid
  3145. ).Sfweight
  3146. row.SfweightLock = this.recipeTemplateList.find(
  3147. (obj) => obj.id == row.ftid
  3148. ).SfweightLock
  3149. }
  3150. if (row.w1 == '' || row.w1 == undefined || isNaN(row.w1)) {
  3151. row.w1 = 0
  3152. }
  3153. if (row.w2 == '' || row.w2 == undefined || isNaN(row.w2)) {
  3154. row.w2 = 0
  3155. }
  3156. if (row.w3 == '' || row.w3 == undefined || isNaN(row.w3)) {
  3157. row.w3 = 0
  3158. }
  3159. if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) {
  3160. row.w4 = 0
  3161. }
  3162. if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) {
  3163. row.w5 = 0
  3164. }
  3165. if (row.w6 == '' || row.w6 == undefined || isNaN(row.w6)) {
  3166. row.w6 = 0
  3167. }
  3168. // 系数不变
  3169. // 系数头数=实际牛头数*系数
  3170. row.ccountratio = (row.ccount * row.ratio) / 100
  3171. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  3172. row.ftweight = (((row.ccount * row.ratio) / 100) * row.Sfweight).toFixed(
  3173. this.decimal
  3174. )
  3175. this.public(row)
  3176. this.placeholder(row)
  3177. },
  3178. blurRatio(row) {
  3179. if (row.ftid !== '-1' && row.ftid !== '') {
  3180. row.Sfweight = this.recipeTemplateList.find(
  3181. (obj) => obj.id == row.ftid
  3182. ).Sfweight
  3183. row.SfweightLock = this.recipeTemplateList.find(
  3184. (obj) => obj.id == row.ftid
  3185. ).SfweightLock
  3186. }
  3187. if (row.w1 == '' || row.w1 == undefined || isNaN(row.w1)) {
  3188. row.w1 = 0
  3189. }
  3190. if (row.w2 == '' || row.w2 == undefined || isNaN(row.w2)) {
  3191. row.w2 = 0
  3192. }
  3193. if (row.w3 == '' || row.w3 == undefined || isNaN(row.w3)) {
  3194. row.w3 = 0
  3195. }
  3196. if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) {
  3197. row.w4 = 0
  3198. }
  3199. if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) {
  3200. row.w5 = 0
  3201. }
  3202. if (row.w6 == '' || row.w6 == undefined || isNaN(row.w6)) {
  3203. row.w6 = 0
  3204. }
  3205. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  3206. row.ftweight = (((row.ccount * row.ratio) / 100) * row.Sfweight).toFixed(
  3207. this.decimal
  3208. )
  3209. // 实际牛头数不变
  3210. // 系数头数=实际牛头数*系数
  3211. row.ccountratio = (
  3212. parseFloat(row.ccount) *
  3213. (parseFloat(row.ratio) / 100)
  3214. ).toFixed(this.decimal)
  3215. this.public(row)
  3216. this.placeholder(row)
  3217. },
  3218. blurCcountratio(row) {
  3219. if (row.ftid !== '-1' && row.ftid !== '') {
  3220. row.Sfweight = this.recipeTemplateList.find(
  3221. (obj) => obj.id == row.ftid
  3222. ).Sfweight
  3223. row.SfweightLock = this.recipeTemplateList.find(
  3224. (obj) => obj.id == row.ftid
  3225. ).SfweightLock
  3226. }
  3227. if (row.w1 == '' || row.w1 == undefined || isNaN(row.w1)) {
  3228. row.w1 = 0
  3229. }
  3230. if (row.w2 == '' || row.w2 == undefined || isNaN(row.w2)) {
  3231. row.w2 = 0
  3232. }
  3233. if (row.w3 == '' || row.w3 == undefined || isNaN(row.w3)) {
  3234. row.w3 = 0
  3235. }
  3236. if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) {
  3237. row.w4 = 0
  3238. }
  3239. if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) {
  3240. row.w5 = 0
  3241. }
  3242. if (row.w6 == '' || row.w6 == undefined || isNaN(row.w6)) {
  3243. row.w6 = 0
  3244. }
  3245. // 实际牛头数不变
  3246. // 系数=系数头数/实际牛头数*100
  3247. row.ratio = (
  3248. (parseFloat(row.ccountratio) / parseFloat(row.ccount)) *
  3249. 100
  3250. ).toFixed(this.decimal)
  3251. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  3252. row.ftweight = (((row.ccount * row.ratio) / 100) * row.Sfweight).toFixed(
  3253. this.decimal
  3254. )
  3255. this.public(row)
  3256. this.placeholder(row)
  3257. },
  3258. public(row) {
  3259. console.log(row, 'row')
  3260. // 未锁定时:各班次比例不变,各班次重量=配方重量*各班次比例
  3261. // 锁定时:未锁定班次比例不变,锁定班次比例=班次重量/配方重量x100%
  3262. if (row.isOneWeight == true) {
  3263. if (
  3264. row.w1 &&
  3265. row.ftweight &&
  3266. !isNaN(parseFloat(row.w1)) &&
  3267. !isNaN(parseFloat(row.ftweight))
  3268. ) {
  3269. row.r1 = (
  3270. (parseFloat(row.w1) / parseFloat(row.ftweight)) *
  3271. 100
  3272. ).toFixed(this.decimalr)
  3273. } else {
  3274. row.r1 = 0
  3275. }
  3276. } else {
  3277. if (
  3278. row.r1 &&
  3279. row.ftweight &&
  3280. !isNaN(parseFloat(row.r1)) &&
  3281. !isNaN(parseFloat(row.ftweight))
  3282. ) {
  3283. row.w1 = (
  3284. (parseFloat(row.ftweight) * parseFloat(row.r1)) /
  3285. 100
  3286. ).toFixed(this.decimal)
  3287. } else {
  3288. row.w1 = 0
  3289. }
  3290. }
  3291. if (row.isTwoWeight == true) {
  3292. if (
  3293. row.w2 &&
  3294. row.ftweight &&
  3295. !isNaN(parseFloat(row.w2)) &&
  3296. !isNaN(parseFloat(row.ftweight))
  3297. ) {
  3298. row.r2 = (
  3299. (parseFloat(row.w2) / parseFloat(row.ftweight)) *
  3300. 100
  3301. ).toFixed(this.decimalr)
  3302. } else {
  3303. row.r2 = 0
  3304. }
  3305. } else {
  3306. if (
  3307. row.r2 &&
  3308. row.ftweight &&
  3309. !isNaN(parseFloat(row.r2)) &&
  3310. !isNaN(parseFloat(row.ftweight))
  3311. ) {
  3312. row.w2 = (
  3313. (parseFloat(row.ftweight) * parseFloat(row.r2)) /
  3314. 100
  3315. ).toFixed(this.decimal)
  3316. } else {
  3317. row.w2 = 0
  3318. }
  3319. }
  3320. if (row.isThreeWeight == true) {
  3321. if (
  3322. row.w3 &&
  3323. row.ftweight &&
  3324. !isNaN(parseFloat(row.w3)) &&
  3325. !isNaN(parseFloat(row.ftweight))
  3326. ) {
  3327. row.r3 = (
  3328. (parseFloat(row.w3) / parseFloat(row.ftweight)) *
  3329. 100
  3330. ).toFixed(this.decimalr)
  3331. } else {
  3332. row.r3 = 0
  3333. }
  3334. } else {
  3335. if (
  3336. row.r3 &&
  3337. row.ftweight &&
  3338. !isNaN(parseFloat(row.r3)) &&
  3339. !isNaN(parseFloat(row.ftweight))
  3340. ) {
  3341. row.w3 = (
  3342. (parseFloat(row.ftweight) * parseFloat(row.r3)) /
  3343. 100
  3344. ).toFixed(this.decimal)
  3345. } else {
  3346. row.w3 = 0
  3347. }
  3348. }
  3349. if (row.isFourWeight == true) {
  3350. if (
  3351. row.w4 &&
  3352. row.ftweight &&
  3353. !isNaN(parseFloat(row.w4)) &&
  3354. !isNaN(parseFloat(row.ftweight))
  3355. ) {
  3356. row.r4 = (
  3357. (parseFloat(row.w4) / parseFloat(row.ftweight)) *
  3358. 100
  3359. ).toFixed(this.decimalr)
  3360. } else {
  3361. row.r4 = 0
  3362. }
  3363. } else {
  3364. if (
  3365. row.r4 &&
  3366. row.ftweight &&
  3367. !isNaN(parseFloat(row.r4)) &&
  3368. !isNaN(parseFloat(row.ftweight))
  3369. ) {
  3370. row.w4 = (
  3371. (parseFloat(row.ftweight) * parseFloat(row.r4)) /
  3372. 100
  3373. ).toFixed(this.decimal)
  3374. } else {
  3375. row.w4 = 0
  3376. }
  3377. }
  3378. if (row.isFiveWeight == true) {
  3379. if (
  3380. row.w5 &&
  3381. row.ftweight &&
  3382. !isNaN(parseFloat(row.w5)) &&
  3383. !isNaN(parseFloat(row.ftweight))
  3384. ) {
  3385. row.r5 = (
  3386. (parseFloat(row.w5) / parseFloat(row.ftweight)) *
  3387. 100
  3388. ).toFixed(this.decimalr)
  3389. } else {
  3390. row.r5 = 0
  3391. }
  3392. } else {
  3393. if (
  3394. row.r5 &&
  3395. row.ftweight &&
  3396. !isNaN(parseFloat(row.r5)) &&
  3397. !isNaN(parseFloat(row.ftweight))
  3398. ) {
  3399. row.w5 = (
  3400. (parseFloat(row.ftweight) * parseFloat(row.r5)) /
  3401. 100
  3402. ).toFixed(this.decimal)
  3403. } else {
  3404. row.w5 = 0
  3405. }
  3406. }
  3407. if (row.isSixWeight == true) {
  3408. if (
  3409. row.w6 &&
  3410. row.ftweight &&
  3411. !isNaN(parseFloat(row.w6)) &&
  3412. !isNaN(parseFloat(row.ftweight))
  3413. ) {
  3414. row.r6 = (
  3415. (parseFloat(row.w6) / parseFloat(row.ftweight)) *
  3416. 100
  3417. ).toFixed(this.decimalr)
  3418. } else {
  3419. row.r5 = 0
  3420. }
  3421. } else {
  3422. if (
  3423. row.r6 &&
  3424. row.ftweight &&
  3425. !isNaN(parseFloat(row.r6)) &&
  3426. !isNaN(parseFloat(row.ftweight))
  3427. ) {
  3428. row.w6 = (
  3429. (parseFloat(row.ftweight) * parseFloat(row.r6)) /
  3430. 100
  3431. ).toFixed(this.decimal)
  3432. } else {
  3433. row.w6 = 0
  3434. }
  3435. }
  3436. console.log(row, 'row2')
  3437. if (
  3438. row.isOneWeight ||
  3439. row.isTWoWeight ||
  3440. row.isThreeWeight ||
  3441. row.isFourWeight ||
  3442. row.isFiveWeight ||
  3443. row.isSixWeight
  3444. ) {
  3445. var sumr = 0
  3446. if (row.r1 && !isNaN(row.r1)) {
  3447. sumr += parseFloat(row.r1)
  3448. }
  3449. if (row.r2 && !isNaN(row.r2)) {
  3450. sumr += parseFloat(row.r2)
  3451. }
  3452. if (row.r3 && !isNaN(row.r3)) {
  3453. sumr += parseFloat(row.r3)
  3454. }
  3455. if (row.r4 && !isNaN(row.r4)) {
  3456. sumr += parseFloat(row.r4)
  3457. }
  3458. if (row.r5 && !isNaN(row.r5)) {
  3459. sumr += parseFloat(row.r5)
  3460. }
  3461. if (row.r6 && !isNaN(row.r6)) {
  3462. sumr += parseFloat(row.r6)
  3463. }
  3464. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  3465. } else {
  3466. // 总比例不变
  3467. var sumr = 0
  3468. if (row.r1 && !isNaN(row.r1)) {
  3469. sumr += parseFloat(row.r1)
  3470. }
  3471. if (row.r2 && !isNaN(row.r2)) {
  3472. sumr += parseFloat(row.r2)
  3473. }
  3474. if (row.r3 && !isNaN(row.r3)) {
  3475. sumr += parseFloat(row.r3)
  3476. }
  3477. if (row.r4 && !isNaN(row.r4)) {
  3478. sumr += parseFloat(row.r4)
  3479. }
  3480. if (row.r5 && !isNaN(row.r5)) {
  3481. sumr += parseFloat(row.r5)
  3482. }
  3483. if (row.r6 && !isNaN(row.r6)) {
  3484. sumr += parseFloat(row.r6)
  3485. }
  3486. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  3487. }
  3488. // 饲喂投喂量 = 所有班次重量之和
  3489. var sumw = 0
  3490. if (row.w1 && !isNaN(row.w1)) {
  3491. sumw += parseFloat(row.w1)
  3492. }
  3493. if (row.w2 && !isNaN(row.w2)) {
  3494. sumw += parseFloat(row.w2)
  3495. }
  3496. if (row.w3 && !isNaN(row.w3)) {
  3497. sumw += parseFloat(row.w3)
  3498. }
  3499. if (row.w4 && !isNaN(row.w4)) {
  3500. sumw += parseFloat(row.w4)
  3501. }
  3502. if (row.w5 && !isNaN(row.w5)) {
  3503. sumw += parseFloat(row.w5)
  3504. }
  3505. if (row.w6 && !isNaN(row.w6)) {
  3506. sumw += parseFloat(row.w6)
  3507. }
  3508. this.$set(row, 'sumw', sumw.toFixed(this.decimal))
  3509. // 日投喂量 = 饲喂投喂量+补料
  3510. if (isNaN(row.bw1) || row.bw1 == '') {
  3511. this.$set(row, 'bw1', 0)
  3512. }
  3513. if (isNaN(row.bw2) || row.bw2 == '') {
  3514. this.$set(row, 'bw2', 0)
  3515. }
  3516. if (isNaN(row.bw3) || row.bw3 == '') {
  3517. this.$set(row, 'bw3', 0)
  3518. }
  3519. if (isNaN(row.bw4) || row.bw4 == '') {
  3520. this.$set(row, 'bw4', 0)
  3521. }
  3522. if (isNaN(row.bw5) || row.bw5 == '') {
  3523. this.$set(row, 'bw5', 0)
  3524. }
  3525. if (isNaN(row.bw6) || row.bw6 == '') {
  3526. this.$set(row, 'bw6', 0)
  3527. }
  3528. // var sumbw = (parseFloat(row.bw1) + parseFloat(row.bw2) + parseFloat(row.bw3) + parseFloat(row.bw4) + parseFloat(row.bw5) + parseFloat(row.bw6)).toFixed(this.decimal)
  3529. var sumbw = 0
  3530. if (row.bw1 && !isNaN(row.bw1)) {
  3531. sumbw += parseFloat(row.bw1)
  3532. }
  3533. if (row.bw2 && !isNaN(row.bw2)) {
  3534. sumbw += parseFloat(row.bw2)
  3535. }
  3536. if (row.bw3 && !isNaN(row.bw3)) {
  3537. sumbw += parseFloat(row.bw3)
  3538. }
  3539. if (row.bw4 && !isNaN(row.bw4)) {
  3540. sumbw += parseFloat(row.bw4)
  3541. }
  3542. if (row.bw5 && !isNaN(row.bw5)) {
  3543. sumbw += parseFloat(row.bw5)
  3544. }
  3545. if (row.bw6 && !isNaN(row.bw6)) {
  3546. sumbw += parseFloat(row.bw6)
  3547. }
  3548. this.$set(row, 'sumbw', sumbw.toFixed(this.decimal))
  3549. var todayfeed = parseFloat(sumw) + parseFloat(sumbw)
  3550. this.$set(row, 'todayfeed', todayfeed)
  3551. },
  3552. blurR(row, item) {
  3553. if (row.ftid !== '-1' && row.ftid !== '') {
  3554. row.Sfweight = this.recipeTemplateList.find(
  3555. (obj) => obj.id == row.ftid
  3556. ).Sfweight
  3557. }
  3558. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  3559. row.ftweight = (
  3560. ((parseFloat(row.ccount) * parseFloat(row.ratio)) / 100) *
  3561. parseFloat(row.Sfweight)
  3562. ).toFixed(this.decimal)
  3563. console.log(parseFloat(row.ccount), '======ccount')
  3564. console.log(parseFloat(row.ftweight), '======ftweight')
  3565. if (item == 1) {
  3566. // 一班比例
  3567. if (
  3568. !isNaN(parseFloat(row.r1)) &&
  3569. !isNaN(parseFloat(row.ftweight)) &&
  3570. row.r1 &&
  3571. row.ftweight
  3572. ) {
  3573. row.w1 = (
  3574. (parseFloat(row.r1) / 100) *
  3575. parseFloat(row.ftweight)
  3576. ).toFixed(this.decimal)
  3577. } else {
  3578. row.w1 = 0
  3579. }
  3580. } else if (item == 2) {
  3581. // 二班比例
  3582. if (
  3583. !isNaN(parseFloat(row.r2)) &&
  3584. !isNaN(parseFloat(row.ftweight)) &&
  3585. row.r2 &&
  3586. row.ftweight
  3587. ) {
  3588. row.w2 = (
  3589. (parseFloat(row.r2) / 100) *
  3590. parseFloat(row.ftweight)
  3591. ).toFixed(this.decimal)
  3592. } else {
  3593. row.w2 = 0
  3594. }
  3595. } else if (item == 3) {
  3596. // 三班比例
  3597. if (
  3598. !isNaN(parseFloat(row.r3)) &&
  3599. !isNaN(parseFloat(row.ftweight)) &&
  3600. row.r3 &&
  3601. row.ftweight
  3602. ) {
  3603. row.w3 = (
  3604. (parseFloat(row.r3) / 100) *
  3605. parseFloat(row.ftweight)
  3606. ).toFixed(this.decimal)
  3607. } else {
  3608. row.w3 = 0
  3609. }
  3610. } else if (item == 4) {
  3611. // 四班比例
  3612. if (
  3613. !isNaN(parseFloat(row.r4)) &&
  3614. !isNaN(parseFloat(row.ftweight)) &&
  3615. row.r4 &&
  3616. row.ftweight
  3617. ) {
  3618. row.w4 = (
  3619. (parseFloat(row.r4) / 100) *
  3620. parseFloat(row.ftweight)
  3621. ).toFixed(this.decimal)
  3622. } else {
  3623. row.w4 = 0
  3624. }
  3625. } else if (item == 5) {
  3626. // 五班比例
  3627. if (
  3628. !isNaN(parseFloat(row.r5)) &&
  3629. !isNaN(parseFloat(row.ftweight)) &&
  3630. row.r5 &&
  3631. row.ftweight
  3632. ) {
  3633. row.w5 = (
  3634. (parseFloat(row.r5) / 100) *
  3635. parseFloat(row.ftweight)
  3636. ).toFixed(this.decimal)
  3637. } else {
  3638. row.w5 = 0
  3639. }
  3640. } else if (item == 6) {
  3641. // 六班比例
  3642. if (
  3643. !isNaN(parseFloat(row.r6)) &&
  3644. !isNaN(parseFloat(row.ftweight)) &&
  3645. row.r6 &&
  3646. row.ftweight
  3647. ) {
  3648. row.w6 = (
  3649. (parseFloat(row.r6) / 100) *
  3650. parseFloat(row.ftweight)
  3651. ).toFixed(this.decimal)
  3652. } else {
  3653. row.w6 = 0
  3654. }
  3655. }
  3656. // 总比例=所有比例之和
  3657. // 饲喂投喂量 = 所有班次重量之和
  3658. var sumr = 0
  3659. if (row.r1 && !isNaN(row.r1)) {
  3660. sumr += parseFloat(row.r1)
  3661. }
  3662. if (row.r2 && !isNaN(row.r2)) {
  3663. sumr += parseFloat(row.r2)
  3664. }
  3665. if (row.r3 && !isNaN(row.r3)) {
  3666. sumr += parseFloat(row.r3)
  3667. }
  3668. if (row.r4 && !isNaN(row.r4)) {
  3669. sumr += parseFloat(row.r4)
  3670. }
  3671. if (row.r5 && !isNaN(row.r5)) {
  3672. sumr += parseFloat(row.r5)
  3673. }
  3674. if (row.r6 && !isNaN(row.r6)) {
  3675. sumr += parseFloat(row.r6)
  3676. }
  3677. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  3678. var sumw = 0
  3679. if (row.w1 && !isNaN(row.w1)) {
  3680. sumw += parseFloat(row.w1)
  3681. }
  3682. if (row.w2 && !isNaN(row.w2)) {
  3683. sumw += parseFloat(row.w2)
  3684. }
  3685. if (row.w3 && !isNaN(row.w3)) {
  3686. sumw += parseFloat(row.w3)
  3687. }
  3688. if (row.w4 && !isNaN(row.w4)) {
  3689. sumw += parseFloat(row.w4)
  3690. }
  3691. if (row.w5 && !isNaN(row.w5)) {
  3692. sumw += parseFloat(row.w5)
  3693. }
  3694. if (row.w6 && !isNaN(row.w6)) {
  3695. sumw += parseFloat(row.w6)
  3696. }
  3697. this.$set(row, 'sumw', sumw.toFixed(this.decimal))
  3698. // 日投喂量 = 饲喂投喂量+补料
  3699. if (isNaN(row.bw1) || row.bw1 == '' || row.bw1 == undefined) {
  3700. this.$set(row, 'bw1', 0)
  3701. }
  3702. if (isNaN(row.bw2) || row.bw2 == '' || row.bw1 == undefined) {
  3703. this.$set(row, 'bw2', 0)
  3704. }
  3705. if (isNaN(row.bw3) || row.bw3 == '' || row.bw1 == undefined) {
  3706. this.$set(row, 'bw3', 0)
  3707. }
  3708. if (isNaN(row.bw4) || row.bw4 == '' || row.bw1 == undefined) {
  3709. this.$set(row, 'bw4', 0)
  3710. }
  3711. if (isNaN(row.bw5) || row.bw5 == '' || row.bw1 == undefined) {
  3712. this.$set(row, 'bw5', 0)
  3713. }
  3714. if (isNaN(row.bw6) || row.bw6 == '' || row.bw1 == undefined) {
  3715. this.$set(row, 'bw6', 0)
  3716. }
  3717. var sumbw = 0
  3718. if (row.bw1 && !isNaN(row.bw1)) {
  3719. sumbw += parseFloat(row.bw1)
  3720. }
  3721. if (row.bw2 && !isNaN(row.bw2)) {
  3722. sumbw += parseFloat(row.bw2)
  3723. }
  3724. if (row.bw3 && !isNaN(row.bw3)) {
  3725. sumbw += parseFloat(row.bw3)
  3726. }
  3727. if (row.bw4 && !isNaN(row.bw4)) {
  3728. sumbw += parseFloat(row.bw4)
  3729. }
  3730. if (row.bw5 && !isNaN(row.bw5)) {
  3731. sumbw += parseFloat(row.bw5)
  3732. }
  3733. if (row.bw6 && !isNaN(row.bw6)) {
  3734. sumbw += parseFloat(row.bw6)
  3735. }
  3736. this.$set(row, 'sumbw', sumbw.toFixed(this.decimal))
  3737. // var sumbw = (parseFloat(row.bw1) + parseFloat(row.bw2) + parseFloat(row.bw3) + parseFloat(row.bw4) + parseFloat(row.bw5) + parseFloat(row.bw6)).toFixed(this.decimal)
  3738. var todayfeed = parseFloat(sumw) + parseFloat(sumbw)
  3739. console.log(todayfeed, 'sumw==')
  3740. this.$set(row, 'todayfeed', todayfeed)
  3741. this.placeholder(row)
  3742. },
  3743. placeholder(row) {
  3744. this.$set(row, 'placeholder_r1', this.oldRowList.r1)
  3745. this.$set(row, 'placeholder_r2', this.oldRowList.r2)
  3746. this.$set(row, 'placeholder_r3', this.oldRowList.r3)
  3747. this.$set(row, 'placeholder_r4', this.oldRowList.r4)
  3748. this.$set(row, 'placeholder_r5', this.oldRowList.r5)
  3749. this.$set(row, 'placeholder_r6', this.oldRowList.r6)
  3750. this.$set(row, 'placeholder_w1', this.oldRowList.w1)
  3751. this.$set(row, 'placeholder_w2', this.oldRowList.w2)
  3752. this.$set(row, 'placeholder_w3', this.oldRowList.w3)
  3753. this.$set(row, 'placeholder_w4', this.oldRowList.w4)
  3754. this.$set(row, 'placeholder_w5', this.oldRowList.w5)
  3755. this.$set(row, 'placeholder_w6', this.oldRowList.w6)
  3756. this.$set(row, 'placeholder_bw1', this.oldRowList.bw1)
  3757. this.$set(row, 'placeholder_bw2', this.oldRowList.bw2)
  3758. this.$set(row, 'placeholder_bw3', this.oldRowList.bw3)
  3759. this.$set(row, 'placeholder_bw4', this.oldRowList.bw4)
  3760. this.$set(row, 'placeholder_bw5', this.oldRowList.bw5)
  3761. this.$set(row, 'placeholder_bw6', this.oldRowList.bw6)
  3762. this.$set(row, 'placeholder_ccount', this.oldRowList.ccount)
  3763. this.$set(row, 'placeholder_ratio', this.oldRowList.ratio)
  3764. this.$set(row, 'placeholder_ccountratio', this.oldRowList.ccountratio)
  3765. },
  3766. blurWeight(row, item) {
  3767. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  3768. if (row.ftid !== '-1' && row.ftid !== '') {
  3769. row.Sfweight = this.recipeTemplateList.find(
  3770. (obj) => obj.id == row.ftid
  3771. ).Sfweight
  3772. }
  3773. if (item == 1) {
  3774. // 一班重量
  3775. if (
  3776. !isNaN(parseFloat(row.w1)) &&
  3777. !isNaN(parseFloat(row.ftweight)) &&
  3778. row.w1 &&
  3779. row.ftweight
  3780. ) {
  3781. row.r1 = (
  3782. (parseFloat(row.w1) / parseFloat(row.ftweight)) *
  3783. 100
  3784. ).toFixed(this.decimalr)
  3785. } else {
  3786. row.r1 = 0
  3787. }
  3788. } else if (item == 2) {
  3789. // 二班重量
  3790. if (
  3791. !isNaN(parseFloat(row.w2)) &&
  3792. !isNaN(parseFloat(row.ftweight)) &&
  3793. row.w2 &&
  3794. row.ftweight
  3795. ) {
  3796. row.r2 = (
  3797. (parseFloat(row.w2) / parseFloat(row.ftweight)) *
  3798. 100
  3799. ).toFixed(this.decimalr)
  3800. } else {
  3801. row.r2 = 0
  3802. }
  3803. } else if (item == 3) {
  3804. // 三班重量
  3805. if (
  3806. !isNaN(parseFloat(row.w3)) &&
  3807. !isNaN(parseFloat(row.ftweight)) &&
  3808. row.w3 &&
  3809. row.ftweight
  3810. ) {
  3811. row.r3 = (
  3812. (parseFloat(row.w3) / parseFloat(row.ftweight)) *
  3813. 100
  3814. ).toFixed(this.decimalr)
  3815. } else {
  3816. row.r3 = 0
  3817. }
  3818. } else if (item == 4) {
  3819. // 四班重量
  3820. if (
  3821. !isNaN(parseFloat(row.w4)) &&
  3822. !isNaN(parseFloat(row.ftweight)) &&
  3823. row.w4 &&
  3824. row.ftweight
  3825. ) {
  3826. row.r4 = (
  3827. (parseFloat(row.w4) / parseFloat(row.ftweight)) *
  3828. 100
  3829. ).toFixed(this.decimalr)
  3830. } else {
  3831. row.r4 = 0
  3832. }
  3833. } else if (item == 5) {
  3834. // 五班重量
  3835. if (
  3836. !isNaN(parseFloat(row.w5)) &&
  3837. !isNaN(parseFloat(row.ftweight)) &&
  3838. row.w5 &&
  3839. row.ftweight
  3840. ) {
  3841. row.r5 = (
  3842. (parseFloat(row.w5) / parseFloat(row.ftweight)) *
  3843. 100
  3844. ).toFixed(this.decimalr)
  3845. } else {
  3846. row.r5 = 0
  3847. }
  3848. } else if (item == 6) {
  3849. // 六班重量
  3850. if (
  3851. !isNaN(parseFloat(row.w6)) &&
  3852. !isNaN(parseFloat(row.ftweight)) &&
  3853. row.w6 &&
  3854. row.ftweight
  3855. ) {
  3856. row.r6 = (
  3857. (parseFloat(row.w6) / parseFloat(row.ftweight)) *
  3858. 100
  3859. ).toFixed(this.decimalr)
  3860. } else {
  3861. row.r6 = 0
  3862. }
  3863. }
  3864. // 总比例=所有比例之和
  3865. // 饲喂投喂量 = 所有班次重量之和
  3866. var sumr = 0
  3867. if (row.r1 && !isNaN(row.r1)) {
  3868. sumr += parseFloat(row.r1)
  3869. }
  3870. if (row.r2 && !isNaN(row.r2)) {
  3871. sumr += parseFloat(row.r2)
  3872. }
  3873. if (row.r3 && !isNaN(row.r3)) {
  3874. sumr += parseFloat(row.r3)
  3875. }
  3876. if (row.r4 && !isNaN(row.r4)) {
  3877. sumr += parseFloat(row.r4)
  3878. }
  3879. if (row.r5 && !isNaN(row.r5)) {
  3880. sumr += parseFloat(row.r5)
  3881. }
  3882. if (row.r6 && !isNaN(row.r6)) {
  3883. sumr += parseFloat(row.r6)
  3884. }
  3885. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  3886. var sumw = 0
  3887. if (row.w1 && !isNaN(row.w1)) {
  3888. sumw += parseFloat(row.w1)
  3889. }
  3890. if (row.w2 && !isNaN(row.w2)) {
  3891. sumw += parseFloat(row.w2)
  3892. }
  3893. if (row.w3 && !isNaN(row.w3)) {
  3894. sumw += parseFloat(row.w3)
  3895. }
  3896. if (row.w4 && !isNaN(row.w4)) {
  3897. sumw += parseFloat(row.w4)
  3898. }
  3899. if (row.w5 && !isNaN(row.w5)) {
  3900. sumw += parseFloat(row.w5)
  3901. }
  3902. if (row.w6 && !isNaN(row.w6)) {
  3903. sumw += parseFloat(row.w6)
  3904. }
  3905. this.$set(row, 'sumw', sumw.toFixed(this.decimal))
  3906. // 日投喂量 = 饲喂投喂量+补料
  3907. if (isNaN(row.bw1) || row.bw1 == '' || row.bw1 == undefined) {
  3908. this.$set(row, 'bw1', 0)
  3909. }
  3910. if (isNaN(row.bw2) || row.bw2 == '' || row.bw2 == undefined) {
  3911. this.$set(row, 'bw2', 0)
  3912. }
  3913. if (isNaN(row.bw3) || row.bw3 == '' || row.bw3 == undefined) {
  3914. this.$set(row, 'bw3', 0)
  3915. }
  3916. if (isNaN(row.bw4) || row.bw4 == '' || row.bw4 == undefined) {
  3917. this.$set(row, 'bw4', 0)
  3918. }
  3919. if (isNaN(row.bw5) || row.bw5 == '' || row.bw5 == undefined) {
  3920. this.$set(row, 'bw5', 0)
  3921. }
  3922. if (isNaN(row.bw6) || row.bw6 == '' || row.bw6 == undefined) {
  3923. this.$set(row, 'bw6', 0)
  3924. }
  3925. var sumbw = 0
  3926. if (row.bw1 && !isNaN(row.bw1)) {
  3927. sumbw += parseFloat(row.bw1)
  3928. }
  3929. if (row.bw2 && !isNaN(row.bw2)) {
  3930. sumbw += parseFloat(row.bw2)
  3931. }
  3932. if (row.bw3 && !isNaN(row.bw3)) {
  3933. sumbw += parseFloat(row.bw3)
  3934. }
  3935. if (row.bw4 && !isNaN(row.bw4)) {
  3936. sumbw += parseFloat(row.bw4)
  3937. }
  3938. if (row.bw5 && !isNaN(row.bw5)) {
  3939. sumbw += parseFloat(row.bw5)
  3940. }
  3941. if (row.bw6 && !isNaN(row.bw6)) {
  3942. sumbw += parseFloat(row.bw6)
  3943. }
  3944. this.$set(row, 'sumbw', sumbw.toFixed(this.decimal))
  3945. // var sumbw = (parseFloat(row.bw1) + parseFloat(row.bw2) + parseFloat(row.bw3) + parseFloat(row.bw4) + parseFloat(row.bw5) + parseFloat(row.bw6)).toFixed(this.decimal)
  3946. var todayfeed = parseFloat(sumw) + parseFloat(sumbw)
  3947. this.$set(row, 'todayfeed', todayfeed)
  3948. this.placeholder(row)
  3949. },
  3950. blurBw(row) {
  3951. this.placeholder(row)
  3952. },
  3953. celldblclick(row, column, cell, event) {
  3954. console.log(row, '=====')
  3955. if (!this.isproportion) {
  3956. this.handleUpdate(row)
  3957. }
  3958. },
  3959. // 编辑
  3960. handleUpdate(row) {
  3961. console.log(row)
  3962. this.oldRowList = { ...row }
  3963. for (let i = 0; i < this.table.list.length; i++) {
  3964. if (this.table.list[i].Edit == true) {
  3965. this.$message({
  3966. type: 'error',
  3967. message: this.$t('driver.messageNote'),
  3968. duration: 2000
  3969. })
  3970. return false
  3971. }
  3972. }
  3973. // 编辑true,不可编辑false
  3974. row.Edit = true
  3975. row.NoEdit = false
  3976. // 编辑false,编辑保存true
  3977. row.isUpdate = false
  3978. row.isUpdateSave = true
  3979. row.ftid = String(row.ftid)
  3980. if (row.ptsfid == '-1') {
  3981. row.ptsfid = ''
  3982. }
  3983. row.ptsfid = String(row.ptsfid)
  3984. // dryweight
  3985. this.table.temp.ftid = row.ftid
  3986. this.table.temp.ftname = row.ftname
  3987. this.table.temp.ptsfid = row.ptsfid
  3988. this.table.temp.ptsfname = row.ptsfname
  3989. },
  3990. updateData(row) {
  3991. if (isNaN(row.r1)) {
  3992. this.$set(row, 'r1', 0)
  3993. }
  3994. if (isNaN(row.r2)) {
  3995. this.$set(row, 'r2', 0)
  3996. }
  3997. if (isNaN(row.r3)) {
  3998. this.$set(row, 'r3', 0)
  3999. }
  4000. if (isNaN(row.r4)) {
  4001. this.$set(row, 'r4', 0)
  4002. }
  4003. if (isNaN(row.r5)) {
  4004. this.$set(row, 'r5', 0)
  4005. }
  4006. if (isNaN(row.r6)) {
  4007. this.$set(row, 'r6', 0)
  4008. }
  4009. if (isNaN(row.w1)) {
  4010. this.$set(row, 'w1', 0)
  4011. }
  4012. if (isNaN(row.w2)) {
  4013. this.$set(row, 'w2', 0)
  4014. }
  4015. if (isNaN(row.w3)) {
  4016. this.$set(row, 'w3', 0)
  4017. }
  4018. if (isNaN(row.w4)) {
  4019. this.$set(row, 'w4', 0)
  4020. }
  4021. if (isNaN(row.w5)) {
  4022. this.$set(row, 'w5', 0)
  4023. }
  4024. if (isNaN(row.w6)) {
  4025. this.$set(row, 'w6', 0)
  4026. }
  4027. if (isNaN(row.bw1)) {
  4028. this.$set(row, 'bw1', 0)
  4029. }
  4030. if (isNaN(row.bw2)) {
  4031. this.$set(row, 'bw2', 0)
  4032. }
  4033. if (isNaN(row.bw3)) {
  4034. this.$set(row, 'bw3', 0)
  4035. }
  4036. if (isNaN(row.bw4)) {
  4037. this.$set(row, 'bw4', 0)
  4038. }
  4039. if (isNaN(row.bw5)) {
  4040. this.$set(row, 'bw5', 0)
  4041. }
  4042. if (isNaN(row.bw6)) {
  4043. this.$set(row, 'bw6', 0)
  4044. }
  4045. var arr = []
  4046. for (let i = 1; i <= this.table.RWLength; i++) {
  4047. var obj = {}
  4048. obj['times'] = i
  4049. obj['pastureid'] = row.pastureid
  4050. obj['barid'] = row.barid
  4051. obj['cowcount'] = row.ccount
  4052. obj['ccountradio'] = row.ccountradio
  4053. obj['ptid'] = row.ftid
  4054. if (row.ptsfid !== '') {
  4055. obj['ptsid'] = row.ptsfid
  4056. } else {
  4057. obj['ptsid'] = '-1'
  4058. }
  4059. obj['weight'] = row['w' + i]
  4060. if (row['bw' + i] == '') {
  4061. obj['supplement'] = 0
  4062. } else {
  4063. obj['supplement'] = row['bw' + i]
  4064. }
  4065. obj['tratio'] = parseFloat(row['r' + i]).toFixed(
  4066. parseInt(Cookies.get('decimalr'))
  4067. )
  4068. obj['todaysupplement'] = row.todaysupplement
  4069. obj['todayweight'] = row.todayweight
  4070. arr.push(obj)
  4071. }
  4072. arr.forEach((item) => {
  4073. if (isNaN(item.tratio)) {
  4074. item.tratio = 0
  4075. }
  4076. })
  4077. if (this.table.isPtsfname == 0) {
  4078. row.ptsfid = '-1'
  4079. row.ptsfname = ''
  4080. } else {
  4081. if (row.ptsfid == '') {
  4082. row.ptsfid = '-1'
  4083. row.ptsfname = ''
  4084. }
  4085. }
  4086. if (row.supplyweight == '') {
  4087. row.supplyweight = '0'
  4088. }
  4089. if (this.table.isPtsfname == false) {
  4090. row.supplyweight = '0'
  4091. }
  4092. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  4093. this.$set(
  4094. row,
  4095. 'ccountratio',
  4096. Math.floor(parseFloat(row.ccountratio) * 100) / 100
  4097. )
  4098. row.ccountratio = String(row.ccountratio)
  4099. row.sumr = Math.round(row.sumr)
  4100. // for(let i=0;i<arr.length;i++){
  4101. // if(arr[i].tratio == undefined ||arr[i].tratio =='' || arr[i].tratio == null){
  4102. // arr[i].tratio = 0
  4103. // }
  4104. // }
  4105. this.table.rwList = arr
  4106. console.log('点击了编辑保存', row)
  4107. if (row.feedweight == '') {
  4108. row.feedweight = row.todayweight
  4109. }
  4110. this.table.temp.pastureid = row.pastureid
  4111. this.table.temp.id = row.id
  4112. this.table.temp.barname = row.barname
  4113. this.table.temp.barid = row.barid
  4114. this.table.temp.ccount = row.ccount
  4115. this.table.temp.ratio = row.ratio
  4116. this.table.temp.ccountratio = row.ccountratio
  4117. this.table.temp.ftid = row.ftid
  4118. this.table.temp.ftname = row.ftname
  4119. this.table.temp.ptsfid = row.ptsfid
  4120. this.table.temp.ptsfname = row.ptsfname
  4121. this.table.temp.ftweight = row.ftweight
  4122. this.table.temp.supplyweight = row.supplyweight
  4123. this.table.temp.feedweight = row.feedweight
  4124. this.table.temp.owner = row.owner
  4125. this.table.temp.sumr = row.sumr
  4126. if (row.softccount == '') {
  4127. row.softccount = 0
  4128. }
  4129. if (row.r1 == '' || isNaN(row.r1)) {
  4130. row.r1 = 0
  4131. }
  4132. if (row.r2 == '' || isNaN(row.r2)) {
  4133. row.r2 = 0
  4134. }
  4135. if (row.r3 == '' || isNaN(row.r3)) {
  4136. row.r3 = 0
  4137. }
  4138. if (row.r4 == '' || isNaN(row.r4)) {
  4139. row.r4 = 0
  4140. }
  4141. if (row.r5 == '' || isNaN(row.r5)) {
  4142. row.r5 = 0
  4143. }
  4144. if (row.r6 == '' || isNaN(row.r6)) {
  4145. row.r6 = 0
  4146. }
  4147. if (row.w1 == '' || isNaN(row.w1)) {
  4148. row.w1 = 0
  4149. }
  4150. if (row.w2 == '' || isNaN(row.w2)) {
  4151. row.w2 = 0
  4152. }
  4153. if (row.w3 == '' || isNaN(row.w3)) {
  4154. row.w3 = 0
  4155. }
  4156. if (row.w4 == '' || isNaN(row.w4)) {
  4157. row.w4 = 0
  4158. }
  4159. if (row.w5 == '' || isNaN(row.w5)) {
  4160. row.w5 = 0
  4161. }
  4162. if (row.w6 == '' || isNaN(row.w6)) {
  4163. row.w6 = 0
  4164. }
  4165. console.log(row, '===========')
  4166. this.table.temp.softccount = row.softccount
  4167. this.table.temp.r1 = Math.round(row.r1)
  4168. this.table.temp.r2 = Math.round(row.r2)
  4169. this.table.temp.r3 = Math.round(row.r3)
  4170. this.table.temp.r4 = Math.round(row.r4)
  4171. this.table.temp.r5 = Math.round(row.r5)
  4172. this.table.temp.r6 = Math.round(row.r6)
  4173. this.table.temp.w1 = row.w1
  4174. this.table.temp.w2 = row.w2
  4175. this.table.temp.w3 = row.w3
  4176. this.table.temp.w4 = row.w4
  4177. this.table.temp.w5 = row.w5
  4178. this.table.temp.w6 = row.w6
  4179. var obj = {}
  4180. obj.userId = Cookies.get('employeid')
  4181. obj.pastureid = row.pastureid
  4182. obj.id = row.id
  4183. obj.data = []
  4184. if (this.oldRowList.w1 !== row.w1) {
  4185. obj.data.push({
  4186. old: this.oldRowList.w1,
  4187. new: row.w1,
  4188. times: 1,
  4189. ptid: row.ftid,
  4190. ptsid: row.ptsfid
  4191. })
  4192. }
  4193. if (this.oldRowList.w2 !== row.w2) {
  4194. obj.data.push({
  4195. old: this.oldRowList.w2,
  4196. new: row.w2,
  4197. times: 2,
  4198. ptid: row.ftid,
  4199. ptsid: row.ptsfid
  4200. })
  4201. }
  4202. if (this.oldRowList.w3 !== row.w3) {
  4203. obj.data.push({
  4204. old: this.oldRowList.w3,
  4205. new: row.w3,
  4206. times: 3,
  4207. ptid: row.ftid,
  4208. ptsid: row.ptsfid
  4209. })
  4210. }
  4211. if (this.oldRowList.w4 !== row.w4) {
  4212. obj.data.push({
  4213. old: this.oldRowList.w4,
  4214. new: row.w4,
  4215. times: 4,
  4216. ptid: row.ftid,
  4217. ptsid: row.ptsfid
  4218. })
  4219. }
  4220. if (this.oldRowList.w5 !== row.w5) {
  4221. obj.data.push({
  4222. old: this.oldRowList.w5,
  4223. new: row.w5,
  4224. times: 5,
  4225. ptid: row.ftid,
  4226. ptsid: row.ptsfid
  4227. })
  4228. }
  4229. if (this.oldRowList.w6 !== row.w6) {
  4230. obj.data.push({
  4231. old: this.oldRowList.w6,
  4232. new: row.w6,
  4233. times: 6,
  4234. ptid: row.ftid,
  4235. ptsid: row.ptsfid
  4236. })
  4237. }
  4238. if (this.oldRowList.bw1 !== row.bw1) {
  4239. obj.data.push({
  4240. old: this.oldRowList.bw1,
  4241. new: row.bw1,
  4242. times: 1,
  4243. ptid: row.ftid,
  4244. ptsid: row.ptsfid
  4245. })
  4246. }
  4247. if (this.oldRowList.bw2 !== row.bw2) {
  4248. obj.data.push({
  4249. old: this.oldRowList.bw2,
  4250. new: row.bw2,
  4251. times: 2,
  4252. ptid: row.ftid,
  4253. ptsid: row.ptsfid
  4254. })
  4255. }
  4256. if (this.oldRowList.bw3 !== row.bw3) {
  4257. obj.data.push({
  4258. old: this.oldRowList.bw3,
  4259. new: row.bw3,
  4260. times: 3,
  4261. ptid: row.ftid,
  4262. ptsid: row.ptsfid
  4263. })
  4264. }
  4265. if (this.oldRowList.bw4 !== row.bw4) {
  4266. obj.data.push({
  4267. old: this.oldRowList.bw4,
  4268. new: row.bw4,
  4269. times: 4,
  4270. ptid: row.ftid,
  4271. ptsid: row.ptsfid
  4272. })
  4273. }
  4274. if (this.oldRowList.bw5 !== row.bw5) {
  4275. obj.data.push({
  4276. old: this.oldRowList.bw5,
  4277. new: row.bw5,
  4278. times: 5,
  4279. ptid: row.ftid,
  4280. ptsid: row.ptsfid
  4281. })
  4282. }
  4283. if (this.oldRowList.bw6 !== row.bw6) {
  4284. obj.data.push({
  4285. old: this.oldRowList.bw6,
  4286. new: row.bw6,
  4287. times: 6,
  4288. ptid: row.ftid,
  4289. ptsid: row.ptsfid
  4290. })
  4291. }
  4292. if (
  4293. this.table.temp.ccount == '' &&
  4294. this.table.temp.ratio == '' &&
  4295. this.table.temp.ccountratio == '' &&
  4296. this.table.temp.ftid == ''
  4297. ) {
  4298. this.$message({
  4299. type: 'error',
  4300. message: this.$t('message.msg118'),
  4301. duration: 2000
  4302. })
  4303. return false
  4304. }
  4305. if (
  4306. this.table.temp.ratio == '' &&
  4307. this.table.temp.ccountratio == '' &&
  4308. this.table.temp.ftid == ''
  4309. ) {
  4310. this.$message({
  4311. type: 'error',
  4312. message: this.$t('message.msg119'),
  4313. duration: 2000
  4314. })
  4315. return false
  4316. }
  4317. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  4318. this.$message({
  4319. type: 'error',
  4320. message: this.$t('message.msg120'),
  4321. duration: 2000
  4322. })
  4323. return false
  4324. }
  4325. console.log(this.table.temp.ccount, '实际牛头数不能为空')
  4326. if (this.table.temp.ccount === '') {
  4327. this.$message({
  4328. type: 'error',
  4329. message: this.$t('message.msg121'),
  4330. duration: 2000
  4331. })
  4332. return false
  4333. }
  4334. if (this.table.temp.ratio === '') {
  4335. this.$message({
  4336. type: 'error',
  4337. message: this.$t('message.msg122'),
  4338. duration: 2000
  4339. })
  4340. return false
  4341. }
  4342. if (this.table.temp.ccountratio === '') {
  4343. this.$message({
  4344. type: 'error',
  4345. message: this.$t('message.msg123'),
  4346. duration: 2000
  4347. })
  4348. return false
  4349. }
  4350. if (this.table.temp.ftid == '') {
  4351. this.$message({
  4352. type: 'error',
  4353. message: this.$t('message.msg124'),
  4354. duration: 2000
  4355. })
  4356. return false
  4357. }
  4358. const positiveInteger = /^[0-9]\d*$/
  4359. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  4360. this.$message({
  4361. type: 'error',
  4362. message: this.$t('message.msg125'),
  4363. duration: 2000
  4364. })
  4365. return false
  4366. }
  4367. this.isokDisable = true
  4368. setTimeout(() => {
  4369. this.isokDisable = false
  4370. }, 1000)
  4371. let createdate = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  4372. // this.requestParam.parammaps = this.table.temp
  4373. this.requestParam.common = {
  4374. returnmap: '0'
  4375. }
  4376. this.requestParam.data = []
  4377. this.requestParam.data[0] = {
  4378. name: 'updateBigFP',
  4379. type: 'e',
  4380. parammaps: {
  4381. pastureid: row.pastureid,
  4382. id: row.id,
  4383. barname: row.barname,
  4384. barid: row.barid,
  4385. softccount: row.softccount,
  4386. ccount: row.ccount,
  4387. ratio: row.ratio,
  4388. ccountratio: row.ccountratio,
  4389. ftid: row.ftid,
  4390. ftname: row.ftname,
  4391. ptsfid: row.ptsfid,
  4392. ptsfname: row.ptsfname,
  4393. ftweight: row.ftweight,
  4394. supplyweight: row.supplyweight,
  4395. feedweight: row.feedweight,
  4396. owner: row.owner,
  4397. sumr: row.sumr
  4398. }
  4399. }
  4400. this.requestParam.data[1] = {
  4401. name: 'insertSpotList',
  4402. resultmaps: { list: this.table.rwList }
  4403. }
  4404. this.requestParam.data[1].children = []
  4405. this.requestParam.data[1].children[0] = {
  4406. name: 'updateBigFPDetail',
  4407. type: 'e',
  4408. parammaps: {
  4409. pastureid: '@insertSpotList.pastureid',
  4410. barname: row.barname,
  4411. barid: '@insertSpotList.barid',
  4412. times: '@insertSpotList.times',
  4413. tratio: '@insertSpotList.tratio',
  4414. weight: '@insertSpotList.weight',
  4415. cowcount: '@insertSpotList.cowcount',
  4416. ccountradio: row.ccountratio,
  4417. ptid: '@insertSpotList.ptid',
  4418. ptsid: '@insertSpotList.ptsid',
  4419. supplement: '@insertSpotList.supplement',
  4420. feedweight: row.feedweight,
  4421. supplyweight: row.supplyweight,
  4422. ratio: row.ratio
  4423. }
  4424. }
  4425. // this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  4426. // pastureid: row.pastureid,
  4427. // fpid: row.id
  4428. // }}
  4429. this.requestParam.data[2] = {
  4430. name: 'insertFeedphistory',
  4431. type: 'e',
  4432. parammaps: {
  4433. createdate: createdate,
  4434. pastureid: row.pastureid,
  4435. barname: row.barname,
  4436. barid: row.barid,
  4437. softccount: row.softccount,
  4438. ccount: row.ccount,
  4439. ratio: row.ratio,
  4440. ccountratio: row.ccountratio,
  4441. ftid: row.ftid,
  4442. ftname: row.ftname,
  4443. ptsfid: row.ptsfid,
  4444. ptsfname: row.ptsfname,
  4445. feedweight: row.feedweight,
  4446. ftweight: row.ftweight,
  4447. supplyweight: row.supplyweight
  4448. }
  4449. }
  4450. this.requestParam.data[3] = {
  4451. name: 'insertSpotList2',
  4452. resultmaps: { list: this.table.rwList }
  4453. }
  4454. this.requestParam.data[3].children = []
  4455. this.requestParam.data[3].children[0] = {
  4456. name: 'insertFpdetailhistory',
  4457. type: 'e',
  4458. parammaps: {
  4459. createdate: createdate,
  4460. pastureid: '@insertSpotList2.pastureid',
  4461. barname: row.barname,
  4462. barid: '@insertSpotList2.barid',
  4463. times: '@insertSpotList2.times',
  4464. tratio: '@insertSpotList2.tratio',
  4465. weight: '@insertSpotList2.weight',
  4466. cowcount: '@insertSpotList2.cowcount',
  4467. ccountradio: row.ccountratio,
  4468. ptid: '@insertSpotList2.ptid',
  4469. ptsid: '@insertSpotList2.ptsid',
  4470. supplement: '@insertSpotList2.supplement',
  4471. feedweight: row.feedweight,
  4472. supplyweight: row.supplyweight,
  4473. ratio: row.ratio,
  4474. userId: Cookies.get('employeid')
  4475. }
  4476. }
  4477. ExecDataByConfig(this.requestParam).then((response) => {
  4478. console.log('编辑保存发送参数', this.requestParam)
  4479. if (response.msg === 'fail') {
  4480. this.$notify({
  4481. title: this.$t('driver.saveFail'),
  4482. message: response.data,
  4483. type: 'warning',
  4484. duration: 2000
  4485. })
  4486. } else {
  4487. if (obj.data.length > 0) {
  4488. const url = 'authdata/fpdetail/edit'
  4489. const data = obj
  4490. postJson(url, data).then((response) => {
  4491. if (response.msg !== 'fail') {
  4492. this.$notify({
  4493. title: this.$t('common.succes'),
  4494. message: this.$t('driver.saveSuccess'),
  4495. type: 'success',
  4496. duration: 2000
  4497. })
  4498. }
  4499. })
  4500. } else {
  4501. this.$notify({
  4502. title: this.$t('common.succes'),
  4503. message: this.$t('driver.saveSuccess'),
  4504. type: 'success',
  4505. duration: 2000
  4506. })
  4507. }
  4508. this.getList()
  4509. for (let i = 0; i < this.headerList.length; i++) {
  4510. if (this.headerList[i].target.className == 'el-icon-lock') {
  4511. this.headerList[i].target.className = 'el-icon-unlock'
  4512. this.$set(
  4513. this.headerList[i].target,
  4514. 'className',
  4515. 'el-icon-unlock'
  4516. )
  4517. }
  4518. }
  4519. }
  4520. })
  4521. },
  4522. updateCancel(row) {
  4523. console.log('点击了编辑取消')
  4524. // 编辑false,不可编辑true
  4525. row.Edit = false
  4526. row.NoEdit = true
  4527. // 编辑true,编辑保存false
  4528. row.isUpdate = true
  4529. row.isUpdateSave = false
  4530. // this.reload()
  4531. for (let i = 0; i < this.headerList.length; i++) {
  4532. if (this.headerList[i].target.className == 'el-icon-lock') {
  4533. this.headerList[i].target.className = 'el-icon-unlock'
  4534. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  4535. }
  4536. }
  4537. console.log(this.table.getdataListParm.offset)
  4538. this.table.getdataListParm.offset = this.table.getdataListParm.offset
  4539. this.getList()
  4540. // this.$router.push('/formulationPlan/dhedFormula')
  4541. },
  4542. handleSelect(val) {
  4543. console.log('勾选数据', val)
  4544. this.selectList = val
  4545. },
  4546. // 营养评估
  4547. handleNutritional() {
  4548. console.log('点击了营养评估')
  4549. this.dialogFull = false
  4550. if (this.selectList.length !== 1) {
  4551. this.$message({
  4552. type: 'error',
  4553. message: this.$t('message.msg126'),
  4554. duration: 2000
  4555. })
  4556. return false
  4557. } else {
  4558. console.log(this.nutritional.temp)
  4559. this.nutritional.dialogStatus = 'Nutritional'
  4560. this.nutritional.activeName = 'first'
  4561. this.nutritional.dialogFormVisible = true
  4562. this.nutritional.tab1.getdataListParm1.parammaps.pastureid =
  4563. this.selectList[0].pastureid
  4564. this.nutritional.tab1.getdataListParm1.parammaps.barid =
  4565. this.selectList[0].barid
  4566. this.getNutritionalList()
  4567. this.nutritional.tab1.list = []
  4568. }
  4569. },
  4570. tableRowClassName({ row }) {
  4571. // console.log(row)
  4572. if (row.isColor == '0') {
  4573. return 'red-row'
  4574. } else {
  4575. return ''
  4576. }
  4577. },
  4578. handleNutritionalTab(item) {
  4579. if (item == 'first ') {
  4580. this.nutritional.tab1.getdataListParm1.parammaps.pastureid =
  4581. this.selectList[0].pastureid
  4582. this.nutritional.tab1.getdataListParm1.parammaps.barid =
  4583. this.selectList[0].barid
  4584. this.getNutritionalList()
  4585. this.nutritional.tab1.list = []
  4586. } else {
  4587. console.log('牛群评估')
  4588. this.nutritional.tab2.getdataListParm1.parammaps.pastureid =
  4589. this.selectList[0].pastureid
  4590. this.nutritional.tab2.getdataListParm1.parammaps.barid =
  4591. this.selectList[0].barid
  4592. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(
  4593. this.nutritional.tab2.inputDatetime[0],
  4594. '{y}-{m}-{d}'
  4595. )
  4596. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(
  4597. this.nutritional.tab2.inputDatetime[1],
  4598. '{y}-{m}-{d}'
  4599. )
  4600. this.nutritional.tab2.getdataListParm2.parammaps.pastureid =
  4601. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4602. this.nutritional.tab2.getdataListParm2.parammaps.barid =
  4603. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4604. this.nutritional.tab2.getdataListParm2.parammaps.startTime =
  4605. this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4606. this.nutritional.tab2.getdataListParm2.parammaps.stopTime =
  4607. this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4608. this.nutritional.tab2.getdataListParm3.parammaps.pastureid =
  4609. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4610. this.nutritional.tab2.getdataListParm3.parammaps.barid =
  4611. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4612. this.nutritional.tab2.getdataListParm3.parammaps.startTime =
  4613. this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4614. this.nutritional.tab2.getdataListParm3.parammaps.stopTime =
  4615. this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4616. this.nutritional.tab2.getdataListParm4.parammaps.pastureid =
  4617. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4618. this.nutritional.tab2.getdataListParm4.parammaps.barid =
  4619. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4620. this.nutritional.tab2.getdataListParm4.parammaps.startTime =
  4621. this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4622. this.nutritional.tab2.getdataListParm4.parammaps.stopTime =
  4623. this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4624. this.getTab2NutritionalList1()
  4625. this.getTab2NutritionalList2()
  4626. this.getTab2NutritionalList3()
  4627. this.getTab2NutritionalList4()
  4628. }
  4629. },
  4630. changeTab2Date() {
  4631. this.nutritional.tab2.getdataListParm1.parammaps.pastureid =
  4632. this.selectList[0].pastureid
  4633. this.nutritional.tab2.getdataListParm1.parammaps.barid =
  4634. this.selectList[0].barid
  4635. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(
  4636. this.nutritional.tab2.inputDatetime[0],
  4637. '{y}-{m}-{d}'
  4638. )
  4639. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(
  4640. this.nutritional.tab2.inputDatetime[1],
  4641. '{y}-{m}-{d}'
  4642. )
  4643. this.nutritional.tab2.getdataListParm2.parammaps.pastureid =
  4644. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4645. this.nutritional.tab2.getdataListParm2.parammaps.barid =
  4646. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4647. this.nutritional.tab2.getdataListParm2.parammaps.startTime =
  4648. this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4649. this.nutritional.tab2.getdataListParm2.parammaps.stopTime =
  4650. this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4651. this.nutritional.tab2.getdataListParm3.parammaps.pastureid =
  4652. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4653. this.nutritional.tab2.getdataListParm3.parammaps.barid =
  4654. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4655. this.nutritional.tab2.getdataListParm3.parammaps.startTime =
  4656. this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4657. this.nutritional.tab2.getdataListParm3.parammaps.stopTime =
  4658. this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4659. this.nutritional.tab2.getdataListParm4.parammaps.pastureid =
  4660. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4661. this.nutritional.tab2.getdataListParm4.parammaps.barid =
  4662. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4663. this.nutritional.tab2.getdataListParm4.parammaps.startTime =
  4664. this.nutritional.tab2.getdataListParm1.parammaps.startTime
  4665. this.nutritional.tab2.getdataListParm4.parammaps.stopTime =
  4666. this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  4667. this.getTab2NutritionalList1()
  4668. this.getTab2NutritionalList2()
  4669. this.getTab2NutritionalList3()
  4670. this.getTab2NutritionalList4()
  4671. },
  4672. handleBefore() {
  4673. if (this.nutritional.activeName == 'first') {
  4674. if (
  4675. this.nutritional.tab1.inputDatetime !== '' &&
  4676. this.nutritional.tab1.inputDatetime !== null
  4677. ) {
  4678. var start = new Date(
  4679. this.nutritional.tab1.inputDatetime[0].setDate(
  4680. this.nutritional.tab1.inputDatetime[0].getDate() - 1
  4681. )
  4682. )
  4683. var stop = new Date(
  4684. this.nutritional.tab1.inputDatetime[1].setDate(
  4685. this.nutritional.tab1.inputDatetime[1].getDate() - 1
  4686. )
  4687. )
  4688. this.nutritional.tab1.inputDatetime.length = 0
  4689. this.nutritional.tab1.inputDatetime.push(start, stop)
  4690. this.$forceUpdate()
  4691. }
  4692. } else {
  4693. var start2 = new Date(
  4694. this.nutritional.tab2.inputDatetime[0].setDate(
  4695. this.nutritional.tab2.inputDatetime[0].getDate() - 1
  4696. )
  4697. )
  4698. var stop2 = new Date(
  4699. this.nutritional.tab2.inputDatetime[1].setDate(
  4700. this.nutritional.tab2.inputDatetime[1].getDate() - 1
  4701. )
  4702. )
  4703. this.nutritional.tab2.inputDatetime.length = 0
  4704. this.nutritional.tab2.inputDatetime.push(start2, stop2)
  4705. this.$forceUpdate()
  4706. this.nutritional.tab2.getdataListParm1.parammaps.pastureid =
  4707. this.selectList[0].pastureid
  4708. this.nutritional.tab2.getdataListParm1.parammaps.barid =
  4709. this.selectList[0].barid
  4710. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(
  4711. this.nutritional.tab2.inputDatetime[0],
  4712. '{y}-{m}-{d}'
  4713. )
  4714. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(
  4715. this.nutritional.tab2.inputDatetime[1],
  4716. '{y}-{m}-{d}'
  4717. )
  4718. this.nutritional.tab2.getdataListParm2.parammaps.pastureid =
  4719. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4720. this.nutritional.tab2.getdataListParm2.parammaps.barid =
  4721. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4722. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(
  4723. this.nutritional.tab2.inputDatetime[0],
  4724. '{y}-{m}-{d}'
  4725. )
  4726. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(
  4727. this.nutritional.tab2.inputDatetime[1],
  4728. '{y}-{m}-{d}'
  4729. )
  4730. this.nutritional.tab2.getdataListParm3.parammaps.pastureid =
  4731. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4732. this.nutritional.tab2.getdataListParm3.parammaps.barid =
  4733. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4734. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(
  4735. this.nutritional.tab2.inputDatetime[0],
  4736. '{y}-{m}-{d}'
  4737. )
  4738. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(
  4739. this.nutritional.tab2.inputDatetime[1],
  4740. '{y}-{m}-{d}'
  4741. )
  4742. this.nutritional.tab2.getdataListParm4.parammaps.pastureid =
  4743. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4744. this.nutritional.tab2.getdataListParm4.parammaps.barid =
  4745. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4746. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(
  4747. this.nutritional.tab2.inputDatetime[0],
  4748. '{y}-{m}-{d}'
  4749. )
  4750. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(
  4751. this.nutritional.tab2.inputDatetime[1],
  4752. '{y}-{m}-{d}'
  4753. )
  4754. this.getTab2NutritionalList1()
  4755. this.getTab2NutritionalList2()
  4756. this.getTab2NutritionalList3()
  4757. this.getTab2NutritionalList4()
  4758. }
  4759. },
  4760. handleNext() {
  4761. if (this.nutritional.activeName == 'first') {
  4762. if (
  4763. this.nutritional.tab1.inputDatetime !== '' &&
  4764. this.nutritional.tab1.inputDatetime !== null
  4765. ) {
  4766. console.log(this.nutritional.tab1.inputDatetime)
  4767. var start3 = new Date(
  4768. this.nutritional.tab1.inputDatetime[0].setDate(
  4769. this.nutritional.tab1.inputDatetime[0].getDate() + 1
  4770. )
  4771. )
  4772. var stop3 = new Date(
  4773. this.nutritional.tab1.inputDatetime[1].setDate(
  4774. this.nutritional.tab1.inputDatetime[1].getDate() + 1
  4775. )
  4776. )
  4777. this.nutritional.tab1.inputDatetime.length = 0
  4778. this.nutritional.tab1.inputDatetime.push(start3, stop3)
  4779. this.$forceUpdate()
  4780. }
  4781. } else {
  4782. var start4 = new Date(
  4783. this.nutritional.tab2.inputDatetime[0].setDate(
  4784. this.nutritional.tab2.inputDatetime[0].getDate() + 1
  4785. )
  4786. )
  4787. var stop4 = new Date(
  4788. this.nutritional.tab2.inputDatetime[1].setDate(
  4789. this.nutritional.tab2.inputDatetime[1].getDate() + 1
  4790. )
  4791. )
  4792. this.nutritional.tab2.inputDatetime.length = 0
  4793. this.nutritional.tab2.inputDatetime.push(start4, stop4)
  4794. this.$forceUpdate()
  4795. this.nutritional.tab2.getdataListParm1.parammaps.pastureid =
  4796. this.selectList[0].pastureid
  4797. this.nutritional.tab2.getdataListParm1.parammaps.barid =
  4798. this.selectList[0].barid
  4799. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(
  4800. this.nutritional.tab2.inputDatetime[0],
  4801. '{y}-{m}-{d}'
  4802. )
  4803. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(
  4804. this.nutritional.tab2.inputDatetime[1],
  4805. '{y}-{m}-{d}'
  4806. )
  4807. this.nutritional.tab2.getdataListParm2.parammaps.pastureid =
  4808. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4809. this.nutritional.tab2.getdataListParm2.parammaps.barid =
  4810. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4811. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(
  4812. this.nutritional.tab2.inputDatetime[0],
  4813. '{y}-{m}-{d}'
  4814. )
  4815. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(
  4816. this.nutritional.tab2.inputDatetime[1],
  4817. '{y}-{m}-{d}'
  4818. )
  4819. this.nutritional.tab2.getdataListParm3.parammaps.pastureid =
  4820. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4821. this.nutritional.tab2.getdataListParm3.parammaps.barid =
  4822. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4823. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(
  4824. this.nutritional.tab2.inputDatetime[0],
  4825. '{y}-{m}-{d}'
  4826. )
  4827. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(
  4828. this.nutritional.tab2.inputDatetime[1],
  4829. '{y}-{m}-{d}'
  4830. )
  4831. this.nutritional.tab2.getdataListParm4.parammaps.pastureid =
  4832. this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  4833. this.nutritional.tab2.getdataListParm4.parammaps.barid =
  4834. this.nutritional.tab2.getdataListParm1.parammaps.barid
  4835. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(
  4836. this.nutritional.tab2.inputDatetime[0],
  4837. '{y}-{m}-{d}'
  4838. )
  4839. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(
  4840. this.nutritional.tab2.inputDatetime[1],
  4841. '{y}-{m}-{d}'
  4842. )
  4843. this.getTab2NutritionalList1()
  4844. this.getTab2NutritionalList2()
  4845. this.getTab2NutritionalList3()
  4846. this.getTab2NutritionalList4()
  4847. }
  4848. },
  4849. getNutritionalList() {
  4850. this.nutritional.tab1.listLoading1 = true
  4851. GetDataByName(this.nutritional.tab1.getdataListParm1).then((response) => {
  4852. console.log('评估上方数据', response.data.list)
  4853. if (response.data.list !== null) {
  4854. response.data.list[0].cowclassid = String(
  4855. response.data.list[0].cowclassid
  4856. )
  4857. this.nutritional.tab1.temp = response.data.list[0]
  4858. this.nutritional.tab1.disabledCowclass = true
  4859. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  4860. this.nutritional.tab1.getdataListParm2.parammaps.name1 =
  4861. 'judgenurBarHSL'
  4862. this.nutritional.tab1.getdataListParm2.parammaps.startTime =
  4863. parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  4864. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(
  4865. this.nutritional.tab1.inputDatetime[1],
  4866. '{y}-{m}-{d}'
  4867. )
  4868. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(
  4869. this.nutritional.tab1.temp.bw
  4870. )
  4871. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(
  4872. this.nutritional.tab1.temp.dayw
  4873. )
  4874. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(
  4875. this.nutritional.tab1.temp.fetal
  4876. )
  4877. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(
  4878. this.nutritional.tab1.temp.avgdim
  4879. )
  4880. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(
  4881. this.nutritional.tab1.temp.dayspre
  4882. )
  4883. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(
  4884. this.nutritional.tab1.temp.product
  4885. )
  4886. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(
  4887. this.nutritional.tab1.temp.fat
  4888. )
  4889. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(
  4890. this.nutritional.tab1.temp.pro
  4891. )
  4892. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(
  4893. this.nutritional.tab1.temp.lactose
  4894. )
  4895. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(
  4896. this.nutritional.tab1.temp.source
  4897. )
  4898. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(
  4899. this.nutritional.tab1.temp.tem
  4900. )
  4901. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(
  4902. this.nutritional.tab1.temp.cowsum
  4903. )
  4904. this.nutritional.tab1.getdataListParm2.parammaps.cowclass =
  4905. this.nutritional.tab1.temp.cowclass
  4906. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid =
  4907. this.nutritional.tab1.temp.cowclassid
  4908. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass =
  4909. this.nutritional.tab1.temp.bigcowclass
  4910. this.nutritional.tab1.getdataListParm2.parammaps.pastureid =
  4911. this.selectList[0].pastureid
  4912. this.nutritional.tab1.getdataListParm2.parammaps.barid =
  4913. this.nutritional.tab1.temp.barid
  4914. this.nutritional.tab1.getdataListParm2.parammaps.date =
  4915. this.nutritional.tab1.temp.date
  4916. this.getNutritionalList2()
  4917. } else {
  4918. this.nutritional.tab1.temp = []
  4919. this.nutritional.tab1.disabledCowclass = false
  4920. }
  4921. setTimeout(() => {
  4922. this.nutritional.tab1.listLoading = false
  4923. }, 100)
  4924. })
  4925. },
  4926. assessmentData() {
  4927. console.log('评估保存')
  4928. this.$refs['temp'].validate((valid) => {
  4929. if (valid) {
  4930. if (
  4931. this.nutritional.tab1.inputDatetime == '' ||
  4932. this.nutritional.tab1.inputDatetime == null
  4933. ) {
  4934. this.$message({
  4935. type: 'error',
  4936. message: this.$t('message.msg127'),
  4937. duration: 2000
  4938. })
  4939. return false
  4940. } else {
  4941. // 牛头数
  4942. const positiveInteger = /^[1-9]\d*$/
  4943. if (this.nutritional.tab1.temp.cowsum !== '') {
  4944. if (
  4945. !positiveInteger.test(
  4946. parseFloat(this.nutritional.tab1.temp.cowsum)
  4947. )
  4948. ) {
  4949. this.$message({
  4950. type: 'error',
  4951. message: this.$t('message.msg128'),
  4952. duration: 2000
  4953. })
  4954. return false
  4955. }
  4956. }
  4957. const twoDecimalPlaces = /^\d+(\.\d{1,2})?$/
  4958. // 温度环境
  4959. if (this.nutritional.tab1.temp.tem !== '') {
  4960. if (
  4961. !twoDecimalPlaces.test(
  4962. parseFloat(this.nutritional.tab1.temp.tem)
  4963. )
  4964. ) {
  4965. this.$message({
  4966. type: 'error',
  4967. message: this.$t('message.msg129'),
  4968. duration: 2000
  4969. })
  4970. return false
  4971. }
  4972. }
  4973. // 平均月龄
  4974. if (this.nutritional.tab1.temp.avgmonthage !== '') {
  4975. if (
  4976. !twoDecimalPlaces.test(
  4977. parseFloat(this.nutritional.tab1.temp.avgmonthage)
  4978. )
  4979. ) {
  4980. this.$message({
  4981. type: 'error',
  4982. message: this.$t('message.msg130'),
  4983. duration: 2000
  4984. })
  4985. return false
  4986. }
  4987. }
  4988. // 体重
  4989. if (this.nutritional.tab1.temp.bw !== '') {
  4990. if (
  4991. !twoDecimalPlaces.test(
  4992. parseFloat(this.nutritional.tab1.temp.bw)
  4993. )
  4994. ) {
  4995. this.$message({
  4996. type: 'error',
  4997. message: this.$t('message.msg131'),
  4998. duration: 2000
  4999. })
  5000. return false
  5001. }
  5002. }
  5003. // 日增重
  5004. if (this.nutritional.tab1.temp.dayw !== '') {
  5005. if (
  5006. !twoDecimalPlaces.test(
  5007. parseFloat(this.nutritional.tab1.temp.dayw)
  5008. )
  5009. ) {
  5010. this.$message({
  5011. type: 'error',
  5012. message: this.$t('message.msg132'),
  5013. duration: 2000
  5014. })
  5015. return false
  5016. }
  5017. }
  5018. const dayspre = /^(([1-9]|([1-9]\d)|(1\d\d)|(2([0-7]\d|7[0-9]))))$/
  5019. // 怀孕天数
  5020. if (this.nutritional.tab1.temp.dayspre !== '') {
  5021. if (
  5022. !dayspre.test(parseFloat(this.nutritional.tab1.temp.dayspre))
  5023. ) {
  5024. this.$message({
  5025. type: 'error',
  5026. message: this.$t('message.msg133'),
  5027. duration: 2000
  5028. })
  5029. return false
  5030. }
  5031. }
  5032. const fetal = /^(?:[1-9]|1[0-9])$/
  5033. // 胎次
  5034. if (this.nutritional.tab1.temp.fetal !== '') {
  5035. if (!fetal.test(parseFloat(this.nutritional.tab1.temp.fetal))) {
  5036. this.$message({
  5037. type: 'error',
  5038. message: this.$t('message.msg134'),
  5039. duration: 2000
  5040. })
  5041. return false
  5042. }
  5043. }
  5044. // 平均泌乳
  5045. if (this.nutritional.tab1.temp.avgdim !== '') {
  5046. if (
  5047. !positiveInteger.test(
  5048. parseFloat(this.nutritional.tab1.temp.avgdim)
  5049. )
  5050. ) {
  5051. this.$message({
  5052. type: 'error',
  5053. message: this.$t('message.msg135'),
  5054. duration: 2000
  5055. })
  5056. return false
  5057. }
  5058. }
  5059. // 产奶量
  5060. if (this.nutritional.tab1.temp.product !== '') {
  5061. if (
  5062. !twoDecimalPlaces.test(
  5063. parseFloat(this.nutritional.tab1.temp.product)
  5064. )
  5065. ) {
  5066. this.$message({
  5067. type: 'error',
  5068. message: this.$t('message.msg136'),
  5069. duration: 2000
  5070. })
  5071. return false
  5072. }
  5073. }
  5074. // 乳脂率
  5075. if (this.nutritional.tab1.temp.fat !== '') {
  5076. if (
  5077. !twoDecimalPlaces.test(
  5078. parseFloat(this.nutritional.tab1.temp.fat)
  5079. )
  5080. ) {
  5081. this.$message({
  5082. type: 'error',
  5083. message: this.$t('message.msg137'),
  5084. duration: 2000
  5085. })
  5086. return false
  5087. }
  5088. }
  5089. // 乳蛋白率
  5090. if (this.nutritional.tab1.temp.pro !== '') {
  5091. if (
  5092. !twoDecimalPlaces.test(
  5093. parseFloat(this.nutritional.tab1.temp.pro)
  5094. )
  5095. ) {
  5096. this.$message({
  5097. type: 'error',
  5098. message: this.$t('message.msg138'),
  5099. duration: 2000
  5100. })
  5101. return false
  5102. }
  5103. }
  5104. // 乳糖率
  5105. if (this.nutritional.tab1.temp.lactose !== '') {
  5106. if (
  5107. !twoDecimalPlaces.test(
  5108. parseFloat(this.nutritional.tab1.temp.lactose)
  5109. )
  5110. ) {
  5111. this.$message({
  5112. type: 'error',
  5113. message: this.$t('message.msg139'),
  5114. duration: 2000
  5115. })
  5116. return false
  5117. }
  5118. }
  5119. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  5120. this.nutritional.tab1.getdataListParm2.parammaps.name1 =
  5121. 'judgenurBarHSL'
  5122. this.nutritional.tab1.getdataListParm2.parammaps.startTime =
  5123. parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  5124. this.nutritional.tab1.getdataListParm2.parammaps.stopTime =
  5125. parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  5126. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(
  5127. this.nutritional.tab1.temp.bw
  5128. )
  5129. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(
  5130. this.nutritional.tab1.temp.dayw
  5131. )
  5132. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(
  5133. this.nutritional.tab1.temp.fetal
  5134. )
  5135. this.nutritional.tab1.getdataListParm2.parammaps.avgdim =
  5136. parseFloat(this.nutritional.tab1.temp.avgdim)
  5137. this.nutritional.tab1.getdataListParm2.parammaps.dayspre =
  5138. parseFloat(this.nutritional.tab1.temp.dayspre)
  5139. this.nutritional.tab1.getdataListParm2.parammaps.product =
  5140. parseFloat(this.nutritional.tab1.temp.product)
  5141. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(
  5142. this.nutritional.tab1.temp.fat
  5143. )
  5144. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(
  5145. this.nutritional.tab1.temp.pro
  5146. )
  5147. this.nutritional.tab1.getdataListParm2.parammaps.lactose =
  5148. parseFloat(this.nutritional.tab1.temp.lactose)
  5149. this.nutritional.tab1.getdataListParm2.parammaps.source =
  5150. parseFloat(this.nutritional.tab1.temp.source)
  5151. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(
  5152. this.nutritional.tab1.temp.tem
  5153. )
  5154. this.nutritional.tab1.getdataListParm2.parammaps.cowsum =
  5155. parseFloat(this.nutritional.tab1.temp.cowsum)
  5156. this.nutritional.tab1.getdataListParm2.parammaps.cowclass =
  5157. this.nutritional.tab1.temp.cowclass
  5158. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid =
  5159. this.nutritional.tab1.temp.cowclassid
  5160. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass =
  5161. this.nutritional.tab1.temp.bigcowclass
  5162. this.nutritional.tab1.getdataListParm2.parammaps.pastureid =
  5163. this.selectList[0].pastureid
  5164. this.nutritional.tab1.getdataListParm2.parammaps.barid =
  5165. this.nutritional.tab1.temp.barid
  5166. this.nutritional.tab1.getdataListParm2.parammaps.date =
  5167. this.nutritional.tab1.temp.date
  5168. this.getNutritionalList2()
  5169. }
  5170. }
  5171. })
  5172. },
  5173. getNutritionalList2() {
  5174. this.nutritional.tab1.listLoading2 = true
  5175. const url = 'authdata/GETNurJudge'
  5176. const data = this.nutritional.tab1.getdataListParm2
  5177. postJson(url, data).then((response) => {
  5178. if (response.msg !== 'fail') {
  5179. if (response.data.list !== null) {
  5180. for (let i = 0; i < response.data.length; i++) {
  5181. if (response.data[i].cowneed == null) {
  5182. response.data[i].cowneed = ''
  5183. }
  5184. var reg = RegExp(/>/)
  5185. var reg2 = RegExp(/</)
  5186. var reg3 = RegExp(/-/)
  5187. if (reg.test(response.data[i].cowneed) == true) {
  5188. const cowneed = response.data[i].cowneed.split('>')[1]
  5189. if (
  5190. parseFloat(response.data[i].ftpro) < parseFloat(cowneed) ||
  5191. parseFloat(response.data[i].hprov) < parseFloat(cowneed) ||
  5192. parseFloat(response.data[i].sprov) < parseFloat(cowneed)
  5193. ) {
  5194. this.$set(response.data[i], 'isColor', '0')
  5195. } else {
  5196. this.$set(response.data[i], 'isColor', '')
  5197. }
  5198. } else if (reg2.test(response.data[i].cowneed) == true) {
  5199. const cowneed2 = response.data[i].cowneed.split('<')[1]
  5200. if (
  5201. parseFloat(response.data[i].ftpro) > parseFloat(cowneed2) ||
  5202. parseFloat(response.data[i].hprov) > parseFloat(cowneed2) ||
  5203. parseFloat(response.data[i].sprov) > parseFloat(cowneed2)
  5204. ) {
  5205. this.$set(response.data[i], 'isColor', '0')
  5206. } else {
  5207. this.$set(response.data[i], 'isColor', '')
  5208. }
  5209. } else if (reg3.test(response.data[i].cowneed) == true) {
  5210. response.data[i].cowneed = String(response.data[i].cowneed)
  5211. if (response.data[i].cowneed.length == 1) {
  5212. const cowneed3 = response.data[i].cowneed.split('-')
  5213. console.log(cowneed3, 'cowneed3')
  5214. if (
  5215. parseFloat(response.data[i].ftpro) >
  5216. parseFloat(cowneed3[0]) &&
  5217. parseFloat(response.data[i].ftpro) < parseFloat(cowneed3[1])
  5218. ) {
  5219. this.$set(response.data[i], 'isColor', '')
  5220. } else if (
  5221. parseFloat(response.data[i].hprov) >
  5222. parseFloat(cowneed3[0]) &&
  5223. parseFloat(response.data[i].hprov) < parseFloat(cowneed3[1])
  5224. ) {
  5225. this.$set(response.data[i], 'isColor', '')
  5226. } else if (
  5227. parseFloat(response.data[i].sprov) >
  5228. parseFloat(cowneed3[0]) &&
  5229. parseFloat(response.data[i].sprov) < parseFloat(cowneed3[1])
  5230. ) {
  5231. this.$set(response.data[i], 'isColor', '')
  5232. } else if (cowneed3[0] == '' && cowneed3[0] == '') {
  5233. this.$set(response.data[i], 'isColor', '')
  5234. } else {
  5235. this.$set(response.data[i], 'isColor', '0')
  5236. }
  5237. } else {
  5238. if (
  5239. parseFloat(response.data[i].ftpro) <
  5240. parseFloat(response.data[i].cowneed) ||
  5241. parseFloat(response.data[i].hprov) <
  5242. parseFloat(response.data[i].cowneed) ||
  5243. parseFloat(response.data[i].sprov) <
  5244. parseFloat(response.data[i].cowneed)
  5245. ) {
  5246. this.$set(response.data[i], 'isColor', '0')
  5247. } else {
  5248. this.$set(response.data[i], 'isColor', '')
  5249. }
  5250. }
  5251. } else {
  5252. response.data[i].cowneed = String(response.data[i].cowneed)
  5253. if (response.data[i].cowneed[0] !== '-') {
  5254. if (
  5255. parseFloat(response.data[i].ftpro) <
  5256. parseFloat(response.data[i].cowneed) ||
  5257. parseFloat(response.data[i].hprov) <
  5258. parseFloat(response.data[i].cowneed) ||
  5259. parseFloat(response.data[i].sprov) <
  5260. parseFloat(response.data[i].cowneed)
  5261. ) {
  5262. this.$set(response.data[i], 'isColor', '0')
  5263. } else {
  5264. this.$set(response.data[i], 'isColor', '')
  5265. }
  5266. } else {
  5267. this.$set(response.data[i], 'isColor', '')
  5268. }
  5269. }
  5270. }
  5271. console.log(response.data)
  5272. console.log('评估下方数据', response.data)
  5273. this.nutritional.tab1.list = response.data
  5274. this.nutritional.tab1.total = response.data.total
  5275. } else {
  5276. this.nutritional.tab1.list = []
  5277. }
  5278. } else {
  5279. this.$notify({
  5280. title: this.$t('message.msg37'),
  5281. message: response.data,
  5282. type: 'warning',
  5283. duration: 2000
  5284. })
  5285. }
  5286. setTimeout(() => {
  5287. this.nutritional.tab1.listLoading2 = false
  5288. }, 100)
  5289. })
  5290. },
  5291. // 牛群评估
  5292. getTab2NutritionalList1() {
  5293. this.nutritional.tab2.listLoading1 = true
  5294. GetDataByName(this.nutritional.tab2.getdataListParm1).then((response) => {
  5295. console.log('宾州筛分析', response.data.list)
  5296. if (response.data.list !== null) {
  5297. this.nutritional.tab2.list1 = response.data.list
  5298. this.nutritional.tab2.pageNum1 = response.data.pageNum
  5299. this.nutritional.tab2.pageSize1 = response.data.pageSize
  5300. this.nutritional.tab2.total1 = response.data.total
  5301. } else {
  5302. this.nutritional.tab2.list1 = []
  5303. }
  5304. setTimeout(() => {
  5305. this.nutritional.tab2.listLoading1 = false
  5306. }, 100)
  5307. })
  5308. },
  5309. getTab2NutritionalList2() {
  5310. this.nutritional.tab2.listLoading2 = true
  5311. GetDataByName(this.nutritional.tab2.getdataListParm2).then((response) => {
  5312. console.log('粪便筛分析', response.data.list)
  5313. if (response.data.list !== null) {
  5314. this.nutritional.tab2.list2 = response.data.list
  5315. this.nutritional.tab2.pageNum2 = response.data.pageNum
  5316. this.nutritional.tab2.pageSize2 = response.data.pageSize
  5317. this.nutritional.tab2.total2 = response.data.total
  5318. } else {
  5319. this.nutritional.tab2.list2 = []
  5320. }
  5321. setTimeout(() => {
  5322. this.nutritional.tab2.listLoading2 = false
  5323. }, 100)
  5324. })
  5325. },
  5326. getTab2NutritionalList3() {
  5327. this.nutritional.tab2.listLoading3 = true
  5328. GetDataByName(this.nutritional.tab2.getdataListParm3).then((response) => {
  5329. console.log('BCS评分', response.data.list)
  5330. if (response.data.list !== null) {
  5331. for (let i = 0; i < response.data.list.length; i++) {
  5332. this.$set(
  5333. response.data.list[i],
  5334. 'score25rate',
  5335. (
  5336. (parseFloat(response.data.list[i].score25) /
  5337. parseFloat(response.data.list[i].cowsum)) *
  5338. 100
  5339. ).toFixed(parseInt(Cookies.get('decimal')))
  5340. )
  5341. this.$set(
  5342. response.data.list[i],
  5343. 'score275rate',
  5344. (
  5345. (parseFloat(response.data.list[i].score275) /
  5346. parseFloat(response.data.list[i].cowsum)) *
  5347. 100
  5348. ).toFixed(parseInt(Cookies.get('decimal')))
  5349. )
  5350. this.$set(
  5351. response.data.list[i],
  5352. 'score3rate',
  5353. (
  5354. (parseFloat(response.data.list[i].score3) /
  5355. parseFloat(response.data.list[i].cowsum)) *
  5356. 100
  5357. ).toFixed(parseInt(Cookies.get('decimal')))
  5358. )
  5359. this.$set(
  5360. response.data.list[i],
  5361. 'score325rate',
  5362. (
  5363. (parseFloat(response.data.list[i].score325) /
  5364. parseFloat(response.data.list[i].cowsum)) *
  5365. 100
  5366. ).toFixed(parseInt(Cookies.get('decimal')))
  5367. )
  5368. this.$set(
  5369. response.data.list[i],
  5370. 'score35rate',
  5371. (
  5372. (parseFloat(response.data.list[i].score35) /
  5373. parseFloat(response.data.list[i].cowsum)) *
  5374. 100
  5375. ).toFixed(parseInt(Cookies.get('decimal')))
  5376. )
  5377. this.$set(
  5378. response.data.list[i],
  5379. 'score375rate',
  5380. (
  5381. (parseFloat(response.data.list[i].score375) /
  5382. parseFloat(response.data.list[i].cowsum)) *
  5383. 100
  5384. ).toFixed(parseInt(Cookies.get('decimal')))
  5385. )
  5386. this.$set(
  5387. response.data.list[i],
  5388. 'score4rate',
  5389. (
  5390. 100 -
  5391. response.data.list[i].score25rate -
  5392. response.data.list[i].score275rate -
  5393. response.data.list[i].score3rate -
  5394. response.data.list[i].score325rate -
  5395. response.data.list[i].score35rate -
  5396. response.data.list[i].score375rate
  5397. ).toFixed(parseInt(Cookies.get('decimal')))
  5398. )
  5399. }
  5400. this.nutritional.tab2.list3 = response.data.list
  5401. this.nutritional.tab2.pageNum3 = response.data.pageNum
  5402. this.nutritional.tab2.pageSize3 = response.data.pageSize
  5403. this.nutritional.tab2.total3 = response.data.total
  5404. } else {
  5405. this.nutritional.tab2.list3 = []
  5406. }
  5407. setTimeout(() => {
  5408. this.nutritional.tab2.listLoading3 = false
  5409. }, 100)
  5410. })
  5411. },
  5412. getTab2NutritionalList4() {
  5413. this.nutritional.tab2.listLoading4 = true
  5414. GetDataByName(this.nutritional.tab2.getdataListParm4).then((response) => {
  5415. console.log('粪便评分', response.data.list)
  5416. if (response.data.list !== null) {
  5417. for (let i = 0; i < response.data.list.length; i++) {
  5418. this.$set(
  5419. response.data.list[i],
  5420. 'score1rate',
  5421. (
  5422. (parseFloat(response.data.list[i].score1) /
  5423. parseFloat(response.data.list[i].cowsum)) *
  5424. 100
  5425. ).toFixed(parseInt(Cookies.get('decimal')))
  5426. )
  5427. this.$set(
  5428. response.data.list[i],
  5429. 'score2rate',
  5430. (
  5431. (parseFloat(response.data.list[i].score2) /
  5432. parseFloat(response.data.list[i].cowsum)) *
  5433. 100
  5434. ).toFixed(parseInt(Cookies.get('decimal')))
  5435. )
  5436. this.$set(
  5437. response.data.list[i],
  5438. 'score3rate',
  5439. (
  5440. (parseFloat(response.data.list[i].score3) /
  5441. parseFloat(response.data.list[i].cowsum)) *
  5442. 100
  5443. ).toFixed(parseInt(Cookies.get('decimal')))
  5444. )
  5445. this.$set(
  5446. response.data.list[i],
  5447. 'score4rate',
  5448. (
  5449. (parseFloat(response.data.list[i].score4) /
  5450. parseFloat(response.data.list[i].cowsum)) *
  5451. 100
  5452. ).toFixed(parseInt(Cookies.get('decimal')))
  5453. )
  5454. this.$set(
  5455. response.data.list[i],
  5456. 'score5rate',
  5457. (
  5458. 100 -
  5459. response.data.list[i].score1rate -
  5460. response.data.list[i].score2rate -
  5461. response.data.list[i].score3rate -
  5462. response.data.list[i].score4rate
  5463. ).toFixed(parseInt(Cookies.get('decimal')))
  5464. )
  5465. }
  5466. this.nutritional.tab2.list4 = response.data.list
  5467. this.nutritional.tab2.pageNum4 = response.data.pageNum
  5468. this.nutritional.tab2.pageSize4 = response.data.pageSize
  5469. this.nutritional.tab2.total4 = response.data.total
  5470. } else {
  5471. this.nutritional.tab2.list4 = []
  5472. }
  5473. setTimeout(() => {
  5474. this.nutritional.tab2.listLoading4 = false
  5475. }, 100)
  5476. })
  5477. },
  5478. // 历史记录
  5479. handleHistoryRecords() {
  5480. console.log('点击了历史记录')
  5481. this.dialogFull = false
  5482. this.history.dialogStatus = 'history'
  5483. this.history.dialogFormVisible = true
  5484. this.getDateList()
  5485. },
  5486. // 历史时间
  5487. getDateList() {
  5488. GetDataByName(this.history.getdataDateParm).then((response) => {
  5489. console.log('table数据', response.data.list)
  5490. if (response.data.list !== null) {
  5491. this.history.getdataListParm.parammaps.date =
  5492. response.data.list[0].maxdate
  5493. this.getHistoryIsDisplay()
  5494. } else {
  5495. this.history.getdataListParm.parammaps.date = ''
  5496. }
  5497. })
  5498. },
  5499. getHistoryIsDisplay() {
  5500. GetDataByName(this.table.getdataListParm2).then((response) => {
  5501. console.log(response.data.list[0].inforvalue)
  5502. if (response.data.list !== null) {
  5503. if (response.data.list[0].inforvalue == 0) {
  5504. this.table.isPtsfname = false
  5505. } else {
  5506. this.table.isPtsfname = true
  5507. }
  5508. }
  5509. })
  5510. GetDataByName(this.table.getdataListParm3).then((response) => {
  5511. if (response.data.list !== null) {
  5512. if (response.data.list[0].inforvalue == 1) {
  5513. this.history.isRW1 = true
  5514. this.history.isRW2 = false
  5515. this.history.isRW3 = false
  5516. this.history.isRW4 = false
  5517. this.history.isRW5 = false
  5518. this.history.isRW6 = false
  5519. } else if (response.data.list[0].inforvalue == 2) {
  5520. this.history.isRW1 = true
  5521. this.history.isRW2 = true
  5522. this.history.isRW3 = false
  5523. this.history.isRW4 = false
  5524. this.history.isRW5 = false
  5525. this.history.isRW6 = false
  5526. } else if (response.data.list[0].inforvalue == 3) {
  5527. this.history.isRW1 = true
  5528. this.history.isRW2 = true
  5529. this.history.isRW3 = true
  5530. this.history.isRW4 = false
  5531. this.history.isRW5 = false
  5532. this.history.isRW6 = false
  5533. } else if (response.data.list[0].inforvalue == 4) {
  5534. this.history.isRW1 = true
  5535. this.history.isRW2 = true
  5536. this.history.isRW3 = true
  5537. this.history.isRW4 = true
  5538. this.history.isRW5 = false
  5539. this.history.isRW6 = false
  5540. } else if (response.data.list[0].inforvalue == 5) {
  5541. this.history.isRW1 = true
  5542. this.history.isRW2 = true
  5543. this.history.isRW3 = true
  5544. this.history.isRW4 = true
  5545. this.history.isRW5 = true
  5546. this.history.isRW6 = false
  5547. } else if (response.data.list[0].inforvalue == 6) {
  5548. this.history.isRW1 = true
  5549. this.history.isRW2 = true
  5550. this.history.isRW3 = true
  5551. this.history.isRW4 = true
  5552. this.history.isRW5 = true
  5553. this.history.isRW6 = true
  5554. }
  5555. } else {
  5556. this.history.isRW1 = false
  5557. this.history.isRW2 = false
  5558. this.history.isRW3 = false
  5559. this.history.isRW4 = false
  5560. this.history.isRW5 = false
  5561. this.history.isRW6 = false
  5562. }
  5563. })
  5564. this.getHistoryList()
  5565. },
  5566. getHistoryList() {
  5567. this.history.listLoading = true
  5568. GetDataByName(this.history.getdataListParm).then((response) => {
  5569. console.log('table数据', response.data.list)
  5570. if (response.data.list !== null) {
  5571. console.log('table数据', response.data.list)
  5572. for (let i = 0; i < response.data.list.length; i++) {
  5573. if (
  5574. response.data.list[i].ptid == undefined ||
  5575. response.data.list[i].ptname == ''
  5576. ) {
  5577. this.$set(response.data.list[i], 'ptid', '')
  5578. this.$set(response.data.list[i], 'ptname', '')
  5579. }
  5580. }
  5581. this.history.list = response.data.list
  5582. this.handleSpan()
  5583. this.history.pageNum = response.data.pageNum
  5584. this.history.pageSize = response.data.pageSize
  5585. this.history.total = response.data.total
  5586. } else {
  5587. this.history.list = []
  5588. }
  5589. setTimeout(() => {
  5590. this.history.listLoading = false
  5591. }, 100)
  5592. })
  5593. },
  5594. handleSpan() {
  5595. this.mergekeys.forEach((key) => {
  5596. this.spanObj[key] = []
  5597. let position = 0
  5598. this.history.list.forEach((item, index) => {
  5599. if (index === 0) {
  5600. this.spanObj[key].push(1)
  5601. position = 0
  5602. } else {
  5603. if (key == 'sumweight') {
  5604. if (
  5605. this.history.list[index][key] ===
  5606. this.history.list[index - 1][key] &&
  5607. this.history.list[index]['barname'] ===
  5608. this.history.list[index - 1]['barname']
  5609. ) {
  5610. this.spanObj[key][position] += 1
  5611. this.spanObj[key].push(0)
  5612. } else {
  5613. this.spanObj[key].push(1)
  5614. position = index
  5615. }
  5616. } else {
  5617. if (
  5618. this.history.list[index][key] ===
  5619. this.history.list[index - 1][key]
  5620. ) {
  5621. this.spanObj[key][position] += 1
  5622. this.spanObj[key].push(0)
  5623. } else {
  5624. this.spanObj[key].push(1)
  5625. position = index
  5626. }
  5627. }
  5628. }
  5629. })
  5630. })
  5631. },
  5632. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  5633. for (let i = 0; i < this.mergekeys.length; i++) {
  5634. if (column.property === this.mergekeys[i]) {
  5635. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  5636. const _col = _row > 0 ? 1 : 0
  5637. return {
  5638. rowspan: _row,
  5639. colspan: _col
  5640. }
  5641. }
  5642. }
  5643. },
  5644. changeDate() {
  5645. this.getHistoryList()
  5646. },
  5647. // 应用
  5648. handleApplication() {
  5649. console.log('点击了应用')
  5650. MessageBox.confirm(
  5651. this.$t('message.msg58') +
  5652. this.history.getdataListParm.parammaps.date +
  5653. this.$t('message.msg59'),
  5654. {
  5655. confirmButtonText: this.$t('common.confirm'),
  5656. cancelButtonText: this.$t('common.cancel'),
  5657. type: 'warning'
  5658. }
  5659. )
  5660. .then(() => {
  5661. this.requestParam.name = 'applyFPdate'
  5662. this.requestParam.parammaps = {}
  5663. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  5664. this.requestParam.parammaps.date =
  5665. this.history.getdataListParm.parammaps.date
  5666. PostDataByName(this.requestParam).then((response) => {
  5667. if (response.msg === 'fail') {
  5668. this.$notify({
  5669. title: this.$t('driver.saveFail'),
  5670. message: response.data,
  5671. type: 'warning',
  5672. duration: 2000
  5673. })
  5674. } else {
  5675. this.$notify({
  5676. title: this.$t('common.succes'),
  5677. message: this.$t('driver.saveSuccess'),
  5678. type: 'success',
  5679. duration: 2000
  5680. })
  5681. this.getHistoryIsDisplay()
  5682. this.getList()
  5683. }
  5684. })
  5685. })
  5686. .catch(() => {
  5687. this.$message({ type: 'info', message: this.$t('message.msg41') })
  5688. })
  5689. },
  5690. // 导出
  5691. handleExport(item) {
  5692. if (item == 1) {
  5693. console.log('点击了导出模板')
  5694. this.download.getdataListParm.parammaps =
  5695. this.table.getdataListParm.parammaps
  5696. GetDataByName(this.download.getdataListParm).then((response) => {
  5697. if (response.data.list !== null) {
  5698. this.download.list = response.data.list
  5699. } else {
  5700. this.download.list = []
  5701. }
  5702. var downloadList = this.$t('message.downloadList')
  5703. const table = this.$refs.table
  5704. const columns = table.columns
  5705. const labels = columns.map((column) => column.label)
  5706. const labelArr = labels.splice(0,2);
  5707. console.log(labels,'1111------------');
  5708. var excelDatas = [
  5709. {
  5710. tHeader:this.$t('message.dhedform.theader'),
  5711. filterVal: ['barname', '', '', '', '', '', '', '', ''],
  5712. tableDatas: this.download.list,
  5713. sheetName: 'Sheet1'
  5714. },
  5715. {
  5716. tHeader: [this.$t('message.msg113')],
  5717. filterVal: ['obj1'],
  5718. tableDatas: downloadList,
  5719. sheetName: 'Sheet2'
  5720. }
  5721. ]
  5722. json2excel(excelDatas, this.$t('message.msg112'), true, 'xlsx')
  5723. })
  5724. } else {
  5725. console.log('点击了导出数据')
  5726. this.download.getdataListParm.parammaps =
  5727. this.table.getdataListParm.parammaps
  5728. GetDataByName(this.download.getdataListParm).then((response) => {
  5729. if (response.data.list !== null) {
  5730. for (let i = 0; i < response.data.list.length; i++) {
  5731. if (
  5732. response.data.list[i].ftid !== undefined &&
  5733. response.data.list[i].ftid !== ''
  5734. ) {
  5735. if (
  5736. this.recipeTemplateList.find(
  5737. (obj) => obj.id == response.data.list[i].ftid
  5738. ) !== undefined
  5739. ) {
  5740. this.$set(
  5741. response.data.list[i],
  5742. 'dryweight',
  5743. this.recipeTemplateList.find(
  5744. (obj) => obj.id == response.data.list[i].ftid
  5745. ).dryweight
  5746. ) // 编辑保存
  5747. } else {
  5748. this.$set(response.data.list[i], 'dryweight', '')
  5749. }
  5750. }
  5751. if (response.data.list[i].timesopt !== undefined) {
  5752. var timesoptArr = response.data.list[i].timesopt.split(',')
  5753. for (let j = 0; j < timesoptArr.length; j++) {
  5754. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] =
  5755. timesoptArr[j].split(':')[1]
  5756. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] =
  5757. timesoptArr[j].split(':')[2]
  5758. }
  5759. }
  5760. if (
  5761. response.data.list[i].r1 == '' ||
  5762. response.data.list[i].r1 == undefined
  5763. ) {
  5764. response.data.list[i].r1 = 0
  5765. response.data.list[i].w1 = 0
  5766. }
  5767. if (
  5768. response.data.list[i].r2 == '' ||
  5769. response.data.list[i].r2 == undefined
  5770. ) {
  5771. response.data.list[i].r2 = 0
  5772. response.data.list[i].w2 = 0
  5773. }
  5774. if (
  5775. response.data.list[i].r3 == '' ||
  5776. response.data.list[i].r3 == undefined
  5777. ) {
  5778. response.data.list[i].r3 = 0
  5779. response.data.list[i].w3 = 0
  5780. }
  5781. if (
  5782. response.data.list[i].r4 == '' ||
  5783. response.data.list[i].r4 == undefined
  5784. ) {
  5785. response.data.list[i].r4 = 0
  5786. response.data.list[i].w4 = 0
  5787. }
  5788. if (
  5789. response.data.list[i].r5 == '' ||
  5790. response.data.list[i].r5 == undefined
  5791. ) {
  5792. response.data.list[i].r5 = 0
  5793. response.data.list[i].w5 = 0
  5794. }
  5795. if (
  5796. response.data.list[i].r6 == '' ||
  5797. response.data.list[i].r6 == undefined
  5798. ) {
  5799. response.data.list[i].r6 = 0
  5800. response.data.list[i].w6 = 0
  5801. }
  5802. this.$set(
  5803. response.data.list[i],
  5804. 'sumr',
  5805. parseFloat(response.data.list[i].r1) +
  5806. parseFloat(response.data.list[i].r2) +
  5807. parseFloat(response.data.list[i].r3) +
  5808. parseFloat(response.data.list[i].r4) +
  5809. parseFloat(response.data.list[i].r5) +
  5810. parseFloat(response.data.list[i].r6)
  5811. )
  5812. response.data.list[i].sumr = formatNum(
  5813. response.data.list[i].sumr,
  5814. parseInt(Cookies.get('decimalr'))
  5815. )
  5816. this.$set(
  5817. response.data.list[i],
  5818. 'dailyWeight',
  5819. parseFloat(response.data.list[i].w1) +
  5820. parseFloat(response.data.list[i].w2) +
  5821. parseFloat(response.data.list[i].w3) +
  5822. parseFloat(response.data.list[i].w4) +
  5823. parseFloat(response.data.list[i].w5) +
  5824. parseFloat(response.data.list[i].w6)
  5825. )
  5826. response.data.list[i].dailyWeight = formatNum(
  5827. response.data.list[i].dailyWeight,
  5828. parseInt(Cookies.get('decimal'))
  5829. )
  5830. }
  5831. this.download.list = response.data.list
  5832. } else {
  5833. this.download.list = []
  5834. }
  5835. if (
  5836. this.table.isRW1 == true &&
  5837. this.table.isRW2 == false &&
  5838. this.table.isRW3 == false &&
  5839. this.table.isRW4 == false &&
  5840. this.table.isRW5 == false &&
  5841. this.table.isRW6 == false
  5842. ) {
  5843. var excelDatas = [
  5844. {
  5845. tHeader: this.$t('dhedFormula.theader2'),
  5846. filterVal: [
  5847. 'barname',
  5848. 'softccount',
  5849. 'ccount',
  5850. 'ratio',
  5851. 'ccountratio',
  5852. 'ftname',
  5853. 'ptsfname',
  5854. 'r1',
  5855. 'w1',
  5856. 'sumr',
  5857. 'dailyWeight',
  5858. 'ftweight',
  5859. 'supplyweight',
  5860. 'dryweight'
  5861. ],
  5862. tableDatas: this.download.list,
  5863. sheetName: 'Sheet1'
  5864. }
  5865. ]
  5866. } else if (
  5867. this.table.isRW1 == true &&
  5868. this.table.isRW2 == true &&
  5869. this.table.isRW3 == false &&
  5870. this.table.isRW4 == false &&
  5871. this.table.isRW5 == false &&
  5872. this.table.isRW6 == false
  5873. ) {
  5874. var excelDatas = [
  5875. {
  5876. tHeader: this.$t('dhedFormula.theader3'),
  5877. filterVal: [
  5878. 'barname',
  5879. 'softccount',
  5880. 'ccount',
  5881. 'ratio',
  5882. 'ccountratio',
  5883. 'ftname',
  5884. 'ptsfname',
  5885. 'r1',
  5886. 'w1',
  5887. 'r2',
  5888. 'w2',
  5889. 'sumr',
  5890. 'dailyWeight',
  5891. 'ftweight',
  5892. 'supplyweight',
  5893. 'dryweight'
  5894. ],
  5895. tableDatas: this.download.list,
  5896. sheetName: 'Sheet1'
  5897. }
  5898. ]
  5899. } else if (
  5900. this.table.isRW1 == true &&
  5901. this.table.isRW2 == true &&
  5902. this.table.isRW3 == true &&
  5903. this.table.isRW4 == false &&
  5904. this.table.isRW5 == false &&
  5905. this.table.isRW6 == false
  5906. ) {
  5907. var excelDatas = [
  5908. {
  5909. tHeader: this.$t('dhedFormula.theader4'),
  5910. filterVal: [
  5911. 'barname',
  5912. 'softccount',
  5913. 'ccount',
  5914. 'ratio',
  5915. 'ccountratio',
  5916. 'ftname',
  5917. 'ptsfname',
  5918. 'r1',
  5919. 'w1',
  5920. 'r2',
  5921. 'w2',
  5922. 'r3',
  5923. 'w3',
  5924. 'sumr',
  5925. 'dailyWeight',
  5926. 'ftweight',
  5927. 'supplyweight',
  5928. 'dryweight'
  5929. ],
  5930. tableDatas: this.download.list,
  5931. sheetName: 'Sheet1'
  5932. }
  5933. ]
  5934. } else if (
  5935. this.table.isRW1 == true &&
  5936. this.table.isRW2 == true &&
  5937. this.table.isRW3 == true &&
  5938. this.table.isRW4 == true &&
  5939. this.table.isRW5 == false &&
  5940. this.table.isRW6 == false
  5941. ) {
  5942. var excelDatas = [
  5943. {
  5944. tHeader: this.$t('dhedFormula.theader5'),
  5945. filterVal: [
  5946. 'barname',
  5947. 'softccount',
  5948. 'ccount',
  5949. 'ratio',
  5950. 'ccountratio',
  5951. 'ftname',
  5952. 'ptsfname',
  5953. 'r1',
  5954. 'w1',
  5955. 'r2',
  5956. 'w2',
  5957. 'r3',
  5958. 'w3',
  5959. 'r4',
  5960. 'w4',
  5961. 'sumr',
  5962. 'dailyWeight',
  5963. 'ftweight',
  5964. 'supplyweight',
  5965. 'dryweight'
  5966. ],
  5967. tableDatas: this.download.list,
  5968. sheetName: 'Sheet1'
  5969. }
  5970. ]
  5971. } else if (
  5972. this.table.isRW1 == true &&
  5973. this.table.isRW2 == true &&
  5974. this.table.isRW3 == true &&
  5975. this.table.isRW4 == true &&
  5976. this.table.isRW5 == true &&
  5977. this.table.isRW6 == false
  5978. ) {
  5979. var excelDatas = [
  5980. {
  5981. tHeader: this.$t('dhedFormula.theader6'),
  5982. filterVal: [
  5983. 'barname',
  5984. 'softccount',
  5985. 'ccount',
  5986. 'ratio',
  5987. 'ccountratio',
  5988. 'ftname',
  5989. 'ptsfname',
  5990. 'r1',
  5991. 'w1',
  5992. 'r2',
  5993. 'w2',
  5994. 'r3',
  5995. 'w3',
  5996. 'r4',
  5997. 'w4',
  5998. 'r5',
  5999. 'w5',
  6000. 'sumr',
  6001. 'dailyWeight',
  6002. 'ftweight',
  6003. 'supplyweight',
  6004. 'dryweight'
  6005. ],
  6006. tableDatas: this.download.list,
  6007. sheetName: 'Sheet1'
  6008. }
  6009. ]
  6010. } else if (
  6011. this.table.isRW1 == true &&
  6012. this.table.isRW2 == true &&
  6013. this.table.isRW3 == true &&
  6014. this.table.isRW4 == true &&
  6015. this.table.isRW5 == true &&
  6016. this.table.isRW6 == true
  6017. ) {
  6018. var excelDatas = [
  6019. {
  6020. tHeader: this.$t('dhedFormula.theader7'),
  6021. filterVal: [
  6022. 'barname',
  6023. 'softccount',
  6024. 'ccount',
  6025. 'ratio',
  6026. 'ccountratio',
  6027. 'ftname',
  6028. 'ptsfname',
  6029. 'r1',
  6030. 'w1',
  6031. 'r2',
  6032. 'w2',
  6033. 'r3',
  6034. 'w3',
  6035. 'r4',
  6036. 'w4',
  6037. 'r5',
  6038. 'w5',
  6039. 'r6',
  6040. 'w6',
  6041. 'sumr',
  6042. 'dailyWeight',
  6043. 'ftweight',
  6044. 'supplyweight',
  6045. 'dryweight'
  6046. ],
  6047. tableDatas: this.download.list,
  6048. sheetName: 'Sheet1'
  6049. }
  6050. ]
  6051. }
  6052. json2excel(excelDatas, this.$t('message.msg140'), true, 'xlsx')
  6053. })
  6054. }
  6055. },
  6056. beforeImport(file) {
  6057. const isLt2M = file.size / 1024 / 1024 < 2
  6058. if (!isLt2M) {
  6059. this.$message.error(this.$t('dhedFormula.errMsg'))
  6060. }
  6061. return isLt2M
  6062. },
  6063. handleImportSuccess(res, file) {
  6064. this.getList()
  6065. if (res.msg === 'ok') {
  6066. this.$message({
  6067. title: this.$t('common.succes'),
  6068. message:
  6069. this.$t('message.msg5') +
  6070. res.data.success +
  6071. this.$t('message.msg39'),
  6072. type: 'success',
  6073. duration: 2000
  6074. })
  6075. if (res.data.err_count > 0) {
  6076. this.$notify({
  6077. title: this.$t('message.msg37'),
  6078. message:
  6079. this.$t('message.msg38') +
  6080. res.data.err_count +
  6081. this.$t('message.msg39'),
  6082. type: 'danger',
  6083. duration: 2000
  6084. })
  6085. import('@/vendor/Export2Excel').then((excel) => {
  6086. const list1 = res.data.result
  6087. const tHeader = this.$t('dhedFormula.theader1')
  6088. const filterVal = [
  6089. '栏舍名称',
  6090. '实际牛头数',
  6091. '系数(%)',
  6092. '配方模板',
  6093. '补料配方',
  6094. '第一班比例(%)',
  6095. '第二班比例(%)',
  6096. '第三班比例(%)',
  6097. 'error_msg'
  6098. ]
  6099. const data1 = this.formatJson(filterVal, list1)
  6100. excel.export_json_to_excel({
  6101. header: tHeader,
  6102. data: data1,
  6103. filename: this.$t('dhedFormula.lspf'),
  6104. autoWidth: true,
  6105. bookType: 'xlsx'
  6106. })
  6107. })
  6108. }
  6109. } else {
  6110. this.$notify({
  6111. title: this.$t('message.msg37'),
  6112. message: this.$t('message.msg40'),
  6113. type: 'danger',
  6114. duration: 2000
  6115. })
  6116. }
  6117. },
  6118. formatJson(filterVal, jsonData) {
  6119. return jsonData.map((v) =>
  6120. filterVal.map((j) => {
  6121. if (j === 'timestamp') {
  6122. return parseTime(v[j])
  6123. } else {
  6124. return v[j]
  6125. }
  6126. })
  6127. )
  6128. },
  6129. // 干物质调节
  6130. handleDryMatterRegulation() {
  6131. console.log('干物质调节')
  6132. this.isShowDialog = true
  6133. this.$refs.mychild.getBalconicFormula()
  6134. this.$refs.mychild.restTemp()
  6135. },
  6136. handleSynchronous() {
  6137. MessageBox.confirm(this.$t('dhedFormula.msg1'), {
  6138. confirmButtonText: this.$t('common.confirm'),
  6139. cancelButtonText: this.$t('common.cancel'),
  6140. type: 'warning'
  6141. })
  6142. .then(() => {
  6143. const url = 'authdata/ud/feedp/sync'
  6144. const data = {}
  6145. postJson(url, data).then((response) => {
  6146. if (response.msg !== 'fail') {
  6147. this.$notify({
  6148. title: this.$t('common.succes'),
  6149. message: this.$t('driver.saveSuccess'),
  6150. type: 'success',
  6151. duration: 2000
  6152. })
  6153. }
  6154. })
  6155. })
  6156. .catch(() => {
  6157. this.$message({ type: 'info', message: this.$t('message.msg114') })
  6158. })
  6159. },
  6160. handle_batchEdit() {
  6161. // this.getList()
  6162. this.isproportion = true
  6163. console.log(this.isproportion)
  6164. this.oldList = JSON.parse(JSON.stringify(this.table.list))
  6165. this.table.list.forEach((item, key) => {
  6166. item.Edit = false
  6167. item.NoEdit = true
  6168. item.isUpdate = true
  6169. item.isUpdateSave = false
  6170. })
  6171. // row.Edit
  6172. },
  6173. focusData(row) {
  6174. console.log(row, 'row')
  6175. this.oldList.forEach((item, key) => {
  6176. if (row.id == item.id) {
  6177. this.oldRowList = { ...item }
  6178. }
  6179. })
  6180. console.log(this.oldRowList, 'row')
  6181. },
  6182. handle_batchEdit_save() {
  6183. const arr = this.table.list.filter((item2) => {
  6184. console.log(item2, 'item2')
  6185. return !this.oldList.some(
  6186. (item1) =>
  6187. item1.r1 === item2.r1 &&
  6188. item1.r2 === item2.r2 &&
  6189. item1.r3 === item2.r3 &&
  6190. item1.r4 === item2.r4 &&
  6191. item1.r5 === item2.r5 &&
  6192. item1.r6 === item2.r6
  6193. )
  6194. })
  6195. const barList = []
  6196. arr.forEach((item) => {
  6197. let obj = {}
  6198. obj.barname = item.barname
  6199. obj.ccount = item.ccount
  6200. obj.ratio = item.ratio
  6201. obj.ftname = item.ftname
  6202. obj.ptsfname = item.ptsfname
  6203. obj.times1 = item.r1
  6204. obj.times2 = item.r2
  6205. obj.times3 = item.r3
  6206. obj.times4 = item.r4
  6207. obj.times5 = item.r5
  6208. obj.times6 = item.r6
  6209. barList.push(obj)
  6210. })
  6211. const url = 'authdata/fpdetail/batch/edit'
  6212. let data = {
  6213. pastureId: Cookies.get('pastureid'),
  6214. barList: barList
  6215. }
  6216. postJson(url, data).then((response) => {
  6217. if (response.msg !== 'fail') {
  6218. this.$notify({
  6219. title: this.$t('common.succes'),
  6220. message: this.$t('driver.saveSuccess'),
  6221. type: 'success',
  6222. duration: 2000
  6223. })
  6224. } else {
  6225. this.$notify({
  6226. title: this.$t('driver.saveFail'),
  6227. message: response.data,
  6228. type: 'warning',
  6229. duration: 2000
  6230. })
  6231. }
  6232. this.isproportion = false
  6233. })
  6234. },
  6235. cancelChangeEdit() {
  6236. // 取消顺序
  6237. this.getList()
  6238. this.isproportion = false
  6239. },
  6240. handleRestore(row) {
  6241. // 恢复
  6242. MessageBox.confirm(this.$t('message.msg333'), {
  6243. confirmButtonText: this.$t('common.confirm'),
  6244. cancelButtonText: this.$t('common.cancel'),
  6245. type: 'warning'
  6246. })
  6247. .then(() => {
  6248. const dataList = this.history.list
  6249. const result = dataList.filter((obj) => obj.barname === row.barname)
  6250. console.log(result, 'result')
  6251. const barList = []
  6252. result.forEach((item) => {
  6253. console.log(item, 'item')
  6254. let obj = {}
  6255. obj.barname = item.barname
  6256. obj.ccount = item.ccount
  6257. obj.ratio = item.ratio
  6258. obj.ftname = item.ptname
  6259. // obj.ptsfname = item.ptsfname
  6260. if (item.timesin == '1') {
  6261. obj.times1 = item.tratio
  6262. } else {
  6263. obj.times1 = 0
  6264. }
  6265. if (item.timesin == '2') {
  6266. obj.times2 = item.tratio
  6267. } else {
  6268. obj.times2 = 0
  6269. }
  6270. if (item.timesin == '3') {
  6271. obj.times3 = item.tratio
  6272. } else {
  6273. obj.times3 = 0
  6274. }
  6275. if (item.timesin == '4') {
  6276. obj.times4 = item.tratio
  6277. } else {
  6278. obj.times4 = 0
  6279. }
  6280. if (item.timesin == '5') {
  6281. obj.times5 = item.tratio
  6282. } else {
  6283. obj.times5 = 0
  6284. }
  6285. if (item.timesin == '6') {
  6286. obj.times6 = item.tratio
  6287. } else {
  6288. obj.times6 = 0
  6289. }
  6290. barList.push(obj)
  6291. })
  6292. // 根据 "barname" 属性进行分组
  6293. const groupedData = barList.reduce((acc, obj) => {
  6294. const key = obj.barname
  6295. if (!acc[key]) {
  6296. acc[key] = [obj]
  6297. } else {
  6298. acc[key].push(obj)
  6299. }
  6300. return acc
  6301. }, {})
  6302. console.log(groupedData, 'groupedData')
  6303. console.log(Object.keys(groupedData), 'groupedData')
  6304. // 合并相同 "barname" 值的对象
  6305. const consolidatedData = groupedData[
  6306. Object.keys(groupedData)[0]
  6307. ].reduce((acc, item) => {
  6308. for (const key in item) {
  6309. if (key.startsWith('times')) {
  6310. acc[key] = (acc[key] || 0) + parseFloat(item[key])
  6311. } else {
  6312. acc[key] = item[key]
  6313. }
  6314. }
  6315. return acc
  6316. }, {})
  6317. console.log(consolidatedData)
  6318. const url = 'authdata/fpdetail/batch/edit'
  6319. let data = {
  6320. pastureId: Cookies.get('pastureid'),
  6321. barList: [consolidatedData]
  6322. }
  6323. postJson(url, data).then((response) => {
  6324. if (response.msg !== 'fail') {
  6325. this.$notify({
  6326. title: this.$t('common.succes'),
  6327. message: this.$t('driver.saveSuccess'),
  6328. type: 'success',
  6329. duration: 2000
  6330. })
  6331. this.getDateList()
  6332. } else {
  6333. this.$notify({
  6334. title: this.$t('driver.saveFail'),
  6335. message: response.data,
  6336. type: 'warning',
  6337. duration: 2000
  6338. })
  6339. }
  6340. this.isproportion = false
  6341. })
  6342. })
  6343. .catch(() => {
  6344. this.$message({ type: 'info', message: this.$t('message.msg115') })
  6345. })
  6346. }
  6347. }
  6348. }
  6349. </script>
  6350. <style lang="scss" scoped>
  6351. .search {
  6352. clear: both;
  6353. height: 50px;
  6354. }
  6355. .table {
  6356. margin-top: 10px;
  6357. }
  6358. /deep/ .el-input__inner {
  6359. padding: 0 5px;
  6360. }
  6361. /deep/ .el-table .cell {
  6362. padding-left: 5px;
  6363. padding-right: 5px;
  6364. }
  6365. </style>
  6366. <style lang="scss">
  6367. .red-row {
  6368. background: #fde2e2 !important;
  6369. }
  6370. </style>