| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524 | <template>  <div class="app-container">    <!-- 配方模板表 -->    <div ref="template" class="template">      <div class="recipeTemplate">        <p>配方模板表</p>      </div>      <div class="operation">        <el-button class="success" @click="handleCreate">新增</el-button>        <el-button class="danger" @click="handleDelete">删除</el-button>        <el-button class="warning" @click="handleCopy">复制</el-button>        <el-button class="success" @click="handleRecipeRecord">配方记录</el-button>        <!-- <el-button class="success" @click="handleHistory">生成历史</el-button> -->        <el-upload style="float: right;margin-right: 75px;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">          <el-button class="import" style="float: right;">导入</el-button>        </el-upload>        <el-dropdown style="float: right;margin-right: 10px;">          <el-button class="export">导出</el-button>          <el-dropdown-menu slot="dropdown">            <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>            <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>          </el-dropdown-menu>        </el-dropdown>      </div>      <div class="search">        <el-select v-model="table.getdataListParm.parammaps.ccname" filterable placeholder="牲畜类别" class="filter-item" clearable>          <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />        </el-select>        <el-select v-model="table.getdataListParm.parammaps.fttype" filterable placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>          <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />        </el-select>        <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>          <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />        </el-select>        <div ref="selectInput" class="filter-item selectInput">          <el-input type="text" placeholder="请点击选择搜索条件" class="Input" />          <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />          <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />          <ul v-if="arrowUp" class="selectUl">            <li><a>配方名称</a><el-input v-model="table.getdataListParm.parammaps.tname" style="width: 245px;" /></li>            <li><a>备注</a><el-input v-model="table.getdataListParm.parammaps.remark" style="width: 245px;" /></li>            <li><a>来源</a><el-input v-model="table.getdataListParm.parammaps.source" style="width: 245px;" /></li>            <li>              <div style="float: right;">                <el-button class="minCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>                <el-button class="miniPrimary" @click="handleSearch">搜索</el-button>              </div>            </li>          </ul>        </div>        <el-button class="successBorder" @click="handleSearch">查询</el-button>        <el-button class="successBorder" @click="handleRefresh">重置</el-button>      </div>      <div class="table">        <el-table          :key="table.tableKey"          v-loading="table.listLoading"          element-loading-text="给我一点时间"          :data="table.list"          border          fit          highlight-current-row          style="width: 98%;"          :row-style="rowStyle"          :cell-style="cellStyle"          :height="350"          class="elTable table-fixed"          @row-click="tableRowClick"          @selection-change="handleSelectionChange"        >          <el-table-column type="selection" align="center" width="50" />          <el-table-column label="序号" align="center" type="index" width="50px">            <template slot-scope="scope">              <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>            </template>          </el-table-column>          <el-table-column label="配方名称" min-width="110px" align="center">            <template slot-scope="scope">              <span v-if="scope.row.NoEdit">{{ scope.row.tname }}</span>              <el-input v-if="scope.row.Edit" v-model.trim="scope.row.tname" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" />            </template>          </el-table-column>          <el-table-column label="配方颜色" min-width="85px" align="center">            <template slot-scope="scope">              <el-color-picker v-model="scope.row.tcolor" size="mini" :disabled="scope.row.NoEdit" style="margin:10px 0;" />            </template>          </el-table-column>          <el-table-column label="牲畜类别" min-width="130px" align="center">            <template slot-scope="scope">              <span v-if="scope.row.NoEdit">{{ scope.row.ccname }}</span>              <el-select v-if="scope.row.Edit" v-model="scope.row.ccid" filterable placeholder="牲畜类别" class="filter-item" style="width:95%;padding:10px 0;" @change="changeLivestockType">                <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />              </el-select>            </template>          </el-table-column>          <el-table-column label="配方类型" min-width="130px" align="center">            <template slot-scope="scope">              <span v-if="scope.row.NoEdit">{{ scope.row.fttype }}</span>              <el-select v-if="scope.row.Edit && scope.row.isCreate == true" v-model="scope.row.fttypeid" filterable placeholder="配方类型" class="filter-item" style="width:95%;padding:10px 0;" @change="changeFormulaType">                <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />              </el-select>              <el-select v-if="scope.row.Edit && scope.row.isUpdateSave == true" v-model="scope.row.fttypeid" disabled filterable placeholder="配方类型" class="filter-item" style="width:95%;padding:10px 0;" @change="changeFormulaType">                <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />              </el-select>            </template>          </el-table-column>          <el-table-column label="来源" min-width="90px" align="center">            <template slot-scope="scope">              <span>{{ scope.row.source }}</span>            </template>          </el-table-column>          <el-table-column label="备注" min-width="90px" align="center">            <template slot-scope="scope">              <span v-if="scope.row.NoEdit">{{ scope.row.remark }}</span>              <el-input v-if="scope.row.Edit" v-model="scope.row.remark" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="255" style="width:95%;padding:10px 0;" />            </template>          </el-table-column>          <el-table-column label="版本号" min-width="90px" align="center">            <template slot-scope="scope">              <span>{{ scope.row.version }}</span>            </template>          </el-table-column>          <el-table-column label="是否启用" min-width="90px" align="center">            <template slot-scope="scope">              <el-switch v-model="scope.row.enable" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.$index, scope.row)" />            </template>          </el-table-column>          <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">            <template slot-scope="{row}">              <!-- 新增 -->              <el-button v-if="row.isCreate" 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" class="miniSuccess" @click="updateData(row)">保存</el-button>              <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel(row)">取消</el-button>              <el-button v-if="row.NoEdit && isFormula" class="miniSuccess" @click="handleFormulationEvaluation(row)">配方评估</el-button>            </template>          </el-table-column>        </el-table>      </div>    </div>    <!-- 配方详情表 -->    <div v-if="isDetail" ref="detail" class="detail" style="margin-top: 30px;">      <div class="recipeTemplate">        <p>配方详情表</p>      </div>      <div class="operation">        <el-button style="float: left;" class="success" @click="handleCreate2">新增</el-button>        <el-button style="float: left;" class="danger" @click="handleDelete2">删除</el-button>        <el-button style="float: left;" class="success" @click="handleSyntheticPremix">合成预混料</el-button>        <el-button v-if="isOrder" style="float: left;" class="success" @click="handleChangeOrder">更改顺序</el-button>        <div v-else style="float: left;margin-left: 10px;">          <el-button class="success" @click="saveChangeOrder">保存</el-button>          <el-button class="success" @click="cancelChangeOrder">取消</el-button>        </div>        <div ref="selectInput2" class="filter-item selectInput" style="margin: 0 10px;">          <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />          <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />          <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />          <ul v-if="arrowUp2" class="selectUl" style="width: 400px;">            <li>              <a style="width: 130px;">饲料名称</a>              <el-select v-model="table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:245px;">                <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />              </el-select>            </li>            <li><a style="width: 130px;">饲料组名称</a><el-input v-model="table2.getdataListParm.parammaps.feedgroup" style="width: 245px;" /></li>            <li><a style="width: 130px;">重量</a><el-input v-model="table2.getdataListParm.parammaps.fweight" style="width: 245px;" /></li>            <li>              <a style="width: 130px;">搅拌延时</a>              <el-select v-model="table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:245px;" clearable>                <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />              </el-select>            </li>            <li>              <a style="width: 130px;">是否锁定牛头数比例</a>              <el-select v-model="table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:245px;" clearable>                <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />              </el-select>            </li>            <li><a style="width: 130px;">顺序</a><el-input v-model="table2.getdataListParm.parammaps.sort" style="width: 245px;" /></li>            <li>              <div style="float: right;">                <el-button class="minCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>                <el-button class="miniSuccess" @click="handleSearch2">搜索</el-button>              </div>            </li>          </ul>        </div>        <el-button class="successBorder" @click="handleSearch2">查询</el-button>        <el-button class="successBorder" @click="handleRefresh2">重置</el-button>      </div>      <div class="table2" style="min-height: 400px;">        <el-table          id="table2"          ref="table2"          :key="table2.tableKey"          v-loading="table2.listLoading"          element-loading-text="给我一点时间"          :data="table2.list"          border          fit          highlight-current-row          style="width: 98%;"          :row-style="rowStyle"          :cell-style="cellStyle"          class="elTable table-fixed"          row-key="id"          :summary-method="getSummaries"          show-summary          @selection-change="handleSelectionChange2"        >          <el-table-column type="selection" width="60" />          <el-table-column label="序号" align="center" type="index" width="50px" />          <el-table-column label="饲料组" min-width="110px" align="center">            <template slot-scope="scope">              <span v-if="scope.row.groupNoEdit">{{ scope.row.feedgroup }}</span>              <el-input v-if="scope.row.groupEdit" v-model="scope.row.feedgroup" :disabled="scope.row.isGroupDisabled" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" />            </template>          </el-table-column>          <el-table-column label="饲料名称" min-width="130px" align="center">            <template slot-scope="scope">              <span v-if="scope.row.NoEdit">{{ scope.row.fname }}</span>              <el-select v-if="scope.row.Edit" v-model="scope.row.fid" filterable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeFname(value, scope.row)}">                <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.id" />              </el-select>            </template>          </el-table-column>          <el-table-column label="重量(KG)" prop="fweight" min-width="180px" align="center">            <template slot-scope="scope">              <span v-if="scope.row.NoEdit">{{ scope.row.fweight }}</span>              <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" placeholder="重量" step="0.01" type="number" style="width:95%;padding:10px 0;" />            </template>          </el-table-column>          <el-table-column label="搅拌延时(min)" min-width="90px" align="center">            <template slot-scope="scope">              <span v-if="scope.row.NoEdit">{{ scope.row.autosecond }}</span>              <el-select v-if="scope.row.Edit" v-model="scope.row.autosecond" filterable placeholder="搅拌延时" class="filter-item" style="width:95%;padding:10px 0;">                <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.id" />              </el-select>            </template>          </el-table-column>          <el-table-column v-if="lockCount.isLockCount" label="是否锁定牛头数比例" min-width="110px" align="center">            <template slot-scope="scope">              <span v-if="scope.row.NoEdit && scope.row.islockcount == '0'">否</span>              <span v-if="scope.row.NoEdit && scope.row.islockcount == '1'">是</span>              <el-select v-if="scope.row.Edit" v-model="scope.row.islockcount" placeholder="" class="filter-item" style="width:95%;padding:10px 0;">                <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />              </el-select>            </template>          </el-table-column>          <el-table-column label="顺序" min-width="90px" 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" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" @blur="blurSort(scope.row)" />            </template>          </el-table-column>          <el-table-column label="操作" align="center" width="320" class-name="small-padding fixed-width" fixed="right">            <template slot-scope="{row}">              <!-- 新增 -->              <el-button v-if="row.isCreate" class="miniSuccess" @click="createData2(row)">保存</el-button>              <el-button v-if="row.isCreate" class="minCancel" @click="createCancel2(row)">取消</el-button>              <!-- 编辑 -->              <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate2(row)">编辑</el-button>              <el-button v-if="row.isUpdate" class="miniDanger" @click="handleRowDelete2(row)">删除</el-button>              <!-- 编辑保存 -->              <el-button v-if="row.isUpdateSave" class="miniSuccess" @click="updateData2(row)">保存</el-button>              <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel2(row)">取消</el-button>              <!-- 拆分预混料 -->              <el-button v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false" class="miniSuccess" @click="handleSplitPremix(row)">拆分预混料</el-button>            </template>          </el-table-column>        </el-table>      </div>    </div>    <!-- 配方记录 -->    <el-dialog :title="textMap[template.dialogStatus]" :destroy-on-close="true" :visible.sync="template.dialogFormVisible" :close-on-click-modal="false" width="90%">      <div class="dialogMinHeight" style="overflow-y: auto;margin-bottom: 30px;overflow-x: hidden;">        <div ref="templateDialog" class="templateDialog">          <div class="recipeTemplate">            <p>配方模板表</p>          </div>          <div class="operation">            <el-date-picker v-model="template.table.getdataListParm.parammaps.date" type="date" placeholder="请选择历史记录时间" :clearable="false" style="width: 180px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="changeDate" />            <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->          </div>          <div class="search">            <el-select v-model="template.table.getdataListParm.parammaps.ccname" placeholder="牲畜类别" class="filter-item" clearable>              <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />            </el-select>            <el-select v-model="template.table.getdataListParm.parammaps.fttype" placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>              <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />            </el-select>            <el-select v-model="template.table.getdataListParm.parammaps.enable" placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>              <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />            </el-select>            <div ref="selectInput" class="filter-item selectInput">              <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />              <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />              <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />              <ul v-if="arrowUp" class="selectUl">                <li><a>配方名称</a><el-input v-model="template.table.getdataListParm.parammaps.tname" style="width: 245px;" /></li>                <li><a>备注</a><el-input v-model="template.table.getdataListParm.parammaps.remark" style="width: 245px;" /></li>                <li><a>来源</a><el-input v-model="template.table.getdataListParm.parammaps.source" style="width: 245px;" /></li>                <li>                  <div style="float: right;">                    <el-button class="minCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>                    <el-button class="miniSuccess" @click="handleDialogSearch">搜索</el-button>                  </div>                </li>              </ul>            </div>            <el-button class="successBorder" @click="handleDialogSearch">查询</el-button>            <el-button class="successBorder" @click="handleDialogRefresh">重置</el-button>          </div>          <div class="table">            <el-table              :key="template.table.tableKey"              v-loading="template.table.listLoading"              element-loading-text="给我一点时间"              :data="template.table.list"              border              fit              highlight-current-row              style="width: 98%;"              :row-style="rowStyle"              :cell-style="cellStyle"              class="elTable table-fixed"              @row-click="tableRowClickDialog"            >              <el-table-column label="序号" align="center" type="index" width="50px">                <template slot-scope="scope">                  <span>{{ scope.$index + (template.table.pageNum-1) * template.table.pageSize + 1 }}</span>                </template>              </el-table-column>              <el-table-column label="配方名称" min-width="130px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.tname }}</span>                </template>              </el-table-column>              <el-table-column label="配方颜色" min-width="110px" align="center">                <template slot-scope="scope">                  <el-color-picker v-model="scope.row.tcolor" size="mini" disabled style="margin:10px 0;" />                </template>              </el-table-column>              <el-table-column label="牲畜类别" min-width="110px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.ccname }}</span>                </template>              </el-table-column>              <el-table-column label="配方类型" min-width="110px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.fttype }}</span>                </template>              </el-table-column>              <el-table-column label="来源" min-width="90px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.source }}</span>                </template>              </el-table-column>              <el-table-column label="备注" min-width="90px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.remark }}</span>                </template>              </el-table-column>              <el-table-column label="版本号" min-width="90px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.version }}</span>                </template>              </el-table-column>              <el-table-column label="版本时间" min-width="90px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.versiontime }}</span>                </template>              </el-table-column>              <el-table-column label="是否启用" min-width="90px" align="center">                <template slot-scope="scope">                  <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />                </template>              </el-table-column>            </el-table>          </div>        </div>        <div v-if="isDetailDialog" id="detailDialog2" ref="detailDialog2" class="detailDialog" style="margin-top: 30px;">          <div class="recipeTemplate">            <p>配方详情表</p>          </div>          <div class="operation">            <div ref="selectInput2" class="filter-item selectInput">              <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />              <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />              <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />              <ul v-if="arrowUp2" class="selectUl" style="width: 400px;">                <li>                  <a style="width: 130px;">饲料名称</a>                  <el-select v-model="template.table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:245px;">                    <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />                  </el-select>                </li>                <li><a style="width: 130px;">饲料组名称</a><el-input v-model="template.table2.getdataListParm.parammaps.feedgroup" style="width: 245px;" /></li>                <li><a style="width: 130px;">重量</a><el-input v-model="template.table2.getdataListParm.parammaps.fweight" style="width: 245px;" /></li>                <li>                  <a style="width: 130px;">搅拌延时</a>                  <el-select v-model="template.table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:245px;">                    <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />                  </el-select>                </li>                <li>                  <a style="width: 130px;">是否锁定牛头数比例</a>                  <el-select v-model="template.table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:245px;">                    <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />                  </el-select>                </li>                <li><a style="width: 130px;">顺序</a><el-input v-model="template.table2.getdataListParm.parammaps.sort" style="width: 245px;" /></li>                <li>                  <div style="float: right;">                    <el-button class="minCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>                    <el-button class="miniSuccess" @click="handleDialogSearch2">搜索</el-button>                  </div>                </li>              </ul>            </div>            <el-button class="successBorder" @click="handleDialogSearch2">查询</el-button>            <el-button class="successBorder" @click="handleDialogRefresh2">重置</el-button>          </div>          <div class="table2">            <el-table              id="templateTable2"              :key="template.table2.tableKey"              v-loading="template.table2.listLoading"              element-loading-text="给我一点时间"              :data="template.table2.list"              border              fit              highlight-current-row              style="width: 98%;"              :summary-method="getTemplateTable2Summaries"              show-summary              :row-style="rowStyle"              :cell-style="cellStyle"              class="elTable table-fixed"              row-key="id"            >              <el-table-column label="饲料组" min-width="130px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.feedgroup }}</span>                </template>              </el-table-column>              <el-table-column label="饲料名称" min-width="130px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.fname }}</span>                </template>              </el-table-column>              <el-table-column label="重量(KG)" prop="fweight" min-width="200px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.fweight }}</span>                </template>              </el-table-column>              <el-table-column label="搅拌延时(min)" min-width="130px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.autosecondname }}</span>                </template>              </el-table-column>              <el-table-column label="是否锁定牛头数比例" min-width="130px" align="center">                <template slot-scope="scope">                  <span v-if="scope.row.islockcount == '0'">否</span>                  <span v-if="scope.row.islockcount == '1'">是</span>                </template>              </el-table-column>              <el-table-column label="顺序" min-width="130px" align="center">                <template slot-scope="scope">                  <span>{{ scope.row.sort }}</span>                </template>              </el-table-column>            </el-table>          </div>        </div>        <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">          <el-button @click="template.dialogFormVisible = false; ">关闭</el-button>        </div>      </div>    </el-dialog>    <!-- 合成预混料 -->    <el-dialog :title="textMap[detail.dialogStatus]" :destroy-on-close="true" :visible.sync="detail.dialogFormVisible" :close-on-click-modal="false" width="90%">      <div class="detailDialog">        <h2>饲料</h2>        <div class="table1">          <el-table            :key="detail.tableKey"            v-loading="detail.listLoading"            element-loading-text="给我一点时间"            :data="detail.list"            fit            highlight-current-row            style="width: 100%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"            show-summary          >            <el-table-column label="序号" align="center" type="index" width="50px" />            <el-table-column label="饲料名称" min-width="130px" align="center">              <template slot-scope="scope">                <span>{{ scope.row.fname }}</span>              </template>            </el-table-column>            <el-table-column prop="fweight" label="重量(KG)" />            <el-table-column label="搅拌延时(min)" min-width="110px" align="center">              <template slot-scope="scope">                <span>{{ scope.row.autosecond }}</span>              </template>            </el-table-column>            <el-table-column v-if="lockCount.isLockCount" label="是否锁定牛头数比例" min-width="130px" align="center">              <template slot-scope="scope">                <span v-if="scope.row.islockcount == '0'">否</span>                <span v-if="scope.row.islockcount == '1'">是</span>              </template>            </el-table-column>            <el-table-column label="顺序" min-width="110px" align="center">              <template slot-scope="scope">                <span>{{ scope.row.sort }}</span>              </template>            </el-table-column>          </el-table>        </div>        <h2>合成预混料</h2>        <div class="table2" style="margin-bottom: 50px;">          <el-table            :key="detail.tableKey2"            v-loading="detail.listLoading2"            element-loading-text="给我一点时间"            :data="detail.list2"            border            fit            highlight-current-row            style="width: 100%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"          >            <el-table-column label="配方名称" min-width="130px" align="center">              <template slot-scope="scope">                <el-input v-model="scope.row.tname" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" :disabled="detail.disabled" />              </template>            </el-table-column>            <el-table-column label="配方颜色11" min-width="130px" align="center">              <template slot-scope="scope">                <el-color-picker v-model="scope.row.tcolor" size="mini" style="margin:10px 0;" :disabled="detail.disabled" />              </template>            </el-table-column>            <el-table-column label="牲畜类别" min-width="130px" align="center">              <template slot-scope="scope">                <el-select v-model="scope.row.ccid" placeholder="选择牲畜父类" class="filter-item" style="width:95%;padding:10px 0;" :disabled="detail.disabled" @change="changeLivestockType2">                  <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />                </el-select>              </template>            </el-table-column>            <el-table-column label="配方类型" min-width="110px" align="center">              <template slot-scope="scope">                <span>{{ scope.row.fttype }}</span>              </template>            </el-table-column>            <el-table-column label="来源" min-width="110px" align="center">              <template slot-scope="scope">                <span>{{ scope.row.source }}</span>              </template>            </el-table-column>            <el-table-column label="备注" min-width="130px" align="center">              <template slot-scope="scope">                <el-input v-model="scope.row.remark" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" :disabled="detail.disabled" />              </template>            </el-table-column>            <el-table-column label="是否启用" min-width="130px" align="center">              <template slot-scope="scope">                <el-switch v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" :disabled="detail.disabled" />              </template>            </el-table-column>          </el-table>        </div>        <div slot="footer" class="dialog-footer" style="bottom: -50px;">          <el-button class="cancelClose" @click="detail.dialogFormVisible = false; ">关闭</el-button>          <el-button class="success" :disabled="isokDisable" @click="syntheticPremixData()">确认</el-button>        </div>      </div>    </el-dialog>    <!-- 历史记录 -->    <el-dialog :title="textMap[historyRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">      <div class="historyRecord">        <keep-alive>          <component :is="historyRecord.myComponent" ref="historyRecord" />        </keep-alive>      </div>      <div slot="footer" class="dialog-footer" style="bottom: 10px;">        <el-button class="cancelClose" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>      </div>    </el-dialog>  </div></template><script>import { GetDataByName, GetDataByNames, PostDataByName, failproccess, checkButtons, ExecDataByConfig, formatNum } from '@/api/common'import Sortable from 'sortablejs'import { MessageBox } from 'element-ui'import Cookies from 'js-cookie'import { json2excel } from '@/utils/index.js'import { getToken } from '@/utils/auth'import { parseTime } from '@/utils/index.js'export default {  name: 'RecipeTemplate',  data() {    return {      isFormula: [],      requestParams: [        { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] },        { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['配方类型'] },        { name: 'getFeedAndPre', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}      ],      enableList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否启用      lockBullsList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否锁定牛头数比例      livestockTypeList: [], // 牲畜类别      formulaTypeList: [], // 配方类型      feedNameList: [], // 饲料名称      mixingDelayList: [{ id: '0', name: '0' }, { id: '1', name: '1' }, { id: '2', name: '2' }, { id: '3', name: '3' }, { id: '4', name: '4' }, { id: '5', name: '5' }, { id: '6', name: '6' }, { id: '7', name: '7' }, { id: '8', name: '8' }, { id: '9', name: '9' }, { id: '10', name: '10' }, { id: '11', name: '11' }, { id: '12', name: '12' }, { id: '13', name: '13' }, { id: '14', name: '14' }, { id: '15', name: '15' }], // 搅拌延时      selectHistoryTimeList: [{ id: 0, name: '2020-06-10' }, { id: 1, name: '2020-06-11' }, { id: 2, name: '2020-06-12' }, { id: 3, name: '2020-06-13' }], // 请选择历史记录时间      sourceList: [{ id: 0, name: '自定义' }, { id: 1, name: '集团下发' }, { id: 2, name: '导入' }], // 导入      arrowDown: true,      arrowUp: false,      table: {        getdataListParm: {          name: 'getFTList',          page: 1,          offset: 1,          pagecount: 30,          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            tname: '',            ccid: '',            ccname: '',            fttypeid: '',            fttype: '',            remark: '',            enable: ''          }        },        tableKey: 0,        list: [],        total: 0,        listLoading: true,        temp: {}      },      lockCount: {        getdataListParm: {          name: 'getSysoptEnable',          page: 1,          offset: 1,          pagecount: 30,          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            inforname: 'isLockCount'          }        },        isLockCount: false // 是否显示是否锁定牛头数比例      },      isDetail: false,      arrowDown2: true,      arrowUp2: false,      table2: {        getDryweightParm: {          name: 'getFTdryweight',          page: 1,          offset: 1,          pagecount: 10,          returntype: 'Map',          parammaps: {            pastureid: '',            ftid: ''          }        },        dryweight: '',        getdataListParm: {          name: 'getFTdetailList',          page: 1,          offset: 1,          pagecount: '',          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            fname: '',            feedgroup: '',            fweight: '',            autosecondname: '',            islockcount: '',            sort: ''          }        },        tableKey: 0,        list: [],        total: 0,        listLoading: true,        temp: {}      },      isDetailDialog: false,      template: {        dialogFormVisible: false,        dialogStatus: '',        table: {          getdataListParm: {            name: 'getFTListDate',            page: 1,            offset: 1,            pagecount: 10,            returntype: 'Map',            parammaps: {              pastureid: Cookies.get('pastureid'),              tname: '',              ccid: '',              ccname: '',              fttype: '',              remark: '',              enable: '',              date: '',              source: ''            }          },          tableKey: 0,          total: 0,          listLoading: true,          list: []        },        table2: {          getdataListParm: {            name: 'getFTdetailListDate',            page: 1,            offset: 1,            pagecount: 10,            returntype: 'Map',            parammaps: {              pastureid: Cookies.get('pastureid'),              fname: '',              fweight: '',              islockcount: '',              sort: '',              feedgroup: '',              autosecondname: ''            }          },          tableKey: 0,          total: 0,          listLoading: true,          list: []        },        // 历史日期        getdataDateParm: {          name: 'getFTMaxDate',          page: 1,          offset: 1,          pagecount: 10,          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid')          }        }      },      isOrder: true,      detail: {        dialogFormVisible: false,        dialogStatus: '',        tableKey: 0,        total: 0,        listLoading: true,        list: [],        tableKey2: 0,        total2: 0,        listLoading2: false,        list2: [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }],        getdataListParm: {          name: 'getFTDetailCompare',          page: 1,          offset: 1,          pagecount: 10,          returntype: 'Map',          parammaps: {}        },        list3: [],        disabled: false,        getdataListParm2: {          name: 'getFTCompare',          page: 1,          offset: 1,          pagecount: 10,          returntype: 'Map',          parammaps: {}        }      },      selectList: [],      selectList2: [],      textMap: {        RecipeRecord: '配方记录',        SyntheticPremix: '合成预混料',        historyRecord: '历史记录'      },      requestParam: {},      download: {        getdataListParm: {          name: 'getFTList',          page: 1,          offset: 1,          pagecount: 0,          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            tname: '',            ccid: '',            ccname: '',            fttypeid: '',            fttype: '',            remark: '',            enable: ''          }        },        list: []      },      historyRecord: {        dialogStatus: '',        dialogFormVisible: false      },      isokDisable: false,      rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },      cellStyle: { padding: 0 + 'px' },      dropState: false    }  },  computed: {    // 设置请求头    headers() {      return {        token: getToken()      }    },    uploadData() {      return {        name: '颛孙洋洋-配方模板',        importParams: '配方名称, 牲畜类别, 配方类型, 备注, 是否启用, 饲料组, 饲料名称, 重量(kg), 搅拌延时(min), 是否锁定牛头数比例',        sheetname: 'SheetJS'      }    },    // 设置上传地址    uploadExcelUrl() {      return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'    }  },  mounted() {    document.addEventListener('click', (e) => {      if (this.$refs.selectInput !== undefined) {        if (!this.$refs.selectInput.contains(e.target)) {          this.arrowDown = true          this.arrowUp = false        } else {          this.arrowDown = false          this.arrowUp = true        }      }      if (this.$refs.selectInput2 !== undefined) {        if (!this.$refs.selectInput2.contains(e.target)) {          this.arrowDown2 = true          this.arrowUp2 = false        } else {          this.arrowDown2 = false          this.arrowUp2 = true        }      }    })  },  created() {    this.getList()    this.getButtons()    this.getDownList()    this.getIsLockCount()  },  methods: {    getButtons() {      const Formula = 'FormulationEvaluation'      const isFormula = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Formula)      this.isFormula = isFormula    },    getSummaries(param) {      console.log(param, '====')      const { columns, data } = param      const sums = []      columns.forEach((column, index) => {        if (index === 0) {          sums[index] = '合计'          return        }        const values = data.map(item => Number(item[column.property]))        if (!values.every(value => isNaN(value))) {          sums[index] = values.reduce((prev, curr) => {            const value = Number(curr)            if (!isNaN(value)) {              return prev + curr            } else {              return prev            }          }, 0)          // 后台待发          sums[index] += '(干物质量:' + this.table2.dryweight + ')'        } else {          sums[index] = ''        }      })      return sums    },    getDryWeight() {      GetDataByName(this.table2.getDryweightParm).then(response => {        console.log('table数据', response.data.list)        if (response.data.list !== null) {          this.table2.dryweight = response.data.list[0].dryweight        } else {          this.table2.dryweight = ''        }      })    },    getTemplateTable2Summaries(param) {      console.log(param, '====')      const { columns, data } = param      const sums = []      columns.forEach((column, index) => {        if (index === 0) {          sums[index] = '合计'          return        }        const values = data.map(item => Number(item[column.property]))        if (!values.every(value => isNaN(value))) {          sums[index] = values.reduce((prev, curr) => {            const value = Number(curr)            if (!isNaN(value)) {              return prev + curr            } else {              return prev            }          }, 0)          // 后台待发          sums[index] += '(干物质量:' + this.template.table2.getdataListParm.parammaps.dryweight + ')'        } else {          sums[index] = ''        }      })      return sums    },    // handleHistory() {    //   MessageBox.confirm('是否确认生成历史?', {    //     confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'    //   }).then(() => {    //     this.requestParam.name = 'creatFTdate'    //     this.requestParam.parammaps = {}    //     this.requestParam.parammaps.pastureid = Cookies.get('pastureid')    //     PostDataByName(this.requestParam).then(response => {    //       console.log('生成历史保存发送参数', this.requestParam)    //       if (response.msg !== 'fail') {    //         this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })    //       } else {    //         this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })    //       }    //     })    //   })    // },    getDownList() {      GetDataByNames(this.requestParams).then(response => {        this.livestockTypeList = response.data.getDictByName.list        this.formulaTypeList = response.data.getDictByName2.list        this.feedNameList = response.data.getFeedAndPre.list      })    },    // -------------------模板-----------------------------    getList() {      this.table.listLoading = true      GetDataByName(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.table.list = response.data.list          this.table.pageNum = response.data.pageNum          this.table.pageSize = response.data.pageSize          this.table.total = response.data.total        } else {          this.table.list = []        }        setTimeout(() => {          this.table.listLoading = false        }, 100)      })    },    handleSearch() {      console.log('点击了查询')      this.table.getdataListParm.offset = 1      this.getList()      this.arrowDown = true      this.arrowUp = false    },    handleRefresh() {      console.log('点击了重置')      this.table.getdataListParm.offset = 1      this.table.getdataListParm.parammaps.ccid = ''      this.table.getdataListParm.parammaps.ccname = ''      this.table.getdataListParm.parammaps.fttype = ''      this.table.getdataListParm.parammaps.tname = ''      this.table.getdataListParm.parammaps.remark = ''      this.table.getdataListParm.parammaps.enable = ''      this.table.getdataListParm.parammaps.source = ''      this.getList()    },    // 模板新增    handleCreate() {      console.log('点击了新增')      // 编辑true/不可编辑false      // 新增操true,编辑false,编辑保存false      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, 'enable': 1, 'tname': '', 'tcolor': '#ccc', 'ccid': '', 'ccname': '', 'fttype': '', 'fttypeid': '', 'source': '自定义', 'remark': '' })      console.log(this.table.list)    },    // 畜生类别    changeLivestockType(item) {      this.table.temp.ccname = this.livestockTypeList.find(obj => obj.value === item).label    },    // 配方类型    changeFormulaType(item) {      this.table.temp.fttype = this.formulaTypeList.find(obj => obj.value === item).label    },    createData(row) {      console.log('点击了新增保存', row)      this.table.temp.tname = row.tname      this.table.temp.tcolor = row.tcolor      this.table.temp.ccid = row.ccid      this.table.temp.ccname = this.table.temp.ccname      this.table.temp.fttype = this.table.temp.fttype      this.table.temp.fttypeid = row.fttypeid      this.table.temp.source = row.source      this.table.temp.remark = row.remark      this.table.temp.enable = row.enable      this.table.temp.pastureid = Cookies.get('pastureid')      if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {        this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })        return false      } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {        this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })        return false      } else if (this.table.temp.tname == '') {        this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })        return false      } else if (this.table.temp.ccid == '') {        this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })        return false      } else if (this.table.temp.fttypeid == '') {        this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })        return false      }      const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")      if (pattern.test(this.table.temp.tname)) {        this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })        return false      }      console.log(this.table.temp)      this.isokDisable = true      setTimeout(() => {        this.isokDisable = false      }, 1000)      this.requestParam.name = 'insertFT'      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 {          this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })        }      })    },    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) {      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.ccid = String(row.ccid)      row.fttypeid = String(row.fttypeid)      this.table.temp.ccname = row.ccname      this.table.temp.fttype = row.fttype    },    updateData(row) {      console.log('点击了编辑保存', row)      this.table.temp.tname = row.tname      this.table.temp.tcolor = row.tcolor      this.table.temp.ccid = row.ccid      this.table.temp.fttypeid = row.fttypeid      this.table.temp.source = row.source      this.table.temp.remark = row.remark      this.table.temp.enable = row.enable      this.table.temp.ccname = this.table.temp.ccname      this.table.temp.fttype = this.table.temp.fttype      this.table.temp.pastureid = row.pastureid      this.table.temp.id = row.id      if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {        this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })        return false      } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {        this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })        return false      } else if (this.table.temp.tname == '') {        this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })        return false      } else if (this.table.temp.ccid == '') {        this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })        return false      } else if (this.table.temp.fttypeid == '') {        this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })        return false      }      const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")      if (pattern.test(this.table.temp.tname)) {        this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })        return false      }      console.log(this.table.temp)      this.isokDisable = true      setTimeout(() => {        this.isokDisable = false      }, 1000)      this.requestParam.name = 'updateFT'      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 {          this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })        }      })    },    updateCancel(row) {      console.log('点击了编辑取消')      // 编辑false,不可编辑true      row.Edit = false      row.NoEdit = true      // 新增false,编辑true,编辑保存false      row.isCreate = false      row.isUpdate = true      row.isUpdateSave = false      this.getList()    },    // 删除    handleRowDelete(row) {      console.log('点击了行内删除')      MessageBox.confirm('是否确认删除此信息?', {        confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'      }).then(() => {        this.requestParam.common = { 'returnmap': '0' }        this.requestParam.data = []        this.requestParam.data[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {          pastureid: row.pastureid,          id: row.id        }}        this.requestParam.data[1] = { 'name': 'deleteFT', 'type': 'e', 'parammaps': {          pastureid: row.pastureid,          id: row.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.isDetail = false          }        })      }).catch(() => {        this.$message({ type: 'info', message: '已取消删除' })      })    },    handleSelectionChange(val) {      console.log('勾选数据', val)      this.selectList = val    },    handleDelete() {      console.log('点击了删除')      if (this.selectList.length == 0) {        this.$message({ type: 'error', message: '请选择配方', duration: 2000 })      } else {        MessageBox.confirm('是否确认删除此信息?', {          confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'        }).then(() => {          console.log(this.selectList)          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': 'checkdeleteFT', 'type': 'v', 'parammaps': {            id: '@insertSpotList.id',            pastureid: '@insertSpotList.pastureid'          }}          this.requestParam.data[0].children[1] = { 'name': 'deleteFT', '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()            }          })        })      }    },    // 复制    handleCopy() {      if (this.selectList.length == 0) {        this.$message({ type: 'error', message: '请选择配方', duration: 2000 })      } else {        MessageBox.confirm('是否确认复制此信息?', {          confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'        }).then(() => {          console.log(this.selectList)          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': 'copyFT', 'type': 'e', 'parammaps': {            ftid: '@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()            }          })        })      }    },    // 配方记录    handleRecipeRecord() {      console.log('点击了配方记录')      this.template.dialogStatus = 'RecipeRecord'      this.template.dialogFormVisible = true      this.template.table.getdataListParm.parammaps.ccname = ''      this.template.table.getdataListParm.parammaps.fttype = ''      this.template.table.getdataListParm.parammaps.enable = ''      this.template.table.getdataListParm.parammaps.tname = ''      this.template.table.getdataListParm.parammaps.remark = ''      this.template.table.getdataListParm.parammaps.source = ''      this.template.table.getdataListParm.offset = 1      this.getDateList()      this.isDetailDialog = false    },    // 历史时间    getDateList() {      GetDataByName(this.template.getdataDateParm).then(response => {        console.log('table数据', response.data.list)        if (response.data.list !== null) {          this.template.table.getdataListParm.parammaps.date = response.data.list[0].maxdate          this.getTemplateDialogList()        } else {          this.template.table.getdataListParm.parammaps.date = ''        }      })    },    // 配方记录-模板    getTemplateDialogList() {      this.template.table.listLoading = true      GetDataByName(this.template.table.getdataListParm).then(response => {        console.log('table数据', response.data.list)        if (response.data.list !== null) {          this.template.table.list = response.data.list          this.template.table.pageNum = response.data.pageNum          this.template.table.pageSize = response.data.pageSize          this.template.table.total = response.data.total        } else {          this.template.table.list = []        }        setTimeout(() => {          this.template.table.listLoading = false        }, 100)      })    },    handleDialogSearch() {      this.template.table.getdataListParm.offset = 1      this.getTemplateDialogList()      this.arrowDown = true      this.arrowUp = false    },    handleDialogRefresh() {      this.template.table.getdataListParm.parammaps.ccname = ''      this.template.table.getdataListParm.parammaps.fttype = ''      this.template.table.getdataListParm.parammaps.enable = ''      this.template.table.getdataListParm.parammaps.tname = ''      this.template.table.getdataListParm.parammaps.remark = ''      this.template.table.getdataListParm.parammaps.source = ''      this.template.table.getdataListParm.offset = 1      this.getTemplateDialogList()    },    // 配方记录-模板行点击    tableRowClickDialog(row, column, event) {      console.log('配方记录-模板行点击')      this.isDetailDialog = true      this.template.table2.getdataListParm.parammaps.date = this.template.table.getdataListParm.parammaps.date      this.template.table2.getdataListParm.parammaps.version = row.version      this.template.table2.getdataListParm.parammaps.ftid = row.id      this.template.table2.getdataListParm.parammaps.dryweight = row.dryweight      this.getDialogList()      this.getDownList()    },    getDialogList() {      this.template.table2.listLoading = true      GetDataByName(this.template.table2.getdataListParm).then(response => {        console.log('table数据', response.data.list)        if (response.data.list !== null) {          this.template.table2.list = response.data.list          this.template.table2.pageNum = response.data.pageNum          this.template.table2.pageSize = response.data.pageSize          this.template.table2.total = response.data.total        } else {          this.template.table2.list = []        }        this.$nextTick(function() {          document.querySelector('#detailDialog2').scrollIntoView()          // window.scrollTo({          //   'top': this.$refs.detailDialog2.clientHeight          // })        })        setTimeout(() => {          this.template.table2.listLoading = false        }, 100)      })    },    handleDialogSearch2() {      console.log('点击了查询')      this.arrowDown2 = true      this.arrowUp2 = false      this.template.table2.getdataListParm.offset = 1      this.getDialogList2()    },    handleDialogRefresh2() {      console.log('点击了重置')      this.template.table2.getdataListParm.parammaps.fname = ''      this.template.table2.getdataListParm.parammaps.feedgroup = ''      this.template.table2.getdataListParm.parammaps.fweight = ''      this.template.table2.getdataListParm.parammaps.autosecondname = ''      this.template.table2.getdataListParm.parammaps.islockcount = '0'      this.template.table2.getdataListParm.parammaps.sort = ''      this.template.table2.getdataListParm.offset = 1      this.getDialogList2()    },    getDialogList2() {      this.template.table2.listLoading = true      GetDataByName(this.template.table2.getdataListParm).then(response => {        console.log('table数据', response.data.list)        if (response.data.list !== null) {          this.template.table2.list = response.data.list          this.template.table2.pageNum = response.data.pageNum          this.template.table2.pageSize = response.data.pageSize          this.template.table2.total = response.data.total        } else {          this.template.table2.list = []        }        this.$nextTick(function() {          window.scrollTo({            'top': this.$refs.templateDialog.clientHeight          })        })        setTimeout(() => {          this.template.table2.listLoading = false        }, 100)      })    },    // 导出    handleExport(item) {      if (item == 1) {        console.log('点击了导出模板')      } else {        console.log('点击了导出数据')        this.download.getdataListParm.name = 'downloadFTList'        this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps        GetDataByName(this.download.getdataListParm).then(response => {          if (response.data.list !== null) {            for (let i = 0; i < response.data.list.length; i++) {              if (response.data.list[i].islockcount == 0) {                this.$set(response.data.list[i], 'islockcount', '否')              } else {                this.$set(response.data.list[i], 'islockcount', '是')              }              if (response.data.list[i].enable == 0) {                this.$set(response.data.list[i], 'enable', '否')              } else {                this.$set(response.data.list[i], 'enable', '是')              }            }            this.download.list = response.data.list          } else {            this.download.list = []          }          var excelDatas = [            {              tHeader: ['配方名称', '牲畜类别', '配方类型', '来源', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '顺序'],              filterVal: ['tname', 'ccname', 'fttype', 'source', 'remark', 'enable', 'feedgroup', 'fname', 'fweight', 'autosecond', 'islockcount', 'sort'],              tableDatas: this.download.list,              sheetName: 'Sheet1'            }          ]          json2excel(excelDatas, '配方模板', true, 'xlsx')        })      }    },    beforeImport(file) {      const isLt2M = file.size / 1024 / 1024 < 2      if (!isLt2M) {        this.$message.error('上传文件大小不能超过 2MB!')      }      return isLt2M    },    handleImportSuccess(res, file) {      this.getList()      if (res.msg === 'ok') {        this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })        if (res.data.err_count > 0) {          this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })           import('@/vendor/Export2Excel').then(excel => {             const list1 = res.data.result             const tHeader = [               '配方名称', '牲畜类别', '配方类型', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '错误信息'             ]             const filterVal = [               '配方名称', '牲畜类别', '配方类型', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', 'error_msg'             ]             const data1 = this.formatJson(filterVal, list1)             excel.export_json_to_excel({ header: tHeader, data: data1, filename: '配方模板导入报错信息', autoWidth: true, bookType: 'xlsx' })           })        }      } else {        this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })      }    },    formatJson(filterVal, jsonData) {      return jsonData.map(v =>        filterVal.map(j => {          if (j === 'timestamp') {            return parseTime(v[j])          } else {            return v[j]          }        })      )    },    changeDate() {      this.getTemplateDialogList()    },    // 应用    handleApplication() {      console.log('点击了应用')      MessageBox.confirm('是否确认将' + this.template.table.getdataListParm.parammaps.date + '的数据应用到当前?', {        confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'      }).then(() => {        this.requestParam.name = 'applyFTdate'        this.requestParam.parammaps = {}        this.requestParam.parammaps.pastureid = Cookies.get('pastureid')        this.requestParam.parammaps.date = this.template.table.getdataListParm.parammaps.date        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.getTemplateDialogList()            this.getList()          }        })      }).catch(() => {        this.$message({ type: 'info', message: '已取消应用' })      })    },    // 模板行点击    tableRowClick(row, column, event) {      console.log(row, column, event)      for (let i = 0; i < this.table.list.length; i++) {        if (this.table.list[i].Edit == true) {          return false        }      }      console.log(this.isOrder)      if (this.isOrder == false) {        this.$message({ type: 'error', message: '请保存或取消当前更改顺序操作', duration: 2000 })      } else {        if (column.label !== '操作') {          this.isDetail = true // 点击行显示详情          this.table2.getdataListParm.parammaps.ftid = row.id          this.table2.getdataListParm.parammaps.fttypeid = row.fttypeid          this.table2.getdataListParm.parammaps.dryweight = row.dryweight          if (row.fttype == '预混配方') {            this.requestParams[2].parammaps.type = '1'          }          this.getList2()          this.getDownList()        }      }    },    // -------------------详情-----------------------------    // 获取是否显示是否锁定牛头数    getIsLockCount() {      GetDataByName(this.lockCount.getdataListParm).then(response => {        console.log(response.data.list)        if (response.data.list[0].inforvalue == 0) {          this.lockCount.isLockCount = false        } else {          this.lockCount.isLockCount = true        }      })    },    // 详情    getList2() {      this.table2.listLoading = true      GetDataByName(this.table2.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], 'groupEdit', false) // 饲料组编辑            this.$set(response.data.list[i], 'isGroupDisabled', false) // 饲料组编辑禁止编辑            this.$set(response.data.list[i], 'groupNoEdit', 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) // 编辑保存            console.log(this.table2.getdataListParm.parammaps)            console.log(this.table2, '===')          }          this.table2.getDryweightParm.parammaps = this.table2.getdataListParm.parammaps          this.getDryWeight()          this.table2.list = response.data.list          this.table2.pageNum = response.data.pageNum          this.table2.pageSize = response.data.pageSize          this.table2.total = response.data.total        } else {          this.table2.list = []        }        this.$nextTick(function() {          console.log(this.$refs)          console.log(this.$refs.template.clientHeight)          window.scrollTo({            'top': this.$refs.template.clientHeight          })        })        setTimeout(() => {          this.table2.listLoading = false        }, 100)      })    },    // 行拖拽    rowDrop() {      console.log(1111)      console.log(document.querySelector('#table2 .el-table__body-wrapper tbody'))      const tbody = document.querySelector('#table2 .el-table__body-wrapper tbody')      // this.sorTable()      const that = this      // Sortable.create(tbody, {      var sortable = Sortable.create(tbody, {        disabled: that.dropState,        onChoose({ newIndex, oldIndex }) {          console.log(that.isOrder, 'that.isOrder == false')          console.log(that.dropState, 'that.dropState')          if (that.dropState == true || that.isOrder == true) {            sortable.destroy()          }        },        onEnd({ newIndex, oldIndex }) {          const currRow = that.table2.list.splice(oldIndex, 1)[0]          that.table2.list.splice(newIndex, 0, currRow)          console.log('索引', newIndex)          console.log('拖动数据', currRow)          console.log('上', that.table2.list[newIndex - 1])          console.log('下', that.table2.list[newIndex + 1])          if (that.table2.list[newIndex - 1] === undefined) { // 拖动至最上方无值 // 顺序等于0,其他+1 // 饲料组等于饲料名称            for (let i = 0; i < that.table2.list.length; i++) {              that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1 // 其他的顺序+1            }            currRow.sort = 0            currRow.feedgroup = currRow.fname            console.log('拖动至最上方无值')          } else if (currRow.sort == that.table2.list[newIndex - 1].sort) { // 拖动值顺序等于上值顺序            currRow.sort = that.table2.list[newIndex - 1].sort            console.log('拖动值顺序等于上值顺序')          } else if (that.table2.list[newIndex + 1] == undefined) { // 拖动至最下方无值 // 顺序等于上方顺序+1 // 饲料组等于饲料名称            currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1            currRow.feedgroup = currRow.fname            console.log('拖动至最下方无值')          } else if (currRow.sort == that.table2.list[newIndex + 1].sort) { // 拖动值顺序等于下值顺序            currRow.sort == that.table2.list[newIndex + 1].sort            console.log('拖动值顺序等于下值顺序')          } else if (that.table2.list[newIndex - 1].sort == that.table2.list[newIndex + 1].sort) { // 拖动至上下顺序一致,顺序/饲料组与上下保持一致            currRow.sort = that.table2.list[newIndex - 1].sort            currRow.feedgroup = that.table2.list[newIndex - 1].feedgroup            console.log('拖动至上下顺序一致')          } else if (that.table2.list[newIndex - 1].sort !== undefined && that.table2.list[newIndex + 1].sort !== undefined) { // 拖动至上下都有值            console.log('上下')            if (parseInt(that.table2.list[newIndex - 1].sort) + 1 == that.table2.list[newIndex + 1].sort) {              console.log(newIndex)              for (let i = newIndex; i < that.table2.list.length; i++) {                that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1              }            }            currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1            currRow.feedgroup = currRow.fname            console.log(that.table2.list[newIndex + 1].sort)          }        }      })      console.log(sortable.option('disabled'))    },    handleChangeOrder() {      this.isOrder = false      this.rowDrop()    },    saveChangeOrder() {      // 保存顺序      console.log(this.table2.list)      this.requestParam = {}      this.requestParam.common = { 'returnmap': '0' }      this.requestParam.data = []      this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table2.list }}      this.requestParam.data[0].children = []      this.requestParam.data[0].children[0] = { 'name': 'updateFTdetailSort', 'type': 'e', 'parammaps': {        id: '@insertSpotList.id',        pastureid: '@insertSpotList.pastureid',        sort: '@insertSpotList.sort',        feedgroup: '@insertSpotList.feedgroup'      }}      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.getList2()          this.isOrder = true        }      })    },    cancelChangeOrder() {      // 取消顺序      this.getList2()      this.isOrder = true    },    handleSearch2() {      console.log('点击了查询')      this.arrowDown2 = true      this.arrowUp2 = false      this.table2.getdataListParm.offset = 1      this.getList2()    },    handleRefresh2() {      console.log('点击了重置')      this.table2.getdataListParm.parammaps.fname = ''      this.table2.getdataListParm.parammaps.feedgroup = ''      this.table2.getdataListParm.parammaps.fweight = ''      this.table2.getdataListParm.parammaps.autosecondname = ''      this.table2.getdataListParm.parammaps.islockcount = '0'      this.table2.getdataListParm.parammaps.sort = ''      this.table2.getdataListParm.offset = 1      this.getList2()    },    // 详情新增    handleCreate2() {      console.log('点击了详情新增', this.table2.list)      // 编辑true/不可编辑false      // 新增操true,编辑false,编辑保存false      console.log(11)      for (let i = 0; i < this.table2.list.length; i++) {        if (this.table2.list[i].Edit === true) {          console.log(123)          this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })          return false        }      }      console.log(this.table2.list)      if (this.table2.list.length == 0) {        var mysort = 0      } else {        var mysort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1      }      this.table2.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true, 'enable': 1, 'feedgroup': '', 'fid': '', 'fname': '', 'fweight': '', 'autosecond': '0', 'islockcount': '0', 'sort': mysort })      console.log(this.table2.list)    },    changeFname(item, row) {      console.log(item, row)      this.table2.temp.fname = this.feedNameList.find(obj => obj.id == item).fname      row.fname = this.feedNameList.find(obj => obj.id == item).fname      if (this.feedNameList.find(obj => obj.id == item).ispreft == '0') {        this.table2.temp.preftid = '0'      } else {        this.table2.temp.preftid = item      }      if (row.sort == '') {        row.feedgroup = this.table2.temp.fname      } else {        if (row.isCreate == true) { // 新增状态下          for (let i = 1; i < this.table2.list.length; i++) {            if (this.table2.list[i].sort == row.sort) {              console.log(this.table2.list[i])              row.feedgroup = this.table2.list[i].feedgroup              break            } else {              row.feedgroup = this.table2.temp.fname            }          }        } else if (row.isUpdateSave == true) { // 编辑状态下          var Arr = []          for (let i = 0; i < this.table2.list.length; i++) {            Arr.push(this.table2.list[i].sort)          }          var Count = 0          for (let i = 0; i < Arr.length; i++) {            if (Arr[i] == row.sort) {              Count++            }          }          for (let i = 0; i < this.table2.list.length; i++) {            if (Count > 1) {              row.feedgroup = this.table2.list[i].feedgroup              console.log(111, this.table2.list[i].feedgroup)              break            } else if (Count == 1) {              row.feedgroup = this.table2.temp.fname              console.log(222, this.table2.temp.fname)            }          }        }      }    },    bort(row) {      if (row.isCreate == true) {        if (row.sort !== '') {          for (let i = 1; i < this.table2.list.length; i++) {            if (this.table2.list[i].sort == parseInt(row.sort)) {              row.feedgroup = this.table2.list[i].feedgroup              return false            } else {              row.feedgroup = row.fname            }          }        } else {          row.feedgroup = row.fname        }      } else if (row.isUpdateSave == true) {        if (row.sort !== '') {          for (let i = 0; i < this.table2.list.length; i++) {            if (this.table2.list[i].sort == row.sort) {              console.log('失去焦点,行内顺序与表格某顺序相同时', this.table2.list[i])              if (this.table2.list[i].id !== row.id) {                row.isGroupDisabled = true                row.feedgroup = this.table2.list[i].feedgroup                break              }            } else {              console.log('失去焦点,行内顺序与表格某顺序不相同时')              row.isGroupDisabled = true              row.feedgroup = row.fname            }          }        } else {          row.feedgroup = row.fname        }      }    },    createData2(row) {      console.log('点击了详情新增保存', row)      this.table2.temp.pastureid = Cookies.get('pastureid')      this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid      this.table2.temp.fid = row.fid      this.table2.temp.fname = this.table2.temp.fname      this.table2.temp.fweight = row.fweight      this.table2.temp.islockcount = row.islockcount      this.table2.temp.sort = row.sort      this.table2.temp.feedgroup = row.feedgroup      this.table2.temp.preftid = this.table2.temp.preftid      this.table2.temp.autosecond = row.autosecond      if (this.table2.temp.fid == '' && this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {        this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时不能为空', duration: 2000 })        return false      } else if (this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {        this.$message({ type: 'error', message: '重量/搅拌延时不能为空', duration: 2000 })        return false      } else if (this.table2.temp.fid == '') {        this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })        return false      } else if (this.table2.temp.fweight == '') {        this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })        return false      } else if (this.table2.temp.autosecond == '') {        this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })        return false      }      if (this.table2.temp.sort !== '') {        this.table2.temp.sort = this.table2.temp.sort      } else {        console.log(this.table2.list.length)        if (this.table2.list.length == 1) {          this.table2.temp.sort = 0        } else {          this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1          row.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1        }      }      if (this.table2.getdataListParm.parammaps.fttypeid == 2) {        if (parseInt(this.table2.temp.preftid) > 0) {          this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })          return false        }      }      // 校验顺序是否>=0      var ruleSort = /^\d+$/      if (!ruleSort.test(this.table2.temp.sort)) {        this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })        return false      }      // 检验重量>0      // this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 2) //根据默认参数设置小数位数      var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/      if (!ruleWeight.test(this.table2.temp.fweight)) {        this.$message({ type: 'error', message: '重量请输入正数,最多保留俩位小数', duration: 2000 })        return false      }      this.isokDisable = true      setTimeout(() => {        this.isokDisable = false      }, 1000)      this.requestParam.common = { 'returnmap': '0' }      this.requestParam.data = []      this.requestParam.data[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {        pastureid: this.table2.temp.pastureid,        ftid: this.table2.getdataListParm.parammaps.ftid,        fid: row.fid,        fname: this.table2.temp.fname,        fweight: row.fweight,        islockcount: row.islockcount,        sort: row.sort,        feedgroup: row.feedgroup,        preftid: this.table2.temp.preftid,        autosecond: row.autosecond      }}      this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {        pastureid: this.table2.temp.pastureid,        ftid: this.table2.getdataListParm.parammaps.ftid,        type: this.table2.getdataListParm.parammaps.fttypeid      }}      ExecDataByConfig(this.requestParam).then(response => {        console.log('新增保存发送参数', this.requestParam)        if (response.msg !== 'fail') {          this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })          this.getList2()        } else {          this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })        }      })    },    createCancel2(row) {      console.log('点击了详情新增取消')      for (let i = 0; i < this.table2.list.length; i++) {        if (row.myId === this.table2.list[i].myId) {          var listIndex = this.table2.list.indexOf(this.table2.list[i])        }        if (listIndex > -1) {          this.table2.list.splice(listIndex, 1)          return        }      }      this.getDialogList()    },    // 详情编辑    handleUpdate2(row) {      console.log('详情编辑', row)      this.dropState = true      row.isGroupDisabled = false      row.islockcount = String(row.islockcount)      row.fid = String(row.fid)      row.autosecond = String(row.autosecond)      this.table2.temp.fname = row.fname      this.table2.temp.preftid = row.preftid      const rowArr = []      for (let i = 0; i < this.table2.list.length; i++) {        if (this.table2.list[i].Edit == true) {          this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })          return false        }        rowArr.push(this.table2.list[i].sort)      }      var count = 0      for (let i = 0; i < rowArr.length; i++) {        if (rowArr[i] == row.sort) {          count++        }      }      // 判断是否有相同顺序,如果没有饲料组不可编辑,若有饲料组可编辑      if (count == 1) {        // 饲料组编辑false,不可编辑true        row.groupEdit = false        row.groupNoEdit = true        // 编辑true,不可编辑false        row.Edit = true        row.NoEdit = false        // 新增false,编辑false,编辑保存true        row.isCreate = false        row.isUpdate = false        row.isUpdateSave = true      } else if (count > 1) {        // 饲料组编辑true,不可编辑false        row.groupEdit = true        row.groupNoEdit = false        console.log(222)        // 编辑true,不可编辑false        row.Edit = true        row.NoEdit = false        // 新增false,编辑false,编辑保存true        row.isCreate = false        row.isUpdate = false        row.isUpdateSave = true        return false      }    },    updateData2(row) {      console.log('点击了详情编辑保存111', row)      this.isokDisable = true      setTimeout(() => {        this.isokDisable = false      }, 1000)      this.table2.temp.pastureid = row.pastureid      this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid      this.table2.temp.fid = row.fid      this.table2.temp.fname = this.table2.temp.fname      this.table2.temp.fweight = row.fweight      this.table2.temp.islockcount = row.islockcount      this.table2.temp.sort = row.sort      this.table2.temp.feedgroup = row.feedgroup      this.table2.temp.preftid = this.table2.temp.preftid      this.table2.temp.autosecond = row.autosecond      this.table2.temp.id = row.id      if (this.table2.temp.fid == '' && this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {        this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时不能为空', duration: 2000 })        return false      } else if (this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {        this.$message({ type: 'error', message: '重量/搅拌延时不能为空', duration: 2000 })        return false      } else if (this.table2.temp.fid == '') {        this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })        return false      } else if (this.table2.temp.fweight == '') {        this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })        return false      } else if (this.table2.temp.autosecond == '') {        this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })        return false      }      if (this.table2.temp.sort !== '') {        this.table2.temp.sort = this.table2.temp.sort      } else {        this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1      }      if (this.table2.getdataListParm.parammaps.fttypeid == 2) {        if (parseInt(this.table2.temp.preftid) > 0) {          this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })          return false        }      }      // 校验顺序是否>=0      var ruleSort = /^\d+$/      if (!ruleSort.test(this.table2.temp.sort)) {        this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })        return false      }      // this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 2) //根据默认参数设置小数位数      // 检验重量>0      var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/      if (!ruleWeight.test(this.table2.temp.fweight)) {        this.$message({ type: 'error', message: '重量请输入正数,最多保留俩位小数', duration: 2000 })        return false      }      this.requestParam.common = { 'returnmap': '0' }      this.requestParam.data = []      this.requestParam.data[0] = { 'name': 'updateFTdetail', 'type': 'e', 'parammaps': {        pastureid: row.pastureid,        ftid: this.table2.getdataListParm.parammaps.ftid,        fid: row.fid,        fname: this.table2.temp.fname,        fweight: row.fweight,        islockcount: row.islockcount,        sort: row.sort,        feedgroup: row.feedgroup,        preftid: this.table2.temp.preftid,        autosecond: row.autosecond,        id: row.id      }}      this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {        pastureid: row.pastureid,        ftid: this.table2.getdataListParm.parammaps.ftid,        type: this.table2.getdataListParm.parammaps.fttypeid      }}      this.requestParam.data[2] = { 'name': 'updateFTdetailbySort', 'type': 'e', 'parammaps': {        pastureid: row.pastureid,        ftid: this.table2.getdataListParm.parammaps.ftid,        sort: row.sort,        feedgroup: row.feedgroup      }}      ExecDataByConfig(this.requestParam).then(response => {        console.log('新增保存发送参数', this.requestParam)        if (response.msg !== 'fail') {          this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })          this.getList2()          this.dropState = false        } else {          this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })        }      })    },    updateCancel2(row) {      console.log('点击了详情编辑取消')      // 饲料组编辑false,不可编辑true      row.groupEdit = false      row.groupNoEdit = true      // 编辑false,不可编辑true      row.Edit = false      row.NoEdit = true      // 新增false,编辑true,编辑保存false      row.isCreate = false      row.isUpdate = true      row.isUpdateSave = false      this.getList2()      this.dropState = false    },    // 详情删除    handleRowDelete2(row) {      console.log('点击了行内删除')      MessageBox.confirm('是否确认删除此信息?', {        confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'      }).then(() => {        this.requestParam.common = { 'returnmap': '0' }        this.requestParam.data = []        this.requestParam.data[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {          pastureid: row.pastureid,          id: row.id        }}        this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {          pastureid: row.pastureid,          ftid: this.table2.getdataListParm.parammaps.ftid,          type: this.table2.getdataListParm.parammaps.fttypeid        }}        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.getList2()          }        })      }).catch(() => {        this.$message({ type: 'info', message: '已取消删除' })      })    },    handleSelectionChange2(val) {      console.log('勾选数据', val)      this.selectList2 = val    },    handleDelete2() {      console.log('点击了删除')      if (this.selectList2.length == 0) {        this.$message({ type: 'error', message: '请选择配方详情', duration: 2000 })      } else {        MessageBox.confirm('是否确认删除此信息?', {          confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'        }).then(() => {          console.log(this.selectList)          this.requestParam.common = { 'returnmap': '0' }          this.requestParam.data = []          this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList2 }}          this.requestParam.data[0].children = []          this.requestParam.data[0].children[0] = { 'name': 'deleteFTdetail', '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.getList2()            }          })        })      }    },    // 拆分预混料    handleSplitPremix(row) {      console.log('点击了拆分预混料')      MessageBox.confirm('是否确认拆分当前预混料?', {        confirmButtonText: '确认',        cancelButtonText: '取消',        type: 'warning'      }).then(() => {        this.requestParam.name = 'splitFTpre'        this.requestParam.parammaps = {}        this.requestParam.parammaps.ftid = this.table2.getdataListParm.parammaps.ftid        this.requestParam.parammaps.preftid = row.preftid        this.requestParam.parammaps.ftdid = row.id        this.requestParam.parammaps.pastureid = row.pastureid        this.requestParam.parammaps.feedgroup = row.feedgroup        this.requestParam.parammaps.sort = row.sort        this.requestParam.parammaps.fweight = row.fweight        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.getList2()          }        })      }).catch(() => {        this.$message({          type: 'info',          message: '已取消删除'        })      })    },    // 合成预混料    handleSyntheticPremix() {      console.log('点击了合成预混料', this.selectList2)      if (this.table2.getdataListParm.parammaps.fttypeid == 2) {        this.$message({ type: 'error', message: '预混配方不可合成预混料', duration: 2000 })        return false      } else {        if (this.selectList2.length > 1) {          for (let i = 0; i < this.selectList2.length; i++) {            if (parseInt(this.selectList2[i].preftid) > 0) {              this.$message({ type: 'error', message: '不可选择预混料', duration: 2000 })              return false            }          }          if (this.selectList2[0].splitftpreid !== undefined) {            this.detail.getdataListParm.parammaps.ftid = this.selectList2[0].splitftpreid            this.detail.getdataListParm.parammaps.pastureid = this.selectList2[0].pastureid            GetDataByName(this.detail.getdataListParm).then(response => {              if (response.data.list !== null) { // 不为空时得到比对数据                this.detail.list3 = response.data.list                const sortList = [] // 声明排序数组                var fweightSum = 0 // 总重量                for (let i = 0; i < this.selectList2.length; i++) {                  const obj = {}                  obj.fid = this.selectList2[i].fid                  obj.fweight = this.selectList2[i].fweight                  fweightSum = fweightSum + parseFloat(this.selectList2[i].fweight)                  sortList.push(obj)                }                // 排序                sortList.sort(function(a, b) {                  return a.fid.localeCompare(b.fid)                })                var a = 0                if (this.detail.list3.length == sortList.length) {                  for (let i = 0; i < this.detail.list3.length; i++) {                    if (this.detail.list3[i].fid == sortList[i].fid && (this.detail.list3[i].fweight / this.detail.list3[i].sumWeight).toFixed(2) == (sortList[i].fweight / fweightSum).toFixed(2)) {                      a++                    }                  }                  if (a == this.detail.list3.length) { // 如果相等,则该配方为原预混配方                    this.detail.getdataListParm2.parammaps.ftid = this.selectList2[0].splitftpreid                    this.detail.getdataListParm2.parammaps.pastureid = this.selectList2[0].pastureid                    GetDataByName(this.detail.getdataListParm2).then(response => {                      if (response.data.list !== null) {                        this.detail.dialogStatus = 'SyntheticPremix'                        this.detail.dialogFormVisible = true                        this.detail.list = this.selectList2                        this.detail.list2 = response.data.list                        this.detail.disabled = true                        setTimeout(() => {                          this.detail.listLoading = false                        }, 100)                      } else {                        this.detail.list2 = []                      }                    })                  } else {                    this.detail.dialogStatus = 'SyntheticPremix'                    this.detail.dialogFormVisible = true                    this.detail.list = this.selectList2                    this.detail.disabled = false                    this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]                    setTimeout(() => {                      this.detail.listLoading = false                    }, 100)                  }                } else {                  this.detail.dialogStatus = 'SyntheticPremix'                  this.detail.dialogFormVisible = true                  this.detail.list = this.selectList2                  this.detail.disabled = false                  this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]                  setTimeout(() => {                    this.detail.listLoading = false                  }, 100)                }              } else {                this.detail.list3 = []                this.detail.dialogStatus = 'SyntheticPremix'                this.detail.dialogFormVisible = true                this.detail.list = this.selectList2                this.detail.disabled = false                this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]                setTimeout(() => {                  this.detail.listLoading = false                }, 100)              }            })          } else {            this.detail.dialogStatus = 'SyntheticPremix'            this.detail.dialogFormVisible = true            this.detail.list = this.selectList2            this.detail.disabled = false            this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]            setTimeout(() => {              this.detail.listLoading = false            }, 100)          }        } else {          this.$message({ type: 'error', message: '请选择俩条及以上饲料进行合成', duration: 2000 })          return false        }      }    },    // 畜生类别    changeLivestockType2(item) {      this.detail.list2[0].ccname = this.livestockTypeList.find(obj => obj.value === item).label    },    syntheticPremixData() {      console.log('点击了合成预混料确认')      if (this.detail.disabled == true) { // 原预混料        let sumFweight = 0        for (let i = 0; i < this.detail.list.length; i++) {          sumFweight += parseFloat(this.detail.list[i].fweight)        }        sumFweight = sumFweight.toFixed(2)        this.isokDisable = true        setTimeout(() => {          this.isokDisable = false        }, 1000)        this.requestParam.common = { 'returnmap': '0' }        this.requestParam.data = []        this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}        this.requestParam.data[0].children = []        this.requestParam.data[0].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {          pastureid: '@insertSpotList.pastureid',          id: '@insertSpotList.id'        }}        this.requestParam.data[1] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}        this.requestParam.data[1].children = []        this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {          pastureid: Cookies.get('pastureid'),          ftid: this.table2.getdataListParm.parammaps.ftid,          fid: this.detail.list2[0].id,          fname: '@insertSpotList2.tname',          fweight: sumFweight,          islockcount: '0',          sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,          feedgroup: '@insertSpotList2.tname',          preftid: this.detail.list2[0].id,          autosecond: this.detail.list[0].autosecond        }}        ExecDataByConfig(this.requestParam).then(response => {          console.log('合成预混料保存发送参数', this.requestParam)          if (response.msg === 'fail') {            const tname = new RegExp("key 'tname'")            if (tname.test(response.data)) {              this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })            } else {              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })            }          } else {            this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })            this.detail.dialogFormVisible = false            this.getList()            this.getList2()            this.getDownList()          }        })      } else { // 现生成预混料        if (this.detail.list2[0].tname == '' && this.detail.list2[0].ccid == '') {          this.$message({ type: 'error', message: '配方名称/牲畜类别/不能为空', duration: 2000 })          return false        } else if (this.detail.list2[0].tname == '') {          this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })          return false        } else if (this.detail.list2[0].ccid == '') {          this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })          return false        }        const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")        if (pattern.test(this.detail.list2[0].tname)) {          this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })          return false        }        let sumFweight = 0        for (let i = 0; i < this.detail.list.length; i++) {          sumFweight += parseFloat(this.detail.list[i].fweight)        }        sumFweight = sumFweight.toFixed(2)        console.log(sumFweight)        this.isokDisable = true        setTimeout(() => {          this.isokDisable = false        }, 1000)        if (this.detail.list2[0].tcolor == null) {          this.detail.list2[0].tcolor = '#CCCCCC'        }        this.requestParam.common = { 'returnmap': '0' }        this.requestParam.data = []        this.requestParam.data[0] = { 'name': 'insertFT', 'type': 'e', 'parammaps': {          pastureid: Cookies.get('pastureid'),          tcode: this.detail.list2[0].tcode,          tname: this.detail.list2[0].tname,          tcolor: this.detail.list2[0].tcolor,          ccid: this.detail.list2[0].ccid,          ccname: this.detail.list2[0].ccname,          fttype: this.detail.list2[0].fttype,          fttypeid: this.detail.list2[0].fttypeid,          source: this.detail.list2[0].source,          remark: this.detail.list2[0].remark,          enable: this.detail.list2[0].enable        }}        this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}        this.requestParam.data[1].children = []        this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {          pastureid: '@insertSpotList.pastureid',          ftid: '@insertFT.LastInsertId',          fid: '@insertSpotList.fid',          fname: '@insertSpotList.fname',          fweight: '@insertSpotList.fweight',          islockcount: '@insertSpotList.islockcount',          sort: '@insertSpotList.sort',          feedgroup: '@insertSpotList.feedgroup',          preftid: '@insertSpotList.preftid',          autosecond: '@insertSpotList.autosecond'        }}        this.requestParam.data[1].children[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {          pastureid: '@insertSpotList.pastureid',          id: '@insertSpotList.id'        }}        this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}        this.requestParam.data[2].children = []        this.requestParam.data[2].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {          pastureid: Cookies.get('pastureid'),          ftid: this.table2.getdataListParm.parammaps.ftid,          fid: '@insertFT.LastInsertId',          fname: '@insertSpotList2.tname',          fweight: sumFweight,          islockcount: '0',          sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,          feedgroup: '@insertSpotList2.tname',          preftid: '@insertFT.LastInsertId',          autosecond: this.detail.list[0].autosecond        }}        ExecDataByConfig(this.requestParam).then(response => {          console.log('合成预混料保存发送参数', this.requestParam)          if (response.msg === 'fail') {            const tname = new RegExp("key 'tname'")            if (tname.test(response.data)) {              this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })            } else {              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })            }          } else {            this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })            this.detail.dialogFormVisible = false            this.getList()            this.getList2()            this.getDownList()          }        })      }    },    handleFormulationEvaluation(row) {      console.log(row)      this.$router.push({ path: '/statisticalAnalysis/FormulationEvaluation', query: { tname: row.tname }})      this.$router.push({        name: 'FormulationEvaluation',        params: {          tname: row.tname,          ftid: row.id,          pastureid: row.pastureid,          startTime: parseTime(new Date(), '{y}-{m}-{d}'),          inputDatetime: [new Date('startTime'), new Date('startTime')], // 日期后台待传          stopTime: parseTime(new Date(), '{y}-{m}-{d}')        }      })    }  }}</script><style lang="scss" scoped>  .search{margin-top:10px;}  .table{margin-top:10px;}  .table2{margin-top:10px;}  $width:350px;  $left:325px;  .selectInput{    position: relative;    display: inline-block;    .Input{width: $width;position: relative;}    .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}    .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}    .selectUl{      z-index: 111;width: $width;background: #fff;border: 1px solid #E4E7ED;box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);margin: -1px 0 0 0;padding: 6px 0; margin: 0;box-sizing: border-box;position: absolute;      li{        list-style: none;font-size: 14px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #606266; height: 50px; line-height: 50px; box-sizing: border-box; cursor: pointer;        a{float:left;width: 80px;}        a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}      }    }  }  .template{    background: #fff;    position: relative;  }  .detail{    background: #fff;    position: relative;  }  .templateDialog{    background: #fff;    position: relative;  } .detailDialog{    background: #fff;    position: relative;  } </style>
 |