c461608d77ce4a47847c6954381fd0f867a693a6.svn-base 167 KB

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