e3eb3e4cc40cd9daa8f9af1466a3ff48ade90425.svn-base 60 KB

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