2d2373709ca6af27ca238fea77ba34f02326ad69.svn-base 113 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524
  1. <template>
  2. <div class="app-container">
  3. <!-- 配方模板表 -->
  4. <div ref="template" class="template">
  5. <div class="recipeTemplate">
  6. <p>配方模板表</p>
  7. </div>
  8. <div class="operation">
  9. <el-button class="success" @click="handleCreate">新增</el-button>
  10. <el-button class="danger" @click="handleDelete">删除</el-button>
  11. <el-button class="warning" @click="handleCopy">复制</el-button>
  12. <el-button class="success" @click="handleRecipeRecord">配方记录</el-button>
  13. <!-- <el-button class="success" @click="handleHistory">生成历史</el-button> -->
  14. <el-upload style="float: right;margin-right: 75px;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
  15. <el-button class="import" style="float: right;">导入</el-button>
  16. </el-upload>
  17. <el-dropdown style="float: right;margin-right: 10px;">
  18. <el-button class="export">导出</el-button>
  19. <el-dropdown-menu slot="dropdown">
  20. <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
  21. <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
  22. </el-dropdown-menu>
  23. </el-dropdown>
  24. </div>
  25. <div class="search">
  26. <el-select v-model="table.getdataListParm.parammaps.ccname" filterable placeholder="牲畜类别" class="filter-item" clearable>
  27. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />
  28. </el-select>
  29. <el-select v-model="table.getdataListParm.parammaps.fttype" filterable placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>
  30. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />
  31. </el-select>
  32. <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>
  33. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  34. </el-select>
  35. <div ref="selectInput" class="filter-item selectInput">
  36. <el-input type="text" placeholder="请点击选择搜索条件" class="Input" />
  37. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  38. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  39. <ul v-if="arrowUp" class="selectUl">
  40. <li><a>配方名称</a><el-input v-model="table.getdataListParm.parammaps.tname" style="width: 245px;" /></li>
  41. <li><a>备注</a><el-input v-model="table.getdataListParm.parammaps.remark" style="width: 245px;" /></li>
  42. <li><a>来源</a><el-input v-model="table.getdataListParm.parammaps.source" style="width: 245px;" /></li>
  43. <li>
  44. <div style="float: right;">
  45. <el-button class="minCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  46. <el-button class="miniPrimary" @click="handleSearch">搜索</el-button>
  47. </div>
  48. </li>
  49. </ul>
  50. </div>
  51. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  52. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  53. </div>
  54. <div class="table">
  55. <el-table
  56. :key="table.tableKey"
  57. v-loading="table.listLoading"
  58. element-loading-text="给我一点时间"
  59. :data="table.list"
  60. border
  61. fit
  62. highlight-current-row
  63. style="width: 98%;"
  64. :row-style="rowStyle"
  65. :cell-style="cellStyle"
  66. :height="350"
  67. class="elTable table-fixed"
  68. @row-click="tableRowClick"
  69. @selection-change="handleSelectionChange"
  70. >
  71. <el-table-column type="selection" align="center" width="50" />
  72. <el-table-column label="序号" align="center" type="index" width="50px">
  73. <template slot-scope="scope">
  74. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="配方名称" min-width="110px" align="center">
  78. <template slot-scope="scope">
  79. <span v-if="scope.row.NoEdit">{{ scope.row.tname }}</span>
  80. <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:95%;padding:10px 0;" />
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="配方颜色" min-width="85px" align="center">
  84. <template slot-scope="scope">
  85. <el-color-picker v-model="scope.row.tcolor" size="mini" :disabled="scope.row.NoEdit" style="margin:10px 0;" />
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="牲畜类别" min-width="130px" align="center">
  89. <template slot-scope="scope">
  90. <span v-if="scope.row.NoEdit">{{ scope.row.ccname }}</span>
  91. <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">
  92. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />
  93. </el-select>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="配方类型" min-width="130px" align="center">
  97. <template slot-scope="scope">
  98. <span v-if="scope.row.NoEdit">{{ scope.row.fttype }}</span>
  99. <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">
  100. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />
  101. </el-select>
  102. <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">
  103. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />
  104. </el-select>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="来源" min-width="90px" align="center">
  108. <template slot-scope="scope">
  109. <span>{{ scope.row.source }}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="备注" min-width="90px" align="center">
  113. <template slot-scope="scope">
  114. <span v-if="scope.row.NoEdit">{{ scope.row.remark }}</span>
  115. <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;" />
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="版本号" min-width="90px" align="center">
  119. <template slot-scope="scope">
  120. <span>{{ scope.row.version }}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="是否启用" min-width="90px" align="center">
  124. <template slot-scope="scope">
  125. <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)" />
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  129. <template slot-scope="{row}">
  130. <!-- 新增 -->
  131. <el-button v-if="row.isCreate" class="miniSuccess" @click="createData(row)">保存</el-button>
  132. <el-button v-if="row.isCreate" class="minCancel" @click="createCancel(row)">取消</el-button>
  133. <!-- 编辑 -->
  134. <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  135. <el-button v-if="row.isUpdate" class="miniDanger" @click="handleRowDelete(row)">删除</el-button>
  136. <!-- 编辑保存 -->
  137. <el-button v-if="row.isUpdateSave" class="miniSuccess" @click="updateData(row)">保存</el-button>
  138. <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel(row)">取消</el-button>
  139. <el-button v-if="row.NoEdit && isFormula" class="miniSuccess" @click="handleFormulationEvaluation(row)">配方评估</el-button>
  140. </template>
  141. </el-table-column>
  142. </el-table>
  143. </div>
  144. </div>
  145. <!-- 配方详情表 -->
  146. <div v-if="isDetail" ref="detail" class="detail" style="margin-top: 30px;">
  147. <div class="recipeTemplate">
  148. <p>配方详情表</p>
  149. </div>
  150. <div class="operation">
  151. <el-button style="float: left;" class="success" @click="handleCreate2">新增</el-button>
  152. <el-button style="float: left;" class="danger" @click="handleDelete2">删除</el-button>
  153. <el-button style="float: left;" class="success" @click="handleSyntheticPremix">合成预混料</el-button>
  154. <el-button v-if="isOrder" style="float: left;" class="success" @click="handleChangeOrder">更改顺序</el-button>
  155. <div v-else style="float: left;margin-left: 10px;">
  156. <el-button class="success" @click="saveChangeOrder">保存</el-button>
  157. <el-button class="success" @click="cancelChangeOrder">取消</el-button>
  158. </div>
  159. <div ref="selectInput2" class="filter-item selectInput" style="margin: 0 10px;">
  160. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  161. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  162. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  163. <ul v-if="arrowUp2" class="selectUl" style="width: 400px;">
  164. <li>
  165. <a style="width: 130px;">饲料名称</a>
  166. <el-select v-model="table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:245px;">
  167. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />
  168. </el-select>
  169. </li>
  170. <li><a style="width: 130px;">饲料组名称</a><el-input v-model="table2.getdataListParm.parammaps.feedgroup" style="width: 245px;" /></li>
  171. <li><a style="width: 130px;">重量</a><el-input v-model="table2.getdataListParm.parammaps.fweight" style="width: 245px;" /></li>
  172. <li>
  173. <a style="width: 130px;">搅拌延时</a>
  174. <el-select v-model="table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:245px;" clearable>
  175. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />
  176. </el-select>
  177. </li>
  178. <li>
  179. <a style="width: 130px;">是否锁定牛头数比例</a>
  180. <el-select v-model="table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:245px;" clearable>
  181. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  182. </el-select>
  183. </li>
  184. <li><a style="width: 130px;">顺序</a><el-input v-model="table2.getdataListParm.parammaps.sort" style="width: 245px;" /></li>
  185. <li>
  186. <div style="float: right;">
  187. <el-button class="minCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>
  188. <el-button class="miniSuccess" @click="handleSearch2">搜索</el-button>
  189. </div>
  190. </li>
  191. </ul>
  192. </div>
  193. <el-button class="successBorder" @click="handleSearch2">查询</el-button>
  194. <el-button class="successBorder" @click="handleRefresh2">重置</el-button>
  195. </div>
  196. <div class="table2" style="min-height: 400px;">
  197. <el-table
  198. id="table2"
  199. ref="table2"
  200. :key="table2.tableKey"
  201. v-loading="table2.listLoading"
  202. element-loading-text="给我一点时间"
  203. :data="table2.list"
  204. border
  205. fit
  206. highlight-current-row
  207. style="width: 98%;"
  208. :row-style="rowStyle"
  209. :cell-style="cellStyle"
  210. class="elTable table-fixed"
  211. row-key="id"
  212. :summary-method="getSummaries"
  213. show-summary
  214. @selection-change="handleSelectionChange2"
  215. >
  216. <el-table-column type="selection" width="60" />
  217. <el-table-column label="序号" align="center" type="index" width="50px" />
  218. <el-table-column label="饲料组" min-width="110px" align="center">
  219. <template slot-scope="scope">
  220. <span v-if="scope.row.groupNoEdit">{{ scope.row.feedgroup }}</span>
  221. <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;" />
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="饲料名称" min-width="130px" align="center">
  225. <template slot-scope="scope">
  226. <span v-if="scope.row.NoEdit">{{ scope.row.fname }}</span>
  227. <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)}">
  228. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.id" />
  229. </el-select>
  230. </template>
  231. </el-table-column>
  232. <el-table-column label="重量(KG)" prop="fweight" min-width="180px" align="center">
  233. <template slot-scope="scope">
  234. <span v-if="scope.row.NoEdit">{{ scope.row.fweight }}</span>
  235. <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" placeholder="重量" step="0.01" type="number" style="width:95%;padding:10px 0;" />
  236. </template>
  237. </el-table-column>
  238. <el-table-column label="搅拌延时(min)" min-width="90px" align="center">
  239. <template slot-scope="scope">
  240. <span v-if="scope.row.NoEdit">{{ scope.row.autosecond }}</span>
  241. <el-select v-if="scope.row.Edit" v-model="scope.row.autosecond" filterable placeholder="搅拌延时" class="filter-item" style="width:95%;padding:10px 0;">
  242. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.id" />
  243. </el-select>
  244. </template>
  245. </el-table-column>
  246. <el-table-column v-if="lockCount.isLockCount" label="是否锁定牛头数比例" min-width="110px" align="center">
  247. <template slot-scope="scope">
  248. <span v-if="scope.row.NoEdit && scope.row.islockcount == '0'">否</span>
  249. <span v-if="scope.row.NoEdit && scope.row.islockcount == '1'">是</span>
  250. <el-select v-if="scope.row.Edit" v-model="scope.row.islockcount" placeholder="" class="filter-item" style="width:95%;padding:10px 0;">
  251. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  252. </el-select>
  253. </template>
  254. </el-table-column>
  255. <el-table-column label="顺序" min-width="90px" align="center">
  256. <template slot-scope="scope">
  257. <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>
  258. <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)" />
  259. </template>
  260. </el-table-column>
  261. <el-table-column label="操作" align="center" width="320" class-name="small-padding fixed-width" fixed="right">
  262. <template slot-scope="{row}">
  263. <!-- 新增 -->
  264. <el-button v-if="row.isCreate" class="miniSuccess" @click="createData2(row)">保存</el-button>
  265. <el-button v-if="row.isCreate" class="minCancel" @click="createCancel2(row)">取消</el-button>
  266. <!-- 编辑 -->
  267. <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate2(row)">编辑</el-button>
  268. <el-button v-if="row.isUpdate" class="miniDanger" @click="handleRowDelete2(row)">删除</el-button>
  269. <!-- 编辑保存 -->
  270. <el-button v-if="row.isUpdateSave" class="miniSuccess" @click="updateData2(row)">保存</el-button>
  271. <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel2(row)">取消</el-button>
  272. <!-- 拆分预混料 -->
  273. <el-button v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false" class="miniSuccess" @click="handleSplitPremix(row)">拆分预混料</el-button>
  274. </template>
  275. </el-table-column>
  276. </el-table>
  277. </div>
  278. </div>
  279. <!-- 配方记录 -->
  280. <el-dialog :title="textMap[template.dialogStatus]" :destroy-on-close="true" :visible.sync="template.dialogFormVisible" :close-on-click-modal="false" width="90%">
  281. <div class="dialogMinHeight" style="overflow-y: auto;margin-bottom: 30px;overflow-x: hidden;">
  282. <div ref="templateDialog" class="templateDialog">
  283. <div class="recipeTemplate">
  284. <p>配方模板表</p>
  285. </div>
  286. <div class="operation">
  287. <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" />
  288. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  289. </div>
  290. <div class="search">
  291. <el-select v-model="template.table.getdataListParm.parammaps.ccname" placeholder="牲畜类别" class="filter-item" clearable>
  292. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />
  293. </el-select>
  294. <el-select v-model="template.table.getdataListParm.parammaps.fttype" placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>
  295. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />
  296. </el-select>
  297. <el-select v-model="template.table.getdataListParm.parammaps.enable" placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>
  298. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  299. </el-select>
  300. <div ref="selectInput" class="filter-item selectInput">
  301. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  302. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  303. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  304. <ul v-if="arrowUp" class="selectUl">
  305. <li><a>配方名称</a><el-input v-model="template.table.getdataListParm.parammaps.tname" style="width: 245px;" /></li>
  306. <li><a>备注</a><el-input v-model="template.table.getdataListParm.parammaps.remark" style="width: 245px;" /></li>
  307. <li><a>来源</a><el-input v-model="template.table.getdataListParm.parammaps.source" style="width: 245px;" /></li>
  308. <li>
  309. <div style="float: right;">
  310. <el-button class="minCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  311. <el-button class="miniSuccess" @click="handleDialogSearch">搜索</el-button>
  312. </div>
  313. </li>
  314. </ul>
  315. </div>
  316. <el-button class="successBorder" @click="handleDialogSearch">查询</el-button>
  317. <el-button class="successBorder" @click="handleDialogRefresh">重置</el-button>
  318. </div>
  319. <div class="table">
  320. <el-table
  321. :key="template.table.tableKey"
  322. v-loading="template.table.listLoading"
  323. element-loading-text="给我一点时间"
  324. :data="template.table.list"
  325. border
  326. fit
  327. highlight-current-row
  328. style="width: 98%;"
  329. :row-style="rowStyle"
  330. :cell-style="cellStyle"
  331. class="elTable table-fixed"
  332. @row-click="tableRowClickDialog"
  333. >
  334. <el-table-column label="序号" align="center" type="index" width="50px">
  335. <template slot-scope="scope">
  336. <span>{{ scope.$index + (template.table.pageNum-1) * template.table.pageSize + 1 }}</span>
  337. </template>
  338. </el-table-column>
  339. <el-table-column label="配方名称" min-width="130px" align="center">
  340. <template slot-scope="scope">
  341. <span>{{ scope.row.tname }}</span>
  342. </template>
  343. </el-table-column>
  344. <el-table-column label="配方颜色" min-width="110px" align="center">
  345. <template slot-scope="scope">
  346. <el-color-picker v-model="scope.row.tcolor" size="mini" disabled style="margin:10px 0;" />
  347. </template>
  348. </el-table-column>
  349. <el-table-column label="牲畜类别" min-width="110px" align="center">
  350. <template slot-scope="scope">
  351. <span>{{ scope.row.ccname }}</span>
  352. </template>
  353. </el-table-column>
  354. <el-table-column label="配方类型" min-width="110px" align="center">
  355. <template slot-scope="scope">
  356. <span>{{ scope.row.fttype }}</span>
  357. </template>
  358. </el-table-column>
  359. <el-table-column label="来源" min-width="90px" align="center">
  360. <template slot-scope="scope">
  361. <span>{{ scope.row.source }}</span>
  362. </template>
  363. </el-table-column>
  364. <el-table-column label="备注" min-width="90px" align="center">
  365. <template slot-scope="scope">
  366. <span>{{ scope.row.remark }}</span>
  367. </template>
  368. </el-table-column>
  369. <el-table-column label="版本号" min-width="90px" align="center">
  370. <template slot-scope="scope">
  371. <span>{{ scope.row.version }}</span>
  372. </template>
  373. </el-table-column>
  374. <el-table-column label="版本时间" min-width="90px" align="center">
  375. <template slot-scope="scope">
  376. <span>{{ scope.row.versiontime }}</span>
  377. </template>
  378. </el-table-column>
  379. <el-table-column label="是否启用" min-width="90px" align="center">
  380. <template slot-scope="scope">
  381. <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  382. </template>
  383. </el-table-column>
  384. </el-table>
  385. </div>
  386. </div>
  387. <div v-if="isDetailDialog" id="detailDialog2" ref="detailDialog2" class="detailDialog" style="margin-top: 30px;">
  388. <div class="recipeTemplate">
  389. <p>配方详情表</p>
  390. </div>
  391. <div class="operation">
  392. <div ref="selectInput2" class="filter-item selectInput">
  393. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  394. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  395. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  396. <ul v-if="arrowUp2" class="selectUl" style="width: 400px;">
  397. <li>
  398. <a style="width: 130px;">饲料名称</a>
  399. <el-select v-model="template.table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:245px;">
  400. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />
  401. </el-select>
  402. </li>
  403. <li><a style="width: 130px;">饲料组名称</a><el-input v-model="template.table2.getdataListParm.parammaps.feedgroup" style="width: 245px;" /></li>
  404. <li><a style="width: 130px;">重量</a><el-input v-model="template.table2.getdataListParm.parammaps.fweight" style="width: 245px;" /></li>
  405. <li>
  406. <a style="width: 130px;">搅拌延时</a>
  407. <el-select v-model="template.table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:245px;">
  408. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />
  409. </el-select>
  410. </li>
  411. <li>
  412. <a style="width: 130px;">是否锁定牛头数比例</a>
  413. <el-select v-model="template.table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:245px;">
  414. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  415. </el-select>
  416. </li>
  417. <li><a style="width: 130px;">顺序</a><el-input v-model="template.table2.getdataListParm.parammaps.sort" style="width: 245px;" /></li>
  418. <li>
  419. <div style="float: right;">
  420. <el-button class="minCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>
  421. <el-button class="miniSuccess" @click="handleDialogSearch2">搜索</el-button>
  422. </div>
  423. </li>
  424. </ul>
  425. </div>
  426. <el-button class="successBorder" @click="handleDialogSearch2">查询</el-button>
  427. <el-button class="successBorder" @click="handleDialogRefresh2">重置</el-button>
  428. </div>
  429. <div class="table2">
  430. <el-table
  431. id="templateTable2"
  432. :key="template.table2.tableKey"
  433. v-loading="template.table2.listLoading"
  434. element-loading-text="给我一点时间"
  435. :data="template.table2.list"
  436. border
  437. fit
  438. highlight-current-row
  439. style="width: 98%;"
  440. :summary-method="getTemplateTable2Summaries"
  441. show-summary
  442. :row-style="rowStyle"
  443. :cell-style="cellStyle"
  444. class="elTable table-fixed"
  445. row-key="id"
  446. >
  447. <el-table-column label="饲料组" min-width="130px" align="center">
  448. <template slot-scope="scope">
  449. <span>{{ scope.row.feedgroup }}</span>
  450. </template>
  451. </el-table-column>
  452. <el-table-column label="饲料名称" min-width="130px" align="center">
  453. <template slot-scope="scope">
  454. <span>{{ scope.row.fname }}</span>
  455. </template>
  456. </el-table-column>
  457. <el-table-column label="重量(KG)" prop="fweight" min-width="200px" align="center">
  458. <template slot-scope="scope">
  459. <span>{{ scope.row.fweight }}</span>
  460. </template>
  461. </el-table-column>
  462. <el-table-column label="搅拌延时(min)" min-width="130px" align="center">
  463. <template slot-scope="scope">
  464. <span>{{ scope.row.autosecondname }}</span>
  465. </template>
  466. </el-table-column>
  467. <el-table-column label="是否锁定牛头数比例" min-width="130px" align="center">
  468. <template slot-scope="scope">
  469. <span v-if="scope.row.islockcount == '0'">否</span>
  470. <span v-if="scope.row.islockcount == '1'">是</span>
  471. </template>
  472. </el-table-column>
  473. <el-table-column label="顺序" min-width="130px" align="center">
  474. <template slot-scope="scope">
  475. <span>{{ scope.row.sort }}</span>
  476. </template>
  477. </el-table-column>
  478. </el-table>
  479. </div>
  480. </div>
  481. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
  482. <el-button @click="template.dialogFormVisible = false; ">关闭</el-button>
  483. </div>
  484. </div>
  485. </el-dialog>
  486. <!-- 合成预混料 -->
  487. <el-dialog :title="textMap[detail.dialogStatus]" :destroy-on-close="true" :visible.sync="detail.dialogFormVisible" :close-on-click-modal="false" width="90%">
  488. <div class="detailDialog">
  489. <h2>饲料</h2>
  490. <div class="table1">
  491. <el-table
  492. :key="detail.tableKey"
  493. v-loading="detail.listLoading"
  494. element-loading-text="给我一点时间"
  495. :data="detail.list"
  496. fit
  497. highlight-current-row
  498. style="width: 100%;"
  499. :row-style="rowStyle"
  500. :cell-style="cellStyle"
  501. class="elTable table-fixed"
  502. show-summary
  503. >
  504. <el-table-column label="序号" align="center" type="index" width="50px" />
  505. <el-table-column label="饲料名称" min-width="130px" align="center">
  506. <template slot-scope="scope">
  507. <span>{{ scope.row.fname }}</span>
  508. </template>
  509. </el-table-column>
  510. <el-table-column prop="fweight" label="重量(KG)" />
  511. <el-table-column label="搅拌延时(min)" min-width="110px" align="center">
  512. <template slot-scope="scope">
  513. <span>{{ scope.row.autosecond }}</span>
  514. </template>
  515. </el-table-column>
  516. <el-table-column v-if="lockCount.isLockCount" label="是否锁定牛头数比例" min-width="130px" align="center">
  517. <template slot-scope="scope">
  518. <span v-if="scope.row.islockcount == '0'">否</span>
  519. <span v-if="scope.row.islockcount == '1'">是</span>
  520. </template>
  521. </el-table-column>
  522. <el-table-column label="顺序" min-width="110px" align="center">
  523. <template slot-scope="scope">
  524. <span>{{ scope.row.sort }}</span>
  525. </template>
  526. </el-table-column>
  527. </el-table>
  528. </div>
  529. <h2>合成预混料</h2>
  530. <div class="table2" style="margin-bottom: 50px;">
  531. <el-table
  532. :key="detail.tableKey2"
  533. v-loading="detail.listLoading2"
  534. element-loading-text="给我一点时间"
  535. :data="detail.list2"
  536. border
  537. fit
  538. highlight-current-row
  539. style="width: 100%;"
  540. :row-style="rowStyle"
  541. :cell-style="cellStyle"
  542. class="elTable table-fixed"
  543. >
  544. <el-table-column label="配方名称" min-width="130px" align="center">
  545. <template slot-scope="scope">
  546. <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" />
  547. </template>
  548. </el-table-column>
  549. <el-table-column label="配方颜色11" min-width="130px" align="center">
  550. <template slot-scope="scope">
  551. <el-color-picker v-model="scope.row.tcolor" size="mini" style="margin:10px 0;" :disabled="detail.disabled" />
  552. </template>
  553. </el-table-column>
  554. <el-table-column label="牲畜类别" min-width="130px" align="center">
  555. <template slot-scope="scope">
  556. <el-select v-model="scope.row.ccid" placeholder="选择牲畜父类" class="filter-item" style="width:95%;padding:10px 0;" :disabled="detail.disabled" @change="changeLivestockType2">
  557. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />
  558. </el-select>
  559. </template>
  560. </el-table-column>
  561. <el-table-column label="配方类型" min-width="110px" align="center">
  562. <template slot-scope="scope">
  563. <span>{{ scope.row.fttype }}</span>
  564. </template>
  565. </el-table-column>
  566. <el-table-column label="来源" min-width="110px" align="center">
  567. <template slot-scope="scope">
  568. <span>{{ scope.row.source }}</span>
  569. </template>
  570. </el-table-column>
  571. <el-table-column label="备注" min-width="130px" align="center">
  572. <template slot-scope="scope">
  573. <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" />
  574. </template>
  575. </el-table-column>
  576. <el-table-column label="是否启用" min-width="130px" align="center">
  577. <template slot-scope="scope">
  578. <el-switch v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" :disabled="detail.disabled" />
  579. </template>
  580. </el-table-column>
  581. </el-table>
  582. </div>
  583. <div slot="footer" class="dialog-footer" style="bottom: -50px;">
  584. <el-button class="cancelClose" @click="detail.dialogFormVisible = false; ">关闭</el-button>
  585. <el-button class="success" :disabled="isokDisable" @click="syntheticPremixData()">确认</el-button>
  586. </div>
  587. </div>
  588. </el-dialog>
  589. <!-- 历史记录 -->
  590. <el-dialog :title="textMap[historyRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  591. <div class="historyRecord">
  592. <keep-alive>
  593. <component :is="historyRecord.myComponent" ref="historyRecord" />
  594. </keep-alive>
  595. </div>
  596. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  597. <el-button class="cancelClose" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
  598. </div>
  599. </el-dialog>
  600. </div>
  601. </template>
  602. <script>
  603. import { GetDataByName, GetDataByNames, PostDataByName, failproccess, checkButtons, ExecDataByConfig, formatNum } from '@/api/common'
  604. import Sortable from 'sortablejs'
  605. import { MessageBox } from 'element-ui'
  606. import Cookies from 'js-cookie'
  607. import { json2excel } from '@/utils/index.js'
  608. import { getToken } from '@/utils/auth'
  609. import { parseTime } from '@/utils/index.js'
  610. export default {
  611. name: 'RecipeTemplate',
  612. data() {
  613. return {
  614. isFormula: [],
  615. requestParams: [
  616. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] },
  617. { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['配方类型'] },
  618. { name: 'getFeedAndPre', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  619. ],
  620. enableList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否启用
  621. lockBullsList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否锁定牛头数比例
  622. livestockTypeList: [], // 牲畜类别
  623. formulaTypeList: [], // 配方类型
  624. feedNameList: [], // 饲料名称
  625. 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' }], // 搅拌延时
  626. 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' }], // 请选择历史记录时间
  627. sourceList: [{ id: 0, name: '自定义' }, { id: 1, name: '集团下发' }, { id: 2, name: '导入' }], // 导入
  628. arrowDown: true,
  629. arrowUp: false,
  630. table: {
  631. getdataListParm: {
  632. name: 'getFTList',
  633. page: 1,
  634. offset: 1,
  635. pagecount: 30,
  636. returntype: 'Map',
  637. parammaps: {
  638. pastureid: Cookies.get('pastureid'),
  639. tname: '',
  640. ccid: '',
  641. ccname: '',
  642. fttypeid: '',
  643. fttype: '',
  644. remark: '',
  645. enable: ''
  646. }
  647. },
  648. tableKey: 0,
  649. list: [],
  650. total: 0,
  651. listLoading: true,
  652. temp: {}
  653. },
  654. lockCount: {
  655. getdataListParm: {
  656. name: 'getSysoptEnable',
  657. page: 1,
  658. offset: 1,
  659. pagecount: 30,
  660. returntype: 'Map',
  661. parammaps: {
  662. pastureid: Cookies.get('pastureid'),
  663. inforname: 'isLockCount'
  664. }
  665. },
  666. isLockCount: false // 是否显示是否锁定牛头数比例
  667. },
  668. isDetail: false,
  669. arrowDown2: true,
  670. arrowUp2: false,
  671. table2: {
  672. getDryweightParm: {
  673. name: 'getFTdryweight',
  674. page: 1,
  675. offset: 1,
  676. pagecount: 10,
  677. returntype: 'Map',
  678. parammaps: {
  679. pastureid: '',
  680. ftid: ''
  681. }
  682. },
  683. dryweight: '',
  684. getdataListParm: {
  685. name: 'getFTdetailList',
  686. page: 1,
  687. offset: 1,
  688. pagecount: '',
  689. returntype: 'Map',
  690. parammaps: {
  691. pastureid: Cookies.get('pastureid'),
  692. fname: '',
  693. feedgroup: '',
  694. fweight: '',
  695. autosecondname: '',
  696. islockcount: '',
  697. sort: ''
  698. }
  699. },
  700. tableKey: 0,
  701. list: [],
  702. total: 0,
  703. listLoading: true,
  704. temp: {}
  705. },
  706. isDetailDialog: false,
  707. template: {
  708. dialogFormVisible: false,
  709. dialogStatus: '',
  710. table: {
  711. getdataListParm: {
  712. name: 'getFTListDate',
  713. page: 1,
  714. offset: 1,
  715. pagecount: 10,
  716. returntype: 'Map',
  717. parammaps: {
  718. pastureid: Cookies.get('pastureid'),
  719. tname: '',
  720. ccid: '',
  721. ccname: '',
  722. fttype: '',
  723. remark: '',
  724. enable: '',
  725. date: '',
  726. source: ''
  727. }
  728. },
  729. tableKey: 0,
  730. total: 0,
  731. listLoading: true,
  732. list: []
  733. },
  734. table2: {
  735. getdataListParm: {
  736. name: 'getFTdetailListDate',
  737. page: 1,
  738. offset: 1,
  739. pagecount: 10,
  740. returntype: 'Map',
  741. parammaps: {
  742. pastureid: Cookies.get('pastureid'),
  743. fname: '',
  744. fweight: '',
  745. islockcount: '',
  746. sort: '',
  747. feedgroup: '',
  748. autosecondname: ''
  749. }
  750. },
  751. tableKey: 0,
  752. total: 0,
  753. listLoading: true,
  754. list: []
  755. },
  756. // 历史日期
  757. getdataDateParm: {
  758. name: 'getFTMaxDate',
  759. page: 1,
  760. offset: 1,
  761. pagecount: 10,
  762. returntype: 'Map',
  763. parammaps: {
  764. pastureid: Cookies.get('pastureid')
  765. }
  766. }
  767. },
  768. isOrder: true,
  769. detail: {
  770. dialogFormVisible: false,
  771. dialogStatus: '',
  772. tableKey: 0,
  773. total: 0,
  774. listLoading: true,
  775. list: [],
  776. tableKey2: 0,
  777. total2: 0,
  778. listLoading2: false,
  779. list2: [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }],
  780. getdataListParm: {
  781. name: 'getFTDetailCompare',
  782. page: 1,
  783. offset: 1,
  784. pagecount: 10,
  785. returntype: 'Map',
  786. parammaps: {}
  787. },
  788. list3: [],
  789. disabled: false,
  790. getdataListParm2: {
  791. name: 'getFTCompare',
  792. page: 1,
  793. offset: 1,
  794. pagecount: 10,
  795. returntype: 'Map',
  796. parammaps: {}
  797. }
  798. },
  799. selectList: [],
  800. selectList2: [],
  801. textMap: {
  802. RecipeRecord: '配方记录',
  803. SyntheticPremix: '合成预混料',
  804. historyRecord: '历史记录'
  805. },
  806. requestParam: {},
  807. download: {
  808. getdataListParm: {
  809. name: 'getFTList',
  810. page: 1,
  811. offset: 1,
  812. pagecount: 0,
  813. returntype: 'Map',
  814. parammaps: {
  815. pastureid: Cookies.get('pastureid'),
  816. tname: '',
  817. ccid: '',
  818. ccname: '',
  819. fttypeid: '',
  820. fttype: '',
  821. remark: '',
  822. enable: ''
  823. }
  824. },
  825. list: []
  826. },
  827. historyRecord: {
  828. dialogStatus: '',
  829. dialogFormVisible: false
  830. },
  831. isokDisable: false,
  832. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  833. cellStyle: { padding: 0 + 'px' },
  834. dropState: false
  835. }
  836. },
  837. computed: {
  838. // 设置请求头
  839. headers() {
  840. return {
  841. token: getToken()
  842. }
  843. },
  844. uploadData() {
  845. return {
  846. name: '颛孙洋洋-配方模板',
  847. importParams: '配方名称, 牲畜类别, 配方类型, 备注, 是否启用, 饲料组, 饲料名称, 重量(kg), 搅拌延时(min), 是否锁定牛头数比例',
  848. sheetname: 'SheetJS'
  849. }
  850. },
  851. // 设置上传地址
  852. uploadExcelUrl() {
  853. return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
  854. }
  855. },
  856. mounted() {
  857. document.addEventListener('click', (e) => {
  858. if (this.$refs.selectInput !== undefined) {
  859. if (!this.$refs.selectInput.contains(e.target)) {
  860. this.arrowDown = true
  861. this.arrowUp = false
  862. } else {
  863. this.arrowDown = false
  864. this.arrowUp = true
  865. }
  866. }
  867. if (this.$refs.selectInput2 !== undefined) {
  868. if (!this.$refs.selectInput2.contains(e.target)) {
  869. this.arrowDown2 = true
  870. this.arrowUp2 = false
  871. } else {
  872. this.arrowDown2 = false
  873. this.arrowUp2 = true
  874. }
  875. }
  876. })
  877. },
  878. created() {
  879. this.getList()
  880. this.getButtons()
  881. this.getDownList()
  882. this.getIsLockCount()
  883. },
  884. methods: {
  885. getButtons() {
  886. const Formula = 'FormulationEvaluation'
  887. const isFormula = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Formula)
  888. this.isFormula = isFormula
  889. },
  890. getSummaries(param) {
  891. console.log(param, '====')
  892. const { columns, data } = param
  893. const sums = []
  894. columns.forEach((column, index) => {
  895. if (index === 0) {
  896. sums[index] = '合计'
  897. return
  898. }
  899. const values = data.map(item => Number(item[column.property]))
  900. if (!values.every(value => isNaN(value))) {
  901. sums[index] = values.reduce((prev, curr) => {
  902. const value = Number(curr)
  903. if (!isNaN(value)) {
  904. return prev + curr
  905. } else {
  906. return prev
  907. }
  908. }, 0)
  909. // 后台待发
  910. sums[index] += '(干物质量:' + this.table2.dryweight + ')'
  911. } else {
  912. sums[index] = ''
  913. }
  914. })
  915. return sums
  916. },
  917. getDryWeight() {
  918. GetDataByName(this.table2.getDryweightParm).then(response => {
  919. console.log('table数据', response.data.list)
  920. if (response.data.list[0].dryweight !== undefined) {
  921. this.table2.dryweight = response.data.list[0].dryweight
  922. } else {
  923. this.table2.dryweight = ''
  924. }
  925. })
  926. },
  927. getTemplateTable2Summaries(param) {
  928. console.log(param, '====')
  929. const { columns, data } = param
  930. const sums = []
  931. columns.forEach((column, index) => {
  932. if (index === 0) {
  933. sums[index] = '合计'
  934. return
  935. }
  936. const values = data.map(item => Number(item[column.property]))
  937. if (!values.every(value => isNaN(value))) {
  938. sums[index] = values.reduce((prev, curr) => {
  939. const value = Number(curr)
  940. if (!isNaN(value)) {
  941. return prev + curr
  942. } else {
  943. return prev
  944. }
  945. }, 0)
  946. // 后台待发
  947. sums[index] += '(干物质量:' + this.template.table2.getdataListParm.parammaps.dryweight + ')'
  948. } else {
  949. sums[index] = ''
  950. }
  951. })
  952. return sums
  953. },
  954. // handleHistory() {
  955. // MessageBox.confirm('是否确认生成历史?', {
  956. // confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  957. // }).then(() => {
  958. // this.requestParam.name = 'creatFTdate'
  959. // this.requestParam.parammaps = {}
  960. // this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  961. // PostDataByName(this.requestParam).then(response => {
  962. // console.log('生成历史保存发送参数', this.requestParam)
  963. // if (response.msg !== 'fail') {
  964. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  965. // } else {
  966. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  967. // }
  968. // })
  969. // })
  970. // },
  971. getDownList() {
  972. GetDataByNames(this.requestParams).then(response => {
  973. this.livestockTypeList = response.data.getDictByName.list
  974. this.formulaTypeList = response.data.getDictByName2.list
  975. this.feedNameList = response.data.getFeedAndPre.list
  976. })
  977. },
  978. // -------------------模板-----------------------------
  979. getList() {
  980. this.table.listLoading = true
  981. GetDataByName(this.table.getdataListParm).then(response => {
  982. console.log('table数据', response.data.list)
  983. if (response.data.list !== null) {
  984. for (let i = 0; i < response.data.list.length; i++) {
  985. this.$set(response.data.list[i], 'Edit', false) // 编辑
  986. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  987. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  988. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  989. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  990. }
  991. this.table.list = response.data.list
  992. this.table.pageNum = response.data.pageNum
  993. this.table.pageSize = response.data.pageSize
  994. this.table.total = response.data.total
  995. } else {
  996. this.table.list = []
  997. }
  998. setTimeout(() => {
  999. this.table.listLoading = false
  1000. }, 100)
  1001. })
  1002. },
  1003. handleSearch() {
  1004. console.log('点击了查询')
  1005. this.table.getdataListParm.offset = 1
  1006. this.getList()
  1007. this.arrowDown = true
  1008. this.arrowUp = false
  1009. },
  1010. handleRefresh() {
  1011. console.log('点击了重置')
  1012. this.table.getdataListParm.offset = 1
  1013. this.table.getdataListParm.parammaps.ccid = ''
  1014. this.table.getdataListParm.parammaps.ccname = ''
  1015. this.table.getdataListParm.parammaps.fttype = ''
  1016. this.table.getdataListParm.parammaps.tname = ''
  1017. this.table.getdataListParm.parammaps.remark = ''
  1018. this.table.getdataListParm.parammaps.enable = ''
  1019. this.table.getdataListParm.parammaps.source = ''
  1020. this.getList()
  1021. },
  1022. // 模板新增
  1023. handleCreate() {
  1024. console.log('点击了新增')
  1025. // 编辑true/不可编辑false
  1026. // 新增操true,编辑false,编辑保存false
  1027. for (let i = 0; i < this.table.list.length; i++) {
  1028. if (this.table.list[i].Edit === true) {
  1029. console.log(123)
  1030. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1031. return false
  1032. }
  1033. }
  1034. this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'tname': '', 'tcolor': '#ccc', 'ccid': '', 'ccname': '', 'fttype': '', 'fttypeid': '', 'source': '自定义', 'remark': '' })
  1035. console.log(this.table.list)
  1036. },
  1037. // 畜生类别
  1038. changeLivestockType(item) {
  1039. this.table.temp.ccname = this.livestockTypeList.find(obj => obj.value === item).label
  1040. },
  1041. // 配方类型
  1042. changeFormulaType(item) {
  1043. this.table.temp.fttype = this.formulaTypeList.find(obj => obj.value === item).label
  1044. },
  1045. createData(row) {
  1046. console.log('点击了新增保存', row)
  1047. this.table.temp.tname = row.tname
  1048. this.table.temp.tcolor = row.tcolor
  1049. this.table.temp.ccid = row.ccid
  1050. this.table.temp.ccname = this.table.temp.ccname
  1051. this.table.temp.fttype = this.table.temp.fttype
  1052. this.table.temp.fttypeid = row.fttypeid
  1053. this.table.temp.source = row.source
  1054. this.table.temp.remark = row.remark
  1055. this.table.temp.enable = row.enable
  1056. this.table.temp.pastureid = Cookies.get('pastureid')
  1057. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1058. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1059. return false
  1060. } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1061. this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })
  1062. return false
  1063. } else if (this.table.temp.tname == '') {
  1064. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1065. return false
  1066. } else if (this.table.temp.ccid == '') {
  1067. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1068. return false
  1069. } else if (this.table.temp.fttypeid == '') {
  1070. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1071. return false
  1072. }
  1073. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1074. if (pattern.test(this.table.temp.tname)) {
  1075. this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1076. return false
  1077. }
  1078. console.log(this.table.temp)
  1079. this.isokDisable = true
  1080. setTimeout(() => {
  1081. this.isokDisable = false
  1082. }, 1000)
  1083. this.requestParam.name = 'insertFT'
  1084. this.requestParam.parammaps = this.table.temp
  1085. PostDataByName(this.requestParam).then(response => {
  1086. console.log('新增保存发送参数', this.requestParam)
  1087. if (response.msg !== 'fail') {
  1088. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1089. this.getList()
  1090. } else {
  1091. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1092. }
  1093. })
  1094. },
  1095. createCancel(row) {
  1096. console.log('点击了新增取消')
  1097. for (let i = 0; i < this.table.list.length; i++) {
  1098. if (row.myId === this.table.list[i].myId) {
  1099. var listIndex = this.table.list.indexOf(this.table.list[i])
  1100. }
  1101. if (listIndex > -1) {
  1102. this.table.list.splice(listIndex, 1)
  1103. return
  1104. }
  1105. }
  1106. },
  1107. // 模板编辑
  1108. handleUpdate(row) {
  1109. for (let i = 0; i < this.table.list.length; i++) {
  1110. if (this.table.list[i].Edit == true) {
  1111. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1112. return false
  1113. }
  1114. }
  1115. // 编辑true,不可编辑false
  1116. row.Edit = true
  1117. row.NoEdit = false
  1118. // 新增false,编辑false,编辑保存true
  1119. row.isCreate = false
  1120. row.isUpdate = false
  1121. row.isUpdateSave = true
  1122. row.ccid = String(row.ccid)
  1123. row.fttypeid = String(row.fttypeid)
  1124. this.table.temp.ccname = row.ccname
  1125. this.table.temp.fttype = row.fttype
  1126. },
  1127. updateData(row) {
  1128. console.log('点击了编辑保存', row)
  1129. this.table.temp.tname = row.tname
  1130. this.table.temp.tcolor = row.tcolor
  1131. this.table.temp.ccid = row.ccid
  1132. this.table.temp.fttypeid = row.fttypeid
  1133. this.table.temp.source = row.source
  1134. this.table.temp.remark = row.remark
  1135. this.table.temp.enable = row.enable
  1136. this.table.temp.ccname = this.table.temp.ccname
  1137. this.table.temp.fttype = this.table.temp.fttype
  1138. this.table.temp.pastureid = row.pastureid
  1139. this.table.temp.id = row.id
  1140. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1141. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1142. return false
  1143. } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1144. this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })
  1145. return false
  1146. } else if (this.table.temp.tname == '') {
  1147. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1148. return false
  1149. } else if (this.table.temp.ccid == '') {
  1150. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1151. return false
  1152. } else if (this.table.temp.fttypeid == '') {
  1153. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1154. return false
  1155. }
  1156. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1157. if (pattern.test(this.table.temp.tname)) {
  1158. this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1159. return false
  1160. }
  1161. console.log(this.table.temp)
  1162. this.isokDisable = true
  1163. setTimeout(() => {
  1164. this.isokDisable = false
  1165. }, 1000)
  1166. this.requestParam.name = 'updateFT'
  1167. this.requestParam.parammaps = this.table.temp
  1168. PostDataByName(this.requestParam).then(response => {
  1169. console.log('新增保存发送参数', this.requestParam)
  1170. if (response.msg !== 'fail') {
  1171. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1172. this.getList()
  1173. } else {
  1174. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1175. }
  1176. })
  1177. },
  1178. updateCancel(row) {
  1179. console.log('点击了编辑取消')
  1180. // 编辑false,不可编辑true
  1181. row.Edit = false
  1182. row.NoEdit = true
  1183. // 新增false,编辑true,编辑保存false
  1184. row.isCreate = false
  1185. row.isUpdate = true
  1186. row.isUpdateSave = false
  1187. this.getList()
  1188. },
  1189. // 删除
  1190. handleRowDelete(row) {
  1191. console.log('点击了行内删除')
  1192. MessageBox.confirm('是否确认删除此信息?', {
  1193. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1194. }).then(() => {
  1195. this.requestParam.common = { 'returnmap': '0' }
  1196. this.requestParam.data = []
  1197. this.requestParam.data[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  1198. pastureid: row.pastureid,
  1199. id: row.id
  1200. }}
  1201. this.requestParam.data[1] = { 'name': 'deleteFT', 'type': 'e', 'parammaps': {
  1202. pastureid: row.pastureid,
  1203. id: row.id
  1204. }}
  1205. ExecDataByConfig(this.requestParam).then(response => {
  1206. console.log('新增保存发送参数', this.requestParam)
  1207. if (response.msg === 'fail') {
  1208. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1209. } else {
  1210. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1211. this.getList()
  1212. this.isDetail = false
  1213. }
  1214. })
  1215. }).catch(() => {
  1216. this.$message({ type: 'info', message: '已取消删除' })
  1217. })
  1218. },
  1219. handleSelectionChange(val) {
  1220. console.log('勾选数据', val)
  1221. this.selectList = val
  1222. },
  1223. handleDelete() {
  1224. console.log('点击了删除')
  1225. if (this.selectList.length == 0) {
  1226. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1227. } else {
  1228. MessageBox.confirm('是否确认删除此信息?', {
  1229. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1230. }).then(() => {
  1231. console.log(this.selectList)
  1232. this.requestParam.common = { 'returnmap': '0' }
  1233. this.requestParam.data = []
  1234. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1235. this.requestParam.data[0].children = []
  1236. this.requestParam.data[0].children[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  1237. id: '@insertSpotList.id',
  1238. pastureid: '@insertSpotList.pastureid'
  1239. }}
  1240. this.requestParam.data[0].children[1] = { 'name': 'deleteFT', 'type': 'e', 'parammaps': {
  1241. id: '@insertSpotList.id',
  1242. pastureid: '@insertSpotList.pastureid'
  1243. }}
  1244. ExecDataByConfig(this.requestParam).then(response => {
  1245. console.log('删除保存发送参数', this.requestParam)
  1246. if (response.msg === 'fail') {
  1247. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1248. } else {
  1249. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1250. this.getList()
  1251. }
  1252. })
  1253. })
  1254. }
  1255. },
  1256. // 复制
  1257. handleCopy() {
  1258. if (this.selectList.length == 0) {
  1259. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1260. } else {
  1261. MessageBox.confirm('是否确认复制此信息?', {
  1262. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1263. }).then(() => {
  1264. console.log(this.selectList)
  1265. this.requestParam.common = { 'returnmap': '0' }
  1266. this.requestParam.data = []
  1267. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1268. this.requestParam.data[0].children = []
  1269. this.requestParam.data[0].children[0] = { 'name': 'copyFT', 'type': 'e', 'parammaps': {
  1270. ftid: '@insertSpotList.id',
  1271. pastureid: '@insertSpotList.pastureid'
  1272. }}
  1273. ExecDataByConfig(this.requestParam).then(response => {
  1274. console.log('复制保存发送参数', this.requestParam)
  1275. if (response.msg === 'fail') {
  1276. this.$notify({ title: '复制失败', message: response.data, type: 'warning', duration: 2000 })
  1277. } else {
  1278. this.$notify({ title: '', message: '复制成功', type: 'success', duration: 2000 })
  1279. this.getList()
  1280. }
  1281. })
  1282. })
  1283. }
  1284. },
  1285. // 配方记录
  1286. handleRecipeRecord() {
  1287. console.log('点击了配方记录')
  1288. this.template.dialogStatus = 'RecipeRecord'
  1289. this.template.dialogFormVisible = true
  1290. this.template.table.getdataListParm.parammaps.ccname = ''
  1291. this.template.table.getdataListParm.parammaps.fttype = ''
  1292. this.template.table.getdataListParm.parammaps.enable = ''
  1293. this.template.table.getdataListParm.parammaps.tname = ''
  1294. this.template.table.getdataListParm.parammaps.remark = ''
  1295. this.template.table.getdataListParm.parammaps.source = ''
  1296. this.template.table.getdataListParm.offset = 1
  1297. this.getDateList()
  1298. this.isDetailDialog = false
  1299. },
  1300. // 历史时间
  1301. getDateList() {
  1302. GetDataByName(this.template.getdataDateParm).then(response => {
  1303. console.log('table数据', response.data.list)
  1304. if (response.data.list !== null) {
  1305. this.template.table.getdataListParm.parammaps.date = response.data.list[0].maxdate
  1306. this.getTemplateDialogList()
  1307. } else {
  1308. this.template.table.getdataListParm.parammaps.date = ''
  1309. }
  1310. })
  1311. },
  1312. // 配方记录-模板
  1313. getTemplateDialogList() {
  1314. this.template.table.listLoading = true
  1315. GetDataByName(this.template.table.getdataListParm).then(response => {
  1316. console.log('table数据', response.data.list)
  1317. if (response.data.list !== null) {
  1318. this.template.table.list = response.data.list
  1319. this.template.table.pageNum = response.data.pageNum
  1320. this.template.table.pageSize = response.data.pageSize
  1321. this.template.table.total = response.data.total
  1322. } else {
  1323. this.template.table.list = []
  1324. }
  1325. setTimeout(() => {
  1326. this.template.table.listLoading = false
  1327. }, 100)
  1328. })
  1329. },
  1330. handleDialogSearch() {
  1331. this.template.table.getdataListParm.offset = 1
  1332. this.getTemplateDialogList()
  1333. this.arrowDown = true
  1334. this.arrowUp = false
  1335. },
  1336. handleDialogRefresh() {
  1337. this.template.table.getdataListParm.parammaps.ccname = ''
  1338. this.template.table.getdataListParm.parammaps.fttype = ''
  1339. this.template.table.getdataListParm.parammaps.enable = ''
  1340. this.template.table.getdataListParm.parammaps.tname = ''
  1341. this.template.table.getdataListParm.parammaps.remark = ''
  1342. this.template.table.getdataListParm.parammaps.source = ''
  1343. this.template.table.getdataListParm.offset = 1
  1344. this.getTemplateDialogList()
  1345. },
  1346. // 配方记录-模板行点击
  1347. tableRowClickDialog(row, column, event) {
  1348. console.log('配方记录-模板行点击')
  1349. this.isDetailDialog = true
  1350. this.template.table2.getdataListParm.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1351. this.template.table2.getdataListParm.parammaps.version = row.version
  1352. this.template.table2.getdataListParm.parammaps.ftid = row.id
  1353. this.template.table2.getdataListParm.parammaps.dryweight = row.dryweight
  1354. this.getDialogList()
  1355. this.getDownList()
  1356. },
  1357. getDialogList() {
  1358. this.template.table2.listLoading = true
  1359. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1360. console.log('table数据', response.data.list)
  1361. if (response.data.list !== null) {
  1362. this.template.table2.list = response.data.list
  1363. this.template.table2.pageNum = response.data.pageNum
  1364. this.template.table2.pageSize = response.data.pageSize
  1365. this.template.table2.total = response.data.total
  1366. } else {
  1367. this.template.table2.list = []
  1368. }
  1369. this.$nextTick(function() {
  1370. document.querySelector('#detailDialog2').scrollIntoView()
  1371. // window.scrollTo({
  1372. // 'top': this.$refs.detailDialog2.clientHeight
  1373. // })
  1374. })
  1375. setTimeout(() => {
  1376. this.template.table2.listLoading = false
  1377. }, 100)
  1378. })
  1379. },
  1380. handleDialogSearch2() {
  1381. console.log('点击了查询')
  1382. this.arrowDown2 = true
  1383. this.arrowUp2 = false
  1384. this.template.table2.getdataListParm.offset = 1
  1385. this.getDialogList2()
  1386. },
  1387. handleDialogRefresh2() {
  1388. console.log('点击了重置')
  1389. this.template.table2.getdataListParm.parammaps.fname = ''
  1390. this.template.table2.getdataListParm.parammaps.feedgroup = ''
  1391. this.template.table2.getdataListParm.parammaps.fweight = ''
  1392. this.template.table2.getdataListParm.parammaps.autosecondname = ''
  1393. this.template.table2.getdataListParm.parammaps.islockcount = '0'
  1394. this.template.table2.getdataListParm.parammaps.sort = ''
  1395. this.template.table2.getdataListParm.offset = 1
  1396. this.getDialogList2()
  1397. },
  1398. getDialogList2() {
  1399. this.template.table2.listLoading = true
  1400. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1401. console.log('table数据', response.data.list)
  1402. if (response.data.list !== null) {
  1403. this.template.table2.list = response.data.list
  1404. this.template.table2.pageNum = response.data.pageNum
  1405. this.template.table2.pageSize = response.data.pageSize
  1406. this.template.table2.total = response.data.total
  1407. } else {
  1408. this.template.table2.list = []
  1409. }
  1410. this.$nextTick(function() {
  1411. window.scrollTo({
  1412. 'top': this.$refs.templateDialog.clientHeight
  1413. })
  1414. })
  1415. setTimeout(() => {
  1416. this.template.table2.listLoading = false
  1417. }, 100)
  1418. })
  1419. },
  1420. // 导出
  1421. handleExport(item) {
  1422. if (item == 1) {
  1423. console.log('点击了导出模板')
  1424. } else {
  1425. console.log('点击了导出数据')
  1426. this.download.getdataListParm.name = 'downloadFTList'
  1427. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  1428. GetDataByName(this.download.getdataListParm).then(response => {
  1429. if (response.data.list !== null) {
  1430. for (let i = 0; i < response.data.list.length; i++) {
  1431. if (response.data.list[i].islockcount == 0) {
  1432. this.$set(response.data.list[i], 'islockcount', '否')
  1433. } else {
  1434. this.$set(response.data.list[i], 'islockcount', '是')
  1435. }
  1436. if (response.data.list[i].enable == 0) {
  1437. this.$set(response.data.list[i], 'enable', '否')
  1438. } else {
  1439. this.$set(response.data.list[i], 'enable', '是')
  1440. }
  1441. }
  1442. this.download.list = response.data.list
  1443. } else {
  1444. this.download.list = []
  1445. }
  1446. var excelDatas = [
  1447. {
  1448. tHeader: ['配方名称', '牲畜类别', '配方类型', '来源', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '顺序'],
  1449. filterVal: ['tname', 'ccname', 'fttype', 'source', 'remark', 'enable', 'feedgroup', 'fname', 'fweight', 'autosecond', 'islockcount', 'sort'],
  1450. tableDatas: this.download.list,
  1451. sheetName: 'Sheet1'
  1452. }
  1453. ]
  1454. json2excel(excelDatas, '配方模板', true, 'xlsx')
  1455. })
  1456. }
  1457. },
  1458. beforeImport(file) {
  1459. const isLt2M = file.size / 1024 / 1024 < 2
  1460. if (!isLt2M) {
  1461. this.$message.error('上传文件大小不能超过 2MB!')
  1462. }
  1463. return isLt2M
  1464. },
  1465. handleImportSuccess(res, file) {
  1466. this.getList()
  1467. if (res.msg === 'ok') {
  1468. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  1469. if (res.data.err_count > 0) {
  1470. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  1471. import('@/vendor/Export2Excel').then(excel => {
  1472. const list1 = res.data.result
  1473. const tHeader = [
  1474. '配方名称', '牲畜类别', '配方类型', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '错误信息'
  1475. ]
  1476. const filterVal = [
  1477. '配方名称', '牲畜类别', '配方类型', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', 'error_msg'
  1478. ]
  1479. const data1 = this.formatJson(filterVal, list1)
  1480. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '配方模板导入报错信息', autoWidth: true, bookType: 'xlsx' })
  1481. })
  1482. }
  1483. } else {
  1484. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  1485. }
  1486. },
  1487. formatJson(filterVal, jsonData) {
  1488. return jsonData.map(v =>
  1489. filterVal.map(j => {
  1490. if (j === 'timestamp') {
  1491. return parseTime(v[j])
  1492. } else {
  1493. return v[j]
  1494. }
  1495. })
  1496. )
  1497. },
  1498. changeDate() {
  1499. this.getTemplateDialogList()
  1500. },
  1501. // 应用
  1502. handleApplication() {
  1503. console.log('点击了应用')
  1504. MessageBox.confirm('是否确认将' + this.template.table.getdataListParm.parammaps.date + '的数据应用到当前?', {
  1505. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1506. }).then(() => {
  1507. this.requestParam.name = 'applyFTdate'
  1508. this.requestParam.parammaps = {}
  1509. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1510. this.requestParam.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1511. PostDataByName(this.requestParam).then(response => {
  1512. if (response.msg === 'fail') {
  1513. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1514. } else {
  1515. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1516. this.getTemplateDialogList()
  1517. this.getList()
  1518. }
  1519. })
  1520. }).catch(() => {
  1521. this.$message({ type: 'info', message: '已取消应用' })
  1522. })
  1523. },
  1524. // 模板行点击
  1525. tableRowClick(row, column, event) {
  1526. console.log(row, column, event)
  1527. for (let i = 0; i < this.table.list.length; i++) {
  1528. if (this.table.list[i].Edit == true) {
  1529. return false
  1530. }
  1531. }
  1532. console.log(this.isOrder)
  1533. if (this.isOrder == false) {
  1534. this.$message({ type: 'error', message: '请保存或取消当前更改顺序操作', duration: 2000 })
  1535. } else {
  1536. if (column.label !== '操作') {
  1537. this.isDetail = true // 点击行显示详情
  1538. this.table2.getdataListParm.parammaps.ftid = row.id
  1539. this.table2.getdataListParm.parammaps.fttypeid = row.fttypeid
  1540. this.table2.getdataListParm.parammaps.dryweight = row.dryweight
  1541. if (row.fttype == '预混配方') {
  1542. this.requestParams[2].parammaps.type = '1'
  1543. }
  1544. this.getList2()
  1545. this.getDownList()
  1546. }
  1547. }
  1548. },
  1549. // -------------------详情-----------------------------
  1550. // 获取是否显示是否锁定牛头数
  1551. getIsLockCount() {
  1552. GetDataByName(this.lockCount.getdataListParm).then(response => {
  1553. console.log(response.data.list)
  1554. if (response.data.list[0].inforvalue == 0) {
  1555. this.lockCount.isLockCount = false
  1556. } else {
  1557. this.lockCount.isLockCount = true
  1558. }
  1559. })
  1560. },
  1561. // 详情
  1562. getList2() {
  1563. this.table2.listLoading = true
  1564. GetDataByName(this.table2.getdataListParm).then(response => {
  1565. console.log('table数据', response.data.list)
  1566. if (response.data.list !== null) {
  1567. for (let i = 0; i < response.data.list.length; i++) {
  1568. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1569. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1570. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  1571. this.$set(response.data.list[i], 'isGroupDisabled', false) // 饲料组编辑禁止编辑
  1572. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  1573. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1574. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1575. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1576. console.log(this.table2.getdataListParm.parammaps)
  1577. console.log(this.table2, '===')
  1578. }
  1579. this.table2.getDryweightParm.parammaps = this.table2.getdataListParm.parammaps
  1580. this.getDryWeight()
  1581. this.table2.list = response.data.list
  1582. this.table2.pageNum = response.data.pageNum
  1583. this.table2.pageSize = response.data.pageSize
  1584. this.table2.total = response.data.total
  1585. } else {
  1586. this.table2.list = []
  1587. }
  1588. this.$nextTick(function() {
  1589. console.log(this.$refs)
  1590. console.log(this.$refs.template.clientHeight)
  1591. window.scrollTo({
  1592. 'top': this.$refs.template.clientHeight
  1593. })
  1594. })
  1595. setTimeout(() => {
  1596. this.table2.listLoading = false
  1597. }, 100)
  1598. })
  1599. },
  1600. // 行拖拽
  1601. rowDrop() {
  1602. console.log(1111)
  1603. console.log(document.querySelector('#table2 .el-table__body-wrapper tbody'))
  1604. const tbody = document.querySelector('#table2 .el-table__body-wrapper tbody')
  1605. // this.sorTable()
  1606. const that = this
  1607. // Sortable.create(tbody, {
  1608. var sortable = Sortable.create(tbody, {
  1609. disabled: that.dropState,
  1610. onChoose({ newIndex, oldIndex }) {
  1611. console.log(that.isOrder, 'that.isOrder == false')
  1612. console.log(that.dropState, 'that.dropState')
  1613. if (that.dropState == true || that.isOrder == true) {
  1614. sortable.destroy()
  1615. }
  1616. },
  1617. onEnd({ newIndex, oldIndex }) {
  1618. const currRow = that.table2.list.splice(oldIndex, 1)[0]
  1619. that.table2.list.splice(newIndex, 0, currRow)
  1620. console.log('索引', newIndex)
  1621. console.log('拖动数据', currRow)
  1622. console.log('上', that.table2.list[newIndex - 1])
  1623. console.log('下', that.table2.list[newIndex + 1])
  1624. if (that.table2.list[newIndex - 1] === undefined) { // 拖动至最上方无值 // 顺序等于0,其他+1 // 饲料组等于饲料名称
  1625. for (let i = 0; i < that.table2.list.length; i++) {
  1626. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1 // 其他的顺序+1
  1627. }
  1628. currRow.sort = 0
  1629. currRow.feedgroup = currRow.fname
  1630. console.log('拖动至最上方无值')
  1631. } else if (currRow.sort == that.table2.list[newIndex - 1].sort) { // 拖动值顺序等于上值顺序
  1632. currRow.sort = that.table2.list[newIndex - 1].sort
  1633. console.log('拖动值顺序等于上值顺序')
  1634. } else if (that.table2.list[newIndex + 1] == undefined) { // 拖动至最下方无值 // 顺序等于上方顺序+1 // 饲料组等于饲料名称
  1635. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  1636. currRow.feedgroup = currRow.fname
  1637. console.log('拖动至最下方无值')
  1638. } else if (currRow.sort == that.table2.list[newIndex + 1].sort) { // 拖动值顺序等于下值顺序
  1639. currRow.sort == that.table2.list[newIndex + 1].sort
  1640. console.log('拖动值顺序等于下值顺序')
  1641. } else if (that.table2.list[newIndex - 1].sort == that.table2.list[newIndex + 1].sort) { // 拖动至上下顺序一致,顺序/饲料组与上下保持一致
  1642. currRow.sort = that.table2.list[newIndex - 1].sort
  1643. currRow.feedgroup = that.table2.list[newIndex - 1].feedgroup
  1644. console.log('拖动至上下顺序一致')
  1645. } else if (that.table2.list[newIndex - 1].sort !== undefined && that.table2.list[newIndex + 1].sort !== undefined) { // 拖动至上下都有值
  1646. console.log('上下')
  1647. if (parseInt(that.table2.list[newIndex - 1].sort) + 1 == that.table2.list[newIndex + 1].sort) {
  1648. console.log(newIndex)
  1649. for (let i = newIndex; i < that.table2.list.length; i++) {
  1650. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1
  1651. }
  1652. }
  1653. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  1654. currRow.feedgroup = currRow.fname
  1655. console.log(that.table2.list[newIndex + 1].sort)
  1656. }
  1657. }
  1658. })
  1659. console.log(sortable.option('disabled'))
  1660. },
  1661. handleChangeOrder() {
  1662. this.isOrder = false
  1663. this.rowDrop()
  1664. },
  1665. saveChangeOrder() {
  1666. // 保存顺序
  1667. console.log(this.table2.list)
  1668. this.requestParam = {}
  1669. this.requestParam.common = { 'returnmap': '0' }
  1670. this.requestParam.data = []
  1671. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table2.list }}
  1672. this.requestParam.data[0].children = []
  1673. this.requestParam.data[0].children[0] = { 'name': 'updateFTdetailSort', 'type': 'e', 'parammaps': {
  1674. id: '@insertSpotList.id',
  1675. pastureid: '@insertSpotList.pastureid',
  1676. sort: '@insertSpotList.sort',
  1677. feedgroup: '@insertSpotList.feedgroup'
  1678. }}
  1679. ExecDataByConfig(this.requestParam).then(response => {
  1680. console.log('顺序切换保存发送参数', this.requestParam)
  1681. if (response.msg === 'fail') {
  1682. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  1683. } else {
  1684. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  1685. this.getList2()
  1686. this.isOrder = true
  1687. }
  1688. })
  1689. },
  1690. cancelChangeOrder() {
  1691. // 取消顺序
  1692. this.getList2()
  1693. this.isOrder = true
  1694. },
  1695. handleSearch2() {
  1696. console.log('点击了查询')
  1697. this.arrowDown2 = true
  1698. this.arrowUp2 = false
  1699. this.table2.getdataListParm.offset = 1
  1700. this.getList2()
  1701. },
  1702. handleRefresh2() {
  1703. console.log('点击了重置')
  1704. this.table2.getdataListParm.parammaps.fname = ''
  1705. this.table2.getdataListParm.parammaps.feedgroup = ''
  1706. this.table2.getdataListParm.parammaps.fweight = ''
  1707. this.table2.getdataListParm.parammaps.autosecondname = ''
  1708. this.table2.getdataListParm.parammaps.islockcount = '0'
  1709. this.table2.getdataListParm.parammaps.sort = ''
  1710. this.table2.getdataListParm.offset = 1
  1711. this.getList2()
  1712. },
  1713. // 详情新增
  1714. handleCreate2() {
  1715. console.log('点击了详情新增', this.table2.list)
  1716. // 编辑true/不可编辑false
  1717. // 新增操true,编辑false,编辑保存false
  1718. console.log(11)
  1719. for (let i = 0; i < this.table2.list.length; i++) {
  1720. if (this.table2.list[i].Edit === true) {
  1721. console.log(123)
  1722. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1723. return false
  1724. }
  1725. }
  1726. console.log(this.table2.list)
  1727. if (this.table2.list.length == 0) {
  1728. var mysort = 0
  1729. } else {
  1730. var mysort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  1731. }
  1732. 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', 'islockcount': '0', 'sort': mysort })
  1733. console.log(this.table2.list)
  1734. },
  1735. changeFname(item, row) {
  1736. console.log(item, row)
  1737. this.table2.temp.fname = this.feedNameList.find(obj => obj.id == item).fname
  1738. row.fname = this.feedNameList.find(obj => obj.id == item).fname
  1739. if (this.feedNameList.find(obj => obj.id == item).ispreft == '0') {
  1740. this.table2.temp.preftid = '0'
  1741. } else {
  1742. this.table2.temp.preftid = item
  1743. }
  1744. if (row.sort == '') {
  1745. row.feedgroup = this.table2.temp.fname
  1746. } else {
  1747. if (row.isCreate == true) { // 新增状态下
  1748. for (let i = 1; i < this.table2.list.length; i++) {
  1749. if (this.table2.list[i].sort == row.sort) {
  1750. console.log(this.table2.list[i])
  1751. row.feedgroup = this.table2.list[i].feedgroup
  1752. break
  1753. } else {
  1754. row.feedgroup = this.table2.temp.fname
  1755. }
  1756. }
  1757. } else if (row.isUpdateSave == true) { // 编辑状态下
  1758. var Arr = []
  1759. for (let i = 0; i < this.table2.list.length; i++) {
  1760. Arr.push(this.table2.list[i].sort)
  1761. }
  1762. var Count = 0
  1763. for (let i = 0; i < Arr.length; i++) {
  1764. if (Arr[i] == row.sort) {
  1765. Count++
  1766. }
  1767. }
  1768. for (let i = 0; i < this.table2.list.length; i++) {
  1769. if (Count > 1) {
  1770. row.feedgroup = this.table2.list[i].feedgroup
  1771. console.log(111, this.table2.list[i].feedgroup)
  1772. break
  1773. } else if (Count == 1) {
  1774. row.feedgroup = this.table2.temp.fname
  1775. console.log(222, this.table2.temp.fname)
  1776. }
  1777. }
  1778. }
  1779. }
  1780. },
  1781. bort(row) {
  1782. if (row.isCreate == true) {
  1783. if (row.sort !== '') {
  1784. for (let i = 1; i < this.table2.list.length; i++) {
  1785. if (this.table2.list[i].sort == parseInt(row.sort)) {
  1786. row.feedgroup = this.table2.list[i].feedgroup
  1787. return false
  1788. } else {
  1789. row.feedgroup = row.fname
  1790. }
  1791. }
  1792. } else {
  1793. row.feedgroup = row.fname
  1794. }
  1795. } else if (row.isUpdateSave == true) {
  1796. if (row.sort !== '') {
  1797. for (let i = 0; i < this.table2.list.length; i++) {
  1798. if (this.table2.list[i].sort == row.sort) {
  1799. console.log('失去焦点,行内顺序与表格某顺序相同时', this.table2.list[i])
  1800. if (this.table2.list[i].id !== row.id) {
  1801. row.isGroupDisabled = true
  1802. row.feedgroup = this.table2.list[i].feedgroup
  1803. break
  1804. }
  1805. } else {
  1806. console.log('失去焦点,行内顺序与表格某顺序不相同时')
  1807. row.isGroupDisabled = true
  1808. row.feedgroup = row.fname
  1809. }
  1810. }
  1811. } else {
  1812. row.feedgroup = row.fname
  1813. }
  1814. }
  1815. },
  1816. createData2(row) {
  1817. console.log('点击了详情新增保存', row)
  1818. this.table2.temp.pastureid = Cookies.get('pastureid')
  1819. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  1820. this.table2.temp.fid = row.fid
  1821. this.table2.temp.fname = this.table2.temp.fname
  1822. this.table2.temp.fweight = row.fweight
  1823. this.table2.temp.islockcount = row.islockcount
  1824. this.table2.temp.sort = row.sort
  1825. this.table2.temp.feedgroup = row.feedgroup
  1826. this.table2.temp.preftid = this.table2.temp.preftid
  1827. this.table2.temp.autosecond = row.autosecond
  1828. if (this.table2.temp.fid == '' && this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
  1829. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时不能为空', duration: 2000 })
  1830. return false
  1831. } else if (this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
  1832. this.$message({ type: 'error', message: '重量/搅拌延时不能为空', duration: 2000 })
  1833. return false
  1834. } else if (this.table2.temp.fid == '') {
  1835. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  1836. return false
  1837. } else if (this.table2.temp.fweight == '') {
  1838. this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  1839. return false
  1840. } else if (this.table2.temp.autosecond == '') {
  1841. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  1842. return false
  1843. }
  1844. if (this.table2.temp.sort !== '') {
  1845. this.table2.temp.sort = this.table2.temp.sort
  1846. } else {
  1847. console.log(this.table2.list.length)
  1848. if (this.table2.list.length == 1) {
  1849. this.table2.temp.sort = 0
  1850. } else {
  1851. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  1852. row.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  1853. }
  1854. }
  1855. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  1856. if (parseInt(this.table2.temp.preftid) > 0) {
  1857. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  1858. return false
  1859. }
  1860. }
  1861. // 校验顺序是否>=0
  1862. var ruleSort = /^\d+$/
  1863. if (!ruleSort.test(this.table2.temp.sort)) {
  1864. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  1865. return false
  1866. }
  1867. // 检验重量>0
  1868. // this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 2) //根据默认参数设置小数位数
  1869. var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  1870. if (!ruleWeight.test(this.table2.temp.fweight)) {
  1871. this.$message({ type: 'error', message: '重量请输入正数,最多保留俩位小数', duration: 2000 })
  1872. return false
  1873. }
  1874. this.isokDisable = true
  1875. setTimeout(() => {
  1876. this.isokDisable = false
  1877. }, 1000)
  1878. this.requestParam.common = { 'returnmap': '0' }
  1879. this.requestParam.data = []
  1880. this.requestParam.data[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  1881. pastureid: this.table2.temp.pastureid,
  1882. ftid: this.table2.getdataListParm.parammaps.ftid,
  1883. fid: row.fid,
  1884. fname: this.table2.temp.fname,
  1885. fweight: row.fweight,
  1886. islockcount: row.islockcount,
  1887. sort: row.sort,
  1888. feedgroup: row.feedgroup,
  1889. preftid: this.table2.temp.preftid,
  1890. autosecond: row.autosecond
  1891. }}
  1892. this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  1893. pastureid: this.table2.temp.pastureid,
  1894. ftid: this.table2.getdataListParm.parammaps.ftid,
  1895. type: this.table2.getdataListParm.parammaps.fttypeid
  1896. }}
  1897. ExecDataByConfig(this.requestParam).then(response => {
  1898. console.log('新增保存发送参数', this.requestParam)
  1899. if (response.msg !== 'fail') {
  1900. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1901. this.getList2()
  1902. } else {
  1903. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1904. }
  1905. })
  1906. },
  1907. createCancel2(row) {
  1908. console.log('点击了详情新增取消')
  1909. for (let i = 0; i < this.table2.list.length; i++) {
  1910. if (row.myId === this.table2.list[i].myId) {
  1911. var listIndex = this.table2.list.indexOf(this.table2.list[i])
  1912. }
  1913. if (listIndex > -1) {
  1914. this.table2.list.splice(listIndex, 1)
  1915. return
  1916. }
  1917. }
  1918. this.getDialogList()
  1919. },
  1920. // 详情编辑
  1921. handleUpdate2(row) {
  1922. console.log('详情编辑', row)
  1923. this.dropState = true
  1924. row.isGroupDisabled = false
  1925. row.islockcount = String(row.islockcount)
  1926. row.fid = String(row.fid)
  1927. row.autosecond = String(row.autosecond)
  1928. this.table2.temp.fname = row.fname
  1929. this.table2.temp.preftid = row.preftid
  1930. const rowArr = []
  1931. for (let i = 0; i < this.table2.list.length; i++) {
  1932. if (this.table2.list[i].Edit == true) {
  1933. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1934. return false
  1935. }
  1936. rowArr.push(this.table2.list[i].sort)
  1937. }
  1938. var count = 0
  1939. for (let i = 0; i < rowArr.length; i++) {
  1940. if (rowArr[i] == row.sort) {
  1941. count++
  1942. }
  1943. }
  1944. // 判断是否有相同顺序,如果没有饲料组不可编辑,若有饲料组可编辑
  1945. if (count == 1) {
  1946. // 饲料组编辑false,不可编辑true
  1947. row.groupEdit = false
  1948. row.groupNoEdit = true
  1949. // 编辑true,不可编辑false
  1950. row.Edit = true
  1951. row.NoEdit = false
  1952. // 新增false,编辑false,编辑保存true
  1953. row.isCreate = false
  1954. row.isUpdate = false
  1955. row.isUpdateSave = true
  1956. } else if (count > 1) {
  1957. // 饲料组编辑true,不可编辑false
  1958. row.groupEdit = true
  1959. row.groupNoEdit = false
  1960. console.log(222)
  1961. // 编辑true,不可编辑false
  1962. row.Edit = true
  1963. row.NoEdit = false
  1964. // 新增false,编辑false,编辑保存true
  1965. row.isCreate = false
  1966. row.isUpdate = false
  1967. row.isUpdateSave = true
  1968. return false
  1969. }
  1970. },
  1971. updateData2(row) {
  1972. console.log('点击了详情编辑保存111', row)
  1973. this.isokDisable = true
  1974. setTimeout(() => {
  1975. this.isokDisable = false
  1976. }, 1000)
  1977. this.table2.temp.pastureid = row.pastureid
  1978. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  1979. this.table2.temp.fid = row.fid
  1980. this.table2.temp.fname = this.table2.temp.fname
  1981. this.table2.temp.fweight = row.fweight
  1982. this.table2.temp.islockcount = row.islockcount
  1983. this.table2.temp.sort = row.sort
  1984. this.table2.temp.feedgroup = row.feedgroup
  1985. this.table2.temp.preftid = this.table2.temp.preftid
  1986. this.table2.temp.autosecond = row.autosecond
  1987. this.table2.temp.id = row.id
  1988. if (this.table2.temp.fid == '' && this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
  1989. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时不能为空', duration: 2000 })
  1990. return false
  1991. } else if (this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
  1992. this.$message({ type: 'error', message: '重量/搅拌延时不能为空', duration: 2000 })
  1993. return false
  1994. } else if (this.table2.temp.fid == '') {
  1995. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  1996. return false
  1997. } else if (this.table2.temp.fweight == '') {
  1998. this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  1999. return false
  2000. } else if (this.table2.temp.autosecond == '') {
  2001. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  2002. return false
  2003. }
  2004. if (this.table2.temp.sort !== '') {
  2005. this.table2.temp.sort = this.table2.temp.sort
  2006. } else {
  2007. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2008. }
  2009. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2010. if (parseInt(this.table2.temp.preftid) > 0) {
  2011. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  2012. return false
  2013. }
  2014. }
  2015. // 校验顺序是否>=0
  2016. var ruleSort = /^\d+$/
  2017. if (!ruleSort.test(this.table2.temp.sort)) {
  2018. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  2019. return false
  2020. }
  2021. // this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 2) //根据默认参数设置小数位数
  2022. // 检验重量>0
  2023. var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  2024. if (!ruleWeight.test(this.table2.temp.fweight)) {
  2025. this.$message({ type: 'error', message: '重量请输入正数,最多保留俩位小数', duration: 2000 })
  2026. return false
  2027. }
  2028. this.requestParam.common = { 'returnmap': '0' }
  2029. this.requestParam.data = []
  2030. this.requestParam.data[0] = { 'name': 'updateFTdetail', 'type': 'e', 'parammaps': {
  2031. pastureid: row.pastureid,
  2032. ftid: this.table2.getdataListParm.parammaps.ftid,
  2033. fid: row.fid,
  2034. fname: this.table2.temp.fname,
  2035. fweight: row.fweight,
  2036. islockcount: row.islockcount,
  2037. sort: row.sort,
  2038. feedgroup: row.feedgroup,
  2039. preftid: this.table2.temp.preftid,
  2040. autosecond: row.autosecond,
  2041. id: row.id
  2042. }}
  2043. this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2044. pastureid: row.pastureid,
  2045. ftid: this.table2.getdataListParm.parammaps.ftid,
  2046. type: this.table2.getdataListParm.parammaps.fttypeid
  2047. }}
  2048. this.requestParam.data[2] = { 'name': 'updateFTdetailbySort', 'type': 'e', 'parammaps': {
  2049. pastureid: row.pastureid,
  2050. ftid: this.table2.getdataListParm.parammaps.ftid,
  2051. sort: row.sort,
  2052. feedgroup: row.feedgroup
  2053. }}
  2054. ExecDataByConfig(this.requestParam).then(response => {
  2055. console.log('新增保存发送参数', this.requestParam)
  2056. if (response.msg !== 'fail') {
  2057. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2058. this.getList2()
  2059. this.dropState = false
  2060. } else {
  2061. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2062. }
  2063. })
  2064. },
  2065. updateCancel2(row) {
  2066. console.log('点击了详情编辑取消')
  2067. // 饲料组编辑false,不可编辑true
  2068. row.groupEdit = false
  2069. row.groupNoEdit = true
  2070. // 编辑false,不可编辑true
  2071. row.Edit = false
  2072. row.NoEdit = true
  2073. // 新增false,编辑true,编辑保存false
  2074. row.isCreate = false
  2075. row.isUpdate = true
  2076. row.isUpdateSave = false
  2077. this.getList2()
  2078. this.dropState = false
  2079. },
  2080. // 详情删除
  2081. handleRowDelete2(row) {
  2082. console.log('点击了行内删除')
  2083. MessageBox.confirm('是否确认删除此信息?', {
  2084. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2085. }).then(() => {
  2086. this.requestParam.common = { 'returnmap': '0' }
  2087. this.requestParam.data = []
  2088. this.requestParam.data[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2089. pastureid: row.pastureid,
  2090. id: row.id
  2091. }}
  2092. this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2093. pastureid: row.pastureid,
  2094. ftid: this.table2.getdataListParm.parammaps.ftid,
  2095. type: this.table2.getdataListParm.parammaps.fttypeid
  2096. }}
  2097. ExecDataByConfig(this.requestParam).then(response => {
  2098. console.log('新增保存发送参数', this.requestParam)
  2099. if (response.msg === 'fail') {
  2100. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2101. } else {
  2102. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2103. this.getList2()
  2104. }
  2105. })
  2106. }).catch(() => {
  2107. this.$message({ type: 'info', message: '已取消删除' })
  2108. })
  2109. },
  2110. handleSelectionChange2(val) {
  2111. console.log('勾选数据', val)
  2112. this.selectList2 = val
  2113. },
  2114. handleDelete2() {
  2115. console.log('点击了删除')
  2116. if (this.selectList2.length == 0) {
  2117. this.$message({ type: 'error', message: '请选择配方详情', duration: 2000 })
  2118. } else {
  2119. MessageBox.confirm('是否确认删除此信息?', {
  2120. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2121. }).then(() => {
  2122. console.log(this.selectList)
  2123. this.requestParam.common = { 'returnmap': '0' }
  2124. this.requestParam.data = []
  2125. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList2 }}
  2126. this.requestParam.data[0].children = []
  2127. this.requestParam.data[0].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2128. id: '@insertSpotList.id',
  2129. pastureid: '@insertSpotList.pastureid'
  2130. }}
  2131. ExecDataByConfig(this.requestParam).then(response => {
  2132. console.log('删除保存发送参数', this.requestParam)
  2133. if (response.msg === 'fail') {
  2134. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2135. } else {
  2136. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  2137. this.getList2()
  2138. }
  2139. })
  2140. })
  2141. }
  2142. },
  2143. // 拆分预混料
  2144. handleSplitPremix(row) {
  2145. console.log('点击了拆分预混料')
  2146. MessageBox.confirm('是否确认拆分当前预混料?', {
  2147. confirmButtonText: '确认',
  2148. cancelButtonText: '取消',
  2149. type: 'warning'
  2150. }).then(() => {
  2151. this.requestParam.name = 'splitFTpre'
  2152. this.requestParam.parammaps = {}
  2153. this.requestParam.parammaps.ftid = this.table2.getdataListParm.parammaps.ftid
  2154. this.requestParam.parammaps.preftid = row.preftid
  2155. this.requestParam.parammaps.ftdid = row.id
  2156. this.requestParam.parammaps.pastureid = row.pastureid
  2157. this.requestParam.parammaps.feedgroup = row.feedgroup
  2158. this.requestParam.parammaps.sort = row.sort
  2159. this.requestParam.parammaps.fweight = row.fweight
  2160. PostDataByName(this.requestParam).then(response => {
  2161. if (response.msg === 'fail') {
  2162. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2163. } else {
  2164. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2165. this.getList2()
  2166. }
  2167. })
  2168. }).catch(() => {
  2169. this.$message({
  2170. type: 'info',
  2171. message: '已取消删除'
  2172. })
  2173. })
  2174. },
  2175. // 合成预混料
  2176. handleSyntheticPremix() {
  2177. console.log('点击了合成预混料', this.selectList2)
  2178. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2179. this.$message({ type: 'error', message: '预混配方不可合成预混料', duration: 2000 })
  2180. return false
  2181. } else {
  2182. if (this.selectList2.length > 1) {
  2183. for (let i = 0; i < this.selectList2.length; i++) {
  2184. if (parseInt(this.selectList2[i].preftid) > 0) {
  2185. this.$message({ type: 'error', message: '不可选择预混料', duration: 2000 })
  2186. return false
  2187. }
  2188. }
  2189. if (this.selectList2[0].splitftpreid !== undefined) {
  2190. this.detail.getdataListParm.parammaps.ftid = this.selectList2[0].splitftpreid
  2191. this.detail.getdataListParm.parammaps.pastureid = this.selectList2[0].pastureid
  2192. GetDataByName(this.detail.getdataListParm).then(response => {
  2193. if (response.data.list !== null) { // 不为空时得到比对数据
  2194. this.detail.list3 = response.data.list
  2195. const sortList = [] // 声明排序数组
  2196. var fweightSum = 0 // 总重量
  2197. for (let i = 0; i < this.selectList2.length; i++) {
  2198. const obj = {}
  2199. obj.fid = this.selectList2[i].fid
  2200. obj.fweight = this.selectList2[i].fweight
  2201. fweightSum = fweightSum + parseFloat(this.selectList2[i].fweight)
  2202. sortList.push(obj)
  2203. }
  2204. // 排序
  2205. sortList.sort(function(a, b) {
  2206. return a.fid.localeCompare(b.fid)
  2207. })
  2208. var a = 0
  2209. if (this.detail.list3.length == sortList.length) {
  2210. for (let i = 0; i < this.detail.list3.length; i++) {
  2211. if (this.detail.list3[i].fid == sortList[i].fid && (this.detail.list3[i].fweight / this.detail.list3[i].sumWeight).toFixed(2) == (sortList[i].fweight / fweightSum).toFixed(2)) {
  2212. a++
  2213. }
  2214. }
  2215. if (a == this.detail.list3.length) { // 如果相等,则该配方为原预混配方
  2216. this.detail.getdataListParm2.parammaps.ftid = this.selectList2[0].splitftpreid
  2217. this.detail.getdataListParm2.parammaps.pastureid = this.selectList2[0].pastureid
  2218. GetDataByName(this.detail.getdataListParm2).then(response => {
  2219. if (response.data.list !== null) {
  2220. this.detail.dialogStatus = 'SyntheticPremix'
  2221. this.detail.dialogFormVisible = true
  2222. this.detail.list = this.selectList2
  2223. this.detail.list2 = response.data.list
  2224. this.detail.disabled = true
  2225. setTimeout(() => {
  2226. this.detail.listLoading = false
  2227. }, 100)
  2228. } else {
  2229. this.detail.list2 = []
  2230. }
  2231. })
  2232. } else {
  2233. this.detail.dialogStatus = 'SyntheticPremix'
  2234. this.detail.dialogFormVisible = true
  2235. this.detail.list = this.selectList2
  2236. this.detail.disabled = false
  2237. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2238. setTimeout(() => {
  2239. this.detail.listLoading = false
  2240. }, 100)
  2241. }
  2242. } else {
  2243. this.detail.dialogStatus = 'SyntheticPremix'
  2244. this.detail.dialogFormVisible = true
  2245. this.detail.list = this.selectList2
  2246. this.detail.disabled = false
  2247. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2248. setTimeout(() => {
  2249. this.detail.listLoading = false
  2250. }, 100)
  2251. }
  2252. } else {
  2253. this.detail.list3 = []
  2254. this.detail.dialogStatus = 'SyntheticPremix'
  2255. this.detail.dialogFormVisible = true
  2256. this.detail.list = this.selectList2
  2257. this.detail.disabled = false
  2258. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2259. setTimeout(() => {
  2260. this.detail.listLoading = false
  2261. }, 100)
  2262. }
  2263. })
  2264. } else {
  2265. this.detail.dialogStatus = 'SyntheticPremix'
  2266. this.detail.dialogFormVisible = true
  2267. this.detail.list = this.selectList2
  2268. this.detail.disabled = false
  2269. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2270. setTimeout(() => {
  2271. this.detail.listLoading = false
  2272. }, 100)
  2273. }
  2274. } else {
  2275. this.$message({ type: 'error', message: '请选择俩条及以上饲料进行合成', duration: 2000 })
  2276. return false
  2277. }
  2278. }
  2279. },
  2280. // 畜生类别
  2281. changeLivestockType2(item) {
  2282. this.detail.list2[0].ccname = this.livestockTypeList.find(obj => obj.value === item).label
  2283. },
  2284. syntheticPremixData() {
  2285. console.log('点击了合成预混料确认')
  2286. if (this.detail.disabled == true) { // 原预混料
  2287. let sumFweight = 0
  2288. for (let i = 0; i < this.detail.list.length; i++) {
  2289. sumFweight += parseFloat(this.detail.list[i].fweight)
  2290. }
  2291. sumFweight = sumFweight.toFixed(2)
  2292. this.isokDisable = true
  2293. setTimeout(() => {
  2294. this.isokDisable = false
  2295. }, 1000)
  2296. this.requestParam.common = { 'returnmap': '0' }
  2297. this.requestParam.data = []
  2298. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  2299. this.requestParam.data[0].children = []
  2300. this.requestParam.data[0].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2301. pastureid: '@insertSpotList.pastureid',
  2302. id: '@insertSpotList.id'
  2303. }}
  2304. this.requestParam.data[1] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  2305. this.requestParam.data[1].children = []
  2306. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  2307. pastureid: Cookies.get('pastureid'),
  2308. ftid: this.table2.getdataListParm.parammaps.ftid,
  2309. fid: this.detail.list2[0].id,
  2310. fname: '@insertSpotList2.tname',
  2311. fweight: sumFweight,
  2312. islockcount: '0',
  2313. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  2314. feedgroup: '@insertSpotList2.tname',
  2315. preftid: this.detail.list2[0].id,
  2316. autosecond: this.detail.list[0].autosecond
  2317. }}
  2318. ExecDataByConfig(this.requestParam).then(response => {
  2319. console.log('合成预混料保存发送参数', this.requestParam)
  2320. if (response.msg === 'fail') {
  2321. const tname = new RegExp("key 'tname'")
  2322. if (tname.test(response.data)) {
  2323. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  2324. } else {
  2325. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2326. }
  2327. } else {
  2328. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  2329. this.detail.dialogFormVisible = false
  2330. this.getList()
  2331. this.getList2()
  2332. this.getDownList()
  2333. }
  2334. })
  2335. } else { // 现生成预混料
  2336. if (this.detail.list2[0].tname == '' && this.detail.list2[0].ccid == '') {
  2337. this.$message({ type: 'error', message: '配方名称/牲畜类别/不能为空', duration: 2000 })
  2338. return false
  2339. } else if (this.detail.list2[0].tname == '') {
  2340. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  2341. return false
  2342. } else if (this.detail.list2[0].ccid == '') {
  2343. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  2344. return false
  2345. }
  2346. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  2347. if (pattern.test(this.detail.list2[0].tname)) {
  2348. this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  2349. return false
  2350. }
  2351. let sumFweight = 0
  2352. for (let i = 0; i < this.detail.list.length; i++) {
  2353. sumFweight += parseFloat(this.detail.list[i].fweight)
  2354. }
  2355. sumFweight = sumFweight.toFixed(2)
  2356. console.log(sumFweight)
  2357. this.isokDisable = true
  2358. setTimeout(() => {
  2359. this.isokDisable = false
  2360. }, 1000)
  2361. if (this.detail.list2[0].tcolor == null) {
  2362. this.detail.list2[0].tcolor = '#CCCCCC'
  2363. }
  2364. this.requestParam.common = { 'returnmap': '0' }
  2365. this.requestParam.data = []
  2366. this.requestParam.data[0] = { 'name': 'insertFT', 'type': 'e', 'parammaps': {
  2367. pastureid: Cookies.get('pastureid'),
  2368. tcode: this.detail.list2[0].tcode,
  2369. tname: this.detail.list2[0].tname,
  2370. tcolor: this.detail.list2[0].tcolor,
  2371. ccid: this.detail.list2[0].ccid,
  2372. ccname: this.detail.list2[0].ccname,
  2373. fttype: this.detail.list2[0].fttype,
  2374. fttypeid: this.detail.list2[0].fttypeid,
  2375. source: this.detail.list2[0].source,
  2376. remark: this.detail.list2[0].remark,
  2377. enable: this.detail.list2[0].enable
  2378. }}
  2379. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  2380. this.requestParam.data[1].children = []
  2381. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  2382. pastureid: '@insertSpotList.pastureid',
  2383. ftid: '@insertFT.LastInsertId',
  2384. fid: '@insertSpotList.fid',
  2385. fname: '@insertSpotList.fname',
  2386. fweight: '@insertSpotList.fweight',
  2387. islockcount: '@insertSpotList.islockcount',
  2388. sort: '@insertSpotList.sort',
  2389. feedgroup: '@insertSpotList.feedgroup',
  2390. preftid: '@insertSpotList.preftid',
  2391. autosecond: '@insertSpotList.autosecond'
  2392. }}
  2393. this.requestParam.data[1].children[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2394. pastureid: '@insertSpotList.pastureid',
  2395. id: '@insertSpotList.id'
  2396. }}
  2397. this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  2398. this.requestParam.data[2].children = []
  2399. this.requestParam.data[2].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  2400. pastureid: Cookies.get('pastureid'),
  2401. ftid: this.table2.getdataListParm.parammaps.ftid,
  2402. fid: '@insertFT.LastInsertId',
  2403. fname: '@insertSpotList2.tname',
  2404. fweight: sumFweight,
  2405. islockcount: '0',
  2406. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  2407. feedgroup: '@insertSpotList2.tname',
  2408. preftid: '@insertFT.LastInsertId',
  2409. autosecond: this.detail.list[0].autosecond
  2410. }}
  2411. ExecDataByConfig(this.requestParam).then(response => {
  2412. console.log('合成预混料保存发送参数', this.requestParam)
  2413. if (response.msg === 'fail') {
  2414. const tname = new RegExp("key 'tname'")
  2415. if (tname.test(response.data)) {
  2416. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  2417. } else {
  2418. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2419. }
  2420. } else {
  2421. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  2422. this.detail.dialogFormVisible = false
  2423. this.getList()
  2424. this.getList2()
  2425. this.getDownList()
  2426. }
  2427. })
  2428. }
  2429. },
  2430. handleFormulationEvaluation(row) {
  2431. console.log(row)
  2432. this.$router.push({ path: '/statisticalAnalysis/FormulationEvaluation', query: { tname: row.tname }})
  2433. this.$router.push({
  2434. name: 'FormulationEvaluation',
  2435. params: {
  2436. tname: row.tname,
  2437. ftid: row.id,
  2438. pastureid: row.pastureid,
  2439. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  2440. inputDatetime: [new Date('startTime'), new Date('startTime')], // 日期后台待传
  2441. stopTime: parseTime(new Date(), '{y}-{m}-{d}')
  2442. }
  2443. })
  2444. }
  2445. }
  2446. }
  2447. </script>
  2448. <style lang="scss" scoped>
  2449. .search{margin-top:10px;}
  2450. .table{margin-top:10px;}
  2451. .table2{margin-top:10px;}
  2452. $width:350px;
  2453. $left:325px;
  2454. .selectInput{
  2455. position: relative;
  2456. display: inline-block;
  2457. .Input{width: $width;position: relative;}
  2458. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  2459. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  2460. .selectUl{
  2461. 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;
  2462. li{
  2463. 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;
  2464. a{float:left;width: 80px;}
  2465. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  2466. }
  2467. }
  2468. }
  2469. .template{
  2470. background: #fff;
  2471. position: relative;
  2472. }
  2473. .detail{
  2474. background: #fff;
  2475. position: relative;
  2476. }
  2477. .templateDialog{
  2478. background: #fff;
  2479. position: relative;
  2480. }
  2481. .detailDialog{
  2482. background: #fff;
  2483. position: relative;
  2484. }
  2485. </style>