bbf747f8f80e67a81096d6ff45fbc97a8c86b388.svn-base 160 KB

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