index.vue 168 KB

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