3dbd4d1dabbdc66e95cacbe55a87223633b0c74f.svn-base 124 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796
  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)).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))
  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. console.log(111)
  1169. row.feedweight = parseFloat(row.supplyweight) + parseFloat(row.ftweight)
  1170. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1171. console.log(222)
  1172. row.feedweight = parseFloat(row.ftweight)
  1173. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1174. console.log(333)
  1175. row.feedweight = parseFloat(row.supplyweight)
  1176. }
  1177. // if (row.ccountratio !== '' && row.ftweight !== '') {
  1178. // row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1179. // }
  1180. // if (row.ccountratio !== '' && row.BLweight !== '') {
  1181. // row.supplyweight = parseFloat(row.BLweight) * parseFloat(row.ccountratio)
  1182. // }
  1183. }
  1184. if (row.r1 !== '') { this.$set(row, 'w1', (parseFloat(row.feedweight) * (parseFloat(row.r1) / 100)).toFixed(2)) }
  1185. if (row.r2 !== '') { this.$set(row, 'w2', (parseFloat(row.feedweight) * (parseFloat(row.r2) / 100)).toFixed(2)) }
  1186. if (row.r3 !== '') { this.$set(row, 'w3', (parseFloat(row.feedweight) * (parseFloat(row.r3) / 100)).toFixed(2)) }
  1187. if (row.r4 !== '') { this.$set(row, 'w4', (parseFloat(row.feedweight) * (parseFloat(row.r4) / 100)).toFixed(2)) }
  1188. },
  1189. // 实际牛头数失去焦点计算
  1190. // ccount实际牛头数
  1191. // ratio系数
  1192. // ccountratio系数牛头数
  1193. blurCcount(row) { // 实际牛头数
  1194. console.log(row)
  1195. if (row.ftid !== '-1' && row.ftid !== '') {
  1196. console.log(123)
  1197. console.log(this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight)
  1198. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1199. }
  1200. if (row.ptsfid !== '-1' && row.ptsfid !== '') {
  1201. console.log(1234)
  1202. console.log(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight)
  1203. row.BLweight = this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight
  1204. }
  1205. if (row.Sfweight !== '' && row.ccount !== '') {
  1206. console.log(1235)
  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. console.log(111)
  1223. }
  1224. if (row.ccountratio !== '' && row.BLweight !== '') {
  1225. row.supplyweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1226. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1227. row.supplyweight = ''
  1228. row.feedweight = ''
  1229. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1230. row.supplyweight = ''
  1231. row.feedweight = ''
  1232. }
  1233. // 配方重量
  1234. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1235. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1236. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1237. row.ftweight = ''
  1238. row.feedweight = ''
  1239. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1240. row.ftweight = ''
  1241. row.feedweight = ''
  1242. }
  1243. if (this.table.isPtsfname == false) {
  1244. row.feedweight = parseFloat(row.ftweight)
  1245. } else {
  1246. if (row.supplyweight !== '' && row.ftweight !== '') {
  1247. row.feedweight = parseFloat(row.supplyweight) + parseFloat(row.ftweight)
  1248. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1249. row.feedweight = parseFloat(row.supplyweight)
  1250. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1251. row.feedweight = parseFloat(row.ftweight)
  1252. }
  1253. // 配方重量 = 系数头数 * Sfweight
  1254. if (row.ccountratio !== '' && row.ftweight !== '') {
  1255. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1256. }
  1257. // 补料重量 = 系数头数 * BLweight
  1258. if (row.ccountratio !== '' && row.BLweight !== '') {
  1259. row.supplyweight = parseFloat(row.BLweight) * parseFloat(row.ccountratio)
  1260. }
  1261. }
  1262. if (row.r1 !== '') { this.$set(row, 'w1', (parseFloat(row.feedweight) * (parseFloat(row.r1) / 100)).toFixed(2)) }
  1263. if (row.r2 !== '') { this.$set(row, 'w2', (parseFloat(row.feedweight) * (parseFloat(row.r2) / 100)).toFixed(2)) }
  1264. if (row.r3 !== '') { this.$set(row, 'w3', (parseFloat(row.feedweight) * (parseFloat(row.r3) / 100)).toFixed(2)) }
  1265. if (row.r4 !== '') { this.$set(row, 'w4', (parseFloat(row.feedweight) * (parseFloat(row.r4) / 100)).toFixed(2)) }
  1266. },
  1267. blurRatio(row) {
  1268. console.log(row)
  1269. if (row.ftid !== '-1' && row.ftid !== '') {
  1270. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1271. }
  1272. if (row.ptsfid !== '-1' && row.ptsfid !== '') {
  1273. row.BLweight = this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight
  1274. }
  1275. // 系数
  1276. if (row.ccount !== '' && row.ratio !== '' && row.ccountratio !== '') {
  1277. row.ccountratio = parseFloat(row.ccount) * parseFloat(row.ratio) / 100
  1278. } else if (row.ccount !== '' && row.ccountratio !== '') {
  1279. row.ratio = parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount)
  1280. } else if (row.ccount !== '' || row.ccountratio !== '') {
  1281. row.ratio = ''
  1282. }
  1283. // 补料重量
  1284. if (row.ccountratio !== '' && row.BLweight !== '') {
  1285. row.supplyweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1286. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1287. row.supplyweight = ''
  1288. row.feedweight = ''
  1289. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1290. row.supplyweight = ''
  1291. row.feedweight = ''
  1292. }
  1293. // 配方重量
  1294. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1295. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1296. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1297. row.ftweight = ''
  1298. row.feedweight = ''
  1299. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1300. row.ftweight = ''
  1301. row.feedweight = ''
  1302. }
  1303. // 投喂量
  1304. if (row.supplyweight !== '' && row.ftweight !== '') {
  1305. row.feedweight = parseFloat(row.supplyweight) + parseFloat(row.ftweight)
  1306. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1307. row.feedweight = parseFloat(row.ftweight)
  1308. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1309. row.feedweight = parseFloat(row.supplyweight)
  1310. }
  1311. if (this.table.isPtsfname == false) {
  1312. row.feedweight = parseFloat(row.ftweight)
  1313. } else {
  1314. // 投喂量
  1315. if (row.supplyweight !== '' && row.ftweight !== '') {
  1316. row.feedweight = parseFloat(row.supplyweight) + parseFloat(row.ftweight)
  1317. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1318. row.feedweight = parseFloat(row.ftweight)
  1319. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1320. row.feedweight = parseFloat(row.supplyweight)
  1321. }
  1322. // 补料重量
  1323. if (row.ccountratio !== '' && row.BLweight !== '') {
  1324. row.supplyweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1325. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1326. row.supplyweight = ''
  1327. row.feedweight = ''
  1328. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1329. row.supplyweight = ''
  1330. row.feedweight = ''
  1331. }
  1332. // 配方重量
  1333. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1334. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1335. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1336. row.ftweight = ''
  1337. row.feedweight = ''
  1338. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1339. row.ftweight = ''
  1340. row.feedweight = ''
  1341. }
  1342. }
  1343. if (row.r1 !== '') { this.$set(row, 'w1', (parseFloat(row.feedweight) * (parseFloat(row.r1) / 100)).toFixed(2)) }
  1344. if (row.r2 !== '') { this.$set(row, 'w2', (parseFloat(row.feedweight) * (parseFloat(row.r2) / 100)).toFixed(2)) }
  1345. if (row.r3 !== '') { this.$set(row, 'w3', (parseFloat(row.feedweight) * (parseFloat(row.r3) / 100)).toFixed(2)) }
  1346. if (row.r4 !== '') { this.$set(row, 'w4', (parseFloat(row.feedweight) * (parseFloat(row.r4) / 100)).toFixed(2)) }
  1347. },
  1348. blurCcountratio(row) {
  1349. if (row.ftid !== '-1' && row.ftid !== '') {
  1350. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1351. }
  1352. if (row.ptsfid !== '-1' && row.ptsfid !== '') {
  1353. row.BLweight = this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight
  1354. }
  1355. // 系数头数
  1356. if (row.ccountratio !== '' && row.ccount !== '' && row.ratio !== '') {
  1357. row.ratio = parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount)
  1358. } else if (row.ccount !== '' && row.ratio !== '') {
  1359. row.ccountratio = parseFloat(row.ccount) * parseFloat(row.ratio) / 100
  1360. } else if (row.ccountratio !== '' && row.ccount !== '') {
  1361. row.ratio = parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount)
  1362. } else if (row.ccountratio !== '' && row.ratio !== '') {
  1363. row.ccount = parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100
  1364. }
  1365. // 补料重量
  1366. if (row.ccountratio !== '' && row.BLweight !== '') {
  1367. row.supplyweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1368. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1369. row.supplyweight = ''
  1370. row.feedweight = ''
  1371. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1372. row.supplyweight = ''
  1373. row.feedweight = ''
  1374. }
  1375. // 配方重量
  1376. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1377. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1378. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1379. row.ftweight = ''
  1380. row.feedweight = ''
  1381. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1382. row.ftweight = ''
  1383. row.feedweight = ''
  1384. }
  1385. // 投喂量
  1386. if (row.supplyweight !== '' && row.ftweight !== '') {
  1387. row.feedweight = parseFloat(row.supplyweight) + parseFloat(row.ftweight)
  1388. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1389. row.feedweight = parseFloat(row.ftweight)
  1390. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1391. row.feedweight = parseFloat(row.supplyweight)
  1392. }
  1393. if (this.table.isPtsfname == false) {
  1394. console.log(row)
  1395. row.feedweight = parseFloat(row.ftweight)
  1396. } else {
  1397. // 投喂量
  1398. if (row.supplyweight !== '' && row.ftweight !== '') {
  1399. row.feedweight = parseFloat(row.supplyweight) + parseFloat(row.ftweight)
  1400. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1401. row.feedweight = parseFloat(row.ftweight)
  1402. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1403. row.feedweight = parseFloat(row.supplyweight)
  1404. }
  1405. // 补料重量
  1406. if (row.ccountratio !== '' && row.BLweight !== '') {
  1407. row.supplyweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1408. } else if (row.ccountratio !== '' && row.BLweight == '') {
  1409. row.supplyweight = ''
  1410. row.feedweight = ''
  1411. } else if (row.ccountratio == '' && row.BLweight !== '') {
  1412. row.supplyweight = ''
  1413. row.feedweight = ''
  1414. }
  1415. // 配方重量
  1416. if (row.ccountratio !== '' && row.Sfweight !== '') {
  1417. row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1418. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  1419. row.ftweight = ''
  1420. row.feedweight = ''
  1421. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  1422. row.ftweight = ''
  1423. row.feedweight = ''
  1424. }
  1425. }
  1426. if (row.r1 !== '') { this.$set(row, 'w1', (parseFloat(row.feedweight) * (parseFloat(row.r1) / 100)).toFixed(2)) }
  1427. if (row.r2 !== '') { this.$set(row, 'w2', (parseFloat(row.feedweight) * (parseFloat(row.r2) / 100)).toFixed(2)) }
  1428. if (row.r3 !== '') { this.$set(row, 'w3', (parseFloat(row.feedweight) * (parseFloat(row.r3) / 100)).toFixed(2)) }
  1429. if (row.r4 !== '') { this.$set(row, 'w4', (parseFloat(row.feedweight) * (parseFloat(row.r4) / 100)).toFixed(2)) }
  1430. },
  1431. // 总比例
  1432. blurR(row) {
  1433. if (row.r1 == '') { row.r1 = 0 }
  1434. if (row.r2 == '') { row.r2 = 0 }
  1435. if (row.r3 == '') { row.r3 = 0 }
  1436. if (row.r4 == '') { row.r4 = 0 }
  1437. if (row.r1 !== '') {
  1438. row.w1 = parseFloat(row.feedweight) * parseFloat(row.r1) / 100
  1439. row.w1 = row.w1.toFixed(2)
  1440. }
  1441. if (row.r2 !== '') {
  1442. row.w2 = parseFloat(row.feedweight) * parseFloat(row.r2) / 100
  1443. row.w2 = row.w2.toFixed(2)
  1444. }
  1445. if (row.r3 !== '') {
  1446. row.w3 = parseFloat(row.feedweight) * parseFloat(row.r3) / 100
  1447. row.w3 = row.w3.toFixed(2)
  1448. }
  1449. if (row.r4 !== '') {
  1450. row.w4 = parseFloat(row.feedweight) * parseFloat(row.r4) / 100
  1451. row.w4 = row.w4.toFixed(2)
  1452. }
  1453. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1454. },
  1455. // 一班重量得到焦点
  1456. focusW(row) {
  1457. console.log(row)
  1458. this.focusWRow = Object.assign({}, row)
  1459. },
  1460. // 1班重量得到焦点
  1461. focusW2(row) {
  1462. console.log(row)
  1463. this.focusWRow2 = Object.assign({}, row)
  1464. },
  1465. // 3班重量得到焦点
  1466. focusW3(row) {
  1467. console.log(row)
  1468. this.focusWRow3 = Object.assign({}, row)
  1469. },
  1470. // 4班重量得到焦点
  1471. focusW4(row) {
  1472. console.log(row)
  1473. this.focusWRow4 = Object.assign({}, row)
  1474. },
  1475. // 一班重量
  1476. blurW(row) {
  1477. if (row.w1 == '') {
  1478. row.w1 = 0
  1479. }
  1480. if (row.w2 == '') {
  1481. row.w2 = 0
  1482. }
  1483. if (row.w3 == '') {
  1484. row.w3 = 0
  1485. }
  1486. if (row.w4 == '') {
  1487. row.w4 = 0
  1488. }
  1489. if (row.r1 == '') {
  1490. row.r1 = 0
  1491. }
  1492. if (row.r2 == '') {
  1493. row.r2 = 0
  1494. }
  1495. if (row.r3 == '') {
  1496. row.r3 = 0
  1497. }
  1498. if (row.r4 == '') {
  1499. row.r4 = 0
  1500. }
  1501. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1502. console.log(row, '=======投喂量feedweight')
  1503. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1504. if (this.table.RWLength == 4) {
  1505. // 2班3班4班都锁定
  1506. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1507. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1508. this.$set(row, 'sumr', parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4))
  1509. }
  1510. // 2班3班锁定4班未锁定
  1511. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1512. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1513. row.w4 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1514. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1515. if (row.w4 <= 0) {
  1516. row.w4 = 0
  1517. row.r4 = 0
  1518. }
  1519. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1520. }
  1521. // 2班4班锁定3班未锁定
  1522. if (row.isTwoWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1523. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1524. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)).toFixed(2)
  1525. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1526. if (row.w3 <= 0) {
  1527. row.w3 = 0
  1528. row.r3 = 0
  1529. }
  1530. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1531. }
  1532. // 3班4班锁定2班未锁定
  1533. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1534. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1535. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  1536. row.r2 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1537. if (row.w2 <= 0) {
  1538. row.w2 = 0
  1539. row.r2 = 0
  1540. }
  1541. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1542. }
  1543. // 2班锁定,3班4班未锁
  1544. if (row.isTwoWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1545. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1546. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1547. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1548. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4))).toFixed(2)
  1549. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1550. if (row.w3 <= 0) {
  1551. row.w3 = 0
  1552. row.r3 = 0
  1553. }
  1554. if (row.w4 <= 0) {
  1555. row.w4 = 0
  1556. row.r4 = 0
  1557. }
  1558. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1559. }
  1560. // 3班锁定,2班4班未锁
  1561. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1562. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1563. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1564. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1565. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4))).toFixed(2)
  1566. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1567. if (row.w2 <= 0) {
  1568. row.w2 = 0
  1569. row.r2 = 0
  1570. }
  1571. if (row.w4 <= 0) {
  1572. row.w4 = 0
  1573. row.r4 = 0
  1574. }
  1575. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1576. }
  1577. // 4班锁定,2班3班未锁
  1578. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1579. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1580. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3))).toFixed(2)
  1581. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1582. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3))).toFixed(2)
  1583. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1584. if (row.w2 <= 0) {
  1585. row.w2 = 0
  1586. row.r2 = 0
  1587. }
  1588. if (row.w3 <= 0) {
  1589. row.w3 = 0
  1590. row.r3 = 0
  1591. }
  1592. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1593. }
  1594. // 2班3班4班未锁
  1595. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1596. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1597. 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)
  1598. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1599. 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)
  1600. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1601. 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)
  1602. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1603. if (row.w2 <= 0) {
  1604. row.w2 = 0
  1605. row.r2 = 0
  1606. }
  1607. if (row.w3 <= 0) {
  1608. row.w3 = 0
  1609. row.r3 = 0
  1610. }
  1611. if (row.w4 <= 0) {
  1612. row.w4 = 0
  1613. row.r4 = 0
  1614. }
  1615. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1616. }
  1617. } else if (this.table.RWLength == 3) {
  1618. // 三班
  1619. // 2班/3班锁定
  1620. if (row.isTwoWeight == true && row.isThreeWeight == true) {
  1621. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1622. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1623. }
  1624. // 2班不锁3班锁
  1625. if (row.isTwoWeight == false && row.isThreeWeight == true) {
  1626. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1627. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)).toFixed(2)
  1628. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1629. if (row.w2 <= 0) {
  1630. row.w2 = 0
  1631. row.r2 = 0
  1632. }
  1633. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1634. }
  1635. // 3班不锁2班锁
  1636. if (row.isTwoWeight == true && row.isThreeWeight == false) {
  1637. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1638. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)).toFixed(2)
  1639. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1640. if (row.w3 <= 0) {
  1641. row.w3 = 0
  1642. row.r3 = 0
  1643. }
  1644. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1645. }
  1646. // 2班3班都不锁
  1647. if (row.isTwoWeight == false && row.isThreeWeight == false) {
  1648. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1649. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3))).toFixed(2)
  1650. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1651. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3))).toFixed(2)
  1652. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1653. if (row.w3 <= 0) {
  1654. row.w3 = 0
  1655. row.r3 = 0
  1656. }
  1657. if (row.w2 <= 0) {
  1658. row.w2 = 0
  1659. row.r2 = 0
  1660. }
  1661. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1662. }
  1663. } else if (this.table.RWLength == 2) {
  1664. // 两班isOneWeight,isTwoWeight
  1665. if (row.w1 == '') { row.w1 = 0 }
  1666. if (row.w2 == '') { row.w2 = 0 }
  1667. if (row.r1 == '') { row.r1 = 0 }
  1668. if (row.r2 == '') { row.r2 = 0 }
  1669. if (row.isTwoWeight == false) {
  1670. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1671. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1)).toFixed(2)
  1672. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1673. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1674. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2)).toFixed(2))
  1675. } else {
  1676. row.r1 = parseFloat(row.w1) / parseFloat(row.feedweight) * 100
  1677. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2)).toFixed(2))
  1678. }
  1679. }
  1680. },
  1681. blurW2(row) {
  1682. // 2班重量
  1683. if (row.w1 == '') {
  1684. row.w1 = 0
  1685. }
  1686. if (row.w2 == '') {
  1687. row.w2 = 0
  1688. }
  1689. if (row.w3 == '') {
  1690. row.w3 = 0
  1691. }
  1692. if (row.w4 == '') {
  1693. row.w4 = 0
  1694. }
  1695. if (row.r1 == '') {
  1696. row.r1 = 0
  1697. }
  1698. if (row.r2 == '') {
  1699. row.r2 = 0
  1700. }
  1701. if (row.r3 == '') {
  1702. row.r3 = 0
  1703. }
  1704. if (row.r4 == '') {
  1705. row.r4 = 0
  1706. }
  1707. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1708. console.log(row, '=======投喂量feedweight')
  1709. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1710. if (this.table.RWLength == 4) {
  1711. // 四班
  1712. // 1班3班4班都锁定
  1713. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1714. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1715. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1716. }
  1717. // 1班3班锁定4班未锁定
  1718. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1719. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1720. row.w4 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1721. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1722. if (row.w4 <= 0) {
  1723. row.w4 = 0
  1724. row.r4 = 0
  1725. }
  1726. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1727. }
  1728. // 1班4班锁定3班未锁定
  1729. if (row.isOneWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1730. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1731. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)).toFixed(2)
  1732. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1733. if (row.w3 <= 0) {
  1734. row.w3 = 0
  1735. row.r3 = 0
  1736. }
  1737. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1738. }
  1739. // 3班4班锁定1班未锁定
  1740. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1741. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1742. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  1743. row.r1 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1744. if (row.w1 <= 0) {
  1745. row.w1 = 0
  1746. row.r1 = 0
  1747. }
  1748. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1749. }
  1750. // 1班锁定,3班4班未锁
  1751. if (row.isOneWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1752. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1753. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1754. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1755. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4))).toFixed(2)
  1756. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1757. if (row.w3 <= 0) {
  1758. row.w3 = 0
  1759. row.r3 = 0
  1760. }
  1761. if (row.w4 <= 0) {
  1762. row.w4 = 0
  1763. row.r4 = 0
  1764. }
  1765. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1766. }
  1767. // 3班锁定,1班4班未锁
  1768. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1769. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1770. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2))).toFixed(2)
  1771. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1772. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r2))).toFixed(2)
  1773. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1774. if (row.w1 <= 0) {
  1775. row.w1 = 0
  1776. row.r1 = 0
  1777. }
  1778. if (row.w4 <= 0) {
  1779. row.w4 = 0
  1780. row.r4 = 0
  1781. }
  1782. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1783. }
  1784. // 4班锁定,1班3班未锁
  1785. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1786. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1787. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r3))).toFixed(2)
  1788. row.r1 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1789. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r3))).toFixed(2)
  1790. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1791. if (row.w1 <= 0) {
  1792. row.w1 = 0
  1793. row.r1 = 0
  1794. }
  1795. if (row.w3 <= 0) {
  1796. row.w3 = 0
  1797. row.r3 = 0
  1798. }
  1799. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1800. }
  1801. // 1班3班4班未锁
  1802. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1803. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1804. 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)
  1805. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1806. 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)
  1807. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1808. 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)
  1809. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1810. if (row.w1 <= 0) {
  1811. row.w1 = 0
  1812. row.r1 = 0
  1813. }
  1814. if (row.w3 <= 0) {
  1815. row.w3 = 0
  1816. row.r3 = 0
  1817. }
  1818. if (row.w4 <= 0) {
  1819. row.w4 = 0
  1820. row.r4 = 0
  1821. }
  1822. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1823. }
  1824. } else if (this.table.RWLength == 3) {
  1825. // 三班
  1826. // 1班/3班锁定
  1827. if (row.isOneWeight == true && row.isThreeWeight == true) {
  1828. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1829. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1830. }
  1831. // 1班不锁3班锁
  1832. if (row.isOneWeight == false && row.isThreeWeight == true) {
  1833. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1834. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1835. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1836. if (row.w1 <= 0) {
  1837. row.w1 = 0
  1838. row.r1 = 0
  1839. }
  1840. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1841. }
  1842. // 3班不锁1班锁
  1843. if (row.isOneWeight == true && row.isThreeWeight == false) {
  1844. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1845. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2)).toFixed(2)
  1846. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1847. if (row.w3 <= 0) {
  1848. row.w3 = 0
  1849. row.r3 = 0
  1850. }
  1851. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1852. }
  1853. // 1班3班都不锁
  1854. if (row.isOneWeight == false && row.isThreeWeight == false) {
  1855. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1856. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3))).toFixed(2)
  1857. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1858. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3))).toFixed(2)
  1859. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1860. if (row.w3 <= 0) {
  1861. row.w3 = 0
  1862. row.r3 = 0
  1863. }
  1864. if (row.w1 <= 0) {
  1865. row.w1 = 0
  1866. row.r1 = 0
  1867. }
  1868. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  1869. }
  1870. } else if (this.table.RWLength == 2) {
  1871. // 两班
  1872. if (row.isTwoWeight == false) {
  1873. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1874. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2))
  1875. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1876. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1877. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2)).toFixed(2))
  1878. } else {
  1879. row.r2 = parseFloat(row.w2) / parseFloat(row.feedweight) * 100
  1880. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2)).toFixed(2))
  1881. }
  1882. }
  1883. },
  1884. blurW3(row) {
  1885. // 3班重量
  1886. if (row.w1 == '') {
  1887. row.w1 = 0
  1888. }
  1889. if (row.w2 == '') {
  1890. row.w2 = 0
  1891. }
  1892. if (row.w3 == '') {
  1893. row.w3 = 0
  1894. }
  1895. if (row.w4 == '') {
  1896. row.w4 = 0
  1897. }
  1898. if (row.r1 == '') {
  1899. row.r1 = 0
  1900. }
  1901. if (row.r2 == '') {
  1902. row.r2 = 0
  1903. }
  1904. if (row.r3 == '') {
  1905. row.r3 = 0
  1906. }
  1907. if (row.r4 == '') {
  1908. row.r4 = 0
  1909. }
  1910. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1911. console.log(row, '=======投喂量feedweight')
  1912. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1913. if (this.table.RWLength == 4) {
  1914. // 四班
  1915. // 1班2班4班都锁定
  1916. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == true) {
  1917. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1918. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1919. }
  1920. // 1班2班锁定4班未锁定
  1921. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == false) {
  1922. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1923. row.w4 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  1924. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1925. if (row.w4 <= 0) {
  1926. row.w4 = 0
  1927. row.r4 = 0
  1928. }
  1929. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1930. }
  1931. // 2班4班锁定1班未锁定
  1932. if (row.isOneWeight == false && row.isTwoWeight == true && row.isFourWeight == true) {
  1933. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1934. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  1935. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1936. if (row.w1 <= 0) {
  1937. row.w1 = 0
  1938. row.r1 = 0
  1939. }
  1940. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1941. }
  1942. // 1班4班锁定2班未锁定
  1943. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == true) {
  1944. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100)
  1945. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  1946. row.r2 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1947. if (row.w2 <= 0) {
  1948. row.w2 = 0
  1949. row.r2 = 0
  1950. }
  1951. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1952. }
  1953. // 2班锁定,1班4班未锁
  1954. if (row.isTwoWeight == true && row.isOneWeight == false && row.isFourWeight == false) {
  1955. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  1956. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1957. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1958. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r4))).toFixed(2)
  1959. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1960. if (row.w1 <= 0) {
  1961. row.w1 = 0
  1962. row.r1 = 0
  1963. }
  1964. if (row.w4 <= 0) {
  1965. row.w4 = 0
  1966. row.r4 = 0
  1967. }
  1968. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1969. }
  1970. // 1班锁定,2班4班未锁
  1971. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == false) {
  1972. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1973. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r4))).toFixed(2)
  1974. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1975. row.w4 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4))).toFixed(2)
  1976. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  1977. if (row.w2 <= 0) {
  1978. row.w2 = 0
  1979. row.r2 = 0
  1980. }
  1981. if (row.w4 <= 0) {
  1982. row.w4 = 0
  1983. row.r4 = 0
  1984. }
  1985. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  1986. }
  1987. // 4班锁定,2班1班未锁
  1988. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == true) {
  1989. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100)
  1990. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r1) + parseFloat(this.focusWRow.r2))).toFixed(2)
  1991. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  1992. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r1) + parseFloat(row.r2))).toFixed(2)
  1993. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  1994. if (row.w2 <= 0) {
  1995. row.w2 = 0
  1996. row.r2 = 0
  1997. }
  1998. if (row.w1 <= 0) {
  1999. row.w1 = 0
  2000. row.r1 = 0
  2001. }
  2002. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2003. }
  2004. // 2班1班4班未锁
  2005. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == false) {
  2006. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2007. 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)
  2008. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  2009. 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)
  2010. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  2011. 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)
  2012. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2013. if (row.w1 <= 0) {
  2014. row.w1 = 0
  2015. row.r1 = 0
  2016. }
  2017. if (row.w2 <= 0) {
  2018. row.w2 = 0
  2019. row.r2 = 0
  2020. }
  2021. if (row.w4 <= 0) {
  2022. row.w4 = 0
  2023. row.r4 = 0
  2024. }
  2025. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2026. }
  2027. } else if (this.table.RWLength == 3) {
  2028. // 三班
  2029. // 1班/2班锁定
  2030. if (row.isOneWeight == true && row.isTwoWeight == true) {
  2031. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2032. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  2033. }
  2034. // 1班不锁2班锁
  2035. if (row.isOneWeight == false && row.isTwoWeight == true) {
  2036. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2037. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  2038. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  2039. if (row.w1 <= 0) {
  2040. row.w1 = 0
  2041. row.r1 = 0
  2042. }
  2043. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  2044. }
  2045. // 3班不锁2班锁
  2046. // 2班不锁1班锁
  2047. if (row.isOneWeight == true && row.isTwoWeight == false) {
  2048. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2049. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3)).toFixed(2)
  2050. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  2051. if (row.w2 <= 0) {
  2052. row.w2 = 0
  2053. row.r2 = 0
  2054. }
  2055. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)).toFixed(2))
  2056. }
  2057. // 2班3班都不锁
  2058. // 1班2班都不锁
  2059. if (row.isOneWeight == false && row.isTwoWeight == false) {
  2060. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2061. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2))).toFixed(2)
  2062. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  2063. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2))).toFixed(2)
  2064. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  2065. if (row.w1 <= 0) {
  2066. row.w1 = 0
  2067. row.r1 = 0
  2068. }
  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. }
  2076. },
  2077. blurW4(row) {
  2078. if (row.w1 == '') {
  2079. row.w1 = 0
  2080. }
  2081. if (row.w2 == '') {
  2082. row.w2 = 0
  2083. }
  2084. if (row.w3 == '') {
  2085. row.w3 = 0
  2086. }
  2087. if (row.w4 == '') {
  2088. row.w4 = 0
  2089. }
  2090. if (row.r1 == '') {
  2091. row.r1 = 0
  2092. }
  2093. if (row.r2 == '') {
  2094. row.r2 = 0
  2095. }
  2096. if (row.r3 == '') {
  2097. row.r3 = 0
  2098. }
  2099. if (row.r4 == '') {
  2100. row.r4 = 0
  2101. }
  2102. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2103. console.log(row, '=======投喂量feedweight')
  2104. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2105. if (this.table.RWLength == 4) {
  2106. // 四班
  2107. // 1班2班3班都锁定
  2108. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == true) {
  2109. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2110. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2111. }
  2112. // 2班3班锁定1班未锁定
  2113. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == true) {
  2114. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2115. row.w1 = (parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)).toFixed(2)
  2116. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  2117. if (row.w1 <= 0) {
  2118. row.w1 = 0
  2119. row.r1 = 0
  2120. }
  2121. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2122. }
  2123. // 2班1班锁定3班未锁定
  2124. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == false) {
  2125. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2126. row.w3 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)).toFixed(2)
  2127. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2128. if (row.w3 <= 0) {
  2129. row.w3 = 0
  2130. row.r3 = 0
  2131. }
  2132. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2133. }
  2134. // 3班1班锁定2班未锁定
  2135. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == true) {
  2136. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2137. row.w2 = (parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)).toFixed(2)
  2138. row.r2 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2139. if (row.w2 <= 0) {
  2140. row.w2 = 0
  2141. row.r2 = 0
  2142. }
  2143. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2144. }
  2145. // 2班锁定,3班1班未锁
  2146. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == false) {
  2147. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2148. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r1))).toFixed(2)
  2149. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2150. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r1))).toFixed(2)
  2151. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  2152. if (row.w3 <= 0) {
  2153. row.w3 = 0
  2154. row.r3 = 0
  2155. }
  2156. if (row.w1 <= 0) {
  2157. row.w1 = 0
  2158. row.r1 = 0
  2159. }
  2160. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2161. }
  2162. // 3班锁定,2班1班未锁
  2163. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == true) {
  2164. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  2165. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r1))).toFixed(2)
  2166. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  2167. row.w1 = ((parseFloat(row.feedweight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r1))).toFixed(2)
  2168. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  2169. if (row.w2 <= 0) {
  2170. row.w2 = 0
  2171. row.r2 = 0
  2172. }
  2173. if (row.w1 <= 0) {
  2174. row.w1 = 0
  2175. row.r1 = 0
  2176. }
  2177. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2178. }
  2179. // 1班锁定,2班3班未锁
  2180. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == false) {
  2181. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2182. row.w2 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3))).toFixed(2)
  2183. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  2184. row.w3 = ((parseFloat(row.feedweight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3))).toFixed(2)
  2185. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2186. if (row.w2 <= 0) {
  2187. row.w2 = 0
  2188. row.r2 = 0
  2189. }
  2190. if (row.w3 <= 0) {
  2191. row.w3 = 0
  2192. row.r3 = 0
  2193. }
  2194. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2195. }
  2196. // 2班3班1班未锁
  2197. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == false) {
  2198. row.r4 = (parseFloat(row.w4) / parseFloat(row.feedweight) * 100).toFixed(2)
  2199. 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)
  2200. row.r1 = (parseFloat(row.w1) / parseFloat(row.feedweight) * 100).toFixed(2)
  2201. 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)
  2202. row.r2 = (parseFloat(row.w2) / parseFloat(row.feedweight) * 100).toFixed(2)
  2203. 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)
  2204. row.r3 = (parseFloat(row.w3) / parseFloat(row.feedweight) * 100).toFixed(2)
  2205. if (row.w1 <= 0) {
  2206. row.w1 = 0
  2207. row.r1 = 0
  2208. }
  2209. if (row.w2 <= 0) {
  2210. row.w2 = 0
  2211. row.r2 = 0
  2212. }
  2213. if (row.w3 <= 0) {
  2214. row.w3 = 0
  2215. row.r3 = 0
  2216. }
  2217. this.$set(row, 'sumr', (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)).toFixed(2))
  2218. }
  2219. }
  2220. },
  2221. // 编辑
  2222. handleUpdate(row) {
  2223. console.log(row)
  2224. for (let i = 0; i < this.table.list.length; i++) {
  2225. if (this.table.list[i].Edit == true) {
  2226. this.$message({
  2227. type: 'error',
  2228. message: '当前内容未保存,请点击取消或保存继续进行操作',
  2229. duration: 2000
  2230. })
  2231. return false
  2232. }
  2233. }
  2234. // 编辑true,不可编辑false
  2235. row.Edit = true
  2236. row.NoEdit = false
  2237. // 编辑false,编辑保存true
  2238. row.isUpdate = false
  2239. row.isUpdateSave = true
  2240. row.ftid = String(row.ftid)
  2241. if (row.ptsfid == '-1') {
  2242. row.ptsfid = ''
  2243. }
  2244. row.ptsfid = String(row.ptsfid)
  2245. this.table.temp.ftid = row.ftid
  2246. this.table.temp.ftname = row.ftname
  2247. this.table.temp.ptsfid = row.ptsfid
  2248. this.table.temp.ptsfname = row.ptsfname
  2249. },
  2250. updateData(row) {
  2251. console.log(row)
  2252. if (row.r1 == 'NaN') { this.$set(row, 'r1', 0) }
  2253. if (row.r2 == 'NaN') { this.$set(row, 'r2', 0) }
  2254. if (row.r3 == 'NaN') { this.$set(row, 'r3', 0) }
  2255. if (row.r4 == 'NaN') { this.$set(row, 'r4', 0) }
  2256. if (row.w1 == 'NaN') { this.$set(row, 'w1', 0) }
  2257. if (row.w2 == 'NaN') { this.$set(row, 'w2', 0) }
  2258. if (row.w3 == 'NaN') { this.$set(row, 'w3', 0) }
  2259. if (row.w4 == 'NaN') { this.$set(row, 'w4', 0) }
  2260. console.log(row)
  2261. var arr = []
  2262. for (let i = 1; i <= this.table.RWLength; i++) {
  2263. var obj = {}
  2264. obj['times'] = i
  2265. obj['pastureid'] = row.pastureid
  2266. obj['barid'] = row.barid
  2267. obj['cowcount'] = row.ccount
  2268. obj['ccountradio'] = row.ccountradio
  2269. obj['ptid'] = row.ftid
  2270. if (row.ptsfid !== '') {
  2271. obj['ptsid'] = row.ptsfid
  2272. } else {
  2273. obj['ptsid'] = '-1'
  2274. }
  2275. obj['weight'] = row['w' + i]
  2276. obj['tratio'] = Math.round(row['r' + i])
  2277. arr.push(obj)
  2278. }
  2279. if (row.ptsfid == '') {
  2280. row.ptsfid = '-1'
  2281. }
  2282. if (row.supplyweight == '') {
  2283. row.supplyweight = '0'
  2284. }
  2285. if (this.table.isPtsfname == false) {
  2286. row.supplyweight = '0'
  2287. }
  2288. this.$set(row, 'ratio', parseFloat(row.ratio).toFixed(2))
  2289. row.sumr = Math.round(row.sumr)
  2290. this.table.rwList = arr
  2291. console.log('点击了编辑保存', row)
  2292. this.table.temp.pastureid = row.pastureid
  2293. this.table.temp.id = row.id
  2294. this.table.temp.barname = row.barname
  2295. this.table.temp.barid = row.barid
  2296. this.table.temp.ccount = row.ccount
  2297. this.table.temp.ratio = row.ratio
  2298. this.table.temp.ccountratio = row.ccountratio
  2299. this.table.temp.ftid = row.ftid
  2300. this.table.temp.ftname = row.ftname
  2301. this.table.temp.ptsfid = row.ptsfid
  2302. this.table.temp.ptsfname = row.ptsfname
  2303. this.table.temp.ftweight = row.ftweight
  2304. this.table.temp.supplyweight = row.supplyweight
  2305. this.table.temp.feedweight = row.feedweight
  2306. this.table.temp.owner = row.owner
  2307. this.table.temp.sumr = row.sumr
  2308. if (row.softccount == '') {
  2309. row.softccount = 0
  2310. }
  2311. if (row.r1 == '') {
  2312. row.r1 = 0
  2313. }
  2314. if (row.r2 == '') {
  2315. row.r2 = 0
  2316. }
  2317. if (row.r3 == '') {
  2318. row.r3 = 0
  2319. }
  2320. if (row.r4 == '') {
  2321. row.r4 = 0
  2322. }
  2323. if (row.w1 == '') {
  2324. row.w1 = 0
  2325. }
  2326. if (row.w2 == '' || row.w4 == NaN) {
  2327. row.w2 = 0
  2328. }
  2329. if (row.w3 == '' || row.w4 == NaN) {
  2330. row.w3 = 0
  2331. }
  2332. if (row.w4 == '' || row.w4 == NaN) {
  2333. row.w4 = 0
  2334. }
  2335. console.log(row, '===========')
  2336. this.table.temp.softccount = row.softccount
  2337. this.table.temp.r1 = Math.round(row.r1)
  2338. this.table.temp.r2 = Math.round(row.r2)
  2339. this.table.temp.r3 = Math.round(row.r3)
  2340. this.table.temp.r4 = Math.round(row.r4)
  2341. this.table.temp.w1 = row.w1
  2342. this.table.temp.w2 = row.w2
  2343. this.table.temp.w3 = row.w3
  2344. this.table.temp.w4 = row.w4
  2345. if (this.table.temp.ccount == '' && this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2346. this.$message({
  2347. type: 'error',
  2348. message: '实际牛头数/系数/系数头数/配方模版不能为空',
  2349. duration: 2000
  2350. })
  2351. return false
  2352. }
  2353. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2354. this.$message({
  2355. type: 'error',
  2356. message: '系数/系数头数/配方模版不能为空',
  2357. duration: 2000
  2358. })
  2359. return false
  2360. }
  2361. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2362. this.$message({
  2363. type: 'error',
  2364. message: '系数头数/配方模版不能为空',
  2365. duration: 2000
  2366. })
  2367. return false
  2368. }
  2369. if (this.table.temp.ccount == '') {
  2370. this.$message({
  2371. type: 'error',
  2372. message: '实际牛头数不能为空',
  2373. duration: 2000
  2374. })
  2375. return false
  2376. }
  2377. if (this.table.temp.ratio == '') {
  2378. this.$message({
  2379. type: 'error',
  2380. message: '系数不能为空',
  2381. duration: 2000
  2382. })
  2383. return false
  2384. }
  2385. if (this.table.temp.ccountratio == '') {
  2386. this.$message({
  2387. type: 'error',
  2388. message: '系数头数不能为空',
  2389. duration: 2000
  2390. })
  2391. return false
  2392. }
  2393. if (this.table.temp.ftid == '') {
  2394. this.$message({
  2395. type: 'error',
  2396. message: '配方模版不能为空',
  2397. duration: 2000
  2398. })
  2399. return false
  2400. }
  2401. const positiveInteger = /^[1-9]\d*$/
  2402. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  2403. this.$message({
  2404. type: 'error',
  2405. message: '实际牛头数请输入正整数',
  2406. duration: 2000
  2407. })
  2408. return false
  2409. }
  2410. this.isokDisable = true
  2411. setTimeout(() => {
  2412. this.isokDisable = false
  2413. }, 1000)
  2414. // this.requestParam.parammaps = this.table.temp
  2415. this.requestParam.common = {
  2416. 'returnmap': '0'
  2417. }
  2418. this.requestParam.data = []
  2419. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  2420. pastureid: row.pastureid,
  2421. id: row.id,
  2422. barname: row.barname,
  2423. barid: row.barid,
  2424. softccount: row.softccount,
  2425. ccount: row.ccount,
  2426. ratio: row.ratio,
  2427. ccountratio: row.ccountratio,
  2428. ftid: row.ftid,
  2429. ftname: row.ftname,
  2430. ptsfid: row.ptsfid,
  2431. ptsfname: row.ptsfname,
  2432. ftweight: row.ftweight,
  2433. supplyweight: row.supplyweight,
  2434. feedweight: row.feedweight,
  2435. owner: row.owner,
  2436. sumr: row.sumr
  2437. }}
  2438. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  2439. this.requestParam.data[1].children = []
  2440. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  2441. pastureid: '@insertSpotList.pastureid',
  2442. barname: row.barname,
  2443. barid: '@insertSpotList.barid',
  2444. times: '@insertSpotList.times',
  2445. tratio: '@insertSpotList.tratio',
  2446. weight: '@insertSpotList.weight',
  2447. cowcount: '@insertSpotList.cowcount',
  2448. ccountradio: row.ccountratio,
  2449. ptid: '@insertSpotList.ptid',
  2450. ptsid: '@insertSpotList.ptsid',
  2451. feedweight: row.feedweight,
  2452. supplyweight: row.supplyweight,
  2453. ratio: row.ratio
  2454. }}
  2455. this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  2456. pastureid: row.pastureid,
  2457. fpid: row.id
  2458. }}
  2459. ExecDataByConfig(this.requestParam).then(response => {
  2460. console.log('编辑保存发送参数', this.requestParam)
  2461. if (response.msg === 'fail') {
  2462. this.$notify({
  2463. title: '保存失败',
  2464. message: response.data,
  2465. type: 'warning',
  2466. duration: 2000
  2467. })
  2468. } else {
  2469. this.$notify({
  2470. title: '成功',
  2471. message: '保存成功',
  2472. type: 'success',
  2473. duration: 2000
  2474. })
  2475. this.getList()
  2476. }
  2477. })
  2478. },
  2479. updateCancel(row) {
  2480. console.log('点击了编辑取消')
  2481. // 编辑false,不可编辑true
  2482. row.Edit = false
  2483. row.NoEdit = true
  2484. // 编辑true,编辑保存false
  2485. row.isUpdate = true
  2486. row.isUpdateSave = false
  2487. this.getList()
  2488. },
  2489. handleSelect(val) {
  2490. console.log('勾选数据', val)
  2491. this.selectList = val
  2492. },
  2493. // 营养评估
  2494. handleNutritional() {
  2495. console.log('点击了营养评估')
  2496. if (this.selectList.length !== 1) {
  2497. this.$message({
  2498. type: 'error',
  2499. message: '请选择一条栏舍信息进行营养评估',
  2500. duration: 2000
  2501. })
  2502. return false
  2503. } else {
  2504. console.log(this.nutritional.temp)
  2505. this.nutritional.dialogStatus = 'Nutritional'
  2506. this.nutritional.dialogFormVisible = true
  2507. this.nutritional.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2508. this.nutritional.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2509. this.getNutritionalList()
  2510. }
  2511. },
  2512. getNutritionalList() {
  2513. this.nutritional.listLoading1 = true
  2514. GetDataByName(this.nutritional.getdataListParm1).then(response => {
  2515. console.log('评估上方数据', response.data.list)
  2516. if (response.data.list !== null) {
  2517. response.data.list[0].cowclassid = String(response.data.list[0].cowclassid)
  2518. this.nutritional.temp = response.data.list[0]
  2519. this.nutritional.disabledCowclass = true
  2520. } else {
  2521. this.nutritional.temp = []
  2522. this.nutritional.disabledCowclass = false
  2523. }
  2524. setTimeout(() => {
  2525. this.nutritional.listLoading = false
  2526. }, 100)
  2527. })
  2528. },
  2529. assessmentData() {
  2530. console.log('评估保存')
  2531. this.$refs['temp'].validate(valid => {
  2532. if (valid) {
  2533. this.nutritional.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  2534. this.nutritional.getdataListParm2.parammaps.cowclassid = this.nutritional.temp.cowclassid
  2535. this.getNutritionalList2()
  2536. }
  2537. })
  2538. },
  2539. getNutritionalList2() {
  2540. this.nutritional.listLoading2 = true
  2541. GetDataByName(this.nutritional.getdataListParm2).then(response => {
  2542. console.log('评估下方数据', response.data.list)
  2543. if (response.data.list !== null) {
  2544. this.nutritional.list = response.data.list
  2545. this.nutritional.pageNum = response.data.pageNum
  2546. this.nutritional.pageSize = response.data.pageSize
  2547. this.nutritional.total = response.data.total
  2548. } else {
  2549. this.nutritional.list = []
  2550. }
  2551. setTimeout(() => {
  2552. this.nutritional.listLoading2 = false
  2553. }, 100)
  2554. })
  2555. },
  2556. // 历史记录
  2557. handleHistoryRecords() {
  2558. console.log('点击了历史记录')
  2559. this.history.dialogStatus = 'history'
  2560. this.history.dialogFormVisible = true
  2561. this.getDateList()
  2562. },
  2563. // 历史时间
  2564. getDateList() {
  2565. GetDataByName(this.history.getdataDateParm).then(response => {
  2566. console.log('table数据', response.data.list)
  2567. if (response.data.list !== null) {
  2568. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  2569. this.getHistoryIsDisplay()
  2570. } else {
  2571. this.history.getdataListParm.parammaps.date = ''
  2572. }
  2573. })
  2574. },
  2575. getHistoryIsDisplay() {
  2576. GetDataByName(this.table.getdataListParm2).then(response => {
  2577. console.log(response.data.list[0].inforvalue)
  2578. if (response.data.list !== null) {
  2579. if (response.data.list[0].inforvalue == 0) {
  2580. this.table.isPtsfname = false
  2581. } else {
  2582. this.table.isPtsfname = true
  2583. }
  2584. }
  2585. })
  2586. GetDataByName(this.table.getdataListParm3).then(response => {
  2587. if (response.data.list !== null) {
  2588. if (response.data.list[0].inforvalue == 1) {
  2589. this.history.isRW1 = true
  2590. this.history.isRW2 = false
  2591. this.history.isRW3 = false
  2592. this.history.isRW4 = false
  2593. } else if (response.data.list[0].inforvalue == 2) {
  2594. this.history.isRW1 = true
  2595. this.history.isRW2 = true
  2596. this.history.isRW3 = false
  2597. this.history.isRW4 = false
  2598. } else if (response.data.list[0].inforvalue == 3) {
  2599. this.history.isRW1 = true
  2600. this.history.isRW2 = true
  2601. this.history.isRW3 = true
  2602. this.history.isRW4 = false
  2603. } else if (response.data.list[0].inforvalue == 4) {
  2604. this.history.isRW1 = true
  2605. this.history.isRW2 = true
  2606. this.history.isRW3 = true
  2607. this.history.isRW4 = true
  2608. }
  2609. } else {
  2610. this.history.isRW1 = false
  2611. this.history.isRW2 = false
  2612. this.history.isRW3 = false
  2613. this.history.isRW4 = false
  2614. }
  2615. })
  2616. this.getHistoryList()
  2617. },
  2618. getHistoryList() {
  2619. this.history.listLoading = true
  2620. GetDataByName(this.history.getdataListParm).then(response => {
  2621. console.log('table数据', response.data.list)
  2622. if (response.data.list !== null) {
  2623. console.log('table数据', response.data.list)
  2624. for (let i = 0; i < response.data.list.length; i++) {
  2625. this.$set(response.data.list[i], 'Edit', false) // 编辑
  2626. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  2627. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  2628. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  2629. if (response.data.list[i].ftid == undefined || response.data.list[i].ftname == '') {
  2630. this.$set(response.data.list[i], 'ftid', '')
  2631. this.$set(response.data.list[i], 'ftname', '')
  2632. }
  2633. if (response.data.list[i].ptsfid == undefined || response.data.list[i].ptsfname == '') {
  2634. this.$set(response.data.list[i], 'ptsfid', '')
  2635. this.$set(response.data.list[i], 'ptsfname', '')
  2636. }
  2637. if (response.data.list[i].ccount == undefined) {
  2638. this.$set(response.data.list[i], 'ccount', '')
  2639. }
  2640. if (response.data.list[i].ratio == undefined) {
  2641. this.$set(response.data.list[i], 'ratio', '100')
  2642. }
  2643. if (response.data.list[i].ccountratio == undefined) {
  2644. this.$set(response.data.list[i], 'ccountratio', '')
  2645. }
  2646. if (response.data.list[i].r1 == undefined) {
  2647. this.$set(response.data.list[i], 'r1', '')
  2648. }
  2649. if (response.data.list[i].r2 == undefined) {
  2650. this.$set(response.data.list[i], 'r2', '')
  2651. }
  2652. if (response.data.list[i].r3 == undefined) {
  2653. this.$set(response.data.list[i], 'r3', '')
  2654. }
  2655. if (response.data.list[i].r4 == undefined) {
  2656. this.$set(response.data.list[i], 'r4', '')
  2657. }
  2658. if (response.data.list[i].w1 == undefined) {
  2659. this.$set(response.data.list[i], 'w1', '')
  2660. }
  2661. if (response.data.list[i].w2 == undefined) {
  2662. this.$set(response.data.list[i], 'w2', '')
  2663. }
  2664. if (response.data.list[i].w3 == undefined) {
  2665. this.$set(response.data.list[i], 'w3', '')
  2666. }
  2667. if (response.data.list[i].w4 == undefined) {
  2668. this.$set(response.data.list[i], 'w4', '')
  2669. }
  2670. if (response.data.list[i].feedweight == undefined) {
  2671. this.$set(response.data.list[i], 'feedweight', '')
  2672. }
  2673. if (response.data.list[i].Bfweight == undefined) {
  2674. this.$set(response.data.list[i], 'Bfweight', '')
  2675. }
  2676. if (response.data.list[i].Sfweight == undefined) {
  2677. this.$set(response.data.list[i], 'Sfweight', '')
  2678. }
  2679. if (response.data.list[i].timesopt !== undefined) {
  2680. var timesoptArr = response.data.list[i].timesopt.split(',')
  2681. for (let j = 0; j < timesoptArr.length; j++) {
  2682. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  2683. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  2684. }
  2685. }
  2686. }
  2687. this.history.list = response.data.list
  2688. for (let i = 0; i < response.data.list.length; i++) {
  2689. if (response.data.list[i].r1 == '') { response.data.list[i].r1 = 0 }
  2690. if (response.data.list[i].r2 == '') { response.data.list[i].r2 = 0 }
  2691. if (response.data.list[i].r3 == '') { response.data.list[i].r3 = 0 }
  2692. if (response.data.list[i].r4 == '') { response.data.list[i].r4 = 0 }
  2693. 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)))
  2694. }
  2695. this.history.pageNum = response.data.pageNum
  2696. this.history.pageSize = response.data.pageSize
  2697. this.history.total = response.data.total
  2698. } else {
  2699. this.history.list = []
  2700. }
  2701. setTimeout(() => {
  2702. this.history.listLoading = false
  2703. }, 100)
  2704. })
  2705. },
  2706. changeDate() {
  2707. this.getHistoryList()
  2708. },
  2709. // 应用
  2710. handleApplication() {
  2711. console.log('点击了应用')
  2712. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  2713. confirmButtonText: '确认',
  2714. cancelButtonText: '取消',
  2715. type: 'warning'
  2716. }).then(() => {
  2717. this.requestParam.name = 'applyFPdate'
  2718. this.requestParam.parammaps = {}
  2719. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  2720. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  2721. PostDataByName(this.requestParam).then(response => {
  2722. if (response.msg === 'fail') {
  2723. this.$notify({
  2724. title: '保存失败',
  2725. message: response.data,
  2726. type: 'warning',
  2727. duration: 2000
  2728. })
  2729. } else {
  2730. this.$notify({
  2731. title: '成功',
  2732. message: '保存成功',
  2733. type: 'success',
  2734. duration: 2000
  2735. })
  2736. this.getHistoryIsDisplay()
  2737. this.getList()
  2738. }
  2739. })
  2740. }).catch(() => {
  2741. this.$message({
  2742. type: 'info',
  2743. message: '已取消应用'
  2744. })
  2745. })
  2746. },
  2747. // 导出模板
  2748. handleExportTemp() {
  2749. console.log('点击了导出模板')
  2750. },
  2751. // 导出
  2752. handleExport() {
  2753. console.log('点击了导出数据')
  2754. },
  2755. // 导入
  2756. handleImport() {
  2757. console.log('点击了导入')
  2758. }
  2759. }
  2760. }
  2761. </script>
  2762. <style lang="scss" scoped>
  2763. .search {
  2764. clear: both;
  2765. }
  2766. .table {
  2767. margin-top: 10px;
  2768. }
  2769. </style>