index.vue 177 KB

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