5585a7be714384528ec5e281f3045b754792e3d4.svn-base 127 KB

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