96fe65a53e559784f009202ce5b90294b40e3153.svn-base 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  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. for (let i = 0; i < this.table.list.length; i++) {
  507. if (this.table.list[i].Edit === true) {
  508. console.log(123)
  509. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  510. return false
  511. }
  512. }
  513. 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': [] })
  514. // this.$refs.box.scrollTop = 0
  515. this.$refs.table.bodyWrapper.scrollTop = 0
  516. this.dropState = true
  517. },
  518. createData(row) {
  519. console.log('点击了新增保存', row)
  520. this.table.temp.pastureid = Cookies.get('pastureid')
  521. this.table.temp.tmrname = row.tmrname
  522. this.table.temp.tmrid = row.tmrid
  523. this.table.temp.sort = row.sort
  524. this.table.temp.sel = row.sel
  525. this.table.temp.times = row.times
  526. this.table.temp.display = row.display
  527. this.table.temp.begintime = row.begintime
  528. this.table.temp.ftname = row.ftname
  529. this.table.temp.ftid = row.ftid
  530. this.table.temp.sumweight = 0
  531. this.table.temp.maxweight = row.maxweight
  532. if (this.table.temp.sort == '' && this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {
  533. this.$message({ type: 'error', message: '车次/TMR编号/班次/模板配方不能为空', duration: 2000 })
  534. return false
  535. } else if (this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {
  536. this.$message({ type: 'error', message: 'TMR编号/班次/模板配方不能为空', duration: 2000 })
  537. return false
  538. } else if (this.table.temp.times == '' && this.table.temp.ftid == '') {
  539. this.$message({ type: 'error', message: '班次/模板配方不能为空', duration: 2000 })
  540. return false
  541. } else if (this.table.temp.ftid == '') {
  542. this.$message({ type: 'error', message: '模板配方不能为空', duration: 2000 })
  543. return false
  544. } else if (this.table.temp.times == '') {
  545. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  546. return false
  547. }
  548. for (let i = 0; i < this.table.list.length; i++) {
  549. if (row.sort == this.table.list[i].sort) {
  550. if (row.myId !== this.table.list[i].myId) {
  551. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  552. return false
  553. }
  554. }
  555. }
  556. var isInteger = /^\d+$/
  557. if (this.table.temp.sort !== '') {
  558. if (!isInteger.test(parseFloat(this.table.temp.sort))) {
  559. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  560. return false
  561. }
  562. }
  563. this.isokDisable = true
  564. setTimeout(() => {
  565. this.isokDisable = false
  566. }, 1000)
  567. this.requestParam = {}
  568. this.requestParam.name = 'insertLpp'
  569. this.requestParam.parammaps = this.table.temp
  570. PostDataByName(this.requestParam).then(response => {
  571. console.log('新增保存发送参数', this.requestParam)
  572. if (response.msg !== 'fail') {
  573. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  574. this.getList()
  575. this.dropState = false
  576. } else {
  577. failproccess(response, this.$notify)
  578. }
  579. })
  580. },
  581. createCancel(row) {
  582. console.log('点击了新增取消')
  583. this.dropState = false
  584. for (let i = 0; i < this.table.list.length; i++) {
  585. if (row.myId === this.table.list[i].myId) {
  586. var listIndex = this.table.list.indexOf(this.table.list[i])
  587. }
  588. if (listIndex > -1) {
  589. this.table.list.splice(listIndex, 1)
  590. return
  591. }
  592. }
  593. },
  594. // 编辑
  595. handleUpdate(row) {
  596. console.log(row, '点击了行编辑')
  597. for (let i = 0; i < this.table.list.length; i++) {
  598. if (this.table.list[i].Edit == true) {
  599. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  600. return false
  601. }
  602. }
  603. // 编辑true,不可编辑false
  604. row.Edit = true
  605. row.NoEdit = false
  606. // 新增false,编辑false,编辑保存true
  607. row.isCreate = false
  608. row.isUpdate = false
  609. row.isUpdateSave = true
  610. row.times = String(row.times)
  611. if (row.sort == undefined) { row.sort = '' }
  612. if (row.tmrid == undefined || row.tmrname == undefined) {
  613. row.tmrid = ''
  614. row.tmrname = ''
  615. }
  616. if (row.display == undefined) { row.display = '' }
  617. if (row.times == undefined) { row.times = '' }
  618. if (row.begintime == undefined) { row.begintime = '' }
  619. if (row.ftid == undefined || row.ftname == undefined) {
  620. row.ftid = ''
  621. row.ftname = ''
  622. }
  623. this.dropState = true
  624. },
  625. updateData(row) {
  626. console.log('点击了编辑保存', row)
  627. this.table.temp.pastureid = row.pastureid
  628. this.table.temp.id = row.id
  629. this.table.temp.tmrname = row.tmrname
  630. this.table.temp.tmrid = row.tmrid
  631. this.table.temp.sort = row.sort
  632. this.table.temp.sel = row.sel
  633. this.table.temp.times = row.times
  634. this.table.temp.display = row.display
  635. this.table.temp.begintime = row.begintime
  636. this.table.temp.ftname = row.ftname
  637. this.table.temp.ftid = row.ftid
  638. this.table.temp.sumweight = row.sumweight
  639. this.table.temp.sumcowcount = row.sumcowcount
  640. this.table.temp.maxweight = row.maxweight
  641. if (this.table.temp.sort == '' && this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {
  642. this.$message({ type: 'error', message: '车次/TMR编号/班次/模板配方不能为空', duration: 2000 })
  643. return false
  644. } else if (this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {
  645. this.$message({ type: 'error', message: 'TMR编号/班次/模板配方不能为空', duration: 2000 })
  646. return false
  647. } else if (this.table.temp.times == '' && this.table.temp.ftid == '') {
  648. this.$message({ type: 'error', message: '班次/模板配方不能为空', duration: 2000 })
  649. return false
  650. } else if (this.table.temp.ftid == '') {
  651. this.$message({ type: 'error', message: '模板配方不能为空', duration: 2000 })
  652. return false
  653. }
  654. for (let i = 0; i < this.table.list.length; i++) {
  655. if (row.sort == this.table.list[i].sort) {
  656. if (row.id !== this.table.list[i].id) {
  657. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  658. return false
  659. }
  660. }
  661. }
  662. var isInteger = /^\d+$/
  663. if (this.table.temp.sort !== '') {
  664. if (!isInteger.test(parseFloat(this.table.temp.sort))) {
  665. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  666. return false
  667. }
  668. }
  669. this.isokDisable = true
  670. setTimeout(() => {
  671. this.isokDisable = false
  672. }, 1000)
  673. this.requestParam = {}
  674. this.requestParam.name = 'updateLpp'
  675. this.requestParam.parammaps = this.table.temp
  676. PostDataByName(this.requestParam).then(response => {
  677. console.log('编辑保存发送参数', this.requestParam)
  678. if (response.msg !== 'fail') {
  679. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  680. this.getList()
  681. this.dropState = false
  682. } else {
  683. failproccess(response, this.$notify)
  684. }
  685. })
  686. },
  687. updateCancel(row) {
  688. console.log('点击了编辑取消')
  689. // 编辑false,不可编辑true
  690. row.Edit = false
  691. row.NoEdit = true
  692. // 新增false,编辑true,编辑保存false
  693. row.isCreate = false
  694. row.isUpdate = true
  695. row.isUpdateSave = false
  696. this.dropState = false
  697. },
  698. // 自动生成
  699. handleAutomaticGeneration() {
  700. this.automaticGeneration.dialogStatus = 'automaticGeneration'
  701. this.automaticGeneration.dialogFormVisible = true
  702. },
  703. continueData(item) {
  704. if (item == 0) {
  705. console.log('点击继续生成')
  706. this.requestParam = {}
  707. this.requestParam.common = { 'returnmap': '0' }
  708. this.requestParam.data = []
  709. this.requestParam.data[0] = { 'name': 'autoCreateLPP', 'type': 'e', 'parammaps': {
  710. 'pastureid': Cookies.get('pastureid'),
  711. 'type': 0
  712. }}
  713. ExecDataByConfig(this.requestParam).then(response => {
  714. console.log('保存发送参数', this.requestParam)
  715. if (response.msg === 'fail') {
  716. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  717. } else {
  718. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  719. this.automaticGeneration.dialogFormVisible = false
  720. this.getList()
  721. }
  722. })
  723. } else {
  724. console.log('点击重新生成')
  725. this.requestParam = {}
  726. this.requestParam.common = { 'returnmap': '0' }
  727. this.requestParam.data = []
  728. this.requestParam.data[0] = { 'name': 'autoCreateLPP', 'type': 'e', 'parammaps': {
  729. 'pastureid': Cookies.get('pastureid'),
  730. 'type': 1
  731. }}
  732. ExecDataByConfig(this.requestParam).then(response => {
  733. console.log('保存发送参数', this.requestParam)
  734. if (response.msg === 'fail') {
  735. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  736. } else {
  737. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  738. this.automaticGeneration.dialogFormVisible = false
  739. this.getList()
  740. }
  741. })
  742. }
  743. },
  744. // 检验
  745. handleCheck() {
  746. console.log('点击检验')
  747. },
  748. // 历史记录
  749. handleHistoryRecord() {
  750. console.log('点击历史记录')
  751. },
  752. // 配方
  753. changeLog: function(evt) {
  754. console.log('change1', evt)
  755. },
  756. start(evt) {
  757. console.log('start1', evt)
  758. this.$set(this.table.startObj, 'from', evt.from.className)
  759. this.$set(this.table.startObj, 'to', evt.from.className)
  760. },
  761. end(evt) {
  762. console.log('end1', evt)
  763. },
  764. move(evt, originalEvent) {
  765. if (originalEvent.target.className === 'list-group-item1 item' || originalEvent.target.className === 'draggableWeight') {
  766. return false
  767. }
  768. console.log(evt)
  769. this.table.move1 = evt.draggedContext.element
  770. },
  771. start2(evt) {
  772. console.log('start2', evt)
  773. this.$set(this.table.startObj, 'from', evt.from.className)
  774. this.$set(this.table.startObj, 'to', evt.from.className)
  775. },
  776. move2(evt, originalEvent) {
  777. // console.log(evt, originalEvent)
  778. if (originalEvent.target.className === 'list-group-item1 item' || originalEvent.target.className === 'draggableWeight') {
  779. return false
  780. }
  781. this.table.move1 = evt.draggedContext.element
  782. },
  783. end2(evt) {
  784. // console.log(evt)
  785. console.log('end2', evt)
  786. },
  787. // 撒料位
  788. changeLog2(evt) {
  789. // console.log(this.table.startObj)
  790. console.log(evt, 'evt-----')
  791. this.table.changeList.push(evt)
  792. evt = this.table.changeList[0]
  793. if (evt.arrList.length == 1) {
  794. evt.arrList[0].sort = 0
  795. } else if (evt.arrList.length > 1) {
  796. for (let i = 0; i < evt.arrList.length; i++) {
  797. if (evt.arrList[i].id == this.table.move1.id && evt.arrList[i].fttype == this.table.move1.fttype) {
  798. if (evt.arrList[i - 1] == undefined) {
  799. evt.arrList[i].sort = 0
  800. evt.sort = 0
  801. } else {
  802. evt.arrList[i].sort = parseFloat(evt.arrList[i - 1].sort) + 1
  803. evt.sort = parseFloat(evt.arrList[i - 1].sort) + 1
  804. }
  805. }
  806. }
  807. }
  808. console.log(evt.arrList)
  809. if (this.table.startObj.from == 'list-group1' && this.table.startObj.to == 'list-group1') {
  810. this.requestParam = {}
  811. this.requestParam.common = { 'returnmap': '0' }
  812. this.requestParam.data = []
  813. this.requestParam.data[0] = { 'name': 'checkLLPDetailInsert', 'type': 'v', 'parammaps': {
  814. pastureid: this.table.move1.pastureid,
  815. barid: this.table.move1.barid,
  816. lppid: evt.id,
  817. times: evt.times,
  818. ftid: this.table.move1.ftid,
  819. ptsid: this.table.move1.ptsid,
  820. ptid: this.table.move1.ptid,
  821. fttype: this.table.move1.fttype,
  822. timesTem: this.table.move1.times
  823. }}
  824. this.requestParam.data[1] = { 'name': 'updateLpplandtlSorts', 'type': 'e', 'parammaps': {
  825. pastureid: evt.pastureid,
  826. sort: evt.sort,
  827. lppid: evt.id
  828. }}
  829. this.requestParam.data[2] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {
  830. pastureid: evt.pastureid,
  831. lppid: evt.id,
  832. barid: this.table.move1.barid,
  833. barname: this.table.move1.barname,
  834. fpdid: this.table.move1.id,
  835. fttype: this.table.move1.fttype,
  836. lweight: this.table.move1.weight,
  837. sort: evt.sort,
  838. tmrid: evt.tmrid,
  839. tmrname: evt.tmrname,
  840. background: this.table.move1.background,
  841. ccountradio: this.table.move1.ccountradio,
  842. cowcount: this.table.move1.cowcount
  843. }}
  844. this.requestParam.data[3] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {
  845. pastureid: this.table.move1.pastureid,
  846. id: this.table.move1.id,
  847. fttype: this.table.move1.fttype,
  848. lweight: this.table.move1.weight
  849. }}
  850. console.log('撒料位上-下新增', this.requestParam)
  851. ExecDataByConfig(this.requestParam).then(response => {
  852. console.log('撒料位新增保存发送参数', this.requestParam)
  853. if (response.msg === 'fail') {
  854. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  855. this.getTimesList()
  856. this.getSmallMenuList()
  857. this.getList()
  858. } else {
  859. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  860. this.getList()
  861. this.getSmallMenuList()
  862. }
  863. })
  864. } else if (this.table.startObj.from == 'list-group2' && this.table.startObj.to == 'list-group2') {
  865. if (this.table.changeList.length == 1) {
  866. this.requestParam = {}
  867. this.requestParam.common = { 'returnmap': '0' }
  868. this.requestParam.data = []
  869. this.requestParam.data[0] = { 'name': 'checkLLPDetailInsert', 'type': 'v', 'parammaps': {
  870. pastureid: this.table.move1.pastureid,
  871. barid: this.table.move1.barid,
  872. lppid: evt.id,
  873. times: evt.times,
  874. ftid: this.table.move1.ftid,
  875. ptsid: this.table.move1.ptsid,
  876. ptid: this.table.move1.ptid,
  877. fttype: this.table.move1.fttype,
  878. timesTem: evt.times
  879. }}
  880. this.requestParam.data[1] = { 'name': 'updateLpplandtlSorts', 'type': 'e', 'parammaps': {
  881. pastureid: evt.pastureid,
  882. sort: evt.sort,
  883. lppid: evt.id
  884. }}
  885. this.requestParam.data[2] = { 'name': 'deleteLppd', 'type': 'e', 'parammaps': {
  886. pastureid: evt.pastureid,
  887. id: this.table.move1.id
  888. }}
  889. this.requestParam.data[3] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {
  890. pastureid: evt.pastureid,
  891. lppid: evt.id,
  892. barid: this.table.move1.barid,
  893. barname: this.table.move1.barname,
  894. fpdid: this.table.move1.fpdid,
  895. fttype: this.table.move1.fttype,
  896. lweight: this.table.move1.weight,
  897. sort: evt.sort,
  898. tmrid: evt.tmrid,
  899. tmrname: evt.tmrname,
  900. background: this.table.move1.background,
  901. ccountradio: this.table.move1.ccountradio,
  902. cowcount: this.table.move1.cowcount
  903. }}
  904. console.log('撒料位下-下新增', this.requestParam)
  905. ExecDataByConfig(this.requestParam).then(response => {
  906. console.log('撒料位新增保存发送参数', this.requestParam)
  907. if (response.msg === 'fail') {
  908. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  909. this.getTimesList()
  910. this.getSmallMenuList()
  911. this.getList()
  912. } else {
  913. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  914. this.getList()
  915. this.getSmallMenuList()
  916. }
  917. })
  918. } else if (this.table.changeList.length == 1) {
  919. if (this.table.isGoing == true) {
  920. console.log(11111)
  921. this.requestParam.common = { 'returnmap': '0' }
  922. this.requestParam.data = []
  923. this.requestParam.data[0] = { 'name': 'checkLLPDetailInsert', 'type': 'e', 'parammaps': {
  924. pastureid: evt.pastureid,
  925. sort: evt.sort,
  926. lppid: evt.id
  927. }}
  928. this.requestParam.data[1] = { 'name': 'deleteLppd', 'type': 'e', 'parammaps': {
  929. pastureid: evt.pastureid,
  930. id: this.table.move1.id
  931. }}
  932. this.requestParam.data[2] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {
  933. pastureid: evt.pastureid,
  934. lppid: evt.id,
  935. barid: this.table.move1.barid,
  936. barname: this.table.move1.barname,
  937. fpdid: this.table.move1.id,
  938. fttype: this.table.move1.fttype,
  939. lweight: this.table.move1.weight,
  940. sort: evt.sort,
  941. tmrid: evt.tmrid,
  942. tmrname: evt.tmrname,
  943. background: this.table.move1.background
  944. }}
  945. this.requestParam.data[3] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {
  946. pastureid: this.table.move1.pastureid,
  947. id: this.table.move1.id,
  948. fttype: this.table.move1.fttype,
  949. statue: 1
  950. }}
  951. console.log('撒料位新增', this.requestParam)
  952. ExecDataByConfig(this.requestParam).then(response => {
  953. console.log('撒料位新增保存发送参数', this.requestParam)
  954. if (response.msg === 'fail') {
  955. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  956. this.getTimesList()
  957. this.getList()
  958. } else {
  959. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  960. this.getList()
  961. }
  962. })
  963. this.table.isGoing = false
  964. } else {
  965. this.table.isGoing = true
  966. }
  967. }
  968. }
  969. },
  970. // 编辑-撒料设备
  971. changeEquipment(item, row, fttype, myid) {
  972. console.log(row)
  973. var objList = {}
  974. for (let i = 0; i < row.arrList.length; i++) {
  975. row.arrList[i].tmrname = this.equipmentList.find(obj => obj.id === item).tname
  976. if (row.arrList[i].fttype == fttype && row.arrList[i].id == myid) {
  977. objList = row.arrList[i]
  978. }
  979. }
  980. this.requestParam = {}
  981. this.requestParam.common = { 'returnmap': '0' }
  982. this.requestParam.data = []
  983. this.requestParam.data[0] = { 'name': 'updateLppd', 'type': 'e', 'parammaps': {
  984. pastureid: row.pastureid,
  985. lppid: row.id,
  986. barid: objList.barid,
  987. barname: objList.barname,
  988. fpdid: objList.fpdid,
  989. fttype: objList.fttype,
  990. lweight: objList.weight,
  991. sort: objList.sort,
  992. tmrid: objList.tmrid,
  993. tmrname: objList.tmrname,
  994. background: objList.background,
  995. id: objList.id
  996. }}
  997. ExecDataByConfig(this.requestParam).then(response => {
  998. console.log('编辑保存发送参数', this.requestParam)
  999. if (response.msg === 'fail') {
  1000. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1001. } else {
  1002. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1003. this.getList()
  1004. this.getTimesList()
  1005. }
  1006. })
  1007. },
  1008. // 编辑-重量
  1009. blurWeight(row, fttype, myid) {
  1010. var objList = {}
  1011. for (let i = 0; i < row.arrList.length; i++) {
  1012. if (row.arrList[i].fttype == fttype && row.arrList[i].id == myid) {
  1013. objList = row.arrList[i]
  1014. }
  1015. }
  1016. if (objList.weight == '') { objList.weight = 0 }
  1017. this.requestParam = {}
  1018. this.requestParam.common = { 'returnmap': '0' }
  1019. this.requestParam.data = []
  1020. this.requestParam.data[0] = { 'name': 'checkFPdLeftW', 'type': 'v', 'parammaps': {
  1021. pastureid: objList.pastureid,
  1022. fpdid: objList.fpdid,
  1023. fttype: objList.fttype,
  1024. lweight: String(parseFloat(objList.weight) - parseFloat(objList.lweight))
  1025. }}
  1026. this.requestParam.data[1] = { 'name': 'updateLppd', 'type': 'e', 'parammaps': {
  1027. pastureid: row.pastureid,
  1028. lppid: row.id,
  1029. barid: objList.barid,
  1030. barname: objList.barname,
  1031. fpdid: objList.fpdid,
  1032. fttype: objList.fttype,
  1033. lweight: objList.weight,
  1034. sort: objList.sort,
  1035. tmrid: objList.tmrid,
  1036. tmrname: objList.tmrname,
  1037. background: objList.background,
  1038. id: objList.id
  1039. }}
  1040. this.requestParam.data[2] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {
  1041. pastureid: objList.pastureid,
  1042. id: objList.fpdid,
  1043. fttype: objList.fttype,
  1044. lweight: String(parseFloat(objList.weight) - parseFloat(objList.lweight))
  1045. }}
  1046. ExecDataByConfig(this.requestParam).then(response => {
  1047. console.log('编辑保存发送参数', this.requestParam)
  1048. if (response.msg === 'fail') {
  1049. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1050. this.getList()
  1051. this.getTimesList()
  1052. } else {
  1053. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1054. this.getList()
  1055. this.getTimesList()
  1056. }
  1057. })
  1058. },
  1059. handleTakeEffectChange() {
  1060. console.log('点击了生效')
  1061. },
  1062. // 撒料位删除
  1063. handleFLDelete(ele, row) {
  1064. console.log(ele, row, '点击了撒料删除')
  1065. this.selectList = []
  1066. this.requestParam = {}
  1067. this.requestParam.common = { 'returnmap': '0' }
  1068. this.requestParam.data = []
  1069. this.requestParam.data[0] = { 'name': 'deleteLppd', 'type': 'e', 'parammaps': {
  1070. pastureid: ele.pastureid,
  1071. id: ele.id
  1072. }}
  1073. this.requestParam.data[1] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {
  1074. pastureid: ele.pastureid,
  1075. id: ele.fpdid,
  1076. fttype: ele.fttype,
  1077. lweight: '-' + parseFloat(ele.weight)
  1078. }}
  1079. ExecDataByConfig(this.requestParam).then(response => {
  1080. console.log('删除保存发送参数', this.requestParam)
  1081. if (response.msg === 'fail') {
  1082. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1083. } else {
  1084. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1085. this.getList()
  1086. this.getTimesList()
  1087. }
  1088. })
  1089. },
  1090. handleSelect(val) {
  1091. console.log('勾选数据', val)
  1092. this.selectList = val
  1093. },
  1094. // 减少车次
  1095. handleReduceTrains() {
  1096. if (this.selectList.length == 0) {
  1097. this.$message({ type: 'error', message: '请选择车次', duration: 2000 })
  1098. return false
  1099. } else {
  1100. // 减少对应车次
  1101. for (let i = 0; i < this.selectList.length; i++) {
  1102. if (this.selectList[i].arrList.length > 0) {
  1103. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  1104. return false
  1105. }
  1106. }
  1107. MessageBox.confirm('是否确认删除此信息?', {
  1108. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1109. }).then(() => {
  1110. console.log(this.selectList)
  1111. this.requestParam = {}
  1112. this.requestParam.common = { 'returnmap': '0' }
  1113. this.requestParam.data = []
  1114. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1115. this.requestParam.data[0].children = []
  1116. this.requestParam.data[0].children[0] = { 'name': 'deleteLpp', 'type': 'e', 'parammaps': {
  1117. id: '@insertSpotList.id',
  1118. pastureid: '@insertSpotList.pastureid'
  1119. }}
  1120. ExecDataByConfig(this.requestParam).then(response => {
  1121. console.log('删除保存发送参数', this.requestParam)
  1122. if (response.msg === 'fail') {
  1123. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1124. } else {
  1125. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1126. this.getList()
  1127. }
  1128. })
  1129. })
  1130. }
  1131. },
  1132. // 行内删除
  1133. handleRowDelete(row) {
  1134. console.log(row, '点击了行删除')
  1135. if (row.arrList.length == 0) {
  1136. MessageBox.confirm('是否确认删除此信息?', {
  1137. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1138. }).then(() => {
  1139. this.selectList = []
  1140. this.requestParam = {}
  1141. this.requestParam.name = 'deleteLpp'
  1142. this.requestParam.parammaps = {}
  1143. this.requestParam.parammaps.pastureid = row.pastureid
  1144. this.requestParam.parammaps.id = row.id
  1145. PostDataByName(this.requestParam).then(response => {
  1146. if (response.msg === 'fail') {
  1147. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1148. } else {
  1149. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1150. this.getList()
  1151. }
  1152. })
  1153. }).catch(() => {
  1154. this.$message({ type: 'info', message: '已取消删除' })
  1155. })
  1156. } else {
  1157. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  1158. return false
  1159. }
  1160. },
  1161. handleLeftButton() { // 向左
  1162. this.isLeftButton = false
  1163. this.isRightButton = true
  1164. this.$refs.listRight.style.zIndex = 4
  1165. this.getSmallMenuList()
  1166. },
  1167. handleRightButton() { // 向右
  1168. this.isLeftButton = true
  1169. this.isRightButton = false
  1170. this.$refs.listRight.style.zIndex = 1
  1171. }
  1172. }
  1173. }
  1174. </script>
  1175. <style lang="scss" scoped>
  1176. /deep/ .el-radio-button__orig-radio:checked+.el-radio-button__inner {
  1177. color: #fff;
  1178. background-color: #ccc;
  1179. border-color: #ccc;
  1180. -webkit-box-shadow: -1px 0 0 0 #ccc;
  1181. box-shadow: -1px 0 0 0 #ccc;
  1182. }
  1183. </style>
  1184. <style lang="scss" scoped>
  1185. .list{
  1186. position: fixed; height: 150px;z-index: 3;width: 85%;
  1187. .list-t{position: fixed;z-index: 1;height:39px;}
  1188. .draggableList{ width: 100%; height: 117px; list-style: none;margin-top:32px;padding-left:0;padding-right:0;overflow: auto;
  1189. .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;}
  1190. li{
  1191. margin: 3px 0;text-align: center;color:#fff;
  1192. .draggableName{display:block;font-size: 12px;width: 100%;padding-top: 5px;overflow: hidden; text-overflow:ellipsis; white-space: nowrap;}
  1193. .draggableWeight{display:block;font-size: 10px;background: #fff; color: #000; width: 50%; margin: 0 auto; border-radius: 3px;}
  1194. }
  1195. }
  1196. }
  1197. $width:46%;
  1198. $width2:calc(46% - 50px);
  1199. .list-r{
  1200. position: fixed; height: 150px;z-index: 1;width: $width;right: 0;
  1201. .rightButton{
  1202. height: 150px;position: fixed;
  1203. .left{font:40px/150px '';position: fixed;background: #fff;width: 50px;right: 0;}
  1204. span{width: 20px;font:500 16px/16px '';display: inline-block;position: fixed;right: 0;margin-top: 42px;}
  1205. .right{font:40px/150px '';background: #fff;width: 50px;right: $width;}
  1206. .smallTable{position: fixed; top: 95px; width: $width2; margin-left: 50px;}
  1207. }
  1208. }
  1209. .operation{margin-top: 150px;height: 50px;}
  1210. .table{clear:both;}
  1211. </style>
  1212. <style lang="scss">
  1213. // 下拉框
  1214. .filter-item2 .el-input--suffix .el-input__inner{
  1215. height: 30px !important;
  1216. font-size: 8px;
  1217. padding: 0 2px;
  1218. }
  1219. .filter-item2 .el-input--suffix .el-input__suffix .el-input__suffix-inner .el-input__icon{
  1220. line-height: 30px !important;
  1221. }
  1222. // 输入框
  1223. .filter-item2 .el-input__inner{
  1224. height: 30px !important;
  1225. font-size: 8px;
  1226. padding: 0 2px;
  1227. }
  1228. </style>