7434499a6c7bf4add4ef51baac59508d5b1d0d4b.svn-base 162 KB

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