7ab4edb7746fb572c3f83e43052801022becb716.svn-base 94 KB

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