index.vue 251 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate1">设置推料时间</el-button>
  5. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate">设置允许误差时间</el-button>
  6. <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" style="float: left;" @click="handleTakeEffect">启用</el-button>
  7. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" style="float: left;" @click="handleDisable">禁用</el-button>
  8. <el-button v-if="isRoleEdit" class="success" style="float: left;" @click="handleCheck">校验</el-button>
  9. </div>
  10. <div class="table">
  11. <el-table
  12. :key="table.tableKey"
  13. ref="table"
  14. v-loading="table.listLoading"
  15. element-loading-text="给我一点时间"
  16. :data="table.list"
  17. border
  18. fit
  19. highlight-current-row
  20. style="width: 100%;"
  21. :row-style="rowStyle"
  22. :cell-style="cellStyle"
  23. class="elTable table-fixed"
  24. :max-height="myHeight"
  25. @header-click="headerClick"
  26. @cell-click="cellClick"
  27. @selection-change="handleSelect"
  28. @cell-dblclick="celldblclick"
  29. >
  30. <el-table-column type="selection" width="50" />
  31. <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left" />
  32. <el-table-column label="栏舍名称" min-width="100px" align="center" class-name="small-padding fixed-width" fixed="left">
  33. <template slot-scope="scope">
  34. <span>{{ scope.row.barname }}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column :key="2" label="推料车名称" min-width="70px" align="center">
  38. <template slot-scope="scope">
  39. <span>{{ scope.row.softccount }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column :key="3" label="推料车编号" min-width="90px" align="center">
  43. <template slot-scope="scope">
  44. <span v-if="scope.row.NoEdit">{{ scope.row.ccount }}</span>
  45. <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)" />
  46. </template>
  47. </el-table-column>
  48. <el-table-column :key="4" label="推料时间(每天)" min-width="85px" align="center">
  49. <template slot-scope="scope">
  50. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  51. <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)" />
  52. </template>
  53. </el-table-column>
  54. <el-table-column :key="5" label="允许误差时间(分钟)" min-width="85px" align="center">
  55. <template slot-scope="scope">
  56. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  57. <el-input v-if="scope.row.Edit" v-model="scope.row.ccountratio" type="number" style="width:95%;padding:10px 0;" @blur="blurCcountratio(scope.row)" />
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  61. <template slot-scope="{row}">
  62. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  63. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  64. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  65. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
  70. </div>
  71. <el-dialog :fullscreen="dialogFull" :visible.sync="create1.dialogFormVisible" :close-on-click-modal="false" width="50%">
  72. <template slot="title">
  73. <div class="avue-crud__dialog__header">
  74. <span class="el-dialog__title">
  75. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  76. 推料计划
  77. </span>
  78. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  79. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  80. <svg-icon v-else icon-class="fullscreen" />
  81. </div>
  82. </div>
  83. </template>
  84. <div class="app-add">
  85. <el-form ref="temp" :rules="create1.rules" :model="create1.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
  86. <el-row>
  87. <el-col :span="6">
  88. <el-form-item label="设置时间:" prop="useinbarid">
  89. <el-time-picker
  90. v-model="value1"
  91. :picker-options="{
  92. selectableRange: '00:00:00 - 23:59:59'
  93. }"
  94. placeholder="任意时间点">
  95. </el-time-picker>
  96. </el-form-item>
  97. </el-col>
  98. </el-row>
  99. </el-form>
  100. <div slot="footer" class="dialog-footer">
  101. <el-button class="cancelClose" @click="create1.dialogFormVisible = false;getList()">关闭</el-button>
  102. <el-button class="save" @click="handleCreate">确认</el-button>
  103. </div>
  104. </div>
  105. </el-dialog>
  106. </div>
  107. </template>
  108. <script>
  109. import { GetDataByName, postJson, GetDataByNames, compareSort, ExecDataByConfig, failproccess, PostDataByName, formatNum, checkButtons } from '@/api/common'
  110. import Pagination from '@/components/Pagination'
  111. import Pagination2 from '@/components/Pagination2'
  112. import { parseTime, json2excel, handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  113. import { MessageBox } from 'element-ui'
  114. import Cookies from 'js-cookie'
  115. import axios from 'axios'
  116. import { getToken } from '@/utils/auth'
  117. export default {
  118. inject: ['reload'],
  119. name: 'PushMaterialPlan',
  120. components: { Pagination, Pagination2 },
  121. data() {
  122. return {
  123. value1: new Date(2016, 9, 10, 18, 40),
  124. dialogFull: false,
  125. isRoleEdit: [],
  126. headerList: [],
  127. pickerMinDate: '',
  128. pickerOptions: {
  129. onPick: ({ maxDate, minDate }) => {
  130. this.pickerMinDate = minDate.getTime()
  131. if (maxDate) {
  132. this.pickerMinDate = ''
  133. }
  134. },
  135. // 限制不能选择今天之后的日期
  136. disabledDate: (time) => {
  137. if (this.pickerMinDate !== '') {
  138. const one = 31 * 24 * 3600 * 1000
  139. const minTime = this.pickerMinDate - one
  140. let maxTime = this.pickerMinDate + one
  141. if (maxTime > new Date()) {
  142. maxTime = new Date()
  143. }
  144. return time.getTime() < minTime - 8.64e7 || time.getTime() > maxTime - 8.64e7
  145. }
  146. return time.getTime() > Date.now() - 8.64e7
  147. }
  148. },
  149. requestParams: [
  150. { name: 'getFTSWLSList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  151. { name: 'getFTBLList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  152. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  153. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  154. ],
  155. getFeedTempletNameListParm: {
  156. name: 'getFeedTempletName',
  157. page: 1,
  158. offset: 1,
  159. // pagecount: parseInt(Cookies.get('pageCount')),
  160. pagecount: '',
  161. returntype: 'Map',
  162. parammaps: {}
  163. },
  164. tnameList: [], // 配方名 称
  165. recipeTemplateList: [], // 配方模板
  166. feedingFormulaList: [], // 补料配方
  167. livestockTypeList: [], // 类别
  168. barList: [],
  169. rules: {
  170. cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  171. },
  172. table: {
  173. getdataListParm: {
  174. name: 'getFPList',
  175. page: 1,
  176. offset: 1,
  177. // pagecount: parseInt(Cookies.get('pageCount')),
  178. pagecount: '',
  179. returntype: 'Map',
  180. parammaps: {
  181. pastureid: Cookies.get('pastureid'),
  182. enable: '',
  183. barid: '',
  184. tname: ''
  185. }
  186. },
  187. tableKey: 0,
  188. list: [],
  189. total: 0,
  190. listLoading: true,
  191. temp: {},
  192. rwList: [],
  193. isPtsfname: false, // 补料配方/补料重量
  194. getdataListParm2: {
  195. name: 'getSysoptEnable',
  196. page: 1,
  197. offset: 1,
  198. pagecount: 1,
  199. returntype: 'Map',
  200. parammaps: {
  201. pastureid: Cookies.get('pastureid'),
  202. inforname: 'isEnableSupplyFeed'
  203. }
  204. },
  205. getdataListParm3: {
  206. name: 'getSysoptEnable1',
  207. page: 1,
  208. offset: 1,
  209. pagecount: 1,
  210. returntype: 'Map',
  211. parammaps: {
  212. pastureid: Cookies.get('pastureid'),
  213. inforname: 'times'
  214. }
  215. },
  216. RWLength: '' // 班次长度
  217. },
  218. selectList: [],
  219. textMap: {
  220. Nutritional: '营养评估',
  221. history: '历史记录'
  222. },
  223. focusWRow: {}, // 一班重量得到焦点暂存
  224. focusWRow2: {}, // 2班重量得到焦点暂存
  225. focusWRow3: {}, // 3班重量得到焦点暂存
  226. focusWRow4: {}, // 4班重量得到焦点暂存
  227. requestParam: {},
  228. download: {
  229. getdataListParm: {
  230. name: 'getFPList',
  231. page: 1,
  232. offset: 1,
  233. pagecount: 0,
  234. returntype: 'Map',
  235. parammaps: {
  236. pastureid: Cookies.get('pastureid'),
  237. enable: ''
  238. }
  239. },
  240. list: []
  241. },
  242. spanObj: {},
  243. mergekeys: ['barname', 'sumweight'],
  244. isShowDialog: false,
  245. isokDisable: false,
  246. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  247. cellStyle: { padding: 0 + 'px' },
  248. myHeight: document.documentElement.clientHeight - 85 - 140,
  249. oldRowList:{},
  250. create1: {
  251. dialogFormVisible: false,
  252. dialogStatus: '',
  253. temp: { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '', sort: '' },
  254. rules: {
  255. // fname: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  256. // fclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  257. // feedcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  258. }
  259. },
  260. }
  261. },
  262. computed: {
  263. },
  264. created() {
  265. this.getButtons()
  266. this.getDownList()
  267. this.getFeedTempletNameList()
  268. },
  269. methods: {
  270. getButtons() {
  271. const Edit = 'DhedFormula'
  272. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  273. this.isRoleEdit = isRoleEdit
  274. },
  275. getDownList() {
  276. GetDataByNames(this.requestParams).then(response => {
  277. this.recipeTemplateList = response.data.getFTSWLSList.list
  278. this.feedingFormulaList = response.data.getFTBLList.list
  279. this.livestockTypeList = response.data.getCowclassListEnable.list
  280. this.barList = response.data.getBarListEnable.list
  281. this.getIsDisplay()
  282. })
  283. },
  284. // 新增
  285. handleCreate1() {
  286. console.log('点击了新增')
  287. this.resetTemp1()
  288. this.dialogFull = false
  289. this.create1.dialogStatus = 'create'
  290. this.create1.dialogFormVisible = true
  291. },
  292. resetTemp1() {
  293. this.create1.temp = { pastureid: Cookies.get('pastureid'), 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'sort': "", 'ftid': '', 'ftname': '', 'tmrcode': '', 'tmrid': '', 'times': '', 'lppcode': '', 'lppid': '', 'rtime': '', barid: '', 'treatmethod': '', 'useinbar': '', 'useinbarid': '' }
  294. },
  295. getFeedTempletNameList() {
  296. GetDataByName(this.getFeedTempletNameListParm).then(response => {
  297. if (response.data.list !== null) {
  298. this.tnameList = response.data.list
  299. } else {
  300. this.tnameList = []
  301. }
  302. })
  303. },
  304. getIsDisplay() {
  305. GetDataByName(this.table.getdataListParm2).then(response => {
  306. console.log(response.data.list[0].inforvalue)
  307. if (response.data.list !== null) {
  308. if (response.data.list[0].inforvalue == 0) {
  309. this.table.isPtsfname = false
  310. } else {
  311. this.table.isPtsfname = true
  312. }
  313. }
  314. })
  315. GetDataByName(this.table.getdataListParm3).then(response => {
  316. console.log(response.data.list[0].inforvalue)
  317. if (response.data.list !== null) {
  318. this.table.RWLength = response.data.list[0].inforvalue
  319. if (response.data.list[0].inforvalue == 1) {
  320. this.table.isRW1 = true
  321. this.table.isRW2 = false
  322. this.table.isRW3 = false
  323. this.table.isRW4 = false
  324. } else if (response.data.list[0].inforvalue == 2) {
  325. this.table.isRW1 = true
  326. this.table.isRW2 = true
  327. this.table.isRW3 = false
  328. this.table.isRW4 = false
  329. } else if (response.data.list[0].inforvalue == 3) {
  330. this.table.isRW1 = true
  331. this.table.isRW2 = true
  332. this.table.isRW3 = true
  333. this.table.isRW4 = false
  334. } else if (response.data.list[0].inforvalue == 4) {
  335. this.table.isRW1 = true
  336. this.table.isRW2 = true
  337. this.table.isRW3 = true
  338. this.table.isRW4 = true
  339. }
  340. } else {
  341. this.table.isRW1 = false
  342. this.table.isRW2 = false
  343. this.table.isRW3 = false
  344. this.table.isRW4 = false
  345. }
  346. })
  347. this.getList()
  348. },
  349. getList() {
  350. this.table.listLoading = true
  351. GetDataByName(this.table.getdataListParm).then(response => {
  352. console.log('table数据', response.data.list)
  353. if (response.data.list !== null) {
  354. for (let i = 0; i < response.data.list.length; i++) {
  355. this.$set(response.data.list[i], 'Edit', false) // 编辑
  356. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  357. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  358. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  359. if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
  360. if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
  361. this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
  362. } else {
  363. this.$set(response.data.list[i], 'dryweight', '')
  364. }
  365. }
  366. if (response.data.list[i].ftid == undefined || response.data.list[i].ftname == '') {
  367. this.$set(response.data.list[i], 'ftid', '')
  368. this.$set(response.data.list[i], 'ftname', '')
  369. }
  370. if (response.data.list[i].ptsfid == undefined || response.data.list[i].ptsfname == '') {
  371. this.$set(response.data.list[i], 'ptsfid', '')
  372. this.$set(response.data.list[i], 'ptsfname', '')
  373. }
  374. if (response.data.list[i].ccount == undefined) {
  375. this.$set(response.data.list[i], 'ccount', '')
  376. }
  377. if (response.data.list[i].softccount == undefined) {
  378. this.$set(response.data.list[i], 'softccount', '')
  379. }
  380. if (response.data.list[i].ratio == undefined) {
  381. this.$set(response.data.list[i], 'ratio', 100)
  382. }
  383. if (response.data.list[i].ccountratio == undefined) {
  384. this.$set(response.data.list[i], 'ccountratio', '')
  385. }
  386. if (response.data.list[i].r1 == undefined) {
  387. this.$set(response.data.list[i], 'r1', '')
  388. }
  389. if (response.data.list[i].r2 == undefined) {
  390. this.$set(response.data.list[i], 'r2', '')
  391. }
  392. if (response.data.list[i].r3 == undefined) {
  393. this.$set(response.data.list[i], 'r3', '')
  394. }
  395. if (response.data.list[i].r4 == undefined) {
  396. this.$set(response.data.list[i], 'r4', '')
  397. }
  398. if (response.data.list[i].w1 == undefined) {
  399. this.$set(response.data.list[i], 'w1', '')
  400. }
  401. if (response.data.list[i].w2 == undefined) {
  402. this.$set(response.data.list[i], 'w2', '')
  403. }
  404. if (response.data.list[i].w3 == undefined) {
  405. this.$set(response.data.list[i], 'w3', '')
  406. }
  407. if (response.data.list[i].w4 == undefined) {
  408. this.$set(response.data.list[i], 'w4', '')
  409. }
  410. if (response.data.list[i].supplyweight == undefined) {
  411. this.$set(response.data.list[i], 'supplyweight', '')
  412. }
  413. if (response.data.list[i].feedweight == undefined || parseFloat(response.data.list[i].feedweight) == 0) {
  414. this.$set(response.data.list[i], 'feedweight', '')
  415. }
  416. this.$set(response.data.list[i], 'dailyWeight', '')
  417. if (response.data.list[i].Bfweight == undefined) {
  418. this.$set(response.data.list[i], 'Bfweight', '')
  419. }
  420. if (response.data.list[i].Sfweight == undefined) {
  421. this.$set(response.data.list[i], 'Sfweight', '')
  422. }
  423. if (response.data.list[i].isOneWeight == undefined) {
  424. this.$set(response.data.list[i], 'isOneWeight', false)
  425. }
  426. if (response.data.list[i].isTwoWeight == undefined) {
  427. this.$set(response.data.list[i], 'isTwoWeight', false)
  428. }
  429. if (response.data.list[i].isThreeWeight == undefined) {
  430. this.$set(response.data.list[i], 'isThreeWeight', false)
  431. }
  432. if (response.data.list[i].isFourWeight == undefined) {
  433. this.$set(response.data.list[i], 'isFourWeight', false)
  434. }
  435. if (response.data.list[i].timesopt !== undefined) {
  436. var timesoptArr = response.data.list[i].timesopt.split(',')
  437. for (let j = 0; j < timesoptArr.length; j++) {
  438. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  439. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  440. }
  441. }
  442. if (response.data.list[i].bw1 == undefined) {
  443. this.$set(response.data.list[i], 'bw1', '')
  444. }
  445. if (response.data.list[i].bw2 == undefined) {
  446. this.$set(response.data.list[i], 'bw2', '')
  447. }
  448. if (response.data.list[i].bw3 == undefined) {
  449. this.$set(response.data.list[i], 'bw3', '')
  450. }
  451. if (response.data.list[i].bw4 == undefined) {
  452. this.$set(response.data.list[i], 'bw4', '')
  453. }
  454. if (response.data.list[i].supplement !== undefined) {
  455. var supplementArr = response.data.list[i].supplement.split(',')
  456. for (let j = 0; j < supplementArr.length; j++) {
  457. response.data.list[i]['bw' + supplementArr[j].split(':')[0]] = supplementArr[j].split(':')[2]
  458. }
  459. }
  460. }
  461. // console.log(response.data.list, sumr)
  462. for (let i = 0; i < response.data.list.length; i++) {
  463. if (response.data.list[i].r1 == '') {
  464. response.data.list[i].r1 = 0
  465. response.data.list[i].w1 = 0
  466. }
  467. if (response.data.list[i].r2 == '') {
  468. response.data.list[i].r2 = 0
  469. response.data.list[i].w2 = 0
  470. }
  471. if (response.data.list[i].r3 == '') {
  472. response.data.list[i].r3 = 0
  473. response.data.list[i].w3 = 0
  474. }
  475. if (response.data.list[i].r4 == '') {
  476. response.data.list[i].r4 = 0
  477. response.data.list[i].w4 = 0
  478. }
  479. 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))
  480. response.data.list[i].sumr = formatNum(response.data.list[i].sumr, parseInt(Cookies.get('decimal')))
  481. // this.$set(response.data.list[i],'feedweight',formatNum(parseFloat(response.data.list[i].feedweight) * parseFloat(response.data.list[i].sumr)/100,2))
  482. 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))
  483. response.data.list[i].dailyWeight = formatNum(response.data.list[i].dailyWeight, parseInt(Cookies.get('decimal')))
  484. }
  485. this.table.list = response.data.list
  486. console.log(this.table.list, 'this.table.list')
  487. this.table.pageNum = response.data.pageNum
  488. this.table.pageSize = response.data.pageSize
  489. this.table.total = response.data.total
  490. } else {
  491. this.table.list = []
  492. }
  493. setTimeout(() => {
  494. this.table.listLoading = false
  495. }, 100)
  496. })
  497. },
  498. handleSearch() {
  499. this.getList()
  500. },
  501. renderHeader(h, { column, $index }) { // h即为cerateElement的简写,具体可看vue官方文档
  502. return h(
  503. 'div',
  504. [
  505. h('span', column.label),
  506. h('i', {
  507. class: 'el-icon-unlock',
  508. ref: 'el-icon-unlock',
  509. style: 'margin-left:5px;'
  510. })
  511. ]
  512. )
  513. },
  514. headerClick(column, event) {
  515. console.log(column, event)
  516. this.headerList.push(event)
  517. if (column.label == '第一班重量') {
  518. for (let i = 0; i < this.table.list.length; i++) {
  519. if (this.table.list[i].Edit == true) {
  520. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  521. event.target.className = 'el-icon-lock'
  522. this.$set(this.table.list[i], 'isOneWeight', true) // 锁住不可编辑
  523. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  524. event.target.className = 'el-icon-unlock'
  525. this.$set(this.table.list[i], 'isOneWeight', false) // 解锁可编辑
  526. }
  527. }
  528. }
  529. } else if (column.label == '第二班重量') {
  530. for (let i = 0; i < this.table.list.length; i++) {
  531. if (this.table.list[i].Edit == true) {
  532. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  533. event.target.className = 'el-icon-lock'
  534. this.$set(this.table.list[i], 'isTwoWeight', true) // 锁住不可编辑
  535. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  536. event.target.className = 'el-icon-unlock'
  537. this.$set(this.table.list[i], 'isTwoWeight', false) // 解锁可编辑
  538. }
  539. }
  540. }
  541. } else if (column.label == '第三班重量') {
  542. for (let i = 0; i < this.table.list.length; i++) {
  543. if (this.table.list[i].Edit == true) {
  544. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  545. event.target.className = 'el-icon-lock'
  546. this.$set(this.table.list[i], 'isThreeWeight', true) // 锁住不可编辑
  547. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  548. event.target.className = 'el-icon-unlock'
  549. this.$set(this.table.list[i], 'isThreeWeight', false) // 解锁可编辑
  550. }
  551. }
  552. }
  553. } else if (column.label == '第四班重量') {
  554. for (let i = 0; i < this.table.list.length; i++) {
  555. if (this.table.list[i].Edit == true) {
  556. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  557. event.target.className = 'el-icon-lock'
  558. this.$set(this.table.list[i], 'isFourWeight', true) // 锁住不可编辑
  559. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  560. event.target.className = 'el-icon-unlock'
  561. this.$set(this.table.list[i], 'isFourWeight', false) // 解锁可编辑
  562. }
  563. }
  564. }
  565. }
  566. },
  567. // 配方模板
  568. changeRecipeTemplate(item, row) {
  569. row.myccname = this.recipeTemplateList.find(obj => obj.id == item).ccname
  570. if (row.bigcowclass !== row.myccname) {
  571. this.$message({ type: 'warning', message: '所选配方模板牲畜类别与栏舍对应牲畜类别不一致', duration: 2000 })
  572. }
  573. console.log(row.supplyweight, 'row.supplyweight')
  574. row.ftname = this.recipeTemplateList.find(obj => obj.id == item).tname
  575. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == item).Sfweight// Sfweight
  576. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == item).SfweightLock// SfweightLock
  577. row.dryweight = this.recipeTemplateList.find(obj => obj.id == item).dryweight// SfweightLock
  578. // 补料重量supplyweight
  579. // 配方重量ftweight
  580. // 系数头数ccountratio
  581. // 投喂量feedweight
  582. // 实际牛头数ccount
  583. // 投喂量 = 配方重量 + 补料重量
  584. // 配方重量 = Sfweight * 系数头数 + SfweightLock * 实际牛头数ccount
  585. console.log(row.Sfweight, 'row.Sfweight')
  586. console.log(row.ccountratio, '系数头数')
  587. console.log(row.SfweightLock, 'SfweightLock')
  588. console.log(row.ccount, '实际牛头数')
  589. if (row.Sfweight !== '' && row.ccount !== '') {
  590. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  591. } else {
  592. row.ftweight = ''
  593. }
  594. // console.log(row.ftweight, 'row.ftweight')
  595. // console.log(row.supplyweight, 'row.supplyweight')
  596. // console.log(this.table.isPtsfname, 'isPtsfname')
  597. if (this.table.isPtsfname == false) {
  598. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  599. } else {
  600. if (row.supplyweight == 'NaN') {
  601. row.supplyweight = 0
  602. }
  603. console.log(row.supplyweight)
  604. if (row.supplyweight !== '' && row.ftweight !== '') {
  605. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  606. } else if (row.supplyweight == '' && row.ftweight !== '') {
  607. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  608. } else if (row.supplyweight !== '' && row.ftweight !== '') {
  609. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  610. }
  611. if (row.ccountratio !== '' && row.ftweight !== '') {
  612. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  613. }
  614. if (row.Sfweight !== '' && row.ccount !== '') {
  615. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  616. } else {
  617. row.ftweight = ''
  618. }
  619. }
  620. console.log(row.supplyweight)
  621. if (row.supplyweight == 'NaN') { row.supplyweight = 0 }
  622. if (row.r1 !== '') { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  623. if (row.r2 !== '') { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  624. if (row.r3 !== '') { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  625. if (row.r4 !== '') { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  626. if (row.w1 == '') { row.w1 = 0 }
  627. if (row.w2 == '') { row.w2 = 0 }
  628. if (row.w3 == '') { row.w3 = 0 }
  629. if (row.w4 == '') { row.w4 = 0 }
  630. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  631. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  632. },
  633. // 实际牛头数失去焦点计算
  634. // ccount实际牛头数
  635. // ratio系数
  636. // ccountratio系数牛头数
  637. blurCcount(row) { // 实际牛头数
  638. console.log(row)
  639. if (row.ftid !== '-1' && row.ftid !== '') {
  640. console.log(this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight)
  641. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  642. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  643. }
  644. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  645. // row.ptsfid = parseInt(row.ptsfid)
  646. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), parseInt(Cookies.get('decimal')))
  647. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), parseInt(Cookies.get('decimal')))
  648. }
  649. if (row.ptsfid == '') {
  650. row.BLweight = 0
  651. row.BLweightLock = 0
  652. }
  653. if (row.Sfweight !== '' && row.ccount !== '') {
  654. // console.log(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount))
  655. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  656. }
  657. // 系数牛头数 = 实际牛头数 * 系数/100
  658. if (row.ccount !== '' && row.ratio !== '') {
  659. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  660. } else if (row.ratio !== '' && row.ccountratio !== '') {
  661. row.ccount = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  662. } else if (row.ccount !== '' || row.ratio !== '') {
  663. row.ccountratio = ''
  664. }
  665. // 补料重量
  666. console.log(row.ccountratio, row.BLweight)
  667. if (row.BLweight == 'undefined') {
  668. this.$set(row, 'BLweight', '')
  669. }
  670. console.log('BLweight', row.BLweight)
  671. console.log('ccountratio', row.ccountratio)
  672. console.log('BLweightLock', row.BLweightLock)
  673. console.log('ccount', row.ccount)
  674. if (row.ccountratio !== '' && row.BLweight !== '') {
  675. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  676. } else if (row.ccountratio !== '' && row.BLweight == '') {
  677. row.supplyweight = ''
  678. row.feedweight = ''
  679. } else if (row.ccountratio == '' && row.BLweight !== '') {
  680. row.supplyweight = ''
  681. row.feedweight = ''
  682. }
  683. // 配方重量
  684. if (row.ccountratio !== '' && row.Sfweight !== '') {
  685. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  686. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  687. row.ftweight = ''
  688. row.feedweight = ''
  689. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  690. row.ftweight = ''
  691. row.feedweight = ''
  692. }
  693. if (this.table.isPtsfname == false) {
  694. row.feedweight = parseFloat(row.ftweight)
  695. } else {
  696. if (row.supplyweight !== '' && row.ftweight !== '') {
  697. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  698. } else if (row.supplyweight !== '' && row.ftweight == '') {
  699. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  700. } else if (row.supplyweight == '' && row.ftweight !== '') {
  701. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  702. }
  703. // 配方重量 = 系数头数 * Sfweight
  704. if (row.ccountratio !== '' && row.ftweight !== '') {
  705. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  706. }
  707. // 补料重量 = 系数头数 * BLweight
  708. if (row.ccountratio !== '' && row.BLweight !== '') {
  709. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  710. }
  711. }
  712. console.log(row)
  713. if (row.r1 !== '' && row.isOneWeight == false) { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  714. if (row.r2 !== '' && row.isTwoWeight == false) { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  715. if (row.r3 !== '' && row.isThreeWeight == false) { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  716. if (row.r4 !== '' && row.isFourWeight == false) { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  717. if (row.isOneWeight == true) {
  718. this.$set(row, 'r1', formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  719. }
  720. if (row.isTwoWeight == true) {
  721. this.$set(row, 'r2', formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  722. }
  723. if (row.isThreeWeight == true) {
  724. this.$set(row, 'r3', formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  725. }
  726. if (row.isFourWeight == true) {
  727. this.$set(row, 'r4', formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  728. }
  729. if (row.w1 == '') { row.w1 = 0 }
  730. if (row.w2 == '') { row.w2 = 0 }
  731. if (row.w3 == '') { row.w3 = 0 }
  732. if (row.w4 == '') { row.w4 = 0 }
  733. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  734. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  735. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  736. },
  737. blurRatio(row) {
  738. console.log(row, '--------------')
  739. if (row.ftid !== '-1' && row.ftid !== '') {
  740. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  741. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  742. }
  743. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  744. // row.ptsfid = parseInt(row.ptsfid)
  745. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), parseInt(Cookies.get('decimal')))
  746. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), parseInt(Cookies.get('decimal')))
  747. }
  748. if (row.ptsfid == '') {
  749. row.BLweight = 0
  750. row.BLweightLock = 0
  751. }
  752. // 系数
  753. if (row.ccount !== '' && row.ratio !== '' && row.ccountratio !== '') {
  754. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  755. } else if (row.ccount !== '' && row.ccountratio !== '') {
  756. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  757. } else if (row.ccount !== '' || row.ccountratio !== '') {
  758. row.ratio = ''
  759. }
  760. // 补料重量
  761. if (row.ccountratio !== '' && row.BLweight !== '') {
  762. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  763. } else if (row.ccountratio !== '' && row.BLweight == '' || row.ccountratio == '' && row.BLweight !== '') {
  764. row.supplyweight = ''
  765. row.feedweight = ''
  766. }
  767. // 配方重量
  768. if (row.ccountratio !== '' && row.Sfweight !== '') {
  769. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  770. } else if (row.ccountratio !== '' && row.Sfweight == '' || row.ccountratio == '' && row.Sfweight !== '') {
  771. row.ftweight = ''
  772. row.feedweight = ''
  773. }
  774. // 投喂量
  775. if (row.supplyweight !== '' && row.ftweight !== '') {
  776. row.feedweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  777. } else if (row.supplyweight == '' && row.ftweight !== '') {
  778. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  779. } else if (row.supplyweight !== '' && row.ftweight == '') {
  780. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  781. }
  782. console.log(row.supplyweight, '补料重量')
  783. console.log(row.ftweight, '配方重量')
  784. if (this.table.isPtsfname == false) {
  785. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  786. } else {
  787. // 投喂量
  788. if (row.supplyweight !== '' && row.ftweight !== '') {
  789. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  790. } else if (row.supplyweight == '' && row.ftweight !== '') {
  791. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  792. } else if (row.supplyweight !== '' && row.ftweight == '') {
  793. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  794. }
  795. // 补料重量
  796. if (row.ccountratio !== '' && row.BLweight !== '') {
  797. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  798. } else if (row.ccountratio !== '' && row.BLweight == '') {
  799. row.supplyweight = ''
  800. row.feedweight = ''
  801. } else if (row.ccountratio == '' && row.BLweight !== '') {
  802. row.supplyweight = ''
  803. row.feedweight = ''
  804. }
  805. // 配方重量
  806. if (row.ccountratio !== '' && row.Sfweight !== '') {
  807. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  808. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  809. row.ftweight = ''
  810. row.feedweight = ''
  811. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  812. row.ftweight = ''
  813. row.feedweight = ''
  814. }
  815. }
  816. if (row.r1 !== '' && row.isOneWeight == false) { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  817. if (row.r2 !== '' && row.isTwoWeight == false) { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  818. if (row.r3 !== '' && row.isThreeWeight == false) { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  819. if (row.r4 !== '' && row.isFourWeight == false) { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  820. if (row.isOneWeight == true) {
  821. this.$set(row, 'r1', formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  822. }
  823. if (row.isTwoWeight == true) {
  824. this.$set(row, 'r2', formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  825. }
  826. if (row.isThreeWeight == true) {
  827. this.$set(row, 'r3', formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  828. }
  829. if (row.isFourWeight == true) {
  830. this.$set(row, 'r4', formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  831. }
  832. if (row.w1 == '') { row.w1 = 0 }
  833. if (row.w2 == '') { row.w2 = 0 }
  834. if (row.w3 == '') { row.w3 = 0 }
  835. if (row.w4 == '') { row.w4 = 0 }
  836. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  837. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  838. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  839. },
  840. blurCcountratio(row) {
  841. if (row.ftid !== '-1' && row.ftid !== '') {
  842. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  843. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  844. }
  845. if (row.ptsfid !== '-1' && row.ptsfid !== '' && this.table.isPtsfname == true) {
  846. // row.ptsfid = parseInt(row.ptsfid)
  847. row.BLweight = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).Sfweight), parseInt(Cookies.get('decimal')))
  848. row.BLweightLock = formatNum(parseFloat(this.feedingFormulaList.find(obj => obj.id == row.ptsfid).SfweightLock), parseInt(Cookies.get('decimal')))
  849. }
  850. if (row.ptsfid == '') {
  851. row.BLweight = 0
  852. row.BLweightLock = 0
  853. }
  854. if (row.ptsfid == '') {
  855. row.BLweight = 0
  856. row.BLweightLock = 0
  857. }
  858. // ratio系数ccountratio系数头数ccount实际牛头数
  859. // 系数头数
  860. if (row.ccountratio !== '' && row.ccount !== '' && row.ratio !== '') {
  861. if (row.ccountratio !== 0 && row.ccount !== 0) {
  862. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  863. }
  864. } else if (row.ccount !== '' && row.ratio !== '') {
  865. row.ccountratio = formatNum(parseFloat(row.ccount) * parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  866. } else if (row.ccountratio !== '' && row.ccount !== '') {
  867. if (row.ccountratio !== 0 && row.ccount !== 0) {
  868. row.ratio = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  869. }
  870. } else if (row.ccountratio !== '' && row.ratio !== '') {
  871. row.ccount = formatNum(parseFloat(row.ccountratio) * 100 / parseFloat(row.ratio) / 100, parseInt(Cookies.get('decimal')))
  872. }
  873. // 补料重量
  874. if (row.ccountratio !== '' && row.BLweight !== '') {
  875. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  876. } else if (row.ccountratio !== '' && row.BLweight == '') {
  877. row.supplyweight = ''
  878. row.feedweight = ''
  879. } else if (row.ccountratio == '' && row.BLweight !== '') {
  880. row.supplyweight = ''
  881. row.feedweight = ''
  882. }
  883. // 配方重量
  884. if (row.ccountratio !== '' && row.Sfweight !== '') {
  885. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  886. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  887. row.ftweight = ''
  888. row.feedweight = ''
  889. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  890. row.ftweight = ''
  891. row.feedweight = ''
  892. }
  893. // 投喂量
  894. if (row.supplyweight !== '' && row.ftweight !== '') {
  895. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  896. } else if (row.supplyweight == '' && row.ftweight !== '') {
  897. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  898. } else if (row.supplyweight !== '' && row.ftweight == '') {
  899. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  900. }
  901. if (this.table.isPtsfname == false) {
  902. console.log(row)
  903. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  904. } else {
  905. // 投喂量
  906. if (row.supplyweight !== '' && row.ftweight !== '') {
  907. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  908. } else if (row.supplyweight == '' && row.ftweight !== '') {
  909. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  910. } else if (row.supplyweight !== '' && row.ftweight == '') {
  911. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  912. }
  913. // 补料重量
  914. if (row.ccountratio !== '' && row.BLweight !== '') {
  915. row.supplyweight = formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  916. } else if (row.ccountratio !== '' && row.BLweight == '') {
  917. row.supplyweight = ''
  918. row.feedweight = ''
  919. } else if (row.ccountratio == '' && row.BLweight !== '') {
  920. row.supplyweight = ''
  921. row.feedweight = ''
  922. }
  923. // 配方重量
  924. if (row.ccountratio !== '' && row.Sfweight !== '') {
  925. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  926. } else if (row.ccountratio !== '' && row.Sfweight == '') {
  927. row.ftweight = ''
  928. row.feedweight = ''
  929. } else if (row.ccountratio == '' && row.Sfweight !== '') {
  930. row.ftweight = ''
  931. row.feedweight = ''
  932. }
  933. }
  934. if (row.r1 !== '' && row.isOneWeight == false) {
  935. this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal'))))
  936. }
  937. if (row.r2 !== '' && row.isTwoWeight == false) {
  938. this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal'))))
  939. }
  940. if (row.r3 !== '' && row.isThreeWeight == false) {
  941. this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal'))))
  942. }
  943. if (row.r4 !== '' && row.isFourWeight == false) {
  944. this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal'))))
  945. }
  946. if (row.isOneWeight == true) {
  947. this.$set(row, 'r1', formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  948. }
  949. if (row.isTwoWeight == true) {
  950. this.$set(row, 'r2', formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  951. }
  952. if (row.isThreeWeight == true) {
  953. this.$set(row, 'r3', formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  954. }
  955. if (row.isFourWeight == true) {
  956. this.$set(row, 'r4', formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal'))))
  957. }
  958. if (row.w1 == '') { row.w1 = 0 }
  959. if (row.w2 == '') { row.w2 = 0 }
  960. if (row.w3 == '') { row.w3 = 0 }
  961. if (row.w4 == '') { row.w4 = 0 }
  962. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  963. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  964. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  965. },
  966. // 总比例
  967. blurR(row) {
  968. if (row.r1 == '') { row.r1 = 0 }
  969. if (row.r2 == '') { row.r2 = 0 }
  970. if (row.r3 == '') { row.r3 = 0 }
  971. if (row.r4 == '') { row.r4 = 0 }
  972. if (row.r1 !== '') {
  973. row.w1 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r1) / 100, parseInt(Cookies.get('decimal')))
  974. }
  975. if (row.r2 !== '') {
  976. row.w2 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r2) / 100, parseInt(Cookies.get('decimal')))
  977. }
  978. if (row.r3 !== '') {
  979. row.w3 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r3) / 100, parseInt(Cookies.get('decimal')))
  980. }
  981. if (row.r4 !== '') {
  982. row.w4 = formatNum(parseFloat(row.feedweight) * parseFloat(row.r4) / 100, parseInt(Cookies.get('decimal')))
  983. }
  984. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  985. if (row.w1 == '') { row.w1 = 0 }
  986. if (row.w2 == '') { row.w2 = 0 }
  987. if (row.w3 == '') { row.w3 = 0 }
  988. if (row.w4 == '') { row.w4 = 0 }
  989. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  990. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  991. },
  992. // 一班重量得到焦点
  993. focusW(row) {
  994. console.log(row, '====')
  995. this.focusWRow = Object.assign({}, row)
  996. },
  997. // 1班重量得到焦点
  998. focusW2(row) {
  999. this.focusWRow2 = Object.assign({}, row)
  1000. },
  1001. // 3班重量得到焦点
  1002. focusW3(row) {
  1003. this.focusWRow3 = Object.assign({}, row)
  1004. },
  1005. // 4班重量得到焦点
  1006. focusW4(row) {
  1007. this.focusWRow4 = Object.assign({}, row)
  1008. },
  1009. // 一班重量
  1010. blurW(row) {
  1011. if (row.w1 == '') {
  1012. row.w1 = 0
  1013. }
  1014. if (row.w2 == '') {
  1015. row.w2 = 0
  1016. }
  1017. if (row.w3 == '') {
  1018. row.w3 = 0
  1019. }
  1020. if (row.w4 == '') {
  1021. row.w4 = 0
  1022. }
  1023. if (row.r1 == '') {
  1024. row.r1 = 0
  1025. }
  1026. if (row.r2 == '') {
  1027. row.r2 = 0
  1028. }
  1029. if (row.r3 == '') {
  1030. row.r3 = 0
  1031. }
  1032. if (row.r4 == '') {
  1033. row.r4 = 0
  1034. }
  1035. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1036. console.log(row, '=======投喂量feedweight')
  1037. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1038. if (this.table.RWLength == 4) {
  1039. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1040. // 2班3班4班都锁定
  1041. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1042. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1043. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1044. }
  1045. // 2班3班锁定4班未锁定
  1046. if (row.isTwoWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1047. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1048. row.w4 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  1049. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1050. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1051. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1052. }
  1053. // 2班4班锁定3班未锁定
  1054. if (row.isTwoWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1055. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1056. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1057. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1058. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1059. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1060. }
  1061. // 3班4班锁定2班未锁定
  1062. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1063. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1064. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1065. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1066. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1067. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1068. }
  1069. // 2班锁定,3班4班未锁
  1070. if (row.isTwoWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1071. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1072. if (row.r3 == 0 && row.r4 == 0) {
  1073. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  1074. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1075. row.w4 = row.w3
  1076. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1077. } else if (row.r3 == 0 && row.r4 !== 0) {
  1078. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1079. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1080. if (row.w1 == '') { row.w1 = 0 }
  1081. if (row.w2 == '') { row.w2 = 0 }
  1082. if (row.w3 == '') { row.w3 = 0 }
  1083. if (row.w4 == '') { row.w4 = 0 }
  1084. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1085. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1086. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1087. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1088. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1089. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1090. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1091. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1092. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1093. }
  1094. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1095. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1096. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1097. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1098. } else if (row.r3 !== 0 && row.r4 == 0) {
  1099. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1100. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1101. if (row.w1 == '') { row.w1 = 0 }
  1102. if (row.w2 == '') { row.w2 = 0 }
  1103. if (row.w3 == '') { row.w3 = 0 }
  1104. if (row.w4 == '') { row.w4 = 0 }
  1105. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1106. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1107. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1108. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1109. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1110. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1111. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1112. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1113. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1114. }
  1115. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1116. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1117. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1118. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1119. } else {
  1120. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1121. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1122. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1123. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1124. }
  1125. if (isNaN(row.w3)) {
  1126. row.w3 = 0
  1127. row.r3 = 0
  1128. }
  1129. if (isNaN(row.w4)) {
  1130. row.w4 = 0
  1131. row.r4 = 0
  1132. }
  1133. if (row.w3 <= 0) {
  1134. row.w3 = 0
  1135. row.r3 = 0
  1136. }
  1137. if (row.w4 <= 0) {
  1138. row.w4 = 0
  1139. row.r4 = 0
  1140. }
  1141. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1142. }
  1143. // 3班锁定,2班4班未锁
  1144. if (row.isTwoWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1145. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1146. if (row.r2 == 0 && row.r4 == 0) {
  1147. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  1148. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1149. row.w4 = row.w2
  1150. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1151. } else if (row.r2 == 0 && row.r4 !== 0) {
  1152. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1153. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1154. if (row.w1 == '') { row.w1 = 0 }
  1155. if (row.w2 == '') { row.w2 = 0 }
  1156. if (row.w3 == '') { row.w3 = 0 }
  1157. if (row.w4 == '') { row.w4 = 0 }
  1158. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1159. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1160. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1161. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1162. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1163. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1164. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1165. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1166. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1167. }
  1168. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1169. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1170. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1171. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1172. } else if (row.r2 !== 0 && row.r4 == 0) {
  1173. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  1174. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1175. if (row.w1 == '') { row.w1 = 0 }
  1176. if (row.w2 == '') { row.w2 = 0 }
  1177. if (row.w3 == '') { row.w3 = 0 }
  1178. if (row.w4 == '') { row.w4 = 0 }
  1179. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1180. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1181. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1182. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1183. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1184. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1185. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1186. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1187. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1188. }
  1189. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1190. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1191. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1192. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1193. } else {
  1194. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1195. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1196. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1197. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1198. }
  1199. if (isNaN(row.w2)) {
  1200. row.w2 = 0
  1201. row.r2 = 0
  1202. }
  1203. if (isNaN(row.w4)) {
  1204. row.w4 = 0
  1205. row.r4 = 0
  1206. }
  1207. if (row.w2 <= 0) {
  1208. row.w2 = 0
  1209. row.r2 = 0
  1210. }
  1211. if (row.w4 <= 0) {
  1212. row.w4 = 0
  1213. row.r4 = 0
  1214. }
  1215. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1216. }
  1217. // 4班锁定,2班3班未锁
  1218. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1219. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1220. if (row.r2 == 0 && row.r3 == 0) {
  1221. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  1222. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1223. row.w3 = row.w2
  1224. row.r3 = row.r2
  1225. } else if (row.r2 == 0 && row.r3 !== 0) {
  1226. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1227. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1228. if (row.w1 == '') { row.w1 = 0 }
  1229. if (row.w2 == '') { row.w2 = 0 }
  1230. if (row.w3 == '') { row.w3 = 0 }
  1231. if (row.w4 == '') { row.w4 = 0 }
  1232. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1233. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1234. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1235. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1236. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1237. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1238. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1239. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1240. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1241. }
  1242. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1243. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1244. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1245. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1246. } else if (row.r2 !== 0 && row.r3 == 0) {
  1247. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  1248. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1249. if (row.w1 == '') { row.w1 = 0 }
  1250. if (row.w2 == '') { row.w2 = 0 }
  1251. if (row.w3 == '') { row.w3 = 0 }
  1252. if (row.w4 == '') { row.w4 = 0 }
  1253. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1254. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1255. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1256. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1257. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1258. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1259. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1260. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1261. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1262. }
  1263. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1264. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1265. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1266. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1267. } else {
  1268. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1269. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1270. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1271. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1272. }
  1273. if (row.w2 <= 0) {
  1274. row.w2 = 0
  1275. row.r2 = 0
  1276. }
  1277. if (row.w3 <= 0) {
  1278. row.w3 = 0
  1279. row.r3 = 0
  1280. }
  1281. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1282. }
  1283. // 2班3班4班未锁
  1284. if (row.isTwoWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1285. console.log('1231234')
  1286. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1287. if (parseFloat(row.r2) == 0 && parseFloat(row.r3) == 0 && parseFloat(row.r4) == 0) {
  1288. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) / 3, parseInt(Cookies.get('decimal')))
  1289. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1290. row.w3 = row.w2
  1291. row.w4 = row.w2
  1292. row.r3 = row.r2
  1293. row.r4 = row.r2
  1294. } else if (parseFloat(row.r2) == 0 && parseFloat(row.r3) == 0 && parseFloat(row.r4) !== 0) {
  1295. row.w3 = formatNum(((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4))) / 2, parseInt(Cookies.get('decimal')))
  1296. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1297. row.w2 = row.w3
  1298. row.r2 = row.r3
  1299. if (row.w1 == '') { row.w1 = 0 }
  1300. if (row.w2 == '') { row.w2 = 0 }
  1301. if (row.w3 == '') { row.w3 = 0 }
  1302. if (row.w4 == '') { row.w4 = 0 }
  1303. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1304. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1305. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1306. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1307. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1308. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1309. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1310. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1311. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1312. }
  1313. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1314. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1315. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1316. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1317. } else if (parseFloat(row.r2) == 0 && parseFloat(row.r3) !== 0 && parseFloat(row.r4) == 0) {
  1318. row.w2 = formatNum(((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3))) / 2, parseInt(Cookies.get('decimal')))
  1319. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1320. row.w4 = row.w2
  1321. row.r4 = row.r2
  1322. if (row.w1 == '') { row.w1 = 0 }
  1323. if (row.w2 == '') { row.w2 = 0 }
  1324. if (row.w3 == '') { row.w3 = 0 }
  1325. if (row.w4 == '') { row.w4 = 0 }
  1326. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1327. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1328. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1329. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1330. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1331. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1332. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1333. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1334. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1335. }
  1336. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1337. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1338. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1339. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1340. } else if (parseFloat(row.r2) !== 0 && parseFloat(row.r3) == 0 && parseFloat(row.r4) == 0) {
  1341. row.w3 = formatNum(((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2))) / 2, parseInt(Cookies.get('decimal')))
  1342. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1343. row.w4 = row.w3
  1344. row.r4 = row.r3
  1345. if (row.w1 == '') { row.w1 = 0 }
  1346. if (row.w2 == '') { row.w2 = 0 }
  1347. if (row.w3 == '') { row.w3 = 0 }
  1348. if (row.w4 == '') { row.w4 = 0 }
  1349. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1350. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1351. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1352. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1353. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1354. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1355. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1356. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1357. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1358. }
  1359. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1360. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1361. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1362. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1363. } else if (row.r2 == 0 && row.r3 !== 0 && row.r4 !== 0) {
  1364. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1365. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1366. if (row.w1 == '') { row.w1 = 0 }
  1367. if (row.w2 == '') { row.w2 = 0 }
  1368. if (row.w3 == '') { row.w3 = 0 }
  1369. if (row.w4 == '') { row.w4 = 0 }
  1370. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1371. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1372. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1373. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1374. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1375. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1376. console.log(row.dailyWeight)
  1377. console.log(this.focusWRow.dailyWeight)
  1378. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1379. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1380. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1381. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1382. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1383. }
  1384. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1385. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1386. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1387. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1388. } else if (row.r2 !== 0 && row.r3 == 0 && row.r4 !== 0) {
  1389. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1390. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1391. if (row.w1 == '') { row.w1 = 0 }
  1392. if (row.w2 == '') { row.w2 = 0 }
  1393. if (row.w3 == '') { row.w3 = 0 }
  1394. if (row.w4 == '') { row.w4 = 0 }
  1395. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1396. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1397. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1398. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1399. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1400. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1401. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1402. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1403. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1404. row.w4 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1405. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1406. }
  1407. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1408. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1409. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1410. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1411. } else if (row.r2 !== 0 && row.r3 !== 0 && row.r4 == 0) {
  1412. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1413. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1414. if (row.w1 == '') { row.w1 = 0 }
  1415. if (row.w2 == '') { row.w2 = 0 }
  1416. if (row.w3 == '') { row.w3 = 0 }
  1417. if (row.w4 == '') { row.w4 = 0 }
  1418. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1419. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1420. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1421. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1422. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1423. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1424. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1425. row.w2 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1426. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1427. row.w3 = formatNum((parseFloat(this.focusWRow.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1428. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1429. }
  1430. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1431. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1432. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1433. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1434. } else {
  1435. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1436. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1437. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1438. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1439. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(row.r4) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3) + parseFloat(this.focusWRow.r4)), parseInt(Cookies.get('decimal')))
  1440. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1441. }
  1442. if (isNaN(row.w2)) {
  1443. row.w2 = 0
  1444. row.r2 = 0
  1445. }
  1446. if (isNaN(row.w3)) {
  1447. row.w3 = 0
  1448. row.r3 = 0
  1449. }
  1450. if (isNaN(row.w4)) {
  1451. row.w4 = 0
  1452. row.r4 = 0
  1453. }
  1454. if (row.w2 <= 0) {
  1455. row.w2 = 0
  1456. row.r2 = 0
  1457. }
  1458. if (row.w3 <= 0) {
  1459. row.w3 = 0
  1460. row.r3 = 0
  1461. }
  1462. if (row.w4 <= 0) {
  1463. row.w4 = 0
  1464. row.r4 = 0
  1465. }
  1466. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1467. }
  1468. } else if (this.table.RWLength == 3) {
  1469. // 三班
  1470. // 2班/3班锁定
  1471. if (row.isTwoWeight == true && row.isThreeWeight == true) {
  1472. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1473. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  1474. }
  1475. // 2班不锁3班锁
  1476. if (row.isTwoWeight == false && row.isThreeWeight == true) {
  1477. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1478. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  1479. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1480. if (row.w2 <= 0) {
  1481. row.w2 = 0
  1482. row.r2 = 0
  1483. }
  1484. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  1485. }
  1486. // 3班不锁2班锁
  1487. if (row.isTwoWeight == true && row.isThreeWeight == false) {
  1488. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1489. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2), parseInt(Cookies.get('decimal')))
  1490. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1491. if (row.w3 <= 0) {
  1492. row.w3 = 0
  1493. row.r3 = 0
  1494. }
  1495. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  1496. }
  1497. // 2班3班都不锁
  1498. if (row.isTwoWeight == false && row.isThreeWeight == false) {
  1499. console.log(row.w1, 'w1----------')
  1500. console.log(row.feedweight, 'feedweight----------')
  1501. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1502. if (row.r2 == 0 && row.r3 == 0) {
  1503. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  1504. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1505. row.w3 = row.w2
  1506. row.r3 = row.r2
  1507. } else if (row.r2 == 0 && row.r3 !== 0) {
  1508. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1509. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1510. if (row.w1 == '') { row.w1 = 0 }
  1511. if (row.w2 == '') { row.w2 = 0 }
  1512. if (row.w3 == '') { row.w3 = 0 }
  1513. if (row.w4 == '') { row.w4 = 0 }
  1514. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1515. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1516. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1517. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1518. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1519. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1520. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1521. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  1522. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1523. }
  1524. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1525. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1526. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1527. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1528. } else if (row.r2 !== 0 && row.r3 == 0) {
  1529. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  1530. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1531. if (row.w1 == '') { row.w1 = 0 }
  1532. if (row.w2 == '') { row.w2 = 0 }
  1533. if (row.w3 == '') { row.w3 = 0 }
  1534. if (row.w4 == '') { row.w4 = 0 }
  1535. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1536. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1537. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1538. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1539. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1540. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1541. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow.dailyWeight)) {
  1542. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  1543. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1544. }
  1545. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1546. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1547. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1548. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1549. } else {
  1550. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r2) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  1551. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1552. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1)) * parseFloat(this.focusWRow.r3) / (parseFloat(this.focusWRow.r2) + parseFloat(this.focusWRow.r3)), parseInt(Cookies.get('decimal')))
  1553. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1554. console.log('我改了1')
  1555. }
  1556. if (isNaN(row.w2)) {
  1557. row.w2 = 0
  1558. row.r2 = 0
  1559. }
  1560. if (isNaN(row.w3)) {
  1561. row.w3 = 0
  1562. row.r3 = 0
  1563. }
  1564. if (row.w3 <= 0) {
  1565. row.w3 = 0
  1566. row.r3 = 0
  1567. }
  1568. if (row.w2 <= 0) {
  1569. row.w2 = 0
  1570. row.r2 = 0
  1571. }
  1572. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  1573. }
  1574. } else if (this.table.RWLength == 2) {
  1575. // 两班isOneWeight,isTwoWeight
  1576. if (row.w1 == '') { row.w1 = 0 }
  1577. if (row.w2 == '') { row.w2 = 0 }
  1578. if (row.r1 == '') { row.r1 = 0 }
  1579. if (row.r2 == '') { row.r2 = 0 }
  1580. if (row.isTwoWeight == false) {
  1581. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1582. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1), parseInt(Cookies.get('decimal')))
  1583. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1584. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1585. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  1586. } else {
  1587. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1588. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  1589. }
  1590. } else {
  1591. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1592. this.$set(row, 'sumr', formatNum(parseFloat(row.r1), parseInt(Cookies.get('decimal'))))
  1593. }
  1594. if (row.w1 == '') { row.w1 = 0 }
  1595. if (row.w2 == '') { row.w2 = 0 }
  1596. if (row.w3 == '') { row.w3 = 0 }
  1597. if (row.w4 == '') { row.w4 = 0 }
  1598. if (isNaN(row.r1)) { row.r1 = 0 }
  1599. if (isNaN(row.r2)) { row.r2 = 0 }
  1600. if (isNaN(row.r3)) { row.r3 = 0 }
  1601. if (isNaN(row.r4)) { row.r4 = 0 }
  1602. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1603. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1604. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1605. },
  1606. blurW2(row) {
  1607. // 2班重量
  1608. if (row.w1 == '') {
  1609. row.w1 = 0
  1610. }
  1611. if (row.w2 == '') {
  1612. row.w2 = 0
  1613. }
  1614. if (row.w3 == '') {
  1615. row.w3 = 0
  1616. }
  1617. if (row.w4 == '') {
  1618. row.w4 = 0
  1619. }
  1620. if (row.r1 == '') {
  1621. row.r1 = 0
  1622. }
  1623. if (row.r2 == '') {
  1624. row.r2 = 0
  1625. }
  1626. if (row.r3 == '') {
  1627. row.r3 = 0
  1628. }
  1629. if (row.r4 == '') {
  1630. row.r4 = 0
  1631. }
  1632. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  1633. console.log(row, '=======投喂量feedweight')
  1634. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  1635. if (this.table.RWLength == 4) {
  1636. // 四班
  1637. // 1班3班4班都锁定
  1638. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == true) {
  1639. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1640. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1641. }
  1642. // 1班3班锁定4班未锁定
  1643. if (row.isOneWeight == true && row.isThreeWeight == true && row.isFourWeight == false) {
  1644. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1645. row.w4 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  1646. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1647. if (row.w4 <= 0) {
  1648. row.w4 = 0
  1649. row.r4 = 0
  1650. }
  1651. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1652. }
  1653. // 1班4班锁定3班未锁定
  1654. if (row.isOneWeight == true && row.isFourWeight == true && row.isThreeWeight == false) {
  1655. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1656. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1657. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1658. if (row.w3 <= 0) {
  1659. row.w3 = 0
  1660. row.r3 = 0
  1661. }
  1662. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1663. }
  1664. // 3班4班锁定1班未锁定
  1665. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == true) {
  1666. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1667. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  1668. row.r1 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1669. if (row.w1 <= 0) {
  1670. row.w1 = 0
  1671. row.r1 = 0
  1672. }
  1673. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1674. }
  1675. // 1班锁定,3班4班未锁
  1676. if (row.isOneWeight == true && row.isThreeWeight == false && row.isFourWeight == false) {
  1677. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1678. if (row.r3 == 0 && row.r4 == 0) {
  1679. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  1680. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1681. row.w4 = row.w3
  1682. row.r4 = row.r3
  1683. } else if (row.r3 == 0 && row.r4 !== 0) {
  1684. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1685. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1686. if (row.w1 == '') { row.w1 = 0 }
  1687. if (row.w2 == '') { row.w2 = 0 }
  1688. if (row.w3 == '') { row.w3 = 0 }
  1689. if (row.w4 == '') { row.w4 = 0 }
  1690. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1691. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1692. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1693. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1694. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1695. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1696. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1697. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1698. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1699. }
  1700. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1701. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1702. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1703. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1704. } else if (row.r3 !== 0 && row.r4 == 0) {
  1705. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1706. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1707. if (row.w1 == '') { row.w1 = 0 }
  1708. if (row.w2 == '') { row.w2 = 0 }
  1709. if (row.w3 == '') { row.w3 = 0 }
  1710. if (row.w4 == '') { row.w4 = 0 }
  1711. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1712. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1713. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1714. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1715. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1716. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1717. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1718. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1719. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1720. }
  1721. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1722. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1723. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1724. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1725. } else {
  1726. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1727. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1728. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1729. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1730. }
  1731. if (isNaN(row.w3)) {
  1732. row.w3 = 0
  1733. row.r3 = 0
  1734. }
  1735. if (isNaN(row.w4)) {
  1736. row.w4 = 0
  1737. row.r4 = 0
  1738. }
  1739. if (row.w3 <= 0) {
  1740. row.w3 = 0
  1741. row.r3 = 0
  1742. }
  1743. if (row.w4 <= 0) {
  1744. row.w4 = 0
  1745. row.r4 = 0
  1746. }
  1747. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1748. }
  1749. // 3班锁定,1班4班未锁
  1750. if (row.isOneWeight == false && row.isThreeWeight == true && row.isFourWeight == false) {
  1751. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1752. if (row.r1 == 0 && row.r4 == 0) {
  1753. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  1754. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1755. row.w4 = row.w1
  1756. row.r4 = row.r1
  1757. } else if (row.r1 == 0 && row.r4 !== 0) {
  1758. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  1759. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1760. if (row.w1 == '') { row.w1 = 0 }
  1761. if (row.w2 == '') { row.w2 = 0 }
  1762. if (row.w3 == '') { row.w3 = 0 }
  1763. if (row.w4 == '') { row.w4 = 0 }
  1764. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1765. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1766. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1767. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1768. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1769. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1770. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1771. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1772. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1773. }
  1774. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1775. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1776. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1777. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1778. } else if (row.r1 !== 0 && row.r4 == 0) {
  1779. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  1780. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1781. if (row.w1 == '') { row.w1 = 0 }
  1782. if (row.w2 == '') { row.w2 = 0 }
  1783. if (row.w3 == '') { row.w3 = 0 }
  1784. if (row.w4 == '') { row.w4 = 0 }
  1785. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1786. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1787. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1788. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1789. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1790. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1791. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1792. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1793. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1794. }
  1795. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1796. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1797. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1798. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1799. } else {
  1800. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1801. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1802. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1803. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1804. }
  1805. if (isNaN(row.w1)) {
  1806. row.w1 = 0
  1807. row.r1 = 0
  1808. }
  1809. if (isNaN(row.w4)) {
  1810. row.w4 = 0
  1811. row.r4 = 0
  1812. }
  1813. if (row.w1 <= 0) {
  1814. row.w1 = 0
  1815. row.r1 = 0
  1816. }
  1817. if (row.w4 <= 0) {
  1818. row.w4 = 0
  1819. row.r4 = 0
  1820. }
  1821. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1822. }
  1823. // 4班锁定,1班3班未锁
  1824. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == true) {
  1825. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1826. if (row.r1 == 0 && row.r3 == 0) {
  1827. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  1828. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1829. row.w3 = row.w1
  1830. row.r3 = row.r1
  1831. } else if (row.r1 == 0 && row.r3 !== 0) {
  1832. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1833. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1834. if (row.w1 == '') { row.w1 = 0 }
  1835. if (row.w2 == '') { row.w2 = 0 }
  1836. if (row.w3 == '') { row.w3 = 0 }
  1837. if (row.w4 == '') { row.w4 = 0 }
  1838. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1839. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1840. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1841. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1842. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1843. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1844. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1845. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow2.r1)), parseInt(Cookies.get('decimal')))
  1846. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1847. }
  1848. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1849. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1850. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1851. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1852. } else if (row.r1 !== 0 && row.r3 == 0) {
  1853. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  1854. row.r3 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1855. if (row.w1 == '') { row.w1 = 0 }
  1856. if (row.w2 == '') { row.w2 = 0 }
  1857. if (row.w3 == '') { row.w3 = 0 }
  1858. if (row.w4 == '') { row.w4 = 0 }
  1859. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1860. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1861. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1862. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1863. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1864. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1865. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1866. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1867. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1868. }
  1869. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1870. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1871. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1872. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1873. } else {
  1874. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  1875. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1876. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow2.r1)), parseInt(Cookies.get('decimal')))
  1877. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1878. }
  1879. if (isNaN(row.w1)) {
  1880. row.w1 = 0
  1881. row.r1 = 0
  1882. }
  1883. if (isNaN(row.w3)) {
  1884. row.w3 = 0
  1885. row.r3 = 0
  1886. }
  1887. if (row.w1 <= 0) {
  1888. row.w1 = 0
  1889. row.r1 = 0
  1890. }
  1891. if (row.w3 <= 0) {
  1892. row.w3 = 0
  1893. row.r3 = 0
  1894. }
  1895. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  1896. }
  1897. // 1班3班4班未锁
  1898. if (row.isOneWeight == false && row.isThreeWeight == false && row.isFourWeight == false) {
  1899. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1900. if (row.r1 == 0 && row.r3 == 0 && row.r4 == 0) {
  1901. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) / 3, parseInt(Cookies.get('decimal')))
  1902. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1903. row.w3 = row.w1
  1904. row.r3 = row.r1
  1905. row.w4 = row.w1
  1906. row.r4 = row.r1
  1907. } else if (row.r1 == 0 && row.r3 == 0 && row.r4 !== 0) {
  1908. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  1909. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1910. row.w3 = row.w1
  1911. row.r3 = row.r1
  1912. if (row.w1 == '') { row.w1 = 0 }
  1913. if (row.w2 == '') { row.w2 = 0 }
  1914. if (row.w3 == '') { row.w3 = 0 }
  1915. if (row.w4 == '') { row.w4 = 0 }
  1916. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1917. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1918. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1919. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1920. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1921. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1922. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1923. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  1924. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1925. }
  1926. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1927. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1928. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1929. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1930. } else if (row.r1 == 0 && row.r3 !== 0 && row.r4 == 0) {
  1931. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  1932. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1933. row.w4 = row.w1
  1934. row.r4 = row.r1
  1935. if (row.w1 == '') { row.w1 = 0 }
  1936. if (row.w2 == '') { row.w2 = 0 }
  1937. if (row.w3 == '') { row.w3 = 0 }
  1938. if (row.w4 == '') { row.w4 = 0 }
  1939. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1940. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1941. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1942. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1943. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1944. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1945. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1946. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  1947. row.r3 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1948. }
  1949. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1950. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1951. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1952. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1953. } else if (row.r1 !== 0 && row.r3 == 0 && row.r4 == 0) {
  1954. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  1955. row.r3 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1956. row.w4 = row.w3
  1957. row.r4 = row.r3
  1958. if (row.w1 == '') { row.w1 = 0 }
  1959. if (row.w2 == '') { row.w2 = 0 }
  1960. if (row.w3 == '') { row.w3 = 0 }
  1961. if (row.w4 == '') { row.w4 = 0 }
  1962. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1963. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1964. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1965. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1966. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1967. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1968. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1969. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1970. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1971. }
  1972. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1973. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1974. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1975. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1976. } else if ((row.r1 !== 0 && row.r3 !== 0 && row.r4 == 0)) {
  1977. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  1978. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1979. if (row.w1 == '') { row.w1 = 0 }
  1980. if (row.w2 == '') { row.w2 = 0 }
  1981. if (row.w3 == '') { row.w3 = 0 }
  1982. if (row.w4 == '') { row.w4 = 0 }
  1983. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1984. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1985. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1986. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1987. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  1988. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1989. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  1990. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  1991. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1992. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  1993. row.r3 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  1994. }
  1995. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  1996. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  1997. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  1998. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  1999. } else if ((row.r1 !== 0 && row.r3 == 0 && row.r4 !== 0)) {
  2000. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2001. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2002. if (row.w1 == '') { row.w1 = 0 }
  2003. if (row.w2 == '') { row.w2 = 0 }
  2004. if (row.w3 == '') { row.w3 = 0 }
  2005. if (row.w4 == '') { row.w4 = 0 }
  2006. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2007. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2008. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2009. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2010. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2011. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2012. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2013. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2014. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2015. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2016. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2017. }
  2018. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2019. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2020. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2021. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2022. } else if ((row.r1 == 0 && row.r3 !== 0 && row.r4 !== 0)) {
  2023. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2024. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2025. if (row.w1 == '') { row.w1 = 0 }
  2026. if (row.w2 == '') { row.w2 = 0 }
  2027. if (row.w3 == '') { row.w3 = 0 }
  2028. if (row.w4 == '') { row.w4 = 0 }
  2029. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2030. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2031. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2032. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2033. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2034. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2035. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2036. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2037. row.r3 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2038. row.w4 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2039. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2040. }
  2041. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2042. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2043. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2044. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2045. } else {
  2046. console.log('wolaile')
  2047. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2048. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2049. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2050. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2051. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r4) / (parseFloat(this.focusWRow2.r1) + parseFloat(this.focusWRow2.r3) + parseFloat(this.focusWRow2.r4)), parseInt(Cookies.get('decimal')))
  2052. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2053. }
  2054. if (isNaN(row.w1)) {
  2055. row.w1 = 0
  2056. row.r1 = 0
  2057. }
  2058. if (isNaN(row.w3)) {
  2059. row.w3 = 0
  2060. row.r3 = 0
  2061. }
  2062. if (isNaN(row.w4)) {
  2063. row.w4 = 0
  2064. row.r4 = 0
  2065. }
  2066. if (row.w1 <= 0) {
  2067. row.w1 = 0
  2068. row.r1 = 0
  2069. }
  2070. if (row.w3 <= 0) {
  2071. row.w3 = 0
  2072. row.r3 = 0
  2073. }
  2074. if (row.w4 <= 0) {
  2075. row.w4 = 0
  2076. row.r4 = 0
  2077. }
  2078. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2079. }
  2080. } else if (this.table.RWLength == 3) {
  2081. // 三班
  2082. // 1班/3班锁定
  2083. if (row.isOneWeight == true && row.isThreeWeight == true) {
  2084. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2085. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2086. }
  2087. // 1班不锁3班锁
  2088. if (row.isOneWeight == false && row.isThreeWeight == true) {
  2089. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2090. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2091. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2092. if (row.w1 <= 0) {
  2093. row.w1 = 0
  2094. row.r1 = 0
  2095. }
  2096. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2097. }
  2098. // 3班不锁1班锁
  2099. if (row.isOneWeight == true && row.isThreeWeight == false) {
  2100. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2101. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2), parseInt(Cookies.get('decimal')))
  2102. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2103. if (row.w3 <= 0) {
  2104. row.w3 = 0
  2105. row.r3 = 0
  2106. }
  2107. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2108. }
  2109. // 1班3班都不锁
  2110. if (row.isOneWeight == false && row.isThreeWeight == false) {
  2111. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2112. if (row.r1 == 0 && row.r3 == 0) {
  2113. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2114. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2115. row.w3 = row.w1
  2116. row.r3 = row.r1
  2117. } else if (row.r1 == 0 && row.r3 !== 0) {
  2118. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2119. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2120. if (row.w1 == '') { row.w1 = 0 }
  2121. if (row.w2 == '') { row.w2 = 0 }
  2122. if (row.w3 == '') { row.w3 = 0 }
  2123. if (row.w4 == '') { row.w4 = 0 }
  2124. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2125. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2126. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2127. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2128. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2129. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2130. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2131. row.w3 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2132. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2133. }
  2134. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2135. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2136. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2137. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2138. } else if (row.r1 !== 0 && row.r3 == 0) {
  2139. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2140. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2141. if (row.w1 == '') { row.w1 = 0 }
  2142. if (row.w2 == '') { row.w2 = 0 }
  2143. if (row.w3 == '') { row.w3 = 0 }
  2144. if (row.w4 == '') { row.w4 = 0 }
  2145. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2146. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2147. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2148. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2149. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2150. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2151. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow2.dailyWeight)) {
  2152. row.w1 = formatNum((parseFloat(this.focusWRow2.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2153. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2154. }
  2155. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2156. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2157. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2158. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2159. } else {
  2160. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2161. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2162. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(this.focusWRow2.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2163. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2164. }
  2165. if (isNaN(row.w1)) {
  2166. row.w1 = 0
  2167. row.r1 = 0
  2168. }
  2169. if (isNaN(row.w3)) {
  2170. row.w3 = 0
  2171. row.r3 = 0
  2172. }
  2173. if (row.w3 <= 0) {
  2174. row.w3 = 0
  2175. row.r3 = 0
  2176. }
  2177. if (row.w1 <= 0) {
  2178. row.w1 = 0
  2179. row.r1 = 0
  2180. }
  2181. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2182. }
  2183. } else if (this.table.RWLength == 2) {
  2184. if (row.isOneWeight == false) {
  2185. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2186. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2), parseInt(Cookies.get('decimal')))
  2187. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2188. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2189. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  2190. } else {
  2191. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2192. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2), parseInt(Cookies.get('decimal'))))
  2193. }
  2194. }
  2195. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2196. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2197. if (row.w1 == '') { row.w1 = 0 }
  2198. if (row.w2 == '') { row.w2 = 0 }
  2199. if (row.w3 == '') { row.w3 = 0 }
  2200. if (row.w4 == '') { row.w4 = 0 }
  2201. if (isNaN(row.r1)) { row.r1 = 0 }
  2202. if (isNaN(row.r2)) { row.r2 = 0 }
  2203. if (isNaN(row.r3)) { row.r3 = 0 }
  2204. if (isNaN(row.r4)) { row.r4 = 0 }
  2205. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2206. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2207. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2208. },
  2209. blurW3(row) {
  2210. // 3班重量
  2211. if (row.w1 == '') {
  2212. row.w1 = 0
  2213. }
  2214. if (row.w2 == '') {
  2215. row.w2 = 0
  2216. }
  2217. if (row.w3 == '') {
  2218. row.w3 = 0
  2219. }
  2220. if (row.w4 == '') {
  2221. row.w4 = 0
  2222. }
  2223. if (row.r1 == '') {
  2224. row.r1 = 0
  2225. }
  2226. if (row.r2 == '') {
  2227. row.r2 = 0
  2228. }
  2229. if (row.r3 == '') {
  2230. row.r3 = 0
  2231. }
  2232. if (row.r4 == '') {
  2233. row.r4 = 0
  2234. }
  2235. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2236. console.log(row, '=======投喂量feedweight')
  2237. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2238. if (this.table.RWLength == 4) {
  2239. // 四班
  2240. // 1班2班4班都锁定
  2241. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == true) {
  2242. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2243. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2244. }
  2245. // 1班2班锁定4班未锁定
  2246. if (row.isOneWeight == true && row.isTwoWeight == true && row.isFourWeight == false) {
  2247. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2248. row.w4 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2249. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2250. if (row.w4 <= 0) {
  2251. row.w4 = 0
  2252. row.r4 = 0
  2253. }
  2254. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2255. }
  2256. // 2班4班锁定1班未锁定
  2257. if (row.isOneWeight == false && row.isTwoWeight == true && row.isFourWeight == true) {
  2258. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2259. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2260. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2261. if (row.w1 <= 0) {
  2262. row.w1 = 0
  2263. row.r1 = 0
  2264. }
  2265. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2266. }
  2267. // 1班4班锁定2班未锁定
  2268. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == true) {
  2269. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2270. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2271. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2272. if (row.w2 <= 0) {
  2273. row.w2 = 0
  2274. row.r2 = 0
  2275. }
  2276. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2277. }
  2278. // 2班锁定,1班4班未锁
  2279. if (row.isTwoWeight == true && row.isOneWeight == false && row.isFourWeight == false) {
  2280. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2281. if (row.r1 == 0 && row.r4 == 0) {
  2282. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2283. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2284. row.w4 = row.w1
  2285. row.r4 = row.r1
  2286. } else if (row.r1 == 0 && row.r4 !== 0) {
  2287. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2288. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2289. if (row.w1 == '') { row.w1 = 0 }
  2290. if (row.w2 == '') { row.w2 = 0 }
  2291. if (row.w3 == '') { row.w3 = 0 }
  2292. if (row.w4 == '') { row.w4 = 0 }
  2293. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2294. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2295. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2296. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2297. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2298. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2299. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2300. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2301. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2302. }
  2303. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2304. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2305. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2306. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2307. } else if (row.r1 !== 0 && row.r4 == 0) {
  2308. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2309. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2310. if (row.w1 == '') { row.w1 = 0 }
  2311. if (row.w2 == '') { row.w2 = 0 }
  2312. if (row.w3 == '') { row.w3 = 0 }
  2313. if (row.w4 == '') { row.w4 = 0 }
  2314. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2315. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2316. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2317. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2318. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2319. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2320. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2321. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2322. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2323. }
  2324. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2325. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2326. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2327. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2328. } else {
  2329. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2330. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2331. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2332. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2333. }
  2334. if (isNaN(row.w1)) {
  2335. row.w1 = 0
  2336. row.r1 = 0
  2337. }
  2338. if (isNaN(row.w4)) {
  2339. row.w4 = 0
  2340. row.r4 = 0
  2341. }
  2342. if (row.w1 <= 0) {
  2343. row.w1 = 0
  2344. row.r1 = 0
  2345. }
  2346. if (row.w4 <= 0) {
  2347. row.w4 = 0
  2348. row.r4 = 0
  2349. }
  2350. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2351. }
  2352. // 1班锁定,2班4班未锁
  2353. if (row.isTwoWeight == false && row.isOneWeight == true && row.isFourWeight == false) {
  2354. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2355. if (row.r2 == 0 && row.r4 == 0) {
  2356. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2357. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2358. row.w4 = row.w2
  2359. row.r4 = row.r2
  2360. } else if (row.r2 == 0 && row.r4 !== 0) {
  2361. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2362. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2363. if (row.w1 == '') { row.w1 = 0 }
  2364. if (row.w2 == '') { row.w2 = 0 }
  2365. if (row.w3 == '') { row.w3 = 0 }
  2366. if (row.w4 == '') { row.w4 = 0 }
  2367. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2368. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2369. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2370. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2371. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2372. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2373. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2374. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2375. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2376. }
  2377. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2378. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2379. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2380. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2381. } else if (row.r2 !== 0 && row.r4 == 0) {
  2382. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2383. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2384. if (row.w1 == '') { row.w1 = 0 }
  2385. if (row.w2 == '') { row.w2 = 0 }
  2386. if (row.w3 == '') { row.w3 = 0 }
  2387. if (row.w4 == '') { row.w4 = 0 }
  2388. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2389. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2390. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2391. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2392. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2393. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2394. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2395. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2396. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2397. }
  2398. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2399. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2400. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2401. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2402. } else {
  2403. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2404. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2405. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3)) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2406. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2407. }
  2408. if (isNaN(row.w2)) {
  2409. row.w2 = 0
  2410. row.r2 = 0
  2411. }
  2412. if (isNaN(row.w4)) {
  2413. row.w4 = 0
  2414. row.r4 = 0
  2415. }
  2416. if (row.w2 <= 0) {
  2417. row.w2 = 0
  2418. row.r2 = 0
  2419. }
  2420. if (row.w4 <= 0) {
  2421. row.w4 = 0
  2422. row.r4 = 0
  2423. }
  2424. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2425. }
  2426. // 4班锁定,2班1班未锁
  2427. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == true) {
  2428. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2429. if (row.r1 == 0 && row.r2 == 0) {
  2430. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  2431. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2432. row.w2 = row.w1
  2433. row.r2 = row.r1
  2434. } else if (row.r1 == 0 && row.r2 !== 0) {
  2435. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2436. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2437. if (row.w1 == '') { row.w1 = 0 }
  2438. if (row.w2 == '') { row.w2 = 0 }
  2439. if (row.w3 == '') { row.w3 = 0 }
  2440. if (row.w4 == '') { row.w4 = 0 }
  2441. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2442. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2443. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2444. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2445. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2446. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2447. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2448. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2449. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2450. }
  2451. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2452. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2453. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2454. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2455. } else if (row.r1 !== 0 && row.r2 == 0) {
  2456. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2457. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2458. if (row.w1 == '') { row.w1 = 0 }
  2459. if (row.w2 == '') { row.w2 = 0 }
  2460. if (row.w3 == '') { row.w3 = 0 }
  2461. if (row.w4 == '') { row.w4 = 0 }
  2462. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2463. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2464. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2465. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2466. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2467. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2468. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2469. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2470. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2471. }
  2472. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2473. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2474. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2475. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2476. } else {
  2477. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2478. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2479. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2480. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2481. }
  2482. if (isNaN(row.w1)) {
  2483. row.w1 = 0
  2484. row.r1 = 0
  2485. }
  2486. if (isNaN(row.w2)) {
  2487. row.w2 = 0
  2488. row.r2 = 0
  2489. }
  2490. if (row.w2 <= 0) {
  2491. row.w2 = 0
  2492. row.r2 = 0
  2493. }
  2494. if (row.w1 <= 0) {
  2495. row.w1 = 0
  2496. row.r1 = 0
  2497. }
  2498. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2499. }
  2500. // 2班1班4班未锁
  2501. if (row.isTwoWeight == false && row.isOneWeight == false && row.isFourWeight == false) {
  2502. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2503. if (row.r1 == 0 && row.r2 == 0 && row.r4 == 0) {
  2504. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) / 3, parseInt(Cookies.get('decimal')))
  2505. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2506. row.w2 = row.w1
  2507. row.r2 = row.r1
  2508. row.w4 = row.w1
  2509. row.r4 = row.r1
  2510. } else if (row.r1 == 0 && row.r2 == 0 && row.r4 !== 0) {
  2511. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  2512. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2513. row.w2 = row.w1
  2514. row.r2 = row.r1
  2515. if (row.w1 == '') { row.w1 = 0 }
  2516. if (row.w2 == '') { row.w2 = 0 }
  2517. if (row.w3 == '') { row.w3 = 0 }
  2518. if (row.w4 == '') { row.w4 = 0 }
  2519. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2520. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2521. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2522. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2523. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2524. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2525. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2526. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2527. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2528. }
  2529. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2530. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2531. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2532. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2533. } else if (row.r1 == 0 && row.r2 !== 0 && row.r4 == 0) {
  2534. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2535. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2536. row.w4 = row.w1
  2537. row.r4 = row.r1
  2538. if (row.w1 == '') { row.w1 = 0 }
  2539. if (row.w2 == '') { row.w2 = 0 }
  2540. if (row.w3 == '') { row.w3 = 0 }
  2541. if (row.w4 == '') { row.w4 = 0 }
  2542. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2543. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2544. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2545. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2546. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2547. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2548. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2549. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2550. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2551. }
  2552. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2553. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2554. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2555. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2556. } else if (row.r1 !== 0 && row.r2 == 0 && row.r4 == 0) {
  2557. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  2558. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2559. row.w4 = row.w1
  2560. row.r4 = row.r1
  2561. if (row.w1 == '') { row.w1 = 0 }
  2562. if (row.w2 == '') { row.w2 = 0 }
  2563. if (row.w3 == '') { row.w3 = 0 }
  2564. if (row.w4 == '') { row.w4 = 0 }
  2565. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2566. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2567. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2568. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2569. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2570. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2571. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2572. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2573. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2574. }
  2575. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2576. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2577. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2578. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2579. } else if (row.r1 !== 0 && row.r2 !== 0 && row.r4 == 0) {
  2580. row.w4 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2581. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2582. if (row.w1 == '') { row.w1 = 0 }
  2583. if (row.w2 == '') { row.w2 = 0 }
  2584. if (row.w3 == '') { row.w3 = 0 }
  2585. if (row.w4 == '') { row.w4 = 0 }
  2586. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2587. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2588. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2589. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2590. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2591. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2592. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2593. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2594. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2595. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2596. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2597. }
  2598. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2599. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2600. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2601. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2602. } else if (row.r1 !== 0 && row.r2 == 0 && row.r4 !== 0) {
  2603. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2604. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2605. if (row.w1 == '') { row.w1 = 0 }
  2606. if (row.w2 == '') { row.w2 = 0 }
  2607. if (row.w3 == '') { row.w3 = 0 }
  2608. if (row.w4 == '') { row.w4 = 0 }
  2609. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2610. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2611. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2612. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2613. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2614. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2615. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2616. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2617. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2618. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2619. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2620. }
  2621. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2622. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2623. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2624. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2625. } else if (row.r1 == 0 && row.r2 !== 0 && row.r4 !== 0) {
  2626. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2) - parseFloat(row.w4)), parseInt(Cookies.get('decimal')))
  2627. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2628. if (row.w1 == '') { row.w1 = 0 }
  2629. if (row.w2 == '') { row.w2 = 0 }
  2630. if (row.w3 == '') { row.w3 = 0 }
  2631. if (row.w4 == '') { row.w4 = 0 }
  2632. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2633. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2634. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2635. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2636. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2637. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2638. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2639. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2640. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2641. row.w4 = formatNum((parseFloat(this.focusWRow3.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2642. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2643. }
  2644. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2645. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2646. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2647. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2648. } else {
  2649. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r4)), parseInt(Cookies.get('decimal')))
  2650. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2651. row.w2 = formatNum((parseFloat(row.dailyWeight - row.w3) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2652. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2653. row.w4 = formatNum((parseFloat(row.dailyWeight - row.w3) * parseFloat(row.r4) / (parseFloat(this.focusWRow3.r1) + parseFloat(this.focusWRow3.r2) + parseFloat(this.focusWRow3.r4))), parseInt(Cookies.get('decimal')))
  2654. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2655. }
  2656. if (isNaN(row.w1)) {
  2657. row.w1 = 0
  2658. row.r1 = 0
  2659. }
  2660. if (isNaN(row.w2)) {
  2661. row.w2 = 0
  2662. row.r2 = 0
  2663. }
  2664. if (isNaN(row.w4)) {
  2665. row.w4 = 0
  2666. row.r4 = 0
  2667. }
  2668. if (row.w1 <= 0) {
  2669. row.w1 = 0
  2670. row.r1 = 0
  2671. }
  2672. if (row.w2 <= 0) {
  2673. row.w2 = 0
  2674. row.r2 = 0
  2675. }
  2676. if (row.w4 <= 0) {
  2677. row.w4 = 0
  2678. row.r4 = 0
  2679. }
  2680. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2681. }
  2682. } else if (this.table.RWLength == 3) {
  2683. // 三班
  2684. // 1班/2班锁定
  2685. if (row.isOneWeight == true && row.isTwoWeight == true) {
  2686. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2687. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2688. }
  2689. // 1班不锁2班锁
  2690. if (row.isOneWeight == false && row.isTwoWeight == true) {
  2691. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2692. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2693. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2694. if (row.w1 <= 0) {
  2695. row.w1 = 0
  2696. row.r1 = 0
  2697. }
  2698. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2699. }
  2700. // 3班不锁2班锁
  2701. // 2班不锁1班锁
  2702. if (row.isOneWeight == true && row.isTwoWeight == false) {
  2703. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2704. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2705. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2706. if (row.w2 <= 0) {
  2707. row.w2 = 0
  2708. row.r2 = 0
  2709. }
  2710. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2711. }
  2712. // 2班3班都不锁
  2713. // 1班2班都不锁
  2714. if (row.isOneWeight == false && row.isTwoWeight == false) {
  2715. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2716. if (row.r1 == 0 && row.r2 == 0) {
  2717. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2718. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2719. row.w2 = row.w1
  2720. row.r2 = row.r1
  2721. } else if (row.r1 == 0 && row.r2 !== 0) {
  2722. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2723. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2724. if (row.w1 == '') { row.w1 = 0 }
  2725. if (row.w2 == '') { row.w2 = 0 }
  2726. if (row.w3 == '') { row.w3 = 0 }
  2727. if (row.w4 == '') { row.w4 = 0 }
  2728. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2729. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2730. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2731. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2732. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2733. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2734. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2735. row.w2 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2736. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2737. }
  2738. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2739. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2740. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2741. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2742. } else if (row.r1 !== 0 && row.r2 == 0) {
  2743. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2744. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2745. if (row.w1 == '') { row.w1 = 0 }
  2746. if (row.w2 == '') { row.w2 = 0 }
  2747. if (row.w3 == '') { row.w3 = 0 }
  2748. if (row.w4 == '') { row.w4 = 0 }
  2749. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2750. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2751. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2752. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2753. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2754. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2755. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow3.dailyWeight)) {
  2756. row.w1 = formatNum((parseFloat(this.focusWRow3.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2757. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2758. }
  2759. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2760. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2761. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2762. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2763. } else {
  2764. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2765. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2766. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(this.focusWRow3.r1) + parseFloat(row.r2)), parseInt(Cookies.get('decimal')))
  2767. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2768. }
  2769. if (isNaN(row.w1)) {
  2770. row.w1 = 0
  2771. row.r1 = 0
  2772. }
  2773. if (isNaN(row.w2)) {
  2774. row.w2 = 0
  2775. row.r2 = 0
  2776. }
  2777. if (row.w1 <= 0) {
  2778. row.w1 = 0
  2779. row.r1 = 0
  2780. }
  2781. if (row.w2 <= 0) {
  2782. row.w2 = 0
  2783. row.r2 = 0
  2784. }
  2785. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3), parseInt(Cookies.get('decimal'))))
  2786. }
  2787. }
  2788. if (row.w1 == '') { row.w1 = 0 }
  2789. if (row.w2 == '') { row.w2 = 0 }
  2790. if (row.w3 == '') { row.w3 = 0 }
  2791. if (row.w4 == '') { row.w4 = 0 }
  2792. if (isNaN(row.r1)) { row.r1 = 0 }
  2793. if (isNaN(row.r2)) { row.r2 = 0 }
  2794. if (isNaN(row.r3)) { row.r3 = 0 }
  2795. if (isNaN(row.r4)) { row.r4 = 0 }
  2796. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2797. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2798. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2799. },
  2800. blurW4(row) {
  2801. if (row.w1 == '') {
  2802. row.w1 = 0
  2803. }
  2804. if (row.w2 == '') {
  2805. row.w2 = 0
  2806. }
  2807. if (row.w3 == '') {
  2808. row.w3 = 0
  2809. }
  2810. if (row.w4 == '') {
  2811. row.w4 = 0
  2812. }
  2813. if (row.r1 == '') {
  2814. row.r1 = 0
  2815. }
  2816. if (row.r2 == '') {
  2817. row.r2 = 0
  2818. }
  2819. if (row.r3 == '') {
  2820. row.r3 = 0
  2821. }
  2822. if (row.r4 == '') {
  2823. row.r4 = 0
  2824. }
  2825. // row.ftweight = parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)
  2826. console.log(row, '=======投喂量feedweight')
  2827. // isOneWeight,isTwoWeight,isThreeWeight,isFourWeight
  2828. if (this.table.RWLength == 4) {
  2829. // 四班
  2830. // 1班2班3班都锁定
  2831. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == true) {
  2832. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2833. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2834. }
  2835. // 2班3班锁定1班未锁定
  2836. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == true) {
  2837. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2838. row.w1 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3), parseInt(Cookies.get('decimal')))
  2839. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2840. if (row.w1 <= 0) {
  2841. row.w1 = 0
  2842. row.r1 = 0
  2843. }
  2844. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2845. }
  2846. // 2班1班锁定3班未锁定
  2847. if (row.isOneWeight == true && row.isTwoWeight == true && row.isThreeWeight == false) {
  2848. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2849. row.w3 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w2) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2850. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2851. if (row.w3 <= 0) {
  2852. row.w3 = 0
  2853. row.r3 = 0
  2854. }
  2855. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2856. }
  2857. // 3班1班锁定2班未锁定
  2858. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == true) {
  2859. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2860. row.w2 = formatNum(parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w3) - parseFloat(row.w4), parseInt(Cookies.get('decimal')))
  2861. row.r2 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2862. if (row.w2 <= 0) {
  2863. row.w2 = 0
  2864. row.r2 = 0
  2865. }
  2866. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2867. }
  2868. // 2班锁定,3班1班未锁
  2869. if (row.isOneWeight == false && row.isTwoWeight == true && row.isThreeWeight == false) {
  2870. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2871. if (row.r1 == 0 && row.r3 == 0) {
  2872. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  2873. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2874. row.w3 = row.w1
  2875. row.r3 = row.r1
  2876. } else if (row.r1 == 0 && row.r3 !== 0) {
  2877. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  2878. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2879. if (row.w1 == '') { row.w1 = 0 }
  2880. if (row.w2 == '') { row.w2 = 0 }
  2881. if (row.w3 == '') { row.w3 = 0 }
  2882. if (row.w4 == '') { row.w4 = 0 }
  2883. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2884. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2885. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2886. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2887. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2888. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2889. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  2890. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  2891. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2892. }
  2893. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2894. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2895. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2896. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2897. } else if (row.r1 !== 0 && row.r3 == 0) {
  2898. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2899. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2900. if (row.w1 == '') { row.w1 = 0 }
  2901. if (row.w2 == '') { row.w2 = 0 }
  2902. if (row.w3 == '') { row.w3 = 0 }
  2903. if (row.w4 == '') { row.w4 = 0 }
  2904. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2905. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2906. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2907. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2908. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2909. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2910. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  2911. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2912. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2913. }
  2914. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2915. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2916. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2917. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2918. } else {
  2919. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  2920. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2921. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) * parseFloat(row.r3) / (parseFloat(row.r3) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  2922. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2923. }
  2924. if (isNaN(row.w1)) {
  2925. row.w1 = 0
  2926. row.r1 = 0
  2927. }
  2928. if (isNaN(row.w3)) {
  2929. row.w3 = 0
  2930. row.r3 = 0
  2931. }
  2932. if (row.w3 <= 0) {
  2933. row.w3 = 0
  2934. row.r3 = 0
  2935. }
  2936. if (row.w1 <= 0) {
  2937. row.w1 = 0
  2938. row.r1 = 0
  2939. }
  2940. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  2941. }
  2942. // 3班锁定,2班1班未锁
  2943. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == true) {
  2944. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2945. if (row.r1 == 0 && row.r2 == 0) {
  2946. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  2947. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2948. row.w2 = row.w1
  2949. row.r2 = row.r1
  2950. } else if (row.r1 == 0 && row.r2 !== 0) {
  2951. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  2952. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2953. if (row.w1 == '') { row.w1 = 0 }
  2954. if (row.w2 == '') { row.w2 = 0 }
  2955. if (row.w3 == '') { row.w3 = 0 }
  2956. if (row.w4 == '') { row.w4 = 0 }
  2957. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2958. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2959. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2960. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2961. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2962. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2963. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  2964. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  2965. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2966. }
  2967. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2968. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2969. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2970. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2971. } else if (row.r1 !== 0 && row.r2 == 0) {
  2972. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3) - parseFloat(row.w1)), parseInt(Cookies.get('decimal')))
  2973. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2974. if (row.w1 == '') { row.w1 = 0 }
  2975. if (row.w2 == '') { row.w2 = 0 }
  2976. if (row.w3 == '') { row.w3 = 0 }
  2977. if (row.w4 == '') { row.w4 = 0 }
  2978. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2979. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2980. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2981. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2982. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  2983. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  2984. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  2985. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r2) + parseFloat(row.r1)), parseInt(Cookies.get('decimal')))
  2986. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2987. }
  2988. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  2989. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  2990. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  2991. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  2992. } else {
  2993. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r1) / (parseFloat(row.r2) + parseFloat(row.r1)), parseInt(Cookies.get('decimal')))
  2994. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2995. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(this.focusWRow4.r1)), parseInt(Cookies.get('decimal')))
  2996. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  2997. }
  2998. if (isNaN(row.w1)) {
  2999. row.w1 = 0
  3000. row.r1 = 0
  3001. }
  3002. if (isNaN(row.w2)) {
  3003. row.w2 = 0
  3004. row.r2 = 0
  3005. }
  3006. if (row.w2 <= 0) {
  3007. row.w2 = 0
  3008. row.r2 = 0
  3009. }
  3010. if (row.w1 <= 0) {
  3011. row.w1 = 0
  3012. row.r1 = 0
  3013. }
  3014. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3015. }
  3016. // 1班锁定,2班3班未锁
  3017. if (row.isOneWeight == true && row.isTwoWeight == false && row.isThreeWeight == false) {
  3018. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3019. if (row.r2 == 0 && row.r3 == 0) {
  3020. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) / 2, parseInt(Cookies.get('decimal')))
  3021. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3022. row.w3 = row.w2
  3023. row.r3 = row.r2
  3024. } else if (row.r2 == 0 && row.r3 !== 0) {
  3025. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  3026. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3027. if (row.w1 == '') { row.w1 = 0 }
  3028. if (row.w2 == '') { row.w2 = 0 }
  3029. if (row.w3 == '') { row.w3 = 0 }
  3030. if (row.w4 == '') { row.w4 = 0 }
  3031. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3032. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3033. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3034. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3035. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3036. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3037. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3038. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3039. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3040. }
  3041. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3042. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3043. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3044. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3045. } else if (row.r2 !== 0 && row.r3 == 0) {
  3046. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3047. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3048. if (row.w1 == '') { row.w1 = 0 }
  3049. if (row.w2 == '') { row.w2 = 0 }
  3050. if (row.w3 == '') { row.w3 = 0 }
  3051. if (row.w4 == '') { row.w4 = 0 }
  3052. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3053. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3054. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3055. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3056. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3057. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3058. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3059. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3060. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3061. }
  3062. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3063. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3064. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3065. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3066. } else {
  3067. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3068. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3069. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w1) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3070. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3071. }
  3072. if (isNaN(row.w2)) {
  3073. row.w2 = 0
  3074. row.r2 = 0
  3075. }
  3076. if (isNaN(row.w3)) {
  3077. row.w3 = 0
  3078. row.r3 = 0
  3079. }
  3080. if (row.w2 <= 0) {
  3081. row.w2 = 0
  3082. row.r2 = 0
  3083. }
  3084. if (row.w3 <= 0) {
  3085. row.w3 = 0
  3086. row.r3 = 0
  3087. }
  3088. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3089. }
  3090. // 2班3班1班未锁
  3091. if (row.isOneWeight == false && row.isTwoWeight == false && row.isThreeWeight == false) {
  3092. row.r4 = formatNum(parseFloat(row.w4) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3093. if (row.r1 == 0 && row.r2 == 0 && row.r3 == 0) {
  3094. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) / 3, parseInt(Cookies.get('decimal')))
  3095. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3096. row.w2 = row.w1
  3097. row.r2 = row.r1
  3098. row.w3 = row.w1
  3099. row.r3 = row.r1
  3100. } else if (row.r1 == 0 && row.r2 == 0 && row.r3 !== 0) {
  3101. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w3)) / 2, parseInt(Cookies.get('decimal')))
  3102. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3103. row.w2 = row.w1
  3104. row.r2 = row.r1
  3105. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3106. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3107. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3108. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3109. if (row.w1 == '') { row.w1 = 0 }
  3110. if (row.w2 == '') { row.w2 = 0 }
  3111. if (row.w3 == '') { row.w3 = 0 }
  3112. if (row.w4 == '') { row.w4 = 0 }
  3113. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3114. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3115. console.log(row.dailyWeight)
  3116. console.log(this.focusWRow4.dailyWeight)
  3117. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3118. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3119. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3120. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3121. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3122. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3123. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3124. }
  3125. } else if (row.r1 == 0 && row.r2 !== 0 && row.r3 == 0) {
  3126. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2)) / 2, parseInt(Cookies.get('decimal')))
  3127. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3128. row.w3 = row.w1
  3129. row.r3 = row.r1
  3130. if (row.w1 == '') { row.w1 = 0 }
  3131. if (row.w2 == '') { row.w2 = 0 }
  3132. if (row.w3 == '') { row.w3 = 0 }
  3133. if (row.w4 == '') { row.w4 = 0 }
  3134. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3135. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3136. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3137. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3138. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3139. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3140. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3141. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3142. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3143. }
  3144. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3145. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3146. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3147. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3148. } else if (row.r1 !== 0 && row.r2 == 0 && row.r3 == 0) {
  3149. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w1)) / 2, parseInt(Cookies.get('decimal')))
  3150. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3151. row.w3 = row.w1
  3152. row.r3 = row.r1
  3153. if (row.w1 == '') { row.w1 = 0 }
  3154. if (row.w2 == '') { row.w2 = 0 }
  3155. if (row.w3 == '') { row.w3 = 0 }
  3156. if (row.w4 == '') { row.w4 = 0 }
  3157. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3158. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3159. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3160. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3161. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3162. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3163. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3164. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3165. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3166. }
  3167. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3168. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3169. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3170. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3171. } else if (row.r1 !== 0 && row.r2 !== 0 && row.r3 == 0) {
  3172. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w1) - parseFloat(row.w2)), parseInt(Cookies.get('decimal')))
  3173. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3174. if (row.w1 == '') { row.w1 = 0 }
  3175. if (row.w2 == '') { row.w2 = 0 }
  3176. if (row.w3 == '') { row.w3 = 0 }
  3177. if (row.w4 == '') { row.w4 = 0 }
  3178. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3179. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3180. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3181. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3182. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3183. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3184. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3185. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3186. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3187. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3188. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3189. }
  3190. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3191. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3192. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3193. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3194. } else if (row.r1 !== 0 && row.r2 == 0 && row.r3 !== 0) {
  3195. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w1) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  3196. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3197. if (row.w1 == '') { row.w1 = 0 }
  3198. if (row.w2 == '') { row.w2 = 0 }
  3199. if (row.w3 == '') { row.w3 = 0 }
  3200. if (row.w4 == '') { row.w4 = 0 }
  3201. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3202. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3203. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3204. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3205. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3206. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3207. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3208. row.w1 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3209. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3210. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3211. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3212. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3213. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3214. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3215. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3216. }
  3217. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3218. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3219. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3220. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3221. } else if (row.r1 == 0 && row.r2 !== 0 && row.r3 !== 0) {
  3222. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4) - parseFloat(row.w2) - parseFloat(row.w3)), parseInt(Cookies.get('decimal')))
  3223. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3224. if (row.w1 == '') { row.w1 = 0 }
  3225. if (row.w2 == '') { row.w2 = 0 }
  3226. if (row.w3 == '') { row.w3 = 0 }
  3227. if (row.w4 == '') { row.w4 = 0 }
  3228. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3229. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3230. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3231. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3232. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3233. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3234. if (parseFloat(row.dailyWeight) > parseFloat(this.focusWRow4.dailyWeight)) {
  3235. row.w2 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3236. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3237. row.w3 = formatNum((parseFloat(this.focusWRow4.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3238. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3239. if (row.w1 <= 0) { row.w1 = 0; row.r1 = 0 }
  3240. if (row.w2 <= 0) { row.w2 = 0; row.r2 = 0 }
  3241. if (row.w3 <= 0) { row.w3 = 0; row.r3 = 0 }
  3242. if (row.w4 <= 0) { row.w4 = 0; row.r4 = 0 }
  3243. }
  3244. } else {
  3245. row.w1 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r1) / (parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3)), parseInt(Cookies.get('decimal')))
  3246. row.r1 = formatNum(parseFloat(row.w1) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3247. row.w2 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r2) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3248. row.r2 = formatNum(parseFloat(row.w2) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3249. row.w3 = formatNum((parseFloat(row.dailyWeight) - parseFloat(row.w4)) * parseFloat(row.r3) / (parseFloat(this.focusWRow4.r1) + parseFloat(this.focusWRow4.r2) + parseFloat(this.focusWRow4.r3)), parseInt(Cookies.get('decimal')))
  3250. row.r3 = formatNum(parseFloat(row.w3) / parseFloat(row.feedweight) * 100, parseInt(Cookies.get('decimal')))
  3251. }
  3252. if (isNaN(row.w1)) {
  3253. row.w1 = 0
  3254. row.r1 = 0
  3255. }
  3256. if (isNaN(row.w2)) {
  3257. row.w2 = 0
  3258. row.r2 = 0
  3259. }
  3260. if (isNaN(row.w3)) {
  3261. row.w3 = 0
  3262. row.r3 = 0
  3263. }
  3264. if (row.w1 <= 0) {
  3265. row.w1 = 0
  3266. row.r1 = 0
  3267. }
  3268. if (row.w2 <= 0) {
  3269. row.w2 = 0
  3270. row.r2 = 0
  3271. }
  3272. if (row.w3 <= 0) {
  3273. row.w3 = 0
  3274. row.r3 = 0
  3275. }
  3276. this.$set(row, 'sumr', formatNum(parseFloat(row.r1) + parseFloat(row.r2) + parseFloat(row.r3) + parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3277. }
  3278. }
  3279. if (row.w1 == '') { row.w1 = 0 }
  3280. if (row.w2 == '') { row.w2 = 0 }
  3281. if (row.w3 == '') { row.w3 = 0 }
  3282. if (row.w4 == '') { row.w4 = 0 }
  3283. if (isNaN(row.r1)) { row.r1 = 0 }
  3284. if (isNaN(row.r2)) { row.r2 = 0 }
  3285. if (isNaN(row.r3)) { row.r3 = 0 }
  3286. if (isNaN(row.r4)) { row.r4 = 0 }
  3287. this.$set(row, 'sumr', formatNum(parseFloat(row.r1)+parseFloat(row.r2)+parseFloat(row.r3)+parseFloat(row.r4), parseInt(Cookies.get('decimal'))))
  3288. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
  3289. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  3290. },
  3291. celldblclick(row, column, cell, event) {
  3292. console.log(row, '=====')
  3293. this.handleUpdate(row)
  3294. },
  3295. // 编辑
  3296. handleUpdate(row) {
  3297. console.log(row)
  3298. this.oldRowList = {...row}
  3299. for (let i = 0; i < this.table.list.length; i++) {
  3300. if (this.table.list[i].Edit == true) {
  3301. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  3302. return false
  3303. }
  3304. }
  3305. // 编辑true,不可编辑false
  3306. row.Edit = true
  3307. row.NoEdit = false
  3308. // 编辑false,编辑保存true
  3309. row.isUpdate = false
  3310. row.isUpdateSave = true
  3311. row.ftid = String(row.ftid)
  3312. if (row.ptsfid == '-1') {
  3313. row.ptsfid = ''
  3314. }
  3315. row.ptsfid = String(row.ptsfid)
  3316. // dryweight
  3317. this.table.temp.ftid = row.ftid
  3318. this.table.temp.ftname = row.ftname
  3319. this.table.temp.ptsfid = row.ptsfid
  3320. this.table.temp.ptsfname = row.ptsfname
  3321. },
  3322. updateData(row) {
  3323. if (row.r1 == 'NaN') { this.$set(row, 'r1', 0) }
  3324. if (row.r2 == 'NaN') { this.$set(row, 'r2', 0) }
  3325. if (row.r3 == 'NaN') { this.$set(row, 'r3', 0) }
  3326. if (row.r4 == 'NaN') { this.$set(row, 'r4', 0) }
  3327. if (row.w1 == 'NaN') { this.$set(row, 'w1', 0) }
  3328. if (row.w2 == 'NaN') { this.$set(row, 'w2', 0) }
  3329. if (row.w3 == 'NaN') { this.$set(row, 'w3', 0) }
  3330. if (row.w4 == 'NaN') { this.$set(row, 'w4', 0) }
  3331. if (row.bw1 == 'NaN') { this.$set(row, 'bw1', 0) }
  3332. if (row.bw2 == 'NaN') { this.$set(row, 'bw2', 0) }
  3333. if (row.bw3 == 'NaN') { this.$set(row, 'bw3', 0) }
  3334. if (row.bw4 == 'NaN') { this.$set(row, 'bw4', 0) }
  3335. var arr = []
  3336. for (let i = 1; i <= this.table.RWLength; i++) {
  3337. var obj = {}
  3338. obj['times'] = i
  3339. obj['pastureid'] = row.pastureid
  3340. obj['barid'] = row.barid
  3341. obj['cowcount'] = row.ccount
  3342. obj['ccountradio'] = row.ccountradio
  3343. obj['ptid'] = row.ftid
  3344. if (row.ptsfid !== '') {
  3345. obj['ptsid'] = row.ptsfid
  3346. } else {
  3347. obj['ptsid'] = '-1'
  3348. }
  3349. obj['weight'] = row['w' + i]
  3350. if(row['bw' + i] == ""){
  3351. obj['supplement'] = 0
  3352. }else{
  3353. obj['supplement'] = row['bw' + i]
  3354. }
  3355. obj['tratio'] = Math.round(row['r' + i])
  3356. obj['todaysupplement'] = row.todaysupplement
  3357. obj['todayweight'] = row.todayweight
  3358. arr.push(obj)
  3359. }
  3360. if (this.table.isPtsfname == 0) {
  3361. row.ptsfid = '-1'
  3362. row.ptsfname = ''
  3363. } else {
  3364. if (row.ptsfid == '') {
  3365. row.ptsfid = '-1'
  3366. row.ptsfname = ''
  3367. }
  3368. }
  3369. if (row.supplyweight == '') {
  3370. row.supplyweight = '0'
  3371. }
  3372. if (this.table.isPtsfname == false) {
  3373. row.supplyweight = '0'
  3374. }
  3375. console.log(row, '============')
  3376. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  3377. this.$set(row, 'ccountratio', Math.floor(parseFloat(row.ccountratio) * 100) / 100)
  3378. row.ccountratio = String(row.ccountratio)
  3379. row.sumr = Math.round(row.sumr)
  3380. // for(let i=0;i<arr.length;i++){
  3381. // if(arr[i].tratio == undefined ||arr[i].tratio =='' || arr[i].tratio == null){
  3382. // arr[i].tratio = 0
  3383. // }
  3384. // }
  3385. this.table.rwList = arr
  3386. console.log('点击了编辑保存', row)
  3387. this.table.temp.pastureid = row.pastureid
  3388. this.table.temp.id = row.id
  3389. this.table.temp.barname = row.barname
  3390. this.table.temp.barid = row.barid
  3391. this.table.temp.ccount = row.ccount
  3392. this.table.temp.ratio = row.ratio
  3393. this.table.temp.ccountratio = row.ccountratio
  3394. this.table.temp.ftid = row.ftid
  3395. this.table.temp.ftname = row.ftname
  3396. this.table.temp.ptsfid = row.ptsfid
  3397. this.table.temp.ptsfname = row.ptsfname
  3398. this.table.temp.ftweight = row.ftweight
  3399. this.table.temp.supplyweight = row.supplyweight
  3400. this.table.temp.feedweight = row.feedweight
  3401. this.table.temp.owner = row.owner
  3402. this.table.temp.sumr = row.sumr
  3403. if (row.softccount == '') {
  3404. row.softccount = 0
  3405. }
  3406. if (row.r1 == '') {
  3407. row.r1 = 0
  3408. }
  3409. if (row.r2 == '') {
  3410. row.r2 = 0
  3411. }
  3412. if (row.r3 == '') {
  3413. row.r3 = 0
  3414. }
  3415. if (row.r4 == '') {
  3416. row.r4 = 0
  3417. }
  3418. if (row.w1 == '') {
  3419. row.w1 = 0
  3420. }
  3421. if (row.w2 == '' || row.w4 == NaN) {
  3422. row.w2 = 0
  3423. }
  3424. if (row.w3 == '' || row.w4 == NaN) {
  3425. row.w3 = 0
  3426. }
  3427. if (row.w4 == '' || row.w4 == NaN) {
  3428. row.w4 = 0
  3429. }
  3430. console.log(row, '===========')
  3431. this.table.temp.softccount = row.softccount
  3432. this.table.temp.r1 = Math.round(row.r1)
  3433. this.table.temp.r2 = Math.round(row.r2)
  3434. this.table.temp.r3 = Math.round(row.r3)
  3435. this.table.temp.r4 = Math.round(row.r4)
  3436. this.table.temp.w1 = row.w1
  3437. this.table.temp.w2 = row.w2
  3438. this.table.temp.w3 = row.w3
  3439. this.table.temp.w4 = row.w4
  3440. var obj = {}
  3441. obj.pastureid = row.pastureid
  3442. obj.id = row.id
  3443. obj.data = []
  3444. if(this.oldRowList.w1 !== row.w1){
  3445. obj.data.push({'old':this.oldRowList.w1,'new':row.w1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  3446. }
  3447. if(this.oldRowList.w2 !== row.w2){
  3448. obj.data.push({'old':this.oldRowList.w2,'new':row.w2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  3449. }
  3450. if(this.oldRowList.w3 !== row.w3){
  3451. obj.data.push({'old':this.oldRowList.w3,'new':row.w3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  3452. }
  3453. if(this.oldRowList.bw1 !== row.bw1){
  3454. obj.data.push({'old':this.oldRowList.bw1,'new':row.bw1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  3455. }
  3456. if(this.oldRowList.bw2 !== row.bw2){
  3457. obj.data.push({'old':this.oldRowList.bw2,'new':row.bw2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  3458. }
  3459. if(this.oldRowList.bw3 !== row.bw3){
  3460. obj.data.push({'old':this.oldRowList.bw3,'new':row.bw3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  3461. }
  3462. if (this.table.temp.ccount == '' && this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  3463. this.$message({ type: 'error', message: '实际牛头数/系数/系数头数/配方模版不能为空', duration: 2000 })
  3464. return false
  3465. }
  3466. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  3467. this.$message({ type: 'error', message: '系数/系数头数/配方模版不能为空', duration: 2000 })
  3468. return false
  3469. }
  3470. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  3471. this.$message({ type: 'error', message: '系数头数/配方模版不能为空', duration: 2000 })
  3472. return false
  3473. }
  3474. console.log(this.table.temp.ccount, '实际牛头数不能为空')
  3475. if (this.table.temp.ccount === '') {
  3476. this.$message({ type: 'error', message: '实际牛头数不能为空', duration: 2000 })
  3477. return false
  3478. }
  3479. if (this.table.temp.ratio === '') {
  3480. this.$message({ type: 'error', message: '系数不能为空', duration: 2000 })
  3481. return false
  3482. }
  3483. if (this.table.temp.ccountratio === '') {
  3484. this.$message({ type: 'error', message: '系数头数不能为空', duration: 2000 })
  3485. return false
  3486. }
  3487. if (this.table.temp.ftid == '') {
  3488. this.$message({ type: 'error', message: '配方模版不能为空', duration: 2000 })
  3489. return false
  3490. }
  3491. const positiveInteger = /^[0-9]\d*$/
  3492. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  3493. this.$message({
  3494. type: 'error',
  3495. message: '实际牛头数请输入正整数',
  3496. duration: 2000
  3497. })
  3498. return false
  3499. }
  3500. this.isokDisable = true
  3501. setTimeout(() => {
  3502. this.isokDisable = false
  3503. }, 1000)
  3504. // this.requestParam.parammaps = this.table.temp
  3505. this.requestParam.common = {
  3506. 'returnmap': '0'
  3507. }
  3508. this.requestParam.data = []
  3509. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  3510. pastureid: row.pastureid,
  3511. id: row.id,
  3512. barname: row.barname,
  3513. barid: row.barid,
  3514. softccount: row.softccount,
  3515. ccount: row.ccount,
  3516. ratio: row.ratio,
  3517. ccountratio: row.ccountratio,
  3518. ftid: row.ftid,
  3519. ftname: row.ftname,
  3520. ptsfid: row.ptsfid,
  3521. ptsfname: row.ptsfname,
  3522. ftweight: row.ftweight,
  3523. supplyweight: row.supplyweight,
  3524. feedweight: row.feedweight,
  3525. owner: row.owner,
  3526. sumr: row.sumr
  3527. }}
  3528. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  3529. this.requestParam.data[1].children = []
  3530. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  3531. pastureid: '@insertSpotList.pastureid',
  3532. barname: row.barname,
  3533. barid: '@insertSpotList.barid',
  3534. times: '@insertSpotList.times',
  3535. tratio: '@insertSpotList.tratio',
  3536. weight: '@insertSpotList.weight',
  3537. cowcount: '@insertSpotList.cowcount',
  3538. ccountradio: row.ccountratio,
  3539. ptid: '@insertSpotList.ptid',
  3540. ptsid: '@insertSpotList.ptsid',
  3541. supplement: '@insertSpotList.supplement',
  3542. feedweight: row.feedweight,
  3543. supplyweight: row.supplyweight,
  3544. ratio: row.ratio
  3545. }}
  3546. this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  3547. pastureid: row.pastureid,
  3548. fpid: row.id
  3549. }}
  3550. ExecDataByConfig(this.requestParam).then(response => {
  3551. console.log('编辑保存发送参数', this.requestParam)
  3552. if (response.msg === 'fail') {
  3553. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3554. } else {
  3555. if(obj.data.length>0){
  3556. const url = 'authdata/fpdetail/edit'
  3557. const data = obj
  3558. postJson(url, data).then(response => {
  3559. if(response.msg !== 'fail'){
  3560. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3561. }
  3562. })
  3563. }else{
  3564. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3565. }
  3566. this.getList()
  3567. for (let i = 0; i < this.headerList.length; i++) {
  3568. if (this.headerList[i].target.className == 'el-icon-lock') {
  3569. this.headerList[i].target.className = 'el-icon-unlock'
  3570. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  3571. }
  3572. }
  3573. }
  3574. })
  3575. },
  3576. updateCancel(row) {
  3577. console.log('点击了编辑取消')
  3578. // 编辑false,不可编辑true
  3579. row.Edit = false
  3580. row.NoEdit = true
  3581. // 编辑true,编辑保存false
  3582. row.isUpdate = true
  3583. row.isUpdateSave = false
  3584. // this.reload()
  3585. for (let i = 0; i < this.headerList.length; i++) {
  3586. if (this.headerList[i].target.className == 'el-icon-lock') {
  3587. this.headerList[i].target.className = 'el-icon-unlock'
  3588. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  3589. }
  3590. }
  3591. console.log(this.table.getdataListParm.offset)
  3592. this.table.getdataListParm.offset = this.table.getdataListParm.offset
  3593. this.getList()
  3594. // this.$router.push('/formulationPlan/dhedFormula')
  3595. },
  3596. cellClick(row, column, event) {
  3597. console.log(column)
  3598. },
  3599. handleSelect(val) {
  3600. console.log('勾选数据', val)
  3601. this.selectList = val
  3602. },
  3603. // 营养评估
  3604. handleNutritional() {
  3605. console.log('点击了营养评估')
  3606. this.dialogFull = false
  3607. if (this.selectList.length !== 1) {
  3608. this.$message({ type: 'error', message: '请选择一条栏舍信息进行营养评估', duration: 2000 })
  3609. return false
  3610. } else {
  3611. console.log(this.nutritional.temp)
  3612. this.nutritional.dialogStatus = 'Nutritional'
  3613. this.nutritional.activeName = 'first'
  3614. this.nutritional.dialogFormVisible = true
  3615. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3616. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3617. this.getNutritionalList()
  3618. this.nutritional.tab1.list = []
  3619. }
  3620. },
  3621. tableRowClassName({ row }) {
  3622. // console.log(row)
  3623. if (row.isColor == '0') {
  3624. return 'red-row'
  3625. } else {
  3626. return ''
  3627. }
  3628. },
  3629. handleNutritionalTab(item) {
  3630. if (item == 'first ') {
  3631. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3632. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3633. this.getNutritionalList()
  3634. this.nutritional.tab1.list = []
  3635. } else {
  3636. console.log('牛群评估')
  3637. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3638. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3639. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3640. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3641. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3642. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3643. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3644. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3645. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3646. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3647. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3648. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3649. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3650. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3651. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3652. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3653. this.getTab2NutritionalList1()
  3654. this.getTab2NutritionalList2()
  3655. this.getTab2NutritionalList3()
  3656. this.getTab2NutritionalList4()
  3657. }
  3658. },
  3659. changeTab2Date() {
  3660. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3661. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3662. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3663. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3664. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3665. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3666. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3667. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3668. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3669. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3670. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3671. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3672. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3673. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3674. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  3675. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  3676. this.getTab2NutritionalList1()
  3677. this.getTab2NutritionalList2()
  3678. this.getTab2NutritionalList3()
  3679. this.getTab2NutritionalList4()
  3680. },
  3681. handleBefore() {
  3682. if (this.nutritional.activeName == 'first') {
  3683. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  3684. var start = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() - 1))
  3685. var stop = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() - 1))
  3686. this.nutritional.tab1.inputDatetime.length = 0
  3687. this.nutritional.tab1.inputDatetime.push(start, stop)
  3688. this.$forceUpdate()
  3689. }
  3690. } else {
  3691. var start2 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() - 1))
  3692. var stop2 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() - 1))
  3693. this.nutritional.tab2.inputDatetime.length = 0
  3694. this.nutritional.tab2.inputDatetime.push(start2, stop2)
  3695. this.$forceUpdate()
  3696. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3697. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3698. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3699. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3700. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3701. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3702. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3703. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3704. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3705. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3706. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3707. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3708. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3709. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3710. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3711. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3712. this.getTab2NutritionalList1()
  3713. this.getTab2NutritionalList2()
  3714. this.getTab2NutritionalList3()
  3715. this.getTab2NutritionalList4()
  3716. }
  3717. },
  3718. handleNext() {
  3719. if (this.nutritional.activeName == 'first') {
  3720. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  3721. console.log(this.nutritional.tab1.inputDatetime)
  3722. var start3 = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() + 1))
  3723. var stop3 = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() + 1))
  3724. this.nutritional.tab1.inputDatetime.length = 0
  3725. this.nutritional.tab1.inputDatetime.push(start3, stop3)
  3726. this.$forceUpdate()
  3727. }
  3728. } else {
  3729. var start4 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() + 1))
  3730. var stop4 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() + 1))
  3731. this.nutritional.tab2.inputDatetime.length = 0
  3732. this.nutritional.tab2.inputDatetime.push(start4, stop4)
  3733. this.$forceUpdate()
  3734. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  3735. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  3736. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3737. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3738. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3739. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3740. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3741. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3742. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3743. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3744. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3745. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3746. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  3747. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  3748. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  3749. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  3750. this.getTab2NutritionalList1()
  3751. this.getTab2NutritionalList2()
  3752. this.getTab2NutritionalList3()
  3753. this.getTab2NutritionalList4()
  3754. }
  3755. },
  3756. getNutritionalList() {
  3757. this.nutritional.tab1.listLoading1 = true
  3758. GetDataByName(this.nutritional.tab1.getdataListParm1).then(response => {
  3759. console.log('评估上方数据', response.data.list)
  3760. if (response.data.list !== null) {
  3761. response.data.list[0].cowclassid = String(response.data.list[0].cowclassid)
  3762. this.nutritional.tab1.temp = response.data.list[0]
  3763. this.nutritional.tab1.disabledCowclass = true
  3764. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  3765. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  3766. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  3767. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  3768. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  3769. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  3770. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  3771. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  3772. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  3773. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  3774. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  3775. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  3776. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  3777. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  3778. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  3779. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  3780. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  3781. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  3782. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  3783. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  3784. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  3785. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  3786. this.getNutritionalList2()
  3787. } else {
  3788. this.nutritional.tab1.temp = []
  3789. this.nutritional.tab1.disabledCowclass = false
  3790. }
  3791. setTimeout(() => {
  3792. this.nutritional.tab1.listLoading = false
  3793. }, 100)
  3794. })
  3795. },
  3796. assessmentData() {
  3797. console.log('评估保存')
  3798. this.$refs['temp'].validate(valid => {
  3799. if (valid) {
  3800. if (this.nutritional.tab1.inputDatetime == '' || this.nutritional.tab1.inputDatetime == null) {
  3801. this.$message({ type: 'error', message: '开始日期结束日期不能为空', duration: 2000 })
  3802. return false
  3803. } else {
  3804. // 牛头数
  3805. const positiveInteger = /^[1-9]\d*$/
  3806. if (this.nutritional.tab1.temp.cowsum !== '') {
  3807. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.cowsum))) {
  3808. this.$message({ type: 'error', message: '牛头数请输入正整数', duration: 2000 })
  3809. return false
  3810. }
  3811. }
  3812. const twoDecimalPlaces = /^\d+(\.\d{1,2})?$/
  3813. // 温度环境
  3814. if (this.nutritional.tab1.temp.tem !== '') {
  3815. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.tem))) {
  3816. this.$message({ type: 'error', message: '温度环境请保留两位小数', duration: 2000 })
  3817. return false
  3818. }
  3819. }
  3820. // 平均月龄
  3821. if (this.nutritional.tab1.temp.avgmonthage !== '') {
  3822. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.avgmonthage))) {
  3823. this.$message({ type: 'error', message: '平均月龄请保留两位小数', duration: 2000 })
  3824. return false
  3825. }
  3826. }
  3827. // 体重
  3828. if (this.nutritional.tab1.temp.bw !== '') {
  3829. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.bw))) {
  3830. this.$message({ type: 'error', message: '体重请保留两位小数', duration: 2000 })
  3831. return false
  3832. }
  3833. }
  3834. // 日增重
  3835. if (this.nutritional.tab1.temp.dayw !== '') {
  3836. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.dayw))) {
  3837. this.$message({ type: 'error', message: '日增重请保留两位小数', duration: 2000 })
  3838. return false
  3839. }
  3840. }
  3841. const dayspre = /^(([1-9]|([1-9]\d)|(1\d\d)|(2([0-7]\d|7[0-9]))))$/
  3842. // 怀孕天数
  3843. if (this.nutritional.tab1.temp.dayspre !== '') {
  3844. if (!dayspre.test(parseFloat(this.nutritional.tab1.temp.dayspre))) {
  3845. this.$message({ type: 'error', message: '怀孕天数请输入大于0小于280整数', duration: 2000 })
  3846. return false
  3847. }
  3848. }
  3849. const fetal = /^(?:[1-9]|1[0-9])$/
  3850. // 胎次
  3851. if (this.nutritional.tab1.temp.fetal !== '') {
  3852. if (!fetal.test(parseFloat(this.nutritional.tab1.temp.fetal))) {
  3853. this.$message({ type: 'error', message: '胎次请输入大于0小于20整数', duration: 2000 })
  3854. return false
  3855. }
  3856. }
  3857. // 平均泌乳
  3858. if (this.nutritional.tab1.temp.avgdim !== '') {
  3859. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.avgdim))) {
  3860. this.$message({ type: 'error', message: '平均泌乳天数请输入正整数', duration: 2000 })
  3861. return false
  3862. }
  3863. }
  3864. // 产奶量
  3865. if (this.nutritional.tab1.temp.product !== '') {
  3866. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.product))) {
  3867. this.$message({ type: 'error', message: '产奶量请保留两位小数', duration: 2000 })
  3868. return false
  3869. }
  3870. }
  3871. // 乳脂率
  3872. if (this.nutritional.tab1.temp.fat !== '') {
  3873. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.fat))) {
  3874. this.$message({ type: 'error', message: '乳脂率请保留两位小数', duration: 2000 })
  3875. return false
  3876. }
  3877. }
  3878. // 乳蛋白率
  3879. if (this.nutritional.tab1.temp.pro !== '') {
  3880. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.pro))) {
  3881. this.$message({ type: 'error', message: '乳蛋白率请保留两位小数', duration: 2000 })
  3882. return false
  3883. }
  3884. }
  3885. // 乳糖率
  3886. if (this.nutritional.tab1.temp.lactose !== '') {
  3887. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.lactose))) {
  3888. this.$message({ type: 'error', message: '乳糖率请保留两位小数', duration: 2000 })
  3889. return false
  3890. }
  3891. }
  3892. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  3893. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  3894. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  3895. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  3896. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  3897. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  3898. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  3899. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  3900. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  3901. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  3902. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  3903. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  3904. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  3905. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  3906. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  3907. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  3908. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  3909. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  3910. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  3911. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  3912. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  3913. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  3914. this.getNutritionalList2()
  3915. }
  3916. }
  3917. })
  3918. },
  3919. getNutritionalList2() {
  3920. this.nutritional.tab1.listLoading2 = true
  3921. const url = 'authdata/GETNurJudge'
  3922. const data = this.nutritional.tab1.getdataListParm2
  3923. postJson(url, data).then(response => {
  3924. if (response.msg !== 'fail') {
  3925. if (response.data.list !== null) {
  3926. for (let i = 0; i < response.data.length; i++) {
  3927. if (response.data[i].cowneed == null) {
  3928. response.data[i].cowneed = ''
  3929. }
  3930. var reg = RegExp(/>/)
  3931. var reg2 = RegExp(/</)
  3932. var reg3 = RegExp(/-/)
  3933. if (reg.test(response.data[i].cowneed) == true) {
  3934. const cowneed = response.data[i].cowneed.split('>')[1]
  3935. if ((parseFloat(response.data[i].ftpro) < parseFloat(cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(cowneed)) {
  3936. this.$set(response.data[i], 'isColor', '0')
  3937. } else {
  3938. this.$set(response.data[i], 'isColor', '')
  3939. }
  3940. } else if (reg2.test(response.data[i].cowneed) == true) {
  3941. const cowneed2 = response.data[i].cowneed.split('<')[1]
  3942. if ((parseFloat(response.data[i].ftpro) > parseFloat(cowneed2)) || (parseFloat(response.data[i].hprov) > parseFloat(cowneed2)) || parseFloat(response.data[i].sprov) > parseFloat(cowneed2)) {
  3943. this.$set(response.data[i], 'isColor', '0')
  3944. } else {
  3945. this.$set(response.data[i], 'isColor', '')
  3946. }
  3947. } else if (reg3.test(response.data[i].cowneed) == true) {
  3948. response.data[i].cowneed = String(response.data[i].cowneed)
  3949. if (response.data[i].cowneed.length == 1) {
  3950. const cowneed3 = response.data[i].cowneed.split('-')
  3951. console.log(cowneed3, 'cowneed3')
  3952. if (parseFloat(response.data[i].ftpro) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].ftpro) < parseFloat(cowneed3[1])) {
  3953. this.$set(response.data[i], 'isColor', '')
  3954. } else if (parseFloat(response.data[i].hprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].hprov) < parseFloat(cowneed3[1])) {
  3955. this.$set(response.data[i], 'isColor', '')
  3956. } else if (parseFloat(response.data[i].sprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].sprov) < parseFloat(cowneed3[1])) {
  3957. this.$set(response.data[i], 'isColor', '')
  3958. } else if (cowneed3[0] == '' && cowneed3[0] == '') {
  3959. this.$set(response.data[i], 'isColor', '')
  3960. } else {
  3961. this.$set(response.data[i], 'isColor', '0')
  3962. }
  3963. } else {
  3964. if ((parseFloat(response.data[i].ftpro) < parseFloat(response.data[i].cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(response.data[i].cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(response.data[i].cowneed)) {
  3965. this.$set(response.data[i], 'isColor', '0')
  3966. } else {
  3967. this.$set(response.data[i], 'isColor', '')
  3968. }
  3969. }
  3970. } else {
  3971. response.data[i].cowneed = String(response.data[i].cowneed)
  3972. if (response.data[i].cowneed[0] !== '-') {
  3973. if ((parseFloat(response.data[i].ftpro) < parseFloat(response.data[i].cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(response.data[i].cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(response.data[i].cowneed)) {
  3974. this.$set(response.data[i], 'isColor', '0')
  3975. } else {
  3976. this.$set(response.data[i], 'isColor', '')
  3977. }
  3978. } else {
  3979. this.$set(response.data[i], 'isColor', '')
  3980. }
  3981. }
  3982. }
  3983. console.log(response.data)
  3984. console.log('评估下方数据', response.data)
  3985. this.nutritional.tab1.list = response.data
  3986. this.nutritional.tab1.total = response.data.total
  3987. } else {
  3988. this.nutritional.tab1.list = []
  3989. }
  3990. } else {
  3991. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  3992. }
  3993. setTimeout(() => {
  3994. this.nutritional.tab1.listLoading2 = false
  3995. }, 100)
  3996. })
  3997. },
  3998. // 牛群评估
  3999. getTab2NutritionalList1() {
  4000. this.nutritional.tab2.listLoading1 = true
  4001. GetDataByName(this.nutritional.tab2.getdataListParm1).then(response => {
  4002. console.log('宾州筛分析', response.data.list)
  4003. if (response.data.list !== null) {
  4004. this.nutritional.tab2.list1 = response.data.list
  4005. this.nutritional.tab2.pageNum1 = response.data.pageNum
  4006. this.nutritional.tab2.pageSize1 = response.data.pageSize
  4007. this.nutritional.tab2.total1 = response.data.total
  4008. } else {
  4009. this.nutritional.tab2.list1 = []
  4010. }
  4011. setTimeout(() => {
  4012. this.nutritional.tab2.listLoading1 = false
  4013. }, 100)
  4014. })
  4015. },
  4016. getTab2NutritionalList2() {
  4017. this.nutritional.tab2.listLoading2 = true
  4018. GetDataByName(this.nutritional.tab2.getdataListParm2).then(response => {
  4019. console.log('粪便筛分析', response.data.list)
  4020. if (response.data.list !== null) {
  4021. this.nutritional.tab2.list2 = response.data.list
  4022. this.nutritional.tab2.pageNum2 = response.data.pageNum
  4023. this.nutritional.tab2.pageSize2 = response.data.pageSize
  4024. this.nutritional.tab2.total2 = response.data.total
  4025. } else {
  4026. this.nutritional.tab2.list2 = []
  4027. }
  4028. setTimeout(() => {
  4029. this.nutritional.tab2.listLoading2 = false
  4030. }, 100)
  4031. })
  4032. },
  4033. getTab2NutritionalList3() {
  4034. this.nutritional.tab2.listLoading3 = true
  4035. GetDataByName(this.nutritional.tab2.getdataListParm3).then(response => {
  4036. console.log('BCS评分', response.data.list)
  4037. if (response.data.list !== null) {
  4038. for (let i = 0; i < response.data.list.length; i++) {
  4039. this.$set(response.data.list[i], 'score25rate', (parseFloat(response.data.list[i].score25) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4040. this.$set(response.data.list[i], 'score275rate', (parseFloat(response.data.list[i].score275) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4041. this.$set(response.data.list[i], 'score3rate', (parseFloat(response.data.list[i].score3) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4042. this.$set(response.data.list[i], 'score325rate', (parseFloat(response.data.list[i].score325) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4043. this.$set(response.data.list[i], 'score35rate', (parseFloat(response.data.list[i].score35) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4044. this.$set(response.data.list[i], 'score375rate', (parseFloat(response.data.list[i].score375) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4045. this.$set(response.data.list[i], 'score4rate', (100 - response.data.list[i].score25rate - response.data.list[i].score275rate - response.data.list[i].score3rate - response.data.list[i].score325rate - response.data.list[i].score35rate - response.data.list[i].score375rate).toFixed(parseInt(Cookies.get('decimal'))))
  4046. }
  4047. this.nutritional.tab2.list3 = response.data.list
  4048. this.nutritional.tab2.pageNum3 = response.data.pageNum
  4049. this.nutritional.tab2.pageSize3 = response.data.pageSize
  4050. this.nutritional.tab2.total3 = response.data.total
  4051. } else {
  4052. this.nutritional.tab2.list3 = []
  4053. }
  4054. setTimeout(() => {
  4055. this.nutritional.tab2.listLoading3 = false
  4056. }, 100)
  4057. })
  4058. },
  4059. getTab2NutritionalList4() {
  4060. this.nutritional.tab2.listLoading4 = true
  4061. GetDataByName(this.nutritional.tab2.getdataListParm4).then(response => {
  4062. console.log('粪便评分', response.data.list)
  4063. if (response.data.list !== null) {
  4064. for (let i = 0; i < response.data.list.length; i++) {
  4065. this.$set(response.data.list[i], 'score1rate', (parseFloat(response.data.list[i].score1) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4066. this.$set(response.data.list[i], 'score2rate', (parseFloat(response.data.list[i].score2) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4067. this.$set(response.data.list[i], 'score3rate', (parseFloat(response.data.list[i].score3) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4068. this.$set(response.data.list[i], 'score4rate', (parseFloat(response.data.list[i].score4) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  4069. this.$set(response.data.list[i], 'score5rate', (100 - response.data.list[i].score1rate - response.data.list[i].score2rate - response.data.list[i].score3rate - response.data.list[i].score4rate).toFixed(parseInt(Cookies.get('decimal'))))
  4070. }
  4071. this.nutritional.tab2.list4 = response.data.list
  4072. this.nutritional.tab2.pageNum4 = response.data.pageNum
  4073. this.nutritional.tab2.pageSize4 = response.data.pageSize
  4074. this.nutritional.tab2.total4 = response.data.total
  4075. } else {
  4076. this.nutritional.tab2.list4 = []
  4077. }
  4078. setTimeout(() => {
  4079. this.nutritional.tab2.listLoading4 = false
  4080. }, 100)
  4081. })
  4082. },
  4083. getHistoryIsDisplay() {
  4084. GetDataByName(this.table.getdataListParm2).then(response => {
  4085. console.log(response.data.list[0].inforvalue)
  4086. if (response.data.list !== null) {
  4087. if (response.data.list[0].inforvalue == 0) {
  4088. this.table.isPtsfname = false
  4089. } else {
  4090. this.table.isPtsfname = true
  4091. }
  4092. }
  4093. })
  4094. GetDataByName(this.table.getdataListParm3).then(response => {
  4095. if (response.data.list !== null) {
  4096. if (response.data.list[0].inforvalue == 1) {
  4097. this.history.isRW1 = true
  4098. this.history.isRW2 = false
  4099. this.history.isRW3 = false
  4100. this.history.isRW4 = false
  4101. } else if (response.data.list[0].inforvalue == 2) {
  4102. this.history.isRW1 = true
  4103. this.history.isRW2 = true
  4104. this.history.isRW3 = false
  4105. this.history.isRW4 = false
  4106. } else if (response.data.list[0].inforvalue == 3) {
  4107. this.history.isRW1 = true
  4108. this.history.isRW2 = true
  4109. this.history.isRW3 = true
  4110. this.history.isRW4 = false
  4111. } else if (response.data.list[0].inforvalue == 4) {
  4112. this.history.isRW1 = true
  4113. this.history.isRW2 = true
  4114. this.history.isRW3 = true
  4115. this.history.isRW4 = true
  4116. }
  4117. } else {
  4118. this.history.isRW1 = false
  4119. this.history.isRW2 = false
  4120. this.history.isRW3 = false
  4121. this.history.isRW4 = false
  4122. }
  4123. })
  4124. this.getHistoryList()
  4125. },
  4126. getHistoryList() {
  4127. this.history.listLoading = true
  4128. GetDataByName(this.history.getdataListParm).then(response => {
  4129. console.log('table数据', response.data.list)
  4130. if (response.data.list !== null) {
  4131. console.log('table数据', response.data.list)
  4132. for (let i = 0; i < response.data.list.length; i++) {
  4133. if (response.data.list[i].ptid == undefined || response.data.list[i].ptname == '') {
  4134. this.$set(response.data.list[i], 'ptid', '')
  4135. this.$set(response.data.list[i], 'ptname', '')
  4136. }
  4137. }
  4138. this.history.list = response.data.list
  4139. this.handleSpan()
  4140. this.history.pageNum = response.data.pageNum
  4141. this.history.pageSize = response.data.pageSize
  4142. this.history.total = response.data.total
  4143. } else {
  4144. this.history.list = []
  4145. }
  4146. setTimeout(() => {
  4147. this.history.listLoading = false
  4148. }, 100)
  4149. })
  4150. },
  4151. handleSpan() {
  4152. this.mergekeys.forEach(key => {
  4153. this.spanObj[key] = []
  4154. let position = 0
  4155. this.history.list.forEach((item, index) => {
  4156. if (index === 0) {
  4157. this.spanObj[key].push(1)
  4158. position = 0
  4159. } else {
  4160. if (key == 'sumweight') {
  4161. if (this.history.list[index][key] === this.history.list[index - 1][key] && this.history.list[index]['barname'] === this.history.list[index - 1]['barname']) {
  4162. this.spanObj[key][position] += 1
  4163. this.spanObj[key].push(0)
  4164. } else {
  4165. this.spanObj[key].push(1)
  4166. position = index
  4167. }
  4168. } else {
  4169. if (this.history.list[index][key] === this.history.list[index - 1][key]) {
  4170. this.spanObj[key][position] += 1
  4171. this.spanObj[key].push(0)
  4172. } else {
  4173. this.spanObj[key].push(1)
  4174. position = index
  4175. }
  4176. }
  4177. }
  4178. })
  4179. })
  4180. },
  4181. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  4182. for (let i = 0; i < this.mergekeys.length; i++) {
  4183. if (column.property === this.mergekeys[i]) {
  4184. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  4185. const _col = _row > 0 ? 1 : 0
  4186. return {
  4187. rowspan: _row,
  4188. colspan: _col
  4189. }
  4190. }
  4191. }
  4192. },
  4193. changeDate() {
  4194. this.getHistoryList()
  4195. },
  4196. // 应用
  4197. handleApplication() {
  4198. console.log('点击了应用')
  4199. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  4200. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  4201. }).then(() => {
  4202. this.requestParam.name = 'applyFPdate'
  4203. this.requestParam.parammaps = {}
  4204. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  4205. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  4206. PostDataByName(this.requestParam).then(response => {
  4207. if (response.msg === 'fail') {
  4208. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  4209. } else {
  4210. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  4211. this.getHistoryIsDisplay()
  4212. this.getList()
  4213. }
  4214. })
  4215. }).catch(() => {
  4216. this.$message({ type: 'info', message: '已取消应用' })
  4217. })
  4218. },
  4219. formatJson(filterVal, jsonData) {
  4220. return jsonData.map(v =>
  4221. filterVal.map(j => {
  4222. if (j === 'timestamp') {
  4223. return parseTime(v[j])
  4224. } else {
  4225. return v[j]
  4226. }
  4227. })
  4228. )
  4229. },
  4230. blurBw(row) {
  4231. console.log(row)
  4232. },
  4233. focusBw(row) {
  4234. console.log(row)
  4235. }
  4236. }
  4237. }
  4238. </script>
  4239. <style lang="scss" scoped>
  4240. .search {
  4241. clear: both;
  4242. }
  4243. .table {
  4244. margin-top: 10px;
  4245. }
  4246. </style>
  4247. <style lang="scss">
  4248. .red-row{
  4249. background: #fde2e2 !important;
  4250. }
  4251. </style>