9f90eeba47cc94bc2e1d76a5b608c8854387b022.svn-base 57 KB

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