index.vue 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394
  1. <template>
  2. <div class="app-container">
  3. <div class="search">
  4. <el-select v-model="table.getdataListParm.parammaps.times" filterable placeholder="班次" class="filter-item" style="width: 120px;" @change="changeFrequency">
  5. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  6. </el-select>
  7. </div>
  8. <div class="operation">
  9. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float:left;" @click="handleCreate">新增车次
  10. </el-button>
  11. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" style="float:left;" @click="handleReduceTrains">减少车次</el-button>
  12. <el-button v-if="isRoleEdit" class="success" icon="el-icon-download" style="float:left;" @click="handleAutomaticGeneration">自动生成</el-button>
  13. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" style="float: left;" class="success" @click="handleChangeOrder">更改顺序</el-button>
  14. <div v-else style="float: left;margin-left: 10px;">
  15. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存 </el-button>
  16. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
  17. </div>
  18. <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" style="float: left;" @click="handleTakeEffect"> 生效</el-button>
  19. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" style="float: left;" @click="handleDisable"> 禁用</el-button>
  20. <el-button class="success" icon="el-icon-time" style="float:right;" @click="handleHistoryRecord">历史记录 </el-button>
  21. </div>
  22. <div class="table">
  23. <el-table
  24. id="table"
  25. :key="table.tableKey"
  26. ref="table"
  27. v-loading="table.listLoading"
  28. element-loading-text="给我一点时间"
  29. :data="table.list"
  30. border
  31. highlight-current-row
  32. style="width: 100%;"
  33. :height="height"
  34. :row-style="rowStyle"
  35. :cell-style="cellStyle"
  36. class="elTable"
  37. row-key="id"
  38. @selection-change="handleSelect"
  39. >
  40. <el-table-column type="selection" width="50" />
  41. <el-table-column label="车次" width="50px" align="center" class-name="small-padding fixed-width" fixed="">
  42. <template slot-scope="scope">
  43. <span>{{ scope.row.sort }}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="TMR编号" width="110px" align="center" class-name="small-padding fixed-width" fixed="left">
  47. <template slot-scope="scope">
  48. <span>{{ scope.row.tmrname }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="描述" width="110px" align="center">
  52. <template slot-scope="scope">
  53. <span>{{ scope.row.display }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="生效" width="70px" align="center">
  57. <template slot-scope="scope">
  58. <el-switch v-model="scope.row.sel" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="班次" width="65px" align="center">
  62. <template slot-scope="scope">
  63. <span>{{ scope.row.timesstr }}</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="时间" width="55px" align="center">
  67. <template slot-scope="scope">
  68. <span>{{ scope.row.begintime }}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="最大重量" width="75px" align="center">
  72. <template slot-scope="scope">
  73. <span>{{ scope.row.maxweight }}</span>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="合计重量" width="80px" align="center">
  77. <template slot-scope="scope">
  78. <span>{{ scope.row.sumweight }}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="模板配方" width="90px" align="center">
  82. <template slot-scope="scope">
  83. <span>{{ scope.row.ftname }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column v-show="isInforvalue" label="是否提前小料拆分" width="70px" align="center">
  87. <template slot-scope="scope">
  88. <el-switch v-model="scope.row.issplit" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="撒料" min-width="250px" align="left" header-align="center">
  92. <template slot-scope="scope">
  93. <div v-for="element in scope.row.arrList" :key="element.name" class="list">
  94. <el-tooltip placement="top" :open-delay="1000">
  95. <div slot="content">
  96. <div> 栏舍全称:{{ element.barname }} </div>
  97. <div> 饲料重量:{{ element.weight }} </div>
  98. </div>
  99. <div :style="{'background':element.background}" class="tmrname">{{ element.barname }}</div>
  100. </el-tooltip>
  101. </div>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="操作" align="center" width="70" class-name="small-padding fixed-width" fixed="right">
  105. <template slot-scope="{row}">
  106. <el-button v-if="isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  107. <span v-if="isRoleEdit" class="centerSpan">|</span>
  108. <el-button v-if="isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
  113. </div>
  114. <!-- 自动生成 -->
  115. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="automaticGeneration.dialogFormVisible" :close-on-click-modal="false" width="30%">
  116. <template slot="title">
  117. <div class="avue-crud__dialog__header">
  118. <span class="el-dialog__title">
  119. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  120. {{ textMap[automaticGeneration.dialogStatus] }}
  121. </span>
  122. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  123. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  124. <svg-icon v-else icon-class="fullscreen" />
  125. </div>
  126. </div>
  127. </template>
  128. <div class="app-automaticGeneration" style="margin: 0 auto;">
  129. <div style="width: 210px;margin:60px auto 120px;font-weight: 16px;">
  130. 请选择自动生成方式:<br>
  131. 清空计划并生成新计划;<br>
  132. 当前计划基础上继续生成计划;<br>
  133. </div>
  134. <div slot="footer" class="dialog-footer">
  135. <el-button style="right:240px;" class="cancelClose" @click="automaticGeneration.dialogFormVisible = false;">关闭</el-button>
  136. <el-button style="right:130px;" class="save" :disabled="isokDisable" @click="continueData(0)">继续生成 </el-button>
  137. <el-button style="right:20px;" class="save" :disabled="isokDisable" @click="continueData(1)">重新生成 </el-button>
  138. </div>
  139. </div>
  140. </el-dialog>
  141. <!-- 历史记录 -->
  142. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  143. <template slot="title">
  144. <div class="avue-crud__dialog__header">
  145. <span class="el-dialog__title">
  146. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  147. {{ textMap[historyRecord.dialogStatus] }}
  148. </span>
  149. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  150. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  151. <svg-icon v-else icon-class="fullscreen" />
  152. </div>
  153. </div>
  154. </template>
  155. <div class="historyRecord">
  156. <keep-alive>
  157. <component :is="historyRecord.myComponent" ref="historyRecord" />
  158. </keep-alive>
  159. </div>
  160. <div slot="footer" class="dialog-footer">
  161. <el-button class="cancelClose cancelClose1" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
  162. </div>
  163. </el-dialog>
  164. <!-- 新增、编辑 -->
  165. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="create.dialogFormVisible" :before-close="close" :close-on-click-modal="false" width="90%">
  166. <template slot="title">
  167. <div class="avue-crud__dialog__header">
  168. <span class="el-dialog__title">
  169. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  170. {{ textMap[create.dialogStatus] }}
  171. </span>
  172. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  173. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  174. <svg-icon v-else icon-class="fullscreen" />
  175. </div>
  176. </div>
  177. </template>
  178. <div class="create">
  179. <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="135px" style="width: 100%;margin:0 auto 10px;">
  180. <el-row>
  181. <el-col :span="8">
  182. <el-form-item label="生效:" prop="sel">
  183. <el-switch v-model="create.temp.sel" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  184. </el-form-item>
  185. </el-col>
  186. <el-col :span="8">
  187. <el-form-item label="TMR编号:" prop="tmrid2">
  188. <el-select v-model="create.temp.tmrid2" style="width: 100%;" placeholder="TMR编号" @change="changeTMRNumber">
  189. <el-option v-for="item in equipmentList" :key="item.id" :label="item.eqcode" :value="item.id" />
  190. </el-select>
  191. </el-form-item>
  192. </el-col>
  193. <el-col :span="8">
  194. <el-form-item label="班次:" prop="times">
  195. <el-select v-model="create.temp.times" :disabled="create.list2.length>0" placeholder="班次" style="width:100%;" @change="changeTimes">
  196. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  197. </el-select>
  198. </el-form-item>
  199. </el-col>
  200. </el-row>
  201. <el-row>
  202. <el-col :span="8">
  203. <el-form-item label="提前小料拆分:" prop="issplit">
  204. <el-switch v-model="create.temp.issplit" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  205. </el-form-item>
  206. </el-col>
  207. <el-col :span="8">
  208. <el-form-item label="时间:" prop="begintime">
  209. <el-time-picker v-model="create.temp.begintime" style="width: 100%;" :clearable="false" type="datetime" placeholder="时间" format="HH:mm" value-format="HH:mm" />
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="8">
  213. <el-form-item label="模板配方:" prop="ftid">
  214. <el-select v-model="create.temp.ftid" :disabled="create.list2.length>0" placeholder="模板配方" style="width:100%;" @change="changeTemplateFormulation">
  215. <el-option v-for="item in templateFormulationList" :key="item.id" :label="item.tname" :value="item.id" />
  216. </el-select>
  217. </el-form-item>
  218. </el-col>
  219. </el-row>
  220. <el-row>
  221. <el-col :span="8">
  222. <el-form-item label="描述:" prop="display">
  223. <el-input v-model="create.temp.display" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" placeholder="描述" maxlength="255" style="width: 100%;" />
  224. </el-form-item>
  225. </el-col>
  226. </el-row>
  227. </el-form>
  228. <div v-if="create.dialogStatus !=='update' && !isDispaly" slot="footer" class="dialog-footer">
  229. <el-button class="cancelClose" @click="create.dialogFormVisible = false;getList()">关闭</el-button>
  230. <el-button v-if="create.dialogStatus==='create'" class="save" :disabled="isokDisable" @click="distributionAndSpreading()">分配撒料</el-button>
  231. </div>
  232. <!-- 栏舍 -->
  233. <div v-if="create.dialogStatus =='update' || isDispaly" class="bottom" style="border-top: 1px solid #009C69;">
  234. <el-row>
  235. <el-col :span="20">
  236. <div class="fenceHouse">
  237. <ul v-loading="create.listLoadingTimes" class="fenceHouseList">
  238. <li v-for="element in create.list1" :key="element.arrid">
  239. <span v-if="element.isShowTitle" class="fenceHouseTitle">{{ element.ftname }}:</span>
  240. <div v-for="item in element.arrList" :key="item.id" class="colorBlock">
  241. <div style="position: relative;">
  242. <el-tooltip placement="top" style="height: 18px;line-height: 18px;" :style="{'background':item.background}">
  243. <div slot="content">{{ item.barname }}</div>
  244. <div class="barname">
  245. <span style="float: left;width: 70px;overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ item.barname }}</span>
  246. <b style="background: red;float: right;width: 18px;font-size: 18px;" class="el-icon-check" @click="clickBar(item)" />
  247. </div>
  248. </el-tooltip>
  249. <div class="barWeight" :style="{ background: 'rgba('+item.background2+ ',0.1)' }"> {{ item.weight }} </div>
  250. </div>
  251. </div>
  252. </li>
  253. </ul>
  254. </div>
  255. </el-col>
  256. <el-col :span="4">
  257. <div style="text-align: center;height: 100px;margin-top: 40px;">
  258. <div class="maxweight" style="line-height:20px;"><b>最大重量:</b>{{ create.temp.maxweight }} (KG)</div>
  259. <div class="sumweight" style="line-height:20px;margin-top: 10px;"><b>合计重量:</b>{{ create.temp.sumweight }} (KG) </div>
  260. </div>
  261. </el-col>
  262. </el-row>
  263. <!-- 撒料 -->
  264. <div class="spreadingMaterial">
  265. <div>撒料:</div>
  266. <div class="spreadingMaterialList">
  267. <div v-for="element in create.list2" :key="element.name" class="list-group-item2 item">
  268. <div class="arr-l" :style="{'background':element.tbackground}">
  269. <div class="arr-l-t" />
  270. <div class="arr-l-b">
  271. <el-tooltip placement="top" class="list-group-item1 item" style="height: 18px;line-height: 18px;">
  272. <div slot="content">{{ element.barname }}</div>
  273. <div class="tmrname">{{ element.barname }}</div>
  274. </el-tooltip>
  275. </div>
  276. <div v-if="element.fttype==0" style="background: #009C69;position:absolute;bottom: 0;left: 0;">补</div>
  277. </div>
  278. <div class="arr-r">
  279. <div class="arr-r-r">
  280. <el-tooltip placement="top">
  281. <div slot="content">{{ element.weight }}</div>
  282. <input
  283. ref="weight"
  284. v-model="element.weight"
  285. :autofocus="element.focusState"
  286. type="number"
  287. placeholder="重量"
  288. step="0.01"
  289. class="filter-item2"
  290. style="display: inline-block;height:25px;padding:4px 4px 4px 0;text-align:right;font-size:12px;width: 95%;border: 1px solid #e6e6e6;"
  291. @keyup.enter="$event.target.blur"
  292. @blur="blurWeight(element)"
  293. >
  294. </el-tooltip>
  295. </div>
  296. </div>
  297. <div class="arr-t" :style="{'background':element.background}">
  298. <i class="el-icon-close" style="position: absolute;right: 0;" @click="handleFLDelete(element)" />
  299. </div>
  300. </div>
  301. </div>
  302. </div>
  303. <div slot="footer" class="dialog-footer">
  304. <el-button class="cancelClose" :disabled="isokDisable" @click="close()">关闭</el-button>
  305. <el-button class="save" :disabled="isokDisable" @click="updateData()">确认</el-button>
  306. </div>
  307. </div>
  308. </div>
  309. </el-dialog>
  310. </div>
  311. </template>
  312. <script>
  313. import Cookies from 'js-cookie'
  314. import Sortable from 'sortablejs'
  315. import { checkButtons, ExecDataByConfig, postJson } from '@/api/common'
  316. import { MessageBox } from 'element-ui'
  317. export default {
  318. data() {
  319. return {
  320. isRoleEdit: [],
  321. rowStyle: { maxHeight: 25 + 'px', height: 25 + 'px' },
  322. cellStyle: { padding: 0 + 'px' },
  323. height: document.body.clientHeight - 220, // table高度
  324. table: {
  325. getdataListParm: {
  326. page: 1,
  327. offset: 1,
  328. pagecount: 0,
  329. returntype: 'Map',
  330. parammaps: {
  331. pastureid: Cookies.get('pastureid'),
  332. times: 1,
  333. refresh: 1
  334. }
  335. },
  336. tableKey: 0,
  337. list: [],
  338. total: 0,
  339. listLoading: false
  340. },
  341. frequencyList: [], // 班次
  342. maxTime: {
  343. getMaxTimesParm: {
  344. name: 'getSysoptEnable',
  345. page: 1,
  346. offset: 1,
  347. pagecount: 1,
  348. returntype: 'Map',
  349. parammaps: {
  350. pastureid: Cookies.get('pastureid'),
  351. inforname: 'times'
  352. }
  353. }
  354. },
  355. // 是否显示小料拆分
  356. isInforvalue: false,
  357. selectList: [],
  358. historyRecord: {
  359. dialogFormVisible: false,
  360. dialogStatus: '',
  361. myComponent: null
  362. },
  363. // 自动生成
  364. automaticGeneration: {
  365. dialogFormVisible: false,
  366. dialogStatus: ''
  367. },
  368. textMap: {
  369. automaticGeneration: '提示',
  370. historyRecord: '历史记录',
  371. create: '新增',
  372. update: '编辑'
  373. },
  374. dialogFull: false,
  375. isOrder: true,
  376. requestParam: {},
  377. isokDisable: false,
  378. create: {
  379. dialogFormVisible: false,
  380. dialogStatus: '',
  381. temp: { sel: 1, tmrid: '', tmrid2: '', maxweight: '', issplit: 1, begintime: '', sumweight: 0, display: '', times: 1, ftid: '', ftname: '', tmrname: '', maxweight: '' },
  382. rules: {
  383. tmrid2: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  384. times: [{ type: 'number', required: true, message: '必填', trigger: 'blur' }],
  385. ftid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  386. },
  387. listLoadingTimes: false,
  388. list1: [],
  389. list2: [],
  390. checkBarList: []
  391. },
  392. TMRNumberList: [], // TMR编号
  393. equipmentList: [], // 撒料设备
  394. templateFormulationList: [], // 模板配方
  395. isDispaly: false
  396. }
  397. },
  398. created() {
  399. this.getButtons()
  400. this.getIsDisplay()
  401. this.getList()
  402. },
  403. methods: {
  404. getButtons() {
  405. const Edit = 'MaterialIssuancePlan'
  406. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  407. this.isRoleEdit = isRoleEdit
  408. },
  409. // 下拉列表
  410. getDownList() {
  411. const url = 'authdata/GetDataByName'
  412. const data1 = {
  413. name: 'getTMRListEnableType',
  414. offset: 0,
  415. parammaps: {
  416. pastureid: Cookies.get('pastureid'),
  417. eqtype: '1'
  418. }
  419. }
  420. postJson(url, data1).then(response => {
  421. if (response.data !== null) {
  422. this.TMRNumberList = response.data.list
  423. } else {
  424. this.TMRNumberList = []
  425. }
  426. })
  427. const data2 = {
  428. name: 'getTMRListEnableTypeAll',
  429. offset: 0,
  430. parammaps: {
  431. pastureid: Cookies.get('pastureid'),
  432. eqtype: '1'
  433. }
  434. }
  435. postJson(url, data2).then(response => {
  436. if (response.data !== null) {
  437. this.equipmentList = response.data.list
  438. } else {
  439. this.equipmentList = []
  440. }
  441. })
  442. const data3 = {
  443. name: 'getFTSWList',
  444. offset: 0,
  445. parammaps: {
  446. pastureid: Cookies.get('pastureid')
  447. }
  448. }
  449. postJson(url, data3).then(response => {
  450. if (response.data !== null) {
  451. this.templateFormulationList = response.data.list
  452. } else {
  453. this.templateFormulationList = []
  454. }
  455. })
  456. const data4 = {
  457. name: 'getSysoptEnable',
  458. offset: 0,
  459. parammaps: {
  460. pastureid: Cookies.get('pastureid'),
  461. inforname: 'isSmallMaterial'
  462. }
  463. }
  464. postJson(url, data4).then(response => {
  465. if (response.data !== null) {
  466. if (response.data.list[0].inforvalue == 0) {
  467. this.isInforvalue = false
  468. } else {
  469. this.isInforvalue = true
  470. }
  471. } else {
  472. this.isInforvalue = false
  473. }
  474. })
  475. },
  476. getIsDisplay() {
  477. const url = 'authdata/GetDataByName'
  478. const data = this.maxTime.getMaxTimesParm
  479. postJson(url, data).then(response => {
  480. console.log(response.data.list[0].inforvalue)
  481. if (response.data.list[0].inforvalue == 1) {
  482. this.frequencyList = [{ id: 1, name: '第一班' }]
  483. } else if (response.data.list[0].inforvalue == 2) {
  484. this.frequencyList = [
  485. { id: 1, name: '第一班' },
  486. { id: 2, name: '第二班' }
  487. ]
  488. } else if (response.data.list[0].inforvalue == 3) {
  489. this.frequencyList = [
  490. { id: 1, name: '第一班' },
  491. { id: 2, name: '第二班' },
  492. { id: 3, name: '第三班' }
  493. ]
  494. } else if (response.data.list[0].inforvalue == 4) {
  495. this.frequencyList = [
  496. { id: 1, name: '第一班' },
  497. { id: 2, name: '第二班' },
  498. { id: 3, name: '第三班' },
  499. { id: 4, name: '第四班' }
  500. ]
  501. }
  502. })
  503. },
  504. getList() {
  505. this.table.listLoading = true
  506. const url = 'authdata/spillage'
  507. const data = this.table.getdataListParm
  508. postJson(url, data).then(response => {
  509. if (response.data.list !== undefined) {
  510. if (response.data.list !== null) {
  511. console.log('table数据', response.data.list)
  512. for (let i = 0; i < response.data.list.length; i++) {
  513. if (response.data.list[i].arrList == null) {
  514. this.$set(response.data.list[i], 'arrList', [])
  515. }
  516. }
  517. this.table.list = response.data.list
  518. this.table.total = response.data.list.length
  519. setTimeout(() => {
  520. this.$refs.table.doLayout()
  521. }, 100)
  522. } else {
  523. this.table.list = []
  524. }
  525. }
  526. this.table.listLoading = false
  527. })
  528. },
  529. changeFrequency(val) {
  530. console.log('选择了班次', val)
  531. this.getList()
  532. },
  533. // 行内删除
  534. handleRowDelete(row) {
  535. console.log(row, '点击了行删除')
  536. if (row.arrList.length == 0) {
  537. MessageBox.confirm('是否确认删除此信息?', {
  538. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  539. }).then(() => {
  540. this.selectList = []
  541. this.requestParam = {}
  542. this.requestParam.name = 'deleteLpp'
  543. this.requestParam.parammaps = {}
  544. this.requestParam.parammaps.pastureid = row.pastureid
  545. this.requestParam.parammaps.id = row.id
  546. const url = 'authdata/PostDataByName'
  547. const data = this.requestParam
  548. postJson(url, data).then(response => {
  549. if (response.msg === 'fail') {
  550. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  551. } else {
  552. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  553. this.table.getdataListParm.parammaps.refresh = 1
  554. this.getList()
  555. }
  556. })
  557. }).catch(() => {
  558. this.$message({ type: 'info', message: '已取消删除' })
  559. })
  560. } else {
  561. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  562. return false
  563. }
  564. },
  565. handleSelect(val) {
  566. console.log('勾选数据', val)
  567. this.selectList = val
  568. },
  569. changeTemplateFormulation(item) {
  570. this.create.temp.ftname = this.templateFormulationList.find(obj => obj.id === item).tname
  571. this.getCreateList1()
  572. },
  573. changeTimes(item) {
  574. this.getCreateList1()
  575. },
  576. // TMR编号
  577. changeTMRNumber(item) {
  578. if (this.create.list2.length > 0) {
  579. MessageBox.confirm('更换TMR撒料设备,会清空撒料车,是否更换?', {
  580. confirmButtonText: '是', cancelButtonText: '否', type: 'warning'
  581. }).then(() => {
  582. this.create.temp.tmrid = this.create.temp.tmrid2
  583. this.create.temp.tmrname = this.equipmentList.find(obj => obj.id === item).eqcode
  584. this.create.temp.maxweight = this.equipmentList.find(obj => obj.id === item).maxstirfeed
  585. console.log('tmrname==>', this.create.temp)
  586. if (this.isDispaly || this.create.dialogStatus == 'update') {
  587. this.getClearList()
  588. }
  589. }).catch(() => {
  590. this.create.temp.tmrid2 = this.create.temp.tmrid
  591. this.create.temp.tmrname = this.equipmentList.find(obj => obj.id === this.create.temp.tmrid2).eqcode
  592. this.create.temp.maxweight = this.equipmentList.find(obj => obj.id === this.create.temp.tmrid2).maxstirfeed
  593. console.log(this.create.temp)
  594. this.$message({ type: 'info', message: '已取消' })
  595. })
  596. } else {
  597. this.create.temp.tmrid = this.create.temp.tmrid2
  598. this.create.temp.tmrname = this.equipmentList.find(obj => obj.id === item).eqcode
  599. this.create.temp.maxweight = this.equipmentList.find(obj => obj.id === item).maxstirfeed
  600. console.log('TMR编号item==>', item)
  601. console.log('tmrname==>', this.create.temp)
  602. }
  603. },
  604. getClearList() {
  605. const url = 'authdata/lpplandtl/del'
  606. const data = []
  607. this.create.list2.forEach((item, i) => {
  608. const obj = {}
  609. obj.pastureid = item.pastureid
  610. obj.lpplandtlid = item.id
  611. obj.fttype = item.fttype
  612. obj.lweight = item.lweight
  613. obj.fpdid = item.fpdid
  614. data.push(obj)
  615. })
  616. postJson(url, data).then(response => {
  617. if (response.msg === 'fail') {
  618. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  619. } else {
  620. this.$notify({ title: '', message: '成功', type: 'success', duration: 2000 })
  621. this.getCreateList1()
  622. }
  623. })
  624. },
  625. colorRgb(sColor) {
  626. sColor = sColor.toLowerCase()
  627. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
  628. // 如果是16进制颜色
  629. if (sColor && reg.test(sColor)) {
  630. if (sColor.length === 4) {
  631. var sColorNew = '#'
  632. for (var i = 1; i < 4; i += 1) {
  633. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
  634. }
  635. sColor = sColorNew
  636. }
  637. // 处理六位的颜色值
  638. var sColorChange = []
  639. for (var i = 1; i < 7; i += 2) {
  640. sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2)))
  641. }
  642. return sColorChange.join(',')
  643. }
  644. return 'rgba(' + sColorChange.join(',') + ')'
  645. },
  646. dbclickWeight(item) {
  647. console.log('item==>', item)
  648. console.log('isRoleEdit==>', this.isRoleEdit)
  649. this.$set(item, 'isWeight', true)
  650. this.$set(item, 'focusState', true)
  651. },
  652. blurWeight(item) {
  653. if (parseFloat(item.weight) <= 0) {
  654. this.$message({ type: 'error', message: '重量不可输入小于0的数据', duration: 2000 })
  655. return false
  656. }
  657. if (item.weight == '') {
  658. item.weight = 0
  659. }
  660. const lweight = String(parseFloat(item.weight) - parseFloat(item.lweight))
  661. let sum = 0
  662. this.create.list2.forEach((item, i) => {
  663. console.log('item==>', item)
  664. sum += parseFloat(item.weight)
  665. })
  666. if (sum > this.create.temp.maxweight) {
  667. this.$message({ type: 'error', message: '撒料车总重量大于最大重量', duration: 2000 })
  668. return false
  669. }
  670. this.requestParam = {}
  671. this.requestParam.common = { 'returnmap': '0' }
  672. this.requestParam.data = []
  673. this.requestParam.data[0] = {
  674. 'name': 'checkFPdLeftW', 'type': 'v',
  675. 'parammaps': {
  676. pastureid: item.pastureid, fpdid: item.fpdid, fttype: item.fttype,
  677. lweight: lweight
  678. }
  679. }
  680. this.requestParam.data[1] = {
  681. 'name': 'updateLppd', 'type': 'e',
  682. 'parammaps': {
  683. pastureid: this.create.temp.pastureid, lppid: this.create.temp.id, barid: item.barid,
  684. barname: item.barname, fpdid: item.fpdid, fttype: item.fttype,
  685. lweight: item.weight, sort: item.sort, tmrid: item.tmrid,
  686. tmrname: item.tmrname, background: item.background, id: item.id
  687. }
  688. }
  689. this.requestParam.data[2] = {
  690. 'name': 'updateFpdetailUse', 'type': 'e',
  691. 'parammaps': {
  692. pastureid: item.pastureid, id: item.fpdid,
  693. fttype: item.fttype, lweight: lweight
  694. }
  695. }
  696. ExecDataByConfig(this.requestParam).then(response => {
  697. if (response.msg === 'fail') {
  698. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  699. } else {
  700. // this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  701. }
  702. this.getCreateList1()
  703. })
  704. },
  705. handleFLDelete(ele) {
  706. console.log(ele, '点击了撒料删除')
  707. this.requestParam = {}
  708. this.requestParam.common = { 'returnmap': '0' }
  709. this.requestParam.data = []
  710. this.requestParam.data[0] = {
  711. 'name': 'deleteLppd', 'type': 'e',
  712. 'parammaps': { pastureid: ele.pastureid, id: ele.id }
  713. }
  714. this.requestParam.data[1] = {
  715. 'name': 'updateFpdetailUse', 'type': 'e',
  716. 'parammaps': { pastureid: ele.pastureid, id: ele.fpdid, fttype: ele.fttype, lweight: '-' + parseFloat(ele.weight) }
  717. }
  718. const url = 'authdata/ExecDataByConfig'
  719. const data = this.requestParam
  720. postJson(url, data).then(response => {
  721. if (response.msg === 'fail') {
  722. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  723. } else {
  724. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  725. this.getCreateList1()
  726. }
  727. })
  728. },
  729. handleCreate() {
  730. console.log('新增车次')
  731. this.create.temp = { sel: 1, tmrid: '', tmrid2: '', maxweight: '', issplit: 1, begintime: '', sumweight: 0, display: '', times: 1, ftid: '', ftname: '', tmrname: '', maxweight: '' }
  732. this.getDownList()
  733. this.isDispaly = false
  734. this.dialogFull = false
  735. this.create.dialogStatus = 'create'
  736. this.create.dialogFormVisible = true
  737. this.create.list1 = []
  738. this.create.list2 = []
  739. this.create.checkBarList = []
  740. },
  741. distributionAndSpreading() {
  742. console.log('点击了分配撒料')
  743. this.$refs['temp'].validate(valid => {
  744. if (valid) {
  745. this.isokDisable = true
  746. setTimeout(() => {
  747. this.isokDisable = false
  748. }, 1000)
  749. const url = 'authdata/lpplan/add'
  750. const data = {}
  751. this.create.temp.pastureid = Cookies.get('pastureid')
  752. this.create.temp.times = parseInt(this.create.temp.times)
  753. data.parammaps = this.create.temp
  754. postJson(url, data).then(response => {
  755. console.log('新增保存发送参数', this.requestParam)
  756. if (response.msg !== 'fail') {
  757. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  758. this.create.temp.id = response.data.Id
  759. this.isDispaly = true
  760. } else {
  761. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  762. }
  763. })
  764. this.getCreateList1()
  765. }
  766. })
  767. },
  768. getCreateList1() {
  769. this.create.listLoadingTimes = true
  770. const url = 'authdata/spillage'
  771. const data = {
  772. page: 1,
  773. offset: 1,
  774. pagecount: 0,
  775. returntype: 'Map',
  776. parammaps: {
  777. pastureid: Cookies.get('pastureid'),
  778. times: this.create.temp.times,
  779. refresh: 2,
  780. ftid: this.create.temp.ftid
  781. }
  782. }
  783. postJson(url, data).then(response => {
  784. if (response.data.ftlist !== null) {
  785. for (let i = 0; i < response.data.ftlist.length; i++) {
  786. this.$set(response.data.ftlist[i], 'isShowTitle', true)
  787. if (response.data.ftlist[i].arrList == null) {
  788. this.$set(response.data.ftlist[i], 'isShowTitle', false)
  789. } else {
  790. for (let j = 0; j < response.data.ftlist[i].arrList.length; j++) {
  791. this.$set(response.data.ftlist[i].arrList[j], 'background2', this.colorRgb(response.data.ftlist[i].arrList[j].background))
  792. }
  793. }
  794. }
  795. this.create.list1 = response.data.ftlist
  796. } else {
  797. this.create.list1 = []
  798. }
  799. this.create.listLoadingTimes = false
  800. })
  801. this.getCreateList2()
  802. },
  803. getCreateList2() {
  804. const url = 'authdata/lpplandtl'
  805. const data = {}
  806. data.parammaps = {}
  807. data.parammaps.pastureid = Cookies.get('pastureid'),
  808. data.parammaps.id = this.create.temp.id
  809. postJson(url, data).then(response => {
  810. if (response.data !== null) {
  811. this.create.list2 = response.data
  812. this.create.temp.sort = response.data.length + 1
  813. var sumweight = 0
  814. for (let i = 0; i < this.create.list2.length; i++) {
  815. sumweight += parseFloat(this.create.list2[i].weight)
  816. this.$set(this.create.list2[i], 'isWeight', false)
  817. this.$set(this.create.list2[i], 'focusState', false)
  818. }
  819. console.log('sumweight==>', sumweight)
  820. this.create.temp.sumweight = (sumweight).toFixed(2)
  821. } else {
  822. this.create.list2 = []
  823. this.create.temp.sort = 0
  824. this.create.temp.sumweight = 0
  825. }
  826. })
  827. },
  828. clickBar(item) {
  829. console.log('点击了栏舍item==>', item)
  830. this.create.temp.sumweight = parseFloat(this.create.temp.sumweight)
  831. console.log('this.create.temp.sumweight', this.create.temp.sumweight)
  832. var evt = this.create.temp
  833. if (parseFloat(evt.maxweight) - parseFloat(evt.sumweight) < parseFloat(item.weight)) {
  834. if (parseFloat(evt.sumweight) + parseFloat(item.weight) > parseFloat(evt.maxweight)) {
  835. this.$set(item, 'weight', (parseFloat(evt.maxweight) - parseFloat(evt.sumweight)).toFixed(2))
  836. }
  837. }
  838. if (parseFloat(evt.maxweight) == parseFloat(evt.sumweight) || parseFloat(evt.maxweight) < parseFloat(evt.sumweight)) {
  839. this.$message({ type: 'error', message: '计划配方已经是最大容量', duration: 2000 })
  840. this.getCreateList1()
  841. return
  842. }
  843. console.log('item.weight===>', item.weight)
  844. this.requestParam = {}
  845. this.requestParam.common = { 'returnmap': '0' }
  846. this.requestParam.data = []
  847. this.requestParam.data[0] = { 'name': 'updateLpplandtlSorts', 'type': 'e',
  848. 'parammaps': { pastureid: evt.pastureid, sort: evt.sort, lppid: evt.id }
  849. }
  850. this.requestParam.data[1] = { 'name': 'insertLppd', 'type': 'e',
  851. 'parammaps': {
  852. pastureid: evt.pastureid, lppid: evt.id, barid: item.barid, barname: item.barname, fpdid: item.id, fttype: item.fttype,
  853. lweight: item.weight, sort: evt.sort, tmrid: evt.tmrid, tmrname: evt.tmrname,
  854. background: item.background, ccountradio: item.ccountradio, cowcount: item.cowcount
  855. }
  856. }
  857. this.requestParam.data[2] = { 'name': 'updateFpdetailUse', 'type': 'e',
  858. 'parammaps': { pastureid: item.pastureid, id: item.id, fttype: item.fttype, lweight: item.weight }
  859. }
  860. const url = 'authdata/ExecDataByConfig'
  861. const data = this.requestParam
  862. postJson(url, data).then(response => {
  863. if (response.msg === 'fail') {
  864. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  865. } else {
  866. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  867. }
  868. this.getCreateList1()
  869. })
  870. },
  871. handleUpdate(row) {
  872. this.getDownList()
  873. this.dialogFull = false
  874. this.create.dialogStatus = 'update'
  875. this.create.dialogFormVisible = true
  876. row.tmrid2 = row.tmrid
  877. this.create.temp = Object.assign({}, row)
  878. this.create.checkBarList = []
  879. this.getCreateList1()
  880. },
  881. updateData() {
  882. this.$refs['temp'].validate(valid => {
  883. if (valid) {
  884. this.isokDisable = true
  885. setTimeout(() => {
  886. this.isokDisable = false
  887. }, 1000)
  888. const url = 'authdata/lpplan/edit'
  889. const data = {}
  890. this.create.temp.pastureid = Cookies.get('pastureid')
  891. this.create.temp.times = parseInt(this.create.temp.times)
  892. data.parammaps = this.create.temp
  893. postJson(url, data).then(response => {
  894. console.log('新增保存发送参数', this.requestParam)
  895. if (response.msg !== 'fail') {
  896. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  897. this.isDispaly = false
  898. this.dialogFull = false
  899. this.create.dialogFormVisible = false
  900. this.getList()
  901. } else {
  902. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  903. }
  904. })
  905. }
  906. })
  907. },
  908. close() {
  909. if (this.create.dialogStatus == 'create') {
  910. console.log('新增关闭')
  911. this.isokDisable = true
  912. setTimeout(() => {
  913. this.isokDisable = false
  914. }, 1000)
  915. const url = 'authdata/lpplandtl/restore'
  916. const data = {}
  917. data.old = []
  918. data.new = this.create.list2
  919. postJson(url, data).then(response => {
  920. console.log('新增保存发送参数', this.requestParam)
  921. if (response.msg !== 'fail') {
  922. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  923. this.isDispaly = false
  924. this.dialogFull = false
  925. this.create.dialogFormVisible = false
  926. this.getList()
  927. } else {
  928. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  929. }
  930. })
  931. } else {
  932. console.log('编辑关闭')
  933. this.isokDisable = true
  934. setTimeout(() => {
  935. this.isokDisable = false
  936. }, 1000)
  937. const url = 'authdata/lpplandtl/restore'
  938. const data = {}
  939. data.old = this.create.temp.arrList
  940. data.new = this.create.list2
  941. postJson(url, data).then(response => {
  942. console.log('新增保存发送参数', this.requestParam)
  943. if (response.msg !== 'fail') {
  944. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  945. this.isDispaly = false
  946. this.dialogFull = false
  947. this.create.dialogFormVisible = false
  948. this.getList()
  949. } else {
  950. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  951. }
  952. })
  953. }
  954. },
  955. // 减少车次
  956. handleReduceTrains() {
  957. if (this.selectList.length == 0) {
  958. this.$message({ type: 'error', message: '请选择车次', duration: 2000 })
  959. return false
  960. } else {
  961. // 减少对应车次
  962. for (let i = 0; i < this.selectList.length; i++) {
  963. if (this.selectList[i].arrList.length > 0) {
  964. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  965. return false
  966. }
  967. }
  968. MessageBox.confirm('是否确认删除此信息?', {
  969. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  970. }).then(() => {
  971. console.log(this.selectList)
  972. this.requestParam = {}
  973. this.requestParam.common = { 'returnmap': '0' }
  974. this.requestParam.data = []
  975. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  976. this.requestParam.data[0].children = []
  977. this.requestParam.data[0].children[0] = {
  978. 'name': 'deleteLpp', 'type': 'e', 'parammaps': { id: '@insertSpotList.id', pastureid: '@insertSpotList.pastureid' }
  979. }
  980. ExecDataByConfig(this.requestParam).then(response => {
  981. console.log('删除保存发送参数', this.requestParam)
  982. if (response.msg === 'fail') {
  983. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  984. } else {
  985. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  986. this.table.getdataListParm.parammaps.refresh = 1
  987. this.getList()
  988. }
  989. })
  990. })
  991. }
  992. },
  993. // 自动生成
  994. handleAutomaticGeneration() {
  995. this.dialogFull = false
  996. this.automaticGeneration.dialogStatus = 'automaticGeneration'
  997. this.automaticGeneration.dialogFormVisible = true
  998. },
  999. continueData(item) {
  1000. if (item == 0) {
  1001. console.log('点击继续生成')
  1002. this.requestParam = {}
  1003. this.requestParam.pastureid = Cookies.get('pastureid')
  1004. this.requestParam.type = 0
  1005. const url = 'authdata/Autogeneration'
  1006. const data = this.requestParam
  1007. postJson(url, data).then(response => {
  1008. console.log('新增保存发送参数', this.requestParam)
  1009. if (response.msg !== 'fail') {
  1010. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1011. this.automaticGeneration.dialogFormVisible = false
  1012. this.getIsDisplay()
  1013. } else {
  1014. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1015. }
  1016. })
  1017. } else {
  1018. console.log('点击重新生成')
  1019. MessageBox.confirm('重新生成计划会将原有计划清空再生成,是否确认重新生成?', {
  1020. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1021. }).then(() => {
  1022. this.automaticGeneration.dialogFormVisible = false
  1023. this.requestParam = {}
  1024. this.requestParam.pastureid = Cookies.get('pastureid')
  1025. this.requestParam.type = 1
  1026. const url = 'authdata/Autogeneration'
  1027. const data = this.requestParam
  1028. postJson(url, data).then(response => {
  1029. console.log('新增保存发送参数', this.requestParam)
  1030. if (response.msg !== 'fail') {
  1031. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1032. this.automaticGeneration.dialogFormVisible = false
  1033. this.getIsDisplay()
  1034. } else {
  1035. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1036. }
  1037. })
  1038. }).catch(() => {
  1039. this.$message({ type: 'info', message: '已取消重新生成' })
  1040. })
  1041. }
  1042. },
  1043. handleChangeOrder() {
  1044. console.log('更改顺序')
  1045. this.isOrder = false
  1046. this.rowDrop()
  1047. },
  1048. // 行拖拽
  1049. rowDrop() {
  1050. console.log(document.querySelector('#table .el-table__body-wrapper tbody'))
  1051. const tbody = document.querySelector('#table .el-table__body-wrapper tbody')
  1052. const that = this
  1053. var sortable = Sortable.create(tbody, {
  1054. disabled: that.dropState,
  1055. onChoose({ newIndex, oldIndex }) {
  1056. console.log(that.isOrder, 'that.isOrder == false')
  1057. console.log(that.dropState, 'that.dropState')
  1058. if (that.dropState == true || that.isOrder == true) {
  1059. sortable.destroy()
  1060. }
  1061. },
  1062. onEnd({ newIndex, oldIndex }) {
  1063. const currRow = that.table.list.splice(oldIndex, 1)[0]
  1064. that.table.list.splice(newIndex, 0, currRow)
  1065. console.log('索引', newIndex)
  1066. console.log('拖动数据', currRow)
  1067. console.log('上', that.table.list[newIndex - 1])
  1068. console.log('下', that.table.list[newIndex + 1])
  1069. }
  1070. })
  1071. },
  1072. saveChangeOrder() {
  1073. // 保存顺序
  1074. var sortArr = []
  1075. for (let i = 0; i < this.table.list.length; i++) {
  1076. var obj = {}
  1077. obj.sort = i + 1
  1078. obj.id = this.table.list[i].id
  1079. obj.pastureid = this.table.list[i].pastureid
  1080. sortArr.push(obj)
  1081. }
  1082. const url = 'authdata/trains'
  1083. const data = sortArr
  1084. postJson(url, data).then(response => {
  1085. if (response.msg === 'fail') {
  1086. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  1087. } else {
  1088. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  1089. this.table.getdataListParm.parammaps.refresh = 1
  1090. this.getList()
  1091. this.isOrder = true
  1092. }
  1093. })
  1094. },
  1095. cancelChangeOrder() {
  1096. console.log('取消顺序')
  1097. this.table.getdataListParm.parammaps.refresh = 1
  1098. this.getList()
  1099. this.isOrder = true
  1100. },
  1101. handleTakeEffect() {
  1102. if (this.selectList.length == 0) {
  1103. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1104. } else {
  1105. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  1106. confirmButtonText: '确认',
  1107. cancelButtonText: '取消',
  1108. type: 'warning'
  1109. }).then(() => {
  1110. for (let i = 0; i < this.selectList.length; i++) {
  1111. this.selectList[i].sel = 1
  1112. }
  1113. console.log('生效', this.selectList)
  1114. this.requestParam.common = { 'returnmap': '0' }
  1115. this.requestParam.data = []
  1116. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1117. this.requestParam.data[0].children = []
  1118. this.requestParam.data[0].children[0] = {
  1119. 'name': 'updatelpplanEnable', 'type': 'e', 'parammaps': { sel: '@insertSpotList.sel', id: '@insertSpotList.id', pastureid: '@insertSpotList.pastureid' }
  1120. }
  1121. ExecDataByConfig(this.requestParam).then(response => {
  1122. console.log('生效保存发送参数', this.requestParam)
  1123. if (response.msg === 'fail') {
  1124. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  1125. } else {
  1126. this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
  1127. this.table.getdataListParm.parammaps.refresh = 1
  1128. this.getList()
  1129. }
  1130. })
  1131. })
  1132. }
  1133. },
  1134. handleDisable() {
  1135. if (this.selectList.length == 0) {
  1136. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1137. } else {
  1138. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  1139. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1140. }).then(() => {
  1141. for (let i = 0; i < this.selectList.length; i++) {
  1142. this.selectList[i].sel = 0
  1143. }
  1144. console.log('禁用', this.selectList)
  1145. this.requestParam.common = { 'returnmap': '0' }
  1146. this.requestParam.data = []
  1147. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1148. this.requestParam.data[0].children = []
  1149. this.requestParam.data[0].children[0] = {
  1150. 'name': 'updatelpplanEnable',
  1151. 'type': 'e',
  1152. 'parammaps': { sel: '@insertSpotList.sel', id: '@insertSpotList.id', pastureid: '@insertSpotList.pastureid' }
  1153. }
  1154. ExecDataByConfig(this.requestParam).then(response => {
  1155. console.log('禁用保存发送参数', this.requestParam)
  1156. if (response.msg === 'fail') {
  1157. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  1158. } else {
  1159. this.$notify({ title: '禁用成功', message: '禁用成功', type: 'success', duration: 2000 })
  1160. this.table.getdataListParm.parammaps.refresh = 1
  1161. this.getList()
  1162. }
  1163. })
  1164. })
  1165. }
  1166. },
  1167. // 历史记录
  1168. handleHistoryRecord() {
  1169. console.log('点击历史记录')
  1170. this.dialogFull = false
  1171. this.historyRecord.dialogStatus = 'historyRecord'
  1172. this.historyRecord.dialogFormVisible = true
  1173. const vue = this
  1174. var myComponent = () => import('./historyRecord.vue')
  1175. return vue.historyRecord.myComponent = myComponent
  1176. }
  1177. }
  1178. }
  1179. </script>
  1180. <style lang="scss" scoped>
  1181. .list{width: 60px;display: inline-block;margin: 5px 5px;text-align: center;
  1182. .tmrname{
  1183. width:100%;padding: 5px 5px;overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  1184. }
  1185. }
  1186. .fenceHouse {
  1187. height: 130px;
  1188. background: #fff;
  1189. position: relative;
  1190. ::-webkit-scrollbar {
  1191. width: 7px;
  1192. height: 7px;
  1193. background-color: #F5F5F5;
  1194. }
  1195. ::-webkit-scrollbar-track {
  1196. box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1197. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1198. border-radius: 10px;
  1199. background-color: #F5F5F5;
  1200. }
  1201. ::-webkit-scrollbar-thumb {
  1202. border-radius: 10px;
  1203. box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1204. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1205. background-color: #c8c8c8;
  1206. }
  1207. .fenceHouseList {
  1208. position: absolute;
  1209. width: 100%;
  1210. margin: 0 0;
  1211. height: 130px;
  1212. list-style: none;
  1213. padding: 0 0;
  1214. overflow: auto;
  1215. font-size: 12px;
  1216. .fenceHouseTitle {
  1217. float: left;
  1218. width: 105px;
  1219. white-space: nowrap;
  1220. overflow: hidden;
  1221. text-overflow: ellipsis;
  1222. margin: 5px 5px;
  1223. border-radius: 7px;
  1224. text-align: center;
  1225. color: #000;
  1226. height: 36px;
  1227. line-height: 36px;
  1228. }
  1229. li {
  1230. text-align: center;
  1231. color: #fff;
  1232. .barname {
  1233. display: block;
  1234. width: 100%;
  1235. overflow: hidden;
  1236. text-overflow: ellipsis;
  1237. white-space: nowrap;
  1238. }
  1239. .barWeight{
  1240. display: block;
  1241. line-height: 18px;
  1242. height: 18px;
  1243. color: #000;
  1244. width: 100%;
  1245. margin: 0 auto;
  1246. }
  1247. .colorBlock{
  1248. width: 88px;float: left;margin:5px 5px;height: 36px;
  1249. }
  1250. }
  1251. }
  1252. }
  1253. </style>
  1254. <style lang="scss" >
  1255. .spreadingMaterial {
  1256. height: 200px;
  1257. ::-webkit-scrollbar {
  1258. width: 7px;
  1259. height: 7px;
  1260. background-color: #F5F5F5;
  1261. }
  1262. ::-webkit-scrollbar-track {
  1263. box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1264. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  1265. border-radius: 10px;
  1266. background-color: #F5F5F5;
  1267. }
  1268. ::-webkit-scrollbar-thumb {
  1269. border-radius: 10px;
  1270. box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1271. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1);
  1272. background-color: #c8c8c8;
  1273. }
  1274. .spreadingMaterialList{height: 100%;overflow: auto;}
  1275. .list-group-item2 {
  1276. width: 145px;
  1277. height: 50px;
  1278. overflow: hidden;
  1279. float: left;
  1280. margin: 5px 5px;
  1281. position: relative;
  1282. color: #fff;
  1283. .arr-t {
  1284. height: 50px;
  1285. border-radius: 5px 5px;
  1286. }
  1287. .arr-l {
  1288. float: left;
  1289. width: 60px;
  1290. height: 50px;
  1291. overflow: hidden;
  1292. border-radius: 5px 50% 50% 5px;
  1293. .arr-l-t {
  1294. position: relative;
  1295. .arr-l-t-t {
  1296. width: 0;
  1297. height: 0;
  1298. border-top: 26px solid #3479f2;
  1299. border-right: 26px solid transparent;
  1300. }
  1301. .arr-l-t-b {
  1302. position: absolute;
  1303. top: 4px;
  1304. left: 1px;
  1305. color: #fff;
  1306. width: 10px;
  1307. height: 10px;
  1308. .el-input--suffix {
  1309. opacity: 0;
  1310. .el-input__inner {
  1311. height: 10px;
  1312. }
  1313. }
  1314. }
  1315. }
  1316. .arr-l-b {
  1317. width: 45px;
  1318. position: absolute;
  1319. top: 15px;
  1320. left: 10px;
  1321. color: #fff !important;
  1322. font-size: 12px;
  1323. .tmrname {
  1324. width: 100%;
  1325. overflow: hidden;
  1326. text-overflow: ellipsis;
  1327. white-space: nowrap;
  1328. }
  1329. }
  1330. }
  1331. .arr-c {
  1332. position: absolute;
  1333. top: 0px;
  1334. left: 0;
  1335. }
  1336. .arr-r {
  1337. float: right;
  1338. width: 80px;
  1339. height: 50px;
  1340. overflow: hidden;
  1341. line-height: 50px;
  1342. .arr-r-l {
  1343. float: left;
  1344. width: 85px;
  1345. .barname {
  1346. width: 95%;
  1347. overflow: hidden;
  1348. text-overflow: ellipsis;
  1349. white-space: nowrap;
  1350. font-size: 14px;
  1351. text-align: center;
  1352. }
  1353. }
  1354. .arr-r-c {
  1355. float: left;
  1356. width: 10px;
  1357. }
  1358. .arr-r-r {
  1359. float: left;
  1360. width: 65px;
  1361. .weight {
  1362. width: 100%;
  1363. overflow: hidden;
  1364. text-overflow: ellipsis;
  1365. white-space: nowrap;
  1366. font-size: 14px;
  1367. }
  1368. }
  1369. }
  1370. }
  1371. }
  1372. </style>