d2a4c62d336e34dde1c721a9d6c601f393847644.svn-base 59 KB

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