1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504 |
- <template>
- <div class="app-container">
- <div class="search">
- <el-input v-model="table.getdataListParm.parammaps.fname" placeholder="饲料名称" style="width: 130px;" class="filter-item" clearable />
- <el-select v-model="table.getdataListParm.parammaps.fclassid" filterable placeholder="饲料类别" class="filter-item" style="width: 150px;" clearable>
- <el-option v-for="item in feedTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
- </el-select>
- <el-select v-model="table.getdataListParm.parammaps.source" filterable placeholder="饲料来源" class="filter-item" style="width: 120px;" clearable>
- <el-option v-for="item in feedSourcesList" :key="item.id" :label="item.name" :value="item.id" />
- </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" 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="table.getdataListParm.parammaps.allowratio"type="text" style="width: 245px;" /></li>
- <li><a>跳转重量域</a><el-input v-model="table.getdataListParm.parammaps.autozone" type="text" style="width: 245px;" /></li>
- <li>
- <a>跳转延时</a>
- <el-select v-model="table.getdataListParm.parammaps.autosecond" filterable placeholder="跳转延时" class="filter-item" style="width: 245px;" clearable>
- <el-option v-for="item in jumpDelayList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </li>
- <li>
- <div style="float: right;">
- <el-button class="downminCancel" @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="operation">
- <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新增</el-button>
- <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" @click="handleDelete">删除</el-button>
- <el-button class="success" icon="el-icon-receiving" @click="handleFeedBank">饲料库</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: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" align="center" width="50" fixed="left" />
- <el-table-column label="序号" align="center" type="index" width="50px" fixed="left">
- <template slot-scope="scope">
- <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="饲料名称" min-width="80px" align="center" fixed="left">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="饲料分类" min-width="80px" align="center" fixed="left">
- <template slot-scope="scope">
- <span>{{ scope.row.fclass }}</span>
- </template>
- </el-table-column>
- <el-table-column label="唯一编码" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.feedcode }}</span>
- </template>
- </el-table-column>
- <el-table-column label="饲料来源" min-width="80px" 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.printgroup }}</span>
- </template>
- </el-table-column>
- <el-table-column v-if="isInforvalue" label="小料秤" min-width="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.smtmrname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="允许误差数(kg)" min-width="85px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.allowratio }}</span>
- </template>
- </el-table-column>
- <el-table-column label="包装单位重量(kg)" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.unitweight }}</span>
- </template>
- </el-table-column>
- <el-table-column label="单价" min-width="50px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.uprice }}</span>
- </template>
- </el-table-column>
- <el-table-column label="跳转重量域(kg)" min-width="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.autozone }}</span>
- </template>
- </el-table-column>
- <el-table-column label="跳转延时" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.autosecondname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="确认开始" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.confirmstartname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="继电器位置" min-width="60px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.trgaddress }}</span>
- </template>
- </el-table-column>
- <el-table-column label="无上域" min-width="60px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.jmp == 0">否</span>
- <span v-else>是</span>
- </template>
- </el-table-column>
- <el-table-column label="备用字段01" min-width="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.backup1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="备用字段02" min-width="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.backup2 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="备用字段03" min-width="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.backup3 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="是否启用" min-width="80px" 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-column label="操作" align="center" width="180" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <a class="correcting" @click="handleNutritive (row)">营养价值</a>
- <span class="centerSpan">|</span>
- <a v-if="isRoleEdit" class="correcting" @click="handleRelation(row)">关联</a>
- <span v-if="isRoleEdit" class="centerSpan">|</span>
- <el-button v-if="isRoleEdit" icon="el-icon-edit-outline" class="miniSuccess" @click="handleUpdate(row)" />
- <span v-if="isRoleEdit" class="centerSpan">|</span>
- <el-button v-if="isRoleEdit" icon="el-icon-delete" class="miniDanger" @click="handleRowDelete(row)" />
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
- </div>
- <!-- 新增/编辑 -->
- <el-dialog :fullscreen="dialogFull" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="90%">
- <template slot="title">
- <div class="avue-crud__dialog__header">
- <span class="el-dialog__title">
- <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
- {{ textMap[create.dialogStatus] }}
- </span>
- <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
- <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
- <svg-icon v-else icon-class="fullscreen" />
- </div>
- </div>
- </template>
- <div class="app-add">
- <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
- <el-row>
- <el-col :span="24">
- <h3 style="width: 160px;text-align: right;">基础信息</h3>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="6">
- <el-form-item label="饲料名称:" prop="fname">
- <el-input ref="fname" v-model="create.temp.fname" class="filter-item" placeholder="请输入饲料名称" type="textarea" :autosize="{ minRows:1}" maxlength="32" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="饲料类别:" prop="fclassid">
- <el-select v-model="create.temp.fclassid" filterable placeholder="饲料类别" class="filter-item" style="width: 100%;" @change="changeFeedList">
- <el-option v-for="item in feedTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
- </el-select>
- </el-form-item></el-col>
- <el-col :span="6">
- <el-form-item label="唯一编码:" prop="feedcode">
- <el-input ref="feedcode" v-model="create.temp.feedcode" class="filter-item" placeholder="请输入唯一编码" type="text" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="饲料来源:" prop="source">
- <el-input ref="source" v-model="create.temp.source" class="filter-item" disabled placeholder="用户自定义" type="text" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="6">
- <el-form-item label="计划类型:" prop="printgroupid">
- <el-select v-model="create.temp.printgroupid" filterable placeholder="计划类型" class="filter-item" style="width: 100%;" @change="changePlanList">
- <el-option v-for="item in planTypeList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="包装单位重量(kg):" prop="unitweight">
- <el-input ref="unitweight" v-model="create.temp.unitweight" class="filter-item" placeholder="正整数" type="number" style="width: 100%;" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="单价:" prop="uprice">
- <el-input ref="uprice" v-model="create.temp.uprice" v-limit class="filter-item" placeholder="最多俩位小数" type="number" step="0.01" style="width: 100%;" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <h3 style="width: 160px;text-align: right;">搅拌参数</h3>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="6">
- <el-form-item label="允许误差数(kg):" prop="allowratio">
- <el-input ref="allowratio" v-model="create.temp.allowratio" class="filter-item" placeholder="正整数" type="text" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="跳转重量域(kg):" prop="autozone">
- <el-input ref="autozone" v-model="create.temp.autozone" :disabled="create.temp.autosecond=='0'" class="filter-item" placeholder="0-50之间的整数" type="text" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="跳转延时:" prop="autosecond">
- <el-select v-model="create.temp.autosecond" filterable placeholder="跳转延时" class="filter-item" style="width: 100%;" @change="changeAutosecond">
- <el-option v-for="item in jumpDelayList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="确认开始:" prop="confirmstart">
- <el-select v-model="create.temp.confirmstart" filterabler placeholde="确认开始" class="filter-item" style="width: 100%;" @change="changeConfirmstart">
- <el-option v-for="item in confirmStartList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="6">
- <el-form-item label="是否启用:" prop="enable">
- <el-select v-model="create.temp.enable" filterable placeholder="是否启用" class="filter-item" style="width: 100%;">
- <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="继电器位置:" prop="trgaddress">
- <el-input ref="trgaddress" v-model="create.temp.trgaddress" class="filter-item" placeholder="继电器位置" type="number" />
- </el-form-item>
- </el-col>
- <el-col v-if="isInforvalue" :span="6">
- <el-form-item label="小料秤:" prop="smtmrid">
- <el-select v-model="create.temp.smtmrid" filterable placeholder="小料秤" clearable class="filter-item" style="width: 100%;" @change="changeSmallMaterial">
- <el-option v-for="item in smallMaterialList" :key="item.id" :label="item.tname" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="无上域:" prop="jmp">
- <el-select v-model="create.temp.jmp" placeholder="无上域" class="filter-item" style="width: 100%;" @change="changeSmallMaterial">
- <el-option v-for="item in jmpList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <h3 style="width: 160px;text-align: right;">备用字段</h3>
- </el-row>
- <el-row>
- <el-col :span="6">
- <el-form-item label="备用字段01:" prop="backup1">
- <el-input ref="backup1" v-model="create.temp.backup1" class="filter-item" placeholder="备用字段01" type="text" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="备用字段02:" prop="backup2">
- <el-input ref="backup2" v-model="create.temp.backup2" class="filter-item" placeholder="备用字段02" type="text" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="备用字段03:" prop="backup3">
- <el-input ref="backup3" v-model="create.temp.backup3" class="filter-item" placeholder="备用字段03" type="text" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button class="cancelClose" @click="create.dialogFormVisible = false;getList()">关闭</el-button>
- <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="save" :disabled="isokDisable" @click="create.dialogStatus==='create'?createData():updateData()">确认</el-button>
- </div>
- </div>
- </el-dialog>
- <!-- 饲料库 -->
- <el-dialog :fullscreen="dialogFull" :visible.sync="feedBank.dialogFormVisible" :close-on-click-modal="false" width="90%">
- <template slot="title">
- <div class="avue-crud__dialog__header">
- <span class="el-dialog__title">
- <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
- {{ textMap[feedBank.dialogStatus] }}
- </span>
- <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
- <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
- <svg-icon v-else icon-class="fullscreen" />
- </div>
- </div>
- </template>
- <div class="app-add">
- <div class="search">
- <el-input v-model="feedBank.getdataListParm.parammaps.fname" placeholder="饲料名称" style="width: 130px;" class="filter-item" clearable />
- <el-select v-model="feedBank.getdataListParm.parammaps.statue" filterabler placeholder="关联状态" class="filter-item" style="width: 120px;" clearable>
- <el-option v-for="item in associationStatusList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- <el-button class="successBorder" @click="handleFeedBankSearch">查询</el-button>
- <el-button class="successBorder" @click="handleFeedBankRefresh">重置</el-button>
- </div>
- <div class="table">
- <el-table
- :key="feedBank.tableKey"
- v-loading="feedBank.listLoading"
- element-loading-text="给我一点时间"
- :data="feedBank.list"
- border
- fit
- highlight-current-row
- style="width: 100%;margin: 0 auto 50px;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" align="center" type="index" width="50px" />
- <el-table-column label="来源" min-width="50" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sources }}</span>
- </template>
- </el-table-column>
- <el-table-column label="中国饲料号" min-width="70px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.feedcode }}</span>
- </template>
- </el-table-column>
- <el-table-column label="饲料名称" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="价格" min-width="50px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.price }}</span>
- </template>
- </el-table-column>
- <el-table-column label="样品说明" min-width="50px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.remark }}</span>
- </template>
- </el-table-column>
- <el-table-column label="干物质(DM%)" min-width="65px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.dry }}</span>
- </template>
- </el-table-column>
- <el-table-column label="淀粉(%DM)" min-width="59px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.starch }}</span>
- </template>
- </el-table-column>
- <el-table-column label="粗蛋白(CP%DM)" min-width="70px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.cp }}</span>
- </template>
- </el-table-column>
- <el-table-column label="钙(Ca%DM)" min-width="85px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ca }}</span>
- </template>
- </el-table-column>
- <el-table-column label="磷(P%DM)" min-width="85px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.p }}</span>
- </template>
- </el-table-column>
- <el-table-column label="产奶净能(%DM)" min-width="75px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.n }}</span>
- </template>
- </el-table-column>
- <el-table-column label="脂肪(%DM)" min-width="59px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fat }}</span>
- </template>
- </el-table-column>
- <el-table-column label="ADF(%DM)" min-width="60px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.adf }}</span>
- </template>
- </el-table-column>
- <el-table-column label="NDF(%DM)" min-width="60px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ndf }}</span>
- </template>
- </el-table-column>
- <el-table-column label="NDIP%" min-width="70px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ndip }}</span>
- </template>
- </el-table-column>
- <el-table-column label="粗灰分(Ash%)" min-width="65px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ash }}</span>
- </template>
- </el-table-column>
- <el-table-column label="粗料" min-width="50px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.iscu }}</span>
- </template>
- </el-table-column>
- <el-table-column label="关联状态" min-width="50px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.statue==0">否</span>
- <span v-if="scope.row.statue==1">是</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button class="cancelClose cancelClose1" @click="feedBank.dialogFormVisible = false; ">关闭</el-button>
- </div>
- </div>
- </el-dialog>
- <!-- 关联 -->
- <el-dialog :fullscreen="dialogFull" :visible.sync="relation.dialogFormVisible" :close-on-click-modal="false" width="90%">
- <template slot="title">
- <div class="avue-crud__dialog__header">
- <span class="el-dialog__title">
- <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
- {{ textMap[relation.dialogStatus] }}
- </span>
- <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
- <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
- <svg-icon v-else icon-class="fullscreen" />
- </div>
- </div>
- </template>
- <div class="app-add">
- <div class="search">
- <el-input v-model="relation.getdataListParm.parammaps.fname" placeholder="饲料名称" style="width: 130px;" class="filter-item" clearable />
- <el-button class="successBorder" @click="handleRelationSearch">查询</el-button>
- </div>
- <div class="table">
- <el-table
- :key="relation.tableKey"
- v-loading="relation.listLoading"
- element-loading-text="给我一点时间"
- :data="relation.list"
- border
- fit
- highlight-current-row
- style="width: 100%;margin: 0 auto 50px;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" align="center" type="index" width="50px" />
- <el-table-column label="来源" min-width="50" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sources }}</span>
- </template>
- </el-table-column>
- <el-table-column label="中国饲料号" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.feedcode }}</span>
- </template>
- </el-table-column>
- <el-table-column label="饲料名称" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="价格" min-width="50px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.price }}</span>
- </template>
- </el-table-column>
- <el-table-column label="样品说明" min-width="50px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.remark }}</span>
- </template>
- </el-table-column>
- <el-table-column label="干物质(DM%)" min-width="65px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.dry }}</span>
- </template>
- </el-table-column>
- <el-table-column label="淀粉(%DM)" min-width="59px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.starch }}</span>
- </template>
- </el-table-column>
- <el-table-column label="粗蛋白(CP%DM)" min-width="75px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.cp }}</span>
- </template>
- </el-table-column>
- <el-table-column label="钙(Ca%DM)" min-width="83px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ca }}</span>
- </template>
- </el-table-column>
- <el-table-column label="磷(P%DM)" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.p }}</span>
- </template>
- </el-table-column>
- <el-table-column label="产奶净能(%DM)" min-width="75px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.n }}</span>
- </template>
- </el-table-column>
- <el-table-column label="脂肪(%DM)" min-width="59px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fat }}</span>
- </template>
- </el-table-column>
- <el-table-column label="ADF(%DM)" min-width="60px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.adf }}</span>
- </template>
- </el-table-column>
- <el-table-column label="NDF(%DM)" min-width="60px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ndf }}</span>
- </template>
- </el-table-column>
- <el-table-column label="NDIP%" min-width="70px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ndip }}</span>
- </template>
- </el-table-column>
- <el-table-column label="粗灰分(Ash%)" min-width="65px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ash }}</span>
- </template>
- </el-table-column>
- <el-table-column label="粗料" min-width="50px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.iscu }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" min-width="50px" align="center" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <a v-if="row.statueRelation == '1'" class="correcting" :disabled="isokDisable" @click="disassociateData(row)">取消关联</a>
- <a v-if="row.statueRelation == '0'" class="correcting" :disabled="isokDisable" @click="relationData(row)">关联</a>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button class="cancelClose cancelClose1" @click="relation.dialogFormVisible = false;getList() ">关闭</el-button>
- </div>
- </div>
- </el-dialog>
- <!-- 营养价值 -->
- <el-dialog :fullscreen="dialogFull" :visible.sync="nutritive.dialogFormVisible" :close-on-click-modal="false" width="90%">
- <template slot="title">
- <div class="avue-crud__dialog__header">
- <span class="el-dialog__title">
- <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
- {{ textMap[nutritive.dialogStatus] }}
- </span>
- <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
- <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
- <svg-icon v-else icon-class="fullscreen" />
- </div>
- </div>
- </template>
- <div class="app-add">
- <el-form ref="temp" :rules="nutritive.rules" :model="nutritive.temp" label-position="right" label-width="160px" style="width: 100%;margin:0 auto 50px">
- <el-row>
- <el-col :span="6">
- <el-form-item label="干物质(DM%):" prop="dry">
- <el-input ref="dry" v-model="nutritive.temp.dry" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入干物质" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="淀粉(%DM):" prop="starch">
- <el-input ref="starch" v-model="nutritive.temp.starch" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入淀粉" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="粗蛋白(CP%DM):" prop="cp">
- <el-input ref="cp" v-model="nutritive.temp.cp" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入粗蛋白" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="钙(Ca%DM):" prop="ca">
- <el-input ref="ca" v-model="nutritive.temp.ca" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入钙" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="6">
- <el-form-item label="磷(P%DM):" prop="p">
- <el-input ref="p" v-model="nutritive.temp.p" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入磷" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="产奶净能(%DM):" prop="n">
- <el-input ref="n" v-model="nutritive.temp.n" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入产奶净能" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="脂肪(%DM):" prop="fat">
- <el-input ref="fat" v-model="nutritive.temp.fat" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入脂肪" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="ADF(%DM):" prop="adf">
- <el-input ref="adf" v-model="nutritive.temp.adf" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入ADF" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="6">
- <el-form-item label="NDF(%DM):" prop="ndf">
- <el-input ref="ndf" v-model="nutritive.temp.ndf" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入NDF" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="NDIP(%):" prop="ndip">
- <el-input ref="ndip" v-model="nutritive.temp.ndip" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入NDIP" type="number" step="0.01" />
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="粗灰分(Ash%):" prop="ash">
- <el-input ref="ash" v-model="nutritive.temp.ash" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入粗灰分" type="number" min="0.00" step="0.01" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button class="cancelClose" @click="nutritive.dialogFormVisible = false;getList()">关闭</el-button>
- <el-button v-if="nutritive.dialogStatus==='nutritive' && isRoleEdit" class="save" :disabled="isokDisable" @click="nutritiveData()">确认</el-button>
- </div>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames, checkButtons } from '@/api/common'
- import Cookies from 'js-cookie'
- import Pagination from '@/components/Pagination'
- import { MessageBox } from 'element-ui'
- export default {
- name: 'FeedTable',
- components: { Pagination },
- directives: {
- limit: {
- // 指令的定义
- update: function(el) {
- el.onkeypress = function(e) {
- var code = e.charCode
- if (code != 0) {
- if (!String.fromCharCode(code).match(/[0-9\.]/)) {
- return false
- }
- }
- }
- el.addEventListener('textInput', function(e) {
- e.target.value = e.target.value.replace(/[^0-9\.]/g, '')
- })
- el.onkeyup = function(e) {
- e.target.value = e.target.value.replace(/[^0-9\.]/g, '')
- }
- }
- }
- },
- data() {
- return {
- dialogFull: false,
- isInforvalue: false,
- isRoleEdit: [],
- requestParams: [
- { name: 'getDictByName', offset: 0, pagecount: 0, params: ['跳转延时'] },
- { name: 'getFeedclassByBig', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
- { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['计划类型'] },
- { name: 'getTMRListEnableTypeFeed', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'), eqtype: '4' }}
- ],
- requestParams2: {
- name: 'getSysoptEnable', offset: 0, parammaps: { pastureid: Cookies.get('pastureid'), inforname: 'isSmallMaterial' }
- },
- enableList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用
- feedSourcesList: [{ id: '0', name: '系统内置' }, { id: '1', name: '用户自定义' }], // 饲料来源
- confirmStartList: [{ id: '0', name: '禁用' }, { id: '1', name: '启用' }], // 确认开始
- associationStatusList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 关联状态
- jumpDelayList: [], // 跳转延时
- feedTypeList: [], // 饲料分类
- planTypeList: [], // 计划类型
- smallMaterialList: [], // 小料秤
- jmpList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 无上域
- table: {
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: true,
- getdataListParm: {
- name: 'getFeedList',
- page: 1,
- offset: 1,
- pagecount: parseInt(Cookies.get('pageCount')),
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- fname: '',
- fclassid: '',
- source: '',
- autozone: '',
- autosecond: '',
- allowratio: '',
- printgroup: '',
- enable: ''
- }
- }
- },
- // 多项搜索显示隐藏
- arrowDown: true,
- arrowUp: false,
- // 新增/编辑
- create: {
- dialogFormVisible: false,
- dialogStatus: '',
- temp: { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '' },
- rules: {
- fname: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
- fclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
- feedcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
- }
- },
- // 饲料库
- feedBank: {
- dialogFormVisible: false,
- dialogStatus: '',
- temp: {},
- rules: {},
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: true,
- getdataListParm: {
- name: 'getFeednurList',
- page: 1,
- offset: 1,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- fname: '',
- statue: ''
- }
- }
- },
- // 关联
- relation: {
- dialogFormVisible: false,
- dialogStatus: '',
- temp: {},
- rules: {},
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: true,
- getdataListParm: {
- name: 'getFeednurRelation',
- page: 1,
- offset: 1,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- fname: ''
- }
- }
- },
- // 营养价值
- nutritive: {
- dialogFormVisible: false,
- dialogStatus: '',
- temp: {},
- rules: {}
- },
- textMap: {
- create: '新增',
- update: '编辑',
- feedBank: '饲料库',
- relation: '关联',
- nutritive: '营养价值'
- },
- isokDisable: false,
- selectList: [],
- requestParam: {},
- rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
- cellStyle: { padding: 0 + 'px' }
- }
- },
- 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
- }
- }
- })
- },
- created() {
- this.getList()
- this.getDownList()
- this.getButtons()
- this.getInforvalueList()
- },
- methods: {
- getButtons() {
- const Edit = 'FeedTable'
- const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
- this.isRoleEdit = isRoleEdit
- },
- getInforvalueList() {
- GetDataByName(this.requestParams2).then(response => {
- if (response.data !== null) {
- if (response.data.list[0].inforvalue == 0) {
- this.isInforvalue = false
- } else {
- this.isInforvalue = true
- }
- } else {
- this.isInforvalue = false
- }
- })
- },
- getDownList() {
- GetDataByNames(this.requestParams).then(response => {
- this.jumpDelayList = response.data.getDictByName.list
- this.feedTypeList = response.data.getFeedclassByBig.list
- this.planTypeList = response.data.getDictByName2.list
- this.smallMaterialList = response.data.getTMRListEnableTypeFeed.list
- })
- },
- getList() {
- this.table.listLoading = true
- GetDataByName(this.table.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- 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.parammaps.fname = ''
- this.table.getdataListParm.parammaps.fclassid = ''
- this.table.getdataListParm.parammaps.source = ''
- this.table.getdataListParm.parammaps.autozone = ''
- this.table.getdataListParm.parammaps.autosecond = ''
- this.table.getdataListParm.parammaps.allowratio = ''
- this.table.getdataListParm.parammaps.printgroup = ''
- this.table.getdataListParm.parammaps.enable = ''
- this.table.getdataListParm.offset = 1
- this.getList()
- },
- resetTemp() {
- this.create.temp = { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '', jmp: '0' }
- },
- // 计划类型
- changePlanList(item) {
- console.log(item,'======')
- this.create.temp.printgroup = this.planTypeList.find(obj => obj.value === item).label
- },
- // 饲料类型
- changeFeedList(item) {
- this.create.temp.fclass = this.feedTypeList.find(obj => obj.id === item).mixname
- },
- // 跳转延时
- changeAutosecond(item) {
- this.create.temp.autosecondname = this.jumpDelayList.find(obj => obj.value === item).label
- },
- // 确认开始
- changeConfirmstart(item) {
- this.create.temp.confirmstartname = this.confirmStartList.find(obj => obj.id === item).name
- },
- changeSmallMaterial(item) {
- if (item !== '') {
- this.create.temp.smtmrname = this.smallMaterialList.find(obj => obj.id === item).tname
- } else {
- this.create.temp.smtmrname = ''
- }
- },
- // 新增
- handleCreate() {
- console.log('点击了新增')
- this.resetTemp()
- this.dialogFull = false
- this.create.dialogStatus = 'create'
- this.create.dialogFormVisible = true
- },
- createData() {
- console.log('点击了新增保存')
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.$refs['temp'].validate(valid => {
- if (valid) {
- const unitweight = /^[1-9]\d*$/
- if (this.create.temp.unitweight !== '') {
- if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
- this.$message({ type: 'error', message: '包装单位重量请输入正整数', duration: 2000 })
- return false
- }
- }
- const uprice = /^\d+(\.\d{1,2})?$/
- if (this.create.temp.uprice !== '') {
- if (!uprice.test(parseFloat(this.create.temp.uprice))) {
- this.$message({ type: 'error', message: '单价请保留两位小数', duration: 2000 })
- return false
- }
- }
- if (this.create.temp.autozone !== '') {
- const autozone = /^([0-9]|(1[0-9]|2[0-9]|3[0-9]|4[0-9]|(50)))$/
- if (!autozone.test(parseFloat(this.create.temp.autozone))) {
- this.$message({ type: 'error', message: '跳转重量域请输入大于等于0小于等于50的整数', duration: 2000 })
- return false
- }
- } else {
- this.create.temp.autozone = '0'
- }
- if (this.create.temp.trgaddress.length > 8) {
- this.$message({ type: 'error', message: '继电器位置请输入1-8位数字', duration: 2000 })
- return false
- }
- const allowratio = /^[0-9]\d*$/
- if (this.create.temp.allowratio !== '') {
- if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
- this.$message({ type: 'error', message: '允许误差数请输入大于等于0的整数', duration: 2000 })
- return false
- }
- }
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.requestParam.name = 'insertFeed'
- this.requestParam.parammaps = this.create.temp
- if (this.create.temp.allowratio == '') { this.create.temp.allowratio = '0' }
- if (this.create.temp.uprice == '') { this.create.temp.uprice = '0' }
- if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
- if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
- if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
- PostDataByName(this.requestParam).then(response => {
- console.log('新增保存发送参数', this.requestParam)
- if (response.msg !== 'fail') {
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.create.dialogFormVisible = false
- this.getList()
- } else {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
- if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
- if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
- if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
- if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
- }
- })
- }
- })
- },
- // 编辑
- handleUpdate(row) {
- console.log('点击了编辑', row)
- this.create.dialogStatus = 'update'
- this.dialogFull = false
- this.create.dialogFormVisible = true
- row.fclassid = String(row.fclassid)
- row.printgroupid = String(row.printgroupid)
- row.autosecond = String(row.autosecond)
- row.confirmstart = String(row.confirmstart)
- row.enable = String(row.enable)
- row.jmp = String(row.jmp)
- if (row.printgroupid !== '') {
- row.printgroup = this.planTypeList.find(obj => obj.value == row.printgroupid).label
- }
- this.create.temp = Object.assign({}, row)
- if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
- if (this.create.temp.uprice == '0.00') { this.create.temp.uprice = '' }
- if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
- if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
- if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
- if (this.create.temp.smtmrid == '-1') { this.create.temp.smtmrid = '' }
- console.log(row,'=====')
- },
- updateData() {
- console.log('点击了编辑保存')
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.$refs['temp'].validate(valid => {
- if (valid) {
- const unitweight = /^[1-9]\d*$/
- if (this.create.temp.unitweight !== '') {
- if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
- this.$message({ type: 'error', message: '包装单位重量请输入正整数', duration: 2000 })
- return false
- }
- }
- const uprice = /^\d+(\.\d{1,2})?$/
- if (this.create.temp.uprice !== '') {
- if (!uprice.test(parseFloat(this.create.temp.uprice))) {
- this.$message({ type: 'error', message: '单价请保留两位小数', duration: 2000 })
- return false
- }
- }
- if (this.create.temp.autozone !== '') {
- const autozone = /^([0-9]|(1[0-9]|2[0-9]|3[0-9]|4[0-9]|(50)))$/
- if (!autozone.test(parseFloat(this.create.temp.autozone))) {
- this.$message({ type: 'error', message: '跳转重量域请输入大于等于0小于等于50的整数', duration: 2000 })
- return false
- }
- } else {
- this.create.temp.autozone = '0'
- }
- if (this.create.temp.trgaddress.length > 8) {
- this.$message({ type: 'error', message: '继电器位置请输入1-8位数字', duration: 2000 })
- return false
- }
- const allowratio = /^[0-9]\d*$/
- if (this.create.temp.allowratio !== '') {
- if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
- this.$message({ type: 'error', message: '允许误差数请输入大于等于0的整数', duration: 2000 })
- return false
- }
- }
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.requestParam.name = 'updateFeed'
- this.requestParam.parammaps = this.create.temp
- if (this.create.temp.allowratio == '') { this.create.temp.allowratio = '0' }
- if (this.create.temp.uprice == '') { this.create.temp.uprice = '0' }
- if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
- if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
- if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
- PostDataByName(this.requestParam).then(response => {
- console.log('新增保存发送参数', this.requestParam)
- if (response.msg !== 'fail') {
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.create.dialogFormVisible = false
- this.getList()
- } else {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
- if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
- if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
- if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
- if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
- }
- })
- }
- })
- },
- // 饲料库
- handleFeedBank() {
- console.log('点击了饲料库')
- this.dialogFull = false
- this.feedBank.dialogStatus = 'feedBank'
- this.feedBank.dialogFormVisible = true
- this.getFeedBankList()
- },
- getFeedBankList() {
- this.feedBank.listLoading = true
- GetDataByName(this.feedBank.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- this.feedBank.list = response.data.list
- this.feedBank.pageNum = response.data.pageNum
- this.feedBank.pageSize = response.data.pageSize
- this.feedBank.total = response.data.total
- } else {
- this.feedBank.list = []
- }
- setTimeout(() => {
- this.feedBank.listLoading = false
- }, 100)
- })
- },
- handleFeedBankSearch() {
- console.log('点击了饲料库搜索')
- this.getFeedBankList()
- this.feedBank.getdataListParm.offset = 1
- },
- handleFeedBankRefresh() {
- console.log('点击了饲料库重置')
- this.feedBank.getdataListParm.parammaps.fname = ''
- this.feedBank.getdataListParm.parammaps.statue = ''
- this.getFeedBankList()
- },
- // 关联
- handleRelation(row) {
- console.log('点击了关联')
- this.dialogFull = false
- this.relation.dialogStatus = 'relation'
- this.relation.dialogFormVisible = true
- this.relation.temp = Object.assign({}, row)
- this.relation.getdataListParm.parammaps.fid = this.relation.temp.id
- this.getRelationList()
- },
- getRelationList() {
- this.relation.listLoading = true
- GetDataByName(this.relation.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- this.relation.list = response.data.list
- this.relation.pageNum = response.data.pageNum
- this.relation.pageSize = response.data.pageSize
- this.relation.total = response.data.total
- } else {
- this.relation.list = []
- }
- setTimeout(() => {
- this.relation.listLoading = false
- }, 100)
- })
- },
- handleRelationSearch() {
- console.log('点击了关联搜索')
- this.relation.getdataListParm.offset = 1
- this.getRelationList()
- },
- disassociateData(row) {
- console.log('点击了取消关联')
- MessageBox.confirm('是否确认取消关联?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.requestParam.name = 'updateFeedrelation'
- this.requestParam.parammaps = {}
- this.requestParam.parammaps.pastureid = this.relation.temp.pastureid
- this.requestParam.parammaps.fid = this.relation.temp.id
- this.requestParam.parammaps.id = row.id
- PostDataByName(this.requestParam).then(response => {
- console.log('取消关联保存发送参数', this.requestParam)
- if (response.msg !== 'fail') {
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.getRelationList()
- this.getList()
- } else {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- }
- })
- }).catch(() => {
- this.$message({ type: 'info', message: '已取消' })
- })
- },
- relationData(row) {
- console.log('点击了关联保存')
- MessageBox.confirm('是否确认关联?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- this.requestParam.name = 'insertFeednur'
- this.requestParam.parammaps = {}
- this.requestParam.parammaps.pastureid = this.relation.temp.pastureid
- this.requestParam.parammaps.fid = this.relation.temp.id
- this.requestParam.parammaps.fname = this.relation.temp.fname
- this.requestParam.parammaps.feedcode = this.relation.temp.feedcode
- this.requestParam.parammaps.price = row.price
- this.requestParam.parammaps.remark = row.remark
- this.requestParam.parammaps.dry = row.dry
- this.requestParam.parammaps.starch = row.starch
- this.requestParam.parammaps.cp = row.cp
- this.requestParam.parammaps.ca = row.ca
- this.requestParam.parammaps.p = row.p
- this.requestParam.parammaps.n = row.n
- this.requestParam.parammaps.fat = row.fat
- this.requestParam.parammaps.adf = row.adf
- this.requestParam.parammaps.ndf = row.ndf
- this.requestParam.parammaps.ndip = row.ndip
- this.requestParam.parammaps.ash = row.ash
- this.requestParam.parammaps.fpercent = row.fpercent
- this.requestParam.parammaps.iscu = row.iscu
- this.requestParam.parammaps.feednurid = row.id
- PostDataByName(this.requestParam).then(response => {
- console.log('关联保存发送参数', this.requestParam)
- if (response.msg !== 'fail') {
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.getRelationList()
- this.getList()
- } else {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- }
- })
- }).catch(() => {
- this.$message({ type: 'info', message: '已取消' })
- })
- },
- // 营养价值
- handleNutritive(row) {
- console.log('点击了营养价值', row)
- this.dialogFull = false
- this.nutritive.dialogStatus = 'nutritive'
- this.nutritive.dialogFormVisible = true
- this.nutritive.temp = Object.assign({}, row)
- },
- nutritiveData() {
- console.log('点击了营养价值保存')
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- if (this.nutritive.temp.dry == undefined) { this.$set(this.nutritive.temp, 'dry', '') }
- if (this.nutritive.temp.starch == undefined) { this.$set(this.nutritive.temp, 'starch', '') }
- if (this.nutritive.temp.cp == undefined) { this.$set(this.nutritive.temp, 'cp', '') }
- if (this.nutritive.temp.ca == undefined) { this.$set(this.nutritive.temp, 'ca', '') }
- if (this.nutritive.temp.p == undefined) { this.$set(this.nutritive.temp, 'p', '') }
- if (this.nutritive.temp.n == undefined) { this.$set(this.nutritive.temp, 'n', '') }
- if (this.nutritive.temp.fat == undefined) { this.$set(this.nutritive.temp, 'fat', '') }
- if (this.nutritive.temp.adf == undefined) { this.$set(this.nutritive.temp, 'adf', '') }
- if (this.nutritive.temp.ndf == undefined) { this.$set(this.nutritive.temp, 'ndf', '') }
- if (this.nutritive.temp.ndip == undefined) { this.$set(this.nutritive.temp, 'ndip', '') }
- if (this.nutritive.temp.ash == undefined) { this.$set(this.nutritive.temp, 'ash', '') }
- var positiveNumber = /^\d+(\.\d{1,2})?$/
- if (this.nutritive.temp.dry !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.dry))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- console.log(this.nutritive.temp.starch)
- if (this.nutritive.temp.starch !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.starch))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- if (this.nutritive.temp.cp !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.cp))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- if (this.nutritive.temp.ca !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.ca))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- if (this.nutritive.temp.p !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.p))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- if (this.nutritive.temp.n !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.n))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- if (this.nutritive.temp.fat !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.fat))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- if (this.nutritive.temp.adf !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.adf))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- if (this.nutritive.temp.ndf !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.ndf))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- if (this.nutritive.temp.ndip !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.ndip))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- if (this.nutritive.temp.ash !== '') {
- if (!positiveNumber.test(parseFloat(this.nutritive.temp.ash))) {
- this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
- return false
- }
- }
- this.requestParam.name = 'insertFeednur'
- this.requestParam.parammaps = {}
- this.requestParam.parammaps.pastureid = this.nutritive.temp.pastureid
- this.requestParam.parammaps.fid = this.nutritive.temp.id
- this.requestParam.parammaps.fname = this.nutritive.temp.fname
- this.requestParam.parammaps.feedcode = this.nutritive.temp.feedcode
- this.requestParam.parammaps.price = this.nutritive.temp.uprice
- this.requestParam.parammaps.remark = this.nutritive.temp.remark
- this.requestParam.parammaps.dry = this.nutritive.temp.dry
- this.requestParam.parammaps.starch = this.nutritive.temp.starch
- this.requestParam.parammaps.cp = this.nutritive.temp.cp
- this.requestParam.parammaps.ca = this.nutritive.temp.ca
- this.requestParam.parammaps.p = this.nutritive.temp.p
- this.requestParam.parammaps.n = this.nutritive.temp.n
- this.requestParam.parammaps.fat = this.nutritive.temp.fat
- this.requestParam.parammaps.adf = this.nutritive.temp.adf
- this.requestParam.parammaps.ndf = this.nutritive.temp.ndf
- this.requestParam.parammaps.ndip = this.nutritive.temp.ndip
- this.requestParam.parammaps.ash = this.nutritive.temp.ash
- this.requestParam.parammaps.fpercent = this.nutritive.temp.fpercent
- this.requestParam.parammaps.iscu = this.nutritive.temp.iscu
- this.requestParam.parammaps.feednurid = '-1'
- PostDataByName(this.requestParam).then(response => {
- console.log('关联保存发送参数', this.requestParam)
- if (response.msg !== 'fail') {
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.getList()
- this.nutritive.dialogFormVisible = false
- } else {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- }
- })
- },
- // 行内删除
- handleRowDelete(row) {
- console.log('点击了行内删除')
- MessageBox.confirm('是否确认删除此信息?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- this.selectList = []
- this.requestParam = {}
- this.requestParam.common = { 'returnmap': '0' }
- this.requestParam.data = []
- this.requestParam.data[0] = { 'name': 'checkDeleteFeed', 'type': 'v', 'parammaps': {
- 'pastureid': row.pastureid,
- 'id': row.id
- }}
- this.requestParam.data[1] = { 'name': 'deleteFeed', '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()
- }
- })
- }).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('当前选中' + this.selectList.length + '条信息,是否删除?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- this.requestParam = {}
- this.requestParam.common = { 'returnmap': '0' }
- this.requestParam.data = []
- this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
- this.requestParam.data[0].children = []
- this.requestParam.data[0].children[0] = { 'name': 'checkDeleteFeed', 'type': 'v', 'parammaps': {
- id: '@insertSpotList.id',
- pastureid: '@insertSpotList.pastureid'
- }}
- this.requestParam.data[0].children[1] = { 'name': 'deleteFeed', '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()
- }
- })
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .search{margin-top:10px;}
- .table{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;}
- }
- }
- }
- </style>
|