index.vue 82 KB

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