e85052babaea068176137d4c5383e07d530283ed.svn-base 58 KB

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