index.vue 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900
  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. } else {
  579. this.TMRNumberList = []
  580. }
  581. })
  582. const url2 = 'authdata/tmrListEnableTypeAll'
  583. const data2 = {
  584. parammaps: {
  585. pastureid: Cookies.get('pastureid')
  586. }
  587. }
  588. postJson(url2, data2).then(response => {
  589. if (response.data !== null) {
  590. this.equipmentList = response.data
  591. if(this.create.dialogStatus == 'update'){
  592. if(this.equipmentList.find(obj => obj.id == this.create.temp.tmrid) !== undefined){
  593. this.create.temp.tclassname = this.equipmentList.find(obj => obj.id == this.create.temp.tmrid).tclassname
  594. }else{
  595. this.create.temp.tclassname = '固定式'
  596. }
  597. }
  598. } else {
  599. this.equipmentList = []
  600. }
  601. })
  602. const data3 = {
  603. name: 'getFTSWList',
  604. offset: 0,
  605. parammaps: {
  606. pastureid: Cookies.get('pastureid')
  607. }
  608. }
  609. postJson(url, data3).then(response => {
  610. if (response.data !== null) {
  611. this.templateFormulationList = response.data.list
  612. } else {
  613. this.templateFormulationList = []
  614. }
  615. })
  616. const data4 = {
  617. name: 'getSysoptEnable',
  618. offset: 0,
  619. parammaps: {
  620. pastureid: Cookies.get('pastureid'),
  621. inforname: 'isSmallMaterial'
  622. }
  623. }
  624. postJson(url, data4).then(response => {
  625. if (response.data !== null) {
  626. if (response.data.list[0].inforvalue == 0) {
  627. this.isInforvalue = false
  628. } else {
  629. this.isInforvalue = true
  630. }
  631. } else {
  632. this.isInforvalue = false
  633. }
  634. })
  635. },
  636. getIsDisplay() {
  637. const url = 'authdata/GetDataByName'
  638. const data = this.maxTime.getMaxTimesParm
  639. postJson(url, data).then(response => {
  640. console.log(response.data.list[0].inforvalue)
  641. if (response.data.list[0].inforvalue == 1) {
  642. this.frequencyList = [{ id: 1, name: '第一班' }]
  643. } else if (response.data.list[0].inforvalue == 2) {
  644. this.frequencyList = [
  645. { id: 1, name: '第一班' },
  646. { id: 2, name: '第二班' }
  647. ]
  648. } else if (response.data.list[0].inforvalue == 3) {
  649. this.frequencyList = [
  650. { id: 1, name: '第一班' },
  651. { id: 2, name: '第二班' },
  652. { id: 3, name: '第三班' }
  653. ]
  654. } else if (response.data.list[0].inforvalue == 4) {
  655. this.frequencyList = [
  656. { id: 1, name: '第一班' },
  657. { id: 2, name: '第二班' },
  658. { id: 3, name: '第三班' },
  659. { id: 4, name: '第四班' }
  660. ]
  661. }
  662. })
  663. },
  664. getList() {
  665. this.table.listLoading = true
  666. const url = 'authdata/spillage'
  667. const data = this.table.getdataListParm
  668. postJson(url, data).then(response => {
  669. if (response.data.list !== undefined) {
  670. if (response.data.list !== null) {
  671. console.log('table数据', response.data.list)
  672. for (let i = 0; i < response.data.list.length; i++) {
  673. if (response.data.list[i].arrList == null) {
  674. this.$set(response.data.list[i], 'arrList', [])
  675. }
  676. }
  677. this.table.list = response.data.list
  678. this.table.total = response.data.list.length
  679. setTimeout(() => {
  680. this.$refs.table.doLayout()
  681. }, 100)
  682. } else {
  683. this.table.list = []
  684. }
  685. }
  686. this.table.listLoading = false
  687. })
  688. },
  689. changeFrequency(val) {
  690. console.log('选择了班次', val)
  691. this.getList()
  692. },
  693. // 行内删除
  694. handleRowDelete(row) {
  695. console.log(row, '点击了行删除')
  696. if (row.arrList.length == 0) {
  697. MessageBox.confirm('是否确认删除此信息?', {
  698. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  699. }).then(() => {
  700. this.selectList = []
  701. this.requestParam = {}
  702. this.requestParam.name = 'deleteLpp'
  703. this.requestParam.parammaps = {}
  704. this.requestParam.parammaps.pastureid = row.pastureid
  705. this.requestParam.parammaps.id = row.id
  706. const url = 'authdata/PostDataByName'
  707. const data = this.requestParam
  708. postJson(url, data).then(response => {
  709. if (response.msg === 'fail') {
  710. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  711. } else {
  712. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  713. this.table.getdataListParm.parammaps.refresh = 1
  714. this.getList()
  715. }
  716. })
  717. }).catch(() => {
  718. this.$message({ type: 'info', message: '已取消删除' })
  719. })
  720. } else {
  721. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  722. return false
  723. }
  724. },
  725. handleSelect(val) {
  726. console.log('勾选数据', val)
  727. this.selectList = val
  728. },
  729. changeTemplateFormulation(item) {
  730. this.create.temp.ftname = this.templateFormulationList.find(obj => obj.id === item).tname
  731. this.getCreateList1()
  732. },
  733. changeTimes(item) {
  734. this.getCreateList1()
  735. },
  736. // TMR编号
  737. changeTMRNumber(item) {
  738. if (this.create.list2.length > 0) {
  739. // 备份
  740. // MessageBox.confirm('更换TMR撒料设备,会清空撒料车,是否更换?', {
  741. // confirmButtonText: '是', cancelButtonText: '否', type: 'warning'
  742. // }).then(() => {
  743. // this.create.temp.tmrid = this.create.temp.tmrid2
  744. // this.create.temp.tmrname = this.TMRNumberList.find(obj => obj.id === item).eqcode
  745. // this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === item).maxstirfeed
  746. // this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === item).tclassname
  747. // this.create.temp.mytmrid = this.create.temp.tmrid
  748. // this.create.temp.mytmrname = this.create.temp.tmrname
  749. // console.log('tmrname==>', this.create.temp)
  750. // if (this.isDispaly || this.create.dialogStatus == 'update') {
  751. // this.getClearList()
  752. // }
  753. // }).catch(() => {
  754. // if(this.create.temp.tclassname == '固定式'){
  755. // console.log( this.create.temp,'====')
  756. // this.create.temp.tmrid = this.create.temp.mytmrid
  757. // }
  758. // this.create.temp.tmrid2 = this.create.temp.tmrid
  759. // this.create.temp.tmrname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).eqcode
  760. // this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).maxstirfeed
  761. // this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).tclassname
  762. // this.create.temp.mytmrid = this.create.temp.tmrid2
  763. // this.create.temp.mytmrname = this.create.temp.tmrname
  764. // console.log(this.create.temp)
  765. // this.$message({ type: 'info', message: '已取消' })
  766. // })
  767. // 备份
  768. this.tmrNumber.dialogFormVisible = true
  769. this.tmrNumber.dialogStatus = 'tmrNumber'
  770. this.tmrNumber.radio = '0'
  771. } else {
  772. this.create.temp.tmrid = this.create.temp.tmrid2
  773. this.create.temp.tmrname = this.TMRNumberList.find(obj => obj.id === item).eqcode
  774. this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === item).maxstirfeed
  775. this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === item).tclassname
  776. this.create.temp.mytmrid = this.create.temp.tmrid
  777. this.create.temp.mytmrname = this.create.temp.tmrname
  778. if (this.isDispaly || this.create.dialogStatus == 'update') {
  779. this.getClearList()
  780. }
  781. }
  782. },
  783. tmrNumberData(){
  784. if(this.tmrNumber.radio == '0'){
  785. console.log('1、多出的饲料平均从已分配的各栏舍中扣减。')
  786. }else if(this.tmrNumber.radio == '1'){
  787. console.log('2、多出的饲料从最后一个栏舍依次往前扣减。')
  788. }else if(this.tmrNumber.radio == '2'){
  789. console.log('3、清空已分配的撒料车。')
  790. }
  791. const url = 'authdata/materialtmr/edit'
  792. const data = {
  793. tmrid:this.create.temp.tmrid2,
  794. tmrtype: this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).tclassid,
  795. lppid:this.create.temp.id,
  796. times:this.create.temp.times,
  797. pastureid:Cookies.get('pastureid'),
  798. status:this.tmrNumber.radio
  799. }
  800. postJson(url, data).then(response => {
  801. if (response.msg === 'fail') {
  802. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  803. } else {
  804. this.$notify({ title: '', message: '成功', type: 'success', duration: 2000 })
  805. this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).maxstirfeed
  806. this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).tclassname
  807. this.tmrNumber.dialogFormVisible = false
  808. this.getCreateList1()
  809. }
  810. })
  811. },
  812. closeTmrNumber(){
  813. if(this.create.temp.tclassname == '固定式'){
  814. console.log( this.create.temp,'====')
  815. this.create.temp.tmrid = this.create.temp.mytmrid
  816. }
  817. this.create.temp.tmrid2 = this.create.temp.tmrid
  818. this.create.temp.tmrname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).eqcode
  819. this.create.temp.maxweight = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).maxstirfeed
  820. this.create.temp.tclassname = this.TMRNumberList.find(obj => obj.id === this.create.temp.tmrid2).tclassname
  821. this.create.temp.mytmrid = this.create.temp.tmrid2
  822. this.create.temp.mytmrname = this.create.temp.tmrname
  823. this.tmrNumber.dialogFormVisible = false
  824. },
  825. getClearList() {
  826. const url = 'authdata/lpplandtl/del'
  827. const data = []
  828. this.create.list2.forEach((item, i) => {
  829. const obj = {}
  830. obj.pastureid = item.pastureid
  831. obj.lpplandtlid = item.id
  832. obj.fttype = item.fttype
  833. obj.lweight = item.lweight
  834. obj.fpdid = item.fpdid
  835. data.push(obj)
  836. })
  837. postJson(url, data).then(response => {
  838. if (response.msg === 'fail') {
  839. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  840. } else {
  841. this.$notify({ title: '', message: '成功', type: 'success', duration: 2000 })
  842. this.getCreateList1()
  843. }
  844. })
  845. },
  846. colorRgb(sColor) {
  847. sColor = sColor.toLowerCase()
  848. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
  849. // 如果是16进制颜色
  850. if (sColor && reg.test(sColor)) {
  851. if (sColor.length === 4) {
  852. var sColorNew = '#'
  853. for (var i = 1; i < 4; i += 1) {
  854. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
  855. }
  856. sColor = sColorNew
  857. }
  858. // 处理六位的颜色值
  859. var sColorChange = []
  860. for (var i = 1; i < 7; i += 2) {
  861. sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2)))
  862. }
  863. return sColorChange.join(',')
  864. }
  865. return 'rgba(' + sColorChange.join(',') + ')'
  866. },
  867. dbclickWeight(item) {
  868. console.log('item==>', item)
  869. console.log('isRoleEdit==>', this.isRoleEdit)
  870. this.$set(item, 'isWeight', true)
  871. this.$set(item, 'focusState', true)
  872. },
  873. focusWeight(){
  874. this.isDropState = true
  875. },
  876. blurWeight(item) {
  877. console.log("item.weight", item)
  878. console.log("监听Blur======================")
  879. this.isDropState = false
  880. if (parseFloat(item.weight) <= 0) {
  881. this.$message({ type: 'error', message: '重量不可输入小于0的数据', duration: 2000 })
  882. return false
  883. }
  884. if (item.weight == '') {
  885. item.weight = 0
  886. }
  887. const lweight = String(parseFloat(item.weight) - parseFloat(item.lweight))
  888. let sum = 0
  889. this.create.list2.forEach((item, i) => {
  890. console.log('item==>', item)
  891. sum += parseFloat(item.weight)
  892. })
  893. if (sum > this.create.temp.maxweight) {
  894. this.$message({ type: 'error', message: '撒料车总重量大于最大重量', duration: 2000 })
  895. return false
  896. }
  897. this.requestParam = {}
  898. this.requestParam.common = { 'returnmap': '0' }
  899. this.requestParam.data = []
  900. this.requestParam.data[0] = {
  901. 'name': 'checkFPdLeftW', 'type': 'v',
  902. 'parammaps': {
  903. pastureid: item.pastureid, fpdid: item.fpdid, fttype: item.fttype,
  904. lweight: lweight
  905. }
  906. }
  907. this.requestParam.data[1] = {
  908. 'name': 'updateLppd', 'type': 'e',
  909. 'parammaps': {
  910. pastureid: this.create.temp.pastureid, lppid: this.create.temp.id, barid: item.barid,
  911. barname: item.barname, fpdid: item.fpdid, fttype: item.fttype,
  912. lweight: item.weight, sort: item.sort, tmrid: item.tmrid,
  913. tmrname: item.tmrname, background: item.background, id: item.id
  914. }
  915. }
  916. this.requestParam.data[2] = {
  917. 'name': 'updateFpdetailUse', 'type': 'e',
  918. 'parammaps': {
  919. pastureid: item.pastureid, id: item.fpdid,
  920. fttype: item.fttype, lweight: lweight
  921. }
  922. }
  923. ExecDataByConfig(this.requestParam).then(response => {
  924. if (response.msg === 'fail') {
  925. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  926. } else {
  927. // this.isDropState = false
  928. // this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  929. }
  930. this.getCreateList1()
  931. })
  932. },
  933. handleFLDelete(ele) {
  934. console.log(ele, '点击了撒料删除')
  935. this.requestParam = {}
  936. this.requestParam.common = { 'returnmap': '0' }
  937. this.requestParam.data = []
  938. this.requestParam.data[0] = {
  939. 'name': 'deleteLppd', 'type': 'e',
  940. 'parammaps': { pastureid: ele.pastureid, id: ele.id }
  941. }
  942. this.requestParam.data[1] = {
  943. 'name': 'updateFpdetailUse', 'type': 'e',
  944. 'parammaps': { pastureid: ele.pastureid, id: ele.fpdid, fttype: ele.fttype, lweight: '-' + parseFloat(ele.weight) }
  945. }
  946. const url = 'authdata/ExecDataByConfig'
  947. const data = this.requestParam
  948. postJson(url, data).then(response => {
  949. if (response.msg === 'fail') {
  950. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  951. } else {
  952. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  953. this.getCreateList1()
  954. }
  955. })
  956. },
  957. handleCreate() {
  958. console.log('新增车次')
  959. this.create.temp = { sel: 1, tmrid: '', tmrid2: '', maxweight: '', issplit: 1, begintime: '', sumweight: 0, display: '', times: 1, ftid: '', ftname: '', tmrname: '', maxweight: '' }
  960. this.create.temp.times = this.table.getdataListParm.parammaps.times
  961. this.getDownList()
  962. this.isDispaly = false
  963. this.dialogFull = false
  964. this.create.dialogStatus = 'create'
  965. this.create.dialogFormVisible = true
  966. this.create.list1 = []
  967. this.create.list2 = []
  968. this.create.checkBarList = []
  969. },
  970. distributionAndSpreading() {
  971. console.log('点击了分配撒料')
  972. this.$refs['temp'].validate(valid => {
  973. if (valid) {
  974. this.isokDisable = true
  975. setTimeout(() => {
  976. this.isokDisable = false
  977. }, 1000)
  978. const url = 'authdata/lpplan/add'
  979. const data = {}
  980. this.create.temp.pastureid = Cookies.get('pastureid')
  981. this.create.temp.times = parseInt(this.create.temp.times)
  982. data.parammaps = this.create.temp
  983. postJson(url, data).then(response => {
  984. console.log('新增保存发送参数', this.requestParam)
  985. if (response.msg !== 'fail') {
  986. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  987. this.create.temp.id = response.data.Id
  988. this.isDispaly = true
  989. } else {
  990. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  991. }
  992. })
  993. this.getCreateList1()
  994. }
  995. })
  996. },
  997. getCreateList1() {
  998. this.create.listLoadingTimes = true
  999. const url = 'authdata/spillage'
  1000. const data = {
  1001. page: 1,
  1002. offset: 1,
  1003. pagecount: 0,
  1004. returntype: 'Map',
  1005. parammaps: {
  1006. pastureid: Cookies.get('pastureid'),
  1007. times: this.create.temp.times,
  1008. refresh: 2,
  1009. ftid: this.create.temp.ftid
  1010. }
  1011. }
  1012. postJson(url, data).then(response => {
  1013. if (response.data.ftlist !== null) {
  1014. for (let i = 0; i < response.data.ftlist.length; i++) {
  1015. this.$set(response.data.ftlist[i], 'isShowTitle', true)
  1016. if (response.data.ftlist[i].arrList == null) {
  1017. this.$set(response.data.ftlist[i], 'isShowTitle', false)
  1018. } else {
  1019. for (let j = 0; j < response.data.ftlist[i].arrList.length; j++) {
  1020. this.$set(response.data.ftlist[i].arrList[j], 'background2', this.colorRgb(response.data.ftlist[i].arrList[j].background))
  1021. }
  1022. }
  1023. }
  1024. this.create.list1 = response.data.ftlist
  1025. } else {
  1026. this.create.list1 = []
  1027. }
  1028. this.create.listLoadingTimes = false
  1029. })
  1030. this.getCreateList2()
  1031. },
  1032. getCreateList2() {
  1033. const url = 'authdata/lpplandtl'
  1034. const data = {}
  1035. data.parammaps = {}
  1036. data.parammaps.pastureid = Cookies.get('pastureid'),
  1037. data.parammaps.id = this.create.temp.id
  1038. postJson(url, data).then(response => {
  1039. if (response.data !== null) {
  1040. this.create.list2 = response.data
  1041. this.create.temp.sort = response.data.length + 1
  1042. var sumweight = 0
  1043. for (let i = 0; i < this.create.list2.length; i++) {
  1044. sumweight += parseFloat(this.create.list2[i].weight)
  1045. this.$set(this.create.list2[i], 'isWeight', false)
  1046. this.$set(this.create.list2[i], 'focusState', false)
  1047. }
  1048. console.log('sumweight==>', sumweight)
  1049. this.create.temp.sumweight = (sumweight).toFixed(2)
  1050. } else {
  1051. this.create.list2 = []
  1052. // this.create.temp.sort = 0
  1053. this.create.temp.sumweight = 0
  1054. }
  1055. })
  1056. },
  1057. clickBar(item) {
  1058. this.isokDisable = true
  1059. setTimeout(() => {
  1060. this.isokDisable = false
  1061. }, 1000)
  1062. this.create.temp.sumweight = parseFloat(this.create.temp.sumweight)
  1063. console.log('this.TMRNumberList==>', this.TMRNumberList)
  1064. console.log('点击了栏舍item==>', item)
  1065. console.log('temp==>',this.create.temp)
  1066. console.log('this.equipmentList==>',this.equipmentList)
  1067. // if(this.create.temp.tclassname == '固定式'){
  1068. // if(this.equipmentList.find(obj => obj.tclassname == '撒料设备') !== undefined){
  1069. // this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '撒料设备').eqcode
  1070. // this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '撒料设备').id
  1071. // }else if(this.equipmentList.find(obj => obj.tclassname == '自走式') !== undefined){
  1072. // this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '自走式').eqcode
  1073. // this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '自走式').id
  1074. // }else{
  1075. // this.$message({ type: 'error', message: '请先在TMR设备中创建撒料设备', duration: 2000 })
  1076. // return
  1077. // }
  1078. // }
  1079. if(this.create.temp.tclassname == '固定式'){
  1080. if(this.equipmentList.find(obj => obj.tclassname == '任意车1') !== undefined){
  1081. this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '任意车1').eqcode
  1082. this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '任意车1').id
  1083. }
  1084. }
  1085. var evt = this.create.temp
  1086. if (parseFloat(evt.maxweight) - parseFloat(evt.sumweight) < parseFloat(item.weight)) {
  1087. if (parseFloat(evt.sumweight) + parseFloat(item.weight) > parseFloat(evt.maxweight)) {
  1088. this.$set(item, 'weight', (parseFloat(evt.maxweight) - parseFloat(evt.sumweight)).toFixed(2))
  1089. }
  1090. }
  1091. if (parseFloat(evt.maxweight) == parseFloat(evt.sumweight) || parseFloat(evt.maxweight) < parseFloat(evt.sumweight)) {
  1092. this.$message({ type: 'error', message: '计划配方已经是最大容量', duration: 2000 })
  1093. this.getCreateList1()
  1094. return
  1095. }
  1096. console.log('item.weight===>', evt.maxweight)
  1097. console.log('item.weight===>', evt.sumweight)
  1098. const url = 'authdata/lpplandtl/add'
  1099. const data = {}
  1100. data.parammaps = {}
  1101. data.parammaps.id = item.id
  1102. data.parammaps.pastureid = evt.pastureid
  1103. data.parammaps.lppid = evt.id
  1104. data.parammaps.barid = item.barid
  1105. data.parammaps.barname = item.barname
  1106. data.parammaps.fpdid = item.id
  1107. data.parammaps.lweight = item.weight
  1108. data.parammaps.tmrid = evt.tmrid
  1109. data.parammaps.tmrname = evt.tmrname
  1110. data.parammaps.fttype = item.fttype
  1111. data.parammaps.background = item.background
  1112. data.parammaps.cowcount = item.cowcount
  1113. data.parammaps.ccountradio = item.ccountradio
  1114. postJson(url, data).then(response => {
  1115. // this.requestParam = {}
  1116. // this.requestParam.common = {
  1117. // 'returnmap': '0'
  1118. // }
  1119. // this.requestParam.data = []
  1120. // this.requestParam.data[0] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {
  1121. // pastureid:item.pastureid,
  1122. // lppid:evt.id,
  1123. // barid:item.barid,
  1124. // barname:item.barname,
  1125. // fpdid:item.id,
  1126. // tmrid:evt.tmrid,
  1127. // tmrname:evt.tmrname,
  1128. // fttype:item.fttype,
  1129. // background:item.background,
  1130. // cowcount:item.cowcount,
  1131. // ccountradio:item.ccountradio,
  1132. // lweight:item.weight
  1133. // }
  1134. // }
  1135. // ExecDataByConfig(this.requestParam).then(response => {
  1136. this.requestParam = {}
  1137. this.requestParam.common = { 'returnmap': '0' }
  1138. this.requestParam.data = []
  1139. this.requestParam.data[0] = { 'name': 'updateFpdetailUse', 'type': 'e',
  1140. 'parammaps': { pastureid: item.pastureid, id: item.id, fttype: item.fttype, lweight: item.weight }
  1141. }
  1142. const url2 = 'authdata/ExecDataByConfig'
  1143. const data2 = this.requestParam
  1144. postJson(url2, data2).then(response => {
  1145. if (response.msg === 'fail') {
  1146. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1147. } else {
  1148. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1149. }
  1150. this.getCreateList1()
  1151. })
  1152. })
  1153. },
  1154. handleUpdate(row) {
  1155. console.log(row)
  1156. console.log("equipmentList",this.equipmentList)
  1157. this.getDownList()
  1158. this.dialogFull = false
  1159. this.create.dialogStatus = 'update'
  1160. this.create.dialogFormVisible = true
  1161. row.tmrid2 = row.tmrid
  1162. this.create.temp = Object.assign({}, row)
  1163. this.create.temp.mytmrname = row.tmrname
  1164. this.create.temp.mytmrid = row.tmrid
  1165. this.create.checkBarList = []
  1166. console.log(this.create.temp,'this.create.temp')
  1167. this.getCreateList1()
  1168. },
  1169. updateData() {
  1170. this.$refs['temp'].validate(valid => {
  1171. if (valid) {
  1172. this.isokDisable = true
  1173. setTimeout(() => {
  1174. this.isokDisable = false
  1175. }, 1000)
  1176. const url = 'authdata/lpplan/edit'
  1177. const data = {}
  1178. this.create.temp.pastureid = Cookies.get('pastureid')
  1179. this.create.temp.times = parseInt(this.create.temp.times)
  1180. data.parammaps = this.create.temp
  1181. data.parammaps.tmrid = this.create.temp.tmrid2
  1182. data.parammaps.tmrname = this.create.temp.mytmrname
  1183. data.old = this.create.temp.arrList
  1184. postJson(url, data).then(response => {
  1185. console.log('新增保存发送参数', this.requestParam)
  1186. if (response.msg !== 'fail') {
  1187. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1188. this.isDispaly = false
  1189. this.dialogFull = false
  1190. this.create.dialogFormVisible = false
  1191. this.getList()
  1192. } else {
  1193. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1194. }
  1195. })
  1196. }
  1197. })
  1198. },
  1199. close() {
  1200. if (this.create.dialogStatus == 'create') {
  1201. console.log('新增关闭')
  1202. this.isokDisable = true
  1203. setTimeout(() => {
  1204. this.isokDisable = false
  1205. }, 1000)
  1206. const url = 'authdata/lpplandtl/restore'
  1207. const data = {}
  1208. data.old = []
  1209. data.new = this.create.list2
  1210. postJson(url, data).then(response => {
  1211. console.log('新增保存发送参数', this.requestParam)
  1212. if (response.msg !== 'fail') {
  1213. this.isDispaly = false
  1214. this.dialogFull = false
  1215. this.create.dialogFormVisible = false
  1216. this.getList()
  1217. //window.location.reload()
  1218. }
  1219. })
  1220. } else {
  1221. console.log('编辑关闭')
  1222. this.isokDisable = true
  1223. setTimeout(() => {
  1224. this.isokDisable = false
  1225. }, 1000)
  1226. const url = 'authdata/lpplandtl/restore'
  1227. const data = {}
  1228. data.old = this.create.temp.arrList
  1229. data.new = this.create.list2
  1230. postJson(url, data).then(response => {
  1231. console.log('新增保存发送参数', this.requestParam)
  1232. if (response.msg !== 'fail') {
  1233. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1234. this.isDispaly = false
  1235. this.dialogFull = false
  1236. this.create.dialogFormVisible = false
  1237. this.getList()
  1238. // window.location.reload()
  1239. } else {
  1240. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1241. }
  1242. })
  1243. }
  1244. },
  1245. changeEquipment(item, fttype, myid) {
  1246. console.log('item==>',item)
  1247. console.log('fttype==>',fttype)
  1248. console.log('myid==>',myid)
  1249. let tclassname = this.equipmentList.find(obj => obj.id == item).tclassname
  1250. let maxstirfeed = this.equipmentList.find(obj => obj.id == item).maxstirfeed
  1251. if(tclassname == '固定式'){
  1252. this.$message({ type: 'error', message: '固定式设备无法撒料,请选择撒料设备', duration: 2000 })
  1253. this.getCreateList2()
  1254. return
  1255. }
  1256. var objList = {}
  1257. for (let i = 0; i < this.create.list2.length; i++) {
  1258. if (this.create.list2[i].fttype == fttype && this.create.list2[i].id == myid) {
  1259. this.create.list2[i].tmrname = this.equipmentList.find(obj => obj.id === item).tname
  1260. objList = this.create.list2[i]
  1261. if(parseFloat(this.create.list2[i].weight) > parseFloat(maxstirfeed)){
  1262. objList.weight = maxstirfeed
  1263. }
  1264. }
  1265. }
  1266. const url = 'authdata/lpplandtl/add'
  1267. const data = {}
  1268. data.parammaps = {}
  1269. data.parammaps.id = objList.id
  1270. data.parammaps.pastureid = this.create.temp.pastureid
  1271. data.parammaps.lppid = this.create.temp.id
  1272. data.parammaps.tmrid = objList.tmrid
  1273. data.parammaps.tmrname = objList.tmrname
  1274. postJson(url, data).then(response => {
  1275. console.log('新增保存发送参数', this.requestParam)
  1276. if (response.msg === 'fail') {
  1277. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1278. } else {
  1279. this.getCreateList2()
  1280. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1281. }
  1282. })
  1283. },
  1284. move1(evt, originalEvent){
  1285. console.log('move1===>evt', evt)
  1286. console.log('move1===>originalEvent', originalEvent)
  1287. },
  1288. changeLog1(evt){
  1289. console.log("evt========",evt)
  1290. // 按组拖拽
  1291. const url = 'authdata/lpplandtl/edit/sort'
  1292. const data = {}
  1293. var obj = evt.moved.element
  1294. data.parammaps = {}
  1295. data.parammaps.tmrid = obj.tmrid
  1296. data.parammaps.pastureid = obj.pastureid
  1297. data.parammaps.lppid = obj.lppid
  1298. data.parammaps.sort = evt.moved.newIndex +1
  1299. data.parammaps.id = obj.id
  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. start1(evt){
  1311. console.log('start1===>', evt)
  1312. // this.$set(this.table.startObj, 'from', evt.from.className)
  1313. // this.$set(this.table.startObj, 'to', evt.from.className)
  1314. },
  1315. end1(evt){
  1316. console.log('end1===>', evt)
  1317. },
  1318. // 减少车次
  1319. handleReduceTrains() {
  1320. if (this.selectList.length == 0) {
  1321. this.$message({ type: 'error', message: '请选择车次', duration: 2000 })
  1322. return false
  1323. } else {
  1324. // 减少对应车次
  1325. for (let i = 0; i < this.selectList.length; i++) {
  1326. if (this.selectList[i].arrList.length > 0) {
  1327. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  1328. return false
  1329. }
  1330. }
  1331. MessageBox.confirm('是否确认删除此信息?', {
  1332. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1333. }).then(() => {
  1334. console.log(this.selectList)
  1335. this.requestParam = {}
  1336. this.requestParam.common = { 'returnmap': '0' }
  1337. this.requestParam.data = []
  1338. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1339. this.requestParam.data[0].children = []
  1340. this.requestParam.data[0].children[0] = {
  1341. 'name': 'deleteLpp', 'type': 'e', 'parammaps': { id: '@insertSpotList.id', pastureid: '@insertSpotList.pastureid' }
  1342. }
  1343. ExecDataByConfig(this.requestParam).then(response => {
  1344. console.log('删除保存发送参数', this.requestParam)
  1345. if (response.msg === 'fail') {
  1346. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1347. } else {
  1348. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1349. this.table.getdataListParm.parammaps.refresh = 1
  1350. this.getList()
  1351. }
  1352. })
  1353. })
  1354. }
  1355. },
  1356. // 自动生成
  1357. handleAutomaticGeneration() {
  1358. this.dialogFull = false
  1359. this.automaticGeneration.dialogStatus = 'automaticGeneration'
  1360. this.automaticGeneration.dialogFormVisible = true
  1361. },
  1362. continueData(item) {
  1363. if (item == 0) {
  1364. console.log('点击继续生成')
  1365. this.requestParam = {}
  1366. this.requestParam.pastureid = Cookies.get('pastureid')
  1367. this.requestParam.type = 0
  1368. const url = 'authdata/autogeneration'
  1369. const data = this.requestParam
  1370. postJson(url, data).then(response => {
  1371. console.log('新增保存发送参数', this.requestParam)
  1372. if (response.msg !== 'fail') {
  1373. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1374. this.automaticGeneration.dialogFormVisible = false
  1375. this.getIsDisplay()
  1376. } else {
  1377. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1378. }
  1379. })
  1380. } else {
  1381. console.log('点击重新生成')
  1382. MessageBox.confirm('重新生成计划会将原有计划清空再生成,是否确认重新生成?', {
  1383. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1384. }).then(() => {
  1385. this.automaticGeneration.dialogFormVisible = false
  1386. this.requestParam = {}
  1387. this.requestParam.pastureid = Cookies.get('pastureid')
  1388. this.requestParam.type = 1
  1389. const url = 'authdata/autogeneration'
  1390. const data = this.requestParam
  1391. postJson(url, data).then(response => {
  1392. console.log('新增保存发送参数', this.requestParam)
  1393. if (response.msg !== 'fail') {
  1394. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1395. this.automaticGeneration.dialogFormVisible = false
  1396. this.getIsDisplay()
  1397. } else {
  1398. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1399. }
  1400. })
  1401. }).catch(() => {
  1402. this.$message({ type: 'info', message: '已取消重新生成' })
  1403. })
  1404. }
  1405. },
  1406. handleChangeOrder() {
  1407. console.log('更改顺序')
  1408. this.isOrder = false
  1409. this.rowDrop()
  1410. },
  1411. // 行拖拽
  1412. rowDrop() {
  1413. console.log(document.querySelector('#table .el-table__body-wrapper tbody'))
  1414. const tbody = document.querySelector('#table .el-table__body-wrapper tbody')
  1415. const that = this
  1416. var sortable = Sortable.create(tbody, {
  1417. disabled: that.dropState,
  1418. onChoose({ newIndex, oldIndex }) {
  1419. console.log(that.isOrder, 'that.isOrder == false')
  1420. console.log(that.dropState, 'that.dropState')
  1421. if (that.dropState == true || that.isOrder == true) {
  1422. sortable.destroy()
  1423. }
  1424. },
  1425. onEnd({ newIndex, oldIndex }) {
  1426. const currRow = that.table.list.splice(oldIndex, 1)[0]
  1427. that.table.list.splice(newIndex, 0, currRow)
  1428. console.log('索引', newIndex)
  1429. console.log('拖动数据', currRow)
  1430. console.log('上', that.table.list[newIndex - 1])
  1431. console.log('下', that.table.list[newIndex + 1])
  1432. }
  1433. })
  1434. },
  1435. saveChangeOrder() {
  1436. // 保存顺序
  1437. var sortArr = []
  1438. for (let i = 0; i < this.table.list.length; i++) {
  1439. var obj = {}
  1440. obj.sort = i + 1
  1441. obj.id = this.table.list[i].id
  1442. obj.pastureid = this.table.list[i].pastureid
  1443. sortArr.push(obj)
  1444. }
  1445. const url = 'authdata/trains'
  1446. const data = sortArr
  1447. postJson(url, data).then(response => {
  1448. if (response.msg === 'fail') {
  1449. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  1450. } else {
  1451. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  1452. this.table.getdataListParm.parammaps.refresh = 1
  1453. this.getList()
  1454. this.isOrder = true
  1455. }
  1456. })
  1457. },
  1458. cancelChangeOrder() {
  1459. console.log('取消顺序')
  1460. this.table.getdataListParm.parammaps.refresh = 1
  1461. this.getList()
  1462. this.isOrder = true
  1463. },
  1464. handleTakeEffect() {
  1465. if (this.selectList.length == 0) {
  1466. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1467. } else {
  1468. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  1469. confirmButtonText: '确认',
  1470. cancelButtonText: '取消',
  1471. type: 'warning'
  1472. }).then(() => {
  1473. for (let i = 0; i < this.selectList.length; i++) {
  1474. this.selectList[i].sel = 1
  1475. }
  1476. console.log('生效', this.selectList)
  1477. this.requestParam.common = { 'returnmap': '0' }
  1478. this.requestParam.data = []
  1479. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1480. this.requestParam.data[0].children = []
  1481. this.requestParam.data[0].children[0] = {
  1482. 'name': 'updatelpplanEnable', 'type': 'e', 'parammaps': { sel: '@insertSpotList.sel', id: '@insertSpotList.id', pastureid: '@insertSpotList.pastureid' }
  1483. }
  1484. ExecDataByConfig(this.requestParam).then(response => {
  1485. console.log('生效保存发送参数', this.requestParam)
  1486. if (response.msg === 'fail') {
  1487. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  1488. } else {
  1489. this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
  1490. this.table.getdataListParm.parammaps.refresh = 1
  1491. this.getList()
  1492. }
  1493. })
  1494. })
  1495. }
  1496. },
  1497. handleDisable() {
  1498. if (this.selectList.length == 0) {
  1499. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1500. } else {
  1501. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  1502. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1503. }).then(() => {
  1504. for (let i = 0; i < this.selectList.length; i++) {
  1505. this.selectList[i].sel = 0
  1506. }
  1507. console.log('禁用', this.selectList)
  1508. this.requestParam.common = { 'returnmap': '0' }
  1509. this.requestParam.data = []
  1510. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1511. this.requestParam.data[0].children = []
  1512. this.requestParam.data[0].children[0] = {
  1513. 'name': 'updatelpplanEnable',
  1514. 'type': 'e',
  1515. 'parammaps': { sel: '@insertSpotList.sel', id: '@insertSpotList.id', pastureid: '@insertSpotList.pastureid' }
  1516. }
  1517. ExecDataByConfig(this.requestParam).then(response => {
  1518. console.log('禁用保存发送参数', this.requestParam)
  1519. if (response.msg === 'fail') {
  1520. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  1521. } else {
  1522. this.$notify({ title: '禁用成功', message: '禁用成功', type: 'success', duration: 2000 })
  1523. this.table.getdataListParm.parammaps.refresh = 1
  1524. this.getList()
  1525. }
  1526. })
  1527. })
  1528. }
  1529. },
  1530. // 历史记录
  1531. handleHistoryRecord() {
  1532. console.log('点击历史记录')
  1533. this.dialogFull = false
  1534. this.historyRecord.dialogStatus = 'historyRecord'
  1535. this.historyRecord.dialogFormVisible = true
  1536. const vue = this
  1537. var myComponent = () => import('./historyRecord.vue')
  1538. return vue.historyRecord.myComponent = myComponent
  1539. },
  1540. handleCheck() {
  1541. console.log('点击了校验')
  1542. this.check.dialogStatus = 'check'
  1543. this.check.dialogFormVisible = true
  1544. this.getCheckList()
  1545. },
  1546. getCheckList() {
  1547. const url = 'authdata/spillage'
  1548. const data = {
  1549. page: 1,
  1550. offset: 1,
  1551. pagecount: 0,
  1552. returntype: 'Map',
  1553. parammaps: {
  1554. pastureid: Cookies.get('pastureid'),
  1555. times: this.table.getdataListParm.parammaps.times,
  1556. refresh: 2
  1557. }
  1558. }
  1559. postJson(url, data).then(response => {
  1560. if (response.data.ftlist !== undefined && response.data.ftlist !== null) {
  1561. this.$set(this.check.temp,'isDistribution',0)
  1562. this.check.temp.ftlist = response.data.ftlist
  1563. } else {
  1564. this.check.temp = {}
  1565. this.$set(this.check.temp,'isDistribution',1)
  1566. }
  1567. })
  1568. },
  1569. handleEmpty(){
  1570. console.log('点击了清空')
  1571. var list = []
  1572. for(let i=0;i<this.create.list2.length;i++){
  1573. var obj = {}
  1574. obj.pastureid = this.create.list2[i].pastureid
  1575. obj.id = this.create.list2[i].fpdid
  1576. obj.fttype = this.create.list2[i].fttype
  1577. obj.lweight = '-'+this.create.list2[i].weight
  1578. list.push(obj)
  1579. }
  1580. this.requestParam = {}
  1581. this.requestParam.common = { 'returnmap': '0' }
  1582. this.requestParam.data = []
  1583. this.requestParam.data[0] = { 'name': 'deleteLpplandtl1ByLppid', 'type': 'e', 'parammaps': { lppid: this.create.temp.id, pastureid: Cookies.get('pastureid') }},
  1584. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': list }}
  1585. this.requestParam.data[1].children = []
  1586. this.requestParam.data[1].children[0] = {
  1587. 'name': 'updateFpdetailUse',
  1588. 'type': 'e',
  1589. 'parammaps': { pastureid: '@insertSpotList.pastureid', id: '@insertSpotList.id', fttype: '@insertSpotList.fttype', lweight: '@insertSpotList.lweight' }
  1590. }
  1591. ExecDataByConfig(this.requestParam).then(response => {
  1592. console.log('清空保存发送参数', this.requestParam)
  1593. if (response.msg === 'fail') {
  1594. this.$notify({ title: '清空失败', message: response.data, type: 'warning', duration: 2000 })
  1595. } else {
  1596. this.$notify({ title: '清空成功', message: '清空成功', type: 'success', duration: 2000 })
  1597. this.getCreateList1()
  1598. }
  1599. })
  1600. },
  1601. handleAllEmpty(){
  1602. this.allEmpty.dialogStatus = 'allEmpty'
  1603. this.allEmpty.dialogFormVisible = true
  1604. // MessageBox.confirm('执行该操作会将现有车次已分配的撒料栏舍全部清空,是否要执行该操作?', {
  1605. // confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1606. // }).then(() => {
  1607. //
  1608. // })
  1609. this.getAllEmptyList()
  1610. },
  1611. getAllEmptyList() {
  1612. this.allEmpty.table.listLoading = true
  1613. const url = 'authdata/GetDataByName'
  1614. const data = this.allEmpty.table.getdataListParm
  1615. postJson(url, data).then(response => {
  1616. if (response.data.list !== undefined) {
  1617. if (response.data.list !== null) {
  1618. this.allEmpty.table.list = response.data.list
  1619. this.allEmpty.table.total = response.data.list.length
  1620. setTimeout(() => {
  1621. this.$refs.allEmptyTable.doLayout()
  1622. }, 100)
  1623. } else {
  1624. this.allEmpty.table.list = []
  1625. }
  1626. }
  1627. this.allEmpty.table.listLoading = false
  1628. })
  1629. },
  1630. handleAllEmptySelect(val){
  1631. this.allEmptySelect = []
  1632. val.forEach((ele)=> {
  1633. this.allEmptySelect.push(ele.id)
  1634. });
  1635. },
  1636. allEmptyData(){
  1637. // console.log(this.allEmptySelect)
  1638. // console.log(this.allEmptySelect.toString())
  1639. if(this.allEmptySelect.length == 0){
  1640. this.allEmpty.dialogFormVisible = false;
  1641. this.getList()
  1642. }else{
  1643. // this.requestParam = {}
  1644. // this.requestParam.common = { 'returnmap': '0' }
  1645. // this.requestParam.data = []
  1646. // this.requestParam.data[0] = { 'name': 'deleteLpplandtl1All', 'type': 'e', 'parammaps': { pastureid: Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times,barid:this.allEmptySelect.toString()}},
  1647. // this.requestParam.data[1] = { 'name': 'deletefpdetailAll', 'type': 'e', 'parammaps': { pastureid: Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times,barid:this.allEmptySelect.toString()}},
  1648. // this.requestParam.data[1] = { 'name': 'deletefpdetailAll', 'type': 'e', 'parammaps': { pastureid: Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times,barid:this.allEmptySelect.toString()}},
  1649. // ExecDataByConfig(this.requestParam).then(response => {
  1650. // console.log('清空已分配栏舍', this.requestParam)
  1651. // if (response.msg === 'fail') {
  1652. // this.$notify({ title: '清空失败', message: response.data, type: 'warning', duration: 2000 })
  1653. // } else {
  1654. let url = 'authdata/spillageall/del'
  1655. let data = {}
  1656. data.parammaps = {}
  1657. data.parammaps.pastureid = Cookies.get('pastureid')
  1658. data.parammaps.times = this.table.getdataListParm.parammaps.times
  1659. data.parammaps.barid = this.allEmptySelect.toString()
  1660. postJson(url, data).then(response => {
  1661. if (response.msg !== 'fail') {
  1662. this.$notify({ title: '清空成功', message: '清空成功', type: 'success', duration: 2000 })
  1663. this.allEmpty.dialogFormVisible = false;
  1664. this.getList()
  1665. } else {
  1666. this.$notify({ title: '清空失败', message: response.data, type: 'warning', duration: 2000 })
  1667. }
  1668. })
  1669. // }
  1670. // })
  1671. }
  1672. }
  1673. }
  1674. }
  1675. </script>
  1676. <style lang="scss" scoped>
  1677. .list{width: 60px;display: inline-block;margin: 5px 5px;text-align: center;
  1678. .tmrname{
  1679. width:100%;padding: 5px 5px;overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  1680. }
  1681. }
  1682. .fenceHouse {
  1683. height: 130px;
  1684. background: #fff;
  1685. position: relative;
  1686. ::-webkit-scrollbar {
  1687. width: 7px;
  1688. height: 7px;
  1689. background-color: #F5F5F5;
  1690. }
  1691. ::-webkit-scrollbar-track {
  1692. box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1693. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1694. border-radius: 10px;
  1695. background-color: #F5F5F5;
  1696. }
  1697. ::-webkit-scrollbar-thumb {
  1698. border-radius: 10px;
  1699. box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1700. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1701. background-color: #c8c8c8;
  1702. }
  1703. .fenceHouseList {
  1704. position: absolute;
  1705. width: 100%;
  1706. margin: 0 0;
  1707. height: 130px;
  1708. list-style: none;
  1709. padding: 0 0;
  1710. overflow: auto;
  1711. font-size: 12px;
  1712. .fenceHouseTitle {
  1713. float: left;
  1714. width: 105px;
  1715. white-space: nowrap;
  1716. overflow: hidden;
  1717. text-overflow: ellipsis;
  1718. margin: 5px 5px;
  1719. border-radius: 7px;
  1720. text-align: center;
  1721. color: #000;
  1722. height: 36px;
  1723. line-height: 36px;
  1724. }
  1725. li {
  1726. text-align: center;
  1727. color: #fff;
  1728. .barname {
  1729. display: block;
  1730. width: 100%;
  1731. overflow: hidden;
  1732. text-overflow: ellipsis;
  1733. white-space: nowrap;
  1734. }
  1735. .barWeight{
  1736. display: block;
  1737. line-height: 18px;
  1738. height: 18px;
  1739. color: #000;
  1740. width: 100%;
  1741. margin: 0 auto;
  1742. }
  1743. .colorBlock{
  1744. width: 88px;float: left;margin:5px 5px;height: 36px;
  1745. }
  1746. }
  1747. }
  1748. }
  1749. </style>
  1750. <style lang="scss" >
  1751. .spreadingMaterial {
  1752. height: 200px;
  1753. ::-webkit-scrollbar {
  1754. width: 7px;
  1755. height: 7px;
  1756. background-color: #F5F5F5;
  1757. }
  1758. ::-webkit-scrollbar-track {
  1759. box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1760. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1761. border-radius: 10px;
  1762. background-color: #F5F5F5;
  1763. }
  1764. ::-webkit-scrollbar-thumb {
  1765. border-radius: 10px;
  1766. box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1767. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1768. background-color: #c8c8c8;
  1769. }
  1770. .spreadingMaterialList{height: 100%;overflow: auto;}
  1771. .list-group-item2 {
  1772. width: 220px;
  1773. height: 50px;
  1774. overflow: hidden;
  1775. float: left;
  1776. margin: 5px 5px;
  1777. position: relative;
  1778. color: #fff;
  1779. .arr-t {
  1780. height: 50px;
  1781. border-radius: 5px 5px;
  1782. }
  1783. .arr-l {
  1784. float: left;
  1785. width: 60px;
  1786. height: 50px;
  1787. overflow: hidden;
  1788. border-radius: 5px 50% 50% 5px;
  1789. .arr-l-t {
  1790. position: relative;
  1791. .arr-l-t-t {
  1792. width: 0;
  1793. height: 0;
  1794. border-top: 26px solid #3479f2;
  1795. border-right: 26px solid transparent;
  1796. }
  1797. .arr-l-t-b {
  1798. position: absolute;
  1799. top: 4px;
  1800. left: 1px;
  1801. color: #fff;
  1802. width: 10px;
  1803. height: 10px;
  1804. .el-input--suffix {
  1805. opacity: 0;
  1806. .el-input__inner {
  1807. height: 10px;
  1808. }
  1809. }
  1810. }
  1811. }
  1812. .arr-l-b {
  1813. width: 45px;
  1814. position: absolute;
  1815. top: 15px;
  1816. left: 10px;
  1817. color: #fff !important;
  1818. font-size: 12px;
  1819. .tmrname {
  1820. width: 100%;
  1821. overflow: hidden;
  1822. text-overflow: ellipsis;
  1823. white-space: nowrap;
  1824. }
  1825. }
  1826. }
  1827. .arr-c {
  1828. position: absolute;
  1829. top: 0px;
  1830. left: 0;
  1831. }
  1832. .arr-r {
  1833. float: right;
  1834. width: 160px;
  1835. height: 50px;
  1836. overflow: hidden;
  1837. line-height: 50px;
  1838. .arr-r-l {
  1839. float: left;
  1840. width: 70px;
  1841. .barname {
  1842. width: 95%;
  1843. overflow: hidden;
  1844. text-overflow: ellipsis;
  1845. white-space: nowrap;
  1846. font-size: 14px;
  1847. text-align: center;
  1848. }
  1849. }
  1850. .arr-r-c {
  1851. float: left;
  1852. width: 10px;
  1853. }
  1854. .arr-r-r {
  1855. float: left;
  1856. width: 65px;
  1857. .weight {
  1858. width: 100%;
  1859. overflow: hidden;
  1860. text-overflow: ellipsis;
  1861. white-space: nowrap;
  1862. font-size: 14px;
  1863. }
  1864. }
  1865. }
  1866. }
  1867. }
  1868. </style>