e25d0f565df4238c5fe2ad586bf1b896405fc3b2.svn-base 124 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630
  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="import" style="float: right;">导入</el-button>
  6. <el-dropdown style="float: right;margin-right: 10px;" @click="handleExport">
  7. <el-button class="export">导出</el-button>
  8. <el-dropdown-menu slot="dropdown">
  9. <el-dropdown-item @click.native="handleExportTemp">导出模板</el-dropdown-item>
  10. <el-dropdown-item @click.native="handleExport">导出数据</el-dropdown-item>
  11. </el-dropdown-menu>
  12. </el-dropdown>
  13. <el-button class="export" style="float: right;margin-right: 10px;" @click="handleHistoryRecords">历史记录</el-button>
  14. </div>
  15. <div class="search" />
  16. <div class="table">
  17. <el-table
  18. :key="table.tableKey"
  19. v-loading="table.listLoading"
  20. element-loading-text="给我一点时间"
  21. :data="table.list"
  22. border
  23. fit
  24. highlight-current-row
  25. style="width: 100%;"
  26. :row-style="rowStyle"
  27. :cell-style="cellStyle"
  28. class="elTable table-fixed"
  29. @header-click="headerClick"
  30. @cell-click="cellClick"
  31. @selection-change="handleSelect"
  32. >
  33. <el-table-column type="selection" width="50" />
  34. <el-table-column :key="1" label="序号" align="center" type="index" width="50px">
  35. <template slot-scope="scope">
  36. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column :key="2" label="栏舍名称" min-width="100px" align="center">
  40. <template slot-scope="scope">
  41. <span>{{ scope.row.barname }}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column :key="3" label="软件牛头数" min-width="100px" align="center">
  45. <template slot-scope="scope">
  46. <span>{{ scope.row.softccount }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column :key="4" label="实际牛头数" min-width="130px" align="center">
  50. <template slot-scope="scope">
  51. <span v-if="scope.row.NoEdit">{{ scope.row.ccount }}</span>
  52. <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)" />
  53. </template>
  54. </el-table-column>
  55. <el-table-column :key="5" label="系数(%)" min-width="130px" align="center">
  56. <template slot-scope="scope">
  57. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  58. <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)" />
  59. </template>
  60. </el-table-column>
  61. <el-table-column :key="6" label="系数头数" min-width="130px" align="center">
  62. <template slot-scope="scope">
  63. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  64. <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)" />
  65. </template>
  66. </el-table-column>
  67. <el-table-column :key="7" label="配方模板" min-width="130px" align="center">
  68. <template slot-scope="scope">
  69. <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
  70. <el-select v-if="scope.row.Edit" v-model="scope.row.ftid" filterable placeholder="配方模板" class="filter-item" style="width:95%;padding:10px 0;"@change="(value)=> {changeRecipeTemplate(value, scope.row)}">
  71. <el-option v-for="item in recipeTemplateList" :key="item.id" :label="item.tname" :value="item.id" />
  72. </el-select>
  73. </template>
  74. </el-table-column>
  75. <el-table-column v-if="table.isPtsfname" :key="8" label="补料配方" min-width="130px" align="center">
  76. <template slot-scope="scope">
  77. <span v-if="scope.row.NoEdit">{{ scope.row.ptsfname }}</span>
  78. <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)}">
  79. <el-option v-for="item in feedingFormulaList" :key="item.id" :label="item.tname" :value="item.id" />
  80. </el-select>
  81. </template>
  82. </el-table-column>
  83. <el-table-column v-if="table.isRW1" :key="9" label="第一班比例(%)" min-width="130px" align="center">
  84. <template slot-scope="scope">
  85. <span v-if="scope.row.NoEdit">{{ scope.row.r1 }}</span>
  86. <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)" />
  87. </template>
  88. </el-table-column>
  89. <el-table-column v-if="table.isRW1" :key="10" label="第一班重量" min-width="130px" align="center" :render-header="renderHeader">
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.NoEdit">{{ scope.row.w1 }}</span>
  92. <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)" />
  93. </template>
  94. </el-table-column>
  95. <el-table-column v-if="table.isRW2" :key="11" label="第二班比例(%)" min-width="130px" align="center">
  96. <template slot-scope="scope">
  97. <span v-if="scope.row.NoEdit">{{ scope.row.r2 }}</span>
  98. <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)" />
  99. </template>
  100. </el-table-column>
  101. <el-table-column v-if="table.isRW2" :key="12" label="第二班重量" min-width="130px" align="center" :render-header="renderHeader">
  102. <template slot-scope="scope">
  103. <span v-if="scope.row.NoEdit">{{ scope.row.w2 }}</span>
  104. <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)" />
  105. </template>
  106. </el-table-column>
  107. <el-table-column v-if="table.isRW3" :key="13" label="第三班比例(%)" min-width="130px" align="center">
  108. <template slot-scope="scope">
  109. <span v-if="scope.row.NoEdit">{{ scope.row.r3 }}</span>
  110. <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)" />
  111. </template>
  112. </el-table-column>
  113. <el-table-column v-if="table.isRW3" :key="14" label="第三班重量" min-width="130px" align="center" :render-header="renderHeader">
  114. <template slot-scope="scope">
  115. <span v-if="scope.row.NoEdit">{{ scope.row.w3 }}</span>
  116. <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)" />
  117. </template>
  118. </el-table-column>
  119. <el-table-column v-if="table.isRW4" :key="15" label="第四班比例(%)" min-width="130px" align="center">
  120. <template slot-scope="scope">
  121. <span v-if="scope.row.NoEdit">{{ scope.row.r4 }}</span>
  122. <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)" />
  123. </template>
  124. </el-table-column>
  125. <el-table-column v-if="table.isRW4" :key="16" label="第四班重量" min-width="130px" align="center" :render-header="renderHeader">
  126. <template slot-scope="scope">
  127. <span v-if="scope.row.NoEdit">{{ scope.row.w4 }}</span>
  128. <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)" />
  129. </template>
  130. </el-table-column>
  131. <el-table-column :key="17" label="总比例(%)" min-width="130px" align="center">
  132. <template slot-scope="scope">
  133. <span>{{ scope.row.sumr }}</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column :key="18" label="投喂量" min-width="130px" align="center">
  137. <template slot-scope="scope">
  138. <span>{{ scope.row.feedweight }}</span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column :key="19" label="配方重量" min-width="130px" align="center">
  142. <template slot-scope="scope">
  143. <span>{{ scope.row.ftweight }}</span>
  144. </template>
  145. </el-table-column>
  146. <el-table-column v-if="table.isPtsfname" :key="20" label="补料重量" min-width="130px" align="center">
  147. <template slot-scope="scope">
  148. <span>{{ scope.row.supplyweight }}</span>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  152. <template slot-scope="{row,column,event}">
  153. <!-- 编辑 -->
  154. <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  155. <!-- 编辑保存 -->
  156. <el-button v-if="row.isUpdateSave" class="miniSuccess" :disabled="isokDisable" @click="updateData(row)">保存</el-button>
  157. <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel(row)">取消</el-button>
  158. </template>
  159. </el-table-column>
  160. </el-table>
  161. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  162. </div>
  163. <!-- 历史记录 -->
  164. <el-dialog :title="textMap[history.dialogStatus]" :destroy-on-close="true" :visible.sync="history.dialogFormVisible" :close-on-click-modal="false" width="90%">
  165. <div class="app-history">
  166. <div class="search">
  167. <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" />
  168. <el-button class="successBorder" @click="handleApplication">应用</el-button>
  169. </div>
  170. <div class="table">
  171. <el-table
  172. :key="history.tableKey"
  173. v-loading="history.listLoading"
  174. element-loading-text="给我一点时间"
  175. :data="history.list"
  176. border
  177. fit
  178. highlight-current-row
  179. style="width: 100%;"
  180. :row-style="rowStyle"
  181. :cell-style="cellStyle"
  182. class="elTable table-fixed"
  183. >
  184. <el-table-column type="selection" width="50" />
  185. <el-table-column label="序号" align="center" type="index" width="50px">
  186. <template slot-scope="scope">
  187. <span>{{ scope.$index + (history.pageNum-1) * history.pageSize + 1 }}</span>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="栏舍名称" min-width="100px" align="center">
  191. <template slot-scope="scope">
  192. <span>{{ scope.row.barname }}</span>
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="软件牛头数" min-width="100px" align="center">
  196. <template slot-scope="scope">
  197. <span>{{ scope.row.softccount }}</span>
  198. </template>
  199. </el-table-column>
  200. <el-table-column label="实际牛头数" min-width="130px" align="center">
  201. <template slot-scope="scope">
  202. <span v-if="scope.row.NoEdit">{{ scope.row.ccount }}</span>
  203. <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)" />
  204. </template>
  205. </el-table-column>
  206. <el-table-column label="系数(%)" min-width="130px" align="center">
  207. <template slot-scope="scope">
  208. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  209. <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)" />
  210. </template>
  211. </el-table-column>
  212. <el-table-column label="系数头数" min-width="130px" align="center">
  213. <template slot-scope="scope">
  214. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  215. <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)" />
  216. </template>
  217. </el-table-column>
  218. <el-table-column label="配方模板" min-width="130px" align="center">
  219. <template slot-scope="scope">
  220. <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
  221. <el-select v-if="scope.row.Edit" v-model="scope.row.ftid" filterable placeholder="配方模板" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeRecipeTemplate(value, scope.row)}">
  222. <el-option v-for="item in recipeTemplateList" :key="item.id" :label="item.tname" :value="item.id" />
  223. </el-select>
  224. </template>
  225. </el-table-column>
  226. <el-table-column v-if="history.isPtsfname" label="补料配方" min-width="130px" align="center">
  227. <template slot-scope="scope">
  228. <span v-if="scope.row.NoEdit">{{ scope.row.ptsfname }}</span>
  229. <el-select v-if="scope.row.Edit" v-model="scope.row.ptsfid" filterable placeholder="补料配方" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeFeedingFormula(value, scope.row)}">
  230. <el-option v-for="item in feedingFormulaList" :key="item.id" :label="item.tname" :value="item.id" />
  231. </el-select>
  232. </template>
  233. </el-table-column>
  234. <el-table-column v-if="history.isRW1" label="第一班比例(%)" min-width="130px" align="center">
  235. <template slot-scope="scope">
  236. <span v-if="scope.row.NoEdit">{{ scope.row.r1 }}</span>
  237. <el-input v-if="scope.row.Edit" v-model="scope.row.r1" step="0.01" type="number" :disabled="scope.row.isOneWeight" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
  238. </template>
  239. </el-table-column>
  240. <el-table-column v-if="history.isRW1" label="第一班重量" min-width="130px" align="center" :render-header="renderHeader">
  241. <template slot-scope="scope">
  242. <span v-if="scope.row.NoEdit">{{ scope.row.w1 }}</span>
  243. <el-input v-if="scope.row.Edit" v-model="scope.row.w1" :disabled="scope.row.isTwoWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurW(scope.row)" />
  244. </template>
  245. </el-table-column>
  246. <el-table-column v-if="table.isRW2" label="第二班比例(%)" min-width="130px" align="center">
  247. <template slot-scope="scope">
  248. <span v-if="scope.row.NoEdit">{{ scope.row.r2 }}</span>
  249. <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)" />
  250. </template>
  251. </el-table-column>
  252. <el-table-column v-if="history.isRW2" label="第二班重量" min-width="130px" align="center" :render-header="renderHeader">
  253. <template slot-scope="scope">
  254. <span v-if="scope.row.NoEdit">{{ scope.row.w2 }}</span>
  255. <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)" />
  256. </template>
  257. </el-table-column>
  258. <el-table-column v-if="history.isRW3" label="第三班比例(%)" min-width="130px" align="center">
  259. <template slot-scope="scope">
  260. <span v-if="scope.row.NoEdit">{{ scope.row.r3 }}</span>
  261. <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)" />
  262. </template>
  263. </el-table-column>
  264. <el-table-column v-if="history.isRW3" label="第三班重量" min-width="130px" align="center" :render-header="renderHeader">
  265. <template slot-scope="scope">
  266. <span v-if="scope.row.NoEdit">{{ scope.row.w3 }}</span>
  267. <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)" />
  268. </template>
  269. </el-table-column>
  270. <el-table-column v-if="table.isRW4" label="第四班比例(%)" min-width="130px" align="center">
  271. <template slot-scope="scope">
  272. <span v-if="scope.row.NoEdit">{{ scope.row.r4 }}</span>
  273. <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)" />
  274. </template>
  275. </el-table-column>
  276. <el-table-column v-if="history.isRW4" label="第四班重量" min-width="130px" align="center" :render-header="renderHeader">
  277. <template slot-scope="scope">
  278. <span v-if="scope.row.NoEdit">{{ scope.row.w4 }}</span>
  279. <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)" />
  280. </template>
  281. </el-table-column>
  282. <el-table-column label="总比例(%)" min-width="130px" align="center">
  283. <template slot-scope="scope">
  284. <span>{{ scope.row.sumr }}</span>
  285. </template>
  286. </el-table-column>
  287. <el-table-column label="投喂量" min-width="130px" align="center">
  288. <template slot-scope="scope">
  289. <span>{{ scope.row.feedweight }}</span>
  290. </template>
  291. </el-table-column>
  292. <el-table-column label="配方重量" min-width="130px" align="center">
  293. <template slot-scope="scope">
  294. <span>{{ scope.row.ftweight }}</span>
  295. </template>
  296. </el-table-column>
  297. <el-table-column v-if="history.isPtsfname" label="补料重量" min-width="130px" align="center">
  298. <template slot-scope="scope">
  299. <span>{{ scope.row.supplyweight }}</span>
  300. </template>
  301. </el-table-column>
  302. </el-table>
  303. <pagination v-show="history.total>0" :total="history.total" :page.sync="history.getdataListParm.offset" :limit.sync="history.getdataListParm.pagecount" @pagination="getHistoryList" />
  304. </div>
  305. <div slot="footer" class="dialog-footer">
  306. <el-button class="cancel" @click="history.dialogFormVisible = false; ">关闭</el-button>
  307. </div>
  308. </div>
  309. </el-dialog>
  310. <!-- 营养评估 -->
  311. <el-dialog :title="textMap[nutritional.dialogStatus]" :destroy-on-close="true" :visible.sync="nutritional.dialogFormVisible" :close-on-click-modal="false" width="90%">
  312. <div class="app-nutritional">
  313. <h4 style="position: absolute;top:-5px;left:140px;font:18px/24px '' ;color:#303133;">栏舍:</h4>
  314. <el-form ref="temp" :rules="rules" :model="nutritional.temp" label-position="right" label-width="95px" style="width: 100%;margin-bottom:30px">
  315. <el-row>
  316. <el-col :span="4">
  317. <el-form-item label="类别" prop="cowclassid">
  318. <el-select v-model="nutritional.temp.cowclassid" :disabled="nutritional.disabledCowclass" filterable placeholder="" class="filter-item" style="width:100%;">
  319. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
  320. </el-select>
  321. </el-form-item>
  322. </el-col>
  323. <el-col :span="4">
  324. <el-form-item label="月龄" prop="avgmonthage">
  325. <el-input ref="avgmonthage" v-model="nutritional.temp.avgmonthage" class="filter-item" placeholder="" style="width:100%;" />
  326. </el-form-item>
  327. </el-col>
  328. <el-col :span="4">
  329. <el-form-item label="体重(kg)" prop="bw">
  330. <el-input ref="bw" v-model="nutritional.temp.bw" class="filter-item" placeholder="" style="width:100%;" />
  331. </el-form-item>
  332. </el-col>
  333. <el-col :span="4">
  334. <el-form-item label="日增重(kg)" prop="dayw">
  335. <el-input ref="dayw" v-model="nutritional.temp.dayw" class="filter-item" placeholder="" style="width:100%;" />
  336. </el-form-item>
  337. </el-col>
  338. <el-col :span="4">
  339. <el-form-item label="胎次(次)" prop="fetal">
  340. <el-input ref="fetal" v-model="nutritional.temp.fetal" class="filter-item" placeholder="" style="width:100%;" />
  341. </el-form-item>
  342. </el-col>
  343. <el-col :span="4">
  344. <el-form-item label="泌乳天数(天)" prop="avgdim">
  345. <el-input ref="avgdim" v-model="nutritional.temp.avgdim" class="filter-item" placeholder="" style="width:100%;" />
  346. </el-form-item>
  347. </el-col>
  348. </el-row>
  349. <el-row>
  350. <el-col :span="4">
  351. <el-form-item label="怀孕天数(天)" prop="dayspre">
  352. <el-input ref="dayspre" v-model="nutritional.temp.dayspre" class="filter-item" placeholder="" style="width:100%;" />
  353. </el-form-item>
  354. </el-col>
  355. <el-col :span="4">
  356. <el-form-item label="产奶量(kg)" prop="product">
  357. <el-input ref="product" v-model="nutritional.temp.product" class="filter-item" placeholder="" style="width:100%;" />
  358. </el-form-item>
  359. </el-col>
  360. <el-col :span="4">
  361. <el-form-item label="乳脂率(%)" prop="fat">
  362. <el-input ref="fat" v-model="nutritional.temp.fat" class="filter-item" placeholder="" style="width:100%;" />
  363. </el-form-item>
  364. </el-col>
  365. <el-col :span="4">
  366. <el-form-item label="乳蛋白率(%)" prop="pro">
  367. <el-input ref="pro" v-model="nutritional.temp.pro" class="filter-item" placeholder="" style="width:100%;" />
  368. </el-form-item>
  369. </el-col>
  370. <el-col :span="4">
  371. <el-form-item label="乳糖率(%)" prop="lactose">
  372. <el-input ref="lactose" v-model="nutritional.temp.lactose" class="filter-item" placeholder="" style="width:100%;" />
  373. </el-form-item>
  374. </el-col>
  375. <el-col :span="4">
  376. <el-form-item label="温度(℃)" prop="tem">
  377. <el-input ref="tem" v-model="nutritional.temp.tem" class="filter-item" placeholder="" style="width:100%;" />
  378. </el-form-item>
  379. </el-col>
  380. </el-row>
  381. </el-form>
  382. <div style="position: relative;height: 50px;">
  383. <el-button class="success" :disabled="isokDisable" style="position: absolute;left: 0;right: 0;margin:0 auto;" @click="assessmentData()">评估</el-button>
  384. </div>
  385. <div class="table">
  386. <el-table
  387. :key="nutritional.tableKey"
  388. v-loading="nutritional.listLoading"
  389. element-loading-text="给我一点时间"
  390. :data="nutritional.list"
  391. border
  392. fit
  393. highlight-current-row
  394. style="width: 100%;margin-bottom:60px;"
  395. :row-style="rowStyle"
  396. :cell-style="cellStyle"
  397. class="elTable table-fixed"
  398. >
  399. <el-table-column type="selection" width="50" />
  400. <el-table-column label="序号" align="center" type="index" width="50px">
  401. <template slot-scope="scope">
  402. <span>{{ scope.$index + (nutritional.pageNum-1) * nutritional.pageSize + 1 }}</span>
  403. </template>
  404. </el-table-column>
  405. <el-table-column label="指标" min-width="130px" align="center">
  406. <template slot-scope="scope">
  407. <span>{{ scope.row.standard }}</span>
  408. </template>
  409. </el-table-column>
  410. <el-table-column label="奶牛需要" min-width="130px" align="center">
  411. <template slot-scope="scope">
  412. <span>{{ scope.row.cowneed }}</span>
  413. </template>
  414. </el-table-column>
  415. <el-table-column label="饲料提供" min-width="130px" align="center">
  416. <template slot-scope="scope">
  417. <span>{{ scope.row.feedprov }}</span>
  418. </template>
  419. </el-table-column>
  420. <el-table-column label="实际执行" min-width="130px" align="center">
  421. <template slot-scope="scope">
  422. <span>{{ scope.row.actprov }}</span>
  423. </template>
  424. </el-table-column>
  425. <el-table-column label="相差" min-width="130px" align="center">
  426. <template slot-scope="scope">
  427. <span>{{ scope.row.diff }}</span>
  428. </template>
  429. </el-table-column>
  430. <el-table-column label="粗料提供" min-width="130px" align="center">
  431. <template slot-scope="scope">
  432. <span>{{ scope.row.cprov }}</span>
  433. </template>
  434. </el-table-column>
  435. <el-table-column label="精料提供" min-width="130px" align="center">
  436. <template slot-scope="scope">
  437. <span>{{ scope.row.jprov }}</span>
  438. </template>
  439. </el-table-column>
  440. </el-table>
  441. </div>
  442. <div slot="footer" class="dialog-footer">
  443. <el-button class="cancel" @click="nutritional.dialogFormVisible = false; ">关闭</el-button>
  444. </div>
  445. </div>
  446. </el-dialog>
  447. </div>
  448. </template>
  449. <script>
  450. import { GetDataByName, GetDataByNames, ExecDataByConfig, failproccess, PostDataByName } from '@/api/common'
  451. import Pagination from '@/components/Pagination'
  452. import { parseTime } from '@/utils/index.js'
  453. import { MessageBox } from 'element-ui'
  454. import Cookies from 'js-cookie'
  455. export default {
  456. inject: ['reload'],
  457. name: 'DhedFormula',
  458. components: { Pagination },
  459. data() {
  460. return {
  461. requestParams: [
  462. { name: 'getFTSWList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  463. { name: 'getFTBLList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  464. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  465. ],
  466. recipeTemplateList: [], // 配方模板
  467. feedingFormulaList: [], // 补料配方
  468. livestockTypeList: [], // 类别
  469. rules: {
  470. cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  471. },
  472. table: {
  473. getdataListParm: {
  474. name: 'getFPList',
  475. page: 1,
  476. offset: 1,
  477. pagecount: 10,
  478. returntype: 'Map',
  479. parammaps: {
  480. pastureid: Cookies.get('pastureid'),
  481. enable: ''
  482. }
  483. },
  484. tableKey: 0,
  485. list: [],
  486. total: 0,
  487. listLoading: true,
  488. temp: {},
  489. rwList: [],
  490. isPtsfname: false, // 补料配方/补料重量
  491. getdataListParm2: {
  492. name: 'getSysoptEnable',
  493. page: 1,
  494. offset: 1,
  495. pagecount: 1,
  496. returntype: 'Map',
  497. parammaps: {
  498. pastureid: Cookies.get('pastureid'),
  499. inforname: 'isEnableSupplyFeed'
  500. }
  501. },
  502. isRW1: false, // 第一班
  503. isRW2: false, // 第二班
  504. isRW3: false, // 第三班
  505. isRW4: false, // 第四班
  506. getdataListParm3: {
  507. name: 'getSysoptEnable1',
  508. page: 1,
  509. offset: 1,
  510. pagecount: 1,
  511. returntype: 'Map',
  512. parammaps: {
  513. pastureid: Cookies.get('pastureid'),
  514. inforname: 'times'
  515. }
  516. },
  517. RWLength: '' // 班次长度
  518. },
  519. selectList: [],
  520. // 营养评估
  521. nutritional: {
  522. dialogFormVisible: false,
  523. dialogStatus: '',
  524. listLoading1: true,
  525. getdataListParm1: {
  526. name: 'getnurj',
  527. page: 1,
  528. offset: 1,
  529. pagecount: 10,
  530. returntype: 'Map',
  531. parammaps: {
  532. pastureid: '',
  533. barid: ''
  534. }
  535. },
  536. disabledCowclass: false,
  537. temp: {},
  538. tableKey: 0,
  539. list: [],
  540. total2: 0,
  541. listLoading2: true,
  542. getdataListParm2: {
  543. name: 'judgenurV2',
  544. page: 1,
  545. offset: 1,
  546. pagecount: 10,
  547. returntype: 'Map',
  548. parammaps: {
  549. pastureid: '',
  550. cowclassid: ''
  551. }
  552. }
  553. },
  554. history: {
  555. dialogFormVisible: false,
  556. dialogStatus: '',
  557. temp: {},
  558. rules: {},
  559. tableKey: 0,
  560. list: [],
  561. total: 0,
  562. listLoading: true,
  563. getdataListParm: {
  564. name: 'getFPListDate',
  565. page: 1,
  566. offset: 1,
  567. pagecount: 10,
  568. returntype: 'Map',
  569. parammaps: {
  570. pastureid: Cookies.get('pastureid'),
  571. date: ''
  572. }
  573. },
  574. isPtsfname: false, // 补料配方/补料重量
  575. getdataListParm2: {
  576. name: 'getSysoptEnable',
  577. page: 1,
  578. offset: 1,
  579. pagecount: 1,
  580. returntype: 'Map',
  581. parammaps: {
  582. pastureid: Cookies.get('pastureid'),
  583. inforname: 'isEnableSupplyFeed'
  584. }
  585. },
  586. isRW1: false, // 第一班
  587. isRW2: false, // 第二班
  588. isRW3: false, // 第三班
  589. isRW4: false, // 第四班
  590. getdataListParm3: {
  591. name: 'getSysoptEnable1',
  592. page: 1,
  593. offset: 1,
  594. pagecount: 1,
  595. returntype: 'Map',
  596. parammaps: {
  597. pastureid: Cookies.get('pastureid'),
  598. inforname: 'times'
  599. }
  600. },
  601. getdataDateParm: {
  602. name: 'getFPMaxDate',
  603. page: 1,
  604. offset: 1,
  605. pagecount: 10,
  606. returntype: 'Map',
  607. parammaps: {
  608. pastureid: Cookies.get('pastureid')
  609. }
  610. }
  611. },
  612. textMap: {
  613. Nutritional: '营养评估',
  614. history: '历史记录'
  615. },
  616. focusWRow: {}, // 一班重量得到焦点暂存
  617. focusWRow2: {}, // 2班重量得到焦点暂存
  618. focusWRow3: {}, // 3班重量得到焦点暂存
  619. focusWRow4: {}, // 4班重量得到焦点暂存
  620. requestParam: {},
  621. isokDisable: false,
  622. rowStyle: {
  623. maxHeight: 50 + 'px',
  624. height: 45 + 'px'
  625. },
  626. cellStyle: {
  627. padding: 0 + 'px'
  628. }
  629. }
  630. },
  631. created() {
  632. this.getIsDisplay()
  633. this.getDownList()
  634. },
  635. methods: {
  636. getDownList() {
  637. GetDataByNames(this.requestParams).then(response => {
  638. this.recipeTemplateList = response.data.getFTSWList.list
  639. this.feedingFormulaList = response.data.getFTBLList.list
  640. this.livestockTypeList = response.data.getCowclassListEnable.list
  641. })
  642. },
  643. getIsDisplay() {
  644. GetDataByName(this.table.getdataListParm2).then(response => {
  645. console.log(response.data.list[0].inforvalue)
  646. if (response.data.list !== null) {
  647. if (response.data.list[0].inforvalue == 0) {
  648. this.table.isPtsfname = false
  649. } else {
  650. this.table.isPtsfname = true
  651. }
  652. }
  653. })
  654. GetDataByName(this.table.getdataListParm3).then(response => {
  655. console.log(response.data.list[0].inforvalue)
  656. if (response.data.list !== null) {
  657. this.table.RWLength = response.data.list[0].inforvalue
  658. if (response.data.list[0].inforvalue == 1) {
  659. this.table.isRW1 = true
  660. this.table.isRW2 = false
  661. this.table.isRW3 = false
  662. this.table.isRW4 = false
  663. } else if (response.data.list[0].inforvalue == 2) {
  664. this.table.isRW1 = true
  665. this.table.isRW2 = true
  666. this.table.isRW3 = false
  667. this.table.isRW4 = false
  668. } else if (response.data.list[0].inforvalue == 3) {
  669. this.table.isRW1 = true
  670. this.table.isRW2 = true
  671. this.table.isRW3 = true
  672. this.table.isRW4 = false
  673. } else if (response.data.list[0].inforvalue == 4) {
  674. this.table.isRW1 = true
  675. this.table.isRW2 = true
  676. this.table.isRW3 = true
  677. this.table.isRW4 = true
  678. }
  679. } else {
  680. this.table.isRW1 = false
  681. this.table.isRW2 = false
  682. this.table.isRW3 = false
  683. this.table.isRW4 = false
  684. }
  685. })
  686. this.getList()
  687. },
  688. getList() {
  689. this.table.listLoading = true
  690. GetDataByName(this.table.getdataListParm).then(response => {
  691. console.log('table数据', response.data.list)
  692. if (response.data.list !== null) {
  693. for (let i = 0; i < response.data.list.length; i++) {
  694. this.$set(response.data.list[i], 'Edit', false) // 编辑
  695. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  696. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  697. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  698. if (response.data.list[i].ftid == undefined || response.data.list[i].ftname == '') {
  699. this.$set(response.data.list[i], 'ftid', '')
  700. this.$set(response.data.list[i], 'ftname', '')
  701. }
  702. if (response.data.list[i].ptsfid == undefined || response.data.list[i].ptsfname == '') {
  703. this.$set(response.data.list[i], 'ptsfid', '')
  704. this.$set(response.data.list[i], 'ptsfname', '')
  705. }
  706. if (response.data.list[i].ccount == undefined) {
  707. this.$set(response.data.list[i], 'ccount', '')
  708. }
  709. if (response.data.list[i].softccount == undefined) {
  710. this.$set(response.data.list[i], 'softccount', '')
  711. }
  712. if (response.data.list[i].ratio == undefined) {
  713. this.$set(response.data.list[i], 'ratio', 100)
  714. }
  715. if (response.data.list[i].ccountratio == undefined) {
  716. this.$set(response.data.list[i], 'ccountratio', '')
  717. }
  718. if (response.data.list[i].r1 == undefined) {
  719. this.$set(response.data.list[i], 'r1', '')
  720. }
  721. if (response.data.list[i].r2 == undefined) {
  722. this.$set(response.data.list[i], 'r2', '')
  723. }
  724. if (response.data.list[i].r3 == undefined) {
  725. this.$set(response.data.list[i], 'r3', '')
  726. }
  727. if (response.data.list[i].r4 == undefined) {
  728. this.$set(response.data.list[i], 'r4', '')
  729. }
  730. if (response.data.list[i].w1 == undefined) {
  731. this.$set(response.data.list[i], 'w1', '')
  732. }
  733. if (response.data.list[i].w2 == undefined) {
  734. this.$set(response.data.list[i], 'w2', '')
  735. }
  736. if (response.data.list[i].w3 == undefined) {
  737. this.$set(response.data.list[i], 'w3', '')
  738. }
  739. if (response.data.list[i].w4 == undefined) {
  740. this.$set(response.data.list[i], 'w4', '')
  741. }
  742. if (response.data.list[i].supplyweight == undefined) {
  743. this.$set(response.data.list[i], 'supplyweight', '')
  744. }
  745. if (response.data.list[i].feedweight == undefined) {
  746. this.$set(response.data.list[i], 'feedweight', '')
  747. }
  748. if (response.data.list[i].Bfweight == undefined) {
  749. this.$set(response.data.list[i], 'Bfweight', '')
  750. }
  751. if (response.data.list[i].Sfweight == undefined) {
  752. this.$set(response.data.list[i], 'Sfweight', '')
  753. }
  754. if (response.data.list[i].isOneWeight == undefined) {
  755. this.$set(response.data.list[i], 'isOneWeight', false)
  756. }
  757. if (response.data.list[i].isTwoWeight == undefined) {
  758. this.$set(response.data.list[i], 'isTwoWeight', false)
  759. }
  760. if (response.data.list[i].isThreeWeight == undefined) {
  761. this.$set(response.data.list[i], 'isThreeWeight', false)
  762. }
  763. if (response.data.list[i].isFourWeight == undefined) {
  764. this.$set(response.data.list[i], 'isFourWeight', false)
  765. }
  766. if (response.data.list[i].timesopt !== undefined) {
  767. var timesoptArr = response.data.list[i].timesopt.split(',')
  768. for (let j = 0; j < timesoptArr.length; j++) {
  769. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  770. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  771. }
  772. }
  773. }
  774. // console.log(response.data.list, sumr)
  775. for (let i = 0; i < response.data.list.length; i++) {
  776. if (response.data.list[i].r1 == '') {
  777. response.data.list[i].r1 = 0
  778. }
  779. if (response.data.list[i].r2 == '') {
  780. response.data.list[i].r2 = 0
  781. }
  782. if (response.data.list[i].r3 == '') {
  783. response.data.list[i].r3 = 0
  784. }
  785. if (response.data.list[i].r4 == '') {
  786. response.data.list[i].r4 = 0
  787. }
  788. 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))
  789. response.data.list[i].sumr = response.data.list[i].sumr.toFixed(2)
  790. }
  791. this.table.list = response.data.list
  792. console.log(this.table.list, 'this.table.list')
  793. this.table.pageNum = response.data.pageNum
  794. this.table.pageSize = response.data.pageSize
  795. this.table.total = response.data.total
  796. } else {
  797. this.table.list = []
  798. }
  799. setTimeout(() => {
  800. this.table.listLoading = false
  801. }, 100)
  802. })
  803. },
  804. renderHeader(h, { column, $index }) { // h即为cerateElement的简写,具体可看vue官方文档
  805. // console.log(column)
  806. return h(
  807. 'div',
  808. [
  809. h('span', column.label),
  810. h('i', {
  811. class: 'el-icon-unlock',
  812. ref: 'el-icon-unlock',
  813. style: 'margin-left:5px;'
  814. })
  815. ]
  816. )
  817. },
  818. headerClick(column, event) {
  819. console.log(column, event)
  820. if (column.label == '第一班重量') {
  821. for (let i = 0; i < this.table.list.length; i++) {
  822. if (this.table.list[i].Edit == true) {
  823. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  824. event.target.className = 'el-icon-lock'
  825. this.$set(this.table.list[i], 'isOneWeight', true) // 锁住不可编辑
  826. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  827. event.target.className = 'el-icon-unlock'
  828. this.$set(this.table.list[i], 'isOneWeight', false) // 解锁可编辑
  829. }
  830. }
  831. }
  832. } else if (column.label == '第二班重量') {
  833. for (let i = 0; i < this.table.list.length; i++) {
  834. if (this.table.list[i].Edit == true) {
  835. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  836. event.target.className = 'el-icon-lock'
  837. this.$set(this.table.list[i], 'isTwoWeight', true) // 锁住不可编辑
  838. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  839. event.target.className = 'el-icon-unlock'
  840. this.$set(this.table.list[i], 'isTwoWeight', false) // 解锁可编辑
  841. }
  842. }
  843. }
  844. } else if (column.label == '第三班重量') {
  845. for (let i = 0; i < this.table.list.length; i++) {
  846. if (this.table.list[i].Edit == true) {
  847. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  848. event.target.className = 'el-icon-lock'
  849. this.$set(this.table.list[i], 'isThreeWeight', true) // 锁住不可编辑
  850. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  851. event.target.className = 'el-icon-unlock'
  852. this.$set(this.table.list[i], 'isThreeWeight', false) // 解锁可编辑
  853. }
  854. }
  855. }
  856. } else if (column.label == '第四班重量') {
  857. for (let i = 0; i < this.table.list.length; i++) {
  858. if (this.table.list[i].Edit == true) {
  859. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  860. event.target.className = 'el-icon-lock'
  861. this.$set(this.table.list[i], 'isFourWeight', true) // 锁住不可编辑
  862. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  863. event.target.className = 'el-icon-unlock'
  864. this.$set(this.table.list[i], 'isFourWeight', false) // 解锁可编辑
  865. }
  866. }
  867. }
  868. }
  869. },
  870. // 配方模板
  871. changeRecipeTemplate(item, row) {
  872. console.log(row.supplyweight, 'row.supplyweight')
  873. row.ftname = this.recipeTemplateList.find(obj => obj.id == item).tname
  874. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == item).Sfweight// Sfweight
  875. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == item).SfweightLock// SfweightLock
  876. // 补料重量supplyweight
  877. // 配方重量ftweight
  878. // 系数头数ccountratio
  879. // 投喂量feedweight
  880. // 实际牛头数ccount
  881. // 投喂量 = 配方重量 + 补料重量
  882. // 配方重量 = Sfweight * 系数头数 + SfweightLock * 实际牛头数ccount
  883. console.log(row.Sfweight, 'row.Sfweight')
  884. console.log(row.ccountratio, '系数头数')
  885. console.log(row.SfweightLock, 'SfweightLock')
  886. console.log(row.ccount, '实际牛头数')
  887. if (row.Sfweight !== '' && row.ccount !== '') {
  888. this.$set(row, 'ftweight', (parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)).toFixed(2))
  889. } else {
  890. row.ftweight = ''
  891. }
  892. // console.log(row.ftweight, 'row.ftweight')
  893. // console.log(row.supplyweight, 'row.supplyweight')
  894. // console.log(this.table.isPtsfname, 'isPtsfname')
  895. if (this.table.isPtsfname == false) {
  896. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  897. } else {
  898. if (row.supplyweight == 'NaN') {
  899. row.supplyweight = 0
  900. }
  901. console.log(row.supplyweight)
  902. if (row.supplyweight !== '' && row.ftweight !== '') {
  903. row.feedweight = (parseFloat(row.supplyweight) + parseFloat(row.ftweight)).toFixed(2)
  904. } else if (row.supplyweight == '' && row.ftweight !== '') {
  905. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  906. } else if (row.supplyweight !== '' && row.ftweight !== '') {
  907. row.feedweight = parseFloat(row.supplyweight).toFixed(2)
  908. }
  909. if (row.ccountratio !== '' && row.ftweight !== '') {
  910. row.ftweight = (parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)).toFixed(2)
  911. }
  912. // if (row.ccountratio !== '' && row.BLweight !== '') {
  913. // row.supplyweight = (parseFloat(row.BLweight) * parseFloat(row.ccountratio)).toFixed(2)
  914. // }
  915. // console.log(row.BLweight, row.ccountratio)
  916. if (row.Sfweight !== '' && row.ccount !== '') {
  917. this.$set(row, 'ftweight', (parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)).toFixed(2))
  918. } else {
  919. row.ftweight = ''
  920. }
  921. }
  922. console.log(row.supplyweight)
  923. if (row.supplyweight == 'NaN') { row.supplyweight = 0 }
  924. if (row.r1 !== '') { this.$set(row, 'w1', (parseFloat(row.feedweight) * (parseFloat(row.r1) / 100)).toFixed(2)) }
  925. if (row.r2 !== '') { this.$set(row, 'w2', (parseFloat(row.feedweight) * (parseFloat(row.r2) / 100)).toFixed(2)) }
  926. if (row.r3 !== '') { this.$set(row, 'w3', (parseFloat(row.feedweight) * (parseFloat(row.r3) / 100)).toFixed(2)) }
  927. if (row.r4 !== '') { this.$set(row, 'w4', (parseFloat(row.feedweight) * (parseFloat(row.r4) / 100)).toFixed(2)) }
  928. },
  929. // 补料配方
  930. changeFeedingFormula(item, row) {
  931. console.log(item, '=========')
  932. // 补料重量supplyweight
  933. // 配方重量ftweight
  934. // 系数头数ccountratio
  935. // 投喂量feedweight
  936. // 实际牛头数ccount
  937. // 投喂量 = 配方重量 + 补料重量
  938. if (item !== '') {
  939. console.log(456)
  940. row.ptsfname = this.feedingFormulaList.find(obj => obj.id == item).tname
  941. row.BLweight = this.feedingFormulaList.find(obj => obj.id == item).Sfweight
  942. row.BLSfweightLock = this.feedingFormulaList.find(obj => obj.id == item).SfweightLock
  943. } else {
  944. console.log(123)
  945. row.ptsfname = ''
  946. row.BLweight = 0
  947. row.BLSfweightLock = 0
  948. }
  949. // 配方重量 = 系数头数 * Sfweight
  950. // if (row.ccountratio !== '' && row.ftweight !== '') {
  951. // row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  952. // }
  953. // 补料重量 = 系数头数 * BLweight
  954. // console.log(row.ccountratio)
  955. // console.log(row.ccount)
  956. // console.log(row.BLweight)
  957. // console.log(row.BLSfweightLock)
  958. if (row.ccountratio !== '' && row.ccount !== '' && row.ccount.BLweight !== '' && row.BLSfweightLock !== '') {
  959. this.$set(row, 'supplyweight', (parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLSfweightLock) * parseFloat(row.ccount)).toFixed(2))
  960. } else {
  961. row.supplyweight = ''
  962. }
  963. // if (row.Sfweight !== '' && row.ccount !== '') {
  964. // this.$set(row, 'ftweight', (parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)).toFixed(2))
  965. // } else {
  966. // row.ftweight = ''
  967. // }
  968. if (this.table.isPtsfname == false) {
  969. row.feedweight = parseFloat(row.ftweight)
  970. } else {
  971. if (row.supplyweight !== '' && row.ftweight !== '') {
  972. row.feedweight = (parseFloat(row.supplyweight) + parseFloat(row.ftweight)).toFixed(2)
  973. } else if (row.supplyweight == '' && row.ftweight !== '') {
  974. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  975. } else if (row.supplyweight !== '' && row.ftweight == '') {
  976. row.feedweight = parseFloat(row.supplyweight).toFixed(2)
  977. }
  978. // if (row.ccountratio !== '' && row.ftweight !== '') {
  979. // row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  980. // }
  981. // if (row.ccountratio !== '' && row.BLweight !== '') {
  982. // row.supplyweight = parseFloat(row.BLweight) * parseFloat(row.ccountratio)
  983. // }
  984. }
  985. if (row.r1 !== '') { this.$set(row, 'w1', (parseFloat(row.feedweight) * (parseFloat(row.r1) / 100)).toFixed(2)) }
  986. if (row.r2 !== '') { this.$set(row, 'w2', (parseFloat(row.feedweight) * (parseFloat(row.r2) / 100)).toFixed(2)) }
  987. if (row.r3 !== '') { this.$set(row, 'w3', (parseFloat(row.feedweight) * (parseFloat(row.r3) / 100)).toFixed(2)) }
  988. if (row.r4 !== '') { this.$set(row, 'w4', (parseFloat(row.feedweight) * (parseFloat(row.r4) / 100)).toFixed(2)) }
  989. },
  990. // 实际牛头数失去焦点计算
  991. // ccount实际牛头数
  992. // ratio系数
  993. // ccountratio系数牛头数
  994. blurCcount(row) { // 实际牛头数
  995. console.log(row)
  996. if (row.ftid !== '-1' && row.ftid !== '') {
  997. console.log(this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight)
  998. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  999. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1000. }
  1001. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  1002. // row.ptsfid = parseInt(row.ptsfid)
  1003. row.BLweight = parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight)
  1004. row.BLweightLock = parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock)
  1005. }
  1006. if (row.ptsfid == '') {
  1007. row.BLweight = 0
  1008. row.BLweightLock = 0
  1009. }
  1010. if (row.Sfweight !== '' && row.ccount !== '') {
  1011. // console.log(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount))
  1012. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)
  1013. }
  1014. // 系数牛头数 = 实际牛头数 * 系数/100
  1015. if (row.ccount !== '' && row.ratio !== '') {
  1016. row.ccountratio = parseFloat(row.ccount) * parseFloat(row.ratio) / 100
  1017. } else if (row.ratio !== '' && row.ccountratio !== '') {
  1018. row.ccount = parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100
  1019. } else if (row.ccount !== '' || row.ratio !== '') {
  1020. row.ccountratio = ''
  1021. }
  1022. // 补料重量
  1023. console.log(row.ccountratio, row.BLweight)
  1024. if (row.BLweight == 'undefined') {
  1025. this.$set(row, 'BLweight', '')
  1026. }
  1027. console.log('BLweight', row.BLweight)
  1028. console.log('ccountratio', row.ccountratio)
  1029. console.log('BLweightLock', row.BLweightLock)
  1030. console.log('ccount', row.ccount)
  1031. if (row.ccountratio !== '' && row.BLweight !== '') {
  1032. row.supplyweight = (parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount)).toFixed(2)
  1033. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1034. row.supplyweight = ''
  1035. row.feedweight = ''
  1036. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1037. row.supplyweight = ''
  1038. row.feedweight = ''
  1039. }
  1040. // 配方重量
  1041. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1042. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)
  1043. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1044. row.ftweight = ''
  1045. row.feedweight = ''
  1046. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1047. row.ftweight = ''
  1048. row.feedweight = ''
  1049. }
  1050. if (this.table.isPtsfname == false) {
  1051. row.feedweight = parseFloat(row.ftweight)
  1052. } else {
  1053. if (row.supplyweight !== '' && row.ftweight !== '') {
  1054. row.feedweight = (parseFloat(row.supplyweight) + parseFloat(row.ftweight)).toFixed(2)
  1055. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1056. row.feedweight = parseFloat(row.supplyweight).toFixed(2)
  1057. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1058. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  1059. }
  1060. // 配方重量 = 系数头数 * Sfweight
  1061. if (row.ccountratio !== '' && row.ftweight !== '') {
  1062. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)
  1063. }
  1064. // 补料重量 = 系数头数 * BLweight
  1065. if (row.ccountratio !== '' && row.BLweight !== '') {
  1066. row.supplyweight = (parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount)).toFixed(2)
  1067. }
  1068. }
  1069. if (row.r1 !== '') { this.$set(row, 'w1', (parseFloat(row.feedweight) * (parseFloat(row.r1) / 100)).toFixed(2)) }
  1070. if (row.r2 !== '') { this.$set(row, 'w2', (parseFloat(row.feedweight) * (parseFloat(row.r2) / 100)).toFixed(2)) }
  1071. if (row.r3 !== '') { this.$set(row, 'w3', (parseFloat(row.feedweight) * (parseFloat(row.r3) / 100)).toFixed(2)) }
  1072. if (row.r4 !== '') { this.$set(row, 'w4', (parseFloat(row.feedweight) * (parseFloat(row.r4) / 100)).toFixed(2)) }
  1073. },
  1074. blurRatio(row) {
  1075. console.log(row, '--------------')
  1076. if (row.ftid !== '-1' && row.ftid !== '') {
  1077. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1078. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1079. }
  1080. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  1081. // row.ptsfid = parseInt(row.ptsfid)
  1082. row.BLweight = parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight)
  1083. row.BLweightLock = parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock)
  1084. }
  1085. if (row.ptsfid == '') {
  1086. row.BLweight = 0
  1087. row.BLweightLock = 0
  1088. }
  1089. // 系数
  1090. if (row.ccount !== '' && row.ratio !== '' && row.ccountratio !== '') {
  1091. row.ccountratio = parseFloat(row.ccount) * parseFloat(row.ratio) / 100
  1092. } else if (row.ccount !== '' && row.ccountratio !== '') {
  1093. row.ratio = (parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount)).toFixed(2)
  1094. } else if (row.ccount !== '' || row.ccountratio !== '') {
  1095. row.ratio = ''
  1096. }
  1097. // 补料重量
  1098. if (row.ccountratio !== '' && row.BLweight !== '') {
  1099. row.supplyweight = (parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount)).toFixed(2)
  1100. } else if (row.ccountratio !== '' && row.BLweight == '' || row.ccountratio == '' && row.BLweight !== '') {
  1101. row.supplyweight = ''
  1102. row.feedweight = ''
  1103. }
  1104. // 配方重量
  1105. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1106. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)
  1107. } else if (row.ccountratio !== '' && row.Sfweight == '' || row.ccountratio == '' && row.Sfweight !== '') {
  1108. row.ftweight = ''
  1109. row.feedweight = ''
  1110. }
  1111. // 投喂量
  1112. if (row.supplyweight !== '' && row.ftweight !== '') {
  1113. // row.feedweight = (parseFloat(row.supplyweight) + parseFloat(row.ftweight)).toFixed(2)
  1114. row.feedweight = (parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount)).toFixed(2)
  1115. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1116. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  1117. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1118. row.feedweight = parseFloat(row.supplyweight).toFixed(2)
  1119. }
  1120. console.log(row.supplyweight, '补料重量')
  1121. console.log(row.ftweight, '配方重量')
  1122. if (this.table.isPtsfname == false) {
  1123. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  1124. } else {
  1125. // 投喂量
  1126. if (row.supplyweight !== '' && row.ftweight !== '') {
  1127. row.feedweight = (parseFloat(row.supplyweight) + parseFloat(row.ftweight)).toFixed(2)
  1128. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1129. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  1130. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1131. row.feedweight = parseFloat(row.supplyweight).toFixed(2)
  1132. }
  1133. // 补料重量
  1134. if (row.ccountratio !== '' && row.BLweight !== '') {
  1135. row.supplyweight = (parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount)).toFixed(2)
  1136. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1137. row.supplyweight = ''
  1138. row.feedweight = ''
  1139. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1140. row.supplyweight = ''
  1141. row.feedweight = ''
  1142. }
  1143. // 配方重量
  1144. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1145. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)
  1146. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1147. row.ftweight = ''
  1148. row.feedweight = ''
  1149. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1150. row.ftweight = ''
  1151. row.feedweight = ''
  1152. }
  1153. }
  1154. if (row.r1 !== '') { this.$set(row, 'w1', (parseFloat(row.feedweight) * (parseFloat(row.r1) / 100)).toFixed(2)) }
  1155. if (row.r2 !== '') { this.$set(row, 'w2', (parseFloat(row.feedweight) * (parseFloat(row.r2) / 100)).toFixed(2)) }
  1156. if (row.r3 !== '') { this.$set(row, 'w3', (parseFloat(row.feedweight) * (parseFloat(row.r3) / 100)).toFixed(2)) }
  1157. if (row.r4 !== '') { this.$set(row, 'w4', (parseFloat(row.feedweight) * (parseFloat(row.r4) / 100)).toFixed(2)) }
  1158. },
  1159. blurCcountratio(row) {
  1160. if (row.ftid !== '-1' && row.ftid !== '') {
  1161. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1162. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1163. }
  1164. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  1165. // row.ptsfid = parseInt(row.ptsfid)
  1166. row.BLweight = parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight)
  1167. row.BLweightLock = parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock)
  1168. }
  1169. if (row.ptsfid == '') {
  1170. row.BLweight = 0
  1171. row.BLweightLock = 0
  1172. }
  1173. if (row.ptsfid == '') {
  1174. row.BLweight = 0
  1175. row.BLweightLock = 0
  1176. }
  1177. // 系数头数
  1178. if (row.ccountratio !== '' && row.ccount !== '' && row.ratio !== '') {
  1179. row.ratio = (parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount)).toFixed(2)
  1180. } else if (row.ccount !== '' && row.ratio !== '') {
  1181. row.ccountratio = parseFloat(row.ccount) * parseFloat(row.ratio) / 100
  1182. } else if (row.ccountratio !== '' && row.ccount !== '') {
  1183. row.ratio = (parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount)).toFixed(2)
  1184. } else if (row.ccountratio !== '' && row.ratio !== '') {
  1185. row.ccount = parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100
  1186. }
  1187. // 补料重量
  1188. if (row.ccountratio !== '' && row.BLweight !== '') {
  1189. row.supplyweight = (parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount)).toFixed(2)
  1190. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1191. row.supplyweight = ''
  1192. row.feedweight = ''
  1193. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1194. row.supplyweight = ''
  1195. row.feedweight = ''
  1196. }
  1197. // 配方重量
  1198. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1199. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)
  1200. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1201. row.ftweight = ''
  1202. row.feedweight = ''
  1203. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1204. row.ftweight = ''
  1205. row.feedweight = ''
  1206. }
  1207. // 投喂量
  1208. if (row.supplyweight !== '' && row.ftweight !== '') {
  1209. row.feedweight = (parseFloat(row.supplyweight) + parseFloat(row.ftweight)).toFixed(2)
  1210. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1211. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  1212. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1213. row.feedweight = parseFloat(row.supplyweight).toFixed(2)
  1214. }
  1215. if (this.table.isPtsfname == false) {
  1216. console.log(row)
  1217. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  1218. } else {
  1219. // 投喂量
  1220. if (row.supplyweight !== '' && row.ftweight !== '') {
  1221. row.feedweight = (parseFloat(row.supplyweight) + parseFloat(row.ftweight)).toFixed(2)
  1222. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1223. row.feedweight = parseFloat(row.ftweight).toFixed(2)
  1224. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1225. row.feedweight = parseFloat(row.supplyweight).toFixed(2)
  1226. }
  1227. // 补料重量
  1228. if (row.ccountratio !== '' && row.BLweight !== '') {
  1229. row.supplyweight = (parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount)).toFixed(2)
  1230. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1231. row.supplyweight = ''
  1232. row.feedweight = ''
  1233. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1234. row.supplyweight = ''
  1235. row.feedweight = ''
  1236. }
  1237. // 配方重量
  1238. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1239. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount)
  1240. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1241. row.ftweight = ''
  1242. row.feedweight = ''
  1243. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1244. row.ftweight = ''
  1245. row.feedweight = ''
  1246. }
  1247. }
  1248. if (row.r1 !== '') { this.$set(row, 'w1', (parseFloat(row.feedweight) * (parseFloat(row.r1) / 100)).toFixed(2)) }
  1249. if (row.r2 !== '') { this.$set(row, 'w2', (parseFloat(row.feedweight) * (parseFloat(row.r2) / 100)).toFixed(2)) }
  1250. if (row.r3 !== '') { this.$set(row, 'w3', (parseFloat(row.feedweight) * (parseFloat(row.r3) / 100)).toFixed(2)) }
  1251. if (row.r4 !== '') { this.$set(row, 'w4', (parseFloat(row.feedweight) * (parseFloat(row.r4) / 100)).toFixed(2)) }
  1252. },
  1253. // 总比例
  1254. blurR(row) {
  1255. if (row.r1 == '') { row.r1 = 0 }
  1256. if (row.r2 == '') { row.r2 = 0 }
  1257. if (row.r3 == '') { row.r3 = 0 }
  1258. if (row.r4 == '') { row.r4 = 0 }
  1259. if (row.r1 !== '') {
  1260. row.w1 = parseFloat(row.feedweight) * parseFloat(row.r1) / 100
  1261. row.w1 = row.w1.toFixed(2)
  1262. }
  1263. if (row.r2 !== '') {
  1264. row.w2 = parseFloat(row.feedweight) * parseFloat(row.r2) / 100
  1265. row.w2 = row.w2.toFixed(2)
  1266. }
  1267. if (row.r3 !== '') {
  1268. row.w3 = parseFloat(row.feedweight) * parseFloat(row.r3) / 100
  1269. row.w3 = row.w3.toFixed(2)
  1270. }
  1271. if (row.r4 !== '') {
  1272. row.w4 = parseFloat(row.feedweight) * parseFloat(row.r4) / 100
  1273. row.w4 = row.w4.toFixed(2)
  1274. }
  1275. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1276. },
  1277. // 一班重量得到焦点
  1278. focusW(row) {
  1279. console.log(row)
  1280. this.focusWRow = Object.assign({}, row)
  1281. },
  1282. // 1班重量得到焦点
  1283. focusW2(row) {
  1284. console.log(row)
  1285. this.focusWRow2 = Object.assign({}, row)
  1286. },
  1287. // 3班重量得到焦点
  1288. focusW3(row) {
  1289. console.log(row)
  1290. this.focusWRow3 = Object.assign({}, row)
  1291. },
  1292. // 4班重量得到焦点
  1293. focusW4(row) {
  1294. console.log(row)
  1295. this.focusWRow4 = Object.assign({}, row)
  1296. },
  1297. // 一班重量
  1298. blurW(row) {
  1299. if (row.w1 == '') {
  1300. row.w1 = 0
  1301. }
  1302. if (row.w2 == '') {
  1303. row.w2 = 0
  1304. }
  1305. if (row.w3 == '') {
  1306. row.w3 = 0
  1307. }
  1308. if (row.w4 == '') {
  1309. row.w4 = 0
  1310. }
  1311. if (row.r1 == '') {
  1312. row.r1 = 0
  1313. }
  1314. if (row.r2 == '') {
  1315. row.r2 = 0
  1316. }
  1317. if (row.r3 == '') {
  1318. row.r3 = 0
  1319. }
  1320. if (row.r4 == '') {
  1321. row.r4 = 0
  1322. }
  1323. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1324. console.log(row, '=======投喂量feedweight')
  1325. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1326. if (this.table.RWLength == 4) {
  1327. // 2班3班4班都锁定
  1328. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1329. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1330. this.$set(row, 'sumr', parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4))
  1331. }
  1332. // 2班3班锁定4班未锁定
  1333. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1334. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1335. row.w4 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1336. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1337. if (row.w4 <= 0) {
  1338. row.w4 = 0
  1339. row.r4 = 0
  1340. }
  1341. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1342. }
  1343. // 2班4班锁定3班未锁定
  1344. if (row.isTwoWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1345. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1346. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)).toFixed(2)
  1347. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1348. if (row.w3 <= 0) {
  1349. row.w3 = 0
  1350. row.r3 = 0
  1351. }
  1352. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1353. }
  1354. // 3班4班锁定2班未锁定
  1355. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1356. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1357. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  1358. row.r2 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1359. if (row.w2 <= 0) {
  1360. row.w2 = 0
  1361. row.r2 = 0
  1362. }
  1363. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1364. }
  1365. // 2班锁定,3班4班未锁
  1366. if (row.isTwoWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1367. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1368. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1369. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1370. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4))).toFixed(2)
  1371. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1372. if (row.w3 <= 0) {
  1373. row.w3 = 0
  1374. row.r3 = 0
  1375. }
  1376. if (row.w4 <= 0) {
  1377. row.w4 = 0
  1378. row.r4 = 0
  1379. }
  1380. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1381. }
  1382. // 3班锁定,2班4班未锁
  1383. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1384. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1385. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1386. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1387. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4))).toFixed(2)
  1388. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1389. if (row.w2 <= 0) {
  1390. row.w2 = 0
  1391. row.r2 = 0
  1392. }
  1393. if (row.w4 <= 0) {
  1394. row.w4 = 0
  1395. row.r4 = 0
  1396. }
  1397. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1398. }
  1399. // 4班锁定,2班3班未锁
  1400. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1401. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1402. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3))).toFixed(2)
  1403. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1404. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3))).toFixed(2)
  1405. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1406. if (row.w2 <= 0) {
  1407. row.w2 = 0
  1408. row.r2 = 0
  1409. }
  1410. if (row.w3 <= 0) {
  1411. row.w3 = 0
  1412. row.r3 = 0
  1413. }
  1414. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1415. }
  1416. // 2班3班4班未锁
  1417. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1418. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1419. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1420. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1421. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1422. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1423. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1424. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1425. if (row.w2 <= 0) {
  1426. row.w2 = 0
  1427. row.r2 = 0
  1428. }
  1429. if (row.w3 <= 0) {
  1430. row.w3 = 0
  1431. row.r3 = 0
  1432. }
  1433. if (row.w4 <= 0) {
  1434. row.w4 = 0
  1435. row.r4 = 0
  1436. }
  1437. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1438. }
  1439. } else if (this.table.RWLength == 3) {
  1440. // 三班
  1441. // 2班/3班锁定
  1442. if (row.isTwoWeight == true && row.isThreeWeight == true) {
  1443. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1444. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1445. }
  1446. // 2班不锁3班锁
  1447. if (row.isTwoWeight == false && row.isThreeWeight == true) {
  1448. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1449. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)).toFixed(2)
  1450. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1451. if (row.w2 <= 0) {
  1452. row.w2 = 0
  1453. row.r2 = 0
  1454. }
  1455. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1456. }
  1457. // 3班不锁2班锁
  1458. if (row.isTwoWeight == true && row.isThreeWeight == false) {
  1459. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1460. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)).toFixed(2)
  1461. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1462. if (row.w3 <= 0) {
  1463. row.w3 = 0
  1464. row.r3 = 0
  1465. }
  1466. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1467. }
  1468. // 2班3班都不锁
  1469. if (row.isTwoWeight == false && row.isThreeWeight == false) {
  1470. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1471. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3))).toFixed(2)
  1472. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1473. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3))).toFixed(2)
  1474. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1475. if (row.w3 <= 0) {
  1476. row.w3 = 0
  1477. row.r3 = 0
  1478. }
  1479. if (row.w2 <= 0) {
  1480. row.w2 = 0
  1481. row.r2 = 0
  1482. }
  1483. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1484. }
  1485. } else if (this.table.RWLength == 2) {
  1486. // 两班isOneWeight,isTwoWeight
  1487. if (row.w1 == '') { row.w1 = 0 }
  1488. if (row.w2 == '') { row.w2 = 0 }
  1489. if (row.r1 == '') { row.r1 = 0 }
  1490. if (row.r2 == '') { row.r2 = 0 }
  1491. if (row.isTwoWeight == false) {
  1492. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1493. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1)).toFixed(2)
  1494. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1495. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1496. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2)).toFixed(2))
  1497. } else {
  1498. row.r1 = parseFloat(row.w1) / parseFloat(row.feedweight) * 100
  1499. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2)).toFixed(2))
  1500. }
  1501. }
  1502. },
  1503. blurW2(row) {
  1504. // 2班重量
  1505. if (row.w1 == '') {
  1506. row.w1 = 0
  1507. }
  1508. if (row.w2 == '') {
  1509. row.w2 = 0
  1510. }
  1511. if (row.w3 == '') {
  1512. row.w3 = 0
  1513. }
  1514. if (row.w4 == '') {
  1515. row.w4 = 0
  1516. }
  1517. if (row.r1 == '') {
  1518. row.r1 = 0
  1519. }
  1520. if (row.r2 == '') {
  1521. row.r2 = 0
  1522. }
  1523. if (row.r3 == '') {
  1524. row.r3 = 0
  1525. }
  1526. if (row.r4 == '') {
  1527. row.r4 = 0
  1528. }
  1529. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1530. console.log(row, '=======投喂量feedweight')
  1531. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1532. if (this.table.RWLength == 4) {
  1533. // 四班
  1534. // 1班3班4班都锁定
  1535. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1536. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1537. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1538. }
  1539. // 1班3班锁定4班未锁定
  1540. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1541. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1542. row.w4 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1543. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1544. if (row.w4 <= 0) {
  1545. row.w4 = 0
  1546. row.r4 = 0
  1547. }
  1548. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1549. }
  1550. // 1班4班锁定3班未锁定
  1551. if (row.isOneWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1552. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1553. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)).toFixed(2)
  1554. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1555. if (row.w3 <= 0) {
  1556. row.w3 = 0
  1557. row.r3 = 0
  1558. }
  1559. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1560. }
  1561. // 3班4班锁定1班未锁定
  1562. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1563. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1564. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  1565. row.r1 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1566. if (row.w1 <= 0) {
  1567. row.w1 = 0
  1568. row.r1 = 0
  1569. }
  1570. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1571. }
  1572. // 1班锁定,3班4班未锁
  1573. if (row.isOneWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1574. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1575. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1576. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1577. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4))).toFixed(2)
  1578. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1579. if (row.w3 <= 0) {
  1580. row.w3 = 0
  1581. row.r3 = 0
  1582. }
  1583. if (row.w4 <= 0) {
  1584. row.w4 = 0
  1585. row.r4 = 0
  1586. }
  1587. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1588. }
  1589. // 3班锁定,1班4班未锁
  1590. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1591. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1592. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2))).toFixed(2)
  1593. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1594. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r2))).toFixed(2)
  1595. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1596. if (row.w1 <= 0) {
  1597. row.w1 = 0
  1598. row.r1 = 0
  1599. }
  1600. if (row.w4 <= 0) {
  1601. row.w4 = 0
  1602. row.r4 = 0
  1603. }
  1604. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1605. }
  1606. // 4班锁定,1班3班未锁
  1607. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1608. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1609. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r3))).toFixed(2)
  1610. row.r1 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1611. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r3))).toFixed(2)
  1612. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1613. if (row.w1 <= 0) {
  1614. row.w1 = 0
  1615. row.r1 = 0
  1616. }
  1617. if (row.w3 <= 0) {
  1618. row.w3 = 0
  1619. row.r3 = 0
  1620. }
  1621. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1622. }
  1623. // 1班3班4班未锁
  1624. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1625. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1626. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1))).toFixed(2)
  1627. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1628. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1))).toFixed(2)
  1629. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1630. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1))).toFixed(2)
  1631. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1632. if (row.w1 <= 0) {
  1633. row.w1 = 0
  1634. row.r1 = 0
  1635. }
  1636. if (row.w3 <= 0) {
  1637. row.w3 = 0
  1638. row.r3 = 0
  1639. }
  1640. if (row.w4 <= 0) {
  1641. row.w4 = 0
  1642. row.r4 = 0
  1643. }
  1644. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1645. }
  1646. } else if (this.table.RWLength == 3) {
  1647. // 三班
  1648. // 1班/3班锁定
  1649. if (row.isOneWeight == true && row.isThreeWeight == true) {
  1650. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1651. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1652. }
  1653. // 1班不锁3班锁
  1654. if (row.isOneWeight == false && row.isThreeWeight == true) {
  1655. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1656. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1657. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1658. if (row.w1 <= 0) {
  1659. row.w1 = 0
  1660. row.r1 = 0
  1661. }
  1662. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1663. }
  1664. // 3班不锁1班锁
  1665. if (row.isOneWeight == true && row.isThreeWeight == false) {
  1666. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1667. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)).toFixed(2)
  1668. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1669. if (row.w3 <= 0) {
  1670. row.w3 = 0
  1671. row.r3 = 0
  1672. }
  1673. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1674. }
  1675. // 1班3班都不锁
  1676. if (row.isOneWeight == false && row.isThreeWeight == false) {
  1677. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1678. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3))).toFixed(2)
  1679. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1680. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3))).toFixed(2)
  1681. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1682. if (row.w3 <= 0) {
  1683. row.w3 = 0
  1684. row.r3 = 0
  1685. }
  1686. if (row.w1 <= 0) {
  1687. row.w1 = 0
  1688. row.r1 = 0
  1689. }
  1690. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1691. }
  1692. } else if (this.table.RWLength == 2) {
  1693. // 两班
  1694. if (row.isTwoWeight == false) {
  1695. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1696. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2))
  1697. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1698. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1699. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2)).toFixed(2))
  1700. } else {
  1701. row.r2 = parseFloat(row.w2) / parseFloat(row.feedweight) * 100
  1702. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2)).toFixed(2))
  1703. }
  1704. }
  1705. },
  1706. blurW3(row) {
  1707. // 3班重量
  1708. if (row.w1 == '') {
  1709. row.w1 = 0
  1710. }
  1711. if (row.w2 == '') {
  1712. row.w2 = 0
  1713. }
  1714. if (row.w3 == '') {
  1715. row.w3 = 0
  1716. }
  1717. if (row.w4 == '') {
  1718. row.w4 = 0
  1719. }
  1720. if (row.r1 == '') {
  1721. row.r1 = 0
  1722. }
  1723. if (row.r2 == '') {
  1724. row.r2 = 0
  1725. }
  1726. if (row.r3 == '') {
  1727. row.r3 = 0
  1728. }
  1729. if (row.r4 == '') {
  1730. row.r4 = 0
  1731. }
  1732. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1733. console.log(row, '=======投喂量feedweight')
  1734. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1735. if (this.table.RWLength == 4) {
  1736. // 四班
  1737. // 1班2班4班都锁定
  1738. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == true) {
  1739. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1740. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1741. }
  1742. // 1班2班锁定4班未锁定
  1743. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == false) {
  1744. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1745. row.w4 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1746. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1747. if (row.w4 <= 0) {
  1748. row.w4 = 0
  1749. row.r4 = 0
  1750. }
  1751. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1752. }
  1753. // 2班4班锁定1班未锁定
  1754. if (row.isOneWeight == false && row.isTwoWeight == true && row.isFourWeight == true) {
  1755. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1756. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  1757. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1758. if (row.w1 <= 0) {
  1759. row.w1 = 0
  1760. row.r1 = 0
  1761. }
  1762. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1763. }
  1764. // 1班4班锁定2班未锁定
  1765. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == true) {
  1766. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100)
  1767. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  1768. row.r2 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1769. if (row.w2 <= 0) {
  1770. row.w2 = 0
  1771. row.r2 = 0
  1772. }
  1773. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1774. }
  1775. // 2班锁定,1班4班未锁
  1776. if (row.isTwoWeight == true && row.isOneWeight == false && row.isFourWeight == false) {
  1777. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1778. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1779. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1780. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r4))).toFixed(2)
  1781. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1782. if (row.w1 <= 0) {
  1783. row.w1 = 0
  1784. row.r1 = 0
  1785. }
  1786. if (row.w4 <= 0) {
  1787. row.w4 = 0
  1788. row.r4 = 0
  1789. }
  1790. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1791. }
  1792. // 1班锁定,2班4班未锁
  1793. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == false) {
  1794. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1795. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1796. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1797. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4))).toFixed(2)
  1798. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1799. if (row.w2 <= 0) {
  1800. row.w2 = 0
  1801. row.r2 = 0
  1802. }
  1803. if (row.w4 <= 0) {
  1804. row.w4 = 0
  1805. row.r4 = 0
  1806. }
  1807. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1808. }
  1809. // 4班锁定,2班1班未锁
  1810. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == true) {
  1811. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100)
  1812. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2))).toFixed(2)
  1813. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1814. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r2))).toFixed(2)
  1815. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1816. if (row.w2 <= 0) {
  1817. row.w2 = 0
  1818. row.r2 = 0
  1819. }
  1820. if (row.w1 <= 0) {
  1821. row.w1 = 0
  1822. row.r1 = 0
  1823. }
  1824. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1825. }
  1826. // 2班1班4班未锁
  1827. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == false) {
  1828. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1829. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1830. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1831. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1832. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1833. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1834. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1835. if (row.w1 <= 0) {
  1836. row.w1 = 0
  1837. row.r1 = 0
  1838. }
  1839. if (row.w2 <= 0) {
  1840. row.w2 = 0
  1841. row.r2 = 0
  1842. }
  1843. if (row.w4 <= 0) {
  1844. row.w4 = 0
  1845. row.r4 = 0
  1846. }
  1847. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1848. }
  1849. } else if (this.table.RWLength == 3) {
  1850. // 三班
  1851. // 1班/2班锁定
  1852. if (row.isOneWeight == true && row.isTwoWeight == true) {
  1853. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1854. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1855. }
  1856. // 1班不锁2班锁
  1857. if (row.isOneWeight == false && row.isTwoWeight == true) {
  1858. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1859. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1860. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1861. if (row.w1 <= 0) {
  1862. row.w1 = 0
  1863. row.r1 = 0
  1864. }
  1865. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1866. }
  1867. // 3班不锁2班锁
  1868. // 2班不锁1班锁
  1869. if (row.isOneWeight == true && row.isTwoWeight == false) {
  1870. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1871. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)).toFixed(2)
  1872. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1873. if (row.w2 <= 0) {
  1874. row.w2 = 0
  1875. row.r2 = 0
  1876. }
  1877. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1878. }
  1879. // 2班3班都不锁
  1880. // 1班2班都不锁
  1881. if (row.isOneWeight == false && row.isTwoWeight == false) {
  1882. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1883. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2))).toFixed(2)
  1884. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1885. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2))).toFixed(2)
  1886. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1887. if (row.w1 <= 0) {
  1888. row.w1 = 0
  1889. row.r1 = 0
  1890. }
  1891. if (row.w2 <= 0) {
  1892. row.w2 = 0
  1893. row.r2 = 0
  1894. }
  1895. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1896. }
  1897. }
  1898. },
  1899. blurW4(row) {
  1900. if (row.w1 == '') {
  1901. row.w1 = 0
  1902. }
  1903. if (row.w2 == '') {
  1904. row.w2 = 0
  1905. }
  1906. if (row.w3 == '') {
  1907. row.w3 = 0
  1908. }
  1909. if (row.w4 == '') {
  1910. row.w4 = 0
  1911. }
  1912. if (row.r1 == '') {
  1913. row.r1 = 0
  1914. }
  1915. if (row.r2 == '') {
  1916. row.r2 = 0
  1917. }
  1918. if (row.r3 == '') {
  1919. row.r3 = 0
  1920. }
  1921. if (row.r4 == '') {
  1922. row.r4 = 0
  1923. }
  1924. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1925. console.log(row, '=======投喂量feedweight')
  1926. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1927. if (this.table.RWLength == 4) {
  1928. // 四班
  1929. // 1班2班3班都锁定
  1930. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == true) {
  1931. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1932. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1933. }
  1934. // 2班3班锁定1班未锁定
  1935. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == true) {
  1936. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1937. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1938. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1939. if (row.w1 <= 0) {
  1940. row.w1 = 0
  1941. row.r1 = 0
  1942. }
  1943. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1944. }
  1945. // 2班1班锁定3班未锁定
  1946. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == false) {
  1947. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1948. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)).toFixed(2)
  1949. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1950. if (row.w3 <= 0) {
  1951. row.w3 = 0
  1952. row.r3 = 0
  1953. }
  1954. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1955. }
  1956. // 3班1班锁定2班未锁定
  1957. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == true) {
  1958. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1959. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  1960. row.r2 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1961. if (row.w2 <= 0) {
  1962. row.w2 = 0
  1963. row.r2 = 0
  1964. }
  1965. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1966. }
  1967. // 2班锁定,3班1班未锁
  1968. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == false) {
  1969. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1970. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1))).toFixed(2)
  1971. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1972. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r1))).toFixed(2)
  1973. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1974. if (row.w3 <= 0) {
  1975. row.w3 = 0
  1976. row.r3 = 0
  1977. }
  1978. if (row.w1 <= 0) {
  1979. row.w1 = 0
  1980. row.r1 = 0
  1981. }
  1982. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1983. }
  1984. // 3班锁定,2班1班未锁
  1985. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == true) {
  1986. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1987. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r1))).toFixed(2)
  1988. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1989. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r1))).toFixed(2)
  1990. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1991. if (row.w2 <= 0) {
  1992. row.w2 = 0
  1993. row.r2 = 0
  1994. }
  1995. if (row.w1 <= 0) {
  1996. row.w1 = 0
  1997. row.r1 = 0
  1998. }
  1999. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2000. }
  2001. // 1班锁定,2班3班未锁
  2002. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == false) {
  2003. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2004. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3))).toFixed(2)
  2005. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  2006. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3))).toFixed(2)
  2007. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2008. if (row.w2 <= 0) {
  2009. row.w2 = 0
  2010. row.r2 = 0
  2011. }
  2012. if (row.w3 <= 0) {
  2013. row.w3 = 0
  2014. row.r3 = 0
  2015. }
  2016. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2017. }
  2018. // 2班3班1班未锁
  2019. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == false) {
  2020. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2021. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1))).toFixed(2)
  2022. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  2023. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1))).toFixed(2)
  2024. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  2025. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1))).toFixed(2)
  2026. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2027. if (row.w1 <= 0) {
  2028. row.w1 = 0
  2029. row.r1 = 0
  2030. }
  2031. if (row.w2 <= 0) {
  2032. row.w2 = 0
  2033. row.r2 = 0
  2034. }
  2035. if (row.w3 <= 0) {
  2036. row.w3 = 0
  2037. row.r3 = 0
  2038. }
  2039. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2040. }
  2041. }
  2042. },
  2043. // 编辑
  2044. handleUpdate(row) {
  2045. console.log(row)
  2046. for (let i = 0; i < this.table.list.length; i++) {
  2047. if (this.table.list[i].Edit == true) {
  2048. this.$message({
  2049. type: 'error',
  2050. message: '当前内容未保存,请点击取消或保存继续进行操作',
  2051. duration: 2000
  2052. })
  2053. return false
  2054. }
  2055. }
  2056. // 编辑true,不可编辑false
  2057. row.Edit = true
  2058. row.NoEdit = false
  2059. // 编辑false,编辑保存true
  2060. row.isUpdate = false
  2061. row.isUpdateSave = true
  2062. row.ftid = String(row.ftid)
  2063. if (row.ptsfid == '-1') {
  2064. row.ptsfid = ''
  2065. }
  2066. row.ptsfid = String(row.ptsfid)
  2067. this.table.temp.ftid = row.ftid
  2068. this.table.temp.ftname = row.ftname
  2069. this.table.temp.ptsfid = row.ptsfid
  2070. this.table.temp.ptsfname = row.ptsfname
  2071. },
  2072. updateData(row) {
  2073. console.log(row)
  2074. if (row.r1 == 'NaN') { this.$set(row, 'r1', 0) }
  2075. if (row.r2 == 'NaN') { this.$set(row, 'r2', 0) }
  2076. if (row.r3 == 'NaN') { this.$set(row, 'r3', 0) }
  2077. if (row.r4 == 'NaN') { this.$set(row, 'r4', 0) }
  2078. if (row.w1 == 'NaN') { this.$set(row, 'w1', 0) }
  2079. if (row.w2 == 'NaN') { this.$set(row, 'w2', 0) }
  2080. if (row.w3 == 'NaN') { this.$set(row, 'w3', 0) }
  2081. if (row.w4 == 'NaN') { this.$set(row, 'w4', 0) }
  2082. console.log(row)
  2083. var arr = []
  2084. for (let i = 1; i <= this.table.RWLength; i++) {
  2085. var obj = {}
  2086. obj['times'] = i
  2087. obj['pastureid'] = row.pastureid
  2088. obj['barid'] = row.barid
  2089. obj['cowcount'] = row.ccount
  2090. obj['ccountradio'] = row.ccountradio
  2091. obj['ptid'] = row.ftid
  2092. if (row.ptsfid !== '') {
  2093. obj['ptsid'] = row.ptsfid
  2094. } else {
  2095. obj['ptsid'] = '-1'
  2096. }
  2097. obj['weight'] = row['w' + i]
  2098. obj['tratio'] = Math.round(row['r' + i])
  2099. arr.push(obj)
  2100. }
  2101. if (this.table.isPtsfname == 0) {
  2102. row.ptsfid = '-1'
  2103. row.ptsfname = ''
  2104. } else {
  2105. if (row.ptsfid == '') {
  2106. row.ptsfid = '-1'
  2107. row.ptsfname = ''
  2108. }
  2109. }
  2110. if (row.supplyweight == '') {
  2111. row.supplyweight = '0'
  2112. }
  2113. if (this.table.isPtsfname == false) {
  2114. row.supplyweight = '0'
  2115. }
  2116. console.log(row, '============')
  2117. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  2118. this.$set(row, 'ccountratio', Math.floor(parseFloat(row.ccountratio) * 100) / 100)
  2119. row.ratio = String(row.ratio)
  2120. row.ccountratio = String(row.ccountratio)
  2121. row.sumr = Math.round(row.sumr)
  2122. this.table.rwList = arr
  2123. console.log('点击了编辑保存', row)
  2124. this.table.temp.pastureid = row.pastureid
  2125. this.table.temp.id = row.id
  2126. this.table.temp.barname = row.barname
  2127. this.table.temp.barid = row.barid
  2128. this.table.temp.ccount = row.ccount
  2129. this.table.temp.ratio = row.ratio
  2130. this.table.temp.ccountratio = row.ccountratio
  2131. this.table.temp.ftid = row.ftid
  2132. this.table.temp.ftname = row.ftname
  2133. this.table.temp.ptsfid = row.ptsfid
  2134. this.table.temp.ptsfname = row.ptsfname
  2135. this.table.temp.ftweight = row.ftweight
  2136. this.table.temp.supplyweight = row.supplyweight
  2137. this.table.temp.feedweight = row.feedweight
  2138. this.table.temp.owner = row.owner
  2139. this.table.temp.sumr = row.sumr
  2140. if (row.softccount == '') {
  2141. row.softccount = 0
  2142. }
  2143. if (row.r1 == '') {
  2144. row.r1 = 0
  2145. }
  2146. if (row.r2 == '') {
  2147. row.r2 = 0
  2148. }
  2149. if (row.r3 == '') {
  2150. row.r3 = 0
  2151. }
  2152. if (row.r4 == '') {
  2153. row.r4 = 0
  2154. }
  2155. if (row.w1 == '') {
  2156. row.w1 = 0
  2157. }
  2158. if (row.w2 == '' || row.w4 == NaN) {
  2159. row.w2 = 0
  2160. }
  2161. if (row.w3 == '' || row.w4 == NaN) {
  2162. row.w3 = 0
  2163. }
  2164. if (row.w4 == '' || row.w4 == NaN) {
  2165. row.w4 = 0
  2166. }
  2167. console.log(row, '===========')
  2168. this.table.temp.softccount = row.softccount
  2169. this.table.temp.r1 = Math.round(row.r1)
  2170. this.table.temp.r2 = Math.round(row.r2)
  2171. this.table.temp.r3 = Math.round(row.r3)
  2172. this.table.temp.r4 = Math.round(row.r4)
  2173. this.table.temp.w1 = row.w1
  2174. this.table.temp.w2 = row.w2
  2175. this.table.temp.w3 = row.w3
  2176. this.table.temp.w4 = row.w4
  2177. if (this.table.temp.ccount == '' && this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2178. this.$message({
  2179. type: 'error',
  2180. message: '实际牛头数/系数/系数头数/配方模版不能为空',
  2181. duration: 2000
  2182. })
  2183. return false
  2184. }
  2185. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2186. this.$message({
  2187. type: 'error',
  2188. message: '系数/系数头数/配方模版不能为空',
  2189. duration: 2000
  2190. })
  2191. return false
  2192. }
  2193. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2194. this.$message({
  2195. type: 'error',
  2196. message: '系数头数/配方模版不能为空',
  2197. duration: 2000
  2198. })
  2199. return false
  2200. }
  2201. if (this.table.temp.ccount == '') {
  2202. this.$message({
  2203. type: 'error',
  2204. message: '实际牛头数不能为空',
  2205. duration: 2000
  2206. })
  2207. return false
  2208. }
  2209. if (this.table.temp.ratio == '') {
  2210. this.$message({
  2211. type: 'error',
  2212. message: '系数不能为空',
  2213. duration: 2000
  2214. })
  2215. return false
  2216. }
  2217. if (this.table.temp.ccountratio == '') {
  2218. this.$message({
  2219. type: 'error',
  2220. message: '系数头数不能为空',
  2221. duration: 2000
  2222. })
  2223. return false
  2224. }
  2225. if (this.table.temp.ftid == '') {
  2226. this.$message({
  2227. type: 'error',
  2228. message: '配方模版不能为空',
  2229. duration: 2000
  2230. })
  2231. return false
  2232. }
  2233. const positiveInteger = /^[1-9]\d*$/
  2234. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  2235. this.$message({
  2236. type: 'error',
  2237. message: '实际牛头数请输入正整数',
  2238. duration: 2000
  2239. })
  2240. return false
  2241. }
  2242. this.isokDisable = true
  2243. setTimeout(() => {
  2244. this.isokDisable = false
  2245. }, 1000)
  2246. // this.requestParam.parammaps = this.table.temp
  2247. this.requestParam.common = {
  2248. 'returnmap': '0'
  2249. }
  2250. this.requestParam.data = []
  2251. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  2252. pastureid: row.pastureid,
  2253. id: row.id,
  2254. barname: row.barname,
  2255. barid: row.barid,
  2256. softccount: row.softccount,
  2257. ccount: row.ccount,
  2258. ratio: row.ratio,
  2259. ccountratio: row.ccountratio,
  2260. ftid: row.ftid,
  2261. ftname: row.ftname,
  2262. ptsfid: row.ptsfid,
  2263. ptsfname: row.ptsfname,
  2264. ftweight: row.ftweight,
  2265. supplyweight: row.supplyweight,
  2266. feedweight: row.feedweight,
  2267. owner: row.owner,
  2268. sumr: row.sumr
  2269. }}
  2270. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  2271. this.requestParam.data[1].children = []
  2272. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  2273. pastureid: '@insertSpotList.pastureid',
  2274. barname: row.barname,
  2275. barid: '@insertSpotList.barid',
  2276. times: '@insertSpotList.times',
  2277. tratio: '@insertSpotList.tratio',
  2278. weight: '@insertSpotList.weight',
  2279. cowcount: '@insertSpotList.cowcount',
  2280. ccountradio: row.ccountratio,
  2281. ptid: '@insertSpotList.ptid',
  2282. ptsid: '@insertSpotList.ptsid',
  2283. feedweight: row.feedweight,
  2284. supplyweight: row.supplyweight,
  2285. ratio: row.ratio
  2286. }}
  2287. this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  2288. pastureid: row.pastureid,
  2289. fpid: row.id
  2290. }}
  2291. ExecDataByConfig(this.requestParam).then(response => {
  2292. console.log('编辑保存发送参数', this.requestParam)
  2293. if (response.msg === 'fail') {
  2294. this.$notify({
  2295. title: '保存失败',
  2296. message: response.data,
  2297. type: 'warning',
  2298. duration: 2000
  2299. })
  2300. } else {
  2301. this.$notify({
  2302. title: '成功',
  2303. message: '保存成功',
  2304. type: 'success',
  2305. duration: 2000
  2306. })
  2307. this.getList()
  2308. }
  2309. })
  2310. },
  2311. updateCancel(row) {
  2312. console.log('点击了编辑取消')
  2313. // 编辑false,不可编辑true
  2314. row.Edit = false
  2315. row.NoEdit = true
  2316. // 编辑true,编辑保存false
  2317. row.isUpdate = true
  2318. row.isUpdateSave = false
  2319. this.getList()
  2320. this.reload()
  2321. // this.$router.push('/formulationPlan/dhedFormula')
  2322. },
  2323. cellClick(row, column, event) {
  2324. console.log(column)
  2325. },
  2326. handleSelect(val) {
  2327. console.log('勾选数据', val)
  2328. this.selectList = val
  2329. },
  2330. // 营养评估
  2331. handleNutritional() {
  2332. console.log('点击了营养评估')
  2333. if (this.selectList.length !== 1) {
  2334. this.$message({
  2335. type: 'error',
  2336. message: '请选择一条栏舍信息进行营养评估',
  2337. duration: 2000
  2338. })
  2339. return false
  2340. } else {
  2341. console.log(this.nutritional.temp)
  2342. this.nutritional.dialogStatus = 'Nutritional'
  2343. this.nutritional.dialogFormVisible = true
  2344. this.nutritional.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2345. this.nutritional.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2346. this.getNutritionalList()
  2347. }
  2348. },
  2349. getNutritionalList() {
  2350. this.nutritional.listLoading1 = true
  2351. GetDataByName(this.nutritional.getdataListParm1).then(response => {
  2352. console.log('评估上方数据', response.data.list)
  2353. if (response.data.list !== null) {
  2354. response.data.list[0].cowclassid = String(response.data.list[0].cowclassid)
  2355. this.nutritional.temp = response.data.list[0]
  2356. this.nutritional.disabledCowclass = true
  2357. } else {
  2358. this.nutritional.temp = []
  2359. this.nutritional.disabledCowclass = false
  2360. }
  2361. setTimeout(() => {
  2362. this.nutritional.listLoading = false
  2363. }, 100)
  2364. })
  2365. },
  2366. assessmentData() {
  2367. console.log('评估保存')
  2368. this.$refs['temp'].validate(valid => {
  2369. if (valid) {
  2370. this.nutritional.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  2371. this.nutritional.getdataListParm2.parammaps.cowclassid = this.nutritional.temp.cowclassid
  2372. this.getNutritionalList2()
  2373. }
  2374. })
  2375. },
  2376. getNutritionalList2() {
  2377. this.nutritional.listLoading2 = true
  2378. GetDataByName(this.nutritional.getdataListParm2).then(response => {
  2379. console.log('评估下方数据', response.data.list)
  2380. if (response.data.list !== null) {
  2381. this.nutritional.list = response.data.list
  2382. this.nutritional.pageNum = response.data.pageNum
  2383. this.nutritional.pageSize = response.data.pageSize
  2384. this.nutritional.total = response.data.total
  2385. } else {
  2386. this.nutritional.list = []
  2387. }
  2388. setTimeout(() => {
  2389. this.nutritional.listLoading2 = false
  2390. }, 100)
  2391. })
  2392. },
  2393. // 历史记录
  2394. handleHistoryRecords() {
  2395. console.log('点击了历史记录')
  2396. this.history.dialogStatus = 'history'
  2397. this.history.dialogFormVisible = true
  2398. this.getDateList()
  2399. },
  2400. // 历史时间
  2401. getDateList() {
  2402. GetDataByName(this.history.getdataDateParm).then(response => {
  2403. console.log('table数据', response.data.list)
  2404. if (response.data.list !== null) {
  2405. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  2406. this.getHistoryIsDisplay()
  2407. } else {
  2408. this.history.getdataListParm.parammaps.date = ''
  2409. }
  2410. })
  2411. },
  2412. getHistoryIsDisplay() {
  2413. GetDataByName(this.table.getdataListParm2).then(response => {
  2414. console.log(response.data.list[0].inforvalue)
  2415. if (response.data.list !== null) {
  2416. if (response.data.list[0].inforvalue == 0) {
  2417. this.table.isPtsfname = false
  2418. } else {
  2419. this.table.isPtsfname = true
  2420. }
  2421. }
  2422. })
  2423. GetDataByName(this.table.getdataListParm3).then(response => {
  2424. if (response.data.list !== null) {
  2425. if (response.data.list[0].inforvalue == 1) {
  2426. this.history.isRW1 = true
  2427. this.history.isRW2 = false
  2428. this.history.isRW3 = false
  2429. this.history.isRW4 = false
  2430. } else if (response.data.list[0].inforvalue == 2) {
  2431. this.history.isRW1 = true
  2432. this.history.isRW2 = true
  2433. this.history.isRW3 = false
  2434. this.history.isRW4 = false
  2435. } else if (response.data.list[0].inforvalue == 3) {
  2436. this.history.isRW1 = true
  2437. this.history.isRW2 = true
  2438. this.history.isRW3 = true
  2439. this.history.isRW4 = false
  2440. } else if (response.data.list[0].inforvalue == 4) {
  2441. this.history.isRW1 = true
  2442. this.history.isRW2 = true
  2443. this.history.isRW3 = true
  2444. this.history.isRW4 = true
  2445. }
  2446. } else {
  2447. this.history.isRW1 = false
  2448. this.history.isRW2 = false
  2449. this.history.isRW3 = false
  2450. this.history.isRW4 = false
  2451. }
  2452. })
  2453. this.getHistoryList()
  2454. },
  2455. getHistoryList() {
  2456. this.history.listLoading = true
  2457. GetDataByName(this.history.getdataListParm).then(response => {
  2458. console.log('table数据', response.data.list)
  2459. if (response.data.list !== null) {
  2460. console.log('table数据', response.data.list)
  2461. for (let i = 0; i < response.data.list.length; i++) {
  2462. this.$set(response.data.list[i], 'Edit', false) // 编辑
  2463. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  2464. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  2465. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  2466. if (response.data.list[i].ftid == undefined || response.data.list[i].ftname == '') {
  2467. this.$set(response.data.list[i], 'ftid', '')
  2468. this.$set(response.data.list[i], 'ftname', '')
  2469. }
  2470. if (response.data.list[i].ptsfid == undefined || response.data.list[i].ptsfname == '') {
  2471. this.$set(response.data.list[i], 'ptsfid', '')
  2472. this.$set(response.data.list[i], 'ptsfname', '')
  2473. }
  2474. if (response.data.list[i].ccount == undefined) {
  2475. this.$set(response.data.list[i], 'ccount', '')
  2476. }
  2477. if (response.data.list[i].ratio == undefined) {
  2478. this.$set(response.data.list[i], 'ratio', '100')
  2479. }
  2480. if (response.data.list[i].ccountratio == undefined) {
  2481. this.$set(response.data.list[i], 'ccountratio', '')
  2482. }
  2483. if (response.data.list[i].r1 == undefined) {
  2484. this.$set(response.data.list[i], 'r1', '')
  2485. }
  2486. if (response.data.list[i].r2 == undefined) {
  2487. this.$set(response.data.list[i], 'r2', '')
  2488. }
  2489. if (response.data.list[i].r3 == undefined) {
  2490. this.$set(response.data.list[i], 'r3', '')
  2491. }
  2492. if (response.data.list[i].r4 == undefined) {
  2493. this.$set(response.data.list[i], 'r4', '')
  2494. }
  2495. if (response.data.list[i].w1 == undefined) {
  2496. this.$set(response.data.list[i], 'w1', '')
  2497. }
  2498. if (response.data.list[i].w2 == undefined) {
  2499. this.$set(response.data.list[i], 'w2', '')
  2500. }
  2501. if (response.data.list[i].w3 == undefined) {
  2502. this.$set(response.data.list[i], 'w3', '')
  2503. }
  2504. if (response.data.list[i].w4 == undefined) {
  2505. this.$set(response.data.list[i], 'w4', '')
  2506. }
  2507. if (response.data.list[i].feedweight == undefined) {
  2508. this.$set(response.data.list[i], 'feedweight', '')
  2509. }
  2510. if (response.data.list[i].Bfweight == undefined) {
  2511. this.$set(response.data.list[i], 'Bfweight', '')
  2512. }
  2513. if (response.data.list[i].Sfweight == undefined) {
  2514. this.$set(response.data.list[i], 'Sfweight', '')
  2515. }
  2516. if (response.data.list[i].timesopt !== undefined) {
  2517. var timesoptArr = response.data.list[i].timesopt.split(',')
  2518. for (let j = 0; j < timesoptArr.length; j++) {
  2519. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  2520. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  2521. }
  2522. }
  2523. }
  2524. this.history.list = response.data.list
  2525. for (let i = 0; i < response.data.list.length; i++) {
  2526. if (response.data.list[i].r1 == '') { response.data.list[i].r1 = 0 }
  2527. if (response.data.list[i].r2 == '') { response.data.list[i].r2 = 0 }
  2528. if (response.data.list[i].r3 == '') { response.data.list[i].r3 = 0 }
  2529. if (response.data.list[i].r4 == '') { response.data.list[i].r4 = 0 }
  2530. this.$set(response.data.list[i], 'sumr', Math.round(parseFloat(response.data.list[i].r1) + parseFloat(response.data.list[i].r2) + parseFloat(response.data.list[i].r3) + parseFloat(response.data.list[i].r4)))
  2531. }
  2532. this.history.pageNum = response.data.pageNum
  2533. this.history.pageSize = response.data.pageSize
  2534. this.history.total = response.data.total
  2535. } else {
  2536. this.history.list = []
  2537. }
  2538. setTimeout(() => {
  2539. this.history.listLoading = false
  2540. }, 100)
  2541. })
  2542. },
  2543. changeDate() {
  2544. this.getHistoryList()
  2545. },
  2546. // 应用
  2547. handleApplication() {
  2548. console.log('点击了应用')
  2549. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  2550. confirmButtonText: '确认',
  2551. cancelButtonText: '取消',
  2552. type: 'warning'
  2553. }).then(() => {
  2554. this.requestParam.name = 'applyFPdate'
  2555. this.requestParam.parammaps = {}
  2556. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  2557. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  2558. PostDataByName(this.requestParam).then(response => {
  2559. if (response.msg === 'fail') {
  2560. this.$notify({
  2561. title: '保存失败',
  2562. message: response.data,
  2563. type: 'warning',
  2564. duration: 2000
  2565. })
  2566. } else {
  2567. this.$notify({
  2568. title: '成功',
  2569. message: '保存成功',
  2570. type: 'success',
  2571. duration: 2000
  2572. })
  2573. this.getHistoryIsDisplay()
  2574. this.getList()
  2575. }
  2576. })
  2577. }).catch(() => {
  2578. this.$message({
  2579. type: 'info',
  2580. message: '已取消应用'
  2581. })
  2582. })
  2583. },
  2584. // 导出模板
  2585. handleExportTemp() {
  2586. console.log('点击了导出模板')
  2587. },
  2588. // 导出
  2589. handleExport() {
  2590. console.log('点击了导出数据')
  2591. },
  2592. // 导入
  2593. handleImport() {
  2594. console.log('点击了导入')
  2595. }
  2596. }
  2597. }
  2598. </script>
  2599. <style lang="scss" scoped>
  2600. .search {
  2601. clear: both;
  2602. }
  2603. .table {
  2604. margin-top: 10px;
  2605. }
  2606. </style>