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