c80d9e266115b176e49b6357453e9293560b9d2e.svn-base 118 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835
  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
  2400. .temp.ftid == '') {
  2401. this.$message({
  2402. type: 'error',
  2403. message: '实际牛头数/系数/系数头数/配方模版不能为空',
  2404. duration: 2000
  2405. })
  2406. return false
  2407. }
  2408. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2409. this.$message({
  2410. type: 'error',
  2411. message: '系数/系数头数/配方模版不能为空',
  2412. duration: 2000
  2413. })
  2414. return false
  2415. }
  2416. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2417. this.$message({
  2418. type: 'error',
  2419. message: '系数头数/配方模版不能为空',
  2420. duration: 2000
  2421. })
  2422. return false
  2423. }
  2424. if (this.table.temp.ccount == '') {
  2425. this.$message({
  2426. type: 'error',
  2427. message: '实际牛头数不能为空',
  2428. duration: 2000
  2429. })
  2430. return false
  2431. }
  2432. if (this.table.temp.ratio == '') {
  2433. this.$message({
  2434. type: 'error',
  2435. message: '系数不能为空',
  2436. duration: 2000
  2437. })
  2438. return false
  2439. }
  2440. if (this.table.temp.ccountratio == '') {
  2441. this.$message({
  2442. type: 'error',
  2443. message: '系数头数不能为空',
  2444. duration: 2000
  2445. })
  2446. return false
  2447. }
  2448. if (this.table.temp.ftid == '') {
  2449. this.$message({
  2450. type: 'error',
  2451. message: '配方模版不能为空',
  2452. duration: 2000
  2453. })
  2454. return false
  2455. }
  2456. const positiveInteger = /^[1-9]\d*$/
  2457. if (!positiveInteger.test(parseInt(this.table.temp.ccount))) {
  2458. this.$message({
  2459. type: 'error',
  2460. message: '实际牛头数请输入正整数',
  2461. duration: 2000
  2462. })
  2463. return false
  2464. }
  2465. if (!positiveInteger.test(parseInt(this.table.temp.ratio))) {
  2466. this.$message({
  2467. type: 'error',
  2468. message: '系数请输入正整数',
  2469. duration: 2000
  2470. })
  2471. return false
  2472. }
  2473. if (!positiveInteger.test(parseInt(this.table.temp.ratio))) {
  2474. this.$message({
  2475. type: 'error',
  2476. message: '系数头数请输入正整数',
  2477. duration: 2000
  2478. })
  2479. return false
  2480. }
  2481. this.isokDisable = true
  2482. setTimeout(() => {
  2483. this.isokDisable = false
  2484. }, 1000)
  2485. // this.requestParam.parammaps = this.table.temp
  2486. this.requestParam.common = {
  2487. 'returnmap': '0'
  2488. }
  2489. this.requestParam.data = []
  2490. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  2491. pastureid: row.pastureid,
  2492. id: row.id,
  2493. barname: row.barname,
  2494. barid: row.barid,
  2495. softccount: row.softccount,
  2496. ccount: row.ccount,
  2497. ratio: row.ratio,
  2498. ccountratio: row.ccountratio,
  2499. ftid: row.ftid,
  2500. ftname: row.ftname,
  2501. ptsfid: row.ptsfid,
  2502. ptsfname: row.ptsfname,
  2503. ftweight: row.ftweight,
  2504. supplyweight: row.supplyweight,
  2505. feedweight: row.feedweight,
  2506. owner: row.owner,
  2507. sumr: row.sumr
  2508. }}
  2509. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  2510. this.requestParam.data[1].children = []
  2511. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  2512. pastureid: '@insertSpotList.pastureid',
  2513. barname: row.barname,
  2514. barid: '@insertSpotList.barid',
  2515. times: '@insertSpotList.times',
  2516. tratio: '@insertSpotList.tratio',
  2517. weight: '@insertSpotList.weight',
  2518. cowcount: '@insertSpotList.cowcount',
  2519. ccountradio: row.ccountratio,
  2520. ptid: '@insertSpotList.ptid',
  2521. ptsid: '@insertSpotList.ptsid',
  2522. feedweight: row.feedweight,
  2523. supplyweight: row.supplyweight,
  2524. ratio: row.ratio
  2525. }}
  2526. this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  2527. pastureid: row.pastureid,
  2528. fpid: row.id
  2529. }}
  2530. ExecDataByConfig(this.requestParam).then(response => {
  2531. console.log('编辑保存发送参数', this.requestParam)
  2532. if (response.msg === 'fail') {
  2533. this.$notify({
  2534. title: '保存失败',
  2535. message: response.data,
  2536. type: 'warning',
  2537. duration: 2000
  2538. })
  2539. } else {
  2540. this.$notify({
  2541. title: '成功',
  2542. message: '保存成功',
  2543. type: 'success',
  2544. duration: 2000
  2545. })
  2546. this.getList()
  2547. }
  2548. })
  2549. },
  2550. updateCancel(row) {
  2551. console.log('点击了编辑取消')
  2552. // 编辑false,不可编辑true
  2553. row.Edit = false
  2554. row.NoEdit = true
  2555. // 编辑true,编辑保存false
  2556. row.isUpdate = true
  2557. row.isUpdateSave = false
  2558. },
  2559. handleSelect(val) {
  2560. console.log('勾选数据', val)
  2561. this.selectList = val
  2562. },
  2563. // 营养评估
  2564. handleNutritional() {
  2565. console.log('点击了营养评估')
  2566. if (this.selectList.length !== 1) {
  2567. this.$message({
  2568. type: 'error',
  2569. message: '请选择一条栏舍信息进行营养评估',
  2570. duration: 2000
  2571. })
  2572. return false
  2573. } else {
  2574. this.temp = this.selectList
  2575. this.nutritional.dialogStatus = 'Nutritional'
  2576. this.nutritional.dialogFormVisible = true
  2577. this.getList2()
  2578. }
  2579. },
  2580. assessmentData() {
  2581. console.log('评估保存')
  2582. this.getList2()
  2583. },
  2584. getList2() {
  2585. this.nutritional.listLoading = true
  2586. GetDataByName(this.nutritional.getdataListParm).then(response => {
  2587. console.log('table数据', response.data.list)
  2588. if (response.data.list !== null) {
  2589. this.nutritional.list = response.data.list
  2590. this.nutritional.pageNum = response.data.pageNum
  2591. this.nutritional.pageSize = response.data.pageSize
  2592. this.nutritional.total = response.data.total
  2593. } else {
  2594. this.nutritional.list = []
  2595. }
  2596. setTimeout(() => {
  2597. this.nutritional.listLoading = false
  2598. }, 100)
  2599. })
  2600. },
  2601. // 历史记录
  2602. handleHistoryRecords() {
  2603. console.log('点击了历史记录')
  2604. this.history.dialogStatus = 'history'
  2605. this.history.dialogFormVisible = true
  2606. this.getDateList()
  2607. },
  2608. // 历史时间
  2609. getDateList() {
  2610. GetDataByName(this.history.getdataDateParm).then(response => {
  2611. console.log('table数据', response.data.list)
  2612. if (response.data.list !== null) {
  2613. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  2614. this.getHistoryIsDisplay()
  2615. } else {
  2616. this.history.getdataListParm.parammaps.date = ''
  2617. }
  2618. })
  2619. },
  2620. getHistoryIsDisplay() {
  2621. GetDataByName(this.table.getdataListParm2).then(response => {
  2622. console.log(response.data.list[0].inforvalue)
  2623. if (response.data.list !== null) {
  2624. if (response.data.list[0].inforvalue == 0) {
  2625. this.table.isPtsfname = false
  2626. } else {
  2627. this.table.isPtsfname = true
  2628. }
  2629. }
  2630. })
  2631. GetDataByName(this.table.getdataListParm3).then(response => {
  2632. if (response.data.list !== null) {
  2633. if (response.data.list[0].inforvalue == 1) {
  2634. this.history.isRW1 = true
  2635. this.history.isRW2 = false
  2636. this.history.isRW3 = false
  2637. this.history.isRW4 = false
  2638. } else if (response.data.list[0].inforvalue == 2) {
  2639. this.history.isRW1 = true
  2640. this.history.isRW2 = true
  2641. this.history.isRW3 = false
  2642. this.history.isRW4 = false
  2643. } else if (response.data.list[0].inforvalue == 3) {
  2644. this.history.isRW1 = true
  2645. this.history.isRW2 = true
  2646. this.history.isRW3 = true
  2647. this.history.isRW4 = false
  2648. } else if (response.data.list[0].inforvalue == 4) {
  2649. this.history.isRW1 = true
  2650. this.history.isRW2 = true
  2651. this.history.isRW3 = true
  2652. this.history.isRW4 = true
  2653. }
  2654. } else {
  2655. this.history.isRW1 = false
  2656. this.history.isRW2 = false
  2657. this.history.isRW3 = false
  2658. this.history.isRW4 = false
  2659. }
  2660. })
  2661. this.getHistoryList()
  2662. },
  2663. getHistoryList() {
  2664. this.history.listLoading = true
  2665. GetDataByName(this.history.getdataListParm).then(response => {
  2666. console.log('table数据', response.data.list)
  2667. if (response.data.list !== null) {
  2668. for (let i = 0; i < response.data.list.length; i++) {
  2669. this.$set(response.data.list[i], 'Edit', false) // 编辑
  2670. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  2671. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  2672. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  2673. if (response.data.list[i].ftid == undefined || response.data.list[i].ftname == '') {
  2674. this.$set(response.data.list[i], 'ftid', '')
  2675. this.$set(response.data.list[i], 'ftname', '')
  2676. }
  2677. if (response.data.list[i].ptsfid == undefined || response.data.list[i].ptsfname == '') {
  2678. this.$set(response.data.list[i], 'ptsfid', '')
  2679. this.$set(response.data.list[i], 'ptsfname', '')
  2680. }
  2681. if (response.data.list[i].ccount == undefined) {
  2682. this.$set(response.data.list[i], 'ccount', '')
  2683. }
  2684. if (response.data.list[i].ratio == undefined) {
  2685. this.$set(response.data.list[i], 'ratio', '100')
  2686. }
  2687. if (response.data.list[i].ccountratio == undefined) {
  2688. this.$set(response.data.list[i], 'ccountratio', '')
  2689. }
  2690. if (response.data.list[i].r1 == undefined) {
  2691. this.$set(response.data.list[i], 'r1', '')
  2692. }
  2693. if (response.data.list[i].r2 == undefined) {
  2694. this.$set(response.data.list[i], 'r2', '')
  2695. }
  2696. if (response.data.list[i].r3 == undefined) {
  2697. this.$set(response.data.list[i], 'r3', '')
  2698. }
  2699. if (response.data.list[i].r4 == undefined) {
  2700. this.$set(response.data.list[i], 'r4', '')
  2701. }
  2702. if (response.data.list[i].w1 == undefined) {
  2703. this.$set(response.data.list[i], 'w1', '')
  2704. }
  2705. if (response.data.list[i].w2 == undefined) {
  2706. this.$set(response.data.list[i], 'w2', '')
  2707. }
  2708. if (response.data.list[i].w3 == undefined) {
  2709. this.$set(response.data.list[i], 'w3', '')
  2710. }
  2711. if (response.data.list[i].w4 == undefined) {
  2712. this.$set(response.data.list[i], 'w4', '')
  2713. }
  2714. if (response.data.list[i].feedweight == undefined) {
  2715. this.$set(response.data.list[i], 'feedweight', '')
  2716. }
  2717. if (response.data.list[i].Bfweight == undefined) {
  2718. this.$set(response.data.list[i], 'Bfweight', '')
  2719. }
  2720. if (response.data.list[i].Sfweight == undefined) {
  2721. this.$set(response.data.list[i], 'Sfweight', '')
  2722. }
  2723. if (response.data.list[i].timesopt !== undefined) {
  2724. var timesoptArr = response.data.list[i].timesopt.split(',')
  2725. for (let j = 0; j < timesoptArr.length; j++) {
  2726. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  2727. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  2728. }
  2729. }
  2730. }
  2731. this.history.list = response.data.list
  2732. this.history.pageNum = response.data.pageNum
  2733. this.history.pageSize = response.data.pageSize
  2734. this.history.total = response.data.total
  2735. } else {
  2736. this.history.list = []
  2737. }
  2738. setTimeout(() => {
  2739. this.history.listLoading = false
  2740. }, 100)
  2741. })
  2742. },
  2743. changeDate() {
  2744. this.getHistoryList()
  2745. },
  2746. // 应用
  2747. handleApplication() {
  2748. console.log('点击了应用')
  2749. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  2750. confirmButtonText: '确认',
  2751. cancelButtonText: '取消',
  2752. type: 'warning'
  2753. }).then(() => {
  2754. this.requestParam.name = 'applyFPdate'
  2755. this.requestParam.parammaps = {}
  2756. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  2757. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  2758. PostDataByName(this.requestParam).then(response => {
  2759. if (response.msg === 'fail') {
  2760. this.$notify({
  2761. title: '保存失败',
  2762. message: response.data,
  2763. type: 'warning',
  2764. duration: 2000
  2765. })
  2766. } else {
  2767. this.$notify({
  2768. title: '成功',
  2769. message: '保存成功',
  2770. type: 'success',
  2771. duration: 2000
  2772. })
  2773. this.getHistoryIsDisplay()
  2774. this.getList()
  2775. }
  2776. })
  2777. }).catch(() => {
  2778. this.$message({
  2779. type: 'info',
  2780. message: '已取消应用'
  2781. })
  2782. })
  2783. },
  2784. // 导出模板
  2785. handleExportTemp() {
  2786. console.log('点击了导出模板')
  2787. },
  2788. // 导出
  2789. handleExport() {
  2790. console.log('点击了导出数据')
  2791. },
  2792. // 导入
  2793. handleImport() {
  2794. console.log('点击了导入')
  2795. }
  2796. }
  2797. }
  2798. </script>
  2799. <style lang="scss" scoped>
  2800. .search {
  2801. clear: both;
  2802. }
  2803. .table {
  2804. margin-top: 10px;
  2805. }
  2806. </style>