index.vue 155 KB

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