38a5e36becc817b0b54eec86a02912992401696c.svn-base 54 KB

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