123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890 |
- <template>
- <div class="app-container">
- <div class="operation">
-
- <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate1">设置推料时间</el-button>
- <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate2">设置允许误差时间</el-button>
-
- <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" style="float: left;" @click="handleTakeEffect">启用</el-button>
- <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" style="float: left;" @click="handleDisable">禁用</el-button>
- <el-button v-if="isRoleEdit" class="success" style="float: left;" @click="handleCheck">校验</el-button>
-
- </div>
-
- <div class="table">
- <el-table
- :key="table.tableKey"
- ref="table"
- 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"
- :max-height="myHeight"
- @header-click="headerClick"
- @cell-click="cellClick"
- @selection-change="handleSelect"
- @cell-dblclick="celldblclick"
- >
- <el-table-column type="selection" width="50" />
- <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left" />
- <el-table-column label="栏舍名称" min-width="100px" align="center" class-name="small-padding fixed-width" fixed="left">
- <template slot-scope="scope">
-
- <span >{{ scope.row.bname }}</span>
-
- </template>
- </el-table-column>
- <el-table-column :key="2" label="推料车名称" min-width="70px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.NoEdit">{{ scope.row.tmrname }}</span>
- <el-select v-if="scope.row.Edit" v-model="scope.row.tmrid" filterable placeholder="推料车名称" class="filter-item" style="width:95%;padding:10px 0;" @change="changeTmrCode(scope.$index, scope.row)">
- <el-option v-for="item in tmrCodeList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- </template>
- </el-table-column>
- <el-table-column :key="3" label="推料车编号" min-width="90px" align="center">
- <template slot-scope="scope">
- <span >{{ scope.row.tmrcode }}</span>
-
- </template>
- </el-table-column>
- <el-table-column :key="4" label="推料时间(每天)" min-width="85px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.NoEdit">{{ scope.row.times }}</span>
-
- <el-tag v-if="scope.row.Edit" v-for="tag in scope.row.timesArr" :key="tag" closable @close="tag_close(scope.$index, scope.row, tag)" type="success">{{tag}}</el-tag>
-
- <el-time-picker v-if="scope.row.time_single"
- v-model="scope.row.times"
- :picker-options="{ selectableRange: '00:00:00 - 23:59:59' }"
- value-format="HH:mm"
- @change="change_time(scope.$index, scope.row, $event)" format="HH:mm"
- placeholder="任意时间点">
- </el-time-picker>
-
-
- </template>
- </el-table-column>
- <el-table-column :key="5" label="允许误差时间(分钟)" min-width="85px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.NoEdit">{{ scope.row.allowableerror }}</span>
- <el-input v-if="scope.row.Edit" v-model="scope.row.allowableerror" type="number" style="width:95%;padding:10px 0;" />
- </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" />
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
- <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
- <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
- <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
- <el-button v-if="isRoleEdit" class="miniDanger" icon="el-icon-delete" @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="create1.dialogFormVisible" :close-on-click-modal="false" width="50%">
- <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" />
- 推料计划
- </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="create1.rules" :model="create1.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
-
- <el-row>
- <el-col :span="6">
- <el-form-item label="设置时间:" prop="useinbarid">
- <el-time-picker
- v-model="timevalue1"
- :picker-options="{ selectableRange: '00:00:00 - 23:59:59' }"
- value-format="HH:mm"
- @change="change_time1" format="HH:mm"
- placeholder="任意时间点">
- </el-time-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-tag v-for="tag in timetags1" :key="tag.name" closable @close="tag_close1(tag)" type="success">{{tag}}</el-tag>
- </el-row>
-
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button class="cancelClose" @click="create1.dialogFormVisible = false;getList()">关闭</el-button>
- <el-button class="save" @click="create_sure1">确认</el-button>
- </div>
- </div>
- </el-dialog>
- <el-dialog :fullscreen="dialogFull" :visible.sync="create2.dialogFormVisible" :close-on-click-modal="false" width="50%">
- <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" />
- 允许误差时间
- </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="create2.rules" :model="create2.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
-
- <el-row>
- <el-col :span="6">
- <el-form-item label="允许误差时间(分钟):" prop="time">
- <el-input ref="time" v-model="create2.temp.time" class="filter-item" placeholder="请输入" type="text" />
- </el-form-item>
- </el-col>
- </el-row>
-
-
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button class="cancelClose" @click="create2.dialogFormVisible = false;getList()">关闭</el-button>
- <el-button class="save" @click="handleCreate2">确认</el-button>
- </div>
- </div>
- </el-dialog>
- <!-- 校验 -->
- <el-dialog title="提示" :destroy-on-close="true" :visible.sync="check.dialogFormVisible" :close-on-click-modal="false" width="30%">
- <div class="check">
- <p v-if="check.temp.isDistribution == '0'">当前有栏舍未分配,建议及时进行分配,未分配栏舍如下:</p>
- <p v-else>已分配完:当前栏舍已分配完善</p>
- {{ check.temp.bnames }}
- </div>
- <div slot="footer" class="dialog-footer" style="bottom: 10px;">
- <el-button class="save" @click="check.dialogFormVisible=false;">确认</el-button>
- </div>
- </el-dialog>
-
-
-
- </div>
- </template>
- <script>
- import { GetDataByName, postJson, GetDataByNames, compareSort, ExecDataByConfig, failproccess, PostDataByName, formatNum, checkButtons } from '@/api/common'
- import Pagination from '@/components/Pagination'
- import Pagination2 from '@/components/Pagination2'
- import { parseTime, json2excel, handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
- import { MessageBox } from 'element-ui'
- import Cookies from 'js-cookie'
- import axios from 'axios'
- import { getToken } from '@/utils/auth'
-
- export default {
- inject: ['reload'],
- name: 'PushMaterialPlan',
- components: { Pagination, Pagination2 },
- data() {
- return {
- tmrCodeList:[
- // {Code: "001", id: 46, name: "一号推料车"},
- // {Code: "002", id: 47, name: "二号推料车"}
- ],
- table: {
- getdataListParm: {
- name: 'getPushingList',
- page: 1,
- offset: 1,
-
- pagecount: '',
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
-
- }
- },
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: true,
- temp: {},
-
-
- },
- create1: {
- dialogFormVisible: false,
- dialogStatus: '',
- temp: { pastureid: Cookies.get('pastureid'), fname: ''},
- 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' }]
- }
- },
- create2: {
- dialogFormVisible: false,
- dialogStatus: '',
- temp: { pastureid: Cookies.get('pastureid'), time: ''},
- 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' }]
- }
- },
- check: {
- dialogFormVisible: false,
- dialogStatus: '',
- getCheckParm: {
- name: 'checkRemainplan',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid')
- }
- },
- temp: {
- bnames: '',
- isDistribution: ''
- }
- },
- timevalue1: new Date(2022, 9, 10, 18, 40),
- timetags1: [],
- dialogFull: false,
- isRoleEdit: [],
- headerList: [],
- pickerMinDate: '',
-
-
- rules: {
- cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
- },
-
- selectList: [],
-
-
-
- requestParam: {},
- download: {
- getdataListParm: {
- name: 'getFPList',
- page: 1,
- offset: 1,
- pagecount: 0,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- enable: ''
- }
- },
- list: []
- },
- spanObj: {},
- mergekeys: ['barname', 'sumweight'],
- isShowDialog: false,
- isokDisable: false,
- rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
- cellStyle: { padding: 0 + 'px' },
- myHeight: document.documentElement.clientHeight - 85 - 140,
- oldRowList:{},
-
- }
- },
- computed: {
-
-
- },
- created() {
- this.getButtons()
- this.getTMRlist()
- this.getList()
-
- },
- methods: {
- getButtons() {
- const Edit = 'DhedFormula'
- const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
- this.isRoleEdit = isRoleEdit
- },
- getTMRlist() {
- var send_data = {"name":"getPushingTmrList","page":1,"offset":1,"pagecount":"","returntype":"Map","parammaps":{"dictname":"推料车"}}
- GetDataByName(send_data).then(response => {
- if (response.data.list !== null) {
- this.tmrCodeList = response.data.list
- } else {
- this.tmrCodeList = []
- }
- console.log("tmrCodeList",this.tmrCodeList)
- })
- },
- 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], 'isUpdate', true) // 编辑操作
- this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
-
- }
- response.data.list.forEach(function(item){
- if(item.times !== ""){
- item.timesArr = item.times.split(',')
- }
- })
- // console.log(response.data.list, sumr)
-
- this.table.list = response.data.list
- console.log(this.table.list, 'this.table.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)
- })
- },
- // 推料车
- changeTmrCode(index,row) {
- console.log("推料车:====",index,row)
- var Code = this.tmrCodeList.find(obj => obj.id === row.tmrid).Code
- console.log( "推料车编号:====",Code)
- this.table.list[index].tmrcode = Code
- },
-
-
- // 新增
- handleCreate1() {
- console.log('点击了新增')
- this.resetTemp1()
- this.dialogFull = false
- this.create1.dialogStatus = 'create'
- this.create1.dialogFormVisible = true
- },
- resetTemp1() {
- this.create1.temp = { pastureid: Cookies.get('pastureid'), 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'sort': "", 'ftid': '', 'ftname': '', 'tmrcode': '', 'tmrid': '', 'times': '', 'lppcode': '', 'lppid': '', 'rtime': '', barid: '', 'treatmethod': '', 'useinbar': '', 'useinbarid': '' }
- },
-
- create_sure1(){
- console.log(this.timetags1)
- },
- handleCreate2() {
- console.log('点击了新增')
- this.resetTemp2()
- this.dialogFull = false
- this.create2.dialogStatus = 'create'
- this.create2.dialogFormVisible = true
- },
- resetTemp2() {
- this.create2.temp = { pastureid: Cookies.get('pastureid'), 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'sort': "", 'ftid': '', 'ftname': '', 'tmrcode': '', 'tmrid': '', 'times': '', 'lppcode': '', 'lppid': '', 'rtime': '', barid: '', 'treatmethod': '', 'useinbar': '', 'useinbarid': '' }
- },
-
-
-
-
- change_time1(tag){
- console.log("tag", tag)
- console.log("timetags1", this.timetags1)
-
- this.timetags1.push(tag)
- },
- tag_close1(tag){
- console.log("tag", tag)
- console.log("timetags1", this.timetags1)
-
- this.timetags1.splice(this.timetags1.indexOf(tag), 1);
- },
-
- change_time(index,row,item){
- console.log("item", index,row,item)
- this.table.list[index].timesArr.push(item)
-
-
- },
- tag_close(index,row,tag){
- console.log("tag", index,row,tag)
- this.table.list[index].timesArr.splice(this.table.list[index].timesArr.indexOf(tag), 1);
-
- },
- // 校验
- handleCheck() {
- console.log('点击了校验')
- this.check.dialogStatus = 'check'
- this.check.dialogFormVisible = true
- this.getCheckList()
- },
- getCheckList() {
- GetDataByName(this.check.getCheckParm).then(response => {
- if (response.data.list[0].bnames !== undefined) {
- this.check.temp.isDistribution = 0
- this.check.temp.bnames = response.data.list[0].bnames
- } else {
- this.check.temp = {}
- this.check.temp.isDistribution = 1
- }
- })
- },
- handleTakeEffect() {
- console.log(this.selectList)
- if (this.selectList.length == 0) {
- this.$message({ type: 'error', message: '请选择推料信息', duration: 2000 })
- } else {
- MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- var selectArr = this.selectList
- var idsArr = []
- selectArr.forEach(function(item){
- idsArr.push(item.id)
- })
- var send_data = {
- "name":"updateEnableByIds",
- "parammaps":{"enable":"1","ids":idsArr.join(",")}
- }
- GetDataByName(send_data).then(response => {
-
- if (response.msg == 'fail') {
- this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
- this.getList()
- }
-
- })
-
- })
- }
- },
- handleDisable() {
- if (this.selectList.length == 0) {
- this.$message({ type: 'error', message: '请选择推料信息', duration: 2000 })
- } else {
- MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- var selectArr = this.selectList
- var idsArr = []
- selectArr.forEach(function(item){
- idsArr.push(item.id)
- })
- var send_data = {
- "name":"updateEnableByIds",
- "parammaps":{"enable":"0","ids":idsArr.join(",")}
- }
- GetDataByName(send_data).then(response => {
-
- if (response.msg == 'fail') {
- this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '', message: '禁用成功', type: 'success', duration: 2000 })
- this.getList()
- }
-
- })
- })
- }
- },
- renderHeader(h, { column, $index }) { // h即为cerateElement的简写,具体可看vue官方文档
- return h(
- 'div',
- [
- h('span', column.label),
- h('i', {
- class: 'el-icon-unlock',
- ref: 'el-icon-unlock',
- style: 'margin-left:5px;'
- })
- ]
- )
- },
- headerClick(column, event) {
- console.log(column, event)
- this.headerList.push(event)
- for (let i = 0; i < this.table.list.length; i++) {
- if (this.table.list[i].Edit == true) {
- if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
- event.target.className = 'el-icon-lock'
- this.$set(this.table.list[i], 'isTwoWeight', true) // 锁住不可编辑
- } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
- event.target.className = 'el-icon-unlock'
- this.$set(this.table.list[i], 'isTwoWeight', false) // 解锁可编辑
- }
- }
- }
- },
-
-
-
-
-
-
- celldblclick(row, column, cell, event) {
- console.log(row, '=====')
- this.handleUpdate(row)
- },
- // 编辑
- handleUpdate(row) {
- console.log(row)
- this.oldRowList = {...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,编辑保存true
- row.isUpdate = false
- row.isUpdateSave = true
-
- },
- updateData(row) {
-
-
- console.log('点击了编辑保存', row)
-
- row.pastureid = Cookies.get('pastureid')
-
-
- // if (this.table.temp.ccount === '') {
- // this.$message({ type: 'error', message: '实际牛头数不能为空', duration: 2000 })
- // return false
- // }
-
- // const positiveInteger = /^[0-9]\d*$/
- // if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
- // this.$message({
- // type: 'error',
- // message: '实际牛头数请输入正整数',
- // duration: 2000
- // })
- // return false
- // }
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 1000)
- var timeArrRea = row.timesArr
- var timesTempArr = []
- timeArrRea.forEach(function(item){
- timesTempArr.push({"time":item})
- })
- var send_data = {
- "common":{"returnmap":"0"},
- "data":[
- {
- "name":"checkPushing","resultmaps":{"list":timesTempArr},
- "children":[
- {
- "name":"checkPushing","type":"e",
- "parammaps": {
- "tmrname":row.tmrname,
- "tmrid":row.tmrid,
- "id":row.id,
- "time":"@checkPushing.time",
- "type":0
- }
- }
- ]
- }
- ]
- }
- PostDataByName(send_data).then(response => {
- console.log(response)
- if (response.msg === 'fail') {
- this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
-
- }
- })
-
- if(id == 0){
- var send_data = {
- "common":{"returnmap":"0"},
- "data":[
- {"name":"insertPushing","type":"e",
- "parammaps": row
- },
- {"name":"insertPushingDetail",
- "resultmaps":{
- "list":[
- {"time":"10:00"},{"time":"12:00"}
- ]
- },
- "children":[
- {
- "name":"insertPushingDetail","type":"e","parammaps":
- {
- "pastureid":Cookies.get('pastureid'),
- "barid":row.barid,"time":"@insertPushingDetail.time","type":0}}]}
- ]}
- }else {
- }
-
- // ExecDataByConfig(this.requestParam).then(response => {
- // console.log('编辑保存发送参数', this.requestParam)
- // if (response.msg === 'fail') {
- // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- // } else {
- // if(obj.data.length>0){
- // const url = 'authdata/fpdetail/edit'
- // const data = obj
- // postJson(url, data).then(response => {
- // if(response.msg !== 'fail'){
- // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- // }
- // })
- // }else{
- // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- // }
- // this.getList()
- // for (let i = 0; i < this.headerList.length; i++) {
- // if (this.headerList[i].target.className == 'el-icon-lock') {
- // this.headerList[i].target.className = 'el-icon-unlock'
- // this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
- // }
- // }
- // }
- // })
- },
- updateCancel(row) {
- console.log('点击了编辑取消')
- // 编辑false,不可编辑true
- row.Edit = false
- row.NoEdit = true
- // 编辑true,编辑保存false
- row.isUpdate = true
- row.isUpdateSave = false
- // this.reload()
- for (let i = 0; i < this.headerList.length; i++) {
- if (this.headerList[i].target.className == 'el-icon-lock') {
- this.headerList[i].target.className = 'el-icon-unlock'
- this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
- }
- }
- console.log(this.table.getdataListParm.offset)
- this.table.getdataListParm.offset = this.table.getdataListParm.offset
- this.getList()
- // this.$router.push('/formulationPlan/dhedFormula')
- },
- cellClick(row, column, event) {
- console.log(column)
- },
- handleSelect(val) {
- console.log('勾选数据', val)
- this.selectList = val
- },
-
- tableRowClassName({ row }) {
- // console.log(row)
- if (row.isColor == '0') {
- return 'red-row'
- } else {
- return ''
- }
- },
-
-
-
- // 删除
- handleRowDelete(row) {
- console.log('点击了行内删除')
- MessageBox.confirm('是否确认删除此信息?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- this.selectList = []
- this.requestParam.name = 'deleteDungsieve'
- this.requestParam.parammaps = {}
- this.requestParam.parammaps.pastureid = row.pastureid
- this.requestParam.parammaps.id = row.id
- PostDataByName(this.requestParam).then(response => {
- if (response.msg === 'fail') {
- this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
- this.getList()
- }
- })
- }).catch(() => {
- this.$message({ type: 'info', message: '已取消删除' })
- })
- },
-
-
- // 应用
- handleApplication() {
- console.log('点击了应用')
- MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- this.requestParam.name = 'applyFPdate'
- this.requestParam.parammaps = {}
- this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
- this.requestParam.parammaps.date = this.history.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.getList()
- }
- })
- }).catch(() => {
- this.$message({ type: 'info', message: '已取消应用' })
- })
- },
-
-
- formatJson(filterVal, jsonData) {
- return jsonData.map(v =>
- filterVal.map(j => {
- if (j === 'timestamp') {
- return parseTime(v[j])
- } else {
- return v[j]
- }
- })
- )
- },
-
- blurBw(row) {
- console.log(row)
- },
- focusBw(row) {
- console.log(row)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .search {
- clear: both;
- }
- .table {
- margin-top: 10px;
- }
- </style>
- <style lang="scss">
- .red-row{
- background: #fde2e2 !important;
- }
- </style>
|