index - 副本.vue 80 KB

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