index.vue 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float:left;" @click="handleCreate">新增车次
  5. </el-button>
  6. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" style="float:left;" @click="handleReduceTrains">减少车次</el-button>
  7. <el-button v-if="isRoleEdit" class="success" style="float: left;" @click="handleCheck">校验</el-button>
  8. <el-button v-if="isRoleEdit" class="success" icon="el-icon-download" style="float:left;" @click="handleAutomaticGeneration">自动生成</el-button>
  9. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" style="float: left;" class="success" @click="handleChangeOrder">更改顺序</el-button>
  10. <div v-else style="float: left;margin-left: 10px;">
  11. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存 </el-button>
  12. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
  13. </div>
  14. <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" style="float: left;" @click="handleTakeEffect"> 生效</el-button>
  15. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" style="float: left;" @click="handleDisable"> 禁用</el-button>
  16. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" style="float: left;" @click="handleAllEmpty"> 清空已分配栏舍</el-button>
  17. <el-select v-model="table.getdataListParm.parammaps.times" filterable placeholder="班次" class="filter-item" style="width: 120px;float: left;margin-left: 10px;" @change="changeFrequency">
  18. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  19. </el-select>
  20. <el-button class="export" icon="el-icon-time" style="float:right;" @click="handleHistoryRecord">历史记录 </el-button>
  21. </div>
  22. <!-- <div class="search">
  23. <el-select v-model="table.getdataListParm.parammaps.times" filterable placeholder="班次" class="filter-item" style="width: 120px;" @change="changeFrequency">
  24. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  25. </el-select>
  26. </div> -->
  27. <div class="table">
  28. <el-table
  29. id="table"
  30. :key="table.tableKey"
  31. ref="table"
  32. v-loading="table.listLoading"
  33. element-loading-text="给我一点时间"
  34. :data="table.list"
  35. border
  36. highlight-current-row
  37. style="width: 100%;"
  38. :height="height"
  39. :row-style="rowStyle"
  40. :cell-style="cellStyle"
  41. class="elTable"
  42. row-key="id"
  43. @selection-change="handleSelect"
  44. >
  45. <el-table-column type="selection" width="50" />
  46. <el-table-column label="车次" width="50px" align="center" class-name="small-padding fixed-width" fixed="">
  47. <template slot-scope="scope">
  48. <span>{{ scope.row.sort }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="TMR编号" width="110px" align="center" class-name="small-padding fixed-width" fixed="left">
  52. <template slot-scope="scope">
  53. <span>{{ scope.row.tmrname }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="描述" width="110px" align="center">
  57. <template slot-scope="scope">
  58. <span>{{ scope.row.display }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="生效" width="70px" align="center">
  62. <template slot-scope="scope">
  63. <el-switch v-model="scope.row.sel" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="班次" width="65px" align="center">
  67. <template slot-scope="scope">
  68. <span>{{ scope.row.timesstr }}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="时间" width="55px" align="center">
  72. <template slot-scope="scope">
  73. <span>{{ scope.row.begintime }}</span>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="最大重量" width="75px" align="center">
  77. <template slot-scope="scope">
  78. <span>{{ scope.row.maxweight }}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="合计重量" width="80px" align="center">
  82. <template slot-scope="scope">
  83. <span>{{ scope.row.sumweight }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="模板配方" width="90px" align="center">
  87. <template slot-scope="scope">
  88. <span>{{ scope.row.ftname }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column v-show="isInforvalue" label="是否提前小料拆分" width="70px" align="center">
  92. <template slot-scope="scope">
  93. <el-switch v-model="scope.row.issplit" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="撒料" min-width="250px" align="left" header-align="center">
  97. <template slot-scope="scope">
  98. <div v-for="element in scope.row.arrList" :key="element.name" class="list">
  99. <el-tooltip placement="top" :open-delay="1000">
  100. <div slot="content">
  101. <div> 栏舍全称:{{ element.barname }} </div>
  102. <div> 饲料重量:{{ element.weight }} </div>
  103. <div> 撒料车:{{ element.tmrname }} </div>
  104. </div>
  105. <div :style="{'background':element.background}" class="tmrname">{{ element.barname }}</div>
  106. </el-tooltip>
  107. </div>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="操作" align="center" width="70" class-name="small-padding fixed-width" fixed="right">
  111. <template slot-scope="{row}">
  112. <el-button v-if="isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  113. <span v-if="isRoleEdit" class="centerSpan">|</span>
  114. <el-button v-if="isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
  119. </div>
  120. <!-- 自动生成 -->
  121. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="automaticGeneration.dialogFormVisible" :close-on-click-modal="false" width="30%">
  122. <template slot="title">
  123. <div class="avue-crud__dialog__header">
  124. <span class="el-dialog__title">
  125. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  126. {{ textMap[automaticGeneration.dialogStatus] }}
  127. </span>
  128. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  129. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  130. <svg-icon v-else icon-class="fullscreen" />
  131. </div>
  132. </div>
  133. </template>
  134. <div class="app-automaticGeneration" style="margin: 0 auto;">
  135. <div style="width: 210px;margin:60px auto 120px;font-weight: 16px;">
  136. 请选择自动生成方式:<br>
  137. 清空计划并生成新计划;<br>
  138. 当前计划基础上继续生成计划;<br>
  139. </div>
  140. <div slot="footer" class="dialog-footer">
  141. <el-button style="right:240px;" class="cancelClose" @click="automaticGeneration.dialogFormVisible = false;">关闭</el-button>
  142. <el-button style="right:130px;" class="save" :disabled="isokDisable" @click="continueData(0)">继续生成 </el-button>
  143. <el-button style="right:20px;" class="save" :disabled="isokDisable" @click="continueData(1)">重新生成 </el-button>
  144. </div>
  145. </div>
  146. </el-dialog>
  147. <!-- 历史记录 -->
  148. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  149. <template slot="title">
  150. <div class="avue-crud__dialog__header">
  151. <span class="el-dialog__title">
  152. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  153. {{ textMap[historyRecord.dialogStatus] }}
  154. </span>
  155. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  156. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  157. <svg-icon v-else icon-class="fullscreen" />
  158. </div>
  159. </div>
  160. </template>
  161. <div class="historyRecord">
  162. <keep-alive>
  163. <component :is="historyRecord.myComponent" ref="historyRecord" />
  164. </keep-alive>
  165. </div>
  166. <div slot="footer" class="dialog-footer">
  167. <el-button class="cancelClose cancelClose1" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
  168. </div>
  169. </el-dialog>
  170. <!-- 新增、编辑 -->
  171. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="create.dialogFormVisible" v-if='create.dialogFormVisible' :before-close="close" :close-on-click-modal="false" width="90%">
  172. <template slot="title">
  173. <div class="avue-crud__dialog__header">
  174. <span class="el-dialog__title">
  175. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  176. {{ textMap[create.dialogStatus] }}
  177. </span>
  178. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  179. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  180. <svg-icon v-else icon-class="fullscreen" />
  181. </div>
  182. </div>
  183. </template>
  184. <div class="create">
  185. <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="135px" style="width: 100%;margin:0 auto 10px;">
  186. <el-row>
  187. <el-col :span="8">
  188. <el-form-item label="生效:" prop="sel">
  189. <el-switch v-model="create.temp.sel" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  190. </el-form-item>
  191. </el-col>
  192. <el-col :span="8">
  193. <el-form-item label="TMR编号:" prop="tmrid2">
  194. <el-select v-model="create.temp.tmrid2" style="width: 100%;" placeholder="TMR编号" @change="changeTMRNumber">
  195. <!-- <el-option v-for="item in equipmentList" :key="item.id" :label="`${item.tclassname}/${item.eqcode}`" :value="item.id" /> -->
  196. <el-option v-for="item in TMRNumberList" :key="item.id" :label="`${item.tclassname}/${item.eqcode}`" :value="item.id" />
  197. </el-select>
  198. </el-form-item>
  199. </el-col>
  200. <el-col :span="8">
  201. <el-form-item label="班次:" prop="times">
  202. <el-select v-model="create.temp.times" :disabled="create.list2.length>0" placeholder="班次" style="width:100%;" @change="changeTimes">
  203. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  204. </el-select>
  205. </el-form-item>
  206. </el-col>
  207. </el-row>
  208. <el-row>
  209. <el-col :span="8">
  210. <el-form-item label="提前小料拆分:" prop="issplit">
  211. <el-switch v-model="create.temp.issplit" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  212. </el-form-item>
  213. </el-col>
  214. <el-col :span="8">
  215. <el-form-item label="时间:" prop="begintime">
  216. <el-time-picker v-model="create.temp.begintime" style="width: 100%;" :clearable="false" type="datetime" placeholder="时间" format="HH:mm" value-format="HH:mm" />
  217. </el-form-item>
  218. </el-col>
  219. <el-col :span="8">
  220. <el-form-item label="模板配方:" prop="ftid">
  221. <el-select v-model="create.temp.ftid" :disabled="create.list2.length>0" placeholder="模板配方" style="width:100%;" @change="changeTemplateFormulation">
  222. <el-option v-for="item in templateFormulationList" :key="item.id" :label="item.tname" :value="item.id" />
  223. </el-select>
  224. </el-form-item>
  225. </el-col>
  226. </el-row>
  227. <el-row>
  228. <el-col :span="8">
  229. <el-form-item label="描述:" prop="display">
  230. <el-input v-model="create.temp.display" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" placeholder="描述" maxlength="255" style="width: 100%;" />
  231. </el-form-item>
  232. </el-col>
  233. </el-row>
  234. </el-form>
  235. <div v-if="create.dialogStatus !=='update' && !isDispaly" slot="footer" class="dialog-footer">
  236. <el-button class="cancelClose" @click="create.dialogFormVisible = false;getList()">关闭</el-button>
  237. <el-button v-if="create.dialogStatus==='create'" class="save" :disabled="isokDisable" @click="distributionAndSpreading()">分配撒料</el-button>
  238. </div>
  239. <!-- 栏舍 -->
  240. <div v-if="create.dialogStatus =='update' || isDispaly" class="bottom" style="border-top: 1px solid #009C69;">
  241. <el-row>
  242. <el-col :span="20">
  243. <div class="fenceHouse">
  244. <ul v-loading="create.listLoadingTimes" class="fenceHouseList">
  245. <li v-for="element in create.list1" :key="element.arrid">
  246. <span v-if="element.isShowTitle" class="fenceHouseTitle">{{ element.ftname }}:</span>
  247. <div v-for="item in element.arrList" :key="item.id" class="colorBlock">
  248. <div style="position: relative;">
  249. <el-tooltip placement="top" style="height: 18px;line-height: 18px;" :style="{'background':item.background}">
  250. <div slot="content">{{ item.barname }}</div>
  251. <div class="barname">
  252. <span style="float: left;width: 70px;overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ item.barname }}</span>
  253. <button style="background: red;float: right;color: #fff;width: 18px;font-size: 18px;border: none;text-align: center;" :disabled="isokDisable" @click="clickBar(item)">√</button>
  254. </div>
  255. </el-tooltip>
  256. <div class="barWeight" :style="{ background: 'rgba('+item.background2+ ',0.1)' }"> {{ item.weight }} </div>
  257. </div>
  258. </div>
  259. </li>
  260. </ul>
  261. </div>
  262. </el-col>
  263. <el-col :span="4">
  264. <div style="text-align: center;height: 100px;margin-top: 40px;">
  265. <div class="maxweight" style="line-height:20px;"><b>最大重量:</b>{{ create.temp.maxweight }} (KG)</div>
  266. <div class="sumweight" style="line-height:20px;margin-top: 10px;"><b>合计重量:</b>{{ create.temp.sumweight }} (KG) </div>
  267. </div>
  268. </el-col>
  269. </el-row>
  270. <!-- 撒料 -->
  271. <div class="spreadingMaterial">
  272. <div>撒料:<el-button type="danger" @click="handleEmpty">清空</el-button></div>
  273. <div class="spreadingMaterialList">
  274. <!-- force-fallback="true" -->
  275. <draggable
  276. :disabled="isDropState"
  277. id="1"
  278. data-source="juju"
  279. :list="create.list2"
  280. class="list-group1"
  281. draggable=".item"
  282. group="a"
  283. animation="500"
  284. :move="move1"
  285. @change="changeLog1"
  286. @start="start1"
  287. @end="end1(create.temp)"
  288. >
  289. <div v-for="element in create.list2" :key="element.name" class="list-group-item2 item">
  290. <div class="arr-l" :style="{'background':element.tbackground}">
  291. <div class="arr-l-t">
  292. <div class="arr-l-t-t" />
  293. <el-select
  294. v-model="element.tmrid"
  295. placeholder="撒料设备"
  296. class="arr-l-t-b el-icon-arrow-down"
  297. @change="(value)=> {changeEquipment(value, element.fttype,element.id)}"
  298. >
  299. <el-option
  300. v-for="item in equipmentList"
  301. :key="item.id"
  302. :label="item.tname"
  303. :value="item.id"
  304. />
  305. </el-select>
  306. </div>
  307. <div class="arr-l-b">
  308. <el-tooltip placement="top" class="list-group-item1 item" style="height: 18px;line-height: 18px;">
  309. <div slot="content">{{ element.tmrname }}</div>
  310. <div class="tmrname">{{ element.tmrname }}</div>
  311. </el-tooltip>
  312. </div>
  313. <div v-if="element.fttype==0" style="background: #009C69;position:absolute;bottom: 0;left: 0;">补</div>
  314. </div>
  315. <div class="arr-r">
  316. <div class="arr-r-l">
  317. <el-tooltip placement="top">
  318. <div slot="content">{{ element.barname }}</div>
  319. <div class="barname">{{ element.barname }}</div>
  320. </el-tooltip>
  321. </div>
  322. <div class="arr-r-c">-</div>
  323. <div class="arr-r-r">
  324. <el-tooltip placement="top">
  325. <div slot="content">{{ element.weight }}</div>
  326. <input
  327. ref="weight"
  328. v-model="element.weight"
  329. type="number"
  330. placeholder="重量"
  331. step="0.01"
  332. class="filter-item2"
  333. style="display: inline-block;height:25px;padding:4px 4px 4px 0;text-align:right;font-size:12px;width: 95%;border: 1px solid #e6e6e6;"
  334. @keyup.enter="$event.target.blur"
  335. @focus="focusWeight"
  336. @blur="blurWeight(element)"
  337. />
  338. <!-- <el-input ref="wagonnumber" v-model="create.createTemp.wagonnumber" :disabled="create.dialogStatus=='see'" class="filter-item" placeholder="送货单编号" type="text" /> -->
  339. </el-tooltip>
  340. </div>
  341. </div>
  342. <div class="arr-t" :style="{'background':element.background}">
  343. <i class="el-icon-close" style="position: absolute;right: 0;" @click="handleFLDelete(element)" />
  344. </div>
  345. </div>
  346. </draggable>
  347. </div>
  348. </div>
  349. <div slot="footer" class="dialog-footer" style="height: 55px;">
  350. <el-button class="cancelClose" :disabled="isokDisable" @click="close()" style="top:40px;">关闭</el-button>
  351. <el-button class="save" :disabled="isokDisable" @click="updateData()" style="top:40px;">确认</el-button>
  352. </div>
  353. </div>
  354. </div>
  355. </el-dialog>
  356. <!-- 校验 -->
  357. <el-dialog :title="textMap[check.dialogStatus]" :destroy-on-close="true" :visible.sync="check.dialogFormVisible" :close-on-click-modal="false" width="30%">
  358. <div class="check">
  359. <p v-if="check.temp.isDistribution == 0">当前有未分配栏舍,未分配栏舍如下:</p>
  360. <p v-else>已分配完:当前栏舍已分配完善</p>
  361. <div v-for="(item,index) in check.temp.ftlist" :key="index">
  362. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  363. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  364. <span v-for="(item2,index2) in item.arrList" :key="index2">
  365. {{item2.barname}}
  366. </span>
  367. </span>
  368. </div>
  369. </div>
  370. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  371. <el-button class="save" @click="check.dialogFormVisible=false;">确认</el-button>
  372. </div>
  373. </el-dialog>
  374. <!-- 更改TMR编号 -->
  375. <el-dialog :title="textMap[tmrNumber.dialogStatus]" :destroy-on-close="true" :visible.sync="tmrNumber.dialogFormVisible" :close-on-click-modal="false" width="30%">
  376. <h3 style="text-align: center;">是否要改变TMR设备?</h3>
  377. <div class="tmrNumber" style="padding: 10px 30px;">
  378. <p>注:更换TMR撒料设备,变更后的装载重量不同,请选择处理方式</p>
  379. <el-radio v-model="tmrNumber.radio" label="0">1、多出的饲料平均从已分配的各栏舍中扣减。</el-radio><br/><br/>
  380. <el-radio v-model="tmrNumber.radio" label="1">2、多出的饲料从最后一个栏舍依次往前扣减。</el-radio><br/><br/>
  381. <el-radio v-model="tmrNumber.radio" label="2">3、清空已分配的撒料车。</el-radio>
  382. </div>
  383. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  384. <el-button class="cancelClose" :disabled="isokDisable" @click="closeTmrNumber">否</el-button>
  385. <el-button class="save" :disabled="isokDisable" @click="tmrNumberData()">是</el-button>
  386. </div>
  387. </el-dialog>
  388. <!-- 清空已分配的栏舍 -->
  389. <el-dialog :title="textMap[allEmpty.dialogStatus]" :destroy-on-close="true" :visible.sync="allEmpty.dialogFormVisible" :close-on-click-modal="false" width="50%">
  390. <div class="allEmptyData">
  391. <el-table
  392. id="table"
  393. :key="allEmpty.table.tableKey"
  394. ref="allEmptyTable"
  395. v-loading="allEmpty.table.listLoading"
  396. element-loading-text="给我一点时间"
  397. :data="allEmpty.table.list"
  398. border
  399. highlight-current-row
  400. style="width: 100%;"
  401. :height="height"
  402. :row-style="rowStyle"
  403. :cell-style="cellStyle"
  404. class="elTable"
  405. row-key="id"
  406. @selection-change="handleAllEmptySelect"
  407. height="300"
  408. >
  409. <el-table-column type="selection" width="50" />
  410. <el-table-column label="序号" width="50px" align="center" type="index" />
  411. <el-table-column label="栏舍名称" min-width="110px" align="center" prop="bname"/>
  412. </el-table>
  413. </div>
  414. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  415. <el-button class="cancelClose" @click="allEmpty.dialogFormVisible = false;getList()">关闭</el-button>
  416. <el-button class="save" :disabled="isokDisable" @click="allEmptyData()">确认</el-button>
  417. </div>
  418. </el-dialog>
  419. </div>
  420. </template>
  421. <script>
  422. import Cookies from 'js-cookie'
  423. import draggable from 'vuedraggable'
  424. import Sortable from 'sortablejs'
  425. import { checkButtons, ExecDataByConfig, postJson } from '@/api/common'
  426. import { MessageBox } from 'element-ui'
  427. export default {
  428. components: {
  429. draggable
  430. },
  431. data() {
  432. return {
  433. isRoleEdit: [],
  434. rowStyle: { maxHeight: 25 + 'px', height: 25 + 'px' },
  435. cellStyle: { padding: 0 + 'px' },
  436. height: document.body.clientHeight - 220, // table高度
  437. table: {
  438. getdataListParm: {
  439. page: 1,
  440. offset: 1,
  441. pagecount: 0,
  442. returntype: 'Map',
  443. parammaps: {
  444. pastureid: Cookies.get('pastureid'),
  445. times: 1,
  446. refresh: 1
  447. }
  448. },
  449. tableKey: 0,
  450. list: [],
  451. total: 0,
  452. listLoading: false
  453. },
  454. frequencyList: [], // 班次
  455. maxTime: {
  456. getMaxTimesParm: {
  457. name: 'getSysoptEnable',
  458. page: 1,
  459. offset: 1,
  460. pagecount: 1,
  461. returntype: 'Map',
  462. parammaps: {
  463. pastureid: Cookies.get('pastureid'),
  464. inforname: 'times'
  465. }
  466. }
  467. },
  468. // 是否显示小料拆分
  469. isInforvalue: false,
  470. selectList: [],
  471. historyRecord: {
  472. dialogFormVisible: false,
  473. dialogStatus: '',
  474. myComponent: null
  475. },
  476. // 自动生成
  477. automaticGeneration: {
  478. dialogFormVisible: false,
  479. dialogStatus: ''
  480. },
  481. textMap: {
  482. automaticGeneration: '提示',
  483. historyRecord: '历史记录',
  484. create: '新增',
  485. update: '编辑',
  486. check: '提示',
  487. tmrNumber:'',
  488. allEmpty:'清空已分配的栏舍'
  489. },
  490. check: {
  491. dialogFormVisible: false,
  492. dialogStatus: '',
  493. temp: {
  494. ftlist:[],
  495. isDistribution: ''
  496. }
  497. },
  498. dialogFull: false,
  499. isOrder: true,
  500. requestParam: {},
  501. isokDisable: false,
  502. create: {
  503. dialogFormVisible: false,
  504. dialogStatus: '',
  505. temp: { sel: 1, tmrid: '', tmrid2: '', maxweight: '', issplit: 1, begintime: '', sumweight: 0, display: '', times: 1, ftid: '', ftname: '', tmrname: '', maxweight: '' },
  506. rules: {
  507. tmrid2: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  508. times: [{ type: 'number', required: true, message: '必填', trigger: 'blur' }],
  509. ftid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  510. },
  511. listLoadingTimes: false,
  512. list1: [],
  513. list2: [],
  514. checkBarList: []
  515. },
  516. TMRNumberList: [], // TMR编号
  517. equipmentList: [], // 撒料设备
  518. templateFormulationList: [], // 模板配方
  519. isDispaly: false,
  520. dropState: false,
  521. isDropState:false,
  522. tmrNumber:{
  523. dialogFormVisible: false,
  524. dialogStatus: '',
  525. temp:{},
  526. radio:'0'
  527. },
  528. allEmpty:{
  529. dialogFormVisible: false,
  530. dialogStatus: '',
  531. table: {
  532. getdataListParm: {
  533. name:'getBarList',
  534. page: 1,
  535. offset: 1,
  536. pagecount: '',
  537. returntype: 'Map',
  538. parammaps: {
  539. pastureid: Cookies.get('pastureid'),
  540. times: 1,
  541. refresh: 1
  542. }
  543. },
  544. tableKey: 0,
  545. list: [],
  546. total: 0,
  547. listLoading: false,
  548. }
  549. },
  550. allEmptySelect:[]
  551. }
  552. },
  553. created() {
  554. this.getButtons()
  555. this.getIsDisplay()
  556. this.getList()
  557. },
  558. methods: {
  559. getButtons() {
  560. const Edit = 'MaterialIssuancePlan'
  561. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  562. this.isRoleEdit = isRoleEdit
  563. },
  564. // 下拉列表
  565. getDownList() {
  566. const url = 'authdata/GetDataByName'
  567. const data1 = {
  568. name: 'getTMRListEnableType',
  569. offset: 0,
  570. parammaps: {
  571. pastureid: Cookies.get('pastureid'),
  572. eqtype: '1'
  573. }
  574. }
  575. postJson(url, data1).then(response => {
  576. if (response.data !== null) {
  577. this.TMRNumberList = response.data.list
  578. if(this.create.dialogStatus == 'create'){
  579. let isId = false
  580. for(let i=0;i<this.TMRNumberList.length;i++){
  581. if(this.TMRNumberList[i].id == '1000'){
  582. isId = true
  583. }
  584. }
  585. if(isId = true){
  586. if (this.create.list2.length > 0) {
  587. this.tmrNumber.dialogFormVisible = true
  588. this.tmrNumber.dialogStatus = 'tmrNumber'
  589. this.tmrNumber.radio = '0'
  590. } else {
  591. this.create.temp.tmrid2 = '1000'
  592. this.create.temp.tmrid = this.create.temp.tmrid2
  593. this.create.temp.tmrname = this.TMRNumberList.find(obj => obj.id === '1000').eqcode
  594. this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === '1000').maxstirfeed
  595. this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === '1000').tclassname
  596. this.create.temp.mytmrid = this.create.temp.tmrid
  597. this.create.temp.mytmrname = this.create.temp.tmrname
  598. if (this.isDispaly || this.create.dialogStatus == 'update') {
  599. this.getClearList()
  600. }
  601. }
  602. }
  603. }
  604. } else {
  605. this.TMRNumberList = []
  606. }
  607. })
  608. const url2 = 'authdata/tmrListEnableTypeAll'
  609. const data2 = {
  610. parammaps: {
  611. pastureid: Cookies.get('pastureid')
  612. }
  613. }
  614. postJson(url2, data2).then(response => {
  615. if (response.data !== null) {
  616. this.equipmentList = response.data
  617. if(this.create.dialogStatus == 'update'){
  618. if(this.equipmentList.find(obj => obj.id == this.create.temp.tmrid) !== undefined){
  619. this.create.temp.tclassname = this.equipmentList.find(obj => obj.id == this.create.temp.tmrid).tclassname
  620. }else{
  621. this.create.temp.tclassname = '固定式'
  622. }
  623. }
  624. } else {
  625. this.equipmentList = []
  626. }
  627. })
  628. const data3 = {
  629. name: 'getFTSWList',
  630. offset: 0,
  631. parammaps: {
  632. pastureid: Cookies.get('pastureid')
  633. }
  634. }
  635. postJson(url, data3).then(response => {
  636. if (response.data !== null) {
  637. this.templateFormulationList = response.data.list
  638. } else {
  639. this.templateFormulationList = []
  640. }
  641. })
  642. const data4 = {
  643. name: 'getSysoptEnable',
  644. offset: 0,
  645. parammaps: {
  646. pastureid: Cookies.get('pastureid'),
  647. inforname: 'isSmallMaterial'
  648. }
  649. }
  650. postJson(url, data4).then(response => {
  651. if (response.data !== null) {
  652. if (response.data.list[0].inforvalue == 0) {
  653. this.isInforvalue = false
  654. } else {
  655. this.isInforvalue = true
  656. }
  657. } else {
  658. this.isInforvalue = false
  659. }
  660. })
  661. },
  662. getIsDisplay() {
  663. const url = 'authdata/GetDataByName'
  664. const data = this.maxTime.getMaxTimesParm
  665. postJson(url, data).then(response => {
  666. console.log(response.data.list[0].inforvalue)
  667. if (response.data.list[0].inforvalue == 1) {
  668. this.frequencyList = [{ id: 1, name: '第一班' }]
  669. } else if (response.data.list[0].inforvalue == 2) {
  670. this.frequencyList = [
  671. { id: 1, name: '第一班' },
  672. { id: 2, name: '第二班' }
  673. ]
  674. } else if (response.data.list[0].inforvalue == 3) {
  675. this.frequencyList = [
  676. { id: 1, name: '第一班' },
  677. { id: 2, name: '第二班' },
  678. { id: 3, name: '第三班' }
  679. ]
  680. } else if (response.data.list[0].inforvalue == 4) {
  681. this.frequencyList = [
  682. { id: 1, name: '第一班' },
  683. { id: 2, name: '第二班' },
  684. { id: 3, name: '第三班' },
  685. { id: 4, name: '第四班' }
  686. ]
  687. }
  688. })
  689. },
  690. getList() {
  691. this.table.listLoading = true
  692. const url = 'authdata/spillage'
  693. const data = this.table.getdataListParm
  694. postJson(url, data).then(response => {
  695. if (response.data.list !== undefined) {
  696. if (response.data.list !== null) {
  697. console.log('table数据', response.data.list)
  698. for (let i = 0; i < response.data.list.length; i++) {
  699. if (response.data.list[i].arrList == null) {
  700. this.$set(response.data.list[i], 'arrList', [])
  701. }
  702. }
  703. this.table.list = response.data.list
  704. this.table.total = response.data.list.length
  705. setTimeout(() => {
  706. this.$refs.table.doLayout()
  707. }, 100)
  708. } else {
  709. this.table.list = []
  710. }
  711. }
  712. this.table.listLoading = false
  713. })
  714. },
  715. changeFrequency(val) {
  716. console.log('选择了班次', val)
  717. this.getList()
  718. },
  719. // 行内删除
  720. handleRowDelete(row) {
  721. console.log(row, '点击了行删除')
  722. if (row.arrList.length == 0) {
  723. MessageBox.confirm('是否确认删除此信息?', {
  724. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  725. }).then(() => {
  726. this.selectList = []
  727. this.requestParam = {}
  728. this.requestParam.name = 'deleteLpp'
  729. this.requestParam.parammaps = {}
  730. this.requestParam.parammaps.pastureid = row.pastureid
  731. this.requestParam.parammaps.id = row.id
  732. const url = 'authdata/PostDataByName'
  733. const data = this.requestParam
  734. postJson(url, data).then(response => {
  735. if (response.msg === 'fail') {
  736. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  737. } else {
  738. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  739. this.table.getdataListParm.parammaps.refresh = 1
  740. this.getList()
  741. }
  742. })
  743. }).catch(() => {
  744. this.$message({ type: 'info', message: '已取消删除' })
  745. })
  746. } else {
  747. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  748. return false
  749. }
  750. },
  751. handleSelect(val) {
  752. console.log('勾选数据', val)
  753. this.selectList = val
  754. },
  755. changeTemplateFormulation(item) {
  756. this.create.temp.ftname = this.templateFormulationList.find(obj => obj.id === item).tname
  757. this.getCreateList1()
  758. },
  759. changeTimes(item) {
  760. this.getCreateList1()
  761. },
  762. // TMR编号
  763. changeTMRNumber(item) {
  764. if (this.create.list2.length > 0) {
  765. // 备份
  766. // MessageBox.confirm('更换TMR撒料设备,会清空撒料车,是否更换?', {
  767. // confirmButtonText: '是', cancelButtonText: '否', type: 'warning'
  768. // }).then(() => {
  769. // this.create.temp.tmrid = this.create.temp.tmrid2
  770. // this.create.temp.tmrname = this.TMRNumberList.find(obj => obj.id === item).eqcode
  771. // this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === item).maxstirfeed
  772. // this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === item).tclassname
  773. // this.create.temp.mytmrid = this.create.temp.tmrid
  774. // this.create.temp.mytmrname = this.create.temp.tmrname
  775. // console.log('tmrname==>', this.create.temp)
  776. // if (this.isDispaly || this.create.dialogStatus == 'update') {
  777. // this.getClearList()
  778. // }
  779. // }).catch(() => {
  780. // if(this.create.temp.tclassname == '固定式'){
  781. // console.log( this.create.temp,'====')
  782. // this.create.temp.tmrid = this.create.temp.mytmrid
  783. // }
  784. // this.create.temp.tmrid2 = this.create.temp.tmrid
  785. // this.create.temp.tmrname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).eqcode
  786. // this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).maxstirfeed
  787. // this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).tclassname
  788. // this.create.temp.mytmrid = this.create.temp.tmrid2
  789. // this.create.temp.mytmrname = this.create.temp.tmrname
  790. // console.log(this.create.temp)
  791. // this.$message({ type: 'info', message: '已取消' })
  792. // })
  793. // 备份
  794. this.tmrNumber.dialogFormVisible = true
  795. this.tmrNumber.dialogStatus = 'tmrNumber'
  796. this.tmrNumber.radio = '0'
  797. } else {
  798. this.create.temp.tmrid = this.create.temp.tmrid2
  799. this.create.temp.tmrname = this.TMRNumberList.find(obj => obj.id === item).eqcode
  800. this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === item).maxstirfeed
  801. this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === item).tclassname
  802. this.create.temp.mytmrid = this.create.temp.tmrid
  803. this.create.temp.mytmrname = this.create.temp.tmrname
  804. if (this.isDispaly || this.create.dialogStatus == 'update') {
  805. this.getClearList()
  806. }
  807. }
  808. },
  809. tmrNumberData(){
  810. if(this.tmrNumber.radio == '0'){
  811. console.log('1、多出的饲料平均从已分配的各栏舍中扣减。')
  812. }else if(this.tmrNumber.radio == '1'){
  813. console.log('2、多出的饲料从最后一个栏舍依次往前扣减。')
  814. }else if(this.tmrNumber.radio == '2'){
  815. console.log('3、清空已分配的撒料车。')
  816. }
  817. const url = 'authdata/materialtmr/edit'
  818. const data = {
  819. tmrid:this.create.temp.tmrid2,
  820. tmrtype: this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).tclassid,
  821. lppid:this.create.temp.id,
  822. times:this.create.temp.times,
  823. pastureid:Cookies.get('pastureid'),
  824. status:this.tmrNumber.radio
  825. }
  826. postJson(url, data).then(response => {
  827. if (response.msg === 'fail') {
  828. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  829. } else {
  830. this.$notify({ title: '', message: '成功', type: 'success', duration: 2000 })
  831. this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).maxstirfeed
  832. this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).tclassname
  833. this.tmrNumber.dialogFormVisible = false
  834. this.getCreateList1()
  835. }
  836. })
  837. },
  838. closeTmrNumber(){
  839. if(this.create.temp.tclassname == '固定式'){
  840. console.log( this.create.temp,'====')
  841. this.create.temp.tmrid = this.create.temp.mytmrid
  842. }
  843. this.create.temp.tmrid2 = this.create.temp.tmrid
  844. this.create.temp.tmrname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).eqcode
  845. this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).maxstirfeed
  846. this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).tclassname
  847. this.create.temp.mytmrid = this.create.temp.tmrid2
  848. this.create.temp.mytmrname = this.create.temp.tmrname
  849. this.tmrNumber.dialogFormVisible = false
  850. },
  851. getClearList() {
  852. const url = 'authdata/lpplandtl/del'
  853. const data = []
  854. this.create.list2.forEach((item, i) => {
  855. const obj = {}
  856. obj.pastureid = item.pastureid
  857. obj.lpplandtlid = item.id
  858. obj.fttype = item.fttype
  859. obj.lweight = item.lweight
  860. obj.fpdid = item.fpdid
  861. data.push(obj)
  862. })
  863. postJson(url, data).then(response => {
  864. if (response.msg === 'fail') {
  865. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  866. } else {
  867. this.$notify({ title: '', message: '成功', type: 'success', duration: 2000 })
  868. this.getCreateList1()
  869. }
  870. })
  871. },
  872. colorRgb(sColor) {
  873. sColor = sColor.toLowerCase()
  874. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
  875. // 如果是16进制颜色
  876. if (sColor && reg.test(sColor)) {
  877. if (sColor.length === 4) {
  878. var sColorNew = '#'
  879. for (var i = 1; i < 4; i += 1) {
  880. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
  881. }
  882. sColor = sColorNew
  883. }
  884. // 处理六位的颜色值
  885. var sColorChange = []
  886. for (var i = 1; i < 7; i += 2) {
  887. sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2)))
  888. }
  889. return sColorChange.join(',')
  890. }
  891. return 'rgba(' + sColorChange.join(',') + ')'
  892. },
  893. dbclickWeight(item) {
  894. console.log('item==>', item)
  895. console.log('isRoleEdit==>', this.isRoleEdit)
  896. this.$set(item, 'isWeight', true)
  897. this.$set(item, 'focusState', true)
  898. },
  899. focusWeight(){
  900. this.isDropState = true
  901. },
  902. blurWeight(item) {
  903. console.log("item.weight", item)
  904. console.log("监听Blur======================")
  905. this.isDropState = false
  906. if (parseFloat(item.weight) <= 0) {
  907. this.$message({ type: 'error', message: '重量不可输入小于0的数据', duration: 2000 })
  908. return false
  909. }
  910. if (item.weight == '') {
  911. item.weight = 0
  912. }
  913. const lweight = String(parseFloat(item.weight) - parseFloat(item.lweight))
  914. let sum = 0
  915. this.create.list2.forEach((item, i) => {
  916. console.log('item==>', item)
  917. sum += parseFloat(item.weight)
  918. })
  919. if (sum > this.create.temp.maxweight) {
  920. this.$message({ type: 'error', message: '撒料车总重量大于最大重量', duration: 2000 })
  921. return false
  922. }
  923. this.requestParam = {}
  924. this.requestParam.common = { 'returnmap': '0' }
  925. this.requestParam.data = []
  926. this.requestParam.data[0] = {
  927. 'name': 'checkFPdLeftW', 'type': 'v',
  928. 'parammaps': {
  929. pastureid: item.pastureid, fpdid: item.fpdid, fttype: item.fttype,
  930. lweight: lweight
  931. }
  932. }
  933. this.requestParam.data[1] = {
  934. 'name': 'updateLppd', 'type': 'e',
  935. 'parammaps': {
  936. pastureid: this.create.temp.pastureid, lppid: this.create.temp.id, barid: item.barid,
  937. barname: item.barname, fpdid: item.fpdid, fttype: item.fttype,
  938. lweight: item.weight, sort: item.sort, tmrid: item.tmrid,
  939. tmrname: item.tmrname, background: item.background, id: item.id
  940. }
  941. }
  942. this.requestParam.data[2] = {
  943. 'name': 'updateFpdetailUse', 'type': 'e',
  944. 'parammaps': {
  945. pastureid: item.pastureid, id: item.fpdid,
  946. fttype: item.fttype, lweight: lweight
  947. }
  948. }
  949. ExecDataByConfig(this.requestParam).then(response => {
  950. if (response.msg === 'fail') {
  951. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  952. } else {
  953. // this.isDropState = false
  954. // this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  955. }
  956. this.getCreateList1()
  957. })
  958. },
  959. handleFLDelete(ele) {
  960. console.log(ele, '点击了撒料删除')
  961. this.requestParam = {}
  962. this.requestParam.common = { 'returnmap': '0' }
  963. this.requestParam.data = []
  964. this.requestParam.data[0] = {
  965. 'name': 'deleteLppd', 'type': 'e',
  966. 'parammaps': { pastureid: ele.pastureid, id: ele.id }
  967. }
  968. this.requestParam.data[1] = {
  969. 'name': 'updateFpdetailUse', 'type': 'e',
  970. 'parammaps': { pastureid: ele.pastureid, id: ele.fpdid, fttype: ele.fttype, lweight: '-' + parseFloat(ele.weight) }
  971. }
  972. const url = 'authdata/ExecDataByConfig'
  973. const data = this.requestParam
  974. postJson(url, data).then(response => {
  975. if (response.msg === 'fail') {
  976. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  977. } else {
  978. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  979. this.getCreateList1()
  980. }
  981. })
  982. },
  983. handleCreate() {
  984. this.create.temp = { sel: 1, tmrid: '', tmrid2: '', maxweight: '', issplit: 1, begintime: '', sumweight: 0, display: '', times: 1, ftid: '', ftname: '', tmrname: '', maxweight: '' }
  985. // console.log('新增车次',create.temp.tmrid2)
  986. this.create.temp.times = this.table.getdataListParm.parammaps.times
  987. this.getDownList()
  988. this.isDispaly = false
  989. this.dialogFull = false
  990. this.create.dialogStatus = 'create'
  991. this.create.dialogFormVisible = true
  992. this.create.list1 = []
  993. this.create.list2 = []
  994. this.create.checkBarList = []
  995. },
  996. distributionAndSpreading() {
  997. console.log('点击了分配撒料')
  998. this.$refs['temp'].validate(valid => {
  999. if (valid) {
  1000. this.isokDisable = true
  1001. setTimeout(() => {
  1002. this.isokDisable = false
  1003. }, 1000)
  1004. const url = 'authdata/lpplan/add'
  1005. const data = {}
  1006. this.create.temp.pastureid = Cookies.get('pastureid')
  1007. this.create.temp.times = parseInt(this.create.temp.times)
  1008. data.parammaps = this.create.temp
  1009. postJson(url, data).then(response => {
  1010. console.log('新增保存发送参数', this.requestParam)
  1011. if (response.msg !== 'fail') {
  1012. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1013. this.create.temp.id = response.data.Id
  1014. this.isDispaly = true
  1015. } else {
  1016. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1017. }
  1018. })
  1019. this.getCreateList1()
  1020. }
  1021. })
  1022. },
  1023. getCreateList1() {
  1024. this.create.listLoadingTimes = true
  1025. const url = 'authdata/spillage'
  1026. const data = {
  1027. page: 1,
  1028. offset: 1,
  1029. pagecount: 0,
  1030. returntype: 'Map',
  1031. parammaps: {
  1032. pastureid: Cookies.get('pastureid'),
  1033. times: this.create.temp.times,
  1034. refresh: 2,
  1035. ftid: this.create.temp.ftid
  1036. }
  1037. }
  1038. postJson(url, data).then(response => {
  1039. if (response.data.ftlist !== null) {
  1040. for (let i = 0; i < response.data.ftlist.length; i++) {
  1041. this.$set(response.data.ftlist[i], 'isShowTitle', true)
  1042. if (response.data.ftlist[i].arrList == null) {
  1043. this.$set(response.data.ftlist[i], 'isShowTitle', false)
  1044. } else {
  1045. for (let j = 0; j < response.data.ftlist[i].arrList.length; j++) {
  1046. this.$set(response.data.ftlist[i].arrList[j], 'background2', this.colorRgb(response.data.ftlist[i].arrList[j].background))
  1047. }
  1048. }
  1049. }
  1050. this.create.list1 = response.data.ftlist
  1051. } else {
  1052. this.create.list1 = []
  1053. }
  1054. this.create.listLoadingTimes = false
  1055. })
  1056. this.getCreateList2()
  1057. },
  1058. getCreateList2() {
  1059. const url = 'authdata/lpplandtl'
  1060. const data = {}
  1061. data.parammaps = {}
  1062. data.parammaps.pastureid = Cookies.get('pastureid'),
  1063. data.parammaps.id = this.create.temp.id
  1064. postJson(url, data).then(response => {
  1065. if (response.data !== null) {
  1066. this.create.list2 = response.data
  1067. this.create.temp.sort = response.data.length + 1
  1068. var sumweight = 0
  1069. for (let i = 0; i < this.create.list2.length; i++) {
  1070. sumweight += parseFloat(this.create.list2[i].weight)
  1071. this.$set(this.create.list2[i], 'isWeight', false)
  1072. this.$set(this.create.list2[i], 'focusState', false)
  1073. }
  1074. console.log('sumweight==>', sumweight)
  1075. this.create.temp.sumweight = (sumweight).toFixed(2)
  1076. } else {
  1077. this.create.list2 = []
  1078. // this.create.temp.sort = 0
  1079. this.create.temp.sumweight = 0
  1080. }
  1081. })
  1082. },
  1083. clickBar(item) {
  1084. this.isokDisable = true
  1085. setTimeout(() => {
  1086. this.isokDisable = false
  1087. }, 1000)
  1088. this.create.temp.sumweight = parseFloat(this.create.temp.sumweight)
  1089. console.log('this.TMRNumberList==>', this.TMRNumberList)
  1090. console.log('点击了栏舍item==>', item)
  1091. console.log('temp==>',this.create.temp)
  1092. console.log('this.equipmentList==>',this.equipmentList)
  1093. // if(this.create.temp.tclassname == '固定式'){
  1094. // if(this.equipmentList.find(obj => obj.tclassname == '撒料设备') !== undefined){
  1095. // this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '撒料设备').eqcode
  1096. // this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '撒料设备').id
  1097. // }else if(this.equipmentList.find(obj => obj.tclassname == '自走式') !== undefined){
  1098. // this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '自走式').eqcode
  1099. // this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '自走式').id
  1100. // }else{
  1101. // this.$message({ type: 'error', message: '请先在TMR设备中创建撒料设备', duration: 2000 })
  1102. // return
  1103. // }
  1104. // }
  1105. if(this.create.temp.tclassname == '固定式'){
  1106. if(this.equipmentList.find(obj => obj.tclassname == '任意车1') !== undefined){
  1107. this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '任意车1').eqcode
  1108. this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '任意车1').id
  1109. }
  1110. }
  1111. var evt = this.create.temp
  1112. if (parseFloat(evt.maxweight) - parseFloat(evt.sumweight) < parseFloat(item.weight)) {
  1113. if (parseFloat(evt.sumweight) + parseFloat(item.weight) > parseFloat(evt.maxweight)) {
  1114. this.$set(item, 'weight', (parseFloat(evt.maxweight) - parseFloat(evt.sumweight)).toFixed(2))
  1115. }
  1116. }
  1117. if (parseFloat(evt.maxweight) == parseFloat(evt.sumweight) || parseFloat(evt.maxweight) < parseFloat(evt.sumweight)) {
  1118. this.$message({ type: 'error', message: '计划配方已经是最大容量', duration: 2000 })
  1119. this.getCreateList1()
  1120. return
  1121. }
  1122. console.log('item.weight===>', evt.maxweight)
  1123. console.log('item.weight===>', evt.sumweight)
  1124. const url = 'authdata/lpplandtl/add'
  1125. const data = {}
  1126. data.parammaps = {}
  1127. data.parammaps.id = item.id
  1128. data.parammaps.pastureid = evt.pastureid
  1129. data.parammaps.lppid = evt.id
  1130. data.parammaps.barid = item.barid
  1131. data.parammaps.barname = item.barname
  1132. data.parammaps.fpdid = item.id
  1133. data.parammaps.lweight = item.weight
  1134. data.parammaps.tmrid = evt.tmrid
  1135. data.parammaps.tmrname = evt.tmrname
  1136. data.parammaps.fttype = item.fttype
  1137. data.parammaps.background = item.background
  1138. data.parammaps.cowcount = item.cowcount
  1139. data.parammaps.ccountradio = item.ccountradio
  1140. postJson(url, data).then(response => {
  1141. // this.requestParam = {}
  1142. // this.requestParam.common = {
  1143. // 'returnmap': '0'
  1144. // }
  1145. // this.requestParam.data = []
  1146. // this.requestParam.data[0] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {
  1147. // pastureid:item.pastureid,
  1148. // lppid:evt.id,
  1149. // barid:item.barid,
  1150. // barname:item.barname,
  1151. // fpdid:item.id,
  1152. // tmrid:evt.tmrid,
  1153. // tmrname:evt.tmrname,
  1154. // fttype:item.fttype,
  1155. // background:item.background,
  1156. // cowcount:item.cowcount,
  1157. // ccountradio:item.ccountradio,
  1158. // lweight:item.weight
  1159. // }
  1160. // }
  1161. // ExecDataByConfig(this.requestParam).then(response => {
  1162. this.requestParam = {}
  1163. this.requestParam.common = { 'returnmap': '0' }
  1164. this.requestParam.data = []
  1165. this.requestParam.data[0] = { 'name': 'updateFpdetailUse', 'type': 'e',
  1166. 'parammaps': { pastureid: item.pastureid, id: item.id, fttype: item.fttype, lweight: item.weight }
  1167. }
  1168. const url2 = 'authdata/ExecDataByConfig'
  1169. const data2 = this.requestParam
  1170. postJson(url2, data2).then(response => {
  1171. if (response.msg === 'fail') {
  1172. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1173. } else {
  1174. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1175. }
  1176. this.getCreateList1()
  1177. })
  1178. })
  1179. },
  1180. handleUpdate(row) {
  1181. console.log(row)
  1182. console.log("equipmentList",this.equipmentList)
  1183. this.getDownList()
  1184. this.dialogFull = false
  1185. this.create.dialogStatus = 'update'
  1186. this.create.dialogFormVisible = true
  1187. row.tmrid2 = row.tmrid
  1188. this.create.temp = Object.assign({}, row)
  1189. this.create.temp.mytmrname = row.tmrname
  1190. this.create.temp.mytmrid = row.tmrid
  1191. this.create.checkBarList = []
  1192. console.log(this.create.temp,'this.create.temp')
  1193. this.getCreateList1()
  1194. },
  1195. updateData() {
  1196. this.$refs['temp'].validate(valid => {
  1197. if (valid) {
  1198. this.isokDisable = true
  1199. setTimeout(() => {
  1200. this.isokDisable = false
  1201. }, 1000)
  1202. const url = 'authdata/lpplan/edit'
  1203. const data = {}
  1204. this.create.temp.pastureid = Cookies.get('pastureid')
  1205. this.create.temp.times = parseInt(this.create.temp.times)
  1206. data.parammaps = this.create.temp
  1207. data.parammaps.tmrid = this.create.temp.tmrid2
  1208. data.parammaps.tmrname = this.create.temp.mytmrname
  1209. data.old = this.create.temp.arrList
  1210. postJson(url, data).then(response => {
  1211. console.log('新增保存发送参数', this.requestParam)
  1212. if (response.msg !== 'fail') {
  1213. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1214. this.isDispaly = false
  1215. this.dialogFull = false
  1216. this.create.dialogFormVisible = false
  1217. this.getList()
  1218. } else {
  1219. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1220. }
  1221. })
  1222. }
  1223. })
  1224. },
  1225. close() {
  1226. if (this.create.dialogStatus == 'create') {
  1227. console.log('新增关闭')
  1228. this.isokDisable = true
  1229. setTimeout(() => {
  1230. this.isokDisable = false
  1231. }, 1000)
  1232. const url = 'authdata/lpplandtl/restore'
  1233. const data = {}
  1234. data.old = []
  1235. data.new = this.create.list2
  1236. postJson(url, data).then(response => {
  1237. console.log('新增保存发送参数', this.requestParam)
  1238. if (response.msg !== 'fail') {
  1239. this.isDispaly = false
  1240. this.dialogFull = false
  1241. this.create.dialogFormVisible = false
  1242. this.getList()
  1243. //window.location.reload()
  1244. }
  1245. })
  1246. } else {
  1247. console.log('编辑关闭')
  1248. this.isokDisable = true
  1249. setTimeout(() => {
  1250. this.isokDisable = false
  1251. }, 1000)
  1252. const url = 'authdata/lpplandtl/restore'
  1253. const data = {}
  1254. data.old = this.create.temp.arrList
  1255. data.new = this.create.list2
  1256. postJson(url, data).then(response => {
  1257. console.log('新增保存发送参数', this.requestParam)
  1258. if (response.msg !== 'fail') {
  1259. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1260. this.isDispaly = false
  1261. this.dialogFull = false
  1262. this.create.dialogFormVisible = false
  1263. this.getList()
  1264. // window.location.reload()
  1265. } else {
  1266. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1267. }
  1268. })
  1269. }
  1270. },
  1271. changeEquipment(item, fttype, myid) {
  1272. console.log('item==>',item)
  1273. console.log('fttype==>',fttype)
  1274. console.log('myid==>',myid)
  1275. let tclassname = this.equipmentList.find(obj => obj.id == item).tclassname
  1276. let maxstirfeed = this.equipmentList.find(obj => obj.id == item).maxstirfeed
  1277. if(tclassname == '固定式'){
  1278. this.$message({ type: 'error', message: '固定式设备无法撒料,请选择撒料设备', duration: 2000 })
  1279. this.getCreateList2()
  1280. return
  1281. }
  1282. var objList = {}
  1283. for (let i = 0; i < this.create.list2.length; i++) {
  1284. if (this.create.list2[i].fttype == fttype && this.create.list2[i].id == myid) {
  1285. this.create.list2[i].tmrname = this.equipmentList.find(obj => obj.id === item).tname
  1286. objList = this.create.list2[i]
  1287. if(parseFloat(this.create.list2[i].weight) > parseFloat(maxstirfeed)){
  1288. objList.weight = maxstirfeed
  1289. }
  1290. }
  1291. }
  1292. const url = 'authdata/lpplandtl/add'
  1293. const data = {}
  1294. data.parammaps = {}
  1295. data.parammaps.id = objList.id
  1296. data.parammaps.pastureid = this.create.temp.pastureid
  1297. data.parammaps.lppid = this.create.temp.id
  1298. data.parammaps.tmrid = objList.tmrid
  1299. data.parammaps.tmrname = objList.tmrname
  1300. postJson(url, data).then(response => {
  1301. console.log('新增保存发送参数', this.requestParam)
  1302. if (response.msg === 'fail') {
  1303. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1304. } else {
  1305. this.getCreateList2()
  1306. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1307. }
  1308. })
  1309. },
  1310. move1(evt, originalEvent){
  1311. console.log('move1===>evt', evt)
  1312. console.log('move1===>originalEvent', originalEvent)
  1313. },
  1314. changeLog1(evt){
  1315. console.log("evt========",evt)
  1316. // 按组拖拽
  1317. const url = 'authdata/lpplandtl/edit/sort'
  1318. const data = {}
  1319. var obj = evt.moved.element
  1320. data.parammaps = {}
  1321. data.parammaps.tmrid = obj.tmrid
  1322. data.parammaps.pastureid = obj.pastureid
  1323. data.parammaps.lppid = obj.lppid
  1324. data.parammaps.sort = evt.moved.newIndex +1
  1325. data.parammaps.id = obj.id
  1326. postJson(url, data).then(response => {
  1327. console.log('拖动保存发送参数', this.requestParam)
  1328. if (response.msg === 'fail') {
  1329. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1330. } else {
  1331. this.getCreateList2()
  1332. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1333. }
  1334. })
  1335. },
  1336. start1(evt){
  1337. console.log('start1===>', evt)
  1338. // this.$set(this.table.startObj, 'from', evt.from.className)
  1339. // this.$set(this.table.startObj, 'to', evt.from.className)
  1340. },
  1341. end1(evt){
  1342. console.log('end1===>', evt)
  1343. },
  1344. // 减少车次
  1345. handleReduceTrains() {
  1346. if (this.selectList.length == 0) {
  1347. this.$message({ type: 'error', message: '请选择车次', duration: 2000 })
  1348. return false
  1349. } else {
  1350. // 减少对应车次
  1351. for (let i = 0; i < this.selectList.length; i++) {
  1352. if (this.selectList[i].arrList.length > 0) {
  1353. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  1354. return false
  1355. }
  1356. }
  1357. MessageBox.confirm('是否确认删除此信息?', {
  1358. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1359. }).then(() => {
  1360. console.log(this.selectList)
  1361. this.requestParam = {}
  1362. this.requestParam.common = { 'returnmap': '0' }
  1363. this.requestParam.data = []
  1364. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1365. this.requestParam.data[0].children = []
  1366. this.requestParam.data[0].children[0] = {
  1367. 'name': 'deleteLpp', 'type': 'e', 'parammaps': { id: '@insertSpotList.id', pastureid: '@insertSpotList.pastureid' }
  1368. }
  1369. ExecDataByConfig(this.requestParam).then(response => {
  1370. console.log('删除保存发送参数', this.requestParam)
  1371. if (response.msg === 'fail') {
  1372. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1373. } else {
  1374. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1375. this.table.getdataListParm.parammaps.refresh = 1
  1376. this.getList()
  1377. }
  1378. })
  1379. })
  1380. }
  1381. },
  1382. // 自动生成
  1383. handleAutomaticGeneration() {
  1384. this.dialogFull = false
  1385. this.automaticGeneration.dialogStatus = 'automaticGeneration'
  1386. this.automaticGeneration.dialogFormVisible = true
  1387. },
  1388. continueData(item) {
  1389. if (item == 0) {
  1390. console.log('点击继续生成')
  1391. this.requestParam = {}
  1392. this.requestParam.pastureid = Cookies.get('pastureid')
  1393. this.requestParam.type = 0
  1394. const url = 'authdata/autogeneration'
  1395. const data = this.requestParam
  1396. postJson(url, data).then(response => {
  1397. console.log('新增保存发送参数', this.requestParam)
  1398. if (response.msg !== 'fail') {
  1399. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1400. this.automaticGeneration.dialogFormVisible = false
  1401. this.getIsDisplay()
  1402. } else {
  1403. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1404. }
  1405. })
  1406. } else {
  1407. console.log('点击重新生成')
  1408. MessageBox.confirm('重新生成计划会将原有计划清空再生成,是否确认重新生成?', {
  1409. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1410. }).then(() => {
  1411. this.automaticGeneration.dialogFormVisible = false
  1412. this.requestParam = {}
  1413. this.requestParam.pastureid = Cookies.get('pastureid')
  1414. this.requestParam.type = 1
  1415. const url = 'authdata/autogeneration'
  1416. const data = this.requestParam
  1417. postJson(url, data).then(response => {
  1418. console.log('新增保存发送参数', this.requestParam)
  1419. if (response.msg !== 'fail') {
  1420. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1421. this.automaticGeneration.dialogFormVisible = false
  1422. this.getIsDisplay()
  1423. } else {
  1424. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1425. }
  1426. })
  1427. }).catch(() => {
  1428. this.$message({ type: 'info', message: '已取消重新生成' })
  1429. })
  1430. }
  1431. },
  1432. handleChangeOrder() {
  1433. console.log('更改顺序')
  1434. this.isOrder = false
  1435. this.rowDrop()
  1436. },
  1437. // 行拖拽
  1438. rowDrop() {
  1439. console.log(document.querySelector('#table .el-table__body-wrapper tbody'))
  1440. const tbody = document.querySelector('#table .el-table__body-wrapper tbody')
  1441. const that = this
  1442. var sortable = Sortable.create(tbody, {
  1443. disabled: that.dropState,
  1444. onChoose({ newIndex, oldIndex }) {
  1445. console.log(that.isOrder, 'that.isOrder == false')
  1446. console.log(that.dropState, 'that.dropState')
  1447. if (that.dropState == true || that.isOrder == true) {
  1448. sortable.destroy()
  1449. }
  1450. },
  1451. onEnd({ newIndex, oldIndex }) {
  1452. const currRow = that.table.list.splice(oldIndex, 1)[0]
  1453. that.table.list.splice(newIndex, 0, currRow)
  1454. console.log('索引', newIndex)
  1455. console.log('拖动数据', currRow)
  1456. console.log('上', that.table.list[newIndex - 1])
  1457. console.log('下', that.table.list[newIndex + 1])
  1458. }
  1459. })
  1460. },
  1461. saveChangeOrder() {
  1462. // 保存顺序
  1463. var sortArr = []
  1464. for (let i = 0; i < this.table.list.length; i++) {
  1465. var obj = {}
  1466. obj.sort = i + 1
  1467. obj.id = this.table.list[i].id
  1468. obj.pastureid = this.table.list[i].pastureid
  1469. sortArr.push(obj)
  1470. }
  1471. const url = 'authdata/trains'
  1472. const data = sortArr
  1473. postJson(url, data).then(response => {
  1474. if (response.msg === 'fail') {
  1475. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  1476. } else {
  1477. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  1478. this.table.getdataListParm.parammaps.refresh = 1
  1479. this.getList()
  1480. this.isOrder = true
  1481. }
  1482. })
  1483. },
  1484. cancelChangeOrder() {
  1485. console.log('取消顺序')
  1486. this.table.getdataListParm.parammaps.refresh = 1
  1487. this.getList()
  1488. this.isOrder = true
  1489. },
  1490. handleTakeEffect() {
  1491. if (this.selectList.length == 0) {
  1492. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1493. } else {
  1494. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  1495. confirmButtonText: '确认',
  1496. cancelButtonText: '取消',
  1497. type: 'warning'
  1498. }).then(() => {
  1499. for (let i = 0; i < this.selectList.length; i++) {
  1500. this.selectList[i].sel = 1
  1501. }
  1502. console.log('生效', this.selectList)
  1503. this.requestParam.common = { 'returnmap': '0' }
  1504. this.requestParam.data = []
  1505. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1506. this.requestParam.data[0].children = []
  1507. this.requestParam.data[0].children[0] = {
  1508. 'name': 'updatelpplanEnable', 'type': 'e', 'parammaps': { sel: '@insertSpotList.sel', id: '@insertSpotList.id', pastureid: '@insertSpotList.pastureid' }
  1509. }
  1510. ExecDataByConfig(this.requestParam).then(response => {
  1511. console.log('生效保存发送参数', this.requestParam)
  1512. if (response.msg === 'fail') {
  1513. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  1514. } else {
  1515. this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
  1516. this.table.getdataListParm.parammaps.refresh = 1
  1517. this.getList()
  1518. }
  1519. })
  1520. })
  1521. }
  1522. },
  1523. handleDisable() {
  1524. if (this.selectList.length == 0) {
  1525. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1526. } else {
  1527. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  1528. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1529. }).then(() => {
  1530. for (let i = 0; i < this.selectList.length; i++) {
  1531. this.selectList[i].sel = 0
  1532. }
  1533. console.log('禁用', this.selectList)
  1534. this.requestParam.common = { 'returnmap': '0' }
  1535. this.requestParam.data = []
  1536. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1537. this.requestParam.data[0].children = []
  1538. this.requestParam.data[0].children[0] = {
  1539. 'name': 'updatelpplanEnable',
  1540. 'type': 'e',
  1541. 'parammaps': { sel: '@insertSpotList.sel', id: '@insertSpotList.id', pastureid: '@insertSpotList.pastureid' }
  1542. }
  1543. ExecDataByConfig(this.requestParam).then(response => {
  1544. console.log('禁用保存发送参数', this.requestParam)
  1545. if (response.msg === 'fail') {
  1546. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  1547. } else {
  1548. this.$notify({ title: '禁用成功', message: '禁用成功', type: 'success', duration: 2000 })
  1549. this.table.getdataListParm.parammaps.refresh = 1
  1550. this.getList()
  1551. }
  1552. })
  1553. })
  1554. }
  1555. },
  1556. // 历史记录
  1557. handleHistoryRecord() {
  1558. console.log('点击历史记录')
  1559. this.dialogFull = false
  1560. this.historyRecord.dialogStatus = 'historyRecord'
  1561. this.historyRecord.dialogFormVisible = true
  1562. const vue = this
  1563. var myComponent = () => import('./historyRecord.vue')
  1564. return vue.historyRecord.myComponent = myComponent
  1565. },
  1566. handleCheck() {
  1567. console.log('点击了校验')
  1568. this.check.dialogStatus = 'check'
  1569. this.check.dialogFormVisible = true
  1570. this.getCheckList()
  1571. },
  1572. getCheckList() {
  1573. const url = 'authdata/spillage'
  1574. const data = {
  1575. page: 1,
  1576. offset: 1,
  1577. pagecount: 0,
  1578. returntype: 'Map',
  1579. parammaps: {
  1580. pastureid: Cookies.get('pastureid'),
  1581. times: this.table.getdataListParm.parammaps.times,
  1582. refresh: 2
  1583. }
  1584. }
  1585. postJson(url, data).then(response => {
  1586. if (response.data.ftlist !== undefined && response.data.ftlist !== null) {
  1587. this.$set(this.check.temp,'isDistribution',0)
  1588. this.check.temp.ftlist = response.data.ftlist
  1589. } else {
  1590. this.check.temp = {}
  1591. this.$set(this.check.temp,'isDistribution',1)
  1592. }
  1593. })
  1594. },
  1595. handleEmpty(){
  1596. console.log('点击了清空')
  1597. var list = []
  1598. for(let i=0;i<this.create.list2.length;i++){
  1599. var obj = {}
  1600. obj.pastureid = this.create.list2[i].pastureid
  1601. obj.id = this.create.list2[i].fpdid
  1602. obj.fttype = this.create.list2[i].fttype
  1603. obj.lweight = '-'+this.create.list2[i].weight
  1604. list.push(obj)
  1605. }
  1606. this.requestParam = {}
  1607. this.requestParam.common = { 'returnmap': '0' }
  1608. this.requestParam.data = []
  1609. this.requestParam.data[0] = { 'name': 'deleteLpplandtl1ByLppid', 'type': 'e', 'parammaps': { lppid: this.create.temp.id, pastureid: Cookies.get('pastureid') }},
  1610. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': list }}
  1611. this.requestParam.data[1].children = []
  1612. this.requestParam.data[1].children[0] = {
  1613. 'name': 'updateFpdetailUse',
  1614. 'type': 'e',
  1615. 'parammaps': { pastureid: '@insertSpotList.pastureid', id: '@insertSpotList.id', fttype: '@insertSpotList.fttype', lweight: '@insertSpotList.lweight' }
  1616. }
  1617. ExecDataByConfig(this.requestParam).then(response => {
  1618. console.log('清空保存发送参数', this.requestParam)
  1619. if (response.msg === 'fail') {
  1620. this.$notify({ title: '清空失败', message: response.data, type: 'warning', duration: 2000 })
  1621. } else {
  1622. this.$notify({ title: '清空成功', message: '清空成功', type: 'success', duration: 2000 })
  1623. this.getCreateList1()
  1624. }
  1625. })
  1626. },
  1627. handleAllEmpty(){
  1628. this.allEmpty.dialogStatus = 'allEmpty'
  1629. this.allEmpty.dialogFormVisible = true
  1630. // MessageBox.confirm('执行该操作会将现有车次已分配的撒料栏舍全部清空,是否要执行该操作?', {
  1631. // confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1632. // }).then(() => {
  1633. //
  1634. // })
  1635. this.getAllEmptyList()
  1636. },
  1637. getAllEmptyList() {
  1638. this.allEmpty.table.listLoading = true
  1639. const url = 'authdata/GetDataByName'
  1640. const data = this.allEmpty.table.getdataListParm
  1641. postJson(url, data).then(response => {
  1642. if (response.data.list !== undefined) {
  1643. if (response.data.list !== null) {
  1644. this.allEmpty.table.list = response.data.list
  1645. this.allEmpty.table.total = response.data.list.length
  1646. setTimeout(() => {
  1647. this.$refs.allEmptyTable.doLayout()
  1648. }, 100)
  1649. } else {
  1650. this.allEmpty.table.list = []
  1651. }
  1652. }
  1653. this.allEmpty.table.listLoading = false
  1654. })
  1655. },
  1656. handleAllEmptySelect(val){
  1657. this.allEmptySelect = []
  1658. val.forEach((ele)=> {
  1659. this.allEmptySelect.push(ele.id)
  1660. });
  1661. },
  1662. allEmptyData(){
  1663. // console.log(this.allEmptySelect)
  1664. // console.log(this.allEmptySelect.toString())
  1665. if(this.allEmptySelect.length == 0){
  1666. this.allEmpty.dialogFormVisible = false;
  1667. this.getList()
  1668. }else{
  1669. // this.requestParam = {}
  1670. // this.requestParam.common = { 'returnmap': '0' }
  1671. // this.requestParam.data = []
  1672. // this.requestParam.data[0] = { 'name': 'deleteLpplandtl1All', 'type': 'e', 'parammaps': { pastureid: Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times,barid:this.allEmptySelect.toString()}},
  1673. // this.requestParam.data[1] = { 'name': 'deletefpdetailAll', 'type': 'e', 'parammaps': { pastureid: Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times,barid:this.allEmptySelect.toString()}},
  1674. // this.requestParam.data[1] = { 'name': 'deletefpdetailAll', 'type': 'e', 'parammaps': { pastureid: Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times,barid:this.allEmptySelect.toString()}},
  1675. // ExecDataByConfig(this.requestParam).then(response => {
  1676. // console.log('清空已分配栏舍', this.requestParam)
  1677. // if (response.msg === 'fail') {
  1678. // this.$notify({ title: '清空失败', message: response.data, type: 'warning', duration: 2000 })
  1679. // } else {
  1680. let url = 'authdata/spillageall/del'
  1681. let data = {}
  1682. data.parammaps = {}
  1683. data.parammaps.pastureid = Cookies.get('pastureid')
  1684. data.parammaps.times = this.table.getdataListParm.parammaps.times
  1685. data.parammaps.barid = this.allEmptySelect.toString()
  1686. postJson(url, data).then(response => {
  1687. if (response.msg !== 'fail') {
  1688. this.$notify({ title: '清空成功', message: '清空成功', type: 'success', duration: 2000 })
  1689. this.allEmpty.dialogFormVisible = false;
  1690. this.getList()
  1691. } else {
  1692. this.$notify({ title: '清空失败', message: response.data, type: 'warning', duration: 2000 })
  1693. }
  1694. })
  1695. // }
  1696. // })
  1697. }
  1698. }
  1699. }
  1700. }
  1701. </script>
  1702. <style lang="scss" scoped>
  1703. .list{min-width: 60px;display: inline-block;margin: 5px 5px;text-align: center;
  1704. .tmrname{
  1705. width:100%;padding: 5px 5px;overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  1706. }
  1707. }
  1708. .fenceHouse {
  1709. height: 130px;
  1710. background: #fff;
  1711. position: relative;
  1712. ::-webkit-scrollbar {
  1713. width: 7px;
  1714. height: 7px;
  1715. background-color: #F5F5F5;
  1716. }
  1717. ::-webkit-scrollbar-track {
  1718. box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1719. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1720. border-radius: 10px;
  1721. background-color: #F5F5F5;
  1722. }
  1723. ::-webkit-scrollbar-thumb {
  1724. border-radius: 10px;
  1725. box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1726. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1727. background-color: #c8c8c8;
  1728. }
  1729. .fenceHouseList {
  1730. position: absolute;
  1731. width: 100%;
  1732. margin: 0 0;
  1733. height: 130px;
  1734. list-style: none;
  1735. padding: 0 0;
  1736. overflow: auto;
  1737. font-size: 12px;
  1738. .fenceHouseTitle {
  1739. float: left;
  1740. width: 105px;
  1741. white-space: nowrap;
  1742. overflow: hidden;
  1743. text-overflow: ellipsis;
  1744. margin: 5px 5px;
  1745. border-radius: 7px;
  1746. text-align: center;
  1747. color: #000;
  1748. height: 36px;
  1749. line-height: 36px;
  1750. }
  1751. li {
  1752. text-align: center;
  1753. color: #fff;
  1754. .barname {
  1755. display: block;
  1756. width: 100%;
  1757. overflow: hidden;
  1758. text-overflow: ellipsis;
  1759. white-space: nowrap;
  1760. }
  1761. .barWeight{
  1762. display: block;
  1763. line-height: 18px;
  1764. height: 18px;
  1765. color: #000;
  1766. width: 100%;
  1767. margin: 0 auto;
  1768. }
  1769. .colorBlock{
  1770. width: 88px;float: left;margin:5px 5px;height: 36px;
  1771. }
  1772. }
  1773. }
  1774. }
  1775. </style>
  1776. <style lang="scss" >
  1777. .spreadingMaterial {
  1778. height: 200px;
  1779. ::-webkit-scrollbar {
  1780. width: 7px;
  1781. height: 7px;
  1782. background-color: #F5F5F5;
  1783. }
  1784. ::-webkit-scrollbar-track {
  1785. box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1786. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1787. border-radius: 10px;
  1788. background-color: #F5F5F5;
  1789. }
  1790. ::-webkit-scrollbar-thumb {
  1791. border-radius: 10px;
  1792. box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1793. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1794. background-color: #c8c8c8;
  1795. }
  1796. .spreadingMaterialList{height: 100%;overflow: auto;}
  1797. .list-group-item2 {
  1798. width: 220px;
  1799. height: 50px;
  1800. overflow: hidden;
  1801. float: left;
  1802. margin: 5px 5px;
  1803. position: relative;
  1804. color: #fff;
  1805. .arr-t {
  1806. height: 50px;
  1807. border-radius: 5px 5px;
  1808. }
  1809. .arr-l {
  1810. float: left;
  1811. width: 60px;
  1812. height: 50px;
  1813. overflow: hidden;
  1814. border-radius: 5px 50% 50% 5px;
  1815. .arr-l-t {
  1816. position: relative;
  1817. .arr-l-t-t {
  1818. width: 0;
  1819. height: 0;
  1820. border-top: 26px solid #3479f2;
  1821. border-right: 26px solid transparent;
  1822. }
  1823. .arr-l-t-b {
  1824. position: absolute;
  1825. top: 4px;
  1826. left: 1px;
  1827. color: #fff;
  1828. width: 10px;
  1829. height: 10px;
  1830. .el-input--suffix {
  1831. opacity: 0;
  1832. .el-input__inner {
  1833. height: 10px;
  1834. }
  1835. }
  1836. }
  1837. }
  1838. .arr-l-b {
  1839. width: 45px;
  1840. position: absolute;
  1841. top: 15px;
  1842. left: 10px;
  1843. color: #fff !important;
  1844. font-size: 12px;
  1845. .tmrname {
  1846. width: 100%;
  1847. overflow: hidden;
  1848. text-overflow: ellipsis;
  1849. white-space: nowrap;
  1850. }
  1851. }
  1852. }
  1853. .arr-c {
  1854. position: absolute;
  1855. top: 0px;
  1856. left: 0;
  1857. }
  1858. .arr-r {
  1859. float: right;
  1860. width: 160px;
  1861. height: 50px;
  1862. overflow: hidden;
  1863. line-height: 50px;
  1864. .arr-r-l {
  1865. float: left;
  1866. width: 70px;
  1867. .barname {
  1868. width: 95%;
  1869. overflow: hidden;
  1870. text-overflow: ellipsis;
  1871. white-space: nowrap;
  1872. font-size: 14px;
  1873. text-align: center;
  1874. }
  1875. }
  1876. .arr-r-c {
  1877. float: left;
  1878. width: 10px;
  1879. }
  1880. .arr-r-r {
  1881. float: left;
  1882. width: 65px;
  1883. .weight {
  1884. width: 100%;
  1885. overflow: hidden;
  1886. text-overflow: ellipsis;
  1887. white-space: nowrap;
  1888. font-size: 14px;
  1889. }
  1890. }
  1891. }
  1892. }
  1893. }
  1894. </style>