08d5aa5ba452d0ff38512269d4f3f8836f867216.svn-base 118 KB

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