7814b9c8a89565f3eea62cbdfd71d2fc3fbf4b75.svn-base 160 KB

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