| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211 | <template>  <div class="app-container">    <div ref="list" class="list">      <div class="list-t">        <span>班次:</span>        <el-radio-group v-model="menuRadio" size="small" @change="changeMenu">          <el-radio-button v-if="maxTime.isTime1" label="一班">一班</el-radio-button>          <el-radio-button v-if="maxTime.isTime2" label="二班">二班</el-radio-button>          <el-radio-button v-if="maxTime.isTime3" label="三班">三班</el-radio-button>          <el-radio-button v-if="maxTime.isTime4" label="四班">四班</el-radio-button>        </el-radio-group>      </div>      <!-- 拖拽列表 -->      <ul class="draggableList">        <li v-for="element in MenuList" :key="element.arrid">          <span v-if="element.isShowTitle" class="draggableTitle">{{ element.ftname }}:</span>          <draggable id="1" data-source="juju1" :list="element.arrList" class="list-group1" draggable=".item" group="a" :move="move" @change="changeLog" @start="start" @end="end">            <div v-for="item in element.arrList" :key="item.id" :style="{'background':item.background}" class="list-group-item1 item" style="width: 80px;float: left;margin:5px 5px;height: 35px;border-radius: 7px;">              <el-tooltip placement="top" class="list-group-item1 item">                <div slot="content">{{ item.barname }}</div>                <div class="draggableName">{{ item.barname }}</div>              </el-tooltip>              <div class="draggableWeight">{{ item.weight }}</div>            </div>          </draggable>        </li>      </ul>    </div>    <div ref="listRight" class="list-r">      <div v-if="isLeftButton" class="rightButton" @click="handleLeftButton">        <i class="el-icon-arrow-left left" />        <span>栏舍统计</span>      </div>      <div v-if="isRightButton" class="rightButton" @click="handleRightButton">        <i class="el-icon-arrow-right right" />        <div class="smallTable">          <el-table            :list-loading="smallMenu.listLoading"            element-loading-text="给我一点时间"            :data="smallMenu.list"            :row-style="rowStyle2"            :cell-style="cellStyle2"            :header-row-style="headerRowStyle2"            :header-cell-style="headerCellStyle2"            :height="150"            show-summary            sum-text="总栏舍"          >            <el-table-column label="配方/班次" min-width="80px" align="center" prop="tname" />            <el-table-column label="总数" min-width="50px" align="center" prop="usedsum" />            <el-table-column v-if="maxTime.isTime1" label="第一班未分配" min-width="105px" align="center" prop="onetime" />            <el-table-column v-if="maxTime.isTime2" label="第二班未分配" min-width="105px" align="center" prop="twotime" />            <el-table-column v-if="maxTime.isTime3" label="第三班未分配" min-width="105px" align="center" prop="threetime" />            <el-table-column v-if="maxTime.isTime4" label="第四班未分配" min-width="105px" align="center" prop="fourtime" />          </el-table>        </div>      </div>    </div>    <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)">      <el-button class="success" style="float:left;" @click="handleCreate">新增车次</el-button>      <el-button class="danger" style="float:left;" @click="handleReduceTrains">减少车次</el-button>      <el-button class="success" style="float:left;" @click="handleAutomaticGeneration">自动生成</el-button>      <el-button class="success" style="float:left;" @click="handleCheck">校验</el-button>      <el-button class="import" style="float:right;" @click="handleHistoryRecord">历史记录</el-button>    </div>    <div class="table">      <el-table        id="table"        :key="table.tableKey"        v-loading="table.listLoading"        element-loading-text="给我一点时间"        :data="table.list"        border        highlight-current-row        style="width: 100%;"        :height="height"        :row-style="rowStyle"        :cell-style="cellStyle"        class="elTable table-fixed"        row-key="id"        @selection-change="handleSelect"      >        <el-table-column type="selection" width="50" />        <el-table-column label="车次" width="85px" align="center">          <template slot-scope="scope">            <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>            <el-input v-if="scope.row.Edit" v-model="scope.row.sort" type="number" placeholder="车次" class="filter-item" style="display: inline-block;width: 95%;" />          </template>        </el-table-column>        <el-table-column label="TMR编号" width="110px" align="center">          <template slot-scope="scope">            <span v-if="scope.row.NoEdit">{{ scope.row.tmrname }}</span>            <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)}">              <el-option v-for="item in TMRNumberList" :key="item.id" :label="item.eqcode" :value="item.id" />            </el-select>          </template>        </el-table-column>        <el-table-column label="描述" width="110px" align="center">          <template slot-scope="scope">            <span v-if="scope.row.NoEdit">{{ scope.row.display }}</span>            <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%;" />          </template>        </el-table-column>        <el-table-column label="生效" width="100px" align="center">          <template slot-scope="scope">            <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)" />          </template>        </el-table-column>        <el-table-column label="班次" width="100px" align="center">          <template slot-scope="scope">            <span v-if="scope.row.NoEdit">{{ scope.row.timesstr }}</span>            <el-select v-if="scope.row.Edit" v-model="scope.row.times" :disabled="scope.row.Disabled" placeholder="班次" class="filter-item" style="width:95%;">              <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />            </el-select>          </template>        </el-table-column>        <el-table-column label="时间" width="150px" align="center">          <template slot-scope="scope">            <span v-if="scope.row.NoEdit">{{ scope.row.begintime }}</span>            <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%;" />          </template>        </el-table-column>        <el-table-column label="最大重量" width="80px" align="center">          <template slot-scope="scope">            <span>{{ scope.row.maxweight }}</span>          </template>        </el-table-column>        <el-table-column label="合计重量" width="80px" align="center">          <template slot-scope="scope">            <span>{{ scope.row.sumweight }}</span>          </template>        </el-table-column>        <el-table-column label="模板配方" width="120px" align="center">          <template slot-scope="scope">            <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>            <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)}">              <el-option v-for="item in templateFormulationList" :key="item.id" :label="item.tname" :value="item.id" />            </el-select>          </template>        </el-table-column>        <el-table-column label="发料" width="950px" align="center">          <template slot-scope="scope">            <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)">              <div v-for="element in scope.row.arrList" :key="element.name" :style="{'background':element.background}" class="list-group-item2 item" style="width: 100px;float: left;border-radius:5px;margin: 5px 5px;padding: 0;height: 60px;">                <span :style="{'background':element.background}" style="display: block;height:20px;line-height: 20px;border-radius:5px;position: relative;color:#fff;">                  {{ element.barname }}                  <i class="el-icon-close" style="position: absolute;right: 0;" @click="handleFLDelete(element,scope.row)" />                </span>                <div style="margin-top: 7px;">                  <el-tooltip placement="top">                    <div slot="content">{{ element.tmrname }}</div>                    <el-select v-model="element.tmrid" placeholder="发料设备" class="filter-item2" style="display: inline-block;width: 55px;" @change="(value)=> {changeEquipment(value, scope.row,element.fttype,element.id)}">                      <el-option v-for="item in equipmentList" :key="item.id" :label="item.tname" :value="item.id" />                    </el-select>                  </el-tooltip>                  <el-tooltip placement="top">                    <div slot="content">{{ element.weight }}</div>                    <el-input v-model="element.weight" type="number" placeholder="重量" class="filter-item2" style="display: inline-block;width: 40px;" @blur="(value)=> {blurWeight(scope.row,element.fttype,element.id)}" />                  </el-tooltip>                </div>              </div>            </draggable>          </template>        </el-table-column>        <el-table-column align="center" width="250" class-name="small-padding fixed-width" fixed="right">          <template slot-scope="{row}">            <!-- 新增 -->            <el-button v-if="row.isCreate" :disabled="isokDisable" class="miniSuccess" @click="createData(row)">保存</el-button>            <el-button v-if="row.isCreate" class="minCancel" @click="createCancel(row)">取消</el-button>            <!-- 编辑 -->            <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>            <el-button v-if="row.isUpdate" class="miniDanger" @click="handleRowDelete(row)">删除</el-button>            <!-- 编辑保存 -->            <el-button v-if="row.isUpdateSave" :disabled="isokDisable" class="miniSuccess" @click="updateData(row)">保存</el-button>            <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel(row)">取消</el-button>          </template>        </el-table-column>      </el-table>    </div>    <!-- 自动生成 -->    <el-dialog :title="textMap[automaticGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="automaticGeneration.dialogFormVisible" :close-on-click-modal="false" width="40%">      <div class="app-automaticGeneration" style="margin: 0 auto;">        <div style="width: 210px;margin:60px auto 100px;">          请选择自动生成方式<br>          1、清空计划生产新计划<br>          2、当前计划基础上继续生成计划<br>        </div>        <div slot="footer" class="dialog-footer">          <el-button class="cancel" @click="automaticGeneration.dialogFormVisible = false; ">关闭</el-button>          <el-button class="success" :disabled="isokDisable" @click="continueData()">继续生成</el-button>          <el-button class="success" :disabled="isokDisable" @click="emptyPlanData()">清空计划</el-button>        </div>      </div>    </el-dialog>  </div></template><script>import { GetDataByName, GetArrList, PostDataByName, failproccess, ExecDataByConfig } from '@/api/common'import draggable from 'vuedraggable'import Sortable from 'sortablejs'import Cookies from 'js-cookie'import { MessageBox } from 'element-ui'// const id = 1export default {  name: 'MaterialIssuancePlan',  display: 'Two list header slot',  order: 14,  components: { draggable },  data() {    return {      requestParams: {        name: 'getTMRListEnable', offset: 0, parammaps: { pastureid: Cookies.get('pastureid'), eqtype: '1' }      },      requestParams2: {        name: 'getTMRListEnable', offset: 0, parammaps: { pastureid: Cookies.get('pastureid'), eqtype: '2' }      },      requestParams3: {        name: 'getFTSWList', offset: 0, parammaps: { pastureid: Cookies.get('pastureid') }      },      equipmentList: [], // 发料设备      TMRNumberList: [], // TMR编号      frequencyList: [], // 班次      templateFormulationList: [], // 模板配方      // 班次      maxTime: {        getMaxTimesParm: {          name: 'getSysoptEnable',          page: 1,          offset: 1,          pagecount: 1,          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            inforname: 'times'          }        },        // 班次        isTime1: false,        isTime2: false,        isTime3: false,        isTime4: false      },      table: {        getdataListParm: {          name: 'getLppList',          name1: 'getLppdList',          page: 1,          offset: 1,          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid')          }        },        list: [],        total: 0,        tableKey: 0,        listLoading: false,        tabClickIndex: null, // 点击的单元格        tabClickLabel: '', // 当前点击的列名        temp: {},        move1: '',        changeList: [],        startObj: {},        isGoing: false      },      selectList: [], // 选中数据      // 班次      menuRadio: '一班',      MenuList: [], // 配单列表      getdataListParmTimes: {        name: 'geFTListByFP',        name1: 'geFTListByFPDetail',        page: 1,        offset: 1,        returntype: 'Map',        parammaps: {          pastureid: Cookies.get('pastureid'),          times: '1'        }      },      listLoadingTimes: false,      // 栏舍统计      isLeftButton: true, // 向左      isRightButton: false, // 向右      rowStyle2: { maxHeight: 20 + 'px', height: 20 + 'px' },      cellStyle2: { padding: 0 + 'px' },      headerRowStyle2: { maxHeight: 20 + 'px', height: 20 + 'px' },      headerCellStyle2: { padding: 0 + 'px' },      smallMenu: {        getdataListParm: {          name: 'getLppUseSUMList',          page: 1,          offset: 1,          pagecount: 10,          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid')          }        },        total: 0,        tableKey: 0,        listLoading: false,        list: []      },      // 自动生成      automaticGeneration: {        dialogFormVisible: false,        dialogStatus: ''      },      textMap: {        automaticGeneration: '提示'      },      isokDisable: false,      requestParam: {},      height: document.body.clientHeight - 255 - 50, // table高度      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },      cellStyle: { padding: 0 + 'px' }    }  },  created() {    this.getIsDisplay()    this.getDownList()  },  methods: {    // 下拉列表    getDownList() {      GetDataByName(this.requestParams).then(response => {        this.TMRNumberList = response.data.list      })      GetDataByName(this.requestParams2).then(response => {        this.equipmentList = response.data.list      })      GetDataByName(this.requestParams3).then(response => {        this.templateFormulationList = response.data.list      })    },    // 显示班次    getIsDisplay() {      GetDataByName(this.maxTime.getMaxTimesParm).then(response => {        console.log(response.data.list[0].inforvalue)        if (response.data.list[0].inforvalue == 1) {          this.frequencyList = [{ id: '1', name: '第一班' }]        } else if (response.data.list[0].inforvalue == 2) {          this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]        } else if (response.data.list[0].inforvalue == 3) {          this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]        } else if (response.data.list[0].inforvalue == 4) {          this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]        }        if (response.data.list !== null) {          if (response.data.list[0].inforvalue == 1) {            this.maxTime.isTime1 = true            this.maxTime.isTime2 = false            this.maxTime.isTime3 = false            this.maxTime.isTime4 = false          } else if (response.data.list[0].inforvalue == 2) {            this.maxTime.isTime1 = true            this.maxTime.isTime2 = true            this.maxTime.isTime3 = false            this.maxTime.isTime4 = false          } else if (response.data.list[0].inforvalue == 3) {            this.maxTime.isTime1 = true            this.maxTime.isTime2 = true            this.maxTime.isTime3 = true            this.maxTime.isTime4 = false          } else if (response.data.list[0].inforvalue == 4) {            this.maxTime.isTime1 = true            this.maxTime.isTime2 = true            this.maxTime.isTime3 = true            this.maxTime.isTime4 = true          }        } else {          this.maxTime.isTime1 = false          this.maxTime.isTime2 = false          this.maxTime.isTime3 = false          this.maxTime.isTime4 = false        }      })      this.getList()      this.getSmallMenuList() // 栏舍统计      this.getTimesList() // 班次    },    // 头部班次    getTimesList() {      this.listLoadingTimes = true      GetArrList(this.getdataListParmTimes).then(response => {        for (let i = 0; i < response.data.list.length; i++) {          this.$set(response.data.list[i], 'isShowTitle', true)          if (response.data.list[i].arrList == null) {            this.$set(response.data.list[i], 'isShowTitle', false)          }        }        this.MenuList = response.data.list      })    },    // 切换班次    changeMenu(val) {      console.log(val)      if (this.menuRadio === '一班') {        this.getdataListParmTimes.parammaps.times = '1'        this.getTimesList()      } else if (this.menuRadio === '二班') {        this.getdataListParmTimes.parammaps.times = '2'        this.getTimesList()        this.MenuList = this.twoMenuList      } else if (this.menuRadio === '三班') {        this.getdataListParmTimes.parammaps.times = '3'        this.getTimesList()      } else if (this.menuRadio === '四班') {        this.getdataListParmTimes.parammaps.times = '4'        this.getTimesList()      }    },    // 右侧栏舍统计    getSmallMenuList() {      this.smallMenu.listLoading = true      GetDataByName(this.smallMenu.getdataListParm).then(response => {        console.log('smallMenu数据', response.data.list)        if (response.data.list !== null) {          for (let i = 0; i < response.data.list.length; i++) {            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) }            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) }            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) }            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) }            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)            this.$set(response.data.list[i], 'all', '')          }          this.smallMenu.list = response.data.list          this.smallMenu.total = response.data.total        } else {          this.smallMenu.list = []        }        setTimeout(() => {          this.smallMenu.listLoading = false        }, 100)      })    },    // table    getList() {      this.table.listLoading = true      GetArrList(this.table.getdataListParm).then(response => {        console.log('table数据', response.data.list)        if (response.data.list !== null) {          for (let i = 0; i < response.data.list.length; i++) {            this.$set(response.data.list[i], 'Edit', false) // 编辑            this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入            this.$set(response.data.list[i], 'isCreate', false) // 新增操作            this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作            this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存            this.$set(response.data.list[i], 'Disabled', true) // 班次/模板配方不可输入            if (response.data.list[i].arrList == null) {              this.$set(response.data.list[i], 'Disabled', false)              this.$set(response.data.list[i], 'arrList', [])            }          }          this.table.list = response.data.list          this.rowDrop()          this.table.changeList = []          this.table.startObj = {}          if (response.data.total) {            this.table.total = response.data.total          }        } else {          this.table.list = []        }        setTimeout(() => {          this.table.listLoading = false        }, 100)      })    },    // 行拖拽    rowDrop() {      console.log(document.querySelector('#table .el-table__body-wrapper tbody'))      const tbody = document.querySelector('#table .el-table__body-wrapper tbody')      const that = this      Sortable.create(tbody, {        onEnd({ newIndex, oldIndex }) {          const currRow = that.table.list.splice(oldIndex, 1)[0]          that.table.list.splice(newIndex, 0, currRow)          console.log('索引', newIndex)          console.log('拖动数据', currRow)          console.log('上', that.table.list[newIndex - 1])          console.log('下', that.table.list[newIndex + 1])        }      })    },    // TMR编号    changeTMRNumber(item, row) {      row.tmrname = this.TMRNumberList.find(obj => obj.id === item).eqcode      row.maxweight = this.TMRNumberList.find(obj => obj.id === item).maxstirfeed    },    // 配方模板    changeTemplateFormulation(item, row) {      row.ftname = this.templateFormulationList.find(obj => obj.id === item).tname    },    // 增加车次    handleCreate() {      for (let i = 0; i < this.table.list.length; i++) {        if (this.table.list[i].Edit === true) {          console.log(123)          this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })          return false        }      }      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, 'times': '', 'display': '', 'begintime': '', 'ftname': '', 'ftid': '', 'sumweight': '', 'sumcowcount': '', 'maxweight': '', 'arrList': [] })    },    createData(row) {      console.log('点击了新增保存', row)      this.table.temp.pastureid = Cookies.get('pastureid')      this.table.temp.tmrname = row.tmrname      this.table.temp.tmrid = row.tmrid      this.table.temp.sort = row.sort      this.table.temp.sel = row.sel      this.table.temp.times = row.times      this.table.temp.display = row.display      this.table.temp.begintime = row.begintime      this.table.temp.ftname = row.ftname      this.table.temp.ftid = row.ftid      this.table.temp.sumweight = 0      this.table.temp.maxweight = row.maxweight      if (this.table.temp.sort == '' && this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {        this.$message({ type: 'error', message: '车次/TMR编号/班次/模板配方不能为空', duration: 2000 })        return false      } else if (this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {        this.$message({ type: 'error', message: 'TMR编号/班次/模板配方不能为空', duration: 2000 })        return false      } else if (this.table.temp.times == '' && this.table.temp.ftid == '') {        this.$message({ type: 'error', message: '班次/模板配方不能为空', duration: 2000 })        return false      } else if (this.table.temp.ftid == '') {        this.$message({ type: 'error', message: '模板配方不能为空', duration: 2000 })        return false      }      for (let i = 0; i < this.table.list.length; i++) {        if (row.sort == this.table.list[i].sort) {          if (row.myId !== this.table.list[i].myId) {            this.$message({ type: 'error', message: '车次不客重复', duration: 2000 })            return false          }        }      }      var isInteger = /^\d+$/      if (this.table.temp.sort !== '') {        if (!isInteger.test(parseFloat(this.table.temp.sort))) {          this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })          return false        }      }      this.isokDisable = true      setTimeout(() => {        this.isokDisable = false      }, 1000)      this.requestParam = {}      this.requestParam.name = 'insertLpp'      this.requestParam.parammaps = this.table.temp      PostDataByName(this.requestParam).then(response => {        console.log('新增保存发送参数', this.requestParam)        if (response.msg !== 'fail') {          this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })          this.getList()        } else {          failproccess(response, this.$notify)        }      })    },    createCancel(row) {      console.log('点击了新增取消')      for (let i = 0; i < this.table.list.length; i++) {        if (row.myId === this.table.list[i].myId) {          var listIndex = this.table.list.indexOf(this.table.list[i])        }        if (listIndex > -1) {          this.table.list.splice(listIndex, 1)          return        }      }    },    // 编辑    handleUpdate(row) {      console.log(row, '点击了行编辑')      for (let i = 0; i < this.table.list.length; i++) {        if (this.table.list[i].Edit == true) {          this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })          return false        }      }      // 编辑true,不可编辑false      row.Edit = true      row.NoEdit = false      // 新增false,编辑false,编辑保存true      row.isCreate = false      row.isUpdate = false      row.isUpdateSave = true      row.times = String(row.times)      if (row.sort == undefined) { row.sort = '' }      if (row.tmrid == undefined || row.tmrname == undefined) {        row.tmrid = ''        row.tmrname = ''      }      if (row.display == undefined) { row.display = '' }      if (row.times == undefined) { row.times = '' }      if (row.begintime == undefined) { row.begintime = '' }      if (row.ftid == undefined || row.ftname == undefined) {        row.ftid = ''        row.ftname = ''      }    },    updateData(row) {      console.log('点击了编辑保存', row)      this.table.temp.pastureid = row.pastureid      this.table.temp.id = row.id      this.table.temp.tmrname = row.tmrname      this.table.temp.tmrid = row.tmrid      this.table.temp.sort = row.sort      this.table.temp.sel = row.sel      this.table.temp.times = row.times      this.table.temp.display = row.display      this.table.temp.begintime = row.begintime      this.table.temp.ftname = row.ftname      this.table.temp.ftid = row.ftid      this.table.temp.sumweight = row.sumweight      this.table.temp.sumcowcount = row.sumcowcount      this.table.temp.maxweight = row.maxweight      if (this.table.temp.sort == '' && this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {        this.$message({ type: 'error', message: '车次/TMR编号/班次/模板配方不能为空', duration: 2000 })        return false      } else if (this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {        this.$message({ type: 'error', message: 'TMR编号/班次/模板配方不能为空', duration: 2000 })        return false      } else if (this.table.temp.times == '' && this.table.temp.ftid == '') {        this.$message({ type: 'error', message: '班次/模板配方不能为空', duration: 2000 })        return false      } else if (this.table.temp.ftid == '') {        this.$message({ type: 'error', message: '模板配方不能为空', duration: 2000 })        return false      }      for (let i = 0; i < this.table.list.length; i++) {        if (row.sort == this.table.list[i].sort) {          if (row.id !== this.table.list[i].id) {            this.$message({ type: 'error', message: '车次不客重复', duration: 2000 })            return false          }        }      }      var isInteger = /^\d+$/      if (this.table.temp.sort !== '') {        if (!isInteger.test(parseFloat(this.table.temp.sort))) {          this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })          return false        }      }      this.isokDisable = true      setTimeout(() => {        this.isokDisable = false      }, 1000)      this.requestParam = {}      this.requestParam.name = 'updateLpp'      this.requestParam.parammaps = this.table.temp      PostDataByName(this.requestParam).then(response => {        console.log('编辑保存发送参数', this.requestParam)        if (response.msg !== 'fail') {          this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })          this.getList()        } else {          failproccess(response, this.$notify)        }      })    },    updateCancel(row) {      console.log('点击了编辑取消')      // 编辑false,不可编辑true      row.Edit = false      row.NoEdit = true      // 新增false,编辑true,编辑保存false      row.isCreate = false      row.isUpdate = true      row.isUpdateSave = false    },    // 自动生成    handleAutomaticGeneration() {      this.automaticGeneration.dialogStatus = 'automaticGeneration'      this.automaticGeneration.dialogFormVisible = true    },    continueData() {      console.log('点击继续生成')    },    emptyPlanData() {      console.log('点击清空计划')    },    // 检验    handleCheck() {      console.log('点击检验')    },    // 历史记录    handleHistoryRecord() {      console.log('点击历史记录')    },    // 配方    changeLog: function(evt) {      console.log('change1', evt)    },    start(evt) {      console.log('start1', evt)      this.$set(this.table.startObj, 'from', evt.from.className)      this.$set(this.table.startObj, 'to', evt.from.className)    },    end(evt) {      console.log('end1', evt)    },    move(evt, originalEvent) {      if (originalEvent.target.className === 'list-group-item1 item' || originalEvent.target.className === 'draggableWeight') {        return false      }      console.log(evt)      this.table.move1 = evt.draggedContext.element    },    start2(evt) {      console.log('start2', evt)      this.$set(this.table.startObj, 'from', evt.from.className)      this.$set(this.table.startObj, 'to', evt.from.className)    },    move2(evt, originalEvent) {      // console.log(evt, originalEvent)      if (originalEvent.target.className === 'list-group-item1 item' || originalEvent.target.className === 'draggableWeight') {        return false      }      this.table.move1 = evt.draggedContext.element    },    end2(evt) {      // console.log(evt)      console.log('end2', evt)    },    // 发料位    changeLog2(evt) {      // console.log(this.table.startObj)      console.log(evt, 'evt-----')      this.table.changeList.push(evt)      evt = this.table.changeList[0]      if (evt.arrList.length == 1) {        evt.arrList[0].sort = 0      } else if (evt.arrList.length > 1) {        for (let i = 0; i < evt.arrList.length; i++) {          if (evt.arrList[i].id == this.table.move1.id && evt.arrList[i].fttype == this.table.move1.fttype) {            if (evt.arrList[i - 1] == undefined) {              evt.arrList[i].sort = 0              evt.sort = 0            } else {              evt.arrList[i].sort = parseFloat(evt.arrList[i - 1].sort) + 1              evt.sort = parseFloat(evt.arrList[i - 1].sort) + 1            }          }        }      }      console.log(evt.arrList)      if (this.table.startObj.from == 'list-group1' && this.table.startObj.to == 'list-group1') {        this.requestParam = {}        this.requestParam.common = { 'returnmap': '0' }        this.requestParam.data = []        this.requestParam.data[0] = { 'name': 'checkLLPDetailInsert', 'type': 'v', 'parammaps': {          pastureid: this.table.move1.pastureid,          barid: this.table.move1.barid,          lppid: evt.id,          times: evt.times,          ftid: this.table.move1.ftid,          ptsid: this.table.move1.ptsid,          ptid: this.table.move1.ptid,          fttype: this.table.move1.fttype,          timesTem: this.table.move1.times        }}        this.requestParam.data[1] = { 'name': 'updateLpplandtlSorts', 'type': 'e', 'parammaps': {          pastureid: evt.pastureid,          sort: evt.sort,          lppid: evt.id        }}        this.requestParam.data[2] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {          pastureid: evt.pastureid,          lppid: evt.id,          barid: this.table.move1.barid,          barname: this.table.move1.barname,          fpdid: this.table.move1.id,          fttype: this.table.move1.fttype,          lweight: this.table.move1.weight,          sort: evt.sort,          tmrid: evt.tmrid,          tmrname: evt.tmrname,          background: this.table.move1.background,          ccountradio: this.table.move1.ccountradio,          cowcount: this.table.move1.cowcount        }}        this.requestParam.data[3] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {          pastureid: this.table.move1.pastureid,          id: this.table.move1.id,          fttype: this.table.move1.fttype,          lweight: this.table.move1.weight        }}        console.log('发料位上-下新增', this.requestParam)        ExecDataByConfig(this.requestParam).then(response => {          console.log('发料位新增保存发送参数', this.requestParam)          if (response.msg === 'fail') {            this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })            this.getTimesList()            this.getSmallMenuList()            this.getList()          } else {            this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })            this.getList()            this.getSmallMenuList()          }        })      } else if (this.table.startObj.from == 'list-group2' && this.table.startObj.to == 'list-group2') {        if (this.table.changeList.length == 1) {          this.requestParam = {}          this.requestParam.common = { 'returnmap': '0' }          this.requestParam.data = []          this.requestParam.data[0] = { 'name': 'checkLLPDetailInsert', 'type': 'v', 'parammaps': {            pastureid: this.table.move1.pastureid,            barid: this.table.move1.barid,            lppid: evt.id,            times: evt.times,            ftid: this.table.move1.ftid,            ptsid: this.table.move1.ptsid,            ptid: this.table.move1.ptid,            fttype: this.table.move1.fttype,            timesTem: evt.times          }}          this.requestParam.data[1] = { 'name': 'updateLpplandtlSorts', 'type': 'e', 'parammaps': {            pastureid: evt.pastureid,            sort: evt.sort,            lppid: evt.id          }}          this.requestParam.data[2] = { 'name': 'deleteLppd', 'type': 'e', 'parammaps': {            pastureid: evt.pastureid,            id: this.table.move1.id          }}          this.requestParam.data[3] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {            pastureid: evt.pastureid,            lppid: evt.id,            barid: this.table.move1.barid,            barname: this.table.move1.barname,            fpdid: this.table.move1.fpdid,            fttype: this.table.move1.fttype,            lweight: this.table.move1.weight,            sort: evt.sort,            tmrid: evt.tmrid,            tmrname: evt.tmrname,            background: this.table.move1.background,            ccountradio: this.table.move1.ccountradio,            cowcount: this.table.move1.cowcount          }}          console.log('发料位下-下新增', this.requestParam)          ExecDataByConfig(this.requestParam).then(response => {            console.log('发料位新增保存发送参数', this.requestParam)            if (response.msg === 'fail') {              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })              this.getTimesList()              this.getSmallMenuList()              this.getList()            } else {              this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })              this.getList()              this.getSmallMenuList()            }          })        } else if (this.table.changeList.length == 1) {          if (this.table.isGoing == true) {            console.log(11111)            this.requestParam.common = { 'returnmap': '0' }            this.requestParam.data = []            this.requestParam.data[0] = { 'name': 'checkLLPDetailInsert', 'type': 'e', 'parammaps': {              pastureid: evt.pastureid,              sort: evt.sort,              lppid: evt.id            }}            this.requestParam.data[1] = { 'name': 'deleteLppd', 'type': 'e', 'parammaps': {              pastureid: evt.pastureid,              id: this.table.move1.id            }}            this.requestParam.data[2] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {              pastureid: evt.pastureid,              lppid: evt.id,              barid: this.table.move1.barid,              barname: this.table.move1.barname,              fpdid: this.table.move1.id,              fttype: this.table.move1.fttype,              lweight: this.table.move1.weight,              sort: evt.sort,              tmrid: evt.tmrid,              tmrname: evt.tmrname,              background: this.table.move1.background            }}            this.requestParam.data[3] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {              pastureid: this.table.move1.pastureid,              id: this.table.move1.id,              fttype: this.table.move1.fttype,              statue: 1            }}            console.log('发料位新增', this.requestParam)            ExecDataByConfig(this.requestParam).then(response => {              console.log('发料位新增保存发送参数', this.requestParam)              if (response.msg === 'fail') {                this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })                this.getTimesList()                this.getList()              } else {                this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })                this.getList()              }            })            this.table.isGoing = false          } else {            this.table.isGoing = true          }        }      }    },    // 编辑-发料设备    changeEquipment(item, row, fttype, myid) {      var objList = {}      for (let i = 0; i < row.arrList.length; i++) {        row.arrList[i].tmrname = this.equipmentList.find(obj => obj.id === item).tname        if (row.arrList[i].fttype == fttype && row.arrList[i].id == myid) {          objList = row.arrList[i]        }      }      this.requestParam = {}      this.requestParam.common = { 'returnmap': '0' }      this.requestParam.data = []      this.requestParam.data[0] = { 'name': 'updateLppd', 'type': 'e', 'parammaps': {        pastureid: row.pastureid,        lppid: row.id,        barid: objList.barid,        barname: objList.barname,        fpdid: objList.fpdid,        fttype: objList.fttype,        lweight: objList.weight,        sort: objList.sort,        tmrid: objList.tmrid,        tmrname: objList.tmrname,        background: objList.background,        id: objList.id      }}      ExecDataByConfig(this.requestParam).then(response => {        console.log('编辑保存发送参数', this.requestParam)        if (response.msg === 'fail') {          this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })        } else {          this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })          this.getList()          this.getTimesList()        }      })    },    // 编辑-重量    blurWeight(row, fttype, myid) {      var objList = {}      for (let i = 0; i < row.arrList.length; i++) {        if (row.arrList[i].fttype == fttype && row.arrList[i].id == myid) {          objList = row.arrList[i]        }      }      if (objList.weight == '') { objList.weight = 0 }      this.requestParam = {}      this.requestParam.common = { 'returnmap': '0' }      this.requestParam.data = []      this.requestParam.data[0] = { 'name': 'checkFPdLeftW', 'type': 'v', 'parammaps': {        pastureid: objList.pastureid,        fpdid: objList.fpdid,        fttype: objList.fttype,        lweight: String(parseFloat(objList.weight) - parseFloat(objList.lweight))      }}      this.requestParam.data[1] = { 'name': 'updateLppd', 'type': 'e', 'parammaps': {        pastureid: row.pastureid,        lppid: row.id,        barid: objList.barid,        barname: objList.barname,        fpdid: objList.fpdid,        fttype: objList.fttype,        lweight: objList.weight,        sort: objList.sort,        tmrid: objList.tmrid,        tmrname: objList.tmrname,        background: objList.background,        id: objList.id      }}      this.requestParam.data[2] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {        pastureid: objList.pastureid,        id: objList.fpdid,        fttype: objList.fttype,        lweight: String(parseFloat(objList.weight) - parseFloat(objList.lweight))      }}      ExecDataByConfig(this.requestParam).then(response => {        console.log('编辑保存发送参数', this.requestParam)        if (response.msg === 'fail') {          this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })          this.getList()          this.getTimesList()        } else {          this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })          this.getList()          this.getTimesList()        }      })    },    handleTakeEffectChange() {      console.log('点击了生效')    },    // 发料位删除    handleFLDelete(ele, row) {      console.log(ele, row, '点击了发料删除')      this.selectList = []      this.requestParam = {}      this.requestParam.common = { 'returnmap': '0' }      this.requestParam.data = []      this.requestParam.data[0] = { 'name': 'deleteLppd', 'type': 'e', 'parammaps': {        pastureid: ele.pastureid,        id: ele.id      }}      this.requestParam.data[1] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {        pastureid: ele.pastureid,        id: ele.fpdid,        fttype: ele.fttype,        lweight: '-' + parseFloat(ele.weight)      }}      ExecDataByConfig(this.requestParam).then(response => {        console.log('删除保存发送参数', this.requestParam)        if (response.msg === 'fail') {          this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })        } else {          this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })          this.getList()          this.getTimesList()        }      })    },    handleSelect(val) {      console.log('勾选数据', val)      this.selectList = val    },    // 减少车次    handleReduceTrains() {      if (this.selectList.length == 0) {        this.$message({ type: 'error', message: '请选择车次', duration: 2000 })        return false      } else {        // 减少对应车次        for (let i = 0; i < this.selectList.length; i++) {          if (this.selectList[i].arrList.length > 0) {            this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })            return false          }        }        MessageBox.confirm('是否确认删除此信息?', {          confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'        }).then(() => {          console.log(this.selectList)          this.requestParam = {}          this.requestParam.common = { 'returnmap': '0' }          this.requestParam.data = []          this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}          this.requestParam.data[0].children = []          this.requestParam.data[0].children[0] = { 'name': 'deleteLpp', 'type': 'e', 'parammaps': {            id: '@insertSpotList.id',            pastureid: '@insertSpotList.pastureid'          }}          ExecDataByConfig(this.requestParam).then(response => {            console.log('删除保存发送参数', this.requestParam)            if (response.msg === 'fail') {              this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })            } else {              this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })              this.getList()            }          })        })      }    },    // 行内删除    handleRowDelete(row) {      console.log(row, '点击了行删除')      if (row.arrList.length == 0) {        MessageBox.confirm('是否确认删除此信息?', {          confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'        }).then(() => {          this.selectList = []          this.requestParam = {}          this.requestParam.name = 'deleteLpp'          this.requestParam.parammaps = {}          this.requestParam.parammaps.pastureid = row.pastureid          this.requestParam.parammaps.id = row.id          PostDataByName(this.requestParam).then(response => {            if (response.msg === 'fail') {              this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })            } else {              this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })              this.getList()            }          })        }).catch(() => {          this.$message({ type: 'info', message: '已取消删除' })        })      } else {        this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })        return false      }    },    handleLeftButton() { // 向左      this.isLeftButton = false      this.isRightButton = true      this.$refs.listRight.style.zIndex = 4      this.getSmallMenuList()    },    handleRightButton() { // 向右      this.isLeftButton = true      this.isRightButton = false      this.$refs.listRight.style.zIndex = 1    }  }}</script><style lang="scss" scoped>  /deep/ .el-radio-button__orig-radio:checked+.el-radio-button__inner {      color: #fff;      background-color: #ccc;      border-color: #ccc;      -webkit-box-shadow: -1px 0 0 0 #ccc;      box-shadow: -1px 0 0 0 #ccc;  }</style><style lang="scss" scoped>  .list{    position: fixed; height: 150px;z-index: 3;width: 60%;    .list-t{position: fixed;z-index: 1;height:39px;}    .draggableList{ width: 100%; height: 117px; list-style: none;margin-top:32px;padding-left:0;padding-right:0;overflow: auto;      .draggableTitle{float: left;width: 105px;white-space: nowrap;overflow: hidden; text-overflow: ellipsis;margin:5px 5px;border-radius: 7px;text-align: center;color:#000;height: 35px;line-height: 36px;}      li{        margin: 3px 0;text-align: center;color:#fff;        .draggableName{display:block;font-size: 12px;width: 100%;padding-top: 5px;overflow: hidden; text-overflow:ellipsis; white-space: nowrap;}        .draggableWeight{display:block;font-size: 10px;background: #fff; color: #000; width: 50%; margin: 0 auto;  border-radius: 3px;}      }    }  }  $width:46%;  $width2:calc(46% - 50px);  .list-r{    position: fixed; height: 150px;z-index: 1;width: $width;right: 0;    .rightButton{      height: 150px;position: fixed;      .left{font:40px/150px '';position: fixed;background: #fff;width: 50px;right: 0;}      span{width: 20px;font:500 16px/16px '';display: inline-block;position: fixed;right: 0;margin-top: 42px;}      .right{font:40px/150px '';background: #fff;width: 50px;right: $width;}      .smallTable{position: fixed; top: 95px; width: $width2; margin-left: 50px;}    }  }  .operation{margin-top: 150px;height: 50px;}  .table{clear:both;}</style><style lang="scss">  // 下拉框  .filter-item2 .el-input--suffix .el-input__inner{    height: 30px !important;    font-size: 8px;    padding: 0 2px;  }  .filter-item2 .el-input--suffix .el-input__suffix .el-input__suffix-inner .el-input__icon{    line-height: 30px !important;  }  // 输入框  .filter-item2 .el-input__inner{    height: 30px !important;    font-size: 8px;    padding: 0 2px;  }</style>
 |