index.vue 156 KB

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