index.vue 163 KB

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