523eae8557092310b3b51b6cf6aebc208753fd21.svn-base 172 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button class="success" style="float: left;" @click="handleNutritional">营养评估</el-button>
  5. <el-button class="success" style="float: left;" @click="handleDryMatterRegulation">干物质调节</el-button>
  6. <el-upload style="float: right;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
  7. <el-button class="import" style="float: right;">导入</el-button>
  8. </el-upload>
  9. <el-dropdown style="float: right;margin-right: 10px;">
  10. <el-button class="export">导出</el-button>
  11. <el-dropdown-menu slot="dropdown">
  12. <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
  13. <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
  14. </el-dropdown-menu>
  15. </el-dropdown>
  16. <el-button class="export" style="float: right;margin-right: 10px;" @click="handleHistoryRecords">历史记录</el-button>
  17. </div>
  18. <div class="search" />
  19. <div class="table">
  20. <el-table
  21. :key="table.tableKey"
  22. v-loading="table.listLoading"
  23. element-loading-text="给我一点时间"
  24. :data="table.list"
  25. border
  26. fit
  27. highlight-current-row
  28. style="width: 100%;"
  29. :row-style="rowStyle"
  30. :cell-style="cellStyle"
  31. class="elTable table-fixed"
  32. @header-click="headerClick"
  33. @cell-click="cellClick"
  34. @selection-change="handleSelect"
  35. >
  36. <el-table-column type="selection" width="50" />
  37. <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left">
  38. <template slot-scope="scope">
  39. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="栏舍名称" min-width="100px" align="center" class-name="small-padding fixed-width" fixed="left">
  43. <template slot-scope="scope">
  44. <span>{{ scope.row.barname }}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="软件牛头数" min-width="70px" align="center">
  48. <template slot-scope="scope">
  49. <span>{{ scope.row.softccount }}</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="实际牛头数" min-width="90px" align="center">
  53. <template slot-scope="scope">
  54. <span v-if="scope.row.NoEdit">{{ scope.row.ccount }}</span>
  55. <el-input v-if="scope.row.Edit" v-model="scope.row.ccount" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurCcount(scope.row)" />
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="系数(%)" min-width="85px" align="center">
  59. <template slot-scope="scope">
  60. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  61. <el-input v-if="scope.row.Edit" v-model="scope.row.ratio" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurRatio(scope.row)" />
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="系数头数" min-width="85px" align="center">
  65. <template slot-scope="scope">
  66. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  67. <el-input v-if="scope.row.Edit" v-model="scope.row.ccountratio" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurCcountratio(scope.row)" />
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="配方模板" min-width="130px" align="center">
  71. <template slot-scope="scope">
  72. <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
  73. <el-select v-if="scope.row.Edit" v-model="scope.row.ftid" filterable placeholder="配方模板" class="filter-item" style="width:99%;" @change="(value)=> {changeRecipeTemplate(value, scope.row)}">
  74. <el-option v-for="item in recipeTemplateList" :key="item.id" :label="item.tname" :value="item.id" />
  75. </el-select>
  76. </template>
  77. </el-table-column>
  78. <el-table-column v-if="table.isPtsfname" :key="8" label="补料配方" min-width="130px" align="center">
  79. <template slot-scope="scope">
  80. <span v-if="scope.row.NoEdit">{{ scope.row.ptsfname }}</span>
  81. <el-select v-if="scope.row.Edit" v-model="scope.row.ptsfid" clearable filterable placeholder="补料配方" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeFeedingFormula(value, scope.row)}">
  82. <el-option v-for="item in feedingFormulaList" :key="item.id" :label="item.tname" :value="item.id" />
  83. </el-select>
  84. </template>
  85. </el-table-column>
  86. <el-table-column v-if="table.isRW1" :key="9" label="第一班比例(%)" min-width="80px" align="center">
  87. <template slot-scope="scope">
  88. <span v-if="scope.row.NoEdit">{{ scope.row.r1 }}</span>
  89. <el-input v-if="scope.row.Edit" v-model="scope.row.r1" :disabled="scope.row.isOneWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
  90. </template>
  91. </el-table-column>
  92. <el-table-column v-if="table.isRW1" :key="10" label="第一班重量" min-width="80px" align="center" :render-header="renderHeader">
  93. <template slot-scope="scope">
  94. <span v-if="scope.row.NoEdit">{{ scope.row.w1 }}</span>
  95. <el-input v-if="scope.row.Edit" v-model="scope.row.w1" :disabled="scope.row.isOneWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurW(scope.row)" @focus="focusW(scope.row)" />
  96. </template>
  97. </el-table-column>
  98. <el-table-column v-if="table.isRW2" :key="11" label="第二班比例(%)" min-width="80px" align="center">
  99. <template slot-scope="scope">
  100. <span v-if="scope.row.NoEdit">{{ scope.row.r2 }}</span>
  101. <el-input v-if="scope.row.Edit" v-model="scope.row.r2" step="0.01" type="number" :disabled="scope.row.isTwoWeight" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
  102. </template>
  103. </el-table-column>
  104. <el-table-column v-if="table.isRW2" :key="12" label="第二班重量" min-width="80px" align="center" :render-header="renderHeader">
  105. <template slot-scope="scope">
  106. <span v-if="scope.row.NoEdit">{{ scope.row.w2 }}</span>
  107. <el-input v-if="scope.row.Edit" v-model="scope.row.w2" :disabled="scope.row.isTwoWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurW2(scope.row)" @focus="focusW2(scope.row)" />
  108. </template>
  109. </el-table-column>
  110. <el-table-column v-if="table.isRW3" :key="13" label="第三班比例(%)" min-width="80px" align="center">
  111. <template slot-scope="scope">
  112. <span v-if="scope.row.NoEdit">{{ scope.row.r3 }}</span>
  113. <el-input v-if="scope.row.Edit" v-model="scope.row.r3" step="0.01" type="number" :disabled="scope.row.isThreeWeight" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
  114. </template>
  115. </el-table-column>
  116. <el-table-column v-if="table.isRW3" :key="14" label="第三班重量" min-width="80px" align="center" :render-header="renderHeader">
  117. <template slot-scope="scope">
  118. <span v-if="scope.row.NoEdit">{{ scope.row.w3 }}</span>
  119. <el-input v-if="scope.row.Edit" v-model="scope.row.w3" :disabled="scope.row.isThreeWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurW3(scope.row)" @focus="focusW3(scope.row)" />
  120. </template>
  121. </el-table-column>
  122. <el-table-column v-if="table.isRW4" :key="15" label="第四班比例(%)" min-width="80px" align="center">
  123. <template slot-scope="scope">
  124. <span v-if="scope.row.NoEdit">{{ scope.row.r4 }}</span>
  125. <el-input v-if="scope.row.Edit" v-model="scope.row.r4" step="0.01" type="number" :disabled="scope.row.isFourWeight" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
  126. </template>
  127. </el-table-column>
  128. <el-table-column v-if="table.isRW4" :key="16" label="第四班重量" min-width="80px" align="center" :render-header="renderHeader">
  129. <template slot-scope="scope">
  130. <span v-if="scope.row.NoEdit">{{ scope.row.w4 }}</span>
  131. <el-input v-if="scope.row.Edit" v-model="scope.row.w4" :disabled="scope.row.isFourWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurW4(scope.row)" @focus="focusW4(scope.row)" />
  132. </template>
  133. </el-table-column>
  134. <el-table-column :key="17" label="总比例(%)" min-width="80px" align="center">
  135. <template slot-scope="scope">
  136. <span>{{ scope.row.sumr }}</span>
  137. </template>
  138. </el-table-column>
  139. <!-- <el-table-column :key="22" label="投喂量" min-width="80px" align="center">
  140. <template slot-scope="scope">
  141. <span>{{ scope.row.feedweight }}</span>
  142. </template>
  143. </el-table-column> -->
  144. <el-table-column :key="18" label="日投喂量" min-width="70px" align="center">
  145. <template slot-scope="scope">
  146. <span>{{ scope.row.dailyWeight }}</span>
  147. </template>
  148. </el-table-column>
  149. <el-table-column :key="19" label="配方重量" min-width="70px" align="center">
  150. <template slot-scope="scope">
  151. <span>{{ scope.row.ftweight }}</span>
  152. </template>
  153. </el-table-column>
  154. <el-table-column v-if="table.isPtsfname" :key="20" label="补料重量" min-width="100px" align="center">
  155. <template slot-scope="scope">
  156. <span>{{ scope.row.supplyweight }}</span>
  157. </template>
  158. </el-table-column>
  159. <el-table-column :key="21" label="配方干物质" min-width="70px" align="center">
  160. <template slot-scope="scope">
  161. <span>{{ scope.row.dryweight }}</span>
  162. </template>
  163. </el-table-column>
  164. <el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width" fixed="right">
  165. <template slot-scope="{row}">
  166. <!-- 编辑 -->
  167. <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  168. <!-- 编辑保存 -->
  169. <el-button v-if="row.isUpdateSave" class="miniSuccess" :disabled="isokDisable" @click="updateData(row)">保存</el-button>
  170. <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel(row)">取消</el-button>
  171. </template>
  172. </el-table-column>
  173. </el-table>
  174. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  175. </div>
  176. <!-- 历史记录 -->
  177. <el-dialog :title="textMap[history.dialogStatus]" :destroy-on-close="true" :visible.sync="history.dialogFormVisible" :close-on-click-modal="false" width="90%">
  178. <div class="app-history">
  179. <div class="search">
  180. <el-date-picker v-model="history.getdataListParm.parammaps.date" type="date" placeholder="请选择历史记录时间" :clearable="false" style="width: 180px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="changeDate" />
  181. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  182. </div>
  183. <div class="table">
  184. <el-table
  185. :key="history.tableKey"
  186. v-loading="history.listLoading"
  187. element-loading-text="给我一点时间"
  188. :data="history.list"
  189. border
  190. fit
  191. highlight-current-row
  192. style="width: 100%;"
  193. :row-style="rowStyle"
  194. :cell-style="cellStyle"
  195. class="elTable table-fixed"
  196. :span-method="objectSpanMethod"
  197. >
  198. <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left">
  199. <template slot-scope="scope">
  200. <span>{{ scope.$index + (history.pageNum-1) * history.pageSize + 1 }}</span>
  201. </template>
  202. </el-table-column>
  203. <el-table-column :key="2" label="栏舍名称" prop="barname" min-width="90px" align="center" class-name="small-padding fixed-width" fixed="left" />
  204. <el-table-column :key="3" label="班次" prop="times" min-width="90px" align="center" class-name="small-padding fixed-width" fixed="left" />
  205. <el-table-column :key="4" label="软件牛头数" prop="softccount" min-width="70px" align="center" />
  206. <el-table-column :key="5" label="实际牛头数" prop="ccount" min-width="70px" align="center" />
  207. <el-table-column :key="6" label="系数(%)" prop="ratio" min-width="70px" align="center" />
  208. <el-table-column :key="7" label="系数头数" prop="ccountratio" min-width="70px" align="center" />
  209. <el-table-column :key="8" label="配方模板" prop="ptname" min-width="70px" align="center" />
  210. <el-table-column v-if="table.isPtsfname" :key="9" label="补料配方" prop="ptsname" min-width="70px" align="center" />
  211. <el-table-column :key="10" label="班次比例" prop="tratio" min-width="70px" align="center" />
  212. <el-table-column :key="11" label="班次重量" prop="weight" min-width="70px" align="center" />
  213. <el-table-column :key="12" label="配方重量" prop="pweight" min-width="70px" align="center" />
  214. <el-table-column v-if="table.isPtsfname" :key="13" label="补料重量" prop="ptweight" min-width="70px" align="center" />
  215. <el-table-column :key="14" label="配方干物质量" prop="dryweight" min-width="70px" align="center" />
  216. <el-table-column :key="15" label="饲喂干物质量" prop="swdryw" min-width="70px" align="center" />
  217. <el-table-column :key="16" label="采样干物质量" prop="cydryw" min-width="70px" align="center" />
  218. <el-table-column :key="17" label="日投喂量" prop="sumweight" min-width="70px" align="center" />
  219. </el-table>
  220. <pagination2 v-show="history.total>0" :total="history.total" :page.sync="history.getdataListParm.offset" :limit.sync="history.getdataListParm.pagecount" @pagination="getHistoryList" />
  221. </div>
  222. </div>
  223. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  224. <el-button class="cancelClose" @click="history.dialogFormVisible = false; ">关闭</el-button>
  225. </div>
  226. </el-dialog>
  227. <!-- 营养评估 -->
  228. <el-dialog :title="textMap[nutritional.dialogStatus]" :visible.sync="nutritional.dialogFormVisible" :close-on-click-modal="false" width="90%">
  229. <div class="app-nutritional">
  230. <h4 style="position: absolute;top:-5px;left:140px;font:18px/24px '' ;color:#303133;">栏舍:{{ nutritional.tab1.temp.barname }}</h4>
  231. <el-tabs v-model="nutritional.activeName" @tab-click="handleNutritionalTab">
  232. <el-tab-pane label="营养评估" name="first">
  233. <el-form ref="temp" :rules="rules" :model="nutritional.tab1.temp" label-position="right" label-width="95px" style="width: 100%;margin-bottom:30px">
  234. <el-row>
  235. <el-col :span="4">
  236. <el-form-item label="类别" prop="cowclassid">
  237. <el-select v-model="nutritional.tab1.temp.cowclassid" :disabled="nutritional.tab1.disabledCowclass" filterable placeholder="" class="filter-item" style="width:100%;">
  238. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
  239. </el-select>
  240. </el-form-item>
  241. </el-col>
  242. <el-col :span="4">
  243. <el-form-item label="月龄" prop="avgmonthage">
  244. <el-input ref="avgmonthage" v-model="nutritional.tab1.temp.avgmonthage" class="filter-item" placeholder="" style="width:100%;" />
  245. </el-form-item>
  246. </el-col>
  247. <el-col :span="4">
  248. <el-form-item label="体重(kg)" prop="bw">
  249. <el-input ref="bw" v-model="nutritional.tab1.temp.bw" class="filter-item" placeholder="" style="width:100%;" />
  250. </el-form-item>
  251. </el-col>
  252. <el-col :span="4">
  253. <el-form-item label="日增重(kg)" prop="dayw">
  254. <el-input ref="dayw" v-model="nutritional.tab1.temp.dayw" class="filter-item" placeholder="" style="width:100%;" />
  255. </el-form-item>
  256. </el-col>
  257. <el-col :span="4">
  258. <el-form-item label="胎次(次)" prop="fetal">
  259. <el-input ref="fetal" v-model="nutritional.tab1.temp.fetal" class="filter-item" placeholder="" style="width:100%;" />
  260. </el-form-item>
  261. </el-col>
  262. <el-col :span="4">
  263. <el-form-item label="泌乳天数(天)" prop="avgdim">
  264. <el-input ref="avgdim" v-model="nutritional.tab1.temp.avgdim" class="filter-item" placeholder="" style="width:100%;" />
  265. </el-form-item>
  266. </el-col>
  267. </el-row>
  268. <el-row>
  269. <el-col :span="4">
  270. <el-form-item label="怀孕天数(天)" prop="dayspre">
  271. <el-input ref="dayspre" v-model="nutritional.tab1.temp.dayspre" class="filter-item" placeholder="" style="width:100%;" />
  272. </el-form-item>
  273. </el-col>
  274. <el-col :span="4">
  275. <el-form-item label="产奶量(kg)" prop="product">
  276. <el-input ref="product" v-model="nutritional.tab1.temp.product" class="filter-item" placeholder="" style="width:100%;" />
  277. </el-form-item>
  278. </el-col>
  279. <el-col :span="4">
  280. <el-form-item label="乳脂率(%)" prop="fat">
  281. <el-input ref="fat" v-model="nutritional.tab1.temp.fat" class="filter-item" placeholder="" style="width:100%;" />
  282. </el-form-item>
  283. </el-col>
  284. <el-col :span="4">
  285. <el-form-item label="乳蛋白率(%)" prop="pro">
  286. <el-input ref="pro" v-model="nutritional.tab1.temp.pro" class="filter-item" placeholder="" style="width:100%;" />
  287. </el-form-item>
  288. </el-col>
  289. <el-col :span="4">
  290. <el-form-item label="乳糖率(%)" prop="lactose">
  291. <el-input ref="lactose" v-model="nutritional.tab1.temp.lactose" class="filter-item" placeholder="" style="width:100%;" />
  292. </el-form-item>
  293. </el-col>
  294. <el-col :span="4">
  295. <el-form-item label="温度(℃)" prop="tem">
  296. <el-input ref="tem" v-model="nutritional.tab1.temp.tem" class="filter-item" placeholder="" style="width:100%;" />
  297. </el-form-item>
  298. </el-col>
  299. </el-row>
  300. </el-form>
  301. <div style="height: 50px;">
  302. <el-date-picker v-model="nutritional.tab1.inputDatetime" :picker-options="pickerOptions" class="inputDatetime filter-item" :clearable="false" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;margin-right: 10px;" />
  303. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  304. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  305. <el-button class="success" :disabled="isokDisable" @click="assessmentData()">评估</el-button>
  306. </div>
  307. <div class="table">
  308. <el-table
  309. :key="nutritional.tab1.tableKey"
  310. v-loading="nutritional.tab1.listLoading"
  311. element-loading-text="给我一点时间"
  312. :data="nutritional.tab1.list"
  313. border
  314. fit
  315. highlight-current-row
  316. style="width: 100%;margin-bottom:60px;"
  317. :row-style="rowStyle"
  318. :cell-style="cellStyle"
  319. class="elTable table-fixed"
  320. :row-class-name="tableRowClassName"
  321. >
  322. <el-table-column label="序号" align="center" type="index" width="50px" />
  323. <el-table-column label="指标" min-width="130px" align="center">
  324. <template slot-scope="scope">
  325. <span>{{ scope.row.standard }}</span>
  326. </template>
  327. </el-table-column>
  328. <el-table-column label="奶牛需要" min-width="130px" align="center">
  329. <template slot-scope="scope">
  330. <span>{{ scope.row.cowneed }}</span>
  331. </template>
  332. </el-table-column>
  333. <el-table-column label="配方量" min-width="130px" align="center">
  334. <template slot-scope="scope">
  335. <span>{{ scope.row.ftpro }}</span>
  336. </template>
  337. </el-table-column>
  338. <el-table-column label="TMR料" min-width="130px" align="center">
  339. <template slot-scope="scope">
  340. <span>{{ scope.row.hprov }}</span>
  341. </template>
  342. </el-table-column>
  343. <el-table-column label="采食量" min-width="130px" align="center">
  344. <template slot-scope="scope">
  345. <span>{{ scope.row.sprov }}</span>
  346. </template>
  347. </el-table-column>
  348. </el-table>
  349. </div>
  350. </el-tab-pane>
  351. <el-tab-pane label="牛群评估" name="second">
  352. <el-date-picker v-model="nutritional.tab2.inputDatetime" :picker-options="pickerOptions" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;margin-right: 10px;" @change="changeTab2Date" />
  353. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  354. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  355. <el-row>
  356. <el-col :span="24">
  357. <h3 style="text-align: center;">宾州筛分析</h3>
  358. <div class="table">
  359. <el-table
  360. :key="nutritional.tab2.tableKey1"
  361. v-loading="nutritional.tab2.listLoading1"
  362. element-loading-text="给我一点时间"
  363. :data="nutritional.tab2.list1"
  364. border
  365. fit
  366. highlight-current-row
  367. style="width: 100%;margin-bottom:60px;"
  368. :row-style="rowStyle"
  369. :cell-style="cellStyle"
  370. class="elTable table-fixed"
  371. >
  372. <el-table-column label="日期" min-width="130px" align="center">
  373. <template slot-scope="scope">
  374. <span>{{ scope.row.operatetime }}</span>
  375. </template>
  376. </el-table-column>
  377. <el-table-column label="第一层重量(g)" min-width="130px" align="center">
  378. <template slot-scope="scope">
  379. <span>{{ scope.row.oneweight }}</span>
  380. </template>
  381. </el-table-column>
  382. <el-table-column label="第一层百分比" min-width="130px" align="center">
  383. <template slot-scope="scope">
  384. <span>{{ scope.row.onerate }}</span>
  385. </template>
  386. </el-table-column>
  387. <el-table-column label="第二层重量(g)" min-width="130px" align="center">
  388. <template slot-scope="scope">
  389. <span>{{ scope.row.twoweight }}</span>
  390. </template>
  391. </el-table-column>
  392. <el-table-column label="第二层百分比" min-width="130px" align="center">
  393. <template slot-scope="scope">
  394. <span>{{ scope.row.tworate }}</span>
  395. </template>
  396. </el-table-column>
  397. <el-table-column label="第三层重量(g)" min-width="130px" align="center">
  398. <template slot-scope="scope">
  399. <span>{{ scope.row.threeweight }}</span>
  400. </template>
  401. </el-table-column>
  402. <el-table-column label="第三层百分比" min-width="130px" align="center">
  403. <template slot-scope="scope">
  404. <span>{{ scope.row.threerate }}</span>
  405. </template>
  406. </el-table-column>
  407. <el-table-column label="第四层重量(g)" min-width="130px" align="center">
  408. <template slot-scope="scope">
  409. <span>{{ scope.row.fourweight }}</span>
  410. </template>
  411. </el-table-column>
  412. <el-table-column label="第四层百分比" min-width="130px" align="center">
  413. <template slot-scope="scope">
  414. <span>{{ scope.row.fourrate }}</span>
  415. </template>
  416. </el-table-column>
  417. <el-table-column label="参考标准" min-width="130px" align="center">
  418. <template slot-scope="scope">
  419. <span>{{ scope.row.standard }}</span>
  420. </template>
  421. </el-table-column>
  422. </el-table>
  423. </div>
  424. </el-col>
  425. </el-row>
  426. <el-row>
  427. <el-col :span="24">
  428. <h3 style="text-align: center;">粪便筛分析</h3>
  429. <div class="table">
  430. <el-table
  431. :key="nutritional.tab2.tableKey2"
  432. v-loading="nutritional.tab2.listLoading2"
  433. element-loading-text="给我一点时间"
  434. :data="nutritional.tab2.list2"
  435. border
  436. fit
  437. highlight-current-row
  438. style="width: 100%;margin-bottom:60px;"
  439. :row-style="rowStyle"
  440. :cell-style="cellStyle"
  441. class="elTable table-fixed"
  442. >
  443. <el-table-column label="日期" min-width="130px" align="center">
  444. <template slot-scope="scope">
  445. <span>{{ scope.row.operatetime }}</span>
  446. </template>
  447. </el-table-column>
  448. <el-table-column label="第一层重量(g)" min-width="130px" align="center">
  449. <template slot-scope="scope">
  450. <span>{{ scope.row.oneweight }}</span>
  451. </template>
  452. </el-table-column>
  453. <el-table-column label="第一层百分比" min-width="130px" align="center">
  454. <template slot-scope="scope">
  455. <span>{{ scope.row.onerate }}</span>
  456. </template>
  457. </el-table-column>
  458. <el-table-column label="第二层重量(g)" min-width="130px" align="center">
  459. <template slot-scope="scope">
  460. <span>{{ scope.row.twoweight }}</span>
  461. </template>
  462. </el-table-column>
  463. <el-table-column label="第二层百分比" min-width="130px" align="center">
  464. <template slot-scope="scope">
  465. <span>{{ scope.row.tworate }}</span>
  466. </template>
  467. </el-table-column>
  468. <el-table-column label="第三层重量(g)" min-width="130px" align="center">
  469. <template slot-scope="scope">
  470. <span>{{ scope.row.threeweight }}</span>
  471. </template>
  472. </el-table-column>
  473. <el-table-column label="第三层百分比" min-width="130px" align="center">
  474. <template slot-scope="scope">
  475. <span>{{ scope.row.threerate }}</span>
  476. </template>
  477. </el-table-column>
  478. <el-table-column label="参考标准" min-width="130px" align="center">
  479. <template slot-scope="scope">
  480. <span>{{ scope.row.standard }}</span>
  481. </template>
  482. </el-table-column>
  483. </el-table>
  484. </div>
  485. </el-col>
  486. </el-row>
  487. <el-row>
  488. <el-col :span="24">
  489. <h3 style="text-align: center;">BCS评分</h3>
  490. <div class="table">
  491. <el-table
  492. :key="nutritional.tab2.tableKey3"
  493. v-loading="nutritional.tab2.listLoading3"
  494. element-loading-text="给我一点时间"
  495. :data="nutritional.tab2.list3"
  496. border
  497. fit
  498. highlight-current-row
  499. style="width: 100%;margin-bottom:60px;"
  500. :row-style="rowStyle"
  501. :cell-style="cellStyle"
  502. class="elTable table-fixed"
  503. >
  504. <el-table-column label="日期" min-width="130px" align="center">
  505. <template slot-scope="scope">
  506. <span>{{ scope.row.operatetime }}</span>
  507. </template>
  508. </el-table-column>
  509. <el-table-column label="抽查样本数" min-width="130px" align="center">
  510. <template slot-scope="scope">
  511. <span>{{ scope.row.sumcowcount }}</span>
  512. </template>
  513. </el-table-column>
  514. <el-table-column label="单产(kg/头)" min-width="130px" align="center">
  515. <template slot-scope="scope">
  516. <span>{{ scope.row.product }}</span>
  517. </template>
  518. </el-table-column>
  519. <el-table-column label="物质采食量(kg/头)" min-width="130px" align="center">
  520. <template slot-scope="scope">
  521. <span>{{ scope.row.cowneed }}</span>
  522. </template>
  523. </el-table-column>
  524. <el-table-column label="泌乳天数" min-width="130px" align="center">
  525. <template slot-scope="scope">
  526. <span>{{ scope.row.avgdim }}</span>
  527. </template>
  528. </el-table-column>
  529. <el-table-column label="标准分数" min-width="130px" align="center">
  530. <template slot-scope="scope">
  531. <span>{{ scope.row.standardscore }}</span>
  532. </template>
  533. </el-table-column>
  534. <el-table-column label="2.5-分(数量、百分比)" min-width="130px" align="center">
  535. <template slot-scope="scope">
  536. <span>{{ scope.row.score25 }}</span>
  537. </template>
  538. </el-table-column>
  539. <el-table-column label="2.75分(数量、百分比)" min-width="130px" align="center">
  540. <template slot-scope="scope">
  541. <span>{{ scope.row.score275 }}</span>
  542. </template>
  543. </el-table-column>
  544. <el-table-column label="3分(数量、百分比)" min-width="130px" align="center">
  545. <template slot-scope="scope">
  546. <span>{{ scope.row.score3 }}</span>
  547. </template>
  548. </el-table-column>
  549. <el-table-column label="3.25分(数量、百分比)" min-width="130px" align="center">
  550. <template slot-scope="scope">
  551. <span>{{ scope.row.score325 }}</span>
  552. </template>
  553. </el-table-column>
  554. <el-table-column label="3.5分(数量、百分比)" min-width="130px" align="center">
  555. <template slot-scope="scope">
  556. <span>{{ scope.row.feedprov }}</span>
  557. </template>
  558. </el-table-column>
  559. <el-table-column label="3.75分(数量、百分比)" min-width="130px" align="center">
  560. <template slot-scope="scope">
  561. <span>{{ scope.row.score375 }}</span>
  562. </template>
  563. </el-table-column>
  564. <el-table-column label="4+分(数量、百分比)" min-width="130px" align="center">
  565. <template slot-scope="scope">
  566. <span>{{ scope.row.score4 }}</span>
  567. </template>
  568. </el-table-column>
  569. </el-table>
  570. </div>
  571. </el-col>
  572. </el-row>
  573. <el-row>
  574. <el-col :span="24">
  575. <h3 style="text-align: center;">粪便评分</h3>
  576. <div class="table">
  577. <el-table
  578. :key="nutritional.tab2.tableKey4"
  579. v-loading="nutritional.tab2.listLoading4"
  580. element-loading-text="给我一点时间"
  581. :data="nutritional.tab2.list4"
  582. border
  583. fit
  584. highlight-current-row
  585. style="width: 100%;margin-bottom:60px;"
  586. :row-style="rowStyle"
  587. :cell-style="cellStyle"
  588. class="elTable table-fixed"
  589. >
  590. <el-table-column label="日期" min-width="130px" align="center">
  591. <template slot-scope="scope">
  592. <span>{{ scope.row.operatetime }}</span>
  593. </template>
  594. </el-table-column>
  595. <el-table-column label="抽查样本数" min-width="130px" align="center">
  596. <template slot-scope="scope">
  597. <span>{{ scope.row.sumcowcount }}</span>
  598. </template>
  599. </el-table-column>
  600. <el-table-column label="单产(kg/头)" min-width="130px" align="center">
  601. <template slot-scope="scope">
  602. <span>{{ scope.row.product }}</span>
  603. </template>
  604. </el-table-column>
  605. <el-table-column label="干物质采食量(kg/头)" min-width="130px" align="center">
  606. <template slot-scope="scope">
  607. <span>{{ scope.row.cowneed }}</span>
  608. </template>
  609. </el-table-column>
  610. <el-table-column label="泌乳天数" min-width="130px" align="center">
  611. <template slot-scope="scope">
  612. <span>{{ scope.row.avgdim }}</span>
  613. </template>
  614. </el-table-column>
  615. <el-table-column label="标准分数" min-width="130px" align="center">
  616. <template slot-scope="scope">
  617. <span>{{ scope.row.cowneed }}</span>
  618. </template>
  619. </el-table-column>
  620. <el-table-column label="1分(数量、百分比)" min-width="130px" align="center">
  621. <template slot-scope="scope">
  622. <span>{{ scope.row.score1 }}</span>
  623. </template>
  624. </el-table-column>
  625. <el-table-column label="2分(数量、百分比)" min-width="130px" align="center">
  626. <template slot-scope="scope">
  627. <span>{{ scope.row.score2 }}</span>
  628. </template>
  629. </el-table-column>
  630. <el-table-column label="3分(数量、百分比)" min-width="130px" align="center">
  631. <template slot-scope="scope">
  632. <span>{{ scope.row.score3 }}</span>
  633. </template>
  634. </el-table-column>
  635. <el-table-column label="4分(数量、百分比)" min-width="130px" align="center">
  636. <template slot-scope="scope">
  637. <span>{{ scope.row.score4 }}</span>
  638. </template>
  639. </el-table-column>
  640. <el-table-column label="5分(数量、百分比)" min-width="130px" align="center">
  641. <template slot-scope="scope">
  642. <span>{{ scope.row.score5 }}</span>
  643. </template>
  644. </el-table-column>
  645. </el-table>
  646. </div>
  647. </el-col>
  648. </el-row>
  649. </el-tab-pane>
  650. </el-tabs>
  651. <div slot="footer" class="dialog-footer" style="bottom: 0;">
  652. <el-button class="cancelClose" @click="nutritional.dialogFormVisible = false; ">关闭</el-button>
  653. </div>
  654. </div>
  655. </el-dialog>
  656. <!-- 干物质调节 -->
  657. <DryMatterRegulation ref="mychild" :show.sync="isShowDialog" @getIsDisplay="getIsDisplay" />
  658. </div>
  659. </template>
  660. <script>
  661. import { GetDataByName, GETNurJudge, GetDataByNames, compareSort, ExecDataByConfig, failproccess, PostDataByName, formatNum } from '@/api/common'
  662. import Pagination from '@/components/Pagination'
  663. import Pagination2 from '@/components/Pagination2'
  664. import { parseTime, json2excel, handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  665. import { MessageBox } from 'element-ui'
  666. import Cookies from 'js-cookie'
  667. import { getToken } from '@/utils/auth'
  668. import DryMatterRegulation from './dryMatterRegulation.vue'
  669. export default {
  670. inject: ['reload'],
  671. name: 'DhedFormula',
  672. components: { Pagination, Pagination2, DryMatterRegulation },
  673. data() {
  674. return {
  675. pickerMinDate: '',
  676. pickerOptions: {
  677. onPick: ({ maxDate, minDate }) => {
  678. this.pickerMinDate = minDate.getTime()
  679. if (maxDate) {
  680. this.pickerMinDate = ''
  681. }
  682. },
  683. // 限制不能选择今天之后的日期
  684. disabledDate: (time) => {
  685. if (this.pickerMinDate !== '') {
  686. const one = 31 * 24 * 3600 * 1000
  687. const minTime = this.pickerMinDate - one
  688. let maxTime = this.pickerMinDate + one
  689. if (maxTime > new Date()) {
  690. maxTime = new Date()
  691. }
  692. return time.getTime() < minTime - 8.64e7 || time.getTime() > maxTime - 8.64e7
  693. }
  694. return time.getTime() > Date.now() - 8.64e7
  695. }
  696. },
  697. requestParams: [
  698. { name: 'getFTSWList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  699. { name: 'getFTBLList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  700. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  701. ],
  702. recipeTemplateList: [], // 配方模板
  703. feedingFormulaList: [], // 补料配方
  704. livestockTypeList: [], // 类别
  705. rules: {
  706. cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  707. },
  708. table: {
  709. getdataListParm: {
  710. name: 'getFPList',
  711. page: 1,
  712. offset: 1,
  713. pagecount: 10,
  714. returntype: 'Map',
  715. parammaps: {
  716. pastureid: Cookies.get('pastureid'),
  717. enable: ''
  718. }
  719. },
  720. tableKey: 0,
  721. list: [],
  722. total: 0,
  723. listLoading: true,
  724. temp: {},
  725. rwList: [],
  726. isPtsfname: false, // 补料配方/补料重量
  727. getdataListParm2: {
  728. name: 'getSysoptEnable',
  729. page: 1,
  730. offset: 1,
  731. pagecount: 1,
  732. returntype: 'Map',
  733. parammaps: {
  734. pastureid: Cookies.get('pastureid'),
  735. inforname: 'isEnableSupplyFeed'
  736. }
  737. },
  738. isRW1: false, // 第一班
  739. isRW2: false, // 第二班
  740. isRW3: false, // 第三班
  741. isRW4: false, // 第四班
  742. getdataListParm3: {
  743. name: 'getSysoptEnable1',
  744. page: 1,
  745. offset: 1,
  746. pagecount: 1,
  747. returntype: 'Map',
  748. parammaps: {
  749. pastureid: Cookies.get('pastureid'),
  750. inforname: 'times'
  751. }
  752. },
  753. RWLength: '' // 班次长度
  754. },
  755. selectList: [],
  756. // 营养评估
  757. nutritional: {
  758. dialogFormVisible: false,
  759. dialogStatus: '',
  760. activeName: 'first ',
  761. tab1: {
  762. inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  763. listLoading1: true,
  764. getdataListParm1: {
  765. name: 'getnurj',
  766. page: 1,
  767. offset: 1,
  768. pagecount: 10,
  769. returntype: 'Map',
  770. parammaps: {
  771. pastureid: '',
  772. barid: ''
  773. }
  774. },
  775. disabledCowclass: false,
  776. temp: {},
  777. tableKey: 0,
  778. list: [],
  779. total: 0,
  780. listLoading2: true,
  781. getdataListParm2: {
  782. name: 'GETNurJudge',
  783. page: 1,
  784. offset: 1,
  785. pagecount: 10,
  786. returntype: 'Map',
  787. parammaps: {
  788. pastureid: '',
  789. cowclassid: ''
  790. }
  791. }
  792. },
  793. tab2: {
  794. inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  795. listLoading1: true,
  796. tableKey1: 0,
  797. list1: [],
  798. total1: 0,
  799. getdataListParm1: {
  800. name: 'getPennsieveList',
  801. page: 1,
  802. offset: 1,
  803. pagecount: 10,
  804. returntype: 'Map',
  805. parammaps: {
  806. pastureid: '',
  807. barid: '',
  808. startTime: '',
  809. stopTime: '',
  810. inputDatetime: ''
  811. }
  812. },
  813. listLoading2: true,
  814. tableKey2: 0,
  815. list2: [],
  816. total2: 0,
  817. getdataListParm2: {
  818. name: 'getDungsieveList',
  819. page: 1,
  820. offset: 1,
  821. pagecount: 10,
  822. returntype: 'Map',
  823. parammaps: {
  824. pastureid: '',
  825. barid: '',
  826. startTime: '',
  827. stopTime: '',
  828. inputDatetime: ''
  829. }
  830. },
  831. listLoading3: true,
  832. tableKey3: 0,
  833. list3: [],
  834. total3: 0,
  835. getdataListParm3: {
  836. name: 'getBodyscoreList',
  837. page: 1,
  838. offset: 1,
  839. pagecount: 10,
  840. returntype: 'Map',
  841. parammaps: {
  842. pastureid: '',
  843. barid: '',
  844. startTime: '',
  845. stopTime: '',
  846. inputDatetime: ''
  847. }
  848. },
  849. listLoading4: true,
  850. tableKey4: 0,
  851. list4: [],
  852. total4: 0,
  853. getdataListParm4: {
  854. name: 'getDungscoreList',
  855. page: 1,
  856. offset: 1,
  857. pagecount: 10,
  858. returntype: 'Map',
  859. parammaps: {
  860. pastureid: '',
  861. barid: '',
  862. startTime: '',
  863. stopTime: '',
  864. inputDatetime: ''
  865. }
  866. }
  867. }
  868. },
  869. history: {
  870. dialogFormVisible: false,
  871. dialogStatus: '',
  872. temp: {},
  873. rules: {},
  874. tableKey: 0,
  875. list: [],
  876. total: 0,
  877. listLoading: true,
  878. getdataListParm: {
  879. name: 'getPlanModifyFPlist',
  880. page: 1,
  881. offset: 1,
  882. pagecount: 12,
  883. returntype: 'Map',
  884. parammaps: {
  885. pastureid: Cookies.get('pastureid'),
  886. date: ''
  887. }
  888. },
  889. isPtsfname: false, // 补料配方/补料重量
  890. getdataListParm2: {
  891. name: 'getSysoptEnable',
  892. page: 1,
  893. offset: 1,
  894. pagecount: 1,
  895. returntype: 'Map',
  896. parammaps: {
  897. pastureid: Cookies.get('pastureid'),
  898. inforname: 'isEnableSupplyFeed'
  899. }
  900. },
  901. isRW1: false, // 第一班
  902. isRW2: false, // 第二班
  903. isRW3: false, // 第三班
  904. isRW4: false, // 第四班
  905. getdataListParm3: {
  906. name: 'getSysoptEnable1',
  907. page: 1,
  908. offset: 1,
  909. pagecount: 1,
  910. returntype: 'Map',
  911. parammaps: {
  912. pastureid: Cookies.get('pastureid'),
  913. inforname: 'times'
  914. }
  915. },
  916. getdataDateParm: {
  917. name: 'getFPMaxDate',
  918. page: 1,
  919. offset: 1,
  920. pagecount: 10,
  921. returntype: 'Map',
  922. parammaps: {
  923. pastureid: Cookies.get('pastureid')
  924. }
  925. }
  926. },
  927. textMap: {
  928. Nutritional: '营养评估',
  929. history: '历史记录'
  930. },
  931. focusWRow: {}, // 一班重量得到焦点暂存
  932. focusWRow2: {}, // 2班重量得到焦点暂存
  933. focusWRow3: {}, // 3班重量得到焦点暂存
  934. focusWRow4: {}, // 4班重量得到焦点暂存
  935. requestParam: {},
  936. download: {
  937. getdataListParm: {
  938. name: 'getFPList',
  939. page: 1,
  940. offset: 1,
  941. pagecount: 0,
  942. returntype: 'Map',
  943. parammaps: {
  944. pastureid: Cookies.get('pastureid'),
  945. enable: ''
  946. }
  947. },
  948. list: []
  949. },
  950. spanObj: {},
  951. mergekeys: ['barname', 'sumweight'],
  952. isShowDialog: false,
  953. isokDisable: false,
  954. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  955. cellStyle: { padding: 0 + 'px' }
  956. }
  957. },
  958. computed: {
  959. // 设置请求头
  960. headers() {
  961. return {
  962. token: getToken()
  963. }
  964. },
  965. uploadData() {
  966. return {
  967. name: '颛孙洋洋-栏舍配方',
  968. importParams: '栏舍名称,实际牛头数,系数(%),系数头数,配方模板,补料配方,第一班比例(%),第二班比例(%),第三班比例(%)',
  969. requiredParams: '栏舍名称,实际牛头数,系数(%),系数头数,配方模板,补料配方,第一班比例(%),第二班比例(%),第三班比例(%)',
  970. dateParams: '实际牛头数',
  971. sheetname: 'SheetJS'
  972. }
  973. },
  974. // 设置上传地址
  975. uploadExcelUrl() {
  976. return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
  977. }
  978. },
  979. created() {
  980. this.getDownList()
  981. },
  982. methods: {
  983. getDownList() {
  984. GetDataByNames(this.requestParams).then(response => {
  985. this.recipeTemplateList = response.data.getFTSWList.list
  986. this.feedingFormulaList = response.data.getFTBLList.list
  987. this.livestockTypeList = response.data.getCowclassListEnable.list
  988. this.getIsDisplay()
  989. })
  990. },
  991. getIsDisplay() {
  992. GetDataByName(this.table.getdataListParm2).then(response => {
  993. console.log(response.data.list[0].inforvalue)
  994. if (response.data.list !== null) {
  995. if (response.data.list[0].inforvalue == 0) {
  996. this.table.isPtsfname = false
  997. } else {
  998. this.table.isPtsfname = true
  999. }
  1000. }
  1001. })
  1002. GetDataByName(this.table.getdataListParm3).then(response => {
  1003. console.log(response.data.list[0].inforvalue)
  1004. if (response.data.list !== null) {
  1005. this.table.RWLength = response.data.list[0].inforvalue
  1006. if (response.data.list[0].inforvalue == 1) {
  1007. this.table.isRW1 = true
  1008. this.table.isRW2 = false
  1009. this.table.isRW3 = false
  1010. this.table.isRW4 = false
  1011. } else if (response.data.list[0].inforvalue == 2) {
  1012. this.table.isRW1 = true
  1013. this.table.isRW2 = true
  1014. this.table.isRW3 = false
  1015. this.table.isRW4 = false
  1016. } else if (response.data.list[0].inforvalue == 3) {
  1017. this.table.isRW1 = true
  1018. this.table.isRW2 = true
  1019. this.table.isRW3 = true
  1020. this.table.isRW4 = false
  1021. } else if (response.data.list[0].inforvalue == 4) {
  1022. this.table.isRW1 = true
  1023. this.table.isRW2 = true
  1024. this.table.isRW3 = true
  1025. this.table.isRW4 = true
  1026. }
  1027. } else {
  1028. this.table.isRW1 = false
  1029. this.table.isRW2 = false
  1030. this.table.isRW3 = false
  1031. this.table.isRW4 = false
  1032. }
  1033. })
  1034. this.getList()
  1035. },
  1036. getList() {
  1037. this.table.listLoading = true
  1038. GetDataByName(this.table.getdataListParm).then(response => {
  1039. console.log('table数据', response.data.list)
  1040. if (response.data.list !== null) {
  1041. for (let i = 0; i < response.data.list.length; i++) {
  1042. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1043. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1044. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1045. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1046. if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
  1047. if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
  1048. this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
  1049. } else {
  1050. this.$set(response.data.list[i], 'dryweight', '')
  1051. }
  1052. }
  1053. if (response.data.list[i].ftid == undefined || response.data.list[i].ftname == '') {
  1054. this.$set(response.data.list[i], 'ftid', '')
  1055. this.$set(response.data.list[i], 'ftname', '')
  1056. }
  1057. if (response.data.list[i].ptsfid == undefined || response.data.list[i].ptsfname == '') {
  1058. this.$set(response.data.list[i], 'ptsfid', '')
  1059. this.$set(response.data.list[i], 'ptsfname', '')
  1060. }
  1061. if (response.data.list[i].ccount == undefined) {
  1062. this.$set(response.data.list[i], 'ccount', '')
  1063. }
  1064. if (response.data.list[i].softccount == undefined) {
  1065. this.$set(response.data.list[i], 'softccount', '')
  1066. }
  1067. if (response.data.list[i].ratio == undefined) {
  1068. this.$set(response.data.list[i], 'ratio', 100)
  1069. }
  1070. if (response.data.list[i].ccountratio == undefined) {
  1071. this.$set(response.data.list[i], 'ccountratio', '')
  1072. }
  1073. if (response.data.list[i].r1 == undefined) {
  1074. this.$set(response.data.list[i], 'r1', '')
  1075. }
  1076. if (response.data.list[i].r2 == undefined) {
  1077. this.$set(response.data.list[i], 'r2', '')
  1078. }
  1079. if (response.data.list[i].r3 == undefined) {
  1080. this.$set(response.data.list[i], 'r3', '')
  1081. }
  1082. if (response.data.list[i].r4 == undefined) {
  1083. this.$set(response.data.list[i], 'r4', '')
  1084. }
  1085. if (response.data.list[i].w1 == undefined) {
  1086. this.$set(response.data.list[i], 'w1', '')
  1087. }
  1088. if (response.data.list[i].w2 == undefined) {
  1089. this.$set(response.data.list[i], 'w2', '')
  1090. }
  1091. if (response.data.list[i].w3 == undefined) {
  1092. this.$set(response.data.list[i], 'w3', '')
  1093. }
  1094. if (response.data.list[i].w4 == undefined) {
  1095. this.$set(response.data.list[i], 'w4', '')
  1096. }
  1097. if (response.data.list[i].supplyweight == undefined) {
  1098. this.$set(response.data.list[i], 'supplyweight', '')
  1099. }
  1100. if (response.data.list[i].feedweight == undefined) {
  1101. this.$set(response.data.list[i], 'feedweight', '')
  1102. }
  1103. this.$set(response.data.list[i], 'dailyWeight', '')
  1104. if (response.data.list[i].Bfweight == undefined) {
  1105. this.$set(response.data.list[i], 'Bfweight', '')
  1106. }
  1107. if (response.data.list[i].Sfweight == undefined) {
  1108. this.$set(response.data.list[i], 'Sfweight', '')
  1109. }
  1110. if (response.data.list[i].isOneWeight == undefined) {
  1111. this.$set(response.data.list[i], 'isOneWeight', false)
  1112. }
  1113. if (response.data.list[i].isTwoWeight == undefined) {
  1114. this.$set(response.data.list[i], 'isTwoWeight', false)
  1115. }
  1116. if (response.data.list[i].isThreeWeight == undefined) {
  1117. this.$set(response.data.list[i], 'isThreeWeight', false)
  1118. }
  1119. if (response.data.list[i].isFourWeight == undefined) {
  1120. this.$set(response.data.list[i], 'isFourWeight', false)
  1121. }
  1122. if (response.data.list[i].timesopt !== undefined) {
  1123. var timesoptArr = response.data.list[i].timesopt.split(',')
  1124. for (let j = 0; j < timesoptArr.length; j++) {
  1125. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  1126. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  1127. }
  1128. }
  1129. }
  1130. // console.log(response.data.list, sumr)
  1131. for (let i = 0; i < response.data.list.length; i++) {
  1132. if (response.data.list[i].r1 == '') {
  1133. response.data.list[i].r1 = 0
  1134. response.data.list[i].w1 = 0
  1135. }
  1136. if (response.data.list[i].r2 == '') {
  1137. response.data.list[i].r2 = 0
  1138. response.data.list[i].w2 = 0
  1139. }
  1140. if (response.data.list[i].r3 == '') {
  1141. response.data.list[i].r3 = 0
  1142. response.data.list[i].w3 = 0
  1143. }
  1144. if (response.data.list[i].r4 == '') {
  1145. response.data.list[i].r4 = 0
  1146. response.data.list[i].w4 = 0
  1147. }
  1148. 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))
  1149. response.data.list[i].sumr = formatNum(response.data.list[i].sumr, 2)
  1150. // this.$set(response.data.list[i],'feedweight',formatNum(parseFloat(response.data.list[i].feedweight) * parseFloat(response.data.list[i].sumr)/100,2))
  1151. this.$set(response.data.list[i], 'dailyWeight', parseFloat(response.data.list[i].w1) + parseFloat(response.data.list[i].w2) + parseFloat(response.data.list[i].w3) + parseFloat(response.data.list[i].w4))
  1152. response.data.list[i].dailyWeight = formatNum(response.data.list[i].dailyWeight, 2)
  1153. }
  1154. this.table.list = response.data.list
  1155. console.log(this.table.list, 'this.table.list')
  1156. this.table.pageNum = response.data.pageNum
  1157. this.table.pageSize = response.data.pageSize
  1158. this.table.total = response.data.total
  1159. } else {
  1160. this.table.list = []
  1161. }
  1162. setTimeout(() => {
  1163. this.table.listLoading = false
  1164. }, 100)
  1165. })
  1166. },
  1167. renderHeader(h, { column, $index }) { // h即为cerateElement的简写,具体可看vue官方文档
  1168. // console.log(column)
  1169. return h(
  1170. 'div',
  1171. [
  1172. h('span', column.label),
  1173. h('i', {
  1174. class: 'el-icon-unlock',
  1175. ref: 'el-icon-unlock',
  1176. style: 'margin-left:5px;'
  1177. })
  1178. ]
  1179. )
  1180. },
  1181. headerClick(column, event) {
  1182. console.log(column, event)
  1183. if (column.label == '第一班重量') {
  1184. for (let i = 0; i < this.table.list.length; i++) {
  1185. if (this.table.list[i].Edit == true) {
  1186. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1187. event.target.className = 'el-icon-lock'
  1188. this.$set(this.table.list[i], 'isOneWeight', true) // 锁住不可编辑
  1189. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1190. event.target.className = 'el-icon-unlock'
  1191. this.$set(this.table.list[i], 'isOneWeight', false) // 解锁可编辑
  1192. }
  1193. }
  1194. }
  1195. } else if (column.label == '第二班重量') {
  1196. for (let i = 0; i < this.table.list.length; i++) {
  1197. if (this.table.list[i].Edit == true) {
  1198. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1199. event.target.className = 'el-icon-lock'
  1200. this.$set(this.table.list[i], 'isTwoWeight', true) // 锁住不可编辑
  1201. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1202. event.target.className = 'el-icon-unlock'
  1203. this.$set(this.table.list[i], 'isTwoWeight', false) // 解锁可编辑
  1204. }
  1205. }
  1206. }
  1207. } else if (column.label == '第三班重量') {
  1208. for (let i = 0; i < this.table.list.length; i++) {
  1209. if (this.table.list[i].Edit == true) {
  1210. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1211. event.target.className = 'el-icon-lock'
  1212. this.$set(this.table.list[i], 'isThreeWeight', true) // 锁住不可编辑
  1213. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1214. event.target.className = 'el-icon-unlock'
  1215. this.$set(this.table.list[i], 'isThreeWeight', false) // 解锁可编辑
  1216. }
  1217. }
  1218. }
  1219. } else if (column.label == '第四班重量') {
  1220. for (let i = 0; i < this.table.list.length; i++) {
  1221. if (this.table.list[i].Edit == true) {
  1222. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1223. event.target.className = 'el-icon-lock'
  1224. this.$set(this.table.list[i], 'isFourWeight', true) // 锁住不可编辑
  1225. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1226. event.target.className = 'el-icon-unlock'
  1227. this.$set(this.table.list[i], 'isFourWeight', false) // 解锁可编辑
  1228. }
  1229. }
  1230. }
  1231. }
  1232. },
  1233. // 配方模板
  1234. changeRecipeTemplate(item, row) {
  1235. console.log(row.supplyweight, 'row.supplyweight')
  1236. row.ftname = this.recipeTemplateList.find(obj => obj.id == item).tname
  1237. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == item).Sfweight// Sfweight
  1238. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == item).SfweightLock// SfweightLock
  1239. row.dryweight = this.recipeTemplateList.find(obj => obj.id == item).dryweight// SfweightLock
  1240. // 补料重量supplyweight
  1241. // 配方重量ftweight
  1242. // 系数头数ccountratio
  1243. // 投喂量feedweight
  1244. // 实际牛头数ccount
  1245. // 投喂量 = 配方重量 + 补料重量
  1246. // 配方重量 = Sfweight * 系数头数 + SfweightLock * 实际牛头数ccount
  1247. console.log(row.Sfweight, 'row.Sfweight')
  1248. console.log(row.ccountratio, '系数头数')
  1249. console.log(row.SfweightLock, 'SfweightLock')
  1250. console.log(row.ccount, '实际牛头数')
  1251. if (row.Sfweight !== '' && row.ccount !== '') {
  1252. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2))
  1253. } else {
  1254. row.ftweight = ''
  1255. }
  1256. // console.log(row.ftweight, 'row.ftweight')
  1257. // console.log(row.supplyweight, 'row.supplyweight')
  1258. // console.log(this.table.isPtsfname, 'isPtsfname')
  1259. if (this.table.isPtsfname == false) {
  1260. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1261. } else {
  1262. if (row.supplyweight == 'NaN') {
  1263. row.supplyweight = 0
  1264. }
  1265. console.log(row.supplyweight)
  1266. if (row.supplyweight !== '' && row.ftweight !== '') {
  1267. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), 2)
  1268. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1269. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1270. } else if (row.supplyweight !== '' && row.ftweight !== '') {
  1271. row.feedweight = formatNum(parseFloat(row.supplyweight), 2)
  1272. }
  1273. if (row.ccountratio !== '' && row.ftweight !== '') {
  1274. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2)
  1275. }
  1276. if (row.Sfweight !== '' && row.ccount !== '') {
  1277. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2))
  1278. } else {
  1279. row.ftweight = ''
  1280. }
  1281. }
  1282. console.log(row.supplyweight)
  1283. if (row.supplyweight == 'NaN') { row.supplyweight = 0 }
  1284. if (row.r1 !== '') { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), 2)) }
  1285. if (row.r2 !== '') { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), 2)) }
  1286. if (row.r3 !== '') { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), 2)) }
  1287. if (row.r4 !== '') { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), 2)) }
  1288. if (row.w1 == '') { row.w1 = 0 }
  1289. if (row.w2 == '') { row.w2 = 0 }
  1290. if (row.w3 == '') { row.w3 = 0 }
  1291. if (row.w4 == '') { row.w4 = 0 }
  1292. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1293. row.dailyWeight = formatNum(row.dailyWeight, 2)
  1294. },
  1295. // 补料配方
  1296. changeFeedingFormula(item, row) {
  1297. console.log(item, '=========')
  1298. // 补料重量supplyweight
  1299. // 配方重量ftweight
  1300. // 系数头数ccountratio
  1301. // 投喂量feedweight
  1302. // 实际牛头数ccount
  1303. // 投喂量 = 配方重量 + 补料重量
  1304. if (item !== '') {
  1305. console.log(456)
  1306. row.ptsfname = this.feedingFormulaList.find(obj => obj.id == item).tname
  1307. row.BLweight = this.feedingFormulaList.find(obj => obj.id == item).Sfweight
  1308. row.BLSfweightLock = this.feedingFormulaList.find(obj => obj.id == item).SfweightLock
  1309. } else {
  1310. row.ptsfname = ''
  1311. row.BLweight = 0
  1312. row.BLSfweightLock = 0
  1313. }
  1314. // 配方重量 = 系数头数 * Sfweight
  1315. // if (row.ccountratio !== '' && row.ftweight !== '') {
  1316. // row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1317. // }
  1318. // 补料重量 = 系数头数 * BLweight
  1319. // console.log(row.ccountratio)
  1320. // console.log(row.ccount)
  1321. // console.log(row.BLweight)
  1322. // console.log(row.BLSfweightLock)
  1323. if (row.ccountratio !== '' && row.ccount !== '' && row.ccount.BLweight !== '' && row.BLSfweightLock !== '') {
  1324. this.$set(row, 'supplyweight', formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLSfweightLock) * parseFloat(row.ccount), 2))
  1325. } else {
  1326. row.supplyweight = ''
  1327. }
  1328. if (this.table.isPtsfname == false) {
  1329. row.feedweight = parseFloat(row.ftweight)
  1330. } else {
  1331. if (row.supplyweight !== '' && row.ftweight !== '') {
  1332. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), 2)
  1333. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1334. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1335. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1336. row.feedweight = formatNum(parseFloat(row.supplyweight), 2)
  1337. }
  1338. // if (row.ccountratio !== '' && row.ftweight !== '') {
  1339. // row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1340. // }
  1341. // if (row.ccountratio !== '' && row.BLweight !== '') {
  1342. // row.supplyweight = parseFloat(row.BLweight) * parseFloat(row.ccountratio)
  1343. // }
  1344. }
  1345. if (row.r1 !== '') { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), 2)) }
  1346. if (row.r2 !== '') { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), 2)) }
  1347. if (row.r3 !== '') { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), 2)) }
  1348. if (row.r4 !== '') { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), 2)) }
  1349. if (row.w1 == '') { row.w1 = 0 }
  1350. if (row.w2 == '') { row.w2 = 0 }
  1351. if (row.w3 == '') { row.w3 = 0 }
  1352. if (row.w4 == '') { row.w4 = 0 }
  1353. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1354. row.dailyWeight = formatNum(row.dailyWeight, 2)
  1355. },
  1356. // 实际牛头数失去焦点计算
  1357. // ccount实际牛头数
  1358. // ratio系数
  1359. // ccountratio系数牛头数
  1360. blurCcount(row) { // 实际牛头数
  1361. console.log(row)
  1362. if (row.ftid !== '-1' && row.ftid !== '') {
  1363. console.log(this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight)
  1364. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1365. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1366. }
  1367. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  1368. // row.ptsfid = parseInt(row.ptsfid)
  1369. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), 2)
  1370. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), 2)
  1371. }
  1372. if (row.ptsfid == '') {
  1373. row.BLweight = 0
  1374. row.BLweightLock = 0
  1375. }
  1376. if (row.Sfweight !== '' && row.ccount !== '') {
  1377. // console.log(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount))
  1378. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2)
  1379. }
  1380. // 系数牛头数 = 实际牛头数 * 系数/100
  1381. if (row.ccount !== '' && row.ratio !== '') {
  1382. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, 2)
  1383. } else if (row.ratio !== '' && row.ccountratio !== '') {
  1384. row.ccount = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100, 2)
  1385. } else if (row.ccount !== '' || row.ratio !== '') {
  1386. row.ccountratio = ''
  1387. }
  1388. // 补料重量
  1389. console.log(row.ccountratio, row.BLweight)
  1390. if (row.BLweight == 'undefined') {
  1391. this.$set(row, 'BLweight', '')
  1392. }
  1393. console.log('BLweight', row.BLweight)
  1394. console.log('ccountratio', row.ccountratio)
  1395. console.log('BLweightLock', row.BLweightLock)
  1396. console.log('ccount', row.ccount)
  1397. if (row.ccountratio !== '' && row.BLweight !== '') {
  1398. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), 2)
  1399. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1400. row.supplyweight = ''
  1401. row.feedweight = ''
  1402. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1403. row.supplyweight = ''
  1404. row.feedweight = ''
  1405. }
  1406. // 配方重量
  1407. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1408. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2)
  1409. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1410. row.ftweight = ''
  1411. row.feedweight = ''
  1412. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1413. row.ftweight = ''
  1414. row.feedweight = ''
  1415. }
  1416. if (this.table.isPtsfname == false) {
  1417. row.feedweight = parseFloat(row.ftweight)
  1418. } else {
  1419. if (row.supplyweight !== '' && row.ftweight !== '') {
  1420. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), 2)
  1421. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1422. row.feedweight = formatNum(parseFloat(row.supplyweight), 2)
  1423. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1424. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1425. }
  1426. // 配方重量 = 系数头数 * Sfweight
  1427. if (row.ccountratio !== '' && row.ftweight !== '') {
  1428. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2)
  1429. }
  1430. // 补料重量 = 系数头数 * BLweight
  1431. if (row.ccountratio !== '' && row.BLweight !== '') {
  1432. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), 2)
  1433. }
  1434. }
  1435. console.log(row)
  1436. if (row.r1 !== '' && row.isOneWeight == false) { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), 2)) }
  1437. if (row.r2 !== '' && row.isTwoWeight == false) { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), 2)) }
  1438. if (row.r3 !== '' && row.isThreeWeight == false) { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), 2)) }
  1439. if (row.r4 !== '' && row.isFourWeight == false) { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), 2)) }
  1440. if (row.w1 == '') { row.w1 = 0 }
  1441. if (row.w2 == '') { row.w2 = 0 }
  1442. if (row.w3 == '') { row.w3 = 0 }
  1443. if (row.w4 == '') { row.w4 = 0 }
  1444. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1445. row.dailyWeight = formatNum(row.dailyWeight, 2)
  1446. },
  1447. blurRatio(row) {
  1448. console.log(row, '--------------')
  1449. if (row.ftid !== '-1' && row.ftid !== '') {
  1450. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1451. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1452. }
  1453. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  1454. // row.ptsfid = parseInt(row.ptsfid)
  1455. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), 2)
  1456. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), 2)
  1457. }
  1458. if (row.ptsfid == '') {
  1459. row.BLweight = 0
  1460. row.BLweightLock = 0
  1461. }
  1462. // 系数
  1463. if (row.ccount !== '' && row.ratio !== '' && row.ccountratio !== '') {
  1464. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, 2)
  1465. } else if (row.ccount !== '' && row.ccountratio !== '') {
  1466. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), 2)
  1467. } else if (row.ccount !== '' || row.ccountratio !== '') {
  1468. row.ratio = ''
  1469. }
  1470. // 补料重量
  1471. if (row.ccountratio !== '' && row.BLweight !== '') {
  1472. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), 2)
  1473. } else if (row.ccountratio !== '' && row.BLweight == '' || row.ccountratio == '' && row.BLweight !== '') {
  1474. row.supplyweight = ''
  1475. row.feedweight = ''
  1476. }
  1477. // 配方重量
  1478. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1479. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2)
  1480. } else if (row.ccountratio !== '' && row.Sfweight == '' || row.ccountratio == '' && row.Sfweight !== '') {
  1481. row.ftweight = ''
  1482. row.feedweight = ''
  1483. }
  1484. // 投喂量
  1485. if (row.supplyweight !== '' && row.ftweight !== '') {
  1486. row.feedweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), 2)
  1487. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1488. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1489. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1490. row.feedweight = formatNum(parseFloat(row.supplyweight), 2)
  1491. }
  1492. console.log(row.supplyweight, '补料重量')
  1493. console.log(row.ftweight, '配方重量')
  1494. if (this.table.isPtsfname == false) {
  1495. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1496. } else {
  1497. // 投喂量
  1498. if (row.supplyweight !== '' && row.ftweight !== '') {
  1499. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), 2)
  1500. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1501. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1502. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1503. row.feedweight = formatNum(parseFloat(row.supplyweight), 2)
  1504. }
  1505. // 补料重量
  1506. if (row.ccountratio !== '' && row.BLweight !== '') {
  1507. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), 2)
  1508. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1509. row.supplyweight = ''
  1510. row.feedweight = ''
  1511. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1512. row.supplyweight = ''
  1513. row.feedweight = ''
  1514. }
  1515. // 配方重量
  1516. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1517. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2)
  1518. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1519. row.ftweight = ''
  1520. row.feedweight = ''
  1521. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1522. row.ftweight = ''
  1523. row.feedweight = ''
  1524. }
  1525. }
  1526. if (row.r1 !== '' && row.isOneWeight == false) { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), 2)) }
  1527. if (row.r2 !== '' && row.isTwoWeight == false) { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), 2)) }
  1528. if (row.r3 !== '' && row.isThreeWeight == false) { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), 2)) }
  1529. if (row.r4 !== '' && row.isFourWeight == false) { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), 2)) }
  1530. if (row.w1 == '') { row.w1 = 0 }
  1531. if (row.w2 == '') { row.w2 = 0 }
  1532. if (row.w3 == '') { row.w3 = 0 }
  1533. if (row.w4 == '') { row.w4 = 0 }
  1534. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1535. row.dailyWeight = formatNum(row.dailyWeight, 2)
  1536. },
  1537. blurCcountratio(row) {
  1538. if (row.ftid !== '-1' && row.ftid !== '') {
  1539. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1540. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1541. }
  1542. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  1543. // row.ptsfid = parseInt(row.ptsfid)
  1544. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), 2)
  1545. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), 2)
  1546. }
  1547. if (row.ptsfid == '') {
  1548. row.BLweight = 0
  1549. row.BLweightLock = 0
  1550. }
  1551. if (row.ptsfid == '') {
  1552. row.BLweight = 0
  1553. row.BLweightLock = 0
  1554. }
  1555. // 系数头数
  1556. if (row.ccountratio !== '' && row.ccount !== '' && row.ratio !== '') {
  1557. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), 2)
  1558. } else if (row.ccount !== '' && row.ratio !== '') {
  1559. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, 2)
  1560. } else if (row.ccountratio !== '' && row.ccount !== '') {
  1561. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), 2)
  1562. } else if (row.ccountratio !== '' && row.ratio !== '') {
  1563. row.ccount = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100, 2)
  1564. }
  1565. // 补料重量
  1566. if (row.ccountratio !== '' && row.BLweight !== '') {
  1567. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), 2)
  1568. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1569. row.supplyweight = ''
  1570. row.feedweight = ''
  1571. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1572. row.supplyweight = ''
  1573. row.feedweight = ''
  1574. }
  1575. // 配方重量
  1576. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1577. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2)
  1578. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1579. row.ftweight = ''
  1580. row.feedweight = ''
  1581. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1582. row.ftweight = ''
  1583. row.feedweight = ''
  1584. }
  1585. // 投喂量
  1586. if (row.supplyweight !== '' && row.ftweight !== '') {
  1587. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), 2)
  1588. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1589. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1590. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1591. row.feedweight = formatNum(parseFloat(row.supplyweight), 2)
  1592. }
  1593. if (this.table.isPtsfname == false) {
  1594. console.log(row)
  1595. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1596. } else {
  1597. // 投喂量
  1598. if (row.supplyweight !== '' && row.ftweight !== '') {
  1599. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), 2)
  1600. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1601. row.feedweight = formatNum(parseFloat(row.ftweight), 2)
  1602. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1603. row.feedweight = formatNum(parseFloat(row.supplyweight), 2)
  1604. }
  1605. // 补料重量
  1606. if (row.ccountratio !== '' && row.BLweight !== '') {
  1607. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), 2)
  1608. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1609. row.supplyweight = ''
  1610. row.feedweight = ''
  1611. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1612. row.supplyweight = ''
  1613. row.feedweight = ''
  1614. }
  1615. // 配方重量
  1616. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1617. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), 2)
  1618. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1619. row.ftweight = ''
  1620. row.feedweight = ''
  1621. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1622. row.ftweight = ''
  1623. row.feedweight = ''
  1624. }
  1625. }
  1626. if (row.r1 !== '' && row.isOneWeight == false) { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), 2)) }
  1627. if (row.r2 !== '' && row.isTwoWeight == false) { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), 2)) }
  1628. if (row.r3 !== '' && row.isThreeWeight == false) { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), 2)) }
  1629. if (row.r4 !== '' && row.isFourWeight == false) { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), 2)) }
  1630. if (row.w1 == '') { row.w1 = 0 }
  1631. if (row.w2 == '') { row.w2 = 0 }
  1632. if (row.w3 == '') { row.w3 = 0 }
  1633. if (row.w4 == '') { row.w4 = 0 }
  1634. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1635. row.dailyWeight = formatNum(row.dailyWeight, 2)
  1636. },
  1637. // 总比例
  1638. blurR(row) {
  1639. if (row.r1 == '') { row.r1 = 0 }
  1640. if (row.r2 == '') { row.r2 = 0 }
  1641. if (row.r3 == '') { row.r3 = 0 }
  1642. if (row.r4 == '') { row.r4 = 0 }
  1643. if (row.r1 !== '') {
  1644. row.w1 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r1) / 100, 2)
  1645. }
  1646. if (row.r2 !== '') {
  1647. row.w2 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r2) / 100, 2)
  1648. }
  1649. if (row.r3 !== '') {
  1650. row.w3 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r3) / 100, 2)
  1651. }
  1652. if (row.r4 !== '') {
  1653. row.w4 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r4) / 100, 2)
  1654. }
  1655. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1656. if (row.w1 == '') { row.w1 = 0 }
  1657. if (row.w2 == '') { row.w2 = 0 }
  1658. if (row.w3 == '') { row.w3 = 0 }
  1659. if (row.w4 == '') { row.w4 = 0 }
  1660. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1661. row.dailyWeight = formatNum(row.dailyWeight, 2)
  1662. },
  1663. // 一班重量得到焦点
  1664. focusW(row) {
  1665. console.log(row, '====')
  1666. this.focusWRow = Object.assign({}, row)
  1667. },
  1668. // 1班重量得到焦点
  1669. focusW2(row) {
  1670. this.focusWRow2 = Object.assign({}, row)
  1671. },
  1672. // 3班重量得到焦点
  1673. focusW3(row) {
  1674. this.focusWRow3 = Object.assign({}, row)
  1675. },
  1676. // 4班重量得到焦点
  1677. focusW4(row) {
  1678. this.focusWRow4 = Object.assign({}, row)
  1679. },
  1680. // 一班重量
  1681. blurW(row) {
  1682. if (row.w1 == '') {
  1683. row.w1 = 0
  1684. }
  1685. if (row.w2 == '') {
  1686. row.w2 = 0
  1687. }
  1688. if (row.w3 == '') {
  1689. row.w3 = 0
  1690. }
  1691. if (row.w4 == '') {
  1692. row.w4 = 0
  1693. }
  1694. if (row.r1 == '') {
  1695. row.r1 = 0
  1696. }
  1697. if (row.r2 == '') {
  1698. row.r2 = 0
  1699. }
  1700. if (row.r3 == '') {
  1701. row.r3 = 0
  1702. }
  1703. if (row.r4 == '') {
  1704. row.r4 = 0
  1705. }
  1706. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1707. console.log(row, '=======投喂量feedweight')
  1708. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1709. if (this.table.RWLength == 4) {
  1710. // 2班3班4班都锁定
  1711. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1712. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1713. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1714. }
  1715. // 2班3班锁定4班未锁定
  1716. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1717. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1718. row.w4 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  1719. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  1720. if (row.w4 <= 0) {
  1721. row.w4 = 0
  1722. row.r4 = 0
  1723. }
  1724. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1725. }
  1726. // 2班4班锁定3班未锁定
  1727. if (row.isTwoWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1728. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1729. row.w3 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), 2)
  1730. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1731. if (row.w3 <= 0) {
  1732. row.w3 = 0
  1733. row.r3 = 0
  1734. }
  1735. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1736. }
  1737. // 3班4班锁定2班未锁定
  1738. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1739. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1740. row.w2 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), 2)
  1741. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1742. if (row.w2 <= 0) {
  1743. row.w2 = 0
  1744. row.r2 = 0
  1745. }
  1746. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1747. }
  1748. // 2班锁定,3班4班未锁
  1749. if (row.isTwoWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1750. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1751. if (row.r3 !== 0 && row.r4 !== 0) {
  1752. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  1753. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100)
  1754. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), 2)
  1755. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100)
  1756. } else {
  1757. row.r3 = 0
  1758. row.w3 = 0
  1759. row.r4 = 0
  1760. row.r4 = 0
  1761. }
  1762. if (row.w3 <= 0) {
  1763. row.w3 = 0
  1764. row.r3 = 0
  1765. }
  1766. if (row.w4 <= 0) {
  1767. row.w4 = 0
  1768. row.r4 = 0
  1769. }
  1770. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1771. }
  1772. // 3班锁定,2班4班未锁
  1773. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1774. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1775. if (row.r2 !== 0 && row.r4 !== 0) {
  1776. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  1777. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1778. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), 2)
  1779. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  1780. } else {
  1781. row.w2 = 0
  1782. row.r2 = 0
  1783. row.w4 = 0
  1784. row.r4 = 0
  1785. }
  1786. if (row.w2 <= 0) {
  1787. row.w2 = 0
  1788. row.r2 = 0
  1789. }
  1790. if (row.w4 <= 0) {
  1791. row.w4 = 0
  1792. row.r4 = 0
  1793. }
  1794. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1795. }
  1796. // 4班锁定,2班3班未锁
  1797. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1798. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1799. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), 2)
  1800. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1801. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), 2)
  1802. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1803. if (row.w2 <= 0) {
  1804. row.w2 = 0
  1805. row.r2 = 0
  1806. }
  1807. if (row.w3 <= 0) {
  1808. row.w3 = 0
  1809. row.r3 = 0
  1810. }
  1811. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1812. }
  1813. // 2班3班4班未锁
  1814. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1815. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1816. if (row.r2 !== 0 && (row.r3 !== 0 || row.r4 !== 0)) {
  1817. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  1818. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1819. } else {
  1820. row.w2 = 0
  1821. row.r2 = 0
  1822. }
  1823. if (row.r3 !== 0 && (row.r2 !== 0 || row.r4 !== 0)) {
  1824. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  1825. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1826. } else {
  1827. row.w3 = 0
  1828. row.r3 = 0
  1829. }
  1830. if (row.r4 !== 0 && (row.r2 !== 0 || row.r3 !== 0)) {
  1831. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  1832. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  1833. } else {
  1834. row.w4 = 0
  1835. row.r4 = 0
  1836. }
  1837. if (row.w2 <= 0) {
  1838. row.w2 = 0
  1839. row.r2 = 0
  1840. }
  1841. if (row.w3 <= 0) {
  1842. row.w3 = 0
  1843. row.r3 = 0
  1844. }
  1845. if (row.w4 <= 0) {
  1846. row.w4 = 0
  1847. row.r4 = 0
  1848. }
  1849. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1850. }
  1851. } else if (this.table.RWLength == 3) {
  1852. // 三班
  1853. // 2班/3班锁定
  1854. if (row.isTwoWeight == true && row.isThreeWeight == true) {
  1855. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1856. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  1857. }
  1858. // 2班不锁3班锁
  1859. if (row.isTwoWeight == false && row.isThreeWeight == true) {
  1860. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1861. row.w2 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3), 2)
  1862. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1863. if (row.w2 <= 0) {
  1864. row.w2 = 0
  1865. row.r2 = 0
  1866. }
  1867. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  1868. }
  1869. // 3班不锁2班锁
  1870. if (row.isTwoWeight == true && row.isThreeWeight == false) {
  1871. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1872. row.w3 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2), 2)
  1873. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1874. if (row.w3 <= 0) {
  1875. row.w3 = 0
  1876. row.r3 = 0
  1877. }
  1878. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  1879. }
  1880. // 2班3班都不锁
  1881. if (row.isTwoWeight == false && row.isThreeWeight == false) {
  1882. console.log(row.w1, 'w1----------')
  1883. console.log(row.feedweight, 'feedweight----------')
  1884. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1885. if (row.r2 !== 0 && row.r3 !== 0) {
  1886. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), 2)
  1887. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1888. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), 2)
  1889. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1890. } else {
  1891. row.r2 = 0
  1892. row.w3 = 0
  1893. row.r3 = 0
  1894. row.r3 = 0
  1895. }
  1896. if (row.w3 <= 0) {
  1897. row.w3 = 0
  1898. row.r3 = 0
  1899. }
  1900. if (row.w2 <= 0) {
  1901. row.w2 = 0
  1902. row.r2 = 0
  1903. }
  1904. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  1905. }
  1906. } else if (this.table.RWLength == 2) {
  1907. // 两班isOneWeight,isTwoWeight
  1908. if (row.w1 == '') { row.w1 = 0 }
  1909. if (row.w2 == '') { row.w2 = 0 }
  1910. if (row.r1 == '') { row.r1 = 0 }
  1911. if (row.r2 == '') { row.r2 = 0 }
  1912. if (row.isTwoWeight == false) {
  1913. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1914. row.w2 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1), 2)
  1915. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1916. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1917. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), 2))
  1918. } else {
  1919. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1920. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), 2))
  1921. }
  1922. }
  1923. if (row.w1 == '') { row.w1 = 0 }
  1924. if (row.w2 == '') { row.w2 = 0 }
  1925. if (row.w3 == '') { row.w3 = 0 }
  1926. if (row.w4 == '') { row.w4 = 0 }
  1927. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1928. row.dailyWeight = formatNum(row.dailyWeight, 2)
  1929. },
  1930. blurW2(row) {
  1931. // 2班重量
  1932. if (row.w1 == '') {
  1933. row.w1 = 0
  1934. }
  1935. if (row.w2 == '') {
  1936. row.w2 = 0
  1937. }
  1938. if (row.w3 == '') {
  1939. row.w3 = 0
  1940. }
  1941. if (row.w4 == '') {
  1942. row.w4 = 0
  1943. }
  1944. if (row.r1 == '') {
  1945. row.r1 = 0
  1946. }
  1947. if (row.r2 == '') {
  1948. row.r2 = 0
  1949. }
  1950. if (row.r3 == '') {
  1951. row.r3 = 0
  1952. }
  1953. if (row.r4 == '') {
  1954. row.r4 = 0
  1955. }
  1956. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1957. console.log(row, '=======投喂量feedweight')
  1958. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1959. if (this.table.RWLength == 4) {
  1960. // 四班
  1961. // 1班3班4班都锁定
  1962. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1963. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1964. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1965. }
  1966. // 1班3班锁定4班未锁定
  1967. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1968. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1969. row.w4 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  1970. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  1971. if (row.w4 <= 0) {
  1972. row.w4 = 0
  1973. row.r4 = 0
  1974. }
  1975. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1976. }
  1977. // 1班4班锁定3班未锁定
  1978. if (row.isOneWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1979. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1980. row.w3 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), 2)
  1981. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1982. if (row.w3 <= 0) {
  1983. row.w3 = 0
  1984. row.r3 = 0
  1985. }
  1986. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1987. }
  1988. // 3班4班锁定1班未锁定
  1989. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1990. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1991. row.w1 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), 2)
  1992. row.r1 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1993. if (row.w1 <= 0) {
  1994. row.w1 = 0
  1995. row.r1 = 0
  1996. }
  1997. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1998. }
  1999. // 1班锁定,3班4班未锁
  2000. if (row.isOneWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  2001. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2002. if (row.r3 !== 0 && row.r4 !== 0) {
  2003. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  2004. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2005. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), 2)
  2006. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2007. } else {
  2008. row.w3 = 0
  2009. row.r3 = 0
  2010. row.w4 = 0
  2011. row.r4 = 0
  2012. }
  2013. if (row.w3 <= 0) {
  2014. row.w3 = 0
  2015. row.r3 = 0
  2016. }
  2017. if (row.w4 <= 0) {
  2018. row.w4 = 0
  2019. row.r4 = 0
  2020. }
  2021. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2022. }
  2023. // 3班锁定,1班4班未锁
  2024. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  2025. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2026. if (row.r1 !== 0 && row.r2 !== 0) {
  2027. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2)), 2)
  2028. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2029. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r2)), 2)
  2030. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2031. } else {
  2032. row.w1 = 0
  2033. row.r1 = 0
  2034. row.w4 = 0
  2035. row.r4 = 0
  2036. }
  2037. if (row.w1 <= 0) {
  2038. row.w1 = 0
  2039. row.r1 = 0
  2040. }
  2041. if (row.w4 <= 0) {
  2042. row.w4 = 0
  2043. row.r4 = 0
  2044. }
  2045. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2046. }
  2047. // 4班锁定,1班3班未锁
  2048. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  2049. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2050. if (row.r1 !== 0 && row.r3 !== 0) {
  2051. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r3)), 2)
  2052. row.r1 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2053. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r3)), 2)
  2054. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2055. } else {
  2056. row.w1 = 0
  2057. row.r1 = 0
  2058. row.w3 = 0
  2059. row.r3 = 0
  2060. }
  2061. if (row.w1 <= 0) {
  2062. row.w1 = 0
  2063. row.r1 = 0
  2064. }
  2065. if (row.w3 <= 0) {
  2066. row.w3 = 0
  2067. row.r3 = 0
  2068. }
  2069. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2070. }
  2071. // 1班3班4班未锁
  2072. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  2073. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2074. if (row.r1 !== 0 && (row.r2 !== 0 || row.r3 !== 0)) {
  2075. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2076. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2077. } else {
  2078. row.w1 = 0
  2079. row.r1 = 0
  2080. }
  2081. if (row.r3 !== 0 && (row.r2 !== 0 || row.r1 !== 0)) {
  2082. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2083. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2084. } else {
  2085. row.w3 = 0
  2086. row.r3 = 0
  2087. }
  2088. if (row.r4 !== 0 && (row.r1 !== 0 || row.r2 !== 0 || row.r3 !== 0)) {
  2089. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2090. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2091. } else {
  2092. row.w4 = 0
  2093. row.r4 = 0
  2094. }
  2095. if (row.w1 <= 0) {
  2096. row.w1 = 0
  2097. row.r1 = 0
  2098. }
  2099. if (row.w3 <= 0) {
  2100. row.w3 = 0
  2101. row.r3 = 0
  2102. }
  2103. if (row.w4 <= 0) {
  2104. row.w4 = 0
  2105. row.r4 = 0
  2106. }
  2107. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2108. }
  2109. } else if (this.table.RWLength == 3) {
  2110. // 三班
  2111. // 1班/3班锁定
  2112. if (row.isOneWeight == true && row.isThreeWeight == true) {
  2113. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2114. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2115. }
  2116. // 1班不锁3班锁
  2117. if (row.isOneWeight == false && row.isThreeWeight == true) {
  2118. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2119. row.w1 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  2120. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2121. if (row.w1 <= 0) {
  2122. row.w1 = 0
  2123. row.r1 = 0
  2124. }
  2125. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2126. }
  2127. // 3班不锁1班锁
  2128. if (row.isOneWeight == true && row.isThreeWeight == false) {
  2129. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2130. row.w3 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2), 2)
  2131. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2132. if (row.w3 <= 0) {
  2133. row.w3 = 0
  2134. row.r3 = 0
  2135. }
  2136. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2137. }
  2138. // 1班3班都不锁
  2139. if (row.isOneWeight == false && row.isThreeWeight == false) {
  2140. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2141. if (row.r1 !== 0 && row.r3 !== 0) {
  2142. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), 2)
  2143. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2144. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3)), 2)
  2145. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2146. } else if (row.r1 !== 0 && row.r3 == 0) {
  2147. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2148. } else if (row.r1 == 0 && row.r3 !== 0) {
  2149. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2150. } else {
  2151. row.w1 = 0
  2152. row.r1 = 0
  2153. row.w3 = 0
  2154. row.r3 = 0
  2155. }
  2156. if (row.w3 <= 0) {
  2157. row.w3 = 0
  2158. row.r3 = 0
  2159. }
  2160. if (row.w1 <= 0) {
  2161. row.w1 = 0
  2162. row.r1 = 0
  2163. }
  2164. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2165. }
  2166. } else if (this.table.RWLength == 2) {
  2167. // 两班
  2168. if (row.isTwoWeight == false) {
  2169. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2170. row.w1 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2), 2)
  2171. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2172. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2173. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), 2))
  2174. } else {
  2175. row.r2 = parseFloat(row.w2) / parseFloat(row.feedweight) * 100
  2176. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), 2))
  2177. }
  2178. }
  2179. if (row.w1 == '') { row.w1 = 0 }
  2180. if (row.w2 == '') { row.w2 = 0 }
  2181. if (row.w3 == '') { row.w3 = 0 }
  2182. if (row.w4 == '') { row.w4 = 0 }
  2183. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2184. row.dailyWeight = formatNum(row.dailyWeight, 2)
  2185. },
  2186. blurW3(row) {
  2187. // 3班重量
  2188. if (row.w1 == '') {
  2189. row.w1 = 0
  2190. }
  2191. if (row.w2 == '') {
  2192. row.w2 = 0
  2193. }
  2194. if (row.w3 == '') {
  2195. row.w3 = 0
  2196. }
  2197. if (row.w4 == '') {
  2198. row.w4 = 0
  2199. }
  2200. if (row.r1 == '') {
  2201. row.r1 = 0
  2202. }
  2203. if (row.r2 == '') {
  2204. row.r2 = 0
  2205. }
  2206. if (row.r3 == '') {
  2207. row.r3 = 0
  2208. }
  2209. if (row.r4 == '') {
  2210. row.r4 = 0
  2211. }
  2212. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2213. console.log(row, '=======投喂量feedweight')
  2214. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2215. if (this.table.RWLength == 4) {
  2216. // 四班
  2217. // 1班2班4班都锁定
  2218. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == true) {
  2219. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2220. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2221. }
  2222. // 1班2班锁定4班未锁定
  2223. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == false) {
  2224. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2225. row.w4 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  2226. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2227. if (row.w4 <= 0) {
  2228. row.w4 = 0
  2229. row.r4 = 0
  2230. }
  2231. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2232. }
  2233. // 2班4班锁定1班未锁定
  2234. if (row.isOneWeight == false && row.isTwoWeight == true && row.isFourWeight == true) {
  2235. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2236. row.w1 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), 2)
  2237. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2238. if (row.w1 <= 0) {
  2239. row.w1 = 0
  2240. row.r1 = 0
  2241. }
  2242. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2243. }
  2244. // 1班4班锁定2班未锁定
  2245. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == true) {
  2246. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2247. row.w2 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), 2)
  2248. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2249. if (row.w2 <= 0) {
  2250. row.w2 = 0
  2251. row.r2 = 0
  2252. }
  2253. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2254. }
  2255. // 2班锁定,1班4班未锁
  2256. if (row.isTwoWeight == true && row.isOneWeight == false && row.isFourWeight == false) {
  2257. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2258. if (row.r1 !== 0 && row.r4 !== 0) {
  2259. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r4)), 2)
  2260. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2261. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r4)), 2)
  2262. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2263. } else {
  2264. row.w1 = 0
  2265. row.r1 = 0
  2266. row.w4 = 0
  2267. row.r4 = 0
  2268. }
  2269. if (row.w1 <= 0) {
  2270. row.w1 = 0
  2271. row.r1 = 0
  2272. }
  2273. if (row.w4 <= 0) {
  2274. row.w4 = 0
  2275. row.r4 = 0
  2276. }
  2277. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2278. }
  2279. // 1班锁定,2班4班未锁
  2280. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == false) {
  2281. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2282. if (row.r2 !== 0 && row.r4 !== 0) {
  2283. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  2284. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2285. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), 2)
  2286. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2287. } else {
  2288. row.w2 = 0
  2289. row.r2 = 0
  2290. row.w4 = 0
  2291. row.r4 = 0
  2292. }
  2293. if (row.w2 <= 0) {
  2294. row.w2 = 0
  2295. row.r2 = 0
  2296. }
  2297. if (row.w4 <= 0) {
  2298. row.w4 = 0
  2299. row.r4 = 0
  2300. }
  2301. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2302. }
  2303. // 4班锁定,2班1班未锁
  2304. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == true) {
  2305. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2306. if (row.r1 !== 0 && row.r2 !== 0) {
  2307. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2)), 2)
  2308. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2309. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r2)), 2)
  2310. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2311. } else {
  2312. row.w2 = 0
  2313. row.r2 = 0
  2314. row.w1 = 0
  2315. row.r1 = 0
  2316. }
  2317. if (row.w2 <= 0) {
  2318. row.w2 = 0
  2319. row.r2 = 0
  2320. }
  2321. if (row.w1 <= 0) {
  2322. row.w1 = 0
  2323. row.r1 = 0
  2324. }
  2325. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2326. }
  2327. // 2班1班4班未锁
  2328. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == false) {
  2329. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2330. if (row.r1 !== 0 && (row.r2 !== 0 || row.r4 !== 0)) {
  2331. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  2332. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2333. } else {
  2334. row.w1 = 0
  2335. row.r1 = 0
  2336. }
  2337. if (row.r2 !== 0 && (row.r1 !== 0 || row.r4 !== 0)) {
  2338. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  2339. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2340. } else {
  2341. row.w2 = 0
  2342. row.r2 = 0
  2343. }
  2344. if (row.r3 !== 0 && (row.r1 !== 0 || row.r2 !== 0)) {
  2345. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  2346. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2347. } else {
  2348. row.w4 = 0
  2349. row.r4 = 0
  2350. }
  2351. if (row.w1 <= 0) {
  2352. row.w1 = 0
  2353. row.r1 = 0
  2354. }
  2355. if (row.w2 <= 0) {
  2356. row.w2 = 0
  2357. row.r2 = 0
  2358. }
  2359. if (row.w4 <= 0) {
  2360. row.w4 = 0
  2361. row.r4 = 0
  2362. }
  2363. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2364. }
  2365. } else if (this.table.RWLength == 3) {
  2366. // 三班
  2367. // 1班/2班锁定
  2368. if (row.isOneWeight == true && row.isTwoWeight == true) {
  2369. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2370. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2371. }
  2372. // 1班不锁2班锁
  2373. if (row.isOneWeight == false && row.isTwoWeight == true) {
  2374. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2375. row.w1 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  2376. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2377. if (row.w1 <= 0) {
  2378. row.w1 = 0
  2379. row.r1 = 0
  2380. }
  2381. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2382. }
  2383. // 3班不锁2班锁
  2384. // 2班不锁1班锁
  2385. if (row.isOneWeight == true && row.isTwoWeight == false) {
  2386. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2387. row.w2 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3), 2)
  2388. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2389. if (row.w2 <= 0) {
  2390. row.w2 = 0
  2391. row.r2 = 0
  2392. }
  2393. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2394. }
  2395. // 2班3班都不锁
  2396. // 1班2班都不锁
  2397. if (row.isOneWeight == false && row.isTwoWeight == false) {
  2398. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2399. if (row.r1 !== 0 && row.r2 !== 0) {
  2400. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2)), 2)
  2401. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2402. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), 2)
  2403. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2404. } else {
  2405. row.w1 = 0
  2406. row.r1 = 0
  2407. row.w2 = 0
  2408. row.r2 = 0
  2409. }
  2410. if (row.w1 <= 0) {
  2411. row.w1 = 0
  2412. row.r1 = 0
  2413. }
  2414. if (row.w2 <= 0) {
  2415. row.w2 = 0
  2416. row.r2 = 0
  2417. }
  2418. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2419. }
  2420. }
  2421. if (row.w1 == '') { row.w1 = 0 }
  2422. if (row.w2 == '') { row.w2 = 0 }
  2423. if (row.w3 == '') { row.w3 = 0 }
  2424. if (row.w4 == '') { row.w4 = 0 }
  2425. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2426. row.dailyWeight = formatNum(row.dailyWeight, 2)
  2427. },
  2428. blurW4(row) {
  2429. if (row.w1 == '') {
  2430. row.w1 = 0
  2431. }
  2432. if (row.w2 == '') {
  2433. row.w2 = 0
  2434. }
  2435. if (row.w3 == '') {
  2436. row.w3 = 0
  2437. }
  2438. if (row.w4 == '') {
  2439. row.w4 = 0
  2440. }
  2441. if (row.r1 == '') {
  2442. row.r1 = 0
  2443. }
  2444. if (row.r2 == '') {
  2445. row.r2 = 0
  2446. }
  2447. if (row.r3 == '') {
  2448. row.r3 = 0
  2449. }
  2450. if (row.r4 == '') {
  2451. row.r4 = 0
  2452. }
  2453. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2454. console.log(row, '=======投喂量feedweight')
  2455. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2456. if (this.table.RWLength == 4) {
  2457. // 四班
  2458. // 1班2班3班都锁定
  2459. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == true) {
  2460. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2461. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2462. }
  2463. // 2班3班锁定1班未锁定
  2464. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == true) {
  2465. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2466. row.w1 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  2467. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2468. if (row.w1 <= 0) {
  2469. row.w1 = 0
  2470. row.r1 = 0
  2471. }
  2472. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2473. }
  2474. // 2班1班锁定3班未锁定
  2475. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == false) {
  2476. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2477. row.w3 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), 2)
  2478. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2479. if (row.w3 <= 0) {
  2480. row.w3 = 0
  2481. row.r3 = 0
  2482. }
  2483. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2484. }
  2485. // 3班1班锁定2班未锁定
  2486. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == true) {
  2487. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2488. row.w2 = formatNum(parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), 2)
  2489. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2490. if (row.w2 <= 0) {
  2491. row.w2 = 0
  2492. row.r2 = 0
  2493. }
  2494. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2495. }
  2496. // 2班锁定,3班1班未锁
  2497. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == false) {
  2498. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2499. if (row.r1 !== 0 && row.r3 !== 0) {
  2500. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2501. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2502. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r1)), 2)
  2503. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2504. } else {
  2505. row.w3 = 0
  2506. row.r3 = 0
  2507. row.w1 = 0
  2508. row.r1 = 0
  2509. }
  2510. if (row.w3 <= 0) {
  2511. row.w3 = 0
  2512. row.r3 = 0
  2513. }
  2514. if (row.w1 <= 0) {
  2515. row.w1 = 0
  2516. row.r1 = 0
  2517. }
  2518. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2519. }
  2520. // 3班锁定,2班1班未锁
  2521. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == true) {
  2522. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2523. if (row.r1 !== 0 && row.r2 !== 0) {
  2524. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r1)), 2)
  2525. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2526. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r1)), 2)
  2527. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2528. } else {
  2529. row.w2 = 0
  2530. row.r2 = 0
  2531. row.w1 = 0
  2532. row.r1 = 0
  2533. }
  2534. if (row.w2 <= 0) {
  2535. row.w2 = 0
  2536. row.r2 = 0
  2537. }
  2538. if (row.w1 <= 0) {
  2539. row.w1 = 0
  2540. row.r1 = 0
  2541. }
  2542. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2543. }
  2544. // 1班锁定,2班3班未锁
  2545. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == false) {
  2546. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2547. if (row.r2 !== 0 && row.r3 !== 0) {
  2548. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), 2)
  2549. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2550. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), 2)
  2551. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2552. } else {
  2553. row.w2 = 0
  2554. row.r2 = 0
  2555. row.w3 = 0
  2556. row.r3 = 0
  2557. }
  2558. if (row.w2 <= 0) {
  2559. row.w2 = 0
  2560. row.r2 = 0
  2561. }
  2562. if (row.w3 <= 0) {
  2563. row.w3 = 0
  2564. row.r3 = 0
  2565. }
  2566. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2567. }
  2568. // 2班3班1班未锁
  2569. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == false) {
  2570. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2571. if (row.r1 !== 0 && (row.r2 !== 0 && row.r3 !== 0)) {
  2572. row.w1 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2573. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2574. } else {
  2575. row.w1 = 0
  2576. row.r1 = 0
  2577. }
  2578. if (row.r2 !== 0 && (row.r1 !== 0 && row.r3 !== 0)) {
  2579. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2580. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2581. } else {
  2582. row.w2 = 0
  2583. row.r2 = 0
  2584. }
  2585. if (row.r3 !== 0 && (row.r1 !== 0 && row.r2 !== 0)) {
  2586. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2587. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2588. } else {
  2589. row.w3 = 0
  2590. row.r3 = 0
  2591. }
  2592. if (row.w1 <= 0) {
  2593. row.w1 = 0
  2594. row.r1 = 0
  2595. }
  2596. if (row.w2 <= 0) {
  2597. row.w2 = 0
  2598. row.r2 = 0
  2599. }
  2600. if (row.w3 <= 0) {
  2601. row.w3 = 0
  2602. row.r3 = 0
  2603. }
  2604. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2605. }
  2606. }
  2607. if (row.w1 == '') { row.w1 = 0 }
  2608. if (row.w2 == '') { row.w2 = 0 }
  2609. if (row.w3 == '') { row.w3 = 0 }
  2610. if (row.w4 == '') { row.w4 = 0 }
  2611. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2612. row.dailyWeight = formatNum(row.dailyWeight, 2)
  2613. },
  2614. // 编辑
  2615. handleUpdate(row) {
  2616. console.log(row)
  2617. for (let i = 0; i < this.table.list.length; i++) {
  2618. if (this.table.list[i].Edit == true) {
  2619. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2620. return false
  2621. }
  2622. }
  2623. // 编辑true,不可编辑false
  2624. row.Edit = true
  2625. row.NoEdit = false
  2626. // 编辑false,编辑保存true
  2627. row.isUpdate = false
  2628. row.isUpdateSave = true
  2629. row.ftid = String(row.ftid)
  2630. if (row.ptsfid == '-1') {
  2631. row.ptsfid = ''
  2632. }
  2633. row.ptsfid = String(row.ptsfid)
  2634. // dryweight
  2635. this.table.temp.ftid = row.ftid
  2636. this.table.temp.ftname = row.ftname
  2637. this.table.temp.ptsfid = row.ptsfid
  2638. this.table.temp.ptsfname = row.ptsfname
  2639. },
  2640. updateData(row) {
  2641. console.log(row)
  2642. if (row.r1 == 'NaN') { this.$set(row, 'r1', 0) }
  2643. if (row.r2 == 'NaN') { this.$set(row, 'r2', 0) }
  2644. if (row.r3 == 'NaN') { this.$set(row, 'r3', 0) }
  2645. if (row.r4 == 'NaN') { this.$set(row, 'r4', 0) }
  2646. if (row.w1 == 'NaN') { this.$set(row, 'w1', 0) }
  2647. if (row.w2 == 'NaN') { this.$set(row, 'w2', 0) }
  2648. if (row.w3 == 'NaN') { this.$set(row, 'w3', 0) }
  2649. if (row.w4 == 'NaN') { this.$set(row, 'w4', 0) }
  2650. console.log(row)
  2651. var arr = []
  2652. for (let i = 1; i <= this.table.RWLength; i++) {
  2653. var obj = {}
  2654. obj['times'] = i
  2655. obj['pastureid'] = row.pastureid
  2656. obj['barid'] = row.barid
  2657. obj['cowcount'] = row.ccount
  2658. obj['ccountradio'] = row.ccountradio
  2659. obj['ptid'] = row.ftid
  2660. if (row.ptsfid !== '') {
  2661. obj['ptsid'] = row.ptsfid
  2662. } else {
  2663. obj['ptsid'] = '-1'
  2664. }
  2665. obj['weight'] = row['w' + i]
  2666. obj['tratio'] = Math.round(row['r' + i])
  2667. arr.push(obj)
  2668. }
  2669. if (this.table.isPtsfname == 0) {
  2670. row.ptsfid = '-1'
  2671. row.ptsfname = ''
  2672. } else {
  2673. if (row.ptsfid == '') {
  2674. row.ptsfid = '-1'
  2675. row.ptsfname = ''
  2676. }
  2677. }
  2678. if (row.supplyweight == '') {
  2679. row.supplyweight = '0'
  2680. }
  2681. if (this.table.isPtsfname == false) {
  2682. row.supplyweight = '0'
  2683. }
  2684. console.log(row, '============')
  2685. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  2686. this.$set(row, 'ccountratio', Math.floor(parseFloat(row.ccountratio) * 100) / 100)
  2687. row.ratio = String(row.ratio)
  2688. row.ccountratio = String(row.ccountratio)
  2689. row.sumr = Math.round(row.sumr)
  2690. this.table.rwList = arr
  2691. console.log('点击了编辑保存', row)
  2692. this.table.temp.pastureid = row.pastureid
  2693. this.table.temp.id = row.id
  2694. this.table.temp.barname = row.barname
  2695. this.table.temp.barid = row.barid
  2696. this.table.temp.ccount = row.ccount
  2697. this.table.temp.ratio = row.ratio
  2698. this.table.temp.ccountratio = row.ccountratio
  2699. this.table.temp.ftid = row.ftid
  2700. this.table.temp.ftname = row.ftname
  2701. this.table.temp.ptsfid = row.ptsfid
  2702. this.table.temp.ptsfname = row.ptsfname
  2703. this.table.temp.ftweight = row.ftweight
  2704. this.table.temp.supplyweight = row.supplyweight
  2705. this.table.temp.feedweight = row.feedweight
  2706. this.table.temp.owner = row.owner
  2707. this.table.temp.sumr = row.sumr
  2708. if (row.softccount == '') {
  2709. row.softccount = 0
  2710. }
  2711. if (row.r1 == '') {
  2712. row.r1 = 0
  2713. }
  2714. if (row.r2 == '') {
  2715. row.r2 = 0
  2716. }
  2717. if (row.r3 == '') {
  2718. row.r3 = 0
  2719. }
  2720. if (row.r4 == '') {
  2721. row.r4 = 0
  2722. }
  2723. if (row.w1 == '') {
  2724. row.w1 = 0
  2725. }
  2726. if (row.w2 == '' || row.w4 == NaN) {
  2727. row.w2 = 0
  2728. }
  2729. if (row.w3 == '' || row.w4 == NaN) {
  2730. row.w3 = 0
  2731. }
  2732. if (row.w4 == '' || row.w4 == NaN) {
  2733. row.w4 = 0
  2734. }
  2735. console.log(row, '===========')
  2736. this.table.temp.softccount = row.softccount
  2737. this.table.temp.r1 = Math.round(row.r1)
  2738. this.table.temp.r2 = Math.round(row.r2)
  2739. this.table.temp.r3 = Math.round(row.r3)
  2740. this.table.temp.r4 = Math.round(row.r4)
  2741. this.table.temp.w1 = row.w1
  2742. this.table.temp.w2 = row.w2
  2743. this.table.temp.w3 = row.w3
  2744. this.table.temp.w4 = row.w4
  2745. if (this.table.temp.ccount == '' && this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2746. this.$message({ type: 'error', message: '实际牛头数/系数/系数头数/配方模版不能为空', duration: 2000 })
  2747. return false
  2748. }
  2749. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2750. this.$message({ type: 'error', message: '系数/系数头数/配方模版不能为空', duration: 2000 })
  2751. return false
  2752. }
  2753. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2754. this.$message({ type: 'error', message: '系数头数/配方模版不能为空', duration: 2000 })
  2755. return false
  2756. }
  2757. console.log(this.table.temp.ccount, '实际牛头数不能为空')
  2758. if (this.table.temp.ccount == '') {
  2759. this.$message({ type: 'error', message: '实际牛头数不能为空', duration: 2000 })
  2760. return false
  2761. }
  2762. if (this.table.temp.ratio == '') {
  2763. this.$message({ type: 'error', message: '系数不能为空', duration: 2000 })
  2764. return false
  2765. }
  2766. if (this.table.temp.ccountratio == '') {
  2767. this.$message({ type: 'error', message: '系数头数不能为空', duration: 2000 })
  2768. return false
  2769. }
  2770. if (this.table.temp.ftid == '') {
  2771. this.$message({ type: 'error', message: '配方模版不能为空', duration: 2000 })
  2772. return false
  2773. }
  2774. const positiveInteger = /^[0-9]\d*$/
  2775. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  2776. this.$message({
  2777. type: 'error',
  2778. message: '实际牛头数请输入正整数',
  2779. duration: 2000
  2780. })
  2781. return false
  2782. }
  2783. this.isokDisable = true
  2784. setTimeout(() => {
  2785. this.isokDisable = false
  2786. }, 1000)
  2787. // this.requestParam.parammaps = this.table.temp
  2788. this.requestParam.common = {
  2789. 'returnmap': '0'
  2790. }
  2791. this.requestParam.data = []
  2792. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  2793. pastureid: row.pastureid,
  2794. id: row.id,
  2795. barname: row.barname,
  2796. barid: row.barid,
  2797. softccount: row.softccount,
  2798. ccount: row.ccount,
  2799. ratio: row.ratio,
  2800. ccountratio: row.ccountratio,
  2801. ftid: row.ftid,
  2802. ftname: row.ftname,
  2803. ptsfid: row.ptsfid,
  2804. ptsfname: row.ptsfname,
  2805. ftweight: row.ftweight,
  2806. supplyweight: row.supplyweight,
  2807. feedweight: row.feedweight,
  2808. owner: row.owner,
  2809. sumr: row.sumr
  2810. }}
  2811. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  2812. this.requestParam.data[1].children = []
  2813. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  2814. pastureid: '@insertSpotList.pastureid',
  2815. barname: row.barname,
  2816. barid: '@insertSpotList.barid',
  2817. times: '@insertSpotList.times',
  2818. tratio: '@insertSpotList.tratio',
  2819. weight: '@insertSpotList.weight',
  2820. cowcount: '@insertSpotList.cowcount',
  2821. ccountradio: row.ccountratio,
  2822. ptid: '@insertSpotList.ptid',
  2823. ptsid: '@insertSpotList.ptsid',
  2824. feedweight: row.feedweight,
  2825. supplyweight: row.supplyweight,
  2826. ratio: row.ratio
  2827. }}
  2828. this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  2829. pastureid: row.pastureid,
  2830. fpid: row.id
  2831. }}
  2832. ExecDataByConfig(this.requestParam).then(response => {
  2833. console.log('编辑保存发送参数', this.requestParam)
  2834. if (response.msg === 'fail') {
  2835. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2836. } else {
  2837. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2838. this.getList()
  2839. this.reload()
  2840. }
  2841. })
  2842. },
  2843. updateCancel(row) {
  2844. console.log('点击了编辑取消')
  2845. // 编辑false,不可编辑true
  2846. row.Edit = false
  2847. row.NoEdit = true
  2848. // 编辑true,编辑保存false
  2849. row.isUpdate = true
  2850. row.isUpdateSave = false
  2851. this.reload()
  2852. console.log(this.table.getdataListParm.offset)
  2853. this.table.getdataListParm.offset = this.table.getdataListParm.offset
  2854. this.getList()
  2855. // this.$router.push('/formulationPlan/dhedFormula')
  2856. },
  2857. cellClick(row, column, event) {
  2858. console.log(column)
  2859. },
  2860. handleSelect(val) {
  2861. console.log('勾选数据', val)
  2862. this.selectList = val
  2863. },
  2864. // 营养评估
  2865. handleNutritional() {
  2866. console.log('点击了营养评估')
  2867. if (this.selectList.length !== 1) {
  2868. this.$message({ type: 'error', message: '请选择一条栏舍信息进行营养评估', duration: 2000 })
  2869. return false
  2870. } else {
  2871. console.log(this.nutritional.temp)
  2872. this.nutritional.dialogStatus = 'Nutritional'
  2873. this.nutritional.activeName = 'first'
  2874. this.nutritional.dialogFormVisible = true
  2875. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2876. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2877. this.getNutritionalList()
  2878. this.nutritional.tab1.list = []
  2879. }
  2880. },
  2881. tableRowClassName({ row }) {
  2882. // console.log(row)
  2883. if (row.isColor == '0') {
  2884. return 'red-row'
  2885. } else {
  2886. return ''
  2887. }
  2888. },
  2889. handleNutritionalTab(item) {
  2890. if (item == 'first ') {
  2891. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2892. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2893. this.getNutritionalList()
  2894. this.nutritional.tab1.list = []
  2895. } else {
  2896. console.log('牛群评估')
  2897. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2898. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2899. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2900. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2901. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2902. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2903. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2904. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2905. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2906. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2907. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2908. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2909. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2910. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2911. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2912. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2913. this.getTab2NutritionalList1()
  2914. this.getTab2NutritionalList2()
  2915. this.getTab2NutritionalList3()
  2916. this.getTab2NutritionalList4()
  2917. }
  2918. },
  2919. changeTab2Date() {
  2920. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2921. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2922. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2923. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2924. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2925. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2926. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2927. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2928. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2929. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2930. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2931. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2932. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2933. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2934. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2935. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2936. this.getTab2NutritionalList1()
  2937. this.getTab2NutritionalList2()
  2938. this.getTab2NutritionalList3()
  2939. this.getTab2NutritionalList4()
  2940. },
  2941. handleBefore() {
  2942. if (this.nutritional.activeName == 'first') {
  2943. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  2944. var start = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() - 1))
  2945. var stop = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() - 1))
  2946. this.nutritional.tab1.inputDatetime.length = 0
  2947. this.nutritional.tab1.inputDatetime.push(start, stop)
  2948. this.$forceUpdate()
  2949. }
  2950. } else {
  2951. var start2 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() - 1))
  2952. var stop2 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() - 1))
  2953. this.nutritional.tab2.inputDatetime.length = 0
  2954. this.nutritional.tab2.inputDatetime.push(start2, stop2)
  2955. this.$forceUpdate()
  2956. }
  2957. },
  2958. handleNext() {
  2959. if (this.nutritional.activeName == 'first') {
  2960. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  2961. console.log(this.nutritional.tab1.inputDatetime)
  2962. var start3 = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() + 1))
  2963. var stop3 = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() + 1))
  2964. this.nutritional.tab1.inputDatetime.length = 0
  2965. this.nutritional.tab1.inputDatetime.push(start3, stop3)
  2966. this.$forceUpdate()
  2967. }
  2968. } else {
  2969. if (this.nutritional.tab2.inputDatetime !== '' && this.nutritional.tab2.inputDatetime !== null) {
  2970. var start4 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() + 1))
  2971. var stop4 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() + 1))
  2972. this.nutritional.tab2.inputDatetime.length = 0
  2973. this.nutritional.tab2.inputDatetime.push(start4, stop4)
  2974. this.$forceUpdate()
  2975. }
  2976. }
  2977. },
  2978. getNutritionalList() {
  2979. this.nutritional.tab1.listLoading1 = true
  2980. GetDataByName(this.nutritional.tab1.getdataListParm1).then(response => {
  2981. console.log('评估上方数据', response.data.list)
  2982. if (response.data.list !== null) {
  2983. response.data.list[0].cowclassid = String(response.data.list[0].cowclassid)
  2984. this.nutritional.tab1.temp = response.data.list[0]
  2985. this.nutritional.tab1.disabledCowclass = true
  2986. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  2987. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  2988. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  2989. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  2990. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  2991. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  2992. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  2993. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  2994. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  2995. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  2996. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  2997. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  2998. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  2999. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  3000. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  3001. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  3002. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  3003. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  3004. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  3005. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  3006. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  3007. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  3008. this.getNutritionalList2()
  3009. } else {
  3010. this.nutritional.tab1.temp = []
  3011. this.nutritional.tab1.disabledCowclass = false
  3012. }
  3013. setTimeout(() => {
  3014. this.nutritional.tab1.listLoading = false
  3015. }, 100)
  3016. })
  3017. },
  3018. assessmentData() {
  3019. console.log('评估保存')
  3020. this.$refs['temp'].validate(valid => {
  3021. if (valid) {
  3022. if (this.nutritional.tab1.inputDatetime == '' || this.nutritional.tab1.inputDatetime == null) {
  3023. this.$message({ type: 'error', message: '开始日期结束日期不能为空', duration: 2000 })
  3024. return false
  3025. } else {
  3026. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  3027. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  3028. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  3029. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  3030. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  3031. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  3032. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  3033. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  3034. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  3035. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  3036. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  3037. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  3038. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  3039. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  3040. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  3041. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  3042. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  3043. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  3044. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  3045. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  3046. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  3047. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  3048. this.getNutritionalList2()
  3049. }
  3050. }
  3051. })
  3052. },
  3053. getNutritionalList2() {
  3054. this.nutritional.tab1.listLoading2 = true
  3055. GETNurJudge(this.nutritional.tab1.getdataListParm2).then(response => {
  3056. if (response.msg !== 'fail') {
  3057. if (response.data.list !== null) {
  3058. // response.data = response.data.sort(compareSort('sort'))
  3059. for (let i = 0; i < response.data.length; i++) {
  3060. var reg = RegExp(/>/)
  3061. var reg2 = RegExp(/</)
  3062. var reg3 = RegExp(/-/)
  3063. if (reg.test(response.data[i].cowneed) == true) {
  3064. const cowneed = response.data[i].cowneed.split('>')[1]
  3065. if ((parseFloat(response.data[i].ftpro) < parseFloat(cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(cowneed)) {
  3066. this.$set(response.data[i], 'isColor', '0')
  3067. } else {
  3068. this.$set(response.data[i], 'isColor', '')
  3069. }
  3070. } else if (reg2.test(response.data[i].cowneed) == true) {
  3071. const cowneed2 = response.data[i].cowneed.split('<')[1]
  3072. if ((parseFloat(response.data[i].ftpro) > parseFloat(cowneed2)) || (parseFloat(response.data[i].hprov) > parseFloat(cowneed2)) || parseFloat(response.data[i].sprov) > parseFloat(cowneed2)) {
  3073. this.$set(response.data[i], 'isColor', '0')
  3074. } else {
  3075. this.$set(response.data[i], 'isColor', '')
  3076. }
  3077. } else if (reg3.test(response.data[i].cowneed) == true) {
  3078. response.data[i].cowneed = String(response.data[i].cowneed)
  3079. if (response.data[i].cowneed.length == 1) {
  3080. const cowneed3 = response.data[i].cowneed.split('-')
  3081. console.log(cowneed3, 'cowneed3')
  3082. if (parseFloat(response.data[i].ftpro) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].ftpro) < parseFloat(cowneed3[1])) {
  3083. this.$set(response.data[i], 'isColor', '')
  3084. } else if (parseFloat(response.data[i].hprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].hprov) < parseFloat(cowneed3[1])) {
  3085. this.$set(response.data[i], 'isColor', '')
  3086. } else if (parseFloat(response.data[i].sprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].sprov) < parseFloat(cowneed3[1])) {
  3087. this.$set(response.data[i], 'isColor', '')
  3088. } else if (cowneed3[0] == '' && cowneed3[0] == '') {
  3089. this.$set(response.data[i], 'isColor', '')
  3090. } else {
  3091. this.$set(response.data[i], 'isColor', '0')
  3092. }
  3093. } else {
  3094. if ((parseFloat(response.data[i].ftpro) < parseFloat(response.data[i].cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(response.data[i].cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(response.data[i].cowneed)) {
  3095. this.$set(response.data[i], 'isColor', '0')
  3096. } else {
  3097. this.$set(response.data[i], 'isColor', '')
  3098. }
  3099. }
  3100. } else {
  3101. response.data[i].cowneed = String(response.data[i].cowneed)
  3102. if (response.data[i].cowneed[0] !== '-') {
  3103. if ((parseFloat(response.data[i].ftpro) < parseFloat(response.data[i].cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(response.data[i].cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(response.data[i].cowneed)) {
  3104. this.$set(response.data[i], 'isColor', '0')
  3105. } else {
  3106. this.$set(response.data[i], 'isColor', '')
  3107. }
  3108. } else {
  3109. this.$set(response.data[i], 'isColor', '')
  3110. }
  3111. }
  3112. }
  3113. console.log(response.data)
  3114. console.log('评估下方数据', response.data)
  3115. this.nutritional.tab1.list = response.data
  3116. this.nutritional.tab1.total = response.data.total
  3117. } else {
  3118. this.nutritional.tab1.list = []
  3119. }
  3120. } else {
  3121. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  3122. }
  3123. setTimeout(() => {
  3124. this.nutritional.tab1.listLoading2 = false
  3125. }, 100)
  3126. })
  3127. },
  3128. // 牛群评估
  3129. getTab2NutritionalList1() {
  3130. this.nutritional.tab2.listLoading1 = true
  3131. GetDataByName(this.nutritional.tab2.getdataListParm1).then(response => {
  3132. console.log('宾州筛分析', response.data.list)
  3133. if (response.data.list !== null) {
  3134. this.nutritional.tab2.list1 = response.data.list
  3135. this.nutritional.tab2.pageNum1 = response.data.pageNum
  3136. this.nutritional.tab2.pageSize1 = response.data.pageSize
  3137. this.nutritional.tab2.total1 = response.data.total
  3138. } else {
  3139. this.nutritional.tab2.list1 = []
  3140. }
  3141. setTimeout(() => {
  3142. this.nutritional.tab2.listLoading1 = false
  3143. }, 100)
  3144. })
  3145. },
  3146. getTab2NutritionalList2() {
  3147. this.nutritional.tab2.listLoading2 = true
  3148. GetDataByName(this.nutritional.tab2.getdataListParm2).then(response => {
  3149. console.log('粪便筛分析', response.data.list)
  3150. if (response.data.list !== null) {
  3151. this.nutritional.tab2.list2 = response.data.list
  3152. this.nutritional.tab2.pageNum2 = response.data.pageNum
  3153. this.nutritional.tab2.pageSize2 = response.data.pageSize
  3154. this.nutritional.tab2.total2 = response.data.total
  3155. } else {
  3156. this.nutritional.tab2.list2 = []
  3157. }
  3158. setTimeout(() => {
  3159. this.nutritional.tab2.listLoading2 = false
  3160. }, 100)
  3161. })
  3162. },
  3163. getTab2NutritionalList3() {
  3164. this.nutritional.tab2.listLoading3 = true
  3165. GetDataByName(this.nutritional.tab2.getdataListParm3).then(response => {
  3166. console.log('BCS评分', response.data.list)
  3167. if (response.data.list !== null) {
  3168. this.nutritional.tab2.list3 = response.data.list
  3169. this.nutritional.tab2.pageNum3 = response.data.pageNum
  3170. this.nutritional.tab2.pageSize3 = response.data.pageSize
  3171. this.nutritional.tab2.total3 = response.data.total
  3172. } else {
  3173. this.nutritional.tab2.list3 = []
  3174. }
  3175. setTimeout(() => {
  3176. this.nutritional.tab2.listLoading3 = false
  3177. }, 100)
  3178. })
  3179. },
  3180. getTab2NutritionalList4() {
  3181. this.nutritional.tab2.listLoading4 = true
  3182. GetDataByName(this.nutritional.tab2.getdataListParm4).then(response => {
  3183. console.log('粪便评分', response.data.list)
  3184. if (response.data.list !== null) {
  3185. this.nutritional.tab2.list4 = response.data.list
  3186. this.nutritional.tab2.pageNum4 = response.data.pageNum
  3187. this.nutritional.tab2.pageSize4 = response.data.pageSize
  3188. this.nutritional.tab2.total4 = response.data.total
  3189. } else {
  3190. this.nutritional.tab2.list4 = []
  3191. }
  3192. setTimeout(() => {
  3193. this.nutritional.tab2.listLoading4 = false
  3194. }, 100)
  3195. })
  3196. },
  3197. // 历史记录
  3198. handleHistoryRecords() {
  3199. console.log('点击了历史记录')
  3200. this.history.dialogStatus = 'history'
  3201. this.history.dialogFormVisible = true
  3202. this.getDateList()
  3203. },
  3204. // 历史时间
  3205. getDateList() {
  3206. GetDataByName(this.history.getdataDateParm).then(response => {
  3207. console.log('table数据', response.data.list)
  3208. if (response.data.list !== null) {
  3209. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  3210. this.getHistoryIsDisplay()
  3211. } else {
  3212. this.history.getdataListParm.parammaps.date = ''
  3213. }
  3214. })
  3215. },
  3216. getHistoryIsDisplay() {
  3217. GetDataByName(this.table.getdataListParm2).then(response => {
  3218. console.log(response.data.list[0].inforvalue)
  3219. if (response.data.list !== null) {
  3220. if (response.data.list[0].inforvalue == 0) {
  3221. this.table.isPtsfname = false
  3222. } else {
  3223. this.table.isPtsfname = true
  3224. }
  3225. }
  3226. })
  3227. GetDataByName(this.table.getdataListParm3).then(response => {
  3228. if (response.data.list !== null) {
  3229. if (response.data.list[0].inforvalue == 1) {
  3230. this.history.isRW1 = true
  3231. this.history.isRW2 = false
  3232. this.history.isRW3 = false
  3233. this.history.isRW4 = false
  3234. } else if (response.data.list[0].inforvalue == 2) {
  3235. this.history.isRW1 = true
  3236. this.history.isRW2 = true
  3237. this.history.isRW3 = false
  3238. this.history.isRW4 = false
  3239. } else if (response.data.list[0].inforvalue == 3) {
  3240. this.history.isRW1 = true
  3241. this.history.isRW2 = true
  3242. this.history.isRW3 = true
  3243. this.history.isRW4 = false
  3244. } else if (response.data.list[0].inforvalue == 4) {
  3245. this.history.isRW1 = true
  3246. this.history.isRW2 = true
  3247. this.history.isRW3 = true
  3248. this.history.isRW4 = true
  3249. }
  3250. } else {
  3251. this.history.isRW1 = false
  3252. this.history.isRW2 = false
  3253. this.history.isRW3 = false
  3254. this.history.isRW4 = false
  3255. }
  3256. })
  3257. this.getHistoryList()
  3258. },
  3259. getHistoryList() {
  3260. this.history.listLoading = true
  3261. GetDataByName(this.history.getdataListParm).then(response => {
  3262. console.log('table数据', response.data.list)
  3263. if (response.data.list !== null) {
  3264. console.log('table数据', response.data.list)
  3265. for (let i = 0; i < response.data.list.length; i++) {
  3266. if (response.data.list[i].ptid == undefined || response.data.list[i].ptname == '') {
  3267. this.$set(response.data.list[i], 'ptid', '')
  3268. this.$set(response.data.list[i], 'ptname', '')
  3269. }
  3270. }
  3271. this.history.list = response.data.list
  3272. this.handleSpan()
  3273. this.history.pageNum = response.data.pageNum
  3274. this.history.pageSize = response.data.pageSize
  3275. this.history.total = response.data.total
  3276. } else {
  3277. this.history.list = []
  3278. }
  3279. setTimeout(() => {
  3280. this.history.listLoading = false
  3281. }, 100)
  3282. })
  3283. },
  3284. handleSpan() {
  3285. this.mergekeys.forEach(key => {
  3286. this.spanObj[key] = []
  3287. let position = 0
  3288. this.history.list.forEach((item, index) => {
  3289. if (index === 0) {
  3290. this.spanObj[key].push(1)
  3291. position = 0
  3292. } else {
  3293. if (key == 'sumweight') {
  3294. if (this.history.list[index][key] === this.history.list[index - 1][key] && this.history.list[index]['barname'] === this.history.list[index - 1]['barname']) {
  3295. this.spanObj[key][position] += 1
  3296. this.spanObj[key].push(0)
  3297. } else {
  3298. this.spanObj[key].push(1)
  3299. position = index
  3300. }
  3301. } else {
  3302. if (this.history.list[index][key] === this.history.list[index - 1][key]) {
  3303. this.spanObj[key][position] += 1
  3304. this.spanObj[key].push(0)
  3305. } else {
  3306. this.spanObj[key].push(1)
  3307. position = index
  3308. }
  3309. }
  3310. }
  3311. })
  3312. })
  3313. },
  3314. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  3315. for (let i = 0; i < this.mergekeys.length; i++) {
  3316. if (column.property === this.mergekeys[i]) {
  3317. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  3318. const _col = _row > 0 ? 1 : 0
  3319. return {
  3320. rowspan: _row,
  3321. colspan: _col
  3322. }
  3323. }
  3324. }
  3325. },
  3326. changeDate() {
  3327. this.getHistoryList()
  3328. },
  3329. // 应用
  3330. handleApplication() {
  3331. console.log('点击了应用')
  3332. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  3333. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3334. }).then(() => {
  3335. this.requestParam.name = 'applyFPdate'
  3336. this.requestParam.parammaps = {}
  3337. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  3338. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  3339. PostDataByName(this.requestParam).then(response => {
  3340. if (response.msg === 'fail') {
  3341. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3342. } else {
  3343. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3344. this.getHistoryIsDisplay()
  3345. this.getList()
  3346. }
  3347. })
  3348. }).catch(() => {
  3349. this.$message({ type: 'info', message: '已取消应用' })
  3350. })
  3351. },
  3352. // 导出
  3353. handleExport(item) {
  3354. if (item == 1) {
  3355. console.log('点击了导出模板')
  3356. } else {
  3357. console.log('点击了导出数据')
  3358. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  3359. GetDataByName(this.download.getdataListParm).then(response => {
  3360. if (response.data.list !== null) {
  3361. for (let i = 0; i < response.data.list.length; i++) {
  3362. if (response.data.list[i].timesopt !== undefined) {
  3363. var timesoptArr = response.data.list[i].timesopt.split(',')
  3364. for (let j = 0; j < timesoptArr.length; j++) {
  3365. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  3366. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  3367. }
  3368. }
  3369. if (response.data.list[i].r1 == '' || response.data.list[i].r1 == undefined) {
  3370. response.data.list[i].r1 = 0
  3371. }
  3372. if (response.data.list[i].r2 == '' || response.data.list[i].r2 == undefined) {
  3373. response.data.list[i].r2 = 0
  3374. }
  3375. if (response.data.list[i].r3 == '' || response.data.list[i].r3 == undefined) {
  3376. response.data.list[i].r3 = 0
  3377. }
  3378. if (response.data.list[i].r4 == '' || response.data.list[i].r4 == undefined) {
  3379. response.data.list[i].r4 = 0
  3380. }
  3381. 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))
  3382. response.data.list[i].sumr = formatNum(response.data.list[i].sumr, 2)
  3383. }
  3384. this.download.list = response.data.list
  3385. } else {
  3386. this.download.list = []
  3387. }
  3388. if (this.table.isRW1 == true && this.table.isRW2 == false && this.table.isRW3 == false && this.table.isRW4 == false) {
  3389. var excelDatas = [
  3390. {
  3391. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '总比例', '投喂量', '配方重量', '补料重量'],
  3392. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'sumr', 'feedweight', 'ftweight', 'supplyweight'],
  3393. tableDatas: this.download.list,
  3394. sheetName: 'Sheet1'
  3395. }
  3396. ]
  3397. } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == false && this.table.isRW4 == false) {
  3398. var excelDatas = [
  3399. {
  3400. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '总比例', '投喂量', '配方重量', '补料重量'],
  3401. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'sumr', 'feedweight', 'ftweight', 'supplyweight'],
  3402. tableDatas: this.download.list,
  3403. sheetName: 'Sheet1'
  3404. }
  3405. ]
  3406. } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == true && this.table.isRW4 == false) {
  3407. var excelDatas = [
  3408. {
  3409. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '总比例', '投喂量', '配方重量', '补料重量'],
  3410. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'sumr', 'feedweight', 'ftweight', 'supplyweight'],
  3411. tableDatas: this.download.list,
  3412. sheetName: 'Sheet1'
  3413. }
  3414. ]
  3415. } else {
  3416. var excelDatas = [
  3417. {
  3418. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量', '总比例', '投喂量', '配方重量', '补料重量'],
  3419. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'r4', 'w4', 'sumr', 'feedweight', 'ftweight', 'supplyweight'],
  3420. tableDatas: this.download.list,
  3421. sheetName: 'Sheet1'
  3422. }
  3423. ]
  3424. }
  3425. json2excel(excelDatas, '栏舍配方', true, 'xlsx')
  3426. })
  3427. }
  3428. },
  3429. beforeImport(file) {
  3430. const isLt2M = file.size / 1024 / 1024 < 2
  3431. if (!isLt2M) {
  3432. this.$message.error('上传文件大小不能超过 2MB!')
  3433. }
  3434. return isLt2M
  3435. },
  3436. handleImportSuccess(res, file) {
  3437. this.getList()
  3438. if (res.msg === 'ok') {
  3439. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  3440. if (res.data.err_count > 0) {
  3441. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  3442. import('@/vendor/Export2Excel').then(excel => {
  3443. const list1 = res.data.result
  3444. const tHeader = [
  3445. '栏舍名称', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '错误信息'
  3446. ]
  3447. const filterVal = [
  3448. '栏舍名称', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', 'error_msg'
  3449. ]
  3450. const data1 = this.formatJson(filterVal, list1)
  3451. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '栏舍配方导入报错信息', autoWidth: true, bookType: 'xlsx' })
  3452. })
  3453. }
  3454. } else {
  3455. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  3456. }
  3457. },
  3458. formatJson(filterVal, jsonData) {
  3459. return jsonData.map(v =>
  3460. filterVal.map(j => {
  3461. if (j === 'timestamp') {
  3462. return parseTime(v[j])
  3463. } else {
  3464. return v[j]
  3465. }
  3466. })
  3467. )
  3468. },
  3469. // 干物质调节
  3470. handleDryMatterRegulation() {
  3471. console.log('干物质调节')
  3472. this.isShowDialog = true
  3473. this.$refs.mychild.getBalconicFormula()
  3474. this.$refs.mychild.restTemp()
  3475. }
  3476. }
  3477. }
  3478. </script>
  3479. <style lang="scss" scoped>
  3480. .search {
  3481. clear: both;
  3482. }
  3483. .table {
  3484. margin-top: 10px;
  3485. }
  3486. </style>
  3487. <style lang="scss">
  3488. .red-row{
  3489. background: red !important;
  3490. }
  3491. </style>