f056dea5134f1b0e82d1428d410495937d15288f.svn-base 55 KB

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