b2000ef036ab32556b13883719a4c2d3463ec8a0.svn-base 65 KB

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