index.vue 163 KB

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