710a8c2a2e6574e97ab971aa58a1ddc150f62a4f.svn-base 124 KB

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