index.vue 158 KB

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