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