bb50fbd01b562ae5f9d1e2b358d4b6cd0170611d.svn-base 167 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365
  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(row.feedweight) - 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(row.feedweight) - 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(row.feedweight) - 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. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  1752. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100)
  1753. row.w4 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), 2)
  1754. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100)
  1755. if (row.w3 <= 0) {
  1756. row.w3 = 0
  1757. row.r3 = 0
  1758. }
  1759. if (row.w4 <= 0) {
  1760. row.w4 = 0
  1761. row.r4 = 0
  1762. }
  1763. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1764. }
  1765. // 3班锁定,2班4班未锁
  1766. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1767. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1768. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  1769. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1770. row.w4 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), 2)
  1771. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  1772. if (row.w2 <= 0) {
  1773. row.w2 = 0
  1774. row.r2 = 0
  1775. }
  1776. if (row.w4 <= 0) {
  1777. row.w4 = 0
  1778. row.r4 = 0
  1779. }
  1780. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1781. }
  1782. // 4班锁定,2班3班未锁
  1783. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1784. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1785. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), 2)
  1786. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1787. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), 2)
  1788. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1789. if (row.w2 <= 0) {
  1790. row.w2 = 0
  1791. row.r2 = 0
  1792. }
  1793. if (row.w3 <= 0) {
  1794. row.w3 = 0
  1795. row.r3 = 0
  1796. }
  1797. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1798. }
  1799. // 2班3班4班未锁
  1800. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1801. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1802. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  1803. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1804. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  1805. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1806. row.w4 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  1807. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  1808. if (row.w2 <= 0) {
  1809. row.w2 = 0
  1810. row.r2 = 0
  1811. }
  1812. if (row.w3 <= 0) {
  1813. row.w3 = 0
  1814. row.r3 = 0
  1815. }
  1816. if (row.w4 <= 0) {
  1817. row.w4 = 0
  1818. row.r4 = 0
  1819. }
  1820. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1821. }
  1822. } else if (this.table.RWLength == 3) {
  1823. // 三班
  1824. // 2班/3班锁定
  1825. if (row.isTwoWeight == true && row.isThreeWeight == true) {
  1826. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1827. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  1828. }
  1829. // 2班不锁3班锁
  1830. if (row.isTwoWeight == false && row.isThreeWeight == true) {
  1831. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1832. row.w2 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3), 2)
  1833. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1834. if (row.w2 <= 0) {
  1835. row.w2 = 0
  1836. row.r2 = 0
  1837. }
  1838. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  1839. }
  1840. // 3班不锁2班锁
  1841. if (row.isTwoWeight == true && row.isThreeWeight == false) {
  1842. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1843. row.w3 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2), 2)
  1844. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1845. if (row.w3 <= 0) {
  1846. row.w3 = 0
  1847. row.r3 = 0
  1848. }
  1849. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  1850. }
  1851. // 2班3班都不锁
  1852. if (row.isTwoWeight == false && row.isThreeWeight == false) {
  1853. console.log(row.w1,'w1----------')
  1854. console.log(row.feedweight,'feedweight----------')
  1855. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1856. console.log(this.focusWRow,'r1----------')
  1857. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), 2)
  1858. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1859. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), 2)
  1860. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1861. if (row.w3 <= 0) {
  1862. row.w3 = 0
  1863. row.r3 = 0
  1864. }
  1865. if (row.w2 <= 0) {
  1866. row.w2 = 0
  1867. row.r2 = 0
  1868. }
  1869. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  1870. }
  1871. } else if (this.table.RWLength == 2) {
  1872. // 两班isOneWeight,isTwoWeight
  1873. if (row.w1 == '') { row.w1 = 0 }
  1874. if (row.w2 == '') { row.w2 = 0 }
  1875. if (row.r1 == '') { row.r1 = 0 }
  1876. if (row.r2 == '') { row.r2 = 0 }
  1877. if (row.isTwoWeight == false) {
  1878. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1879. row.w2 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1), 2)
  1880. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1881. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1882. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), 2))
  1883. } else {
  1884. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1885. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), 2))
  1886. }
  1887. }
  1888. if (row.w1 == '') { row.w1 = 0 }
  1889. if (row.w2 == '') { row.w2 = 0 }
  1890. if (row.w3 == '') { row.w3 = 0 }
  1891. if (row.w4 == '') { row.w4 = 0 }
  1892. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1893. row.dailyWeight = formatNum(row.dailyWeight, 2)
  1894. },
  1895. blurW2(row) {
  1896. // 2班重量
  1897. if (row.w1 == '') {
  1898. row.w1 = 0
  1899. }
  1900. if (row.w2 == '') {
  1901. row.w2 = 0
  1902. }
  1903. if (row.w3 == '') {
  1904. row.w3 = 0
  1905. }
  1906. if (row.w4 == '') {
  1907. row.w4 = 0
  1908. }
  1909. if (row.r1 == '') {
  1910. row.r1 = 0
  1911. }
  1912. if (row.r2 == '') {
  1913. row.r2 = 0
  1914. }
  1915. if (row.r3 == '') {
  1916. row.r3 = 0
  1917. }
  1918. if (row.r4 == '') {
  1919. row.r4 = 0
  1920. }
  1921. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1922. console.log(row, '=======投喂量feedweight')
  1923. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1924. if (this.table.RWLength == 4) {
  1925. // 四班
  1926. // 1班3班4班都锁定
  1927. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1928. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1929. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1930. }
  1931. // 1班3班锁定4班未锁定
  1932. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1933. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1934. row.w4 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  1935. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  1936. if (row.w4 <= 0) {
  1937. row.w4 = 0
  1938. row.r4 = 0
  1939. }
  1940. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1941. }
  1942. // 1班4班锁定3班未锁定
  1943. if (row.isOneWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1944. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1945. row.w3 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), 2)
  1946. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1947. if (row.w3 <= 0) {
  1948. row.w3 = 0
  1949. row.r3 = 0
  1950. }
  1951. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1952. }
  1953. // 3班4班锁定1班未锁定
  1954. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1955. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1956. row.w1 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), 2)
  1957. row.r1 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1958. if (row.w1 <= 0) {
  1959. row.w1 = 0
  1960. row.r1 = 0
  1961. }
  1962. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1963. }
  1964. // 1班锁定,3班4班未锁
  1965. if (row.isOneWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1966. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1967. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), 2)
  1968. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  1969. row.w4 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), 2)
  1970. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  1971. if (row.w3 <= 0) {
  1972. row.w3 = 0
  1973. row.r3 = 0
  1974. }
  1975. if (row.w4 <= 0) {
  1976. row.w4 = 0
  1977. row.r4 = 0
  1978. }
  1979. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1980. }
  1981. // 3班锁定,1班4班未锁
  1982. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1983. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  1984. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2)), 2)
  1985. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  1986. row.w4 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r2)), 2)
  1987. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  1988. if (row.w1 <= 0) {
  1989. row.w1 = 0
  1990. row.r1 = 0
  1991. }
  1992. if (row.w4 <= 0) {
  1993. row.w4 = 0
  1994. row.r4 = 0
  1995. }
  1996. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  1997. }
  1998. // 4班锁定,1班3班未锁
  1999. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  2000. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2001. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r3)), 2)
  2002. row.r1 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2003. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r3)), 2)
  2004. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2005. if (row.w1 <= 0) {
  2006. row.w1 = 0
  2007. row.r1 = 0
  2008. }
  2009. if (row.w3 <= 0) {
  2010. row.w3 = 0
  2011. row.r3 = 0
  2012. }
  2013. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2014. }
  2015. // 1班3班4班未锁
  2016. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  2017. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2018. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2019. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2020. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2021. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2022. row.w4 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2023. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2024. if (row.w1 <= 0) {
  2025. row.w1 = 0
  2026. row.r1 = 0
  2027. }
  2028. if (row.w3 <= 0) {
  2029. row.w3 = 0
  2030. row.r3 = 0
  2031. }
  2032. if (row.w4 <= 0) {
  2033. row.w4 = 0
  2034. row.r4 = 0
  2035. }
  2036. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2037. }
  2038. } else if (this.table.RWLength == 3) {
  2039. // 三班
  2040. // 1班/3班锁定
  2041. if (row.isOneWeight == true && row.isThreeWeight == true) {
  2042. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2043. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2044. }
  2045. // 1班不锁3班锁
  2046. if (row.isOneWeight == false && row.isThreeWeight == true) {
  2047. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2048. row.w1 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  2049. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2050. if (row.w1 <= 0) {
  2051. row.w1 = 0
  2052. row.r1 = 0
  2053. }
  2054. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2055. }
  2056. // 3班不锁1班锁
  2057. if (row.isOneWeight == true && row.isThreeWeight == false) {
  2058. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2059. row.w3 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2), 2)
  2060. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2061. if (row.w3 <= 0) {
  2062. row.w3 = 0
  2063. row.r3 = 0
  2064. }
  2065. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2066. }
  2067. // 1班3班都不锁
  2068. if (row.isOneWeight == false && row.isThreeWeight == false) {
  2069. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2070. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), 2)
  2071. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2072. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3)), 2)
  2073. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2074. if (row.w3 <= 0) {
  2075. row.w3 = 0
  2076. row.r3 = 0
  2077. }
  2078. if (row.w1 <= 0) {
  2079. row.w1 = 0
  2080. row.r1 = 0
  2081. }
  2082. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2083. }
  2084. } else if (this.table.RWLength == 2) {
  2085. // 两班
  2086. if (row.isTwoWeight == false) {
  2087. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2088. row.w1 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w2), 2)
  2089. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2090. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2091. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), 2))
  2092. } else {
  2093. row.r2 = parseFloat(row.w2) / parseFloat(row.feedweight) * 100
  2094. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), 2))
  2095. }
  2096. }
  2097. if (row.w1 == '') { row.w1 = 0 }
  2098. if (row.w2 == '') { row.w2 = 0 }
  2099. if (row.w3 == '') { row.w3 = 0 }
  2100. if (row.w4 == '') { row.w4 = 0 }
  2101. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2102. row.dailyWeight = formatNum(row.dailyWeight, 2)
  2103. },
  2104. blurW3(row) {
  2105. // 3班重量
  2106. if (row.w1 == '') {
  2107. row.w1 = 0
  2108. }
  2109. if (row.w2 == '') {
  2110. row.w2 = 0
  2111. }
  2112. if (row.w3 == '') {
  2113. row.w3 = 0
  2114. }
  2115. if (row.w4 == '') {
  2116. row.w4 = 0
  2117. }
  2118. if (row.r1 == '') {
  2119. row.r1 = 0
  2120. }
  2121. if (row.r2 == '') {
  2122. row.r2 = 0
  2123. }
  2124. if (row.r3 == '') {
  2125. row.r3 = 0
  2126. }
  2127. if (row.r4 == '') {
  2128. row.r4 = 0
  2129. }
  2130. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2131. console.log(row, '=======投喂量feedweight')
  2132. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2133. if (this.table.RWLength == 4) {
  2134. // 四班
  2135. // 1班2班4班都锁定
  2136. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == true) {
  2137. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2138. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2139. }
  2140. // 1班2班锁定4班未锁定
  2141. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == false) {
  2142. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2143. row.w4 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  2144. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2145. if (row.w4 <= 0) {
  2146. row.w4 = 0
  2147. row.r4 = 0
  2148. }
  2149. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2150. }
  2151. // 2班4班锁定1班未锁定
  2152. if (row.isOneWeight == false && row.isTwoWeight == true && row.isFourWeight == true) {
  2153. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2154. row.w1 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), 2)
  2155. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2156. if (row.w1 <= 0) {
  2157. row.w1 = 0
  2158. row.r1 = 0
  2159. }
  2160. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2161. }
  2162. // 1班4班锁定2班未锁定
  2163. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == true) {
  2164. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2165. row.w2 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), 2)
  2166. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2167. if (row.w2 <= 0) {
  2168. row.w2 = 0
  2169. row.r2 = 0
  2170. }
  2171. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2172. }
  2173. // 2班锁定,1班4班未锁
  2174. if (row.isTwoWeight == true && row.isOneWeight == false && row.isFourWeight == false) {
  2175. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2176. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r4)), 2)
  2177. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2178. row.w4 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r4)), 2)
  2179. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2180. if (row.w1 <= 0) {
  2181. row.w1 = 0
  2182. row.r1 = 0
  2183. }
  2184. if (row.w4 <= 0) {
  2185. row.w4 = 0
  2186. row.r4 = 0
  2187. }
  2188. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2189. }
  2190. // 1班锁定,2班4班未锁
  2191. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == false) {
  2192. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2193. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  2194. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2195. row.w4 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), 2)
  2196. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2197. if (row.w2 <= 0) {
  2198. row.w2 = 0
  2199. row.r2 = 0
  2200. }
  2201. if (row.w4 <= 0) {
  2202. row.w4 = 0
  2203. row.r4 = 0
  2204. }
  2205. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2206. }
  2207. // 4班锁定,2班1班未锁
  2208. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == true) {
  2209. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2210. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2)), 2)
  2211. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2212. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r2)), 2)
  2213. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2214. if (row.w2 <= 0) {
  2215. row.w2 = 0
  2216. row.r2 = 0
  2217. }
  2218. if (row.w1 <= 0) {
  2219. row.w1 = 0
  2220. row.r1 = 0
  2221. }
  2222. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2223. }
  2224. // 2班1班4班未锁
  2225. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == false) {
  2226. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2227. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  2228. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2229. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  2230. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2231. row.w4 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4)), 2)
  2232. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2233. if (row.w1 <= 0) {
  2234. row.w1 = 0
  2235. row.r1 = 0
  2236. }
  2237. if (row.w2 <= 0) {
  2238. row.w2 = 0
  2239. row.r2 = 0
  2240. }
  2241. if (row.w4 <= 0) {
  2242. row.w4 = 0
  2243. row.r4 = 0
  2244. }
  2245. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2246. }
  2247. } else if (this.table.RWLength == 3) {
  2248. // 三班
  2249. // 1班/2班锁定
  2250. if (row.isOneWeight == true && row.isTwoWeight == true) {
  2251. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2252. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2253. }
  2254. // 1班不锁2班锁
  2255. if (row.isOneWeight == false && row.isTwoWeight == true) {
  2256. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2257. row.w1 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  2258. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2259. if (row.w1 <= 0) {
  2260. row.w1 = 0
  2261. row.r1 = 0
  2262. }
  2263. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2264. }
  2265. // 3班不锁2班锁
  2266. // 2班不锁1班锁
  2267. if (row.isOneWeight == true && row.isTwoWeight == false) {
  2268. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2269. row.w2 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3), 2)
  2270. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2271. if (row.w2 <= 0) {
  2272. row.w2 = 0
  2273. row.r2 = 0
  2274. }
  2275. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2276. }
  2277. // 2班3班都不锁
  2278. // 1班2班都不锁
  2279. if (row.isOneWeight == false && row.isTwoWeight == false) {
  2280. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2281. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2)), 2)
  2282. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2283. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), 2)
  2284. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2285. if (row.w1 <= 0) {
  2286. row.w1 = 0
  2287. row.r1 = 0
  2288. }
  2289. if (row.w2 <= 0) {
  2290. row.w2 = 0
  2291. row.r2 = 0
  2292. }
  2293. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), 2))
  2294. }
  2295. }
  2296. if (row.w1 == '') { row.w1 = 0 }
  2297. if (row.w2 == '') { row.w2 = 0 }
  2298. if (row.w3 == '') { row.w3 = 0 }
  2299. if (row.w4 == '') { row.w4 = 0 }
  2300. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2301. row.dailyWeight = formatNum(row.dailyWeight, 2)
  2302. },
  2303. blurW4(row) {
  2304. if (row.w1 == '') {
  2305. row.w1 = 0
  2306. }
  2307. if (row.w2 == '') {
  2308. row.w2 = 0
  2309. }
  2310. if (row.w3 == '') {
  2311. row.w3 = 0
  2312. }
  2313. if (row.w4 == '') {
  2314. row.w4 = 0
  2315. }
  2316. if (row.r1 == '') {
  2317. row.r1 = 0
  2318. }
  2319. if (row.r2 == '') {
  2320. row.r2 = 0
  2321. }
  2322. if (row.r3 == '') {
  2323. row.r3 = 0
  2324. }
  2325. if (row.r4 == '') {
  2326. row.r4 = 0
  2327. }
  2328. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2329. console.log(row, '=======投喂量feedweight')
  2330. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2331. if (this.table.RWLength == 4) {
  2332. // 四班
  2333. // 1班2班3班都锁定
  2334. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == true) {
  2335. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2336. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2337. }
  2338. // 2班3班锁定1班未锁定
  2339. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == true) {
  2340. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2341. row.w1 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3), 2)
  2342. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2343. if (row.w1 <= 0) {
  2344. row.w1 = 0
  2345. row.r1 = 0
  2346. }
  2347. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2348. }
  2349. // 2班1班锁定3班未锁定
  2350. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == false) {
  2351. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2352. row.w3 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), 2)
  2353. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2354. if (row.w3 <= 0) {
  2355. row.w3 = 0
  2356. row.r3 = 0
  2357. }
  2358. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2359. }
  2360. // 3班1班锁定2班未锁定
  2361. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == true) {
  2362. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2363. row.w2 = formatNum(parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), 2)
  2364. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2365. if (row.w2 <= 0) {
  2366. row.w2 = 0
  2367. row.r2 = 0
  2368. }
  2369. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2370. }
  2371. // 2班锁定,3班1班未锁
  2372. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == false) {
  2373. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2374. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2375. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2376. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r1)), 2)
  2377. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2378. if (row.w3 <= 0) {
  2379. row.w3 = 0
  2380. row.r3 = 0
  2381. }
  2382. if (row.w1 <= 0) {
  2383. row.w1 = 0
  2384. row.r1 = 0
  2385. }
  2386. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2387. }
  2388. // 3班锁定,2班1班未锁
  2389. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == true) {
  2390. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2391. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r1)), 2)
  2392. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2393. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r1)), 2)
  2394. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2395. if (row.w2 <= 0) {
  2396. row.w2 = 0
  2397. row.r2 = 0
  2398. }
  2399. if (row.w1 <= 0) {
  2400. row.w1 = 0
  2401. row.r1 = 0
  2402. }
  2403. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2404. }
  2405. // 1班锁定,2班3班未锁
  2406. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == false) {
  2407. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2408. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), 2)
  2409. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2410. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), 2)
  2411. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2412. if (row.w2 <= 0) {
  2413. row.w2 = 0
  2414. row.r2 = 0
  2415. }
  2416. if (row.w3 <= 0) {
  2417. row.w3 = 0
  2418. row.r3 = 0
  2419. }
  2420. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2421. }
  2422. // 2班3班1班未锁
  2423. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == false) {
  2424. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, 2)
  2425. row.w1 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2426. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, 2)
  2427. row.w2 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2428. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, 2)
  2429. row.w3 = formatNum((parseFloat(row.feedweight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1)), 2)
  2430. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, 2)
  2431. if (row.w1 <= 0) {
  2432. row.w1 = 0
  2433. row.r1 = 0
  2434. }
  2435. if (row.w2 <= 0) {
  2436. row.w2 = 0
  2437. row.r2 = 0
  2438. }
  2439. if (row.w3 <= 0) {
  2440. row.w3 = 0
  2441. row.r3 = 0
  2442. }
  2443. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), 2))
  2444. }
  2445. }
  2446. if (row.w1 == '') { row.w1 = 0 }
  2447. if (row.w2 == '') { row.w2 = 0 }
  2448. if (row.w3 == '') { row.w3 = 0 }
  2449. if (row.w4 == '') { row.w4 = 0 }
  2450. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2451. row.dailyWeight = formatNum(row.dailyWeight, 2)
  2452. },
  2453. // 编辑
  2454. handleUpdate(row) {
  2455. console.log(row)
  2456. for (let i = 0; i < this.table.list.length; i++) {
  2457. if (this.table.list[i].Edit == true) {
  2458. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2459. return false
  2460. }
  2461. }
  2462. // 编辑true,不可编辑false
  2463. row.Edit = true
  2464. row.NoEdit = false
  2465. // 编辑false,编辑保存true
  2466. row.isUpdate = false
  2467. row.isUpdateSave = true
  2468. row.ftid = String(row.ftid)
  2469. if (row.ptsfid == '-1') {
  2470. row.ptsfid = ''
  2471. }
  2472. row.ptsfid = String(row.ptsfid)
  2473. // dryweight
  2474. this.table.temp.ftid = row.ftid
  2475. this.table.temp.ftname = row.ftname
  2476. this.table.temp.ptsfid = row.ptsfid
  2477. this.table.temp.ptsfname = row.ptsfname
  2478. },
  2479. updateData(row) {
  2480. console.log(row)
  2481. if (row.r1 == 'NaN') { this.$set(row, 'r1', 0) }
  2482. if (row.r2 == 'NaN') { this.$set(row, 'r2', 0) }
  2483. if (row.r3 == 'NaN') { this.$set(row, 'r3', 0) }
  2484. if (row.r4 == 'NaN') { this.$set(row, 'r4', 0) }
  2485. if (row.w1 == 'NaN') { this.$set(row, 'w1', 0) }
  2486. if (row.w2 == 'NaN') { this.$set(row, 'w2', 0) }
  2487. if (row.w3 == 'NaN') { this.$set(row, 'w3', 0) }
  2488. if (row.w4 == 'NaN') { this.$set(row, 'w4', 0) }
  2489. console.log(row)
  2490. var arr = []
  2491. for (let i = 1; i <= this.table.RWLength; i++) {
  2492. var obj = {}
  2493. obj['times'] = i
  2494. obj['pastureid'] = row.pastureid
  2495. obj['barid'] = row.barid
  2496. obj['cowcount'] = row.ccount
  2497. obj['ccountradio'] = row.ccountradio
  2498. obj['ptid'] = row.ftid
  2499. if (row.ptsfid !== '') {
  2500. obj['ptsid'] = row.ptsfid
  2501. } else {
  2502. obj['ptsid'] = '-1'
  2503. }
  2504. obj['weight'] = row['w' + i]
  2505. obj['tratio'] = Math.round(row['r' + i])
  2506. arr.push(obj)
  2507. }
  2508. if (this.table.isPtsfname == 0) {
  2509. row.ptsfid = '-1'
  2510. row.ptsfname = ''
  2511. } else {
  2512. if (row.ptsfid == '') {
  2513. row.ptsfid = '-1'
  2514. row.ptsfname = ''
  2515. }
  2516. }
  2517. if (row.supplyweight == '') {
  2518. row.supplyweight = '0'
  2519. }
  2520. if (this.table.isPtsfname == false) {
  2521. row.supplyweight = '0'
  2522. }
  2523. console.log(row, '============')
  2524. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  2525. this.$set(row, 'ccountratio', Math.floor(parseFloat(row.ccountratio) * 100) / 100)
  2526. row.ratio = String(row.ratio)
  2527. row.ccountratio = String(row.ccountratio)
  2528. row.sumr = Math.round(row.sumr)
  2529. this.table.rwList = arr
  2530. console.log('点击了编辑保存', row)
  2531. this.table.temp.pastureid = row.pastureid
  2532. this.table.temp.id = row.id
  2533. this.table.temp.barname = row.barname
  2534. this.table.temp.barid = row.barid
  2535. this.table.temp.ccount = row.ccount
  2536. this.table.temp.ratio = row.ratio
  2537. this.table.temp.ccountratio = row.ccountratio
  2538. this.table.temp.ftid = row.ftid
  2539. this.table.temp.ftname = row.ftname
  2540. this.table.temp.ptsfid = row.ptsfid
  2541. this.table.temp.ptsfname = row.ptsfname
  2542. this.table.temp.ftweight = row.ftweight
  2543. this.table.temp.supplyweight = row.supplyweight
  2544. this.table.temp.feedweight = row.feedweight
  2545. this.table.temp.owner = row.owner
  2546. this.table.temp.sumr = row.sumr
  2547. if (row.softccount == '') {
  2548. row.softccount = 0
  2549. }
  2550. if (row.r1 == '') {
  2551. row.r1 = 0
  2552. }
  2553. if (row.r2 == '') {
  2554. row.r2 = 0
  2555. }
  2556. if (row.r3 == '') {
  2557. row.r3 = 0
  2558. }
  2559. if (row.r4 == '') {
  2560. row.r4 = 0
  2561. }
  2562. if (row.w1 == '') {
  2563. row.w1 = 0
  2564. }
  2565. if (row.w2 == '' || row.w4 == NaN) {
  2566. row.w2 = 0
  2567. }
  2568. if (row.w3 == '' || row.w4 == NaN) {
  2569. row.w3 = 0
  2570. }
  2571. if (row.w4 == '' || row.w4 == NaN) {
  2572. row.w4 = 0
  2573. }
  2574. console.log(row, '===========')
  2575. this.table.temp.softccount = row.softccount
  2576. this.table.temp.r1 = Math.round(row.r1)
  2577. this.table.temp.r2 = Math.round(row.r2)
  2578. this.table.temp.r3 = Math.round(row.r3)
  2579. this.table.temp.r4 = Math.round(row.r4)
  2580. this.table.temp.w1 = row.w1
  2581. this.table.temp.w2 = row.w2
  2582. this.table.temp.w3 = row.w3
  2583. this.table.temp.w4 = row.w4
  2584. if (this.table.temp.ccount == '' && this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2585. this.$message({ type: 'error', message: '实际牛头数/系数/系数头数/配方模版不能为空', duration: 2000 })
  2586. return false
  2587. }
  2588. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2589. this.$message({ type: 'error', message: '系数/系数头数/配方模版不能为空', duration: 2000 })
  2590. return false
  2591. }
  2592. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2593. this.$message({ type: 'error', message: '系数头数/配方模版不能为空', duration: 2000 })
  2594. return false
  2595. }
  2596. console.log(this.table.temp.ccount, '实际牛头数不能为空')
  2597. if (this.table.temp.ccount == '') {
  2598. this.$message({ type: 'error', message: '实际牛头数不能为空', duration: 2000 })
  2599. return false
  2600. }
  2601. if (this.table.temp.ratio == '') {
  2602. this.$message({ type: 'error', message: '系数不能为空', duration: 2000 })
  2603. return false
  2604. }
  2605. if (this.table.temp.ccountratio == '') {
  2606. this.$message({ type: 'error', message: '系数头数不能为空', duration: 2000 })
  2607. return false
  2608. }
  2609. if (this.table.temp.ftid == '') {
  2610. this.$message({ type: 'error', message: '配方模版不能为空', duration: 2000 })
  2611. return false
  2612. }
  2613. const positiveInteger = /^[0-9]\d*$/
  2614. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  2615. this.$message({
  2616. type: 'error',
  2617. message: '实际牛头数请输入正整数',
  2618. duration: 2000
  2619. })
  2620. return false
  2621. }
  2622. this.isokDisable = true
  2623. setTimeout(() => {
  2624. this.isokDisable = false
  2625. }, 1000)
  2626. // this.requestParam.parammaps = this.table.temp
  2627. this.requestParam.common = {
  2628. 'returnmap': '0'
  2629. }
  2630. this.requestParam.data = []
  2631. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  2632. pastureid: row.pastureid,
  2633. id: row.id,
  2634. barname: row.barname,
  2635. barid: row.barid,
  2636. softccount: row.softccount,
  2637. ccount: row.ccount,
  2638. ratio: row.ratio,
  2639. ccountratio: row.ccountratio,
  2640. ftid: row.ftid,
  2641. ftname: row.ftname,
  2642. ptsfid: row.ptsfid,
  2643. ptsfname: row.ptsfname,
  2644. ftweight: row.ftweight,
  2645. supplyweight: row.supplyweight,
  2646. feedweight: row.feedweight,
  2647. owner: row.owner,
  2648. sumr: row.sumr
  2649. }}
  2650. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  2651. this.requestParam.data[1].children = []
  2652. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  2653. pastureid: '@insertSpotList.pastureid',
  2654. barname: row.barname,
  2655. barid: '@insertSpotList.barid',
  2656. times: '@insertSpotList.times',
  2657. tratio: '@insertSpotList.tratio',
  2658. weight: '@insertSpotList.weight',
  2659. cowcount: '@insertSpotList.cowcount',
  2660. ccountradio: row.ccountratio,
  2661. ptid: '@insertSpotList.ptid',
  2662. ptsid: '@insertSpotList.ptsid',
  2663. feedweight: row.feedweight,
  2664. supplyweight: row.supplyweight,
  2665. ratio: row.ratio
  2666. }}
  2667. this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  2668. pastureid: row.pastureid,
  2669. fpid: row.id
  2670. }}
  2671. ExecDataByConfig(this.requestParam).then(response => {
  2672. console.log('编辑保存发送参数', this.requestParam)
  2673. if (response.msg === 'fail') {
  2674. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2675. } else {
  2676. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2677. this.getList()
  2678. this.reload()
  2679. }
  2680. })
  2681. },
  2682. updateCancel(row) {
  2683. console.log('点击了编辑取消')
  2684. // 编辑false,不可编辑true
  2685. row.Edit = false
  2686. row.NoEdit = true
  2687. // 编辑true,编辑保存false
  2688. row.isUpdate = true
  2689. row.isUpdateSave = false
  2690. this.reload()
  2691. console.log(this.table.getdataListParm.offset)
  2692. this.table.getdataListParm.offset = this.table.getdataListParm.offset
  2693. this.getList()
  2694. // this.$router.push('/formulationPlan/dhedFormula')
  2695. },
  2696. cellClick(row, column, event) {
  2697. console.log(column)
  2698. },
  2699. handleSelect(val) {
  2700. console.log('勾选数据', val)
  2701. this.selectList = val
  2702. },
  2703. // 营养评估
  2704. handleNutritional() {
  2705. console.log('点击了营养评估')
  2706. if (this.selectList.length !== 1) {
  2707. this.$message({ type: 'error', message: '请选择一条栏舍信息进行营养评估', duration: 2000 })
  2708. return false
  2709. } else {
  2710. console.log(this.nutritional.temp)
  2711. this.nutritional.dialogStatus = 'Nutritional'
  2712. this.nutritional.activeName = 'first'
  2713. this.nutritional.dialogFormVisible = true
  2714. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2715. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2716. this.getNutritionalList()
  2717. this.nutritional.tab1.list = []
  2718. }
  2719. },
  2720. tableRowClassName({ row }) {
  2721. // console.log(row)
  2722. if (row.isColor == '0') {
  2723. return 'red-row'
  2724. } else {
  2725. return ''
  2726. }
  2727. },
  2728. handleNutritionalTab(item) {
  2729. if (item == 'first ') {
  2730. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2731. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2732. this.getNutritionalList()
  2733. this.nutritional.tab1.list = []
  2734. } else {
  2735. console.log('牛群评估')
  2736. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2737. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2738. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2739. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2740. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2741. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2742. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2743. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2744. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2745. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2746. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2747. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2748. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2749. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2750. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2751. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2752. this.getTab2NutritionalList1()
  2753. this.getTab2NutritionalList2()
  2754. this.getTab2NutritionalList3()
  2755. this.getTab2NutritionalList4()
  2756. }
  2757. },
  2758. changeTab2Date() {
  2759. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2760. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2761. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2762. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2763. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2764. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2765. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2766. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2767. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2768. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2769. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2770. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2771. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2772. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2773. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2774. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2775. this.getTab2NutritionalList1()
  2776. this.getTab2NutritionalList2()
  2777. this.getTab2NutritionalList3()
  2778. this.getTab2NutritionalList4()
  2779. },
  2780. handleBefore() {
  2781. if (this.nutritional.activeName == 'first') {
  2782. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  2783. var start = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() - 1))
  2784. var stop = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() - 1))
  2785. this.nutritional.tab1.inputDatetime.length = 0
  2786. this.nutritional.tab1.inputDatetime.push(start, stop)
  2787. this.$forceUpdate()
  2788. }
  2789. } else {
  2790. var start2 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() - 1))
  2791. var stop2 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() - 1))
  2792. this.nutritional.tab2.inputDatetime.length = 0
  2793. this.nutritional.tab2.inputDatetime.push(start2, stop2)
  2794. this.$forceUpdate()
  2795. }
  2796. },
  2797. handleNext() {
  2798. if (this.nutritional.activeName == 'first') {
  2799. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  2800. console.log(this.nutritional.tab1.inputDatetime)
  2801. var start3 = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() + 1))
  2802. var stop3 = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() + 1))
  2803. this.nutritional.tab1.inputDatetime.length = 0
  2804. this.nutritional.tab1.inputDatetime.push(start3, stop3)
  2805. this.$forceUpdate()
  2806. }
  2807. } else {
  2808. if (this.nutritional.tab2.inputDatetime !== '' && this.nutritional.tab2.inputDatetime !== null) {
  2809. var start4 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() + 1))
  2810. var stop4 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() + 1))
  2811. this.nutritional.tab2.inputDatetime.length = 0
  2812. this.nutritional.tab2.inputDatetime.push(start4, stop4)
  2813. this.$forceUpdate()
  2814. }
  2815. }
  2816. },
  2817. getNutritionalList() {
  2818. this.nutritional.tab1.listLoading1 = true
  2819. GetDataByName(this.nutritional.tab1.getdataListParm1).then(response => {
  2820. console.log('评估上方数据', response.data.list)
  2821. if (response.data.list !== null) {
  2822. response.data.list[0].cowclassid = String(response.data.list[0].cowclassid)
  2823. this.nutritional.tab1.temp = response.data.list[0]
  2824. this.nutritional.tab1.disabledCowclass = true
  2825. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  2826. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  2827. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  2828. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  2829. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  2830. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  2831. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  2832. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  2833. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  2834. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  2835. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  2836. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  2837. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  2838. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  2839. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  2840. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  2841. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  2842. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  2843. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  2844. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  2845. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  2846. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  2847. this.getNutritionalList2()
  2848. } else {
  2849. this.nutritional.tab1.temp = []
  2850. this.nutritional.tab1.disabledCowclass = false
  2851. }
  2852. setTimeout(() => {
  2853. this.nutritional.tab1.listLoading = false
  2854. }, 100)
  2855. })
  2856. },
  2857. assessmentData() {
  2858. console.log('评估保存')
  2859. this.$refs['temp'].validate(valid => {
  2860. if (valid) {
  2861. if (this.nutritional.tab1.inputDatetime == '' || this.nutritional.tab1.inputDatetime == null) {
  2862. this.$message({ type: 'error', message: '开始日期结束日期不能为空', duration: 2000 })
  2863. return false
  2864. } else {
  2865. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  2866. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  2867. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  2868. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  2869. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  2870. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  2871. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  2872. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  2873. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  2874. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  2875. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  2876. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  2877. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  2878. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  2879. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  2880. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  2881. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  2882. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  2883. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  2884. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  2885. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  2886. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  2887. this.getNutritionalList2()
  2888. }
  2889. }
  2890. })
  2891. },
  2892. getNutritionalList2() {
  2893. this.nutritional.tab1.listLoading2 = true
  2894. GETNurJudge(this.nutritional.tab1.getdataListParm2).then(response => {
  2895. if (response.msg !== 'fail') {
  2896. if (response.data.list !== null) {
  2897. // response.data = response.data.sort(compareSort('sort'))
  2898. for (let i = 0; i < response.data.length; i++) {
  2899. var reg = RegExp(/>/)
  2900. var reg2 = RegExp(/</)
  2901. var reg3 = RegExp(/-/)
  2902. if (reg.test(response.data[i].cowneed) == true) {
  2903. const cowneed = response.data[i].cowneed.split('>')[1]
  2904. if ((parseFloat(response.data[i].ftpro) < parseFloat(cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(cowneed)) {
  2905. this.$set(response.data[i], 'isColor', '0')
  2906. } else {
  2907. this.$set(response.data[i], 'isColor', '')
  2908. }
  2909. } else if (reg2.test(response.data[i].cowneed) == true) {
  2910. const cowneed2 = response.data[i].cowneed.split('<')[1]
  2911. if ((parseFloat(response.data[i].ftpro) > parseFloat(cowneed2)) || (parseFloat(response.data[i].hprov) > parseFloat(cowneed2)) || parseFloat(response.data[i].sprov) > parseFloat(cowneed2)) {
  2912. this.$set(response.data[i], 'isColor', '0')
  2913. } else {
  2914. this.$set(response.data[i], 'isColor', '')
  2915. }
  2916. } else if (reg3.test(response.data[i].cowneed) == true) {
  2917. response.data[i].cowneed = String(response.data[i].cowneed)
  2918. if (response.data[i].cowneed.length == 1) {
  2919. const cowneed3 = response.data[i].cowneed.split('-')
  2920. console.log(cowneed3, 'cowneed3')
  2921. if (parseFloat(response.data[i].ftpro) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].ftpro) < parseFloat(cowneed3[1])) {
  2922. this.$set(response.data[i], 'isColor', '')
  2923. } else if (parseFloat(response.data[i].hprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].hprov) < parseFloat(cowneed3[1])) {
  2924. this.$set(response.data[i], 'isColor', '')
  2925. } else if (parseFloat(response.data[i].sprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].sprov) < parseFloat(cowneed3[1])) {
  2926. this.$set(response.data[i], 'isColor', '')
  2927. } else if (cowneed3[0] == '' && cowneed3[0] == '') {
  2928. this.$set(response.data[i], 'isColor', '')
  2929. } else {
  2930. this.$set(response.data[i], 'isColor', '0')
  2931. }
  2932. } else {
  2933. 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)) {
  2934. this.$set(response.data[i], 'isColor', '0')
  2935. } else {
  2936. this.$set(response.data[i], 'isColor', '')
  2937. }
  2938. }
  2939. } else {
  2940. response.data[i].cowneed = String(response.data[i].cowneed)
  2941. if (response.data[i].cowneed[0] !== '-') {
  2942. 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)) {
  2943. this.$set(response.data[i], 'isColor', '0')
  2944. } else {
  2945. this.$set(response.data[i], 'isColor', '')
  2946. }
  2947. } else {
  2948. this.$set(response.data[i], 'isColor', '')
  2949. }
  2950. }
  2951. }
  2952. console.log(response.data)
  2953. console.log('评估下方数据', response.data)
  2954. this.nutritional.tab1.list = response.data
  2955. this.nutritional.tab1.total = response.data.total
  2956. } else {
  2957. this.nutritional.tab1.list = []
  2958. }
  2959. } else {
  2960. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  2961. }
  2962. setTimeout(() => {
  2963. this.nutritional.tab1.listLoading2 = false
  2964. }, 100)
  2965. })
  2966. },
  2967. // 牛群评估
  2968. getTab2NutritionalList1() {
  2969. this.nutritional.tab2.listLoading1 = true
  2970. GetDataByName(this.nutritional.tab2.getdataListParm1).then(response => {
  2971. console.log('宾州筛分析', response.data.list)
  2972. if (response.data.list !== null) {
  2973. this.nutritional.tab2.list1 = response.data.list
  2974. this.nutritional.tab2.pageNum1 = response.data.pageNum
  2975. this.nutritional.tab2.pageSize1 = response.data.pageSize
  2976. this.nutritional.tab2.total1 = response.data.total
  2977. } else {
  2978. this.nutritional.tab2.list1 = []
  2979. }
  2980. setTimeout(() => {
  2981. this.nutritional.tab2.listLoading1 = false
  2982. }, 100)
  2983. })
  2984. },
  2985. getTab2NutritionalList2() {
  2986. this.nutritional.tab2.listLoading2 = true
  2987. GetDataByName(this.nutritional.tab2.getdataListParm2).then(response => {
  2988. console.log('粪便筛分析', response.data.list)
  2989. if (response.data.list !== null) {
  2990. this.nutritional.tab2.list2 = response.data.list
  2991. this.nutritional.tab2.pageNum2 = response.data.pageNum
  2992. this.nutritional.tab2.pageSize2 = response.data.pageSize
  2993. this.nutritional.tab2.total2 = response.data.total
  2994. } else {
  2995. this.nutritional.tab2.list2 = []
  2996. }
  2997. setTimeout(() => {
  2998. this.nutritional.tab2.listLoading2 = false
  2999. }, 100)
  3000. })
  3001. },
  3002. getTab2NutritionalList3() {
  3003. this.nutritional.tab2.listLoading3 = true
  3004. GetDataByName(this.nutritional.tab2.getdataListParm3).then(response => {
  3005. console.log('BCS评分', response.data.list)
  3006. if (response.data.list !== null) {
  3007. this.nutritional.tab2.list3 = response.data.list
  3008. this.nutritional.tab2.pageNum3 = response.data.pageNum
  3009. this.nutritional.tab2.pageSize3 = response.data.pageSize
  3010. this.nutritional.tab2.total3 = response.data.total
  3011. } else {
  3012. this.nutritional.tab2.list3 = []
  3013. }
  3014. setTimeout(() => {
  3015. this.nutritional.tab2.listLoading3 = false
  3016. }, 100)
  3017. })
  3018. },
  3019. getTab2NutritionalList4() {
  3020. this.nutritional.tab2.listLoading4 = true
  3021. GetDataByName(this.nutritional.tab2.getdataListParm4).then(response => {
  3022. console.log('粪便评分', response.data.list)
  3023. if (response.data.list !== null) {
  3024. this.nutritional.tab2.list4 = response.data.list
  3025. this.nutritional.tab2.pageNum4 = response.data.pageNum
  3026. this.nutritional.tab2.pageSize4 = response.data.pageSize
  3027. this.nutritional.tab2.total4 = response.data.total
  3028. } else {
  3029. this.nutritional.tab2.list4 = []
  3030. }
  3031. setTimeout(() => {
  3032. this.nutritional.tab2.listLoading4 = false
  3033. }, 100)
  3034. })
  3035. },
  3036. // 历史记录
  3037. handleHistoryRecords() {
  3038. console.log('点击了历史记录')
  3039. this.history.dialogStatus = 'history'
  3040. this.history.dialogFormVisible = true
  3041. this.getDateList()
  3042. },
  3043. // 历史时间
  3044. getDateList() {
  3045. GetDataByName(this.history.getdataDateParm).then(response => {
  3046. console.log('table数据', response.data.list)
  3047. if (response.data.list !== null) {
  3048. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  3049. this.getHistoryIsDisplay()
  3050. } else {
  3051. this.history.getdataListParm.parammaps.date = ''
  3052. }
  3053. })
  3054. },
  3055. getHistoryIsDisplay() {
  3056. GetDataByName(this.table.getdataListParm2).then(response => {
  3057. console.log(response.data.list[0].inforvalue)
  3058. if (response.data.list !== null) {
  3059. if (response.data.list[0].inforvalue == 0) {
  3060. this.table.isPtsfname = false
  3061. } else {
  3062. this.table.isPtsfname = true
  3063. }
  3064. }
  3065. })
  3066. GetDataByName(this.table.getdataListParm3).then(response => {
  3067. if (response.data.list !== null) {
  3068. if (response.data.list[0].inforvalue == 1) {
  3069. this.history.isRW1 = true
  3070. this.history.isRW2 = false
  3071. this.history.isRW3 = false
  3072. this.history.isRW4 = false
  3073. } else if (response.data.list[0].inforvalue == 2) {
  3074. this.history.isRW1 = true
  3075. this.history.isRW2 = true
  3076. this.history.isRW3 = false
  3077. this.history.isRW4 = false
  3078. } else if (response.data.list[0].inforvalue == 3) {
  3079. this.history.isRW1 = true
  3080. this.history.isRW2 = true
  3081. this.history.isRW3 = true
  3082. this.history.isRW4 = false
  3083. } else if (response.data.list[0].inforvalue == 4) {
  3084. this.history.isRW1 = true
  3085. this.history.isRW2 = true
  3086. this.history.isRW3 = true
  3087. this.history.isRW4 = true
  3088. }
  3089. } else {
  3090. this.history.isRW1 = false
  3091. this.history.isRW2 = false
  3092. this.history.isRW3 = false
  3093. this.history.isRW4 = false
  3094. }
  3095. })
  3096. this.getHistoryList()
  3097. },
  3098. getHistoryList() {
  3099. this.history.listLoading = true
  3100. GetDataByName(this.history.getdataListParm).then(response => {
  3101. console.log('table数据', response.data.list)
  3102. if (response.data.list !== null) {
  3103. console.log('table数据', response.data.list)
  3104. for (let i = 0; i < response.data.list.length; i++) {
  3105. if (response.data.list[i].ptid == undefined || response.data.list[i].ptname == '') {
  3106. this.$set(response.data.list[i], 'ptid', '')
  3107. this.$set(response.data.list[i], 'ptname', '')
  3108. }
  3109. }
  3110. this.history.list = response.data.list
  3111. this.handleSpan()
  3112. this.history.pageNum = response.data.pageNum
  3113. this.history.pageSize = response.data.pageSize
  3114. this.history.total = response.data.total
  3115. } else {
  3116. this.history.list = []
  3117. }
  3118. setTimeout(() => {
  3119. this.history.listLoading = false
  3120. }, 100)
  3121. })
  3122. },
  3123. handleSpan() {
  3124. this.mergekeys.forEach(key => {
  3125. this.spanObj[key] = []
  3126. let position = 0
  3127. this.history.list.forEach((item, index) => {
  3128. if (index === 0) {
  3129. this.spanObj[key].push(1)
  3130. position = 0
  3131. } else {
  3132. if (key == 'sumweight') {
  3133. if (this.history.list[index][key] === this.history.list[index - 1][key] && this.history.list[index]['barname'] === this.history.list[index - 1]['barname']) {
  3134. this.spanObj[key][position] += 1
  3135. this.spanObj[key].push(0)
  3136. } else {
  3137. this.spanObj[key].push(1)
  3138. position = index
  3139. }
  3140. } else {
  3141. if (this.history.list[index][key] === this.history.list[index - 1][key]) {
  3142. this.spanObj[key][position] += 1
  3143. this.spanObj[key].push(0)
  3144. } else {
  3145. this.spanObj[key].push(1)
  3146. position = index
  3147. }
  3148. }
  3149. }
  3150. })
  3151. })
  3152. },
  3153. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  3154. for (let i = 0; i < this.mergekeys.length; i++) {
  3155. if (column.property === this.mergekeys[i]) {
  3156. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  3157. const _col = _row > 0 ? 1 : 0
  3158. return {
  3159. rowspan: _row,
  3160. colspan: _col
  3161. }
  3162. }
  3163. }
  3164. },
  3165. changeDate() {
  3166. this.getHistoryList()
  3167. },
  3168. // 应用
  3169. handleApplication() {
  3170. console.log('点击了应用')
  3171. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  3172. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3173. }).then(() => {
  3174. this.requestParam.name = 'applyFPdate'
  3175. this.requestParam.parammaps = {}
  3176. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  3177. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  3178. PostDataByName(this.requestParam).then(response => {
  3179. if (response.msg === 'fail') {
  3180. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3181. } else {
  3182. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3183. this.getHistoryIsDisplay()
  3184. this.getList()
  3185. }
  3186. })
  3187. }).catch(() => {
  3188. this.$message({ type: 'info', message: '已取消应用' })
  3189. })
  3190. },
  3191. // 导出
  3192. handleExport(item) {
  3193. if (item == 1) {
  3194. console.log('点击了导出模板')
  3195. } else {
  3196. console.log('点击了导出数据')
  3197. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  3198. GetDataByName(this.download.getdataListParm).then(response => {
  3199. if (response.data.list !== null) {
  3200. for (let i = 0; i < response.data.list.length; i++) {
  3201. if (response.data.list[i].timesopt !== undefined) {
  3202. var timesoptArr = response.data.list[i].timesopt.split(',')
  3203. for (let j = 0; j < timesoptArr.length; j++) {
  3204. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  3205. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  3206. }
  3207. }
  3208. if (response.data.list[i].r1 == '' || response.data.list[i].r1 == undefined) {
  3209. response.data.list[i].r1 = 0
  3210. }
  3211. if (response.data.list[i].r2 == '' || response.data.list[i].r2 == undefined) {
  3212. response.data.list[i].r2 = 0
  3213. }
  3214. if (response.data.list[i].r3 == '' || response.data.list[i].r3 == undefined) {
  3215. response.data.list[i].r3 = 0
  3216. }
  3217. if (response.data.list[i].r4 == '' || response.data.list[i].r4 == undefined) {
  3218. response.data.list[i].r4 = 0
  3219. }
  3220. 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))
  3221. response.data.list[i].sumr = formatNum(response.data.list[i].sumr, 2)
  3222. }
  3223. this.download.list = response.data.list
  3224. } else {
  3225. this.download.list = []
  3226. }
  3227. if (this.table.isRW1 == true && this.table.isRW2 == false && this.table.isRW3 == false && this.table.isRW4 == false) {
  3228. var excelDatas = [
  3229. {
  3230. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '总比例', '投喂量', '配方重量', '补料重量'],
  3231. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'sumr', 'feedweight', 'ftweight', 'supplyweight'],
  3232. tableDatas: this.download.list,
  3233. sheetName: 'Sheet1'
  3234. }
  3235. ]
  3236. } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == false && this.table.isRW4 == false) {
  3237. var excelDatas = [
  3238. {
  3239. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '总比例', '投喂量', '配方重量', '补料重量'],
  3240. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'sumr', 'feedweight', 'ftweight', 'supplyweight'],
  3241. tableDatas: this.download.list,
  3242. sheetName: 'Sheet1'
  3243. }
  3244. ]
  3245. } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == true && this.table.isRW4 == false) {
  3246. var excelDatas = [
  3247. {
  3248. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '总比例', '投喂量', '配方重量', '补料重量'],
  3249. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'sumr', 'feedweight', 'ftweight', 'supplyweight'],
  3250. tableDatas: this.download.list,
  3251. sheetName: 'Sheet1'
  3252. }
  3253. ]
  3254. } else {
  3255. var excelDatas = [
  3256. {
  3257. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量', '总比例', '投喂量', '配方重量', '补料重量'],
  3258. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'r4', 'w4', 'sumr', 'feedweight', 'ftweight', 'supplyweight'],
  3259. tableDatas: this.download.list,
  3260. sheetName: 'Sheet1'
  3261. }
  3262. ]
  3263. }
  3264. json2excel(excelDatas, '栏舍配方', true, 'xlsx')
  3265. })
  3266. }
  3267. },
  3268. beforeImport(file) {
  3269. const isLt2M = file.size / 1024 / 1024 < 2
  3270. if (!isLt2M) {
  3271. this.$message.error('上传文件大小不能超过 2MB!')
  3272. }
  3273. return isLt2M
  3274. },
  3275. handleImportSuccess(res, file) {
  3276. this.getList()
  3277. if (res.msg === 'ok') {
  3278. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  3279. if (res.data.err_count > 0) {
  3280. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  3281. import('@/vendor/Export2Excel').then(excel => {
  3282. const list1 = res.data.result
  3283. const tHeader = [
  3284. '栏舍名称', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '错误信息'
  3285. ]
  3286. const filterVal = [
  3287. '栏舍名称', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', 'error_msg'
  3288. ]
  3289. const data1 = this.formatJson(filterVal, list1)
  3290. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '栏舍配方导入报错信息', autoWidth: true, bookType: 'xlsx' })
  3291. })
  3292. }
  3293. } else {
  3294. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  3295. }
  3296. },
  3297. formatJson(filterVal, jsonData) {
  3298. return jsonData.map(v =>
  3299. filterVal.map(j => {
  3300. if (j === 'timestamp') {
  3301. return parseTime(v[j])
  3302. } else {
  3303. return v[j]
  3304. }
  3305. })
  3306. )
  3307. },
  3308. // 干物质调节
  3309. handleDryMatterRegulation() {
  3310. console.log('干物质调节')
  3311. this.isShowDialog = true
  3312. this.$refs.mychild.getBalconicFormula()
  3313. this.$refs.mychild.restTemp()
  3314. }
  3315. }
  3316. }
  3317. </script>
  3318. <style lang="scss" scoped>
  3319. .search {
  3320. clear: both;
  3321. }
  3322. .table {
  3323. margin-top: 10px;
  3324. }
  3325. </style>
  3326. <style lang="scss">
  3327. .red-row{
  3328. background: red !important;
  3329. }
  3330. </style>