3ba229f3b91546bb9168c7dcd4c97f70ac29e94f.svn-base 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  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. </div>
  12. <div class="search">
  13. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="牲畜类别" class="filter-item" clearable>
  14. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.name" :value="item.name" />
  15. </el-select>
  16. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>
  17. <el-option v-for="item in formulaTypeList" :key="item.id" :label="item.name" :value="item.name" />
  18. </el-select>
  19. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>
  20. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.name" />
  21. </el-select>
  22. <div ref="selectInput" class="filter-item selectInput">
  23. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  24. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  25. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  26. <ul v-if="arrowUp" class="selectUl">
  27. <li><a>模板名称</a><el-input v-model="table.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  28. <li><a>制定人</a><el-input v-model="table.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  29. <li><a>说明</a><el-input v-model="table.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  30. <li>
  31. <div style="float: right;">
  32. <el-button class="minCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  33. <el-button class="miniSuccess" @click="handleSearch">搜索</el-button>
  34. </div>
  35. </li>
  36. </ul>
  37. </div>
  38. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  39. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  40. </div>
  41. <div class="table">
  42. <el-table
  43. :key="table.tableKey"
  44. v-loading="table.listLoading"
  45. element-loading-text="给我一点时间"
  46. :data="table.list"
  47. border
  48. fit
  49. highlight-current-row
  50. style="width: 98%;"
  51. :row-style="rowStyle"
  52. :cell-style="cellStyle"
  53. class="elTable table-fixed"
  54. @row-click="tableRowClick"
  55. >
  56. <el-table-column label="序号" align="center" type="index" width="50px">
  57. <template slot-scope="scope">
  58. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="配方名称" min-width="130px" align="center">
  62. <template slot-scope="scope">
  63. <span v-if="scope.row.NoEdit">{{ scope.row.eqName }}</span>
  64. <el-input v-if="scope.row.Edit" v-model="scope.row.eqName" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" style="width:80%;padding:10px 0;" maxlength="32" />
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="配方颜色" min-width="130px" align="center">
  68. <template slot-scope="scope">
  69. <el-color-picker v-model="scope.row.financeCode" size="mini" :disabled="scope.row.NoEdit" style="margin:10px 0;" />
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="牲畜类别" min-width="150px" align="center">
  73. <template slot-scope="scope">
  74. <span v-if="scope.row.NoEdit">{{ scope.row.pastureName }}</span>
  75. <el-select v-if="scope.row.Edit" v-model="scope.row.pastureName" placeholder="牲畜类别" class="filter-item" style="width:80%;padding:10px 0;">
  76. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.name" :value="item.name" />
  77. </el-select>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="配方类型" min-width="150px" align="center">
  81. <template slot-scope="scope">
  82. <span v-if="scope.row.NoEdit">{{ scope.row.specification }}</span>
  83. <el-select v-if="scope.row.Edit" v-model="scope.row.specification" placeholder="配方类型" class="filter-item" style="width:80%;padding:10px 0;">
  84. <el-option v-for="item in formulaTypeList" :key="item.id" :label="item.name" :value="item.name" />
  85. </el-select>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="来源" min-width="110px" align="center">
  89. <template slot-scope="scope">
  90. <span>{{ scope.row.status }}</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="备注" min-width="110px" align="center">
  94. <template slot-scope="scope">
  95. <span v-if="scope.row.NoEdit">{{ scope.row.yuanzhi }}</span>
  96. <el-input v-if="scope.row.Edit" v-model="scope.row.yuanzhi" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" style="width:80%;padding:10px 0;" maxlength="32" />
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="是否启用" min-width="110px" align="center">
  100. <template slot-scope="scope">
  101. <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)" />
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  105. <template slot-scope="{row}">
  106. <!-- 新增 -->
  107. <el-button v-if="row.isCreate" class="miniSuccess" @click="createData(row)">保存</el-button>
  108. <el-button v-if="row.isCreate" class="minCancel" @click="createCancel(row)">取消</el-button>
  109. <!-- 编辑 -->
  110. <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  111. <el-button v-if="row.isUpdate" class="miniDanger" @click="handleRowDelete(row)">删除</el-button>
  112. <!-- 编辑保存 -->
  113. <el-button v-if="row.isUpdateSave" class="miniSuccess" @click="updateData(row)">保存</el-button>
  114. <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel(row)">取消</el-button>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. </div>
  119. </div>
  120. <!-- 配方详情表 -->
  121. <div v-if="isDetail" ref="detail" class="detail" style="margin-top: 30px;">
  122. <p class="recipeDetail" />
  123. <div class="operation">
  124. <el-button class="success" @click="handleCreate2">新增</el-button>
  125. <el-button class="danger" @click="handleDelete2">删除</el-button>
  126. <el-button class="success" @click="handleSyntheticPremix">合成预混料</el-button>
  127. <div ref="selectInput2" class="filter-item selectInput">
  128. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  129. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  130. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  131. <ul v-if="arrowUp2" class="selectUl">
  132. <li><a>饲料名称</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  133. <li><a>饲料类型</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  134. <li><a>重量</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  135. <li><a>搅拌延时</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  136. <li><a>顺序</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  137. <li>
  138. <div style="float: right;">
  139. <el-button class="minCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>
  140. <el-button class="miniSuccess" @click="handleSearch2">搜索</el-button>
  141. </div>
  142. </li>
  143. </ul>
  144. </div>
  145. <el-button class="successBorder" @click="handleSearch2">查询</el-button>
  146. <el-button class="successBorder" @click="handleRefresh2">重置</el-button>
  147. </div>
  148. <div class="table2">
  149. <el-table
  150. id="table2"
  151. ref="table2"
  152. :key="table2.tableKey"
  153. v-loading="table2.listLoading"
  154. element-loading-text="给我一点时间"
  155. :data="table2.list"
  156. border
  157. fit
  158. highlight-current-row
  159. style="width: 98%;"
  160. :row-style="rowStyle"
  161. :cell-style="cellStyle"
  162. class="elTable table-fixed"
  163. row-key="id"
  164. show-summary
  165. @selection-change="handleSelect"
  166. >
  167. <el-table-column type="selection" min-width="50" />
  168. <el-table-column label="序号" align="center" type="index" width="50px" />
  169. <el-table-column label="饲料组" min-width="130px" align="center">
  170. <template slot-scope="scope">
  171. <span v-if="scope.row.groupNoEdit">{{ scope.row.group }}</span>
  172. <el-input v-if="scope.row.groupEdit" v-model="scope.row.group" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" style="width:80%;padding:10px 0;" maxlength="32" />
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="饲料名称" min-width="130px" align="center">
  176. <template slot-scope="scope">
  177. <span v-if="scope.row.NoEdit">{{ scope.row.name }}</span>
  178. <el-select v-if="scope.row.Edit" v-model="scope.row.name" placeholder="" class="filter-item" style="width:80%;padding:10px 0;">
  179. <el-option v-for="item in feedNameList" :key="item.id" :label="item.name" :value="item.name" />
  180. </el-select>
  181. </template>
  182. </el-table-column>
  183. <el-table-column label="重量(KG)" prop="weight" min-width="130px" align="center">
  184. <template slot-scope="scope">
  185. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  186. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" style="width:80%;padding:10px 0;" />
  187. </template>
  188. </el-table-column>
  189. <el-table-column label="搅拌延时(min)" min-width="130px" align="center">
  190. <template slot-scope="scope">
  191. <span v-if="scope.row.NoEdit">{{ scope.row.hour }}</span>
  192. <el-select v-if="scope.row.Edit" v-model="scope.row.hour" placeholder="" class="filter-item" style="width:80%;padding:10px 0;">
  193. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />
  194. </el-select>
  195. </template>
  196. </el-table-column>
  197. <el-table-column label="是否锁定牛头数比例" min-width="130px" align="center">
  198. <template slot-scope="scope">
  199. <span v-if="scope.row.NoEdit">{{ scope.row.proportion }}</span>
  200. <el-select v-if="scope.row.Edit" v-model="scope.row.proportion" placeholder="" class="filter-item" style="width:80%;padding:10px 0;">
  201. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.name" />
  202. </el-select>
  203. </template>
  204. </el-table-column>
  205. <el-table-column label="顺序" min-width="130px" align="center">
  206. <template slot-scope="scope">
  207. <span v-if="scope.row.NoEdit">{{ scope.row.order }}</span>
  208. <el-input v-if="scope.row.Edit" v-model="scope.row.order" type="number" style="width:80%;padding:10px 0;" min-number="0" />
  209. </template>
  210. </el-table-column>
  211. <el-table-column label="操作" align="center" width="320" class-name="small-padding fixed-width" fixed="right">
  212. <template slot-scope="{row}">
  213. <!-- 新增 -->
  214. <el-button v-if="row.isCreate" class="miniSuccess" @click="createData2(row)">保存</el-button>
  215. <el-button v-if="row.isCreate" class="minCancel" @click="createCancel2(row)">取消</el-button>
  216. <!-- 编辑 -->
  217. <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate2(row)">编辑</el-button>
  218. <el-button v-if="row.isUpdate" class="miniDanger" @click="handleRowDelete2(row)">删除</el-button>
  219. <!-- 编辑保存 -->
  220. <el-button v-if="row.isUpdateSave" class="miniSuccess" @click="updateData2(row)">保存</el-button>
  221. <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel2(row)">取消</el-button>
  222. <!-- 拆分预混料 -->
  223. <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleSplitPremix(row)">拆分预混料</el-button>
  224. </template>
  225. </el-table-column>
  226. </el-table>
  227. </div>
  228. </div>
  229. <!-- 配方记录 -->
  230. <el-dialog :title="textMap[template.dialogStatus]" :destroy-on-close="true" :visible.sync="template.dialogFormVisible" :close-on-click-modal="false" width="90%">
  231. <div style="height: 400px;overflow: auto;margin-bottom: 30px;">
  232. <div ref="templateDialog" class="templateDialog">
  233. <p class="recipeTemplate" />
  234. <div class="operation">
  235. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="请选择历史记录时间" class="filter-item" clearable>
  236. <el-option v-for="item in selectHistoryTimeList" :key="item.id" :label="item.name" :value="item.name" />
  237. </el-select>
  238. <el-button class="successBorder" @click="handleApplication">应用</el-button>
  239. </div>
  240. <div class="search">
  241. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="牲畜类别" class="filter-item" clearable>
  242. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.name" :value="item.name" />
  243. </el-select>
  244. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>
  245. <el-option v-for="item in formulaTypeList" :key="item.id" :label="item.name" :value="item.name" />
  246. </el-select>
  247. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>
  248. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.name" />
  249. </el-select>
  250. <div ref="selectInput" class="filter-item selectInput">
  251. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  252. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  253. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  254. <ul v-if="arrowUp" class="selectUl">
  255. <li><a>模板名称</a><el-input v-model="table.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  256. <li><a>制定人</a><el-input v-model="table.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  257. <li><a>说明</a><el-input v-model="table.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  258. <li>
  259. <div style="float: right;">
  260. <el-button class="minCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  261. <el-button class="miniSuccess" @click="handleSearch">搜索</el-button>
  262. </div>
  263. </li>
  264. </ul>
  265. </div>
  266. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  267. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  268. </div>
  269. <div class="table">
  270. <el-table
  271. :key="table.tableKey"
  272. v-loading="table.listLoading"
  273. element-loading-text="给我一点时间"
  274. :data="table.list"
  275. border
  276. fit
  277. highlight-current-row
  278. style="width: 98%;"
  279. :row-style="rowStyle"
  280. :cell-style="cellStyle"
  281. class="elTable table-fixed"
  282. @row-click="tableRowClickDialog"
  283. >
  284. <el-table-column label="序号" align="center" type="index" width="50px">
  285. <template slot-scope="scope">
  286. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  287. </template>
  288. </el-table-column>
  289. <el-table-column label="配方名称" min-width="130px" align="center">
  290. <template slot-scope="scope">
  291. <span>{{ scope.row.eqName }}</span>
  292. </template>
  293. </el-table-column>
  294. <el-table-column label="配方颜色" min-width="130px" align="center">
  295. <template slot-scope="scope">
  296. <el-color-picker v-model="scope.row.financeCode" size="mini" :disabled="scope.row.NoEdit" style="margin:10px 0;" />
  297. </template>
  298. </el-table-column>
  299. <el-table-column label="牲畜类别" min-width="150px" align="center">
  300. <template slot-scope="scope">
  301. <span>{{ scope.row.pastureName }}</span>
  302. </template>
  303. </el-table-column>
  304. <el-table-column label="配方类型" min-width="150px" align="center">
  305. <template slot-scope="scope">
  306. <span>{{ scope.row.specification }}</span>
  307. </template>
  308. </el-table-column>
  309. <el-table-column label="来源" min-width="110px" align="center">
  310. <template slot-scope="scope">
  311. <span>{{ scope.row.status }}</span>
  312. </template>
  313. </el-table-column>
  314. <el-table-column label="备注" min-width="110px" align="center">
  315. <template slot-scope="scope">
  316. <span>{{ scope.row.yuanzhi }}</span>
  317. </template>
  318. </el-table-column>
  319. <el-table-column label="是否启用" min-width="110px" align="center">
  320. <template slot-scope="scope">
  321. <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)" />
  322. </template>
  323. </el-table-column>
  324. </el-table>
  325. </div>
  326. </div>
  327. <div v-if="isDetailDialog" class="detailDialog" style="margin-top: 30px;">
  328. <p class="recipeDetail" />
  329. <div class="operation">
  330. <div ref="selectInput2" class="filter-item selectInput">
  331. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  332. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  333. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  334. <ul v-if="arrowUp2" class="selectUl">
  335. <li><a>饲料名称</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  336. <li><a>饲料类型</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  337. <li><a>重量</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  338. <li><a>搅拌延时</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  339. <li><a>顺序</a><el-input v-model="table2.getdataListParm.parammaps.enable" type="text" name="" value="" style="width: 245px;" /></li>
  340. <li>
  341. <div style="float: right;">
  342. <el-button class="minCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>
  343. <el-button class="miniSuccess" @click="handleSearch2">搜索</el-button>
  344. </div>
  345. </li>
  346. </ul>
  347. </div>
  348. <el-button class="successBorder" @click="handleSearch2">查询</el-button>
  349. <el-button class="successBorder" @click="handleRefresh2">重置</el-button>
  350. </div>
  351. <div class="table2">
  352. <el-table
  353. :key="table2.tableKey"
  354. v-loading="table2.listLoading"
  355. element-loading-text="给我一点时间"
  356. :data="table2.list"
  357. border
  358. fit
  359. highlight-current-row
  360. style="width: 98%;"
  361. :row-style="rowStyle"
  362. :cell-style="cellStyle"
  363. class="elTable table-fixed"
  364. row-key="id"
  365. >
  366. <el-table-column label="饲料组" min-width="130px" align="center">
  367. <template slot-scope="scope">
  368. <span>{{ scope.row.group }}</span>
  369. </template>
  370. </el-table-column>
  371. <el-table-column label="饲料名称" min-width="130px" align="center">
  372. <template slot-scope="scope">
  373. <span>{{ scope.row.name }}</span>
  374. </template>
  375. </el-table-column>
  376. <el-table-column label="重量(KG)" min-width="130px" align="center">
  377. <template slot-scope="scope">
  378. <span>{{ scope.row.weight }}</span>
  379. </template>
  380. </el-table-column>
  381. <el-table-column label="搅拌延时(min)" min-width="130px" align="center">
  382. <template slot-scope="scope">
  383. <span>{{ scope.row.hour }}</span>
  384. </template>
  385. </el-table-column>
  386. <el-table-column label="是否锁定牛头数比例" min-width="130px" align="center">
  387. <template slot-scope="scope">
  388. <span>{{ scope.row.proportion }}</span>
  389. </template>
  390. </el-table-column>
  391. <el-table-column label="顺序" min-width="130px" align="center">
  392. <template slot-scope="scope">
  393. <span>{{ scope.row.order }}</span>
  394. </template>
  395. </el-table-column>
  396. </el-table>
  397. </div>
  398. </div>
  399. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
  400. <el-button @click="template.dialogFormVisible = false; ">关闭</el-button>
  401. </div>
  402. </div>
  403. </el-dialog>
  404. <!-- 合成预混料 -->
  405. <el-dialog :title="textMap[detail.dialogStatus]" :destroy-on-close="true" :visible.sync="detail.dialogFormVisible" :close-on-click-modal="false" width="90%">
  406. <div class="detailDialog">
  407. <h2>饲料</h2>
  408. <div class="table1">
  409. <el-table
  410. :key="detail.tableKey"
  411. v-loading="detail.listLoading"
  412. element-loading-text="给我一点时间"
  413. :data="detail.list"
  414. border
  415. fit
  416. highlight-current-row
  417. style="width: 100%;"
  418. :row-style="rowStyle"
  419. :cell-style="cellStyle"
  420. class="elTable table-fixed"
  421. show-summary
  422. >
  423. <el-table-column label="序号" align="center" type="index" width="50px">
  424. <template slot-scope="scope">
  425. <span>{{ scope.$index + (detail.pageNum-1) * detail.pageSize + 1 }}</span>
  426. </template>
  427. </el-table-column>
  428. <el-table-column label="饲料名称" min-width="130px" align="center">
  429. <template slot-scope="scope">
  430. <span>{{ scope.row.brandName }}</span>
  431. </template>
  432. </el-table-column>
  433. <el-table-column prop="statusId" sortable label="重量(KG)" />
  434. <el-table-column label="搅拌延时(min)" min-width="110px" align="center">
  435. <template slot-scope="scope">
  436. <span>{{ scope.row.brandName }}</span>
  437. </template>
  438. </el-table-column>
  439. <el-table-column label="是否锁定牛头数比例" min-width="130px" align="center">
  440. <template slot-scope="scope">
  441. <span>{{ scope.row.brandName }}</span>
  442. </template>
  443. </el-table-column>
  444. <el-table-column label="顺序" min-width="110px" align="center">
  445. <template slot-scope="scope">
  446. <span>{{ scope.row.brandName }}</span>
  447. </template>
  448. </el-table-column>
  449. </el-table>
  450. </div>
  451. <h2>合成预混料</h2>
  452. <div class="table2" style="margin-bottom: 50px;">
  453. <el-table
  454. :key="detail.tableKey2"
  455. v-loading="detail.listLoading2"
  456. element-loading-text="给我一点时间"
  457. :data="detail.list2"
  458. border
  459. fit
  460. highlight-current-row
  461. style="width: 100%;"
  462. :row-style="rowStyle"
  463. :cell-style="cellStyle"
  464. class="elTable table-fixed"
  465. >
  466. <el-table-column label="配方名称" min-width="130px" align="center">
  467. <template slot-scope="scope">
  468. <el-input v-model="scope.row.group" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" style="width:80%;padding:10px 0;" maxlength="32" />
  469. </template>
  470. </el-table-column>
  471. <el-table-column label="配方颜色" min-width="130px" align="center">
  472. <template slot-scope="scope">
  473. <el-color-picker v-model="scope.row.financeCode" size="mini" style="margin:10px 0;" />
  474. </template>
  475. </el-table-column>
  476. <el-table-column label="牲畜类别" min-width="110px" align="center">
  477. <template slot-scope="scope">
  478. <el-select v-model="scope.row.pastureName" placeholder="牲畜类别" class="filter-item" style="width:80%;padding:10px 0;">
  479. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.name" :value="item.name" />
  480. </el-select>
  481. </template>
  482. </el-table-column>
  483. <el-table-column label="配方类型" min-width="130px" align="center">
  484. <template slot-scope="scope">
  485. <el-input v-model="scope.row.group" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" style="width:80%;padding:10px 0;" maxlength="32" />
  486. </template>
  487. </el-table-column>
  488. <el-table-column label="来源" min-width="110px" align="center">
  489. <template slot-scope="scope">
  490. <el-select v-model="scope.row.pastureName" placeholder="来源" class="filter-item" style="width:80%;padding:10px 0;">
  491. <el-option v-for="item in sourceList" :key="item.id" :label="item.name" :value="item.name" />
  492. </el-select>
  493. </template>
  494. </el-table-column>
  495. <el-table-column label="备注" min-width="130px" align="center">
  496. <template slot-scope="scope">
  497. <el-input v-model="scope.row.group" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" style="width:80%;padding:10px 0;" maxlength="32" />
  498. </template>
  499. </el-table-column>
  500. <el-table-column label="是否启用" min-width="130px" align="center">
  501. <template slot-scope="scope">
  502. <el-switch v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  503. </template>
  504. </el-table-column>
  505. </el-table>
  506. </div>
  507. <div slot="footer" class="dialog-footer" style="bottom: -50px;">
  508. <el-button class="cancel" @click="detail.dialogFormVisible = false; ">关闭</el-button>
  509. <el-button class="success" :disabled="isokDisable" @click="syntheticPremixData()">确认</el-button>
  510. </div>
  511. </div>
  512. </el-dialog>
  513. </div>
  514. </template>
  515. <script>
  516. import { GetDataByName } from '@/api/common'
  517. import Sortable from 'sortablejs'
  518. import { MessageBox } from 'element-ui'
  519. export default {
  520. name: 'RecipeTemplate',
  521. data() {
  522. return {
  523. livestockTypeList: [{ id: 0, name: '高产' }, { id: 1, name: '低产' }, { id: 2, name: '中产' }, { id: 3, name: '青年后备' }, { id: 4, name: '围产' }], // 牲畜类别
  524. formulaTypeList: [{ id: 0, name: '饲喂配方' }, { id: 1, name: '预混配方' }, { id: 2, name: '补料配方' }], // 配方类型
  525. enableList: [{ id: 0, name: '是' }, { id: 1, name: '否' }], // 是否启用
  526. lockBullsList: [{ id: 0, name: '是' }, { id: 1, name: '否' }], // 是否锁定牛头数比例
  527. feedNameList: [{ id: 0, name: '国产燕麦草' }, { id: 1, name: '玉米青贮' }, { id: 2, name: '羊草' }, { id: 3, name: '补充料' }], // 饲料名称
  528. mixingDelayList: [{ id: 0, name: '0' }, { id: 1, name: '1' }, { id: 2, name: '2' }, { id: 3, name: '3' }], // 搅拌延时
  529. 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' }], // 请选择历史记录时间
  530. sourceList: [{ id: 0, name: '自定义' }, { id: 1, name: '集团下发' }, { id: 2, name: '导入' }], // 导入
  531. arrowDown: true,
  532. arrowUp: false,
  533. table: {
  534. getdataListParm: {
  535. name: 'getAssetList',
  536. page: 1,
  537. offset: 1,
  538. pagecount: 10,
  539. returntype: 'Map',
  540. parammaps: {
  541. enable: ''
  542. }
  543. },
  544. tableKey: 0,
  545. list: [],
  546. total: 0,
  547. listLoading: true
  548. },
  549. isDetail: false,
  550. arrowDown2: true,
  551. arrowUp2: false,
  552. table2: {
  553. getdataListParm: {
  554. name: 'getAssetList',
  555. page: 1,
  556. offset: 1,
  557. pagecount: 10,
  558. returntype: 'Map',
  559. parammaps: {
  560. enable: ''
  561. }
  562. },
  563. tableKey: 0,
  564. list: [],
  565. total: 0,
  566. listLoading: true
  567. },
  568. isDetailDialog: false,
  569. template: {
  570. dialogFormVisible: false,
  571. dialogStatus: ''
  572. },
  573. detail: {
  574. dialogFormVisible: false,
  575. dialogStatus: '',
  576. getdataListParm: {
  577. name: 'getAssetList',
  578. page: 1,
  579. offset: 1,
  580. pagecount: 10,
  581. returntype: 'Map',
  582. parammaps: {
  583. enable: ''
  584. }
  585. },
  586. tableKey: 0,
  587. total: 0,
  588. listLoading: true,
  589. list: [],
  590. tableKey2: 0,
  591. total2: 0,
  592. listLoading2: false,
  593. list2: [{ 'enable': 1 }]
  594. },
  595. selectList: [],
  596. textMap: {
  597. RecipeRecord: '配方记录',
  598. SyntheticPremix: '合成预混料'
  599. },
  600. isokDisable: false,
  601. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  602. cellStyle: { padding: 0 + 'px' }
  603. }
  604. },
  605. mounted() {
  606. document.addEventListener('click', (e) => {
  607. if (this.$refs.selectInput !== undefined) {
  608. if (!this.$refs.selectInput.contains(e.target)) {
  609. this.arrowDown = true
  610. this.arrowUp = false
  611. } else {
  612. this.arrowDown = false
  613. this.arrowUp = true
  614. }
  615. }
  616. if (this.$refs.selectInput2 !== undefined) {
  617. if (!this.$refs.selectInput2.contains(e.target)) {
  618. this.arrowDown2 = true
  619. this.arrowUp2 = false
  620. } else {
  621. this.arrowDown2 = false
  622. this.arrowUp2 = true
  623. }
  624. }
  625. })
  626. },
  627. created() {
  628. this.getList()
  629. },
  630. methods: {
  631. // -------------------模板-----------------------------
  632. getList() {
  633. this.table.listLoading = true
  634. GetDataByName(this.table.getdataListParm).then(response => {
  635. console.log('table数据', response.data.list)
  636. if (response.data.list !== null) {
  637. for (let i = 0; i < response.data.list.length; i++) {
  638. this.$set(response.data.list[i], 'Edit', false) // 编辑
  639. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  640. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  641. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  642. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  643. }
  644. this.table.list = response.data.list
  645. this.table.pageNum = response.data.pageNum
  646. this.table.pageSize = response.data.pageSize
  647. this.table.total = response.data.total
  648. } else {
  649. this.table.list = []
  650. }
  651. setTimeout(() => {
  652. this.table.listLoading = false
  653. }, 100)
  654. })
  655. },
  656. handleSearch() {
  657. console.log('点击了查询')
  658. this.getList()
  659. this.arrowDown = true
  660. this.arrowUp = false
  661. },
  662. handleRefresh() {
  663. console.log('点击了重置')
  664. },
  665. // 模板新增
  666. handleCreate() {
  667. console.log('点击了新增')
  668. // 编辑true/不可编辑false
  669. // 新增操true,编辑false,编辑保存false
  670. console.log(11)
  671. for (let i = 0; i < this.table.list.length; i++) {
  672. if (this.table.list[i].Edit === true) {
  673. console.log(123)
  674. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  675. return false
  676. }
  677. }
  678. this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1 })
  679. },
  680. createData(row) {
  681. console.log('点击了新增保存', row)
  682. },
  683. createCancel(row) {
  684. console.log('点击了新增取消')
  685. for (let i = 0; i < this.table.list.length; i++) {
  686. if (row.myId === this.table.list[i].myId) {
  687. var listIndex = this.table.list.indexOf(this.table.list[i])
  688. }
  689. if (listIndex > -1) {
  690. this.table.list.splice(listIndex, 1)
  691. return
  692. }
  693. }
  694. },
  695. // 模板编辑
  696. handleUpdate(row) {
  697. for (let i = 0; i < this.table.list.length; i++) {
  698. if (this.table.list[i].Edit == true) {
  699. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  700. return false
  701. }
  702. }
  703. // 编辑true,不可编辑false
  704. row.Edit = true
  705. row.NoEdit = false
  706. // 新增false,编辑false,编辑保存true
  707. row.isCreate = false
  708. row.isUpdate = false
  709. row.isUpdateSave = true
  710. },
  711. updateData(row) {
  712. console.log('点击了编辑保存', row)
  713. },
  714. updateCancel(row) {
  715. console.log('点击了编辑取消')
  716. // 编辑false,不可编辑true
  717. row.Edit = false
  718. row.NoEdit = true
  719. // 新增false,编辑true,编辑保存false
  720. row.isCreate = false
  721. row.isUpdate = true
  722. row.isUpdateSave = false
  723. },
  724. // 删除
  725. handleDelete() {
  726. console.log('点击了删除')
  727. },
  728. // 复制
  729. handleCopy() {
  730. console.log('点击了复制')
  731. },
  732. // 配方记录
  733. handleRecipeRecord() {
  734. console.log('点击了配方记录')
  735. this.template.dialogStatus = 'RecipeRecord'
  736. this.template.dialogFormVisible = true
  737. this.getList()
  738. },
  739. // 应用
  740. handleApplication() {
  741. console.log('点击了应用')
  742. },
  743. tableRowClickDialog() {
  744. console.log('配方记录-模板行点击')
  745. this.isDetailDialog = true
  746. this.getListDialog()
  747. },
  748. getListDialog() {
  749. this.table2.listLoading = true
  750. GetDataByName(this.table2.getdataListParm).then(response => {
  751. console.log('table数据', response.data.list)
  752. if (response.data.list !== null) {
  753. for (let i = 0; i < response.data.list.length; i++) {
  754. this.$set(response.data.list[i], 'Edit', false) // 编辑
  755. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  756. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  757. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  758. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  759. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  760. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  761. }
  762. this.table2.list = response.data.list
  763. this.table2.list = [
  764. { id: '0', group: '饲料组1', name: '饲料名称1', weight: '重量1', 'hour': '搅拌延时1', 'proportion': '是否锁定牛头数比例1', 'order': '0', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  765. { id: '1', group: '饲料组2', name: '饲料名称2', weight: '重量2', 'hour': '搅拌延时2', 'proportion': '是否锁定牛头数比例2', 'order': '1', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  766. { id: '2', group: '饲料组3', name: '饲料名称3', weight: '重量3', 'hour': '搅拌延时3', 'proportion': '是否锁定牛头数比例3', 'order': '2', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  767. { id: '3', group: '饲料组3', name: '饲料名称4', weight: '重量4', 'hour': '搅拌延时4', 'proportion': '是否锁定牛头数比例4', 'order': '2', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  768. { id: '4', group: '饲料组4', name: '饲料名称5', weight: '重量5', 'hour': '搅拌延时5', 'proportion': '是否锁定牛头数比例5', 'order': '3', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  769. { id: '5', group: '饲料组4', name: '饲料名称6', weight: '重量6', 'hour': '搅拌延时6', 'proportion': '是否锁定牛头数比例6', 'order': '3', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  770. { id: '6', group: '饲料组4', name: '饲料名称7', weight: '重量7', 'hour': '搅拌延时7', 'proportion': '是否锁定牛头数比例7', 'order': '3', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  771. { id: '7', group: '饲料组6', name: '饲料名称8', weight: '重量8', 'hour': '搅拌延时8', 'proportion': '是否锁定牛头数比例8', 'order': '5', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true }
  772. ]
  773. this.table2.pageNum = response.data.pageNum
  774. this.table2.pageSize = response.data.pageSize
  775. this.table2.total = response.data.total
  776. } else {
  777. this.table2.list = []
  778. }
  779. this.$nextTick(function() {
  780. window.scrollTo({
  781. 'top': this.$refs.templateDialog.clientHeight
  782. })
  783. })
  784. setTimeout(() => {
  785. this.table2.listLoading = false
  786. }, 100)
  787. })
  788. },
  789. // 模板行点击
  790. tableRowClick(row, column, event) {
  791. console.log(row, column, event)
  792. for (let i = 0; i < this.table.list.length; i++) {
  793. if (this.table.list[i].Edit == true) {
  794. return false
  795. }
  796. }
  797. if (column.label !== '操作') {
  798. this.isDetail = true // 点击行显示详情
  799. this.getList2()
  800. }
  801. },
  802. // -------------------详情-----------------------------
  803. getList2() {
  804. this.table2.listLoading = true
  805. GetDataByName(this.table2.getdataListParm).then(response => {
  806. console.log('table数据', response.data.list)
  807. if (response.data.list !== null) {
  808. for (let i = 0; i < response.data.list.length; i++) {
  809. this.$set(response.data.list[i], 'Edit', false) // 编辑
  810. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  811. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  812. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  813. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  814. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  815. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  816. }
  817. this.table2.list = response.data.list
  818. this.table2.list = [
  819. { id: '0', group: '饲料组1', name: '饲料名称1', weight: '1', 'hour': '搅拌延时1', 'proportion': '是否锁定牛头数比例1', 'order': '0', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  820. { id: '1', group: '饲料组2', name: '饲料名称2', weight: '2', 'hour': '搅拌延时2', 'proportion': '是否锁定牛头数比例2', 'order': '1', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  821. { id: '2', group: '饲料组3', name: '饲料名称3', weight: '3', 'hour': '搅拌延时3', 'proportion': '是否锁定牛头数比例3', 'order': '2', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  822. { id: '3', group: '饲料组3', name: '饲料名称4', weight: '4', 'hour': '搅拌延时4', 'proportion': '是否锁定牛头数比例4', 'order': '2', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  823. { id: '4', group: '饲料组4', name: '饲料名称5', weight: '5', 'hour': '搅拌延时5', 'proportion': '是否锁定牛头数比例5', 'order': '3', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  824. { id: '5', group: '饲料组4', name: '饲料名称6', weight: '6', 'hour': '搅拌延时6', 'proportion': '是否锁定牛头数比例6', 'order': '3', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  825. { id: '6', group: '饲料组4', name: '饲料名称7', weight: '7', 'hour': '搅拌延时7', 'proportion': '是否锁定牛头数比例7', 'order': '3', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true },
  826. { id: '7', group: '饲料组6', name: '饲料名称8', weight: '8', 'hour': '搅拌延时8', 'proportion': '是否锁定牛头数比例8', 'order': '5', 'Edit': false, 'NoEdit': true, 'isCreate': false, 'isUpdate': true, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true }
  827. ]
  828. this.table2.pageNum = response.data.pageNum
  829. this.table2.pageSize = response.data.pageSize
  830. this.rowDrop()
  831. this.table2.total = response.data.total
  832. } else {
  833. this.table2.list = []
  834. }
  835. this.$nextTick(function() {
  836. console.log(this.$refs)
  837. console.log(this.$refs.template.clientHeight)
  838. window.scrollTo({
  839. 'top': this.$refs.template.clientHeight
  840. })
  841. })
  842. setTimeout(() => {
  843. this.table2.listLoading = false
  844. }, 100)
  845. })
  846. },
  847. // 行拖拽
  848. rowDrop() {
  849. console.log(document.querySelector('#table2 .el-table__body-wrapper tbody'))
  850. const tbody = document.querySelector('#table2 .el-table__body-wrapper tbody')
  851. const that = this
  852. Sortable.create(tbody, {
  853. onEnd({ newIndex, oldIndex }) {
  854. const currRow = that.table2.list.splice(oldIndex, 1)[0]
  855. that.table2.list.splice(newIndex, 0, currRow)
  856. console.log('索引', newIndex)
  857. console.log('拖动数据', currRow)
  858. console.log('上', that.table2.list[newIndex - 1])
  859. console.log('下', that.table2.list[newIndex + 1])
  860. if (that.table2.list[newIndex - 1] === undefined) { // 拖动至最上方无值 // 顺序等于0,其他+1 // 饲料组等于饲料名称
  861. for (let i = 0; i < that.table2.list.length; i++) {
  862. that.table2.list[i].order = parseInt(that.table2.list[i].order) + 1 // 其他的顺序+1
  863. }
  864. currRow.order = 0
  865. currRow.group = currRow.name
  866. console.log('拖动至最上方无值')
  867. } else if (currRow.order == that.table2.list[newIndex - 1].order) { // 拖动值顺序等于上值顺序
  868. currRow.order = that.table2.list[newIndex - 1].order
  869. console.log('拖动值顺序等于上值顺序')
  870. } else if (that.table2.list[newIndex + 1] == undefined) { // 拖动至最下方无值 // 顺序等于上方顺序+1 // 饲料组等于饲料名称
  871. currRow.order = parseInt(that.table2.list[newIndex - 1].order) + 1
  872. currRow.group = currRow.name
  873. console.log('拖动至最下方无值')
  874. } else if (currRow.order == that.table2.list[newIndex + 1].order) { // 拖动值顺序等于下值顺序
  875. currRow.order == that.table2.list[newIndex + 1].order
  876. console.log('拖动值顺序等于下值顺序')
  877. } else if (that.table2.list[newIndex - 1].order == that.table2.list[newIndex + 1].order) { // 拖动至上下顺序一致,顺序/饲料组与上下保持一致
  878. currRow.order = that.table2.list[newIndex - 1].order
  879. currRow.group = that.table2.list[newIndex - 1].group
  880. console.log('拖动至上下顺序一致')
  881. } else if (that.table2.list[newIndex - 1].order !== undefined && that.table2.list[newIndex + 1].order !== undefined) { // 拖动至上下都有值
  882. console.log('上下')
  883. if (parseInt(that.table2.list[newIndex - 1].order) + 1 == that.table2.list[newIndex + 1].order) {
  884. console.log(newIndex)
  885. for (let i = newIndex; i < that.table2.list.length; i++) {
  886. that.table2.list[i].order = parseInt(that.table2.list[i].order) + 1
  887. }
  888. }
  889. currRow.order = parseInt(that.table2.list[newIndex - 1].order) + 1
  890. currRow.group = currRow.name
  891. console.log(that.table2.list[newIndex + 1].order)
  892. }
  893. }
  894. })
  895. },
  896. handleSearch2() {
  897. console.log('点击了查询')
  898. this.getList()
  899. this.arrowDown = true
  900. this.arrowUp = false
  901. },
  902. handleRefresh2() {
  903. console.log('点击了重置')
  904. },
  905. // 详情新增
  906. handleCreate2() {
  907. console.log('点击了详情新增')
  908. // 编辑true/不可编辑false
  909. // 新增操true,编辑false,编辑保存false
  910. console.log(11)
  911. for (let i = 0; i < this.table2.list.length; i++) {
  912. if (this.table2.list[i].Edit === true) {
  913. console.log(123)
  914. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  915. return false
  916. }
  917. }
  918. this.table2.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1 })
  919. },
  920. createData2(row) {
  921. console.log('点击了详情新增保存', row)
  922. },
  923. createCancel2(row) {
  924. console.log('点击了详情新增取消')
  925. for (let i = 0; i < this.table.list.length; i++) {
  926. if (row.myId === this.table.list[i].myId) {
  927. var listIndex = this.table.list.indexOf(this.table2.list[i])
  928. }
  929. if (listIndex > -1) {
  930. this.table2.list.splice(listIndex, 1)
  931. return
  932. }
  933. }
  934. },
  935. // 详情编辑
  936. handleUpdate2(row) {
  937. const rowArr = []
  938. for (let i = 0; i < this.table2.list.length; i++) {
  939. if (this.table2.list[i].Edit == true) {
  940. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  941. return false
  942. }
  943. rowArr.push(this.table2.list[i].order)
  944. // console.log(this.table2.list[i].order, '591')
  945. }
  946. console.log(rowArr)
  947. for (let i = 0; i < rowArr.length; i++) {
  948. if (rowArr[i] == row.order) {
  949. rowArr.splice(i, 1)
  950. }
  951. }
  952. console.log(rowArr)
  953. for (let i = 0; i < rowArr.length; i++) {
  954. console.log(rowArr[i], row.order)
  955. if (rowArr[i] !== row.order) {
  956. // 饲料组编辑false,不可编辑true
  957. row.groupEdit = false
  958. row.groupNoEdit = true
  959. // 编辑true,不可编辑false
  960. row.Edit = true
  961. row.NoEdit = false
  962. // 新增false,编辑false,编辑保存true
  963. row.isCreate = false
  964. row.isUpdate = false
  965. row.isUpdateSave = true
  966. } else {
  967. // 饲料组编辑true,不可编辑false
  968. row.groupEdit = true
  969. row.groupNoEdit = false
  970. console.log(222)
  971. // 编辑true,不可编辑false
  972. row.Edit = true
  973. row.NoEdit = false
  974. // 新增false,编辑false,编辑保存true
  975. row.isCreate = false
  976. row.isUpdate = false
  977. row.isUpdateSave = true
  978. return false
  979. }
  980. }
  981. },
  982. updateData2(row) {
  983. console.log('点击了详情编辑保存', row)
  984. },
  985. updateCancel2(row) {
  986. console.log('点击了详情编辑取消')
  987. // 饲料组编辑false,不可编辑true
  988. row.groupEdit = false
  989. row.groupNoEdit = true
  990. // 编辑false,不可编辑true
  991. row.Edit = false
  992. row.NoEdit = true
  993. // 新增false,编辑true,编辑保存false
  994. row.isCreate = false
  995. row.isUpdate = true
  996. row.isUpdateSave = false
  997. },
  998. // 拆分预混料
  999. handleSplitPremix(row) {
  1000. console.log('点击了拆分预混料')
  1001. MessageBox.confirm('是否确认拆分当前预混料?', {
  1002. confirmButtonText: '确认',
  1003. cancelButtonText: '取消',
  1004. type: 'warning'
  1005. }).then(() => {
  1006. console.log('保存')
  1007. }).catch(() => {
  1008. this.$message({
  1009. type: 'info',
  1010. message: '已取消删除'
  1011. })
  1012. })
  1013. },
  1014. handleDelete2() {
  1015. console.log('点击了详情删除')
  1016. },
  1017. handleSelect(val) {
  1018. console.log('勾选数据', val)
  1019. this.selectList = val
  1020. },
  1021. handleSyntheticPremix() {
  1022. console.log('点击了合成预混料')
  1023. if (this.selectList.length >= 2) {
  1024. this.detail.dialogStatus = 'SyntheticPremix'
  1025. this.detail.dialogFormVisible = true
  1026. this.getListSyntheticPremix()
  1027. } else {
  1028. this.$message({ type: 'error', message: '请选择俩条及以上饲料进行合成', duration: 2000 })
  1029. return false
  1030. }
  1031. },
  1032. getListSyntheticPremix() {
  1033. this.detail.listLoading = true
  1034. GetDataByName(this.detail.getdataListParm).then(response => {
  1035. console.log('table数据', response.data.list)
  1036. if (response.data.list !== null) {
  1037. this.detail.list = response.data.list
  1038. this.detail.pageNum = response.data.pageNum
  1039. this.detail.pageSize = response.data.pageSize
  1040. this.detail.total = response.data.total
  1041. } else {
  1042. this.detail.list = []
  1043. }
  1044. setTimeout(() => {
  1045. this.detail.listLoading = false
  1046. }, 100)
  1047. })
  1048. },
  1049. syntheticPremixData() {
  1050. console.log('点击了合成预混料确认')
  1051. }
  1052. }
  1053. }
  1054. </script>
  1055. <style lang="scss" scoped>
  1056. .search{margin-top:10px;}
  1057. .table{margin-top:10px;}
  1058. .table2{margin-top:10px;}
  1059. $width:350px;
  1060. $left:325px;
  1061. .selectInput{
  1062. position: relative;
  1063. display: inline-block;
  1064. .Input{width: $width;position: relative;}
  1065. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  1066. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  1067. .selectUl{
  1068. 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;
  1069. li{
  1070. 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;
  1071. a{float:left;width: 80px;}
  1072. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  1073. }
  1074. }
  1075. }
  1076. .template{
  1077. background: #fff;
  1078. position: relative;
  1079. .recipeTemplate{
  1080. width: 72px;
  1081. height: 70px;
  1082. position: absolute;
  1083. background: url(../../../assets/images/bg1.jpg) no-repeat;
  1084. right: 0;
  1085. top: 0;
  1086. margin: 0;
  1087. }
  1088. }
  1089. .detail{
  1090. background: #fff;
  1091. position: relative;
  1092. .recipeDetail{
  1093. width: 72px;
  1094. height: 70px;
  1095. position: absolute;
  1096. background: url(../../../assets/images/bg2.jpg) no-repeat;
  1097. right: 0;
  1098. top: 0;
  1099. margin: 0;
  1100. }
  1101. }
  1102. .templateDialog{
  1103. background: #fff;
  1104. position: relative;
  1105. .recipeTemplate{
  1106. width: 72px;
  1107. height: 70px;
  1108. position: absolute;
  1109. background: url(../../../assets/images/bg1.jpg) no-repeat;
  1110. right: 0;
  1111. top: 0;
  1112. margin: 0;
  1113. }
  1114. }
  1115. .detailDialog{
  1116. background: #fff;
  1117. position: relative;
  1118. .recipeDetail{
  1119. width: 72px;
  1120. height: 70px;
  1121. position: absolute;
  1122. background: url(../../../assets/images/bg2.jpg) no-repeat;
  1123. right: 0;
  1124. top: 0;
  1125. margin: 0;
  1126. }
  1127. }
  1128. </style>