bd42303e959832001d821b5d956220e0823cb02d.svn-base 54 KB

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