index.vue 167 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488
  1. <template>
  2. <div ref="appContainer" class="app-container">
  3. <div ref="myContainer" class="myContainer">
  4. <!-- 配方模板表 -->
  5. <div ref="template" class="template">
  6. <div class="recipeTemplate">
  7. <p>{{$t('formulationEvaluation.pfmbb')}}</p>
  8. </div>
  9. <div class="search">
  10. <el-select v-model="table.getdataListParm.parammaps.ccname" filterable :placeholder="$t('feedingEfficiency.cxlb')" class="filter-item" clearable>
  11. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />
  12. </el-select>
  13. <el-select v-model="table.getdataListParm.parammaps.fttype" filterable :placeholder="$t('formulationEvaluation.pflx')" class="filter-item" style="width: 120px;" clearable>
  14. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />
  15. </el-select>
  16. <el-select v-model="table.getdataListParm.parammaps.source" filterable :placeholder="$t('formulationEvaluation.ly')" class="filter-item" style="width: 120px;" clearable>
  17. <el-option v-for="item in sourceList" :key="item.id" :label="item.name" :value="item.id" />
  18. </el-select>
  19. <el-select v-model="table.getdataListParm.parammaps.enable" filterable :placeholder="$t('formulationEvaluation.sfqy')" class="filter-item" style="width: 120px;" clearable>
  20. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  21. </el-select>
  22. <div ref="selectInput" class="filter-item selectInput">
  23. <el-input v-model="table.getdataListParm.parammaps.all" type="text" :placeholder="$t('driver.xzsstj')" class="Input" />
  24. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  25. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  26. <ul v-if="arrowUp" class="selectUl">
  27. <li><a>{{$t('formulationEvaluation.pfmc')}}</a><el-input v-model="table.getdataListParm.parammaps.tname" clearable style="width: 245px;" /></li>
  28. <li><a>{{$t('formulationEvaluation.remark')}}</a><el-input v-model="table.getdataListParm.parammaps.remark" clearable style="width: 245px;" /></li>
  29. <li />
  30. <!-- <li><a>{{$t('formulationEvaluation.ly')}}</a><el-input v-model="table.getdataListParm.parammaps.source" clearable style="width: 245px;" /></li> -->
  31. <li>
  32. <div style="float: right;">
  33. <el-button class="downminCancel" @click="arrowUp=false;arrowDown=true;">{{$t('formulationEvaluation.cancel')}}</el-button>
  34. <el-button class="miniPrimary" @click="form_search">{{$t('formulationEvaluation.search')}}</el-button>
  35. </div>
  36. </li>
  37. </ul>
  38. </div>
  39. <el-button class="successBorder" @click="form_search">{{$t('common.query')}}</el-button>
  40. <el-button class="successBorder" @click="handleRefresh">{{$t('common.reset')}}</el-button>
  41. </div>
  42. <div class="operation">
  43. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">{{$t('formulationEvaluation.add')}}</el-button>
  44. <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd">{{$t('formulationEvaluation.pfsc')}}</el-button>
  45. <el-upload style="float: right;margin-right: 15px;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
  46. <el-button v-if="isRoleEdit" class="export" icon="el-icon-download" style="float: right;">{{$t('formulationEvaluation.enter')}}</el-button>
  47. </el-upload>
  48. <el-dropdown style="float: right;">
  49. <el-button class="export" icon="el-icon-upload2">{{$t('formulationEvaluation.out')}}</el-button>
  50. <el-dropdown-menu slot="dropdown">
  51. <el-dropdown-item @click.native="handleExport(1)">{{$t('formulationEvaluation.outmb')}}</el-dropdown-item>
  52. <el-dropdown-item @click.native="handleExport(2)">{{$t('formulationEvaluation.outsj')}}</el-dropdown-item>
  53. </el-dropdown-menu>
  54. </el-dropdown>
  55. <el-button class="export" style="float: right;" @click="handleRecipeRecord">{{$t('formulationEvaluation.pfjl')}}</el-button>
  56. </div>
  57. <div ref="table" class="table">
  58. <el-table
  59. :key="table.tableKey"
  60. v-loading="table.listLoading"
  61. element-loading-text="给我一点时间"
  62. :data="table.list"
  63. border
  64. fit
  65. highlight-current-row
  66. style="width: 98%;"
  67. :row-style="rowStyle"
  68. :cell-style="cellStyle"
  69. class="elTable table-fixed"
  70. :height="myheight"
  71. @row-click="tableRowClick"
  72. @selection-change="handleSelectionChange"
  73. >
  74. <el-table-column type="selection" align="center" width="50" />
  75. <el-table-column :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px" />
  76. <el-table-column :label="$t('errorAnalysis.feedName')" min-width="90px" align="center">
  77. <template slot-scope="scope">
  78. <span v-if="scope.row.NoEdit">{{ scope.row.tname }}</span>
  79. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.tname" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:98%;padding:10px 0;" />
  80. </template>
  81. </el-table-column>
  82. <el-table-column :label="$t('formulationEvaluation.pfbm')" min-width="110px" align="center">
  83. <template slot-scope="scope">
  84. <span v-if="scope.row.NoEdit">{{ scope.row.tcode }}</span>
  85. <!-- <el-input v-if="scope.row.Edit" v-model.trim="scope.row.tcode" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:98%;padding:10px 0;" /> -->
  86. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.tcode" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" disabled maxlength="32" style="width:98%;padding:10px 0;" />
  87. </template>
  88. </el-table-column>
  89. <el-table-column :label="$t('formulationEvaluation.rl')" min-width="110px" align="center">
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.NoEdit">{{ scope.row.volume }}</span>
  92. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.volume" type="number" style="width:98%;padding:10px 0;" />
  93. </template>
  94. </el-table-column>
  95. <el-table-column :label="$t('formulationEvaluation.pfys')" min-width="70px" align="center">
  96. <template slot-scope="scope">
  97. <el-color-picker v-model="scope.row.tcolor" size="mini" :predefine="predefineColors" style="vertical-align: middle;" :disabled="scope.row.NoEdit" />
  98. </template>
  99. </el-table-column>
  100. <el-table-column :label="$t('errorAnalysis.sxlb')" min-width="130px" align="center">
  101. <template slot-scope="scope">
  102. <span v-if="scope.row.NoEdit">{{ scope.row.ccname }}</span>
  103. <el-select v-if="scope.row.Edit" v-model="scope.row.ccid" filterable :placeholder="$t('feedingEfficiency.cxlb')" class="filter-item" style="width:95%;padding:10px 0;" @change="changeLivestockType">
  104. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />
  105. </el-select>
  106. </template>
  107. </el-table-column>
  108. <el-table-column :label="$t('formulationEvaluation.pflx')" min-width="130px" align="center">
  109. <template slot-scope="scope">
  110. <span v-if="scope.row.NoEdit">{{ scope.row.fttype }}</span>
  111. <el-select v-if="scope.row.Edit && scope.row.isCreate == true" v-model="scope.row.fttypeid" filterable :placeholder="$t('formulationEvaluation.pflx')" class="filter-item" style="width:95%;padding:10px 0;" @change="changeFormulaType">
  112. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />
  113. </el-select>
  114. <el-select v-if="scope.row.Edit && scope.row.isUpdateSave == true" v-model="scope.row.fttypeid" disabled filterable :placeholder="$t('formulationEvaluation.pflx')" class="filter-item" style="width:95%;padding:10px 0;" @change="changeFormulaType">
  115. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />
  116. </el-select>
  117. </template>
  118. </el-table-column>
  119. <el-table-column :label="$t('formulationEvaluation.ly')" min-width="90px" align="center">
  120. <template slot-scope="scope">
  121. <span>{{ scope.row.source }}</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column :label="$t('formulationEvaluation.remark')" min-width="90px" align="center">
  125. <template slot-scope="scope">
  126. <span v-if="scope.row.NoEdit">{{ scope.row.remark }}</span>
  127. <el-input v-if="scope.row.Edit" v-model="scope.row.remark" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="255" style="width:95%;padding:10px 0;" />
  128. </template>
  129. </el-table-column>
  130. <el-table-column :label="$t('formulationEvaluation.bbh')" min-width="90px" align="center">
  131. <template slot-scope="scope">
  132. <span>{{ scope.row.version }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column :label="$t('formulationEvaluation.nqlb')" min-width="130px" align="center">
  136. <template slot-scope="scope">
  137. <span v-if="scope.row.NoEdit">{{ scope.row.cattleName }}</span>
  138. <el-select v-if="scope.row.Edit" v-model="scope.row.cattle" filterable :placeholder="$t('formulationEvaluation.nqlb')" class="filter-item" style="width:95%;padding:10px 0;">
  139. <el-option v-for="item in distCattle" :key="item.value" :label="item.distName" :value="item.distCode" />
  140. </el-select>
  141. </template>
  142. </el-table-column>
  143. <el-table-column :label="$t('formulationEvaluation.sfqy')" min-width="90px" align="center">
  144. <template slot-scope="scope">
  145. <el-switch v-model="scope.row.enable" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.$index, scope.row)" />
  146. </template>
  147. </el-table-column>
  148. <el-table-column :label="$t('formulationEvaluation.tzzly')" min-width="85px" align="center">
  149. <template slot-scope="scope">
  150. <span v-if="scope.row.NoEdit">{{ scope.row.autozone }}</span>
  151. <el-input v-if="scope.row.Edit" v-model="scope.row.autozone" type="textarea" :disabled="scope.row.fttype !=='预混配方'" :autosize="{ minRows: 1.3, maxRows: 4}" style="width:95%;padding:10px 0;" />
  152. </template>
  153. </el-table-column>
  154. <el-table-column :label="$t('errorAnalysis.cz')" align="center" width="150" class-name="small-padding fixed-width" fixed="right">
  155. <template slot-scope="{row}">
  156. <el-button v-if="row.NoEdit && isRoleEdit && ispastureuse==0" icon="el-icon-tickets" class="miniSuccess" @click="handleRowRecipeRecord(row)" />
  157. <span v-if="row.NoEdit && isRoleEdit && ispastureuse ==0" icon="el-icon-data-line" class="centerSpan">|</span>
  158. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData(row)" />
  159. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  160. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel(row)" />
  161. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="row.is_modify !== 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  162. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  163. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  164. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  165. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  166. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  167. <span v-if="row.NoEdit && isRoleEdit && ispastureuse ==0" icon="el-icon-data-line" class="centerSpan">|</span>
  168. <el-button v-if="row.NoEdit && isRoleEdit && ispastureuse==0" icon="el-icon-data-line" class="miniSuccess" @click="handleFormulationEvaluation(row)" />
  169. </template>
  170. </el-table-column>
  171. </el-table>
  172. </div>
  173. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;margin-bottom: 10px;font-size: 14px;">{{$t('processAnalysis.total')}}{{ table.total }}{{$t('processAnalysis.tiao')}}</span>
  174. </div>
  175. <!-- 配方详情表 -->
  176. <div v-if="isDetail" ref="detail" class="detail">
  177. <div class="recipeTemplate">
  178. <p>{{$t('formulationEvaluation.pfbqb')}}</p>
  179. </div>
  180. <div style="line-height: 25px;border-bottom: 1px solid #000;margin-bottom: 10px;font-size:16px; font-weight: 600;">
  181. <span :style="{color: table2.getdataListParm.parammaps.tcolor}">{{$t('formulationEvaluation.pfmc')}} : {{table2.getdataListParm.parammaps.tname }}</span><span style="margin: 0 60px;">{{$t('formulationEvaluation.cclx')}}{{table2.getdataListParm.parammaps.ccname}}</span><span>{{$t('formulationEvaluation.pflx')}}:{{table2.getdataListParm.parammaps.fttype}}</span>
  182. </div>
  183. <div class="operation">
  184. <el-button v-if="isRoleEdit" style="float: left;" icon="el-icon-plus" class="success" @click="handleCreate2">{{$t('formulationEvaluation.add')}}</el-button>
  185. <el-button v-if="isRoleEdit" style="float: left;" icon="el-icon-delete" class="danger" @click="form_delete2">{{$t('formulationEvaluation.del')}}</el-button>
  186. <el-button v-if="isRoleEdit" style="float: left;" class="success" icon="el-icon-takeaway-box" @click="handleSyntheticPremix">{{$t('formulationEvaluation.hcyhl')}}</el-button>
  187. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" style="float: left;" class="success" @click="handleChangeOrder">{{$t('formulationEvaluation.ggsx')}}</el-button>
  188. <div v-else style="float: left;margin-left: 10px;">
  189. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">{{$t('formulationEvaluation.save')}}</el-button>
  190. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">{{$t('formulationEvaluation.cancel')}}</el-button>
  191. </div>
  192. <div ref="selectInput2" class="filter-item selectInput" style="margin: 0 10px;">
  193. <el-input v-model="table2.getdataListParm.parammaps.all" type="text" name="" value="" :placeholder="$t('driver.xzsstj')" class="Input" />
  194. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  195. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  196. <ul v-if="arrowUp2" class="selectUl">
  197. <li>
  198. <a style="width: 130px;">{{$t('formulationEvaluation.slmc')}}</a>
  199. <el-select v-model="table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:190px;">
  200. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />
  201. </el-select>
  202. </li>
  203. <li><a style="width: 130px;">{{$t('formulationEvaluation.slzmc')}}</a><el-input v-model="table2.getdataListParm.parammaps.feedgroup" style="width: 190px;" /></li>
  204. <li><a style="width: 130px;">{{$t('formulationEvaluation.reset')}}</a><el-input v-model="table2.getdataListParm.parammaps.fweight" style="width: 190px;" /></li>
  205. <li>
  206. <a style="width: 130px;">{{$t('formulationEvaluation.jbys')}}</a>
  207. <el-select v-model="table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:190px;" clearable>
  208. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />
  209. </el-select>
  210. </li>
  211. <li>
  212. <a style="width: 130px;">{{$t('formulationEvaluation.sfsdntbs')}}</a>
  213. <el-select v-model="table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:190px;" clearable>
  214. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  215. </el-select>
  216. </li>
  217. <li><a style="width: 130px;">{{$t('formulationEvaluation.sort')}}</a><el-input v-model="table2.getdataListParm.parammaps.sort" style="width: 190px;" /></li>
  218. <li>
  219. <div style="float: right;">
  220. <el-button class="downminCancel" @click="arrowUp2=false;arrowDown2=true;">{{$t('formulationEvaluation.cancel')}}</el-button>
  221. <el-button class="miniPrimary" @click="form_search2">{{$t('formulationEvaluation.search')}}</el-button>
  222. </div>
  223. </li>
  224. </ul>
  225. </div>
  226. <el-button class="successBorder" @click="form_search2">{{$t('common.query')}}</el-button>
  227. <el-button class="successBorder" @click="handleRefresh2">{{$t('common.reset')}}</el-button>
  228. <el-button class="hide" @click="handleCloseTable2">{{$t('formulationEvaluation.hide')}}</el-button>
  229. <el-button v-if="isEnlarge" class="hide2" @click="handleEnlarge">{{$t('formulationEvaluation.fd')}}</el-button>
  230. <el-button v-else class="hide2" @click="handleNarrow">{{$t('formulationEvaluation.sx')}}</el-button>
  231. </div>
  232. <div v-if="isEnlarge" class="table2">
  233. <el-table
  234. id="table2"
  235. ref="table2"
  236. :key="table2.tableKey"
  237. v-loading="table2.listLoading"
  238. element-loading-text="给我一点时间"
  239. :data="table2.list"
  240. border
  241. fit
  242. highlight-current-row
  243. style="width: 98%;"
  244. :row-style="rowStyle"
  245. :cell-style="cellStyle"
  246. class="elTable"
  247. row-key="id"
  248. show-summary
  249. :max-height="220"
  250. :summary-method="getSummaries"
  251. @selection-change="handleSelectionChange2"
  252. @cell-dblclick="celldblclick"
  253. >
  254. <el-table-column type="selection" width="50" />
  255. <el-table-column :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px" />
  256. <el-table-column :label="$t('formulationEvaluation.slz')" min-width="120px" align="center">
  257. <template slot-scope="scope">
  258. <span v-if="scope.row.groupNoEdit">{{ scope.row.feedgroup }}</span>
  259. <el-input v-if="scope.row.groupEdit" v-model="scope.row.feedgroup" :disabled="scope.row.isGroupDisabled" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" />
  260. </template>
  261. </el-table-column>
  262. <el-table-column :label="$t('InventoryManagement.silc')" min-width="120px" align="center">
  263. <template slot-scope="scope">
  264. <span v-if="scope.row.NoEdit">{{ scope.row.fname }}</span>
  265. <el-select v-if="scope.row.Edit" v-model="scope.row.fid" filterable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeFname(value, scope.row)}">
  266. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.id" />
  267. </el-select>
  268. </template>
  269. </el-table-column>
  270. <el-table-column :label="$t('formulationEvaluation.reset1')" prop="fweight" width="120px" align="center">
  271. <template slot-scope="scope">
  272. <span v-if="scope.row.NoEdit">{{ scope.row.fweight }}</span>
  273. <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" :placeholder="$t('formulationEvaluation.reset')" step="0.0001" type="number" style="width:95%;padding:10px 0;" />
  274. </template>
  275. </el-table-column>
  276. <el-table-column :label="$t('formulationEvaluation.jbys')" min-width="80px" align="center">
  277. <template slot-scope="scope">
  278. <span v-if="scope.row.NoEdit">{{ scope.row.autosecond }}</span>
  279. <!-- <el-select v-if="scope.row.Edit" v-model="scope.row.autosecond" filterable :placeholder="$t('formulationEvaluation.jbys')" class="filter-item" style="width:95%;padding:10px 0;">
  280. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.id" />
  281. </el-select> -->
  282. <el-input v-if="scope.row.Edit" v-model="scope.row.autosecond" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" />
  283. </template>
  284. </el-table-column>
  285. <el-table-column :label="$t('formulationEvaluation.yxyspc')" min-width="80px" align="center">
  286. <template slot-scope="scope">
  287. <span v-if="scope.row.NoEdit">{{ scope.row.deviation }}</span>
  288. <el-input v-if="scope.row.Edit" v-model="scope.row.deviation" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" />
  289. </template>
  290. </el-table-column>
  291. <el-table-column v-if="lockCount.isLockCount" :label="$t('formulationEvaluation.sfsdntbs')" min-width="80px" align="center">
  292. <template slot-scope="scope">
  293. <span v-if="scope.row.NoEdit && scope.row.islockcount == '0'">否</span>
  294. <span v-if="scope.row.NoEdit && scope.row.islockcount == '1'">是</span>
  295. <el-select v-if="scope.row.Edit" v-model="scope.row.islockcount" placeholder="" class="filter-item" style="width:95%;padding:10px 0;">
  296. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  297. </el-select>
  298. </template>
  299. </el-table-column>
  300. <el-table-column :label="$t('formulationEvaluation.jlqtj')" min-width="70px" align="center">
  301. <template slot-scope="scope">
  302. <el-switch v-model="scope.row.shutdown" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  303. </template>
  304. </el-table-column>
  305. <el-table-column :label="$t('formulationEvaluation.sort')" min-width="70px" align="center">
  306. <template slot-scope="scope">
  307. <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>
  308. <el-input v-if="scope.row.Edit" v-model="scope.row.sort" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" @blur="blurSort(scope.row)" />
  309. </template>
  310. </el-table-column>
  311. <el-table-column :label="$t('errorAnalysis.cz')" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
  312. <template slot-scope="{row}">
  313. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData2(row)" />
  314. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  315. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel2(row)" />
  316. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  317. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  318. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete2(row)" />
  319. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row)" />
  320. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  321. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  322. <span v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false && isRoleEdit" class="centerSpan">|</span>
  323. <el-button v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false && isRoleEdit" icon="el-icon-connection" class="miniSuccess" @click="handleSplitPremix(row)" />
  324. </template>
  325. </el-table-column>
  326. </el-table>
  327. </div>
  328. <div v-else class="table2">
  329. <el-table
  330. id="table2"
  331. ref="mytable2"
  332. :key="table2.tableKey"
  333. v-loading="table2.listLoading"
  334. element-loading-text="给我一点时间"
  335. :data="table2.list"
  336. border
  337. fit
  338. highlight-current-row
  339. style="width: 98%;"
  340. :row-style="rowStyle"
  341. :cell-style="cellStyle"
  342. class="elTable"
  343. row-key="id"
  344. show-summary
  345. :max-height="enlargeHeight"
  346. :summary-method="getSummaries"
  347. @selection-change="handleSelectionChange2"
  348. @cell-dblclick="celldblclick"
  349. >
  350. <el-table-column type="selection" width="50" />
  351. <el-table-column :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px" />
  352. <el-table-column :label="$t('formulationEvaluation.slz')" min-width="120px" align="center">
  353. <template slot-scope="scope">
  354. <span v-if="scope.row.groupNoEdit">{{ scope.row.feedgroup }}</span>
  355. <el-input v-if="scope.row.groupEdit" v-model="scope.row.feedgroup" :disabled="scope.row.isGroupDisabled" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" />
  356. </template>
  357. </el-table-column>
  358. <el-table-column :label="$t('InventoryManagement.silc')" min-width="120px" align="center">
  359. <template slot-scope="scope">
  360. <span v-if="scope.row.NoEdit">{{ scope.row.fname }}</span>
  361. <el-select v-if="scope.row.Edit" v-model="scope.row.fid" filterable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeFname(value, scope.row)}">
  362. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.id" />
  363. </el-select>
  364. </template>
  365. </el-table-column>
  366. <el-table-column :label="$t('formulationEvaluation.reset1')" prop="fweight" width="120px" align="center">
  367. <template slot-scope="scope">
  368. <span v-if="scope.row.NoEdit">{{ scope.row.fweight }}</span>
  369. <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" :placeholder="$t('formulationEvaluation.reset')" step="0.0001" type="number" style="width:95%;padding:10px 0;" />
  370. </template>
  371. </el-table-column>
  372. <el-table-column :label="$t('formulationEvaluation.jbys')" min-width="80px" align="center">
  373. <template slot-scope="scope">
  374. <span v-if="scope.row.NoEdit">{{ scope.row.autosecond }}</span>
  375. <el-select v-if="scope.row.Edit" v-model="scope.row.autosecond" filterable :placeholder="$t('formulationEvaluation.jbys')" class="filter-item" style="width:95%;padding:10px 0;">
  376. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.id" />
  377. </el-select>
  378. </template>
  379. </el-table-column>
  380. <!-- TODO: -->
  381. <el-table-column :label="$t('formulationEvaluation.yxyspc')" min-width="80px" align="center">
  382. </el-table-column>
  383. <el-table-column label="允许延时偏差(min)" min-width="80px" align="center">
  384. <template slot-scope="scope">
  385. <span v-if="scope.row.NoEdit">{{ scope.row.deviation }}</span>
  386. <el-input v-if="scope.row.Edit" v-model="scope.row.deviation" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" />
  387. </template>
  388. </el-table-column>
  389. <el-table-column:label="$t('formulationEvaluation.jlqtj')" min-width="70px" align="center">
  390. <template slot-scope="scope">
  391. <el-switch v-model="scope.row.shutdown" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  392. </template>
  393. </el-table-column:label=>
  394. <!-- -->
  395. <el-table-column v-if="lockCount.isLockCount" :label="$t('formulationEvaluation.sfsdntbs')" min-width="80px" align="center">
  396. <template slot-scope="scope">
  397. <span v-if="scope.row.NoEdit && scope.row.islockcount == '0'">否</span>
  398. <span v-if="scope.row.NoEdit && scope.row.islockcount == '1'">是</span>
  399. <el-select v-if="scope.row.Edit" v-model="scope.row.islockcount" placeholder="" class="filter-item" style="width:95%;padding:10px 0;">
  400. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  401. </el-select>
  402. </template>
  403. </el-table-column>
  404. <el-table-column :label="$t('formulationEvaluation.sort')" min-width="70px" align="center">
  405. <template slot-scope="scope">
  406. <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>
  407. <el-input v-if="scope.row.Edit" v-model="scope.row.sort" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" @blur="blurSort(scope.row)" />
  408. </template>
  409. </el-table-column>
  410. <el-table-column :label="$t('errorAnalysis.cz')" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
  411. <template slot-scope="{row}">
  412. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData2(row)" />
  413. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  414. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel2(row)" />
  415. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  416. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  417. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete2(row)" />
  418. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row)" />
  419. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  420. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  421. <span v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false && isRoleEdit" class="centerSpan">|</span>
  422. <el-button v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false && isRoleEdit" icon="el-icon-connection" class="miniSuccess" @click="handleSplitPremix(row)" />
  423. </template>
  424. </el-table-column>
  425. </el-table>
  426. </div>
  427. </div>
  428. </div>
  429. <!-- 配方模板表 -->
  430. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="template.dialogFormVisible" :close-on-click-modal="false" width="90%">
  431. <template slot="title">
  432. <div class="avue-crud__dialog__header">
  433. <span class="el-dialog__title">
  434. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  435. {{ textMap[template.dialogStatus] }}
  436. </span>
  437. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  438. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  439. <svg-icon v-else icon-class="fullscreen" />
  440. </div>
  441. </div>
  442. </template>
  443. <div class="dialogMinHeight" style="overflow-y: auto;margin-bottom: 0px;overflow-x: hidden;">
  444. <div ref="templateDialog" class="templateDialog">
  445. <div class="recipeTemplate">
  446. <p>{{$t('formulationEvaluation.pfmbb')}}</p>
  447. </div>
  448. <div class="operation1">
  449. <el-date-picker v-model="template.table.getdataListParm.parammaps.date" type="date" :placeholder="$t('formulationEvaluation.lssjjl')":clearable="false" style="width: 180px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="changeDate" />
  450. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  451. </div>
  452. <div class="search">
  453. <el-select v-model="template.table.getdataListParm.parammaps.ccname" :placeholder="$t('feedingEfficiency.cxlb')" class="filter-item" clearable>
  454. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />
  455. </el-select>
  456. <el-select v-model="template.table.getdataListParm.parammaps.fttype" :placeholder="$t('formulationEvaluation.pflx')" class="filter-item" style="width: 120px;" clearable>
  457. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />
  458. </el-select>
  459. <el-select v-model="template.table.getdataListParm.parammaps.enable" :placeholder="$t('formulationEvaluation.sfqy')" class="filter-item" style="margin-left:10px;width: 120px;" clearable>
  460. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  461. </el-select>
  462. <div ref="selectInput" class="filter-item selectInput">
  463. <el-input type="text" name="" value="" :placeholder="$t('driver.xzsstj')" class="Input" />
  464. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  465. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  466. <ul v-if="arrowUp" class="selectUl">
  467. <li><a>{{$t('formulationEvaluation.pfmc')}}</a><el-input v-model="template.table.getdataListParm.parammaps.tname" style="width: 245px;" /></li>
  468. <li><a>{{$t('formulationEvaluation.remark')}}</a><el-input v-model="template.table.getdataListParm.parammaps.remark" style="width: 245px;" /></li>
  469. <li><a>{{$t('formulationEvaluation.ly')}}</a><el-input v-model="template.table.getdataListParm.parammaps.source" style="width: 245px;" /></li>
  470. <li>
  471. <div style="float: right;">
  472. <el-button class="downminCancel" @click="arrowUp=false;arrowDown=true;">{{$t('formulationEvaluation.cancel')}}</el-button>
  473. <el-button class="miniPrimary" @click="handleDialogSearch">{{$t('formulationEvaluation.search')}}</el-button>
  474. </div>
  475. </li>
  476. </ul>
  477. </div>
  478. <el-button class="successBorder" @click="handleDialogSearch" style="margin-left:10px;">{{$t('common.query')}}</el-button>
  479. <el-button class="successBorder" @click="handleDialogRefresh" style="margin-left:10px;">{{$t('common.reset')}}</el-button>
  480. </div>
  481. <div class="table">
  482. <el-table
  483. :key="template.table.tableKey"
  484. v-loading="template.table.listLoading"
  485. element-loading-text="给我一点时间"
  486. :data="template.table.list"
  487. border
  488. fit
  489. highlight-current-row
  490. style="width: 98%;"
  491. :row-style="rowStyle"
  492. :height="myheight2"
  493. :cell-style="cellStyle"
  494. class="elTable table-fixed"
  495. @row-click="tableRowClickDialog"
  496. >
  497. <el-table-column v-if="template.dialogStatus == 'RecipeRecord'" :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px" />
  498. <el-table-column v-else :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px">
  499. <template slot-scope="scope">
  500. <span>{{ scope.$index + (template.table.pageNum-1) * template.table.pageSize + 1 }}</span>
  501. </template>
  502. </el-table-column>
  503. <el-table-column :label="$t('errorAnalysis.feedName')" min-width="130px" align="center">
  504. <template slot-scope="scope">
  505. <span>{{ scope.row.tname }}</span>
  506. </template>
  507. </el-table-column>
  508. <el-table-column :label="$t('formulationEvaluation.pfbm')" min-width="90px" align="center">
  509. <template slot-scope="scope">
  510. <span>{{ scope.row.tcode }}</span>
  511. </template>
  512. </el-table-column>
  513. <el-table-column :label="$t('formulationEvaluation.pfys')" min-width="110px" align="center">
  514. <template slot-scope="scope">
  515. <el-color-picker v-model="scope.row.tcolor" size="mini" :predefine="predefineColors" style="vertical-align: middle;" />
  516. </template>
  517. </el-table-column>
  518. <el-table-column :label="$t('errorAnalysis.sxlb')" min-width="110px" align="center">
  519. <template slot-scope="scope">
  520. <span>{{ scope.row.ccname }}</span>
  521. </template>
  522. </el-table-column>
  523. <el-table-column :label="$t('formulationEvaluation.pflx')" min-width="110px" align="center">
  524. <template slot-scope="scope">
  525. <span>{{ scope.row.fttype }}</span>
  526. </template>
  527. </el-table-column>
  528. <el-table-column :label="$t('formulationEvaluation.ly')" min-width="90px" align="center">
  529. <template slot-scope="scope">
  530. <span>{{ scope.row.source }}</span>
  531. </template>
  532. </el-table-column>
  533. <el-table-column :label="$t('formulationEvaluation.remark')" min-width="90px" align="center">
  534. <template slot-scope="scope">
  535. <span>{{ scope.row.remark }}</span>
  536. </template>
  537. </el-table-column>
  538. <el-table-column :label="$t('formulationEvaluation.bbh')" min-width="90px" align="center">
  539. <template slot-scope="scope">
  540. <span>{{ scope.row.version }}</span>
  541. </template>
  542. </el-table-column>
  543. <el-table-column :label="$t('formulationEvaluation.bbsj')" min-width="90px" align="center">
  544. <template slot-scope="scope">
  545. <span>{{ scope.row.versiontime }}</span>
  546. </template>
  547. </el-table-column>
  548. <el-table-column :label="$t('formulationEvaluation.sfqy')" min-width="90px" align="center">
  549. <template slot-scope="scope">
  550. <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  551. </template>
  552. </el-table-column>
  553. </el-table>
  554. </div>
  555. </div>
  556. <div v-if="isDetailDialog" id="detailDialog2" ref="detailDialog2" class="detailDialog" style="margin-top: 30px;height: 200px;overflow-y: auto;overflow-x: hidden;">
  557. <div class="recipeTemplate">
  558. <p>{{$t('formulationEvaluation.pfbqb')}}</p>
  559. </div>
  560. <div class="operation">
  561. <div ref="selectInput2" class="filter-item selectInput">
  562. <el-input type="text" name="" value="" :placeholder="$t('driver.xzsstj')" class="Input" />
  563. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  564. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  565. <ul v-if="arrowUp2" class="selectUl">
  566. <li>
  567. <a style="width: 130px;">{{$t('formulationEvaluation.slmc')}}</a>
  568. <el-select v-model="template.table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:245px;">
  569. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />
  570. </el-select>
  571. </li>
  572. <li><a style="width: 130px;">{{$t('formulationEvaluation.slzmc')}}</a><el-input v-model="template.table2.getdataListParm.parammaps.feedgroup" style="width: 245px;" /></li>
  573. <li><a style="width: 130px;">{{$t('formulationEvaluation.reset')}}</a><el-input v-model="template.table2.getdataListParm.parammaps.fweight" style="width: 245px;" /></li>
  574. <li>
  575. <a style="width: 130px;">{{$t('formulationEvaluation.jbys')}}</a>
  576. <el-select v-model="template.table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:245px;">
  577. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />
  578. </el-select>
  579. </li>
  580. <li>
  581. <a style="width: 130px;">{{$t('formulationEvaluation.sfsdntbs')}}</a>
  582. <el-select v-model="template.table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:245px;">
  583. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  584. </el-select>
  585. </li>
  586. <li><a style="width: 130px;">{{$t('formulationEvaluation.sort')}}</a><el-input v-model="template.table2.getdataListParm.parammaps.sort" style="width: 245px;" /></li>
  587. <li>
  588. <div style="float: right;">
  589. <el-button class="downminCancel" @click="arrowUp2=false;arrowDown2=true;">{{$t('formulationEvaluation.cancel')}}</el-button>
  590. <el-button class="miniPrimary" @click="handleDialogSearch2">{{$t('formulationEvaluation.search')}}</el-button>
  591. </div>
  592. </li>
  593. </ul>
  594. </div>
  595. <el-button class="successBorder" @click="handleDialogSearch2">{{$t('common.query')}}</el-button>
  596. <el-button class="successBorder" @click="handleDialogRefresh2">{{$t('common.reset')}}</el-button>
  597. <el-button class="hide" @click="handleDialogCloseTable2">{{$t('formulationEvaluation.hide')}}</el-button>
  598. </div>
  599. <div class="table2">
  600. <el-table
  601. id="templateTable2"
  602. :key="template.table2.tableKey"
  603. v-loading="template.table2.listLoading"
  604. element-loading-text="给我一点时间"
  605. :data="template.table2.list"
  606. border
  607. fit
  608. highlight-current-row
  609. style="width: 98%;"
  610. :summary-method="getTemplateTable2Summaries"
  611. show-summary
  612. :row-style="rowStyle"
  613. :cell-style="cellStyle"
  614. class="elTable table-fixed"
  615. row-key="id"
  616. >
  617. <el-table-column :label="$t('formulationEvaluation.slz')" min-width="130px" align="center">
  618. <template slot-scope="scope">
  619. <span>{{ scope.row.feedgroup }}</span>
  620. </template>
  621. </el-table-column>
  622. <el-table-column :label="$t('InventoryManagement.silc')" min-width="130px" align="center">
  623. <template slot-scope="scope">
  624. <span>{{ scope.row.fname }}</span>
  625. </template>
  626. </el-table-column>
  627. <el-table-column :label="$t('formulationEvaluation.reset1')"prop="fweight" min-width="200px" align="center">
  628. <template slot-scope="scope">
  629. <span>{{ scope.row.fweight }}</span>
  630. </template>
  631. </el-table-column>
  632. <el-table-column :label="$t('formulationEvaluation.jbys')" min-width="130px" align="center">
  633. <template slot-scope="scope">
  634. <span>{{ scope.row.autosecondname }}</span>
  635. </template>
  636. </el-table-column>
  637. <el-table-column :label="$t('formulationEvaluation.sfsdntbs')" min-width="130px" align="center">
  638. <template slot-scope="scope">
  639. <span v-if="scope.row.islockcount == '0'">否</span>
  640. <span v-if="scope.row.islockcount == '1'">是</span>
  641. </template>
  642. </el-table-column>
  643. <el-table-column :label="$t('formulationEvaluation.sort')" min-width="130px" align="center">
  644. <template slot-scope="scope">
  645. <span>{{ scope.row.sort }}</span>
  646. </template>
  647. </el-table-column>
  648. </el-table>
  649. </div>
  650. </div>
  651. </div>
  652. <div slot="footer" class="dialog-footer">
  653. <el-button class="cancelClose cancelClose1" @click="template.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  654. </div>
  655. </el-dialog>
  656. <!-- 合成预混料 -->
  657. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="detail.dialogFormVisible" :close-on-click-modal="false" width="90%">
  658. <template slot="title">
  659. <div class="avue-crud__dialog__header">
  660. <span class="el-dialog__title">
  661. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  662. {{ textMap[detail.dialogStatus] }}
  663. </span>
  664. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  665. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  666. <svg-icon v-else icon-class="fullscreen" />
  667. </div>
  668. </div>
  669. </template>
  670. <div class="detailDialog">
  671. <h2>{{$t('formulationEvaluation.feed')}}</h2>
  672. <div class="table1">
  673. <el-table
  674. :key="detail.tableKey"
  675. v-loading="detail.listLoading"
  676. element-loading-text="给我一点时间"
  677. :data="detail.list"
  678. fit
  679. highlight-current-row
  680. style="width: 100%;"
  681. :row-style="rowStyle"
  682. :cell-style="cellStyle"
  683. class="elTable table-fixed"
  684. show-summary
  685. >
  686. <el-table-column :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px" />
  687. <el-table-column :label="$t('InventoryManagement.silc')" min-width="130px" align="center">
  688. <template slot-scope="scope">
  689. <span>{{ scope.row.fname }}</span>
  690. </template>
  691. </el-table-column>
  692. <el-table-column prop="fweight" :label="$t('formulationEvaluation.reset1')"/>
  693. <el-table-column :label="$t('formulationEvaluation.jbys')" min-width="110px" align="center">
  694. <template slot-scope="scope">
  695. <span>{{ scope.row.autosecond }}</span>
  696. </template>
  697. </el-table-column>
  698. <el-table-column v-if="lockCount.isLockCount" :label="$t('formulationEvaluation.sfsdntbs')" min-width="130px" align="center">
  699. <template slot-scope="scope">
  700. <span v-if="scope.row.islockcount == '0'">否</span>
  701. <span v-if="scope.row.islockcount == '1'">是</span>
  702. </template>
  703. </el-table-column>
  704. <el-table-column :label="$t('formulationEvaluation.sort')" min-width="110px" align="center">
  705. <template slot-scope="scope">
  706. <span>{{ scope.row.sort }}</span>
  707. </template>
  708. </el-table-column>
  709. </el-table>
  710. </div>
  711. <h2>{{$t('formulationEvaluation.hcyhl')}}</h2>
  712. <div class="table2" style="margin-bottom: 50px;">
  713. <el-table
  714. :key="detail.tableKey2"
  715. v-loading="detail.listLoading2"
  716. element-loading-text="给我一点时间"
  717. :data="detail.list2"
  718. border
  719. fit
  720. highlight-current-row
  721. style="width: 100%;"
  722. :row-style="rowStyle"
  723. :cell-style="cellStyle"
  724. class="elTable table-fixed"
  725. >
  726. <el-table-column :label="$t('errorAnalysis.feedName')" min-width="130px" align="center">
  727. <template slot-scope="scope">
  728. <el-input v-model="scope.row.tname" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" :disabled="detail.disabled" />
  729. </template>
  730. </el-table-column>
  731. <el-table-column :label="$t('formulationEvaluation.pfys')" min-width="130px" align="center">
  732. <template slot-scope="scope">
  733. <el-color-picker v-model="scope.row.tcolor" size="mini" :predefine="predefineColors" style="vertical-align: middle;" :disabled="detail.disabled" />
  734. </template>
  735. </el-table-column>
  736. <el-table-column :label="$t('errorAnalysis.sxlb')" min-width="130px" align="center">
  737. <template slot-scope="scope">
  738. <el-select v-model="scope.row.ccid" placeholder="选择牲畜父类" class="filter-item" style="width:95%;padding:10px 0;" :disabled="detail.disabled" @change="changeLivestockType2">
  739. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />
  740. </el-select>
  741. </template>
  742. </el-table-column>
  743. <el-table-column :label="$t('formulationEvaluation.pflx')" min-width="110px" align="center">
  744. <template slot-scope="scope">
  745. <span>{{ scope.row.fttype }}</span>
  746. </template>
  747. </el-table-column>
  748. <el-table-column :label="$t('formulationEvaluation.ly')" min-width="110px" align="center">
  749. <template slot-scope="scope">
  750. <span>{{ scope.row.source }}</span>
  751. </template>
  752. </el-table-column>
  753. <el-table-column :label="$t('formulationEvaluation.rl')" min-width="130px" align="center">
  754. <template slot-scope="scope">
  755. <el-input v-model="scope.row.volume" style="width:95%;padding:10px 0;" :disabled="detail.disabled" />
  756. </template>
  757. </el-table-column>
  758. <el-table-column :label="$t('formulationEvaluation.remark')" min-width="130px" align="center">
  759. <template slot-scope="scope">
  760. <el-input v-model="scope.row.remark" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" :disabled="detail.disabled" />
  761. </template>
  762. </el-table-column>
  763. <el-table-column :label="$t('formulationEvaluation.sfqy')" min-width="130px" align="center">
  764. <template slot-scope="scope">
  765. <el-switch v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" :disabled="detail.disabled" />
  766. </template>
  767. </el-table-column>
  768. </el-table>
  769. </div>
  770. <div slot="footer" class="dialog-footer">
  771. <el-button class="cancelClose" @click="detail.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  772. <el-button class="save" :disabled="isokDisable" @click="syntheticPremixData()">{{$t('errorAnalysis.confirm')}}</el-button>
  773. </div>
  774. </div>
  775. </el-dialog>
  776. <!-- 历史记录 -->
  777. <el-dialog :title="textMap[historyRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  778. <div class="historyRecord">
  779. <keep-alive>
  780. <component :is="historyRecord.myComponent" ref="historyRecord" />
  781. </keep-alive>
  782. </div>
  783. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  784. <el-button class="cancelClose1" @click="historyRecord.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  785. </div>
  786. </el-dialog>
  787. <!-- 行内配方记录 -->
  788. <el-dialog :title="textMap[rowRecipeRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="rowRecipeRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  789. <div class="rowRecipeRecord">
  790. <div class="search">
  791. <el-date-picker ref="inputDatetime" v-model="rowRecipeRecord.getdataListParm.parammaps.inputDatetime" class="filter-item inputDatetime" type="daterange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :range-separator="$t('common.to')" :start-placeholder="$t('common.startTime')" :end-placeholder="$t('common.endTime')" />
  792. <el-button class="successBorder" @click="handleRowRecipeRecordSearch">{{$t('common.query')}}</el-button>
  793. </div>
  794. <div class="table">
  795. <el-table
  796. :key="rowRecipeRecord.tableKey"
  797. v-loading="rowRecipeRecord.listLoading"
  798. element-loading-text="给我一点时间"
  799. :data="rowRecipeRecord.list"
  800. border
  801. highlight-current-row
  802. style="width: 100%;"
  803. :row-style="rowStyle"
  804. :cell-style="cellStyle"
  805. class="elTable table-fixed"
  806. >
  807. <el-table-column :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px">
  808. <template slot-scope="scope">
  809. <span>{{ scope.$index + (rowRecipeRecord.pageNum-1) * rowRecipeRecord.pageSize + 1 }}</span>
  810. </template>
  811. </el-table-column>
  812. <!-- <el-table-column :label="$t('formulationEvaluation.xh')" width="60px" align="center" prop="sort" /> -->
  813. <el-table-column :label="$t('formulationEvaluation.xgsj')" width="100px" align="center" prop="datetime1" />
  814. <el-table-column :label="$t('formulationEvaluation.xgyh')" width="130px" align="center" prop="empname" />
  815. <el-table-column :label="$t('formulationEvaluation.slmcdw')" min-width="800px" align="center">
  816. <template slot-scope="scope">
  817. <div v-for="element in scope.row.arrList" :key="element.name" class="list-group-item2 item" style="width:150px;float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin: 5px 5px;padding: 0;height: 30px;">
  818. <el-tooltip v-if="element.change== 'red'" placement="top" :open-delay="1000">
  819. <div slot="content">{{ element.name }}( {{ element.weight }} / {{ element.Eweight }} )</div>
  820. <span :style="{'color':element.change}" style="display: block;height:30px;line-height: 30px;">
  821. {{ element.name }}( {{ element.weight }} / {{ element.Eweight }} )
  822. </span>
  823. </el-tooltip>
  824. <el-tooltip v-else placement="top" :open-delay="1000">
  825. <div slot="content">{{ element.name }}( {{ element.weight }})</div>
  826. <span :style="{'color':element.change}" style="display: block;height:30px;line-height: 30px;">
  827. {{ element.name }}( {{ element.weight }})
  828. </span>
  829. </el-tooltip>
  830. </div>
  831. </template>
  832. </el-table-column>
  833. </el-table>
  834. <pagination v-show="rowRecipeRecord.total>=0" :total="rowRecipeRecord.total" :page.sync="rowRecipeRecord.getdataListParm.offset" :limit.sync="rowRecipeRecord.getdataListParm.pagecount" @pagination="getRowRecipeRecordList()" />
  835. </div>
  836. </div>
  837. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  838. <el-button class="cancelClose1" @click="rowRecipeRecord.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  839. </div>
  840. </el-dialog>
  841. </div>
  842. </template>
  843. <script>
  844. import { GetDataByName, GetDataByNames, PostDataByName, failproccess, checkButtons, postJson, ExecDataByConfig, formatNum } from '@/api/common'
  845. import Sortable from 'sortablejs'
  846. import { MessageBox } from 'element-ui'
  847. import Cookies from 'js-cookie'
  848. import { json2excel } from '@/utils/index.js'
  849. import axios from 'axios'
  850. import { getToken } from '@/utils/auth'
  851. import { parseTime } from '@/utils/index.js'
  852. import Pagination from '@/components/Pagination'
  853. export default {
  854. name: 'RecipeTemplate',
  855. components: { Pagination },
  856. data() {
  857. return {
  858. dialogFull: false,
  859. predefineColors: [
  860. '#E57373', '#F06292', '#BA68C8', '#9575CD', '#7986CB', '#64B5F6', '#4FC3F7', '#4DD0E1', '#4DB6AC', '#81C784', '#AED581', '#DCE775', '#FFF176', '#FFD54F', '#FFB74D', '#FF8A65', '#A1887F', '#E0E0E0', '#90A4AE'
  861. ],
  862. isRoleEdit: [],
  863. myheight: document.documentElement.clientHeight - 265,
  864. requestParams: [
  865. {"name":"getCowclassList","page":1,"offset":1,"pagecount":50,"returntype":"Map","parammaps":{"pastureid":Cookies.get('pastureid'),"classname":"","parentname":"","enable":1}},
  866. // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] },
  867. { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['配方类型'] },
  868. { name: 'getFeedAndPre', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  869. { name: 'getDistCattle', offset: 0, pagecount: 0, parammaps: {}}
  870. ],
  871. distCattle:[],//牛群类别
  872. enableList: [{ id: '0', name: this.$t('formulationEvaluation.fou') }, { id: '1', name: this.$t('formulationEvaluation.shi') }], // 是否启用
  873. lockBullsList: [{ id: '0', name: this.$t('formulationEvaluation.fou') }, { id: '1', name: this.$t('formulationEvaluation.shi') }], // 是否锁定牛头数比例
  874. livestockTypeList: [], // 牲畜类别
  875. formulaTypeList: [], // 配方类型
  876. feedNameList: [], // 饲料名称
  877. mixingDelayList: [{ id: '0', name: '0' }, { id: '1', name: '1' }, { id: '2', name: '2' }, { id: '3', name: '3' }, { id: '4', name: '4' }, { id: '5', name: '5' }, { id: '6', name: '6' }, { id: '7', name: '7' }, { id: '8', name: '8' }, { id: '9', name: '9' }, { id: '10', name: '10' }, { id: '11', name: '11' }, { id: '12', name: '12' }, { id: '13', name: '13' }, { id: '14', name: '14' }, { id: '15', name: '15' }], // 搅拌延时
  878. selectHistoryTimeList: [{ id: 0, name: '2020-06-10' }, { id: 1, name: '2020-06-11' }, { id: 2, name: '2020-06-12' }, { id: 3, name: '2020-06-13' }], // 请选择历史记录时间
  879. arrowDown: true,
  880. arrowUp: false,
  881. ispastureuse: Cookies.get('ispastureuse'),
  882. table: {
  883. getdataListParm: {
  884. name: 'getFTList',
  885. page: 1,
  886. offset: 1,
  887. pagecount: '',
  888. returntype: 'Map',
  889. parammaps: {
  890. pastureid: Cookies.get('pastureid'),
  891. tname: '',
  892. ccid: '',
  893. ccname: '',
  894. fttypeid: '',
  895. fttype: '',
  896. remark: '',
  897. enable: '1',
  898. source: ''
  899. }
  900. },
  901. tableKey: 0,
  902. list: [],
  903. total: 0,
  904. listLoading: true,
  905. temp: {}
  906. },
  907. lockCount: {
  908. getdataListParm: {
  909. name: 'getSysoptEnable',
  910. page: 1,
  911. offset: 1,
  912. pagecount: 30,
  913. returntype: 'Map',
  914. parammaps: {
  915. pastureid: Cookies.get('pastureid'),
  916. inforname: 'isLockCount'
  917. }
  918. },
  919. isLockCount: false // 是否显示是否锁定牛头数比例
  920. },
  921. isDetail: false,
  922. arrowDown2: true,
  923. arrowUp2: false,
  924. table2: {
  925. getDryweightParm: {
  926. name: 'getFTdryweight',
  927. page: 1,
  928. offset: 1,
  929. pagecount: 10,
  930. returntype: 'Map',
  931. parammaps: {
  932. pastureid: '',
  933. ftid: ''
  934. }
  935. },
  936. dryweight: '',
  937. getdataListParm: {
  938. name: 'getFTdetailList',
  939. page: 1,
  940. offset: 1,
  941. pagecount: '',
  942. returntype: 'Map',
  943. parammaps: {
  944. pastureid: Cookies.get('pastureid'),
  945. fname: '',
  946. feedgroup: '',
  947. fweight: '',
  948. autosecondname: '',
  949. islockcount: '',
  950. sort: ''
  951. }
  952. },
  953. tableKey: 0,
  954. list: [],
  955. total: 0,
  956. listLoading: true,
  957. temp: {},
  958. updateList: {}
  959. },
  960. isDetailDialog: false,
  961. template: {
  962. dialogFormVisible: false,
  963. dialogStatus: '',
  964. table: {
  965. getdataListParm: {
  966. name: 'getFTListDate',
  967. page: 1,
  968. offset: 1,
  969. pagecount: '',
  970. returntype: 'Map',
  971. parammaps: {
  972. pastureid: Cookies.get('pastureid'),
  973. tname: '',
  974. ccid: '',
  975. ccname: '',
  976. fttype: '',
  977. remark: '',
  978. enable: '',
  979. date: '',
  980. source: ''
  981. }
  982. },
  983. tableKey: 0,
  984. total: 0,
  985. listLoading: true,
  986. list: []
  987. },
  988. table2: {
  989. getdataListParm: {
  990. name: 'getFTdetailListDate',
  991. page: 1,
  992. offset: 1,
  993. pagecount: 10,
  994. returntype: 'Map',
  995. parammaps: {
  996. pastureid: Cookies.get('pastureid'),
  997. fname: '',
  998. fweight: '',
  999. islockcount: '',
  1000. sort: '',
  1001. feedgroup: '',
  1002. autosecondname: ''
  1003. }
  1004. },
  1005. tableKey: 0,
  1006. total: 0,
  1007. listLoading: true,
  1008. list: []
  1009. },
  1010. // 历史日期
  1011. getdataDateParm: {
  1012. name: 'getFTMaxDate',
  1013. page: 1,
  1014. offset: 1,
  1015. pagecount: 10,
  1016. returntype: 'Map',
  1017. parammaps: {
  1018. pastureid: Cookies.get('pastureid')
  1019. }
  1020. }
  1021. },
  1022. isOrder: true,
  1023. detail: {
  1024. dialogFormVisible: false,
  1025. dialogStatus: '',
  1026. tableKey: 0,
  1027. total: 0,
  1028. listLoading: true,
  1029. list: [],
  1030. tableKey2: 0,
  1031. total2: 0,
  1032. listLoading2: false,
  1033. list2: [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1, }],
  1034. getdataListParm: {
  1035. name: 'getFTDetailCompare',
  1036. page: 1,
  1037. offset: 1,
  1038. pagecount: 10,
  1039. returntype: 'Map',
  1040. parammaps: {}
  1041. },
  1042. list3: [],
  1043. disabled: false,
  1044. getdataListParm2: {
  1045. name: 'getFTCompare',
  1046. page: 1,
  1047. offset: 1,
  1048. pagecount: 10,
  1049. returntype: 'Map',
  1050. parammaps: {}
  1051. }
  1052. },
  1053. selectList: [],
  1054. selectList2: [],
  1055. textMap: {
  1056. RecipeRecord: '配方记录',
  1057. SyntheticPremix: '合成预混料',
  1058. historyRecord: '历史记录',
  1059. detail: '饲料详情',
  1060. rowRecipeRecordTxt: '配方修改记录'
  1061. },
  1062. requestParam: {},
  1063. requestParam2: {},
  1064. requestParam3:{},
  1065. download: {
  1066. getdataListParm: {
  1067. name: 'getFTList',
  1068. page: 1,
  1069. offset: 1,
  1070. pagecount: 0,
  1071. returntype: 'Map',
  1072. parammaps: {
  1073. pastureid: Cookies.get('pastureid'),
  1074. tname: '',
  1075. ccid: '',
  1076. ccname: '',
  1077. fttypeid: '',
  1078. fttype: '',
  1079. remark: '',
  1080. enable: ''
  1081. }
  1082. },
  1083. list: []
  1084. },
  1085. historyRecord: {
  1086. dialogStatus: '',
  1087. dialogFormVisible: false
  1088. },
  1089. isokDisable: false,
  1090. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  1091. cellStyle: { padding: 0 + 'px' },
  1092. dropState: false,
  1093. myheight2: 0,
  1094. height: 0,
  1095. rowRecipeRecord: {
  1096. dialogStatus: '',
  1097. dialogFormVisible: false,
  1098. getdataListParm: {
  1099. name: 'getFitHistory1', 'name1': 'getFitHistory2', page: 1, offset: 1, pagecount: 10, returntype: 'Map',
  1100. parammaps: { inputDatetime: '', pastureid: '', fitid: '' }
  1101. },
  1102. tableKey: 0, total: 0, listLoading: true, list: []
  1103. },
  1104. isEnlarge: true,
  1105. ispalyUd: true,
  1106. // enlargeHeight: document.documentElement.clientHeight - 85 - 165 + 50,
  1107. enlargeHeight: document.documentElement.clientHeight - 85 - 165 + 50,
  1108. getTcodeParm: {
  1109. name: 'getTcode', page: 1, offset: 1, pagecount: 10, returntype: 'Map',
  1110. parammaps: { pastureid: '', fttypeid: '' }
  1111. },
  1112. sourceList: [{ id: '0', name: '自定义' }, { id: '1', name: '集团下发未调整' }, { id: '2', name: '集团下发有调整' }, { id: '3', name: '导入' }]
  1113. }
  1114. },
  1115. computed: {
  1116. // 设置请求头
  1117. headers() {
  1118. return {
  1119. token: getToken()
  1120. }
  1121. },
  1122. uploadData() {
  1123. return {
  1124. name: 'checkfttype,checkbigcowclass,checkFeed,insertFTUpload,insertFTdetailUpload',
  1125. importParams: '配方名称,牲畜类别,配方类型,备注,饲料组,饲料名称,重量(kg),搅拌延时(min),是否锁定牛头数比例',
  1126. sheetname: 'Sheet1',
  1127. // 登录牧场
  1128. pastureid: Cookies.get('pastureid'),
  1129. // 日期参数
  1130. dateParams: '',
  1131. // 必填参数
  1132. requiredParams: '配方名称,牲畜类别,配方类型,饲料名称,重量(kg),搅拌延时(min),是否锁定牛头数比例',
  1133. // 为数值的参数
  1134. numParams: '重量(kg),搅拌延时(min)'
  1135. }
  1136. },
  1137. // 设置上传地址
  1138. uploadExcelUrl() {
  1139. return Cookies.get('url') + 'authdata/ImportExcel'
  1140. }
  1141. },
  1142. mounted() {
  1143. document.addEventListener('click', (e) => {
  1144. if (this.$refs.selectInput !== undefined) {
  1145. if (!this.$refs.selectInput.contains(e.target)) {
  1146. this.arrowDown = true
  1147. this.arrowUp = false
  1148. } else {
  1149. this.arrowDown = false
  1150. this.arrowUp = true
  1151. }
  1152. }
  1153. if (this.$refs.selectInput2 !== undefined) {
  1154. if (!this.$refs.selectInput2.contains(e.target)) {
  1155. this.arrowDown2 = true
  1156. this.arrowUp2 = false
  1157. } else {
  1158. this.arrowDown2 = false
  1159. this.arrowUp2 = true
  1160. }
  1161. }
  1162. })
  1163. },
  1164. created() {
  1165. this.getIspalyUd()
  1166. this.getList()
  1167. this.getButtons()
  1168. this.getDownList()
  1169. this.getIsLockCount()
  1170. },
  1171. methods: {
  1172. getButtons() {
  1173. const Edit = 'RecipeTemplate'
  1174. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  1175. this.isRoleEdit = isRoleEdit
  1176. },
  1177. getSummaries(param) {
  1178. const { columns, data } = param
  1179. const sums = []
  1180. columns.forEach((column, index) => {
  1181. if (index === 0) {
  1182. sums[index] = '合计'
  1183. return
  1184. }
  1185. if (column.property !== undefined) {
  1186. // 加了prop属性的el-table-column 才能找到column.property
  1187. const values = data.map(item => Number(item[column.property]))
  1188. if (!values.every(value => isNaN(value))) {
  1189. sums[index] = values.reduce((prev, curr) => {
  1190. const value = Number(curr)
  1191. if (!isNaN(value)) {
  1192. return prev + curr // 多行相加
  1193. } else {
  1194. return prev
  1195. }
  1196. }, 0)
  1197. sums[index] = sums[index].toFixed(4) + '(干物质量:' + this.table2.dryweight + ')'
  1198. } else {
  1199. sums[index] = ''
  1200. }
  1201. }
  1202. })
  1203. // console.log(sums, 'sums[index]')
  1204. return sums
  1205. },
  1206. getDryWeight() {
  1207. GetDataByName(this.table2.getDryweightParm).then(response => {
  1208. console.log('干物质数据', response.data.list)
  1209. if (response.data.list[0].dryweight !== undefined) {
  1210. this.table2.dryweight = response.data.list[0].dryweight
  1211. } else {
  1212. this.table2.dryweight = ''
  1213. }
  1214. })
  1215. },
  1216. getTemplateTable2Summaries(param) {
  1217. const { columns, data } = param
  1218. const sums = []
  1219. columns.forEach((column, index) => {
  1220. if (index === 0) {
  1221. sums[index] = '合计'
  1222. return
  1223. }
  1224. const values = data.map(item => Number(item[column.property]))
  1225. if (!values.every(value => isNaN(value))) {
  1226. sums[index] = values.reduce((prev, curr) => {
  1227. const value = Number(curr)
  1228. if (!isNaN(value)) {
  1229. return prev + curr
  1230. } else {
  1231. return prev
  1232. }
  1233. }, 0)
  1234. // 后台待发
  1235. sums[index] += '(干物质量:' + this.template.table2.getdataListParm.parammaps.dryweight + ')'
  1236. } else {
  1237. sums[index] = ''
  1238. }
  1239. })
  1240. return sums
  1241. },
  1242. getDownList() {
  1243. GetDataByNames(this.requestParams).then(response => {
  1244. // this.livestockTypeList = response.data.getDictByName.list
  1245. this.livestockTypeList = response.data.getCowclassList.list
  1246. for(var i=0;i<this.livestockTypeList.length;i++){
  1247. this.livestockTypeList[i].label = this.livestockTypeList[i].classname;
  1248. this.livestockTypeList[i].value = this.livestockTypeList[i].id;
  1249. }
  1250. this.formulaTypeList = response.data.getDictByName2.list
  1251. this.feedNameList = response.data.getFeedAndPre.list
  1252. this.distCattle = response.data.getDistCattle.list
  1253. })
  1254. },
  1255. // -------------------模板-----------------------------
  1256. getList() {
  1257. this.table.listLoading = true
  1258. GetDataByName(this.table.getdataListParm).then(response => {
  1259. console.log('配方模板table数据', response.data.list)
  1260. if (response.data.list !== null) {
  1261. for (let i = 0; i < response.data.list.length; i++) {
  1262. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1263. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1264. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1265. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1266. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1267. }
  1268. this.table.list = response.data.list
  1269. this.table.pageNum = response.data.pageNum
  1270. this.table.pageSize = response.data.pageSize
  1271. this.table.total = response.data.total
  1272. } else {
  1273. this.table.list = []
  1274. this.isDetail = false
  1275. }
  1276. setTimeout(() => {
  1277. this.table.listLoading = false
  1278. }, 100)
  1279. })
  1280. },
  1281. getList3() {
  1282. this.table.listLoading = true
  1283. GetDataByName(this.table.getdataListParm).then(response => {
  1284. console.log('table数据', response.data.list)
  1285. if (response.data.list !== null) {
  1286. for (let i = 0; i < response.data.list.length; i++) {
  1287. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1288. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1289. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1290. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1291. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1292. }
  1293. this.table.list = response.data.list
  1294. this.table.pageNum = response.data.pageNum
  1295. this.table.pageSize = response.data.pageSize
  1296. this.table.total = response.data.total
  1297. } else {
  1298. this.table.list = []
  1299. this.isDetail = false
  1300. }
  1301. setTimeout(() => {
  1302. this.table.listLoading = false
  1303. }, 100)
  1304. })
  1305. },
  1306. form_search() {
  1307. console.log('点击了查询')
  1308. this.table.getdataListParm.offset = 1
  1309. this.getList()
  1310. this.table.getdataListParm.parammaps.all = ''
  1311. var obj = {}
  1312. obj.tname = this.table.getdataListParm.parammaps.tname
  1313. obj.remark = this.table.getdataListParm.parammaps.remark
  1314. // obj.source = this.table.getdataListParm.parammaps.source
  1315. Object.getOwnPropertyNames(obj).forEach((key) => {
  1316. console.log(key, obj[key])
  1317. if (obj[key] !== '') {
  1318. this.table.getdataListParm.parammaps.all += obj[key] + '/'
  1319. }
  1320. })
  1321. if (this.table.getdataListParm.parammaps.all.charAt(this.table.getdataListParm.parammaps.all.length - 1) == '/') {
  1322. this.table.getdataListParm.parammaps.all = this.table.getdataListParm.parammaps.all.slice(0, this.table.getdataListParm.parammaps.all.length - 1)
  1323. }
  1324. this.arrowDown = true
  1325. this.arrowUp = false
  1326. },
  1327. handleRefresh() {
  1328. console.log('点击了重置')
  1329. this.table.getdataListParm.offset = 1
  1330. this.table.getdataListParm.parammaps.ccid = ''
  1331. this.table.getdataListParm.parammaps.ccname = ''
  1332. this.table.getdataListParm.parammaps.fttype = ''
  1333. this.table.getdataListParm.parammaps.tname = ''
  1334. this.table.getdataListParm.parammaps.remark = ''
  1335. this.table.getdataListParm.parammaps.enable = '1'
  1336. this.table.getdataListParm.parammaps.source = ''
  1337. this.table.getdataListParm.parammaps.all = ''
  1338. this.getList()
  1339. },
  1340. // 模板新增
  1341. handleCreate() {
  1342. // 编辑true/不可编辑false
  1343. // 新增操true,编辑false,编辑保存false
  1344. for (let i = 0; i < this.table.list.length; i++) {
  1345. if (this.table.list[i].Edit === true) {
  1346. this.$message({ type: 'error', message: this.$t('driver.messageNote'), duration: 2000 })
  1347. return false
  1348. }
  1349. }
  1350. this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1,'autozone':0, 'tname': '', tcode: '', 'tcolor': '#ccc', 'ccid': '', 'ccname': '', 'fttype': '', 'fttypeid': '','volume':'', 'source': '自定义', 'remark': '','cattle':'' })
  1351. console.log('点击了新增this.table.list====>', this.table.list)
  1352. this.table.temp = this.table.list[0]
  1353. this.getTcodeList()
  1354. },
  1355. getTcodeList() {
  1356. this.getTcodeParm.parammaps.pastureid = Cookies.get('pastureid')
  1357. console.log(this.table.temp, 'this.table.temp')
  1358. GetDataByName(this.getTcodeParm).then(response => {
  1359. if (response.data.list !== null) {
  1360. this.table.temp.tcode = response.data.list[0].tcode
  1361. } else {
  1362. this.table.temp.tcode = ''
  1363. }
  1364. })
  1365. },
  1366. // 畜生类别
  1367. changeLivestockType(item) {
  1368. this.table.temp.ccname = this.livestockTypeList.find(obj => obj.value === item).label
  1369. },
  1370. // 配方类型
  1371. changeFormulaType(item) {
  1372. this.table.temp.fttype = this.formulaTypeList.find(obj => obj.value === item).label
  1373. },
  1374. createData(row) {
  1375. console.log('点击了新增保存', row)
  1376. this.table.temp.tname = row.tname
  1377. this.table.temp.tcode = row.tcode
  1378. this.table.temp.tcolor = row.tcolor
  1379. this.table.temp.ccid = row.ccid
  1380. this.table.temp.ccname = this.table.temp.ccname
  1381. this.table.temp.fttype = this.table.temp.fttype
  1382. this.table.temp.fttypeid = row.fttypeid
  1383. this.table.temp.source = row.source
  1384. this.table.temp.remark = row.remark
  1385. this.table.temp.enable = row.enable
  1386. if(this.table.temp.volume == '' || this.table.temp.volume == null){
  1387. this.table.temp.volume = 0
  1388. }
  1389. if( isNaN(this.table.temp.autozone) || this.table.temp.autozone == '' || this.table.temp.autozone == undefined){
  1390. this.table.temp.autozone = 0
  1391. }
  1392. this.table.temp.volume = parseFloat(row.volume)
  1393. this.table.temp.pastureid = Cookies.get('pastureid')
  1394. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1395. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1396. return false
  1397. } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1398. this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })
  1399. return false
  1400. } else if (this.table.temp.tname == '') {
  1401. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1402. return false
  1403. } else if (this.table.temp.ccid == '') {
  1404. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1405. return false
  1406. } else if (this.table.temp.fttypeid == '') {
  1407. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1408. return false
  1409. }
  1410. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1411. // if (pattern.test(this.table.temp.tname)) {
  1412. // this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1413. // return false
  1414. // }
  1415. if (pattern.test(this.table.temp.tcode)) {
  1416. this.$message({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1417. return false
  1418. }
  1419. console.log(this.table.temp)
  1420. this.isokDisable = true
  1421. setTimeout(() => {
  1422. this.isokDisable = false
  1423. }, 1000)
  1424. this.requestParam2.name = 'checkNumber'
  1425. this.requestParam2.parammaps = {}
  1426. this.requestParam2.parammaps.number = this.table.temp.tcode
  1427. GetDataByName(this.requestParam2).then(response => {
  1428. console.log('table数据', response.data.list)
  1429. if (response.data.list[0].vmsg !== '输入非法字符') {
  1430. this.saveCreateData()
  1431. } else {
  1432. this.$notify({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1433. }
  1434. })
  1435. },
  1436. saveCreateData() {
  1437. this.requestParam.name = 'insertFT'
  1438. this.requestParam.parammaps = this.table.temp
  1439. PostDataByName(this.requestParam).then(response => {
  1440. console.log('新增保存发送参数', this.requestParam)
  1441. if (response.msg !== 'fail') {
  1442. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1443. this.getList()
  1444. let data = {}
  1445. data.name = 'insertFeedtemplethistory'
  1446. data.parammaps = this.table.temp
  1447. PostDataByName(data).then(response => {
  1448. if (response.msg !== 'fail') {
  1449. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1450. this.getList()
  1451. } else {
  1452. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1453. }
  1454. })
  1455. } else {
  1456. const isRepeat = new RegExp('Duplicate entry :feedtemplet.tCode')
  1457. if (isRepeat.test(response.data)) {
  1458. this.$notify({ type: 'error', message: '配方编码不可重复,请重新录入', duration: 2000 })
  1459. } else {
  1460. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1461. }
  1462. }
  1463. })
  1464. },
  1465. createCancel(row) {
  1466. console.log('点击了新增取消')
  1467. for (let i = 0; i < this.table.list.length; i++) {
  1468. if (row.myId === this.table.list[i].myId) {
  1469. var listIndex = this.table.list.indexOf(this.table.list[i])
  1470. }
  1471. if (listIndex > -1) {
  1472. this.table.list.splice(listIndex, 1)
  1473. return
  1474. }
  1475. }
  1476. },
  1477. // 模板编辑
  1478. handleUpdate(row) {
  1479. for (let i = 0; i < this.table.list.length; i++) {
  1480. if (this.table.list[i].Edit == true) {
  1481. this.$message({ type: 'error', message: this.$t('driver.messageNote'), duration: 2000 })
  1482. return false
  1483. }
  1484. }
  1485. // 编辑true,不可编辑false
  1486. row.Edit = true
  1487. row.NoEdit = false
  1488. // 新增false,编辑false,编辑保存true
  1489. row.isCreate = false
  1490. row.isUpdate = false
  1491. row.isUpdateSave = true
  1492. if (row.ccname !== undefined) {
  1493. row.ccid = String(row.ccid)
  1494. }
  1495. this.table.temp.ccname = row.ccname
  1496. row.fttypeid = String(row.fttypeid)
  1497. this.table.temp.fttype = row.fttype
  1498. },
  1499. updateData(row) {
  1500. console.log('点击了编辑保存', row)
  1501. this.table.temp.tname = row.tname
  1502. this.table.temp.tcode = row.tcode
  1503. this.table.temp.tcolor = row.tcolor
  1504. this.table.temp.ccid = row.ccid
  1505. this.table.temp.fttypeid = row.fttypeid
  1506. this.table.temp.source = row.source
  1507. this.table.temp.remark = row.remark
  1508. this.table.temp.enable = row.enable
  1509. this.table.temp.ccname = this.table.temp.ccname
  1510. this.table.temp.fttype = this.table.temp.fttype
  1511. this.table.temp.pastureid = row.pastureid
  1512. this.table.temp.id = row.id
  1513. this.table.temp.cattle = row.cattle
  1514. this.table.temp.autozone = row.autozone
  1515. if(this.table.temp.volume == '' || this.table.temp.volume == null || this.table.temp.volume == undefined){
  1516. this.table.temp.volume = 0
  1517. }
  1518. if( isNaN(this.table.temp.autozone) || this.table.temp.autozone == '' || this.table.temp.autozone == undefined){
  1519. this.table.temp.autozone = 0
  1520. }
  1521. this.table.temp.volume = parseFloat(row.volume)
  1522. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1523. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1524. return false
  1525. } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1526. this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })
  1527. return false
  1528. } else if (this.table.temp.tname == '') {
  1529. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1530. return false
  1531. } else if (this.table.temp.ccid == '') {
  1532. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1533. return false
  1534. } else if (this.table.temp.fttypeid == '') {
  1535. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1536. return false
  1537. }
  1538. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1539. // if (pattern.test(this.table.temp.tname)) {
  1540. // this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1541. // return false
  1542. // }
  1543. if (pattern.test(this.table.temp.tcode)) {
  1544. this.$message({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1545. return false
  1546. }
  1547. console.log(this.table.temp)
  1548. this.isokDisable = true
  1549. setTimeout(() => {
  1550. this.isokDisable = false
  1551. }, 1000)
  1552. this.requestParam2 = {}
  1553. this.requestParam2.name = 'checkNumber'
  1554. this.requestParam2.parammaps = {}
  1555. this.requestParam2.parammaps.number = this.table.temp.tcode
  1556. GetDataByName(this.requestParam2).then(response => {
  1557. console.log('table数据', response.data.list)
  1558. if (response.data.list[0].vmsg !== '输入非法字符') {
  1559. this.saveUpdateData()
  1560. } else {
  1561. this.$notify({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1562. }
  1563. })
  1564. },
  1565. saveUpdateData() {
  1566. this.requestParam = {}
  1567. this.requestParam.name = 'updateFT'
  1568. if(this.table.temp.volume == '' || this.table.temp.volume == null || this.table.temp.volume == undefined || isNaN(this.table.temp.volume)){
  1569. this.table.temp.volume = 0
  1570. }
  1571. console.log( this.table.temp.volume,'----')
  1572. if( isNaN(this.table.temp.autozone) || this.table.temp.autozone == '' || this.table.temp.autozone == undefined){
  1573. this.table.temp.autozone = 0
  1574. }
  1575. this.requestParam.parammaps = this.table.temp
  1576. PostDataByName(this.requestParam).then(response => {
  1577. console.log('新增保存发送参数', this.requestParam)
  1578. if (response.msg !== 'fail') {
  1579. this.requestParam3 = {}
  1580. this.requestParam3.name = 'insertFTHistory'
  1581. this.requestParam3.type = 'e'
  1582. this.requestParam3.parammaps = {}
  1583. this.requestParam3.parammaps.id = this.table.temp.id
  1584. this.requestParam3.parammaps.createdate = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  1585. this.requestParam3.parammaps.userId = Cookies.get('employeid')
  1586. PostDataByName(this.requestParam3).then(response => {
  1587. console.log('新增保存发送参数', this.requestParam)
  1588. if (response.msg !== 'fail') {
  1589. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1590. this.getList()
  1591. } else {
  1592. const isRepeat = new RegExp('Duplicate entry :feedtemplet.tCode')
  1593. if (isRepeat.test(response.data)) {
  1594. this.$notify({ type: 'error', message: '配方编码不可重复,请重新录入', duration: 2000 })
  1595. } else {
  1596. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1597. }
  1598. }
  1599. })
  1600. } else {
  1601. const isRepeat = new RegExp('Duplicate entry :feedtemplet.tCode')
  1602. if (isRepeat.test(response.data)) {
  1603. this.$notify({ type: 'error', message: '配方编码不可重复,请重新录入', duration: 2000 })
  1604. } else {
  1605. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1606. }
  1607. }
  1608. })
  1609. },
  1610. updateCancel(row) {
  1611. console.log('点击了编辑取消')
  1612. // 编辑false,不可编辑true
  1613. row.Edit = false
  1614. row.NoEdit = true
  1615. // 新增false,编辑true,编辑保存false
  1616. row.isCreate = false
  1617. row.isUpdate = true
  1618. row.isUpdateSave = false
  1619. this.getList()
  1620. },
  1621. // 删除
  1622. handleRowDelete(row) {
  1623. console.log('点击了行内删除')
  1624. MessageBox.confirm('是否确认删除此信息?', {
  1625. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1626. }).then(() => {
  1627. const url = 'authdata/feedtemplet/del'
  1628. const data = {
  1629. ftId:row.id,
  1630. userId:Cookies.get('employeid')
  1631. }
  1632. postJson(url, data).then(response => {
  1633. if (response.msg === 'fail') {
  1634. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1635. } else {
  1636. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1637. this.getList()
  1638. this.isDetail = false
  1639. }
  1640. })
  1641. }).catch(() => {
  1642. this.$message({ type: 'info', message: '已取消删除' })
  1643. })
  1644. },
  1645. handleSelectionChange(val) {
  1646. console.log('勾选数据', val)
  1647. this.selectList = val
  1648. },
  1649. form_delete() {
  1650. console.log('点击了删除')
  1651. if (this.selectList.length == 0) {
  1652. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1653. } else {
  1654. MessageBox.confirm('是否确认删除此信息?', {
  1655. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1656. }).then(() => {
  1657. console.log(this.selectList)
  1658. this.requestParam.common = { 'returnmap': '0' }
  1659. this.requestParam.data = []
  1660. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1661. this.requestParam.data[0].children = []
  1662. this.requestParam.data[0].children[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  1663. id: '@insertSpotList.id',
  1664. pastureid: '@insertSpotList.pastureid'
  1665. }}
  1666. this.requestParam.data[0].children[1] = { 'name': 'deleteFT', 'type': 'e', 'parammaps': {
  1667. id: '@insertSpotList.id',
  1668. pastureid: '@insertSpotList.pastureid'
  1669. }}
  1670. ExecDataByConfig(this.requestParam).then(response => {
  1671. console.log('删除保存发送参数', this.requestParam)
  1672. if (response.msg === 'fail') {
  1673. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1674. } else {
  1675. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1676. this.getList()
  1677. }
  1678. })
  1679. })
  1680. }
  1681. },
  1682. // 复制
  1683. handleCopy() {
  1684. if (this.selectList.length == 0) {
  1685. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1686. } else {
  1687. MessageBox.confirm('是否确认复制此信息?', {
  1688. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1689. }).then(() => {
  1690. console.log(this.selectList)
  1691. this.requestParam.common = { 'returnmap': '0' }
  1692. this.requestParam.data = []
  1693. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1694. this.requestParam.data[0].children = []
  1695. this.requestParam.data[0].children[0] = { 'name': 'copyFT', 'type': 'e', 'parammaps': {
  1696. ftid: '@insertSpotList.id',
  1697. pastureid: '@insertSpotList.pastureid'
  1698. }}
  1699. ExecDataByConfig(this.requestParam).then(response => {
  1700. console.log('复制保存发送参数', this.requestParam)
  1701. if (response.msg === 'fail') {
  1702. this.$notify({ title: '复制失败', message: response.data, type: 'warning', duration: 2000 })
  1703. } else {
  1704. this.$notify({ title: '', message: '复制成功', type: 'success', duration: 2000 })
  1705. this.getList()
  1706. }
  1707. })
  1708. })
  1709. }
  1710. },
  1711. // 配方记录
  1712. handleRecipeRecord() {
  1713. console.log('点击了配方记录')
  1714. this.template.dialogStatus = 'RecipeRecord'
  1715. this.dialogFull = false
  1716. this.template.dialogFormVisible = true
  1717. this.template.table.getdataListParm.parammaps.ccname = ''
  1718. this.template.table.getdataListParm.parammaps.fttype = ''
  1719. this.template.table.getdataListParm.parammaps.enable = ''
  1720. this.template.table.getdataListParm.parammaps.tname = ''
  1721. this.template.table.getdataListParm.parammaps.remark = ''
  1722. this.template.table.getdataListParm.parammaps.source = ''
  1723. this.template.table.getdataListParm.offset = 1
  1724. this.getDateList()
  1725. this.isDetailDialog = false
  1726. this.myheight2 = document.documentElement.clientHeight - 85 - 265
  1727. },
  1728. // 历史时间
  1729. getDateList() {
  1730. GetDataByName(this.template.getdataDateParm).then(response => {
  1731. console.log('table数据', response.data.list)
  1732. if (response.data.list !== null) {
  1733. this.template.table.getdataListParm.parammaps.date = response.data.list[0].maxdate
  1734. this.getTemplateDialogList()
  1735. } else {
  1736. this.template.table.getdataListParm.parammaps.date = ''
  1737. }
  1738. })
  1739. },
  1740. // 配方记录-模板
  1741. getTemplateDialogList() {
  1742. this.template.table.listLoading = true
  1743. GetDataByName(this.template.table.getdataListParm).then(response => {
  1744. console.log('table数据', response.data.list)
  1745. if (response.data.list !== null) {
  1746. this.template.table.list = response.data.list
  1747. this.template.table.pageNum = response.data.pageNum
  1748. this.template.table.pageSize = response.data.pageSize
  1749. this.template.table.total = response.data.total
  1750. } else {
  1751. this.template.table.list = []
  1752. this.template.table2.list = []
  1753. }
  1754. setTimeout(() => {
  1755. this.template.table.listLoading = false
  1756. }, 100)
  1757. })
  1758. },
  1759. handleDialogSearch() {
  1760. this.template.table.getdataListParm.offset = 1
  1761. this.getTemplateDialogList()
  1762. this.arrowDown = true
  1763. this.arrowUp = false
  1764. },
  1765. handleDialogRefresh() {
  1766. this.template.table.getdataListParm.parammaps.ccname = ''
  1767. this.template.table.getdataListParm.parammaps.fttype = ''
  1768. this.template.table.getdataListParm.parammaps.enable = ''
  1769. this.template.table.getdataListParm.parammaps.tname = ''
  1770. this.template.table.getdataListParm.parammaps.remark = ''
  1771. this.template.table.getdataListParm.parammaps.source = ''
  1772. this.template.table.getdataListParm.offset = 1
  1773. this.getTemplateDialogList()
  1774. },
  1775. // 配方记录-模板行点击
  1776. tableRowClickDialog(row, column, event) {
  1777. console.log('配方记录-模板行点击')
  1778. this.isDetailDialog = true
  1779. this.template.table2.getdataListParm.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1780. this.template.table2.getdataListParm.parammaps.version = row.version
  1781. this.template.table2.getdataListParm.parammaps.ftid = row.id
  1782. this.template.table2.getdataListParm.parammaps.dryweight = row.dryweight
  1783. this.myheight2 = document.documentElement.clientHeight - 85 - 265 - 185
  1784. this.getDialogList()
  1785. this.getDownList()
  1786. // aiaiaiai
  1787. },
  1788. getDialogList() {
  1789. this.template.table2.listLoading = true
  1790. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1791. console.log('table数据', response.data.list)
  1792. if (response.data.list !== null) {
  1793. this.template.table2.list = response.data.list
  1794. this.template.table2.pageNum = response.data.pageNum
  1795. this.template.table2.pageSize = response.data.pageSize
  1796. this.template.table2.total = response.data.total
  1797. } else {
  1798. this.template.table2.list = []
  1799. }
  1800. this.$nextTick(function() {
  1801. document.querySelector('#detailDialog2').scrollIntoView()
  1802. // window.scrollTo({
  1803. // 'top': this.$refs.detailDialog2.clientHeight
  1804. // })
  1805. })
  1806. setTimeout(() => {
  1807. this.template.table2.listLoading = false
  1808. }, 100)
  1809. })
  1810. },
  1811. handleDialogSearch2() {
  1812. console.log('点击了查询')
  1813. this.arrowDown2 = true
  1814. this.arrowUp2 = false
  1815. this.template.table2.getdataListParm.offset = 1
  1816. this.getDialogList2()
  1817. },
  1818. handleDialogRefresh2() {
  1819. console.log('点击了重置')
  1820. this.template.table2.getdataListParm.parammaps.fname = ''
  1821. this.template.table2.getdataListParm.parammaps.feedgroup = ''
  1822. this.template.table2.getdataListParm.parammaps.fweight = ''
  1823. this.template.table2.getdataListParm.parammaps.autosecondname = ''
  1824. this.template.table2.getdataListParm.parammaps.islockcount = '0'
  1825. this.template.table2.getdataListParm.parammaps.sort = ''
  1826. this.template.table2.getdataListParm.offset = 1
  1827. this.getDialogList2()
  1828. },
  1829. getDialogList2() {
  1830. this.template.table2.listLoading = true
  1831. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1832. console.log('table数据', response.data.list)
  1833. if (response.data.list !== null) {
  1834. this.template.table2.list = response.data.list
  1835. this.template.table2.pageNum = response.data.pageNum
  1836. this.template.table2.pageSize = response.data.pageSize
  1837. this.template.table2.total = response.data.total
  1838. } else {
  1839. this.template.table2.list = []
  1840. }
  1841. this.$nextTick(function() {
  1842. window.scrollTo({
  1843. 'top': this.$refs.templateDialog.clientHeight
  1844. })
  1845. })
  1846. setTimeout(() => {
  1847. this.template.table2.listLoading = false
  1848. }, 100)
  1849. })
  1850. },
  1851. // 导出
  1852. handleExport(item) {
  1853. if (item == 1) {
  1854. console.log('点击了导出模板')
  1855. const requestParam = this.requestParam
  1856. const url = Cookies.get('url') + 'file/导入导出模板/配方计划/配方模板导入模板.xlsx' // 请求下载文件的地址
  1857. console.log(url)
  1858. axios({
  1859. method: 'GET',
  1860. url: url,
  1861. data: requestParam,
  1862. headers: { token: getToken(), optname: 'insertcustomdoc' },
  1863. responseType: 'blob'
  1864. }).then(res => {
  1865. if (!res) return
  1866. this.percentage = 99
  1867. setTimeout(() => {
  1868. this.isPercentage = false
  1869. }, 2000)
  1870. const blob = new Blob([res.data], {
  1871. type: 'application/octet-stream;charset=utf-8'
  1872. })
  1873. const url = window.URL.createObjectURL(blob)
  1874. const aLink = document.createElement('a')
  1875. aLink.style.display = 'none'
  1876. aLink.href = url
  1877. const docname = '配方模板导入模板.xlsx'
  1878. aLink.setAttribute('download', docname) // 下载的文件
  1879. document.body.appendChild(aLink)
  1880. aLink.click()
  1881. document.body.removeChild(aLink)
  1882. window.URL.revokeObjectURL(url)
  1883. })
  1884. } else {
  1885. console.log('点击了导出数据')
  1886. this.download.getdataListParm.name = 'downloadFTList'
  1887. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  1888. GetDataByName(this.download.getdataListParm).then(response => {
  1889. if (response.data.list !== null) {
  1890. for (let i = 0; i < response.data.list.length; i++) {
  1891. if (response.data.list[i].islockcount == 0) {
  1892. this.$set(response.data.list[i], 'islockcount', '否')
  1893. } else {
  1894. this.$set(response.data.list[i], 'islockcount', '是')
  1895. }
  1896. if (response.data.list[i].enable == 0) {
  1897. this.$set(response.data.list[i], 'enable', '否')
  1898. } else {
  1899. this.$set(response.data.list[i], 'enable', '是')
  1900. }
  1901. }
  1902. this.download.list = response.data.list
  1903. } else {
  1904. this.download.list = []
  1905. }
  1906. var excelDatas = [
  1907. {
  1908. tHeader: ['配方名称', '配方编码', '牲畜类别', '配方类型', '来源', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '顺序'],
  1909. filterVal: ['tname', 'tcode', 'ccname', 'fttype', 'source', 'remark', 'enable', 'feedgroup', 'fname', 'fweight', 'autosecond', 'islockcount', 'sort'],
  1910. tableDatas: this.download.list,
  1911. sheetName: 'Sheet1'
  1912. }
  1913. ]
  1914. json2excel(excelDatas, '配方模板', true, 'xlsx')
  1915. })
  1916. }
  1917. },
  1918. beforeImport(file) {
  1919. const isLt2M = file.size / 1024 / 1024 < 2
  1920. if (!isLt2M) {
  1921. this.$message.error('上传文件大小不能超过 2MB!')
  1922. }
  1923. return isLt2M
  1924. },
  1925. handleImportSuccess(res, file) {
  1926. this.getList()
  1927. if (res.msg === 'ok') {
  1928. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  1929. if (res.data.err_count > 0) {
  1930. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  1931. import('@/vendor/Export2Excel').then(excel => {
  1932. const list1 = res.data.result
  1933. const tHeader = [
  1934. '配方名称', '牲畜类别', '配方类型', '备注', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '错误信息'
  1935. ]
  1936. const filterVal = [
  1937. '配方名称', '牲畜类别', '配方类型', '备注', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', 'error_msg'
  1938. ]
  1939. const data1 = this.formatJson(filterVal, list1)
  1940. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '配方模板导入报错信息', autoWidth: true, bookType: 'xlsx' })
  1941. })
  1942. }
  1943. } else {
  1944. const isRepeat = new RegExp('Duplicate entry :feedtemplet_tname')
  1945. if (isRepeat.test(res.data)) {
  1946. this.$notify({ type: 'error', message: '配方名称不可重复,请重新录入', duration: 2000 })
  1947. return false
  1948. }
  1949. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  1950. }
  1951. },
  1952. formatJson(filterVal, jsonData) {
  1953. return jsonData.map(v =>
  1954. filterVal.map(j => {
  1955. if (j === 'timestamp') {
  1956. return parseTime(v[j])
  1957. } else {
  1958. return v[j]
  1959. }
  1960. })
  1961. )
  1962. },
  1963. changeDate() {
  1964. this.getTemplateDialogList()
  1965. },
  1966. // 应用
  1967. handleApplication() {
  1968. console.log('点击了应用')
  1969. MessageBox.confirm('是否确认将' + this.template.table.getdataListParm.parammaps.date + '的数据应用到当前?', {
  1970. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1971. }).then(() => {
  1972. this.requestParam.name = 'applyFTdate'
  1973. this.requestParam.parammaps = {}
  1974. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1975. this.requestParam.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1976. PostDataByName(this.requestParam).then(response => {
  1977. if (response.msg === 'fail') {
  1978. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1979. } else {
  1980. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1981. this.getTemplateDialogList()
  1982. this.getList()
  1983. }
  1984. })
  1985. }).catch(() => {
  1986. this.$message({ type: 'info', message: '已取消应用' })
  1987. })
  1988. },
  1989. // 模板行点击
  1990. tableRowClick(row, column, event) {
  1991. for (let i = 0; i < this.table.list.length; i++) {
  1992. if (this.table.list[i].Edit == true) {
  1993. return false
  1994. }
  1995. }
  1996. if (this.isOrder == false) {
  1997. this.$message({ type: 'error', message: '请保存或取消当前更改顺序操作', duration: 2000 })
  1998. } else {
  1999. if (column.label !== '操作') {
  2000. this.isDetail = true // 点击行显示详情
  2001. this.table2.getdataListParm.parammaps.tcolor = row.tcolor
  2002. this.table2.getdataListParm.parammaps.tname = row.tname
  2003. this.table2.getdataListParm.parammaps.ccname = row.ccname
  2004. this.table2.getdataListParm.parammaps.fttype = row.fttype
  2005. this.table2.getdataListParm.parammaps.ftid = row.id
  2006. this.table2.getdataListParm.parammaps.fttypeid = row.fttypeid
  2007. this.table2.getdataListParm.parammaps.dryweight = row.dryweight
  2008. if (row.fttype == '预混配方') {
  2009. this.requestParams[2].parammaps.type = '1'
  2010. } else {
  2011. this.requestParams[2].parammaps.type = ''
  2012. }
  2013. this.myheight = document.documentElement.clientHeight - 85 - 265 - 230
  2014. this.getList2()
  2015. this.getDownList()
  2016. }
  2017. }
  2018. },
  2019. handleCloseTable2() {
  2020. this.isDetail = false
  2021. this.myheight = ''
  2022. this.isEnlarge = true
  2023. },
  2024. handleDialogCloseTable2() {
  2025. this.isDetailDialog = false
  2026. this.myheight2 = document.documentElement.clientHeight - 85 - 265
  2027. },
  2028. // -------------------详情-----------------------------
  2029. // 获取是否显示是否锁定牛头数
  2030. getIsLockCount() {
  2031. GetDataByName(this.lockCount.getdataListParm).then(response => {
  2032. console.log(response.data.list)
  2033. if (response.data.list[0].inforvalue == 0) {
  2034. this.lockCount.isLockCount = false
  2035. } else {
  2036. this.lockCount.isLockCount = true
  2037. }
  2038. })
  2039. },
  2040. // 详情
  2041. getList2() {
  2042. this.table2.listLoading = true
  2043. GetDataByName(this.table2.getdataListParm).then(response => {
  2044. console.log('table数据', response.data.list)
  2045. if (response.data.list !== null) {
  2046. for (let i = 0; i < response.data.list.length; i++) {
  2047. this.$set(response.data.list[i], 'Edit', false) // 编辑
  2048. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  2049. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  2050. this.$set(response.data.list[i], 'isGroupDisabled', false) // 饲料组编辑禁止编辑
  2051. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  2052. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  2053. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  2054. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  2055. }
  2056. this.table2.getDryweightParm.parammaps = this.table2.getdataListParm.parammaps
  2057. this.getDryWeight()
  2058. // for (let i = 0; i < response.data.list.length; i++) {
  2059. // console.log(response.data.list[i].fweight, '===12333')
  2060. // }
  2061. this.table2.list = response.data.list
  2062. this.table2.pageNum = response.data.pageNum
  2063. this.table2.pageSize = response.data.pageSize
  2064. this.table2.total = response.data.total
  2065. } else {
  2066. this.table2.list = []
  2067. }
  2068. setTimeout(() => {
  2069. this.table2.listLoading = false
  2070. }, 100)
  2071. })
  2072. },
  2073. // 行拖拽
  2074. rowDrop() {
  2075. console.log(document.querySelector('#table2 .el-table__body-wrapper tbody'))
  2076. const tbody = document.querySelector('#table2 .el-table__body-wrapper tbody')
  2077. // this.sorTable()
  2078. const that = this
  2079. // Sortable.create(tbody, {
  2080. var sortable = Sortable.create(tbody, {
  2081. disabled: that.dropState,
  2082. onChoose({ newIndex, oldIndex }) {
  2083. console.log(that.isOrder, 'that.isOrder == false')
  2084. console.log(that.dropState, 'that.dropState')
  2085. if (that.dropState == true || that.isOrder == true) {
  2086. sortable.destroy()
  2087. }
  2088. },
  2089. onEnd({ newIndex, oldIndex }) {
  2090. const currRow = that.table2.list.splice(oldIndex, 1)[0]
  2091. that.table2.list.splice(newIndex, 0, currRow)
  2092. console.log('索引', newIndex)
  2093. console.log('拖动数据', currRow)
  2094. console.log('上', that.table2.list[newIndex - 1])
  2095. console.log('下', that.table2.list[newIndex + 1])
  2096. if (that.table2.list[newIndex - 1] === undefined) { // 拖动至最上方无值 // 顺序等于0,其他+1 // 饲料组等于饲料名称
  2097. for (let i = 0; i < that.table2.list.length; i++) {
  2098. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1 // 其他的顺序+1
  2099. }
  2100. currRow.sort = 0
  2101. currRow.feedgroup = currRow.fname
  2102. console.log('拖动至最上方无值')
  2103. } else if (currRow.sort == that.table2.list[newIndex - 1].sort) { // 拖动值顺序等于上值顺序
  2104. currRow.sort = that.table2.list[newIndex - 1].sort
  2105. console.log('拖动值顺序等于上值顺序')
  2106. } else if (that.table2.list[newIndex + 1] == undefined) { // 拖动至最下方无值 // 顺序等于上方顺序+1 // 饲料组等于饲料名称
  2107. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  2108. currRow.feedgroup = currRow.fname
  2109. console.log('拖动至最下方无值')
  2110. } else if (currRow.sort == that.table2.list[newIndex + 1].sort) { // 拖动值顺序等于下值顺序
  2111. currRow.sort == that.table2.list[newIndex + 1].sort
  2112. console.log('拖动值顺序等于下值顺序')
  2113. } else if (that.table2.list[newIndex - 1].sort == that.table2.list[newIndex + 1].sort) { // 拖动至上下顺序一致,顺序/饲料组与上下保持一致
  2114. currRow.sort = that.table2.list[newIndex - 1].sort
  2115. currRow.feedgroup = that.table2.list[newIndex - 1].feedgroup
  2116. console.log('拖动至上下顺序一致')
  2117. } else if (that.table2.list[newIndex - 1].sort !== undefined && that.table2.list[newIndex + 1].sort !== undefined) { // 拖动至上下都有值
  2118. console.log('上下')
  2119. if (parseInt(that.table2.list[newIndex - 1].sort) + 1 == that.table2.list[newIndex + 1].sort) {
  2120. console.log(newIndex)
  2121. for (let i = newIndex; i < that.table2.list.length; i++) {
  2122. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1
  2123. }
  2124. }
  2125. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  2126. currRow.feedgroup = currRow.fname
  2127. console.log(that.table2.list[newIndex + 1].sort)
  2128. }
  2129. }
  2130. })
  2131. console.log(sortable.option('disabled'))
  2132. },
  2133. handleChangeOrder() {
  2134. this.isOrder = false
  2135. this.rowDrop()
  2136. },
  2137. saveChangeOrder() {
  2138. // 保存顺序
  2139. console.log(this.table2.list)
  2140. this.requestParam = {}
  2141. this.requestParam.common = { 'returnmap': '0' }
  2142. this.requestParam.data = []
  2143. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table2.list }}
  2144. this.requestParam.data[0].children = []
  2145. this.requestParam.data[0].children[0] = { 'name': 'updateFTdetailSort', 'type': 'e', 'parammaps': {
  2146. id: '@insertSpotList.id',
  2147. pastureid: '@insertSpotList.pastureid',
  2148. sort: '@insertSpotList.sort',
  2149. feedgroup: '@insertSpotList.feedgroup'
  2150. }}
  2151. ExecDataByConfig(this.requestParam).then(response => {
  2152. console.log('顺序切换保存发送参数', this.requestParam)
  2153. if (response.msg === 'fail') {
  2154. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  2155. } else {
  2156. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  2157. this.getList2()
  2158. this.getList3()
  2159. this.isOrder = true
  2160. }
  2161. })
  2162. },
  2163. cancelChangeOrder() {
  2164. // 取消顺序
  2165. this.getList2()
  2166. this.isOrder = true
  2167. },
  2168. form_search2() {
  2169. console.log('点击了查询')
  2170. this.arrowDown2 = true
  2171. this.arrowUp2 = false
  2172. this.table2.getdataListParm.offset = 1
  2173. // fname, feedgroup, fweight, autosecondname, islockcount, sort
  2174. // this.table2.getdataListParm.parammaps.all = this.table2.getdataListParm.parammaps.fname + ' ' + this.table2.getdataListParm.parammaps.feedgroup + ' ' + this.table2.getdataListParm.parammaps.fweight + ' ' + this.table2.getdataListParm.parammaps.autosecondname + ' ' + this.table2.getdataListParm.parammaps.islockcount + ' ' + this.table2.getdataListParm.parammaps.sort
  2175. this.table2.getdataListParm.parammaps.all = ''
  2176. var obj = {}
  2177. obj.fname = this.table2.getdataListParm.parammaps.fname
  2178. obj.feedgroup = this.table2.getdataListParm.parammaps.feedgroup
  2179. obj.fweight = this.table2.getdataListParm.parammaps.fweight
  2180. obj.autosecondname = this.table2.getdataListParm.parammaps.autosecondname
  2181. if (this.table2.getdataListParm.parammaps.islockcount !== '') {
  2182. if (this.table2.getdataListParm.parammaps.islockcount == 0) {
  2183. this.table2.getdataListParm.parammaps.islockcount = '否'
  2184. } else {
  2185. this.table2.getdataListParm.parammaps.islockcount = '是'
  2186. }
  2187. }
  2188. obj.islockcount = this.table2.getdataListParm.parammaps.islockcount
  2189. obj.sort = this.table2.getdataListParm.parammaps.sort
  2190. Object.getOwnPropertyNames(obj).forEach((key) => {
  2191. console.log(key, obj[key])
  2192. if (obj[key] !== '') {
  2193. this.table2.getdataListParm.parammaps.all += obj[key] + '/'
  2194. }
  2195. })
  2196. if (this.table2.getdataListParm.parammaps.all.charAt(this.table2.getdataListParm.parammaps.all.length - 1) == '/') {
  2197. this.table2.getdataListParm.parammaps.all = this.table2.getdataListParm.parammaps.all.slice(0, this.table2.getdataListParm.parammaps.all.length - 1)
  2198. }
  2199. this.getList2()
  2200. },
  2201. handleRefresh2() {
  2202. console.log('点击了重置')
  2203. this.table2.getdataListParm.parammaps.fname = ''
  2204. this.table2.getdataListParm.parammaps.feedgroup = ''
  2205. this.table2.getdataListParm.parammaps.fweight = ''
  2206. this.table2.getdataListParm.parammaps.autosecondname = ''
  2207. this.table2.getdataListParm.parammaps.islockcount = '0'
  2208. this.table2.getdataListParm.parammaps.sort = ''
  2209. this.table2.getdataListParm.parammaps.all = ''
  2210. this.table2.getdataListParm.offset = 1
  2211. this.getList2()
  2212. },
  2213. // 详情新增
  2214. handleCreate2() {
  2215. console.log('点击了详情新增', this.table2.list)
  2216. // 编辑true/不可编辑false
  2217. // 新增操true,编辑false,编辑保存false
  2218. console.log(11)
  2219. for (let i = 0; i < this.table2.list.length; i++) {
  2220. if (this.table2.list[i].Edit === true) {
  2221. console.log(123)
  2222. this.$message({ type: 'error', message: this.$t('driver.messageNote'), duration: 2000 })
  2223. return false
  2224. }
  2225. }
  2226. console.log(this.table2.list)
  2227. if (this.table2.list.length == 0) {
  2228. var mysort = 0
  2229. } else {
  2230. var mysort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2231. }
  2232. this.table2.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true, 'enable': 1, 'feedgroup': '', 'fid': '', 'fname': '', 'fweight': '', 'autosecond': '0','deviation':'0','islockcount': '0', 'sort': mysort,'shutdown':'0' })
  2233. console.log(this.table2.list)
  2234. },
  2235. changeFname(item, row) {
  2236. console.log(item, row)
  2237. this.table2.temp.fname = this.feedNameList.find(obj => obj.id == item).fname
  2238. row.fname = this.feedNameList.find(obj => obj.id == item).fname
  2239. if (this.feedNameList.find(obj => obj.id == item).ispreft == '0') {
  2240. this.table2.temp.preftid = '0'
  2241. } else {
  2242. this.table2.temp.preftid = item
  2243. }
  2244. if (row.sort == '') {
  2245. row.feedgroup = this.table2.temp.fname
  2246. } else {
  2247. if (row.isCreate == true) { // 新增状态下
  2248. for (let i = 1; i < this.table2.list.length; i++) {
  2249. if (this.table2.list[i].sort == row.sort) {
  2250. console.log(this.table2.list[i])
  2251. row.feedgroup = this.table2.list[i].feedgroup
  2252. break
  2253. } else {
  2254. row.feedgroup = this.table2.temp.fname
  2255. }
  2256. }
  2257. } else if (row.isUpdateSave == true) { // 编辑状态下
  2258. var Arr = []
  2259. for (let i = 0; i < this.table2.list.length; i++) {
  2260. Arr.push(this.table2.list[i].sort)
  2261. }
  2262. var Count = 0
  2263. for (let i = 0; i < Arr.length; i++) {
  2264. if (Arr[i] == row.sort) {
  2265. Count++
  2266. }
  2267. }
  2268. for (let i = 0; i < this.table2.list.length; i++) {
  2269. if (Count > 1) {
  2270. row.feedgroup = this.table2.list[i].feedgroup
  2271. console.log(this.table2.list[i].feedgroup)
  2272. break
  2273. } else if (Count == 1) {
  2274. row.feedgroup = this.table2.temp.fname
  2275. console.log(222, this.table2.temp.fname)
  2276. }
  2277. }
  2278. }
  2279. }
  2280. },
  2281. bort(row) {
  2282. if (row.isCreate == true) {
  2283. if (row.sort !== '') {
  2284. for (let i = 1; i < this.table2.list.length; i++) {
  2285. if (this.table2.list[i].sort == parseInt(row.sort)) {
  2286. row.feedgroup = this.table2.list[i].feedgroup
  2287. return false
  2288. } else {
  2289. row.feedgroup = row.fname
  2290. }
  2291. }
  2292. } else {
  2293. row.feedgroup = row.fname
  2294. }
  2295. } else if (row.isUpdateSave == true) {
  2296. if (row.sort !== '') {
  2297. for (let i = 0; i < this.table2.list.length; i++) {
  2298. if (this.table2.list[i].sort == row.sort) {
  2299. console.log('失去焦点,行内顺序与表格某顺序相同时', this.table2.list[i])
  2300. if (this.table2.list[i].id !== row.id) {
  2301. row.isGroupDisabled = true
  2302. row.feedgroup = this.table2.list[i].feedgroup
  2303. break
  2304. }
  2305. } else {
  2306. console.log('失去焦点,行内顺序与表格某顺序不相同时')
  2307. row.isGroupDisabled = true
  2308. row.feedgroup = row.fname
  2309. }
  2310. }
  2311. } else {
  2312. row.feedgroup = row.fname
  2313. }
  2314. }
  2315. },
  2316. createData2(row) {
  2317. console.log('点击了详情新增保存1', row)
  2318. this.table2.temp.pastureid = Cookies.get('pastureid')
  2319. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  2320. this.table2.temp.fid = row.fid
  2321. this.table2.temp.fname = this.table2.temp.fname
  2322. this.table2.temp.fweight = row.fweight
  2323. this.table2.temp.islockcount = row.islockcount
  2324. this.table2.temp.sort = row.sort
  2325. this.table2.temp.feedgroup = row.feedgroup
  2326. this.table2.temp.preftid = this.table2.temp.preftid
  2327. this.table2.temp.autosecond = row.autosecond
  2328. this.table2.temp.deviation = row.deviation
  2329. this.table2.temp.shutdown = row.shutdown
  2330. if (this.table2.temp.fid === '' && this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2331. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2332. return false
  2333. } else if (this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2334. this.$message({ type: 'error', message: '重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2335. return false
  2336. } else if (this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2337. this.$message({ type: 'error', message: '搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2338. return false
  2339. }else if (this.table2.temp.fid === '') {
  2340. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  2341. return false
  2342. }else if (this.table2.temp.fweight === '') {
  2343. this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  2344. return false
  2345. }else if (this.table2.temp.autosecond === '') {
  2346. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  2347. return false
  2348. } else if (this.table2.temp.deviation === '') {
  2349. this.$message({ type: 'error', message: '允许延时偏差不能为空', duration: 2000 })
  2350. return false
  2351. }
  2352. if(parseFloat(this.table2.temp.deviation) > parseFloat(this.table2.temp.autosecond)){
  2353. this.$message({ type: 'error', message: '允许延时偏差不可超出搅拌延时', duration: 2000 })
  2354. return false
  2355. }
  2356. if (this.table2.temp.sort !== '') {
  2357. this.table2.temp.sort = this.table2.temp.sort
  2358. } else {
  2359. console.log(this.table2.list.length)
  2360. if (this.table2.list.length == 1) {
  2361. this.table2.temp.sort = 0
  2362. } else {
  2363. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2364. row.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2365. }
  2366. }
  2367. if (this.table2.temp.shutdown == '') {
  2368. this.table2.temp.shutdown = 0
  2369. }
  2370. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2371. if (parseInt(this.table2.temp.preftid) > 0) {
  2372. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  2373. return false
  2374. }
  2375. }
  2376. // 校验顺序是否>=0
  2377. var ruleSort = /^\d+$/
  2378. if (!ruleSort.test(this.table2.temp.sort)) {
  2379. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  2380. return false
  2381. }
  2382. // 检验重量>0
  2383. this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 4) // 根据默认参数设置小数位数
  2384. row.fweight = formatNum(row.fweight, 4)
  2385. // return
  2386. // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  2387. if (this.table2.temp.fweight == 0) {
  2388. this.$message({ type: 'error', message: '重量请输入正数,最多保留四位小数', duration: 2000 })
  2389. return false
  2390. }
  2391. this.isokDisable = true
  2392. setTimeout(() => {
  2393. this.isokDisable = false
  2394. }, 1000)
  2395. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2396. this.requestParam.common = { 'returnmap': '0' }
  2397. this.requestParam.createdate = dateTime
  2398. this.requestParam.userId = Cookies.get('employeid')
  2399. this.requestParam.data = []
  2400. this.requestParam.data[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  2401. pastureid: this.table2.temp.pastureid,
  2402. ftid: this.table2.getdataListParm.parammaps.ftid,
  2403. fid: row.fid,
  2404. fname: this.table2.temp.fname,
  2405. fweight: String(row.fweight),
  2406. islockcount: row.islockcount,
  2407. sort: row.sort,
  2408. feedgroup: row.feedgroup,
  2409. preftid: this.table2.temp.preftid,
  2410. autosecond: row.autosecond,
  2411. deviation: row.deviation,
  2412. shutdown: this.table2.temp.shutdown,
  2413. }}
  2414. this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2415. pastureid: this.table2.temp.pastureid,
  2416. ftid: this.table2.getdataListParm.parammaps.ftid,
  2417. type: this.table2.getdataListParm.parammaps.fttypeid,
  2418. status: 0
  2419. }}
  2420. this.requestParam.data[2] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2421. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2422. id: this.table2.getdataListParm.parammaps.ftid
  2423. }}
  2424. this.requestParam.data[3] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2425. weight: row.fweight,
  2426. preftid: this.table2.temp.preftid,
  2427. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2428. ftid: this.table2.getdataListParm.parammaps.ftid,
  2429. dateTime: dateTime,
  2430. slid: 0,
  2431. fid: row.fid,
  2432. autosecond: row.autosecond,
  2433. userId: Cookies.get('employeid')
  2434. }}
  2435. this.requestParam.data[4] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2436. id:this.table2.getdataListParm.parammaps.ftid,
  2437. createdate:dateTime,
  2438. userId: Cookies.get('employeid')
  2439. }}
  2440. const url = 'authdata/ftdetail/edit'
  2441. const data = this.requestParam
  2442. postJson(url, data).then(response => {
  2443. if (response.msg !== 'fail') {
  2444. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2445. this.getList2()
  2446. this.getList3()
  2447. } else {
  2448. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2449. }
  2450. })
  2451. // ExecDataByConfig(this.requestParam).then(response => {
  2452. // console.log('新增保存发送参数', this.requestParam)
  2453. // if (response.msg !== 'fail') {
  2454. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2455. // this.getList2()
  2456. // this.getList3()
  2457. // } else {
  2458. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2459. // }
  2460. // })
  2461. },
  2462. createCancel2(row) {
  2463. console.log('点击了详情新增取消')
  2464. for (let i = 0; i < this.table2.list.length; i++) {
  2465. if (row.myId === this.table2.list[i].myId) {
  2466. var listIndex = this.table2.list.indexOf(this.table2.list[i])
  2467. }
  2468. if (listIndex > -1) {
  2469. this.table2.list.splice(listIndex, 1)
  2470. return
  2471. }
  2472. }
  2473. this.getDialogList()
  2474. },
  2475. // 详情编辑
  2476. handleUpdate2(row) {
  2477. console.log('详情编辑', row)
  2478. this.dropState = true
  2479. row.isGroupDisabled = false
  2480. row.islockcount = String(row.islockcount)
  2481. row.fid = String(row.fid)
  2482. // row.autosecond = String(row.autosecond)
  2483. row.autosecond = row.autosecond
  2484. row.deviation = row.deviation
  2485. this.table2.temp.fname = row.fname
  2486. this.table2.temp.preftid = row.preftid
  2487. const rowArr = []
  2488. for (let i = 0; i < this.table2.list.length; i++) {
  2489. if (this.table2.list[i].Edit == true) {
  2490. this.$message({ type: 'error', message: this.$t('driver.messageNote'), duration: 2000 })
  2491. return false
  2492. }
  2493. rowArr.push(this.table2.list[i].sort)
  2494. }
  2495. var count = 0
  2496. for (let i = 0; i < rowArr.length; i++) {
  2497. if (rowArr[i] == row.sort) {
  2498. count++
  2499. }
  2500. }
  2501. // 判断是否有相同顺序,如果没有饲料组不可编辑,若有饲料组可编辑
  2502. if (count == 1) {
  2503. // 饲料组编辑false,不可编辑true
  2504. row.groupEdit = false
  2505. row.groupNoEdit = true
  2506. // 编辑true,不可编辑false
  2507. row.Edit = true
  2508. row.NoEdit = false
  2509. // 新增false,编辑false,编辑保存true
  2510. row.isCreate = false
  2511. row.isUpdate = false
  2512. row.isUpdateSave = true
  2513. } else if (count > 1) {
  2514. // 饲料组编辑true,不可编辑false
  2515. row.groupEdit = true
  2516. row.groupNoEdit = false
  2517. console.log(222)
  2518. // 编辑true,不可编辑false
  2519. row.Edit = true
  2520. row.NoEdit = false
  2521. // 新增false,编辑false,编辑保存true
  2522. row.isCreate = false
  2523. row.isUpdate = false
  2524. row.isUpdateSave = true
  2525. return false
  2526. }
  2527. this.table2.updateList = Object.assign({}, row)
  2528. },
  2529. updateData2(row) {
  2530. console.log('点击了详情编辑保存', row)
  2531. this.isokDisable = true
  2532. setTimeout(() => {
  2533. this.isokDisable = false
  2534. }, 1000)
  2535. console.log(row.autosecond,'======')
  2536. if(row.autosecond == null || row.autosecond == undefined || isNaN(row.autosecond)){
  2537. row.autosecond = '0'
  2538. }
  2539. this.table2.temp.pastureid = row.pastureid
  2540. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  2541. this.table2.temp.fid = row.fid
  2542. this.table2.temp.fname = this.table2.temp.fname
  2543. this.table2.temp.fweight = row.fweight
  2544. this.table2.temp.islockcount = row.islockcount
  2545. this.table2.temp.sort = row.sort
  2546. this.table2.temp.feedgroup = row.feedgroup
  2547. this.table2.temp.preftid = this.table2.temp.preftid
  2548. this.table2.temp.autosecond = row.autosecond
  2549. this.table2.temp.deviation = row.deviation
  2550. this.table2.temp.shutdown = row.shutdown
  2551. this.table2.temp.id = row.id
  2552. console.log('this.table2.updateList', this.table2.updateList)
  2553. console.log('temp', this.table2.temp)
  2554. // var status = ''
  2555. // if (parseFloat(this.table2.temp.fweight) > parseFloat(this.table2.updateList.fweight)) {
  2556. // status = 0
  2557. // } else {
  2558. // status = 1
  2559. // }
  2560. if (this.table2.temp.fid === '' && this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2561. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2562. return false
  2563. } else if (this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2564. this.$message({ type: 'error', message: '重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2565. return false
  2566. } else if (this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2567. this.$message({ type: 'error', message: '搅拌延时/允许延时偏差不能为空1=', duration: 2000 })
  2568. return false
  2569. }else if (this.table2.temp.fid === '') {
  2570. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  2571. return false
  2572. }else if (this.table2.temp.fweight === '') {
  2573. this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  2574. return false
  2575. }
  2576. else if (this.table2.temp.autosecond === '') {
  2577. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  2578. return false
  2579. } else if (this.table2.temp.deviation === '') {
  2580. this.$message({ type: 'error', message: '允许延时偏差不能为空', duration: 2000 })
  2581. return false
  2582. }
  2583. if(parseFloat(this.table2.temp.deviation) > parseFloat(this.table2.temp.autosecond)){
  2584. this.$message({ type: 'error', message: '允许延时偏差不可超出搅拌延时', duration: 2000 })
  2585. return false
  2586. }
  2587. if (this.table2.temp.shutdown == '') {
  2588. this.table2.temp.shutdown = 0
  2589. }
  2590. if (this.table2.temp.sort !== '') {
  2591. this.table2.temp.sort = this.table2.temp.sort
  2592. } else {
  2593. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2594. }
  2595. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2596. if (parseInt(this.table2.temp.preftid) > 0) {
  2597. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  2598. return false
  2599. }
  2600. }
  2601. // 校验顺序是否>=0
  2602. var ruleSort = /^\d+$/
  2603. if (!ruleSort.test(this.table2.temp.sort)) {
  2604. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  2605. return false
  2606. }
  2607. this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 4) // 根据默认参数设置小数位数
  2608. row.fweight = formatNum(row.fweight, 4)
  2609. // 检验重量>0
  2610. // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  2611. if (this.table2.temp.fweight == 0) {
  2612. this.$message({ type: 'error', message: '重量请输入正数,最多保留四位小数', duration: 2000 })
  2613. return false
  2614. }
  2615. console.log(row.fweight,'row.fweight')
  2616. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2617. this.requestParam.common = { 'returnmap': '0' }
  2618. this.requestParam.createdate = dateTime
  2619. this.requestParam.userId = Cookies.get('employeid')
  2620. this.requestParam.data = []
  2621. this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2622. pastureid: row.pastureid,
  2623. ftid: this.table2.getdataListParm.parammaps.ftid,
  2624. weight: String(row.fweight),
  2625. preftid: this.table2.temp.preftid,
  2626. dateTime: dateTime,
  2627. slid: this.table2.temp.id,
  2628. fid: row.fid,
  2629. autosecond: row.autosecond,
  2630. userId: Cookies.get('employeid')
  2631. }}
  2632. this.requestParam.data[1] = { 'name': 'updateFTdetail', 'type': 'e', 'parammaps': {
  2633. pastureid: row.pastureid,
  2634. ftid: this.table2.getdataListParm.parammaps.ftid,
  2635. fid: row.fid,
  2636. fname: this.table2.temp.fname,
  2637. fweight: String(row.fweight),
  2638. islockcount: row.islockcount,
  2639. sort: row.sort,
  2640. feedgroup: row.feedgroup,
  2641. preftid: this.table2.temp.preftid,
  2642. autosecond: row.autosecond,
  2643. id: row.id,
  2644. deviation:row.deviation,
  2645. shutdown: this.table2.temp.shutdown,
  2646. }}
  2647. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2648. pastureid: row.pastureid,
  2649. ftid: this.table2.getdataListParm.parammaps.ftid,
  2650. type: this.table2.getdataListParm.parammaps.fttypeid,
  2651. // status: status
  2652. }}
  2653. this.requestParam.data[3] = { 'name': 'updateFTdetailbySort', 'type': 'e', 'parammaps': {
  2654. pastureid: row.pastureid,
  2655. ftid: this.table2.getdataListParm.parammaps.ftid,
  2656. sort: row.sort,
  2657. feedgroup: row.feedgroup
  2658. }}
  2659. this.requestParam.data[4] = { 'name': 'updateFTdetailGroup', 'type': 'e', 'parammaps': {
  2660. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2661. ftid: this.table2.getdataListParm.parammaps.ftid
  2662. }}
  2663. this.requestParam.data[5] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2664. id:this.table2.getdataListParm.parammaps.ftid,
  2665. createdate:dateTime,
  2666. userId: Cookies.get('employeid')
  2667. }}
  2668. const url = 'authdata/ftdetail/edit'
  2669. const data = this.requestParam
  2670. postJson(url, data).then(response => {
  2671. if (response.msg !== 'fail') {
  2672. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2673. this.getList2()
  2674. this.getList3()
  2675. this.dropState = false
  2676. } else {
  2677. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2678. }
  2679. })
  2680. // ExecDataByConfig(this.requestParam).then(response => {
  2681. // console.log('新增保存发送参数', this.requestParam)
  2682. // if (response.msg !== 'fail') {
  2683. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2684. // this.getList2()
  2685. // this.getList3()
  2686. // this.dropState = false
  2687. // } else {
  2688. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2689. // }
  2690. // })
  2691. },
  2692. updateCancel2(row) {
  2693. console.log('点击了详情编辑取消')
  2694. // 饲料组编辑false,不可编辑true
  2695. row.groupEdit = false
  2696. row.groupNoEdit = true
  2697. // 编辑false,不可编辑true
  2698. row.Edit = false
  2699. row.NoEdit = true
  2700. // 新增false,编辑true,编辑保存false
  2701. row.isCreate = false
  2702. row.isUpdate = true
  2703. row.isUpdateSave = false
  2704. this.getList2()
  2705. this.dropState = false
  2706. },
  2707. // 详情删除
  2708. handleRowDelete2(row) {
  2709. console.log('点击了行内删除')
  2710. MessageBox.confirm('是否确认删除此信息?', {
  2711. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2712. }).then(() => {
  2713. console.log(this.table2.list.length)
  2714. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2715. if (this.table2.list.length > 1) {
  2716. this.requestParam.common = { 'returnmap': '0' }
  2717. this.requestParam.createdate = dateTime
  2718. this.requestParam.data = []
  2719. this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2720. pastureid: row.pastureid,
  2721. ftid: this.table2.getdataListParm.parammaps.ftid,
  2722. weight: 0,
  2723. preftid: row.preftid,
  2724. dateTime: dateTime,
  2725. slid: row.id,
  2726. fid: row.fid,
  2727. autosecond: row.autosecond,
  2728. userId: Cookies.get('employeid')
  2729. }}
  2730. this.requestParam.data[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2731. pastureid: row.pastureid,
  2732. id: row.id
  2733. }}
  2734. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2735. pastureid: row.pastureid,
  2736. ftid: this.table2.getdataListParm.parammaps.ftid,
  2737. type: this.table2.getdataListParm.parammaps.fttypeid,
  2738. status: 1
  2739. }}
  2740. this.requestParam.data[3] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2741. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2742. id: this.table2.getdataListParm.parammaps.ftid
  2743. }}
  2744. this.requestParam.data[4] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2745. id:this.table2.getdataListParm.parammaps.ftid,
  2746. createdate:dateTime,
  2747. userId: Cookies.get('employeid')
  2748. }}
  2749. } else {
  2750. this.requestParam.common = { 'returnmap': '0' }
  2751. this.requestParam.createdate = dateTime
  2752. this.requestParam.userId = Cookies.get('employeid')
  2753. this.requestParam.data = []
  2754. // this.requestParam.data[1] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  2755. // pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2756. // id: this.table2.getdataListParm.parammaps.ftid
  2757. // }}
  2758. this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2759. pastureid: row.pastureid,
  2760. ftid: this.table2.getdataListParm.parammaps.ftid,
  2761. weight: 0,
  2762. preftid: row.preftid,
  2763. dateTime: dateTime,
  2764. slid: row.id,
  2765. fid: row.fid,
  2766. autosecond: row.autosecond,
  2767. userId: Cookies.get('employeid')
  2768. }}
  2769. this.requestParam.data[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2770. pastureid: row.pastureid,
  2771. id: row.id
  2772. }}
  2773. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2774. pastureid: row.pastureid,
  2775. ftid: this.table2.getdataListParm.parammaps.ftid,
  2776. type: this.table2.getdataListParm.parammaps.fttypeid,
  2777. status: 1
  2778. }}
  2779. this.requestParam.data[3] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2780. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2781. id: this.table2.getdataListParm.parammaps.ftid
  2782. }}
  2783. this.requestParam.data[4] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2784. id:this.table2.getdataListParm.parammaps.ftid,
  2785. createdate:dateTime,
  2786. userId: Cookies.get('employeid')
  2787. }}
  2788. }
  2789. const url = 'authdata/ftdetail/edit'
  2790. const data = this.requestParam
  2791. postJson(url, data).then(response => {
  2792. if (response.msg !== 'fail') {
  2793. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2794. this.getList2()
  2795. this.getList3()
  2796. } else {
  2797. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2798. }
  2799. })
  2800. // ExecDataByConfig(this.requestParam).then(response => {
  2801. // console.log('新增保存发送参数', this.requestParam)
  2802. // if (response.msg === 'fail') {
  2803. // this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2804. // } else {
  2805. // this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2806. // this.getList2()
  2807. // this.getList3()
  2808. // }
  2809. // })
  2810. }).catch(() => {
  2811. this.$message({ type: 'info', message: '已取消删除' })
  2812. })
  2813. },
  2814. handleSelectionChange2(val) {
  2815. console.log('勾选数据', val)
  2816. this.selectList2 = val
  2817. },
  2818. celldblclick(row, column, cell, event) {
  2819. console.log(row, '=====')
  2820. this.handleUpdate2(row)
  2821. },
  2822. form_delete2() {
  2823. console.log('点击了删除')
  2824. if (this.selectList2.length == 0) {
  2825. this.$message({ type: 'error', message: '请选择配方详情', duration: 2000 })
  2826. } else {
  2827. MessageBox.confirm('是否确认删除此信息?', {
  2828. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2829. }).then(() => {
  2830. console.log(this.table2.list.length - this.selectList2.length)
  2831. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2832. if (this.table2.list.length - this.selectList2.length > 0) {
  2833. this.requestParam.common = { 'returnmap': '0' }
  2834. this.requestParam.createdate = dateTime
  2835. this.requestParam.userId = Cookies.get('employeid')
  2836. this.requestParam.data = []
  2837. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList2 }}
  2838. this.requestParam.data[0].children = []
  2839. this.requestParam.data[0].children[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2840. pastureid: '@insertSpotList.pastureid',
  2841. ftid: '@insertSpotList.ftid',
  2842. weight: 0,
  2843. preftid: '@insertSpotList.preftid',
  2844. dateTime: dateTime,
  2845. slid: '@insertSpotList.id',
  2846. fid: '@insertSpotList.fid',
  2847. autosecond: '@insertSpotList.autosecond',
  2848. userId: Cookies.get('employeid')
  2849. }}
  2850. this.requestParam.data[0].children[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2851. id: '@insertSpotList.id',
  2852. pastureid: '@insertSpotList.pastureid'
  2853. }}
  2854. this.requestParam.data[1] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2855. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2856. id: this.table2.getdataListParm.parammaps.ftid
  2857. }}
  2858. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2859. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2860. ftid:this.table2.getdataListParm.parammaps.ftid,
  2861. type: this.table2.getdataListParm.parammaps.fttypeid,
  2862. status: 1
  2863. }}
  2864. this.requestParam.data[3] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2865. id:this.table2.getdataListParm.parammaps.ftid,
  2866. createdate:dateTime,
  2867. userId: Cookies.get('employeid')
  2868. }}
  2869. const url = 'authdata/ftdetail/edit'
  2870. const data = this.requestParam
  2871. postJson(url, data).then(response => {
  2872. if (response.msg !== 'fail') {
  2873. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2874. this.getList2()
  2875. this.getList3()
  2876. } else {
  2877. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2878. }
  2879. })
  2880. } else {
  2881. this.requestParam.common = { 'returnmap': '0' }
  2882. this.requestParam.data = []
  2883. // this.requestParam.data[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  2884. // pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2885. // id: this.table2.getdataListParm.parammaps.ftid
  2886. // }}
  2887. // this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList2 }}
  2888. // this.requestParam.data[1].children = []
  2889. // this.requestParam.data[1].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2890. // id: '@insertSpotList.id',
  2891. // pastureid: '@insertSpotList.pastureid'
  2892. // }}
  2893. this.requestParam.data[0] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2894. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2895. id: this.table2.getdataListParm.parammaps.ftid
  2896. }}
  2897. // this.requestParam.data[3] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2898. // pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2899. // ftid:this.table2.getdataListParm.parammaps.ftid,
  2900. // type: this.table2.getdataListParm.parammaps.fttypeid,
  2901. // status: 1
  2902. // }}
  2903. ExecDataByConfig(this.requestParam).then(response => {
  2904. console.log('删除保存发送参数', this.requestParam)
  2905. if (response.msg === 'fail') {
  2906. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2907. } else {
  2908. const url = 'authdata/ftdetai/del'
  2909. const data = {}
  2910. data.parammaps = {}
  2911. data.parammaps.pastureid = this.table2.getdataListParm.parammaps.pastureid
  2912. data.parammaps.ftid = this.table2.getdataListParm.parammaps.ftid
  2913. data.parammaps.type = this.table2.getdataListParm.parammaps.fttypeid
  2914. postJson(url, data).then(response => {
  2915. if (response.msg !== 'fail') {
  2916. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2917. this.getList2()
  2918. this.getList3()
  2919. } else {
  2920. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2921. }
  2922. })
  2923. }
  2924. })
  2925. }
  2926. })
  2927. }
  2928. },
  2929. // 拆分预混料
  2930. handleSplitPremix(row) {
  2931. console.log('点击了拆分预混料')
  2932. MessageBox.confirm('是否确认拆分当前预混料?', {
  2933. confirmButtonText: '确认',
  2934. cancelButtonText: '取消',
  2935. type: 'warning'
  2936. }).then(() => {
  2937. this.requestParam.name = 'splitFTpre'
  2938. this.requestParam.parammaps = {}
  2939. this.requestParam.parammaps.ftid = this.table2.getdataListParm.parammaps.ftid
  2940. this.requestParam.parammaps.preftid = row.preftid
  2941. this.requestParam.parammaps.ftdid = row.id
  2942. this.requestParam.parammaps.pastureid = row.pastureid
  2943. this.requestParam.parammaps.feedgroup = row.feedgroup
  2944. this.requestParam.parammaps.sort = row.sort
  2945. this.requestParam.parammaps.fweight = row.fweight
  2946. PostDataByName(this.requestParam).then(response => {
  2947. if (response.msg === 'fail') {
  2948. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2949. } else {
  2950. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2951. this.getList2()
  2952. this.getList3()
  2953. }
  2954. })
  2955. }).catch(() => {
  2956. this.$message({
  2957. type: 'info',
  2958. message: '已取消删除'
  2959. })
  2960. })
  2961. },
  2962. // 合成预混料
  2963. handleSyntheticPremix() {
  2964. console.log('点击了合成预混料', this.selectList2)
  2965. this.dialogFull = false
  2966. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2967. this.$message({ type: 'error', message: '预混配方不可合成预混料', duration: 2000 })
  2968. return false
  2969. } else {
  2970. if (this.selectList2.length > 1) {
  2971. for (let i = 0; i < this.selectList2.length; i++) {
  2972. if (parseInt(this.selectList2[i].preftid) > 0) {
  2973. this.$message({ type: 'error', message: '不可选择预混料', duration: 2000 })
  2974. return false
  2975. }
  2976. }
  2977. if (this.selectList2[0].splitftpreid !== undefined) {
  2978. this.detail.getdataListParm.parammaps.ftid = this.selectList2[0].splitftpreid
  2979. this.detail.getdataListParm.parammaps.pastureid = this.selectList2[0].pastureid
  2980. GetDataByName(this.detail.getdataListParm).then(response => {
  2981. if (response.data.list !== null) { // 不为空时得到比对数据
  2982. this.detail.list3 = response.data.list
  2983. const sortList = [] // 声明排序数组
  2984. var fweightSum = 0 // 总重量
  2985. for (let i = 0; i < this.selectList2.length; i++) {
  2986. const obj = {}
  2987. obj.fid = this.selectList2[i].fid
  2988. obj.fweight = this.selectList2[i].fweight
  2989. fweightSum = fweightSum + parseFloat(this.selectList2[i].fweight)
  2990. sortList.push(obj)
  2991. }
  2992. // 排序
  2993. sortList.sort(function(a, b) {
  2994. return a.fid.localeCompare(b.fid)
  2995. })
  2996. var a = 0
  2997. if (this.detail.list3.length == sortList.length) {
  2998. for (let i = 0; i < this.detail.list3.length; i++) {
  2999. if (this.detail.list3[i].fid == sortList[i].fid && (this.detail.list3[i].fweight / this.detail.list3[i].sumWeight).toFixed(3) == (sortList[i].fweight / fweightSum).toFixed(3)) {
  3000. a++
  3001. }
  3002. }
  3003. if (a == this.detail.list3.length) { // 如果相等,则该配方为原预混配方
  3004. this.detail.getdataListParm2.parammaps.ftid = this.selectList2[0].splitftpreid
  3005. this.detail.getdataListParm2.parammaps.pastureid = this.selectList2[0].pastureid
  3006. GetDataByName(this.detail.getdataListParm2).then(response => {
  3007. if (response.data.list !== null) {
  3008. this.detail.dialogStatus = 'SyntheticPremix'
  3009. this.detail.dialogFormVisible = true
  3010. this.detail.list = this.selectList2
  3011. this.detail.list2 = response.data.list
  3012. this.detail.disabled = true
  3013. setTimeout(() => {
  3014. this.detail.listLoading = false
  3015. }, 100)
  3016. } else {
  3017. this.detail.list2 = []
  3018. }
  3019. })
  3020. } else {
  3021. this.detail.dialogStatus = 'SyntheticPremix'
  3022. this.detail.dialogFormVisible = true
  3023. this.detail.list = this.selectList2
  3024. this.detail.disabled = false
  3025. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1,volume:'' }]
  3026. setTimeout(() => {
  3027. this.detail.listLoading = false
  3028. }, 100)
  3029. }
  3030. } else {
  3031. this.detail.dialogStatus = 'SyntheticPremix'
  3032. this.detail.dialogFormVisible = true
  3033. this.detail.list = this.selectList2
  3034. this.detail.disabled = false
  3035. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1,volume:'' }]
  3036. setTimeout(() => {
  3037. this.detail.listLoading = false
  3038. }, 100)
  3039. }
  3040. } else {
  3041. this.detail.list3 = []
  3042. this.detail.dialogStatus = 'SyntheticPremix'
  3043. this.detail.dialogFormVisible = true
  3044. this.detail.list = this.selectList2
  3045. this.detail.disabled = false
  3046. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1,volume:'' }]
  3047. setTimeout(() => {
  3048. this.detail.listLoading = false
  3049. }, 100)
  3050. }
  3051. })
  3052. } else {
  3053. this.detail.dialogStatus = 'SyntheticPremix'
  3054. this.detail.dialogFormVisible = true
  3055. this.detail.list = this.selectList2
  3056. this.detail.disabled = false
  3057. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1,volume:'' }]
  3058. setTimeout(() => {
  3059. this.detail.listLoading = false
  3060. }, 100)
  3061. }
  3062. } else {
  3063. this.$message({ type: 'error', message: '请选择俩条及以上饲料进行合成', duration: 2000 })
  3064. return false
  3065. }
  3066. }
  3067. },
  3068. // 畜生类别
  3069. changeLivestockType2(item) {
  3070. this.detail.list2[0].ccname = this.livestockTypeList.find(obj => obj.value === item).label
  3071. },
  3072. syntheticPremixData() {
  3073. console.log('点击了合成预混料确认')
  3074. if (this.detail.disabled == true) { // 原预混料
  3075. let sumFweight = 0
  3076. for (let i = 0; i < this.detail.list.length; i++) {
  3077. sumFweight += parseFloat(this.detail.list[i].fweight)
  3078. }
  3079. sumFweight = sumFweight.toFixed(3)
  3080. this.isokDisable = true
  3081. setTimeout(() => {
  3082. this.isokDisable = false
  3083. }, 1000)
  3084. this.requestParam.common = { 'returnmap': '0' }
  3085. this.requestParam.data = []
  3086. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  3087. this.requestParam.data[0].children = []
  3088. this.requestParam.data[0].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  3089. pastureid: '@insertSpotList.pastureid',
  3090. id: '@insertSpotList.id'
  3091. }}
  3092. this.requestParam.data[1] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  3093. this.requestParam.data[1].children = []
  3094. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  3095. pastureid: Cookies.get('pastureid'),
  3096. ftid: this.table2.getdataListParm.parammaps.ftid,
  3097. fid: this.detail.list2[0].id,
  3098. fname: '@insertSpotList2.tname',
  3099. shutdown: '0',
  3100. fweight: sumFweight,
  3101. islockcount: '0',
  3102. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  3103. feedgroup: '@insertSpotList2.tname',
  3104. preftid: this.detail.list2[0].id,
  3105. autosecond: this.detail.list[0].autosecond
  3106. }}
  3107. ExecDataByConfig(this.requestParam).then(response => {
  3108. console.log('合成预混料保存发送参数', this.requestParam)
  3109. if (response.msg === 'fail') {
  3110. const tname = new RegExp("key 'tname'")
  3111. if (tname.test(response.data)) {
  3112. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  3113. } else {
  3114. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3115. }
  3116. } else {
  3117. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  3118. this.detail.dialogFormVisible = false
  3119. this.getList3()
  3120. this.getList2()
  3121. this.getDownList()
  3122. }
  3123. })
  3124. } else { // 现生成预混料
  3125. if (this.detail.list2[0].tname == '' && this.detail.list2[0].ccid == '') {
  3126. this.$message({ type: 'error', message: '配方名称/牲畜类别/不能为空', duration: 2000 })
  3127. return false
  3128. } else if (this.detail.list2[0].tname == '') {
  3129. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  3130. return false
  3131. } else if (this.detail.list2[0].ccid == '') {
  3132. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  3133. return false
  3134. }
  3135. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  3136. if (pattern.test(this.detail.list2[0].tname)) {
  3137. this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  3138. return false
  3139. }
  3140. let sumFweight = 0
  3141. for (let i = 0; i < this.detail.list.length; i++) {
  3142. sumFweight += parseFloat(this.detail.list[i].fweight)
  3143. }
  3144. sumFweight = sumFweight.toFixed(3)
  3145. console.log(sumFweight)
  3146. this.isokDisable = true
  3147. setTimeout(() => {
  3148. this.isokDisable = false
  3149. }, 1000)
  3150. if (this.detail.list2[0].tcolor == null) {
  3151. this.detail.list2[0].tcolor = '#CCCCCC'
  3152. }
  3153. this.requestParam.common = { 'returnmap': '0' }
  3154. this.requestParam.data = []
  3155. this.requestParam.data[0] = { 'name': 'insertFT', 'type': 'e', 'parammaps': {
  3156. pastureid: Cookies.get('pastureid'),
  3157. tcode: this.detail.list2[0].tcode,
  3158. tname: this.detail.list2[0].tname,
  3159. tcolor: this.detail.list2[0].tcolor,
  3160. ccid: this.detail.list2[0].ccid,
  3161. ccname: this.detail.list2[0].ccname,
  3162. fttype: this.detail.list2[0].fttype,
  3163. fttypeid: this.detail.list2[0].fttypeid,
  3164. source: this.detail.list2[0].source,
  3165. remark: this.detail.list2[0].remark,
  3166. enable: this.detail.list2[0].enable,
  3167. volume:this.detail.list2[0].volume
  3168. }}
  3169. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  3170. this.requestParam.data[1].children = []
  3171. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  3172. pastureid: '@insertSpotList.pastureid',
  3173. ftid: '@insertFT.LastInsertId',
  3174. fid: '@insertSpotList.fid',
  3175. fname: '@insertSpotList.fname',
  3176. fweight: '@insertSpotList.fweight',
  3177. islockcount: '@insertSpotList.islockcount',
  3178. sort: '@insertSpotList.sort',
  3179. feedgroup: '@insertSpotList.feedgroup',
  3180. preftid: '@insertSpotList.preftid',
  3181. autosecond: '@insertSpotList.autosecond',
  3182. shutdown: '@insertSpotList.shutdown'
  3183. }}
  3184. this.requestParam.data[1].children[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  3185. pastureid: '@insertSpotList.pastureid',
  3186. id: '@insertSpotList.id'
  3187. }}
  3188. this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  3189. this.requestParam.data[2].children = []
  3190. this.requestParam.data[2].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  3191. pastureid: Cookies.get('pastureid'),
  3192. ftid: this.table2.getdataListParm.parammaps.ftid,
  3193. fid: '@insertFT.LastInsertId',
  3194. fname: '@insertSpotList2.tname',
  3195. shutdown: '0',
  3196. fweight: sumFweight,
  3197. islockcount: '0',
  3198. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  3199. feedgroup: '@insertSpotList2.tname',
  3200. preftid: '@insertFT.LastInsertId',
  3201. autosecond: this.detail.list[0].autosecond
  3202. }}
  3203. ExecDataByConfig(this.requestParam).then(response => {
  3204. console.log('合成预混料保存发送参数', this.requestParam)
  3205. if (response.msg === 'fail') {
  3206. const tname = new RegExp("key 'tname'")
  3207. if (tname.test(response.data)) {
  3208. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  3209. } else {
  3210. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3211. }
  3212. } else {
  3213. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  3214. this.detail.dialogFormVisible = false
  3215. this.getList3()
  3216. this.getList2()
  3217. this.getDownList()
  3218. }
  3219. })
  3220. }
  3221. },
  3222. handleFormulationEvaluation(row) {
  3223. console.log(row)
  3224. // this.$router.push({ path: '/statisticalAnalysis/FormulationEvaluation', query: { tname: row.tname }})
  3225. this.$router.push({
  3226. name: 'FormulationEvaluation',
  3227. params: {
  3228. tname: row.tname,
  3229. ftid: row.id,
  3230. pastureid: row.pastureid,
  3231. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  3232. inputDatetime: [new Date('startTime'), new Date('startTime')], // 日期后台待传
  3233. stopTime: parseTime(new Date(), '{y}-{m}-{d}')
  3234. }
  3235. })
  3236. },
  3237. // 配方记录
  3238. handleRowRecipeRecord(row) {
  3239. console.log(row)
  3240. this.rowRecipeRecord.temp = Object.assign({}, row)
  3241. this.rowRecipeRecord.dialogFormVisible = true
  3242. this.textMap.rowRecipeRecordTxt = '配方修改记录——配方:' + row.tname
  3243. this.rowRecipeRecord.dialogStatus = 'rowRecipeRecordTxt'
  3244. this.rowRecipeRecord.getdataListParm.parammaps.pastureid = row.pastureid
  3245. this.rowRecipeRecord.getdataListParm.parammaps.fitid = row.id
  3246. this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime = []
  3247. this.getRowRecipeRecordList()
  3248. },
  3249. getRowRecipeRecordList() {
  3250. this.rowRecipeRecord.listLoading = true
  3251. this.rowRecipeRecord.getdataListParm.parammaps.fitid = this.rowRecipeRecord.temp.id
  3252. if (this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime == null) {
  3253. this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime = ''
  3254. this.rowRecipeRecord.getdataListParm.parammaps.startTime = ''
  3255. this.rowRecipeRecord.getdataListParm.parammaps.stopTime = ''
  3256. } else {
  3257. this.rowRecipeRecord.getdataListParm.parammaps.startTime = this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime[0]
  3258. this.rowRecipeRecord.getdataListParm.parammaps.stopTime = this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime[1]
  3259. }
  3260. const url = 'authdata/GetArrList'
  3261. const data = this.rowRecipeRecord.getdataListParm
  3262. postJson(url, data).then(response => {
  3263. if (response.data.list !== null) {
  3264. for (let i = 0; i < response.data.list.length; i++) {
  3265. if (response.data.list[i].arrList == null) {
  3266. this.$set(response.data.list[i], 'arrList', [])
  3267. }
  3268. }
  3269. this.rowRecipeRecord.list = response.data.list
  3270. this.rowRecipeRecord.pageNum = response.data.pageNum
  3271. this.rowRecipeRecord.pageSize = response.data.pageSize
  3272. this.rowRecipeRecord.total = response.data.total
  3273. } else {
  3274. this.rowRecipeRecord.list = []
  3275. this.rowRecipeRecord.total = 0
  3276. }
  3277. console.log(response.data, 'response.data')
  3278. setTimeout(() => {
  3279. this.rowRecipeRecord.listLoading = false
  3280. }, 100)
  3281. })
  3282. },
  3283. handleRowRecipeRecordSearch() {
  3284. this.getRowRecipeRecordList()
  3285. },
  3286. handleEnlarge() {
  3287. var height = (document.documentElement.clientHeight - 165 + 50).toString() + 'px'
  3288. // var height = (document.documentElement.clientHeight - 165 + 80).toString() + 'px'
  3289. // var height2 = '-' + (document.documentElement.clientHeight - 400).toString() + 'px'
  3290. var height2 = '-' + (this.$refs.template.offsetHeight).toString() + 'px'
  3291. // console.log(this.$refs.detail.offsetHeight)
  3292. // console.log(height2, 'height2')
  3293. this.isEnlarge = false
  3294. this.$refs.detail.style.top = height2
  3295. this.$refs.detail.style.height = height
  3296. this.$refs.appContainer.style.height = height
  3297. this.$refs.table2.style.height = 0
  3298. this.$refs.myContainer.style.posiiton = 'relative'
  3299. this.$refs.detail.style.posiiton = 'absolute'
  3300. },
  3301. handleNarrow() {
  3302. this.isEnlarge = true
  3303. this.$refs.detail.style.top = 0
  3304. this.$refs.detail.style.height = '300px'
  3305. this.$refs.myContainer.style.posiiton = ''
  3306. this.$refs.detail.style.posiiton = ''
  3307. this.$refs.detail.style.zIndex = ''
  3308. },
  3309. handleTakeEffect() {
  3310. if (this.selectList.length == 0) {
  3311. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  3312. } else {
  3313. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  3314. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3315. }).then(() => {
  3316. let ids = []
  3317. for (let i = 0; i < this.selectList.length; i++) {
  3318. ids.push(this.selectList[i].id)
  3319. }
  3320. var data = {}
  3321. data.parammaps = {}
  3322. data.parammaps.enable = 1
  3323. data.parammaps.id = ids.toString()
  3324. var url = 'authdata/feedtemplet/enable'
  3325. postJson(url,data).then(response => {
  3326. console.log('生效保存发送参数', data)
  3327. if (response.msg === 'fail') {
  3328. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  3329. } else {
  3330. this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
  3331. this.getList()
  3332. }
  3333. })
  3334. })
  3335. }
  3336. },
  3337. handleDisable() {
  3338. if (this.selectList.length == 0) {
  3339. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  3340. } else {
  3341. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  3342. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3343. }).then(() => {
  3344. let ids = []
  3345. for (let i = 0; i < this.selectList.length; i++) {
  3346. ids.push(this.selectList[i].id)
  3347. }
  3348. var data = {}
  3349. data.parammaps = {}
  3350. data.parammaps.enable = 0
  3351. data.parammaps.id = ids.toString()
  3352. console.log('禁用', data)
  3353. var url = 'authdata/feedtemplet/enable'
  3354. postJson(url,data).then(response => {
  3355. console.log('禁用保存发送参数', this.requestParam)
  3356. if (response.msg === 'fail') {
  3357. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  3358. } else {
  3359. this.$notify({ title: '', message: '禁用成功', type: 'success', duration: 2000 })
  3360. this.getList()
  3361. }
  3362. })
  3363. })
  3364. }
  3365. },
  3366. getIspalyUd(){
  3367. let url = 'authdata/GetDataByName'
  3368. let data = {
  3369. "name":"getSysoptEnable","page":1,"offset":1,"pagecount":1,"returntype":"Map",
  3370. "parammaps":{"pastureid":Cookies.get('pastureid'),"inforname":"gmUdSync"}
  3371. }
  3372. postJson(url,data).then(response => {
  3373. if (response.msg !== 'fail') {
  3374. if(response.data.list[0].inforvalue == 0){
  3375. this.ispalyUd = false
  3376. }else{
  3377. this.ispalyUd = true
  3378. }
  3379. } else {
  3380. this.$notify({ title: '请求失败', message: response.data, type: 'warning', duration: 2000 })
  3381. }
  3382. })
  3383. },
  3384. handleGetUd(){
  3385. MessageBox.confirm('是否上传配方?', {
  3386. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3387. }).then(() => {
  3388. let url = 'authdata/gm/udfeedtemplet/push'
  3389. let data = {
  3390. pastureId:Cookies.get('pastureid')
  3391. }
  3392. postJson(url,data).then(response => {
  3393. if (response.msg !== 'fail') {
  3394. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3395. this.getList()
  3396. } else {
  3397. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3398. }
  3399. })
  3400. })
  3401. }
  3402. }
  3403. }
  3404. </script>
  3405. <style lang="scss" scoped>
  3406. // .search{margin-top:10px;height: 40px;}
  3407. // .operation{height: 50px;}
  3408. .table{margin-top:5px;}
  3409. .table2{margin-top:10px;}
  3410. $width:350px;
  3411. $left:325px;
  3412. .selectInput{
  3413. position: relative;
  3414. display: inline-block;
  3415. .Input{width: $width;position: relative;}
  3416. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  3417. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  3418. .selectUl{
  3419. height:220px;overflow-y: auto;z-index: 111;width: $width;background: #fff;border: 1px solid #E4E7ED;box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);margin: -1px 0 0 0;padding: 6px 0; margin: 0;box-sizing: border-box;position: absolute;
  3420. li{
  3421. list-style: none;font-size: 14px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #606266; height: 50px; line-height: 50px; box-sizing: border-box; cursor: pointer;
  3422. a{float:left;width: 80px;}
  3423. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  3424. }
  3425. }
  3426. }
  3427. .template{
  3428. background: #fff;
  3429. position: relative;
  3430. }
  3431. .app-container{background: #fff;}
  3432. .detail{
  3433. background: #fff;
  3434. overflow-y: hidden;
  3435. overflow-x: hidden;
  3436. // position: fixed;
  3437. // bottom: 0;
  3438. // right:0;
  3439. z-index: 3;
  3440. // width: calc(100% - 210px);
  3441. position: relative;
  3442. }
  3443. .hide2{float: right;right:0;}
  3444. .templateDialog{
  3445. background: #fff;
  3446. position: relative;
  3447. }
  3448. .detailDialog{
  3449. background: #fff;
  3450. position: relative;
  3451. }
  3452. .hide{float: right;margin-right: 60px;}
  3453. </style>
  3454. <style>
  3455. .el-color-dropdown__main-wrapper{display: none !important;}
  3456. .el-color-dropdown__value{display: none !important;}
  3457. .el-color-dropdown__btns .el-button--text{display: none !important;}
  3458. </style>