0045bcd3bde8e1326df13148e2237c641195ef57.svn-base 58 KB

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