代码删除同步

master
张博文
parent d18c244339
commit 74f13d0d91

@ -1,71 +0,0 @@
import request from '@/utils/request'
// 创建农资
export function createInputsInfo(data) {
return request({
url: '/basic/inputs-info/create',
method: 'post',
data: data
})
}
// 更新农资
export function updateInputsInfo(data) {
return request({
url: '/basic/inputs-info/update',
method: 'put',
data: data
})
}
// 删除农资
export function deleteInputsInfo(id) {
return request({
url: '/basic/inputs-info/delete?id=' + id,
method: 'delete'
})
}
// 获得农资
export function getInputsInfo(id) {
return request({
url: '/basic/inputs-info/get?id=' + id,
method: 'get'
})
}
// 获得农资分页
export function getInputsInfoPage(query) {
return request({
url: '/basic/inputs-info/page',
method: 'get',
params: query
})
}
// 获得农资
export function queryListOfMiniResult(query) {
return request({
url: '/basic/inputs-info/queryListOfMiniResult',
method: 'get',
params: query,
})
}
// 获得所有农资信息
export function getInputsInfoInputsInfoList(params) {
  return request({
    url: '/basic/inputs-info/getInputsInfoInputsInfoList',
    method: 'get',
    params,
  })
}
// 根据指定的商户id 获取所有名下多个农资
export function getInputsInfoListByBelongBusinessId(query) {
  return request({
    url: '/basic/inputs-info/getInputsInfoListByBelongBusinessId',
    method: 'get',
    params: query
  })
}

@ -1,53 +0,0 @@
import request from '@/utils/request'
// 创建溯源链证书配置
export function createTraceCert(data) {
return request({
url: '/configure/trace-cert/create',
method: 'post',
data: data
})
}
// 更新溯源链证书配置
export function updateTraceCert(data) {
return request({
url: '/configure/trace-cert/update',
method: 'put',
data: data
})
}
// 删除溯源链证书配置
export function deleteTraceCert(id) {
return request({
url: '/configure/trace-cert/delete?id=' + id,
method: 'delete'
})
}
// 获得溯源链证书配置
export function getByBelongBusinessId(belongBusinessId) {
return request({
url: '/configure/trace-cert/getByBelongBusinessId?belongBusinessId=' + belongBusinessId,
method: 'get'
})
}
// 获得溯源链证书配置
// export function getTraceCert(id) {
// return request({
// url: '/configure/trace-cert/get?id=' + id,
// method: 'get'
// })
// }
// 获得溯源链证书配置分页
// export function getTraceCertPage(query) {
// return request({
// url: '/configure/trace-cert/page',
// method: 'get',
// params: query
// })
// }

@ -1,73 +0,0 @@
import request from '@/utils/request'
// 创建农资批次
export function createInputsBatch(data) {
return request({
url: '/product/inputs-batch/create',
method: 'post',
data: data
})
}
// 更新农资批次
export function updateInputsBatch(data) {
return request({
url: '/product/inputs-batch/update',
method: 'put',
data: data
})
}
// 删除农资批次
export function deleteInputsBatch(id) {
return request({
url: '/product/inputs-batch/delete?id=' + id,
method: 'delete'
})
}
// 获得农资批次
export function getInputsBatch(id) {
return request({
url: '/product/inputs-batch/get?id=' + id,
method: 'get'
})
}
// 获得农资批次分页
export function getInputsBatchPage(query) {
return request({
url: '/product/inputs-batch/page',
method: 'get',
params: query
})
}
// 导出农资批次 Excel
export function exportInputsBatchExcel(query) {
return request({
url: '/product/inputs-batch/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得农资批次编号
export function getInputsBatchNumberList(count) {
return request({
url: '/product/inputs-batch/getInputsBatchNumberList?count=' + count,
method: 'get'
})
}
// 批量删除农资批次
export function deleteBatch(params) {
return request({
url: '/product/inputs-batch/deleteBatch?' + Object.keys(params).map(key => key + '=' + params[key]).join('&'),
method: 'delete',
})
}

@ -1,96 +0,0 @@
import request from '@/utils/request'
// 创建农资采购
export function createInputsBuy(data) {
return request({
url: '/product/inputs-buy/create',
method: 'post',
data: data
})
}
// 更新农资采购
export function updateInputsBuy(data) {
return request({
url: '/product/inputs-buy/update',
method: 'put',
data: data
})
}
// 删除农资采购
export function deleteInputsBuy(id) {
return request({
url: '/product/inputs-buy/delete?id=' + id,
method: 'delete'
})
}
// 获得农资采购
export function getInputsBuy(id) {
return request({
url: '/product/inputs-buy/get?id=' + id,
method: 'get'
})
}
// 获得农资采购分页
export function getInputsBuyPage(query) {
return request({
url: '/product/inputs-buy/page',
method: 'get',
params: query
})
}
// 导出农资采购 Excel
export function exportInputsBuyExcel(query) {
return request({
url: '/product/inputs-buy/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得农资采购单号
export function getInputsBuyNumberList(count) {
return request({
url: '/product/inputs-buy/getInputsBuyNumberList?count=' + count,
method: 'get'
})
}
// 获得农资采购(通过出库单号,用于新增)
export function getInputsBuyByOutbound(query) {
return request({
url: '/product/inputs-buy/getInputsBuyByOutbound',
method: 'get',
params: query,
})
}
// 冻结
export function getInputsBuyFreeze(id) {
return request({
url: '/product/inputs-buy/freeze?id='+id,
method: 'put',
})
}
// 激活
export function getInputsBuyActive(id) {
return request({
url: '/product/inputs-buy/active?id='+id,
method: 'put',
})
}
// 上链
export function getInputsBuyUpChain(id) {
return request({
url: '/product/inputs-buy/upChain?id='+id,
method: 'put',
})
}

@ -1,10 +0,0 @@
import request from '@/utils/request'
// 根据农资id获取所有农资批次
export function getInputsBatchInputsBatchIdList(params) {
return request({
url: '/product/inputs-batch/getInputsBatchInputsBatchIdList',
method: 'get',
params,
})
}

@ -1,63 +0,0 @@
import request from '@/utils/request'
// 创建地块状态
export function createLandBlockState(data) {
return request({
url: '/product/land-block-state/create',
method: 'post',
data: data
})
}
// 更新地块状态
export function updateLandBlockState(data) {
return request({
url: '/product/land-block-state/update',
method: 'put',
data: data
})
}
// 删除地块状态
export function deleteLandBlockState(id) {
return request({
url: '/product/land-block-state/delete?id=' + id,
method: 'delete'
})
}
// 获得地块状态
export function getLandBlockState(id) {
return request({
url: '/product/land-block-state/get?id=' + id,
method: 'get'
})
}
// 获得地块状态分页
export function getLandBlockStatePage(query) {
return request({
url: '/product/land-block-state/page',
method: 'get',
params: query
})
}
// 导出地块状态 Excel
export function exportLandBlockStateExcel(query) {
return request({
url: '/product/land-block-state/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 根据商户ID获取所有地块状态
export function getBusinessInfoByListLandBlockState(query) {
  return request({
    url: '/product/land-block-state/getBusinessInfoByListLandBlockState',
    method: 'get',
    params: query
  })
}

@ -1,73 +0,0 @@
import request from '@/utils/request'
// 创建农事土地信息
export function createLandInfo(data) {
return request({
url: '/product/land-info/create',
method: 'post',
data: data
})
}
// 更新农事土地信息
export function updateLandInfo(data) {
return request({
url: '/product/land-info/update',
method: 'put',
data: data
})
}
// 删除农事土地信息
export function deleteLandInfo(id) {
return request({
url: '/product/land-info/delete?id=' + id,
method: 'delete'
})
}
// 获得农事土地信息
export function getLandInfo(id) {
return request({
url: '/product/land-info/get?id=' + id,
method: 'get'
})
}
// 获得农事土地信息分页
export function getLandInfoPage(query) {
return request({
url: '/product/land-info/page',
method: 'get',
params: query
})
}
// 导出农事土地信息 Excel
export function exportLandInfoExcel(query) {
return request({
url: '/product/land-info/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得所有地块名称
export function getLandInfoLandNameList(query) {
return request({
url: '/product/land-info/nameList',
method: 'get',
params: query
})
}
// 根据商户名称获取所有地块昵称
export function getBusinessNamesByLandId(query) {
  return request({
    url: '/product/land-info/getByBusinessId',
    method: 'get',
    params: query
  })
}

@ -1,63 +0,0 @@
import request from '@/utils/request'
// 创建地块类型
export function createLandInfoType(data) {
return request({
url: '/product/land-info-type/create',
method: 'post',
data: data
})
}
// 更新地块类型
export function updateLandInfoType(data) {
return request({
url: '/product/land-info-type/update',
method: 'put',
data: data
})
}
// 删除地块类型
export function deleteLandInfoType(id) {
return request({
url: '/product/land-info-type/delete?id=' + id,
method: 'delete'
})
}
// 获得地块类型
export function getLandInfoType(id) {
return request({
url: '/product/land-info-type/get?id=' + id,
method: 'get'
})
}
// 获得地块类型分页
export function getLandInfoTypePage(query) {
return request({
url: '/product/land-info-type/page',
method: 'get',
params: query
})
}
// 导出地块类型 Excel
export function exportLandInfoTypeExcel(query) {
return request({
url: '/product/land-info-type/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 根据belongBusinessId商户id获取所有地块类型
export function getByBusinessInfoId(params) {
return request({
url: '/product/land-info-type/getByBusinessInfoId',
method: 'get',
params
})
}

@ -1,87 +0,0 @@
import request from '@/utils/request'
// 创建种植/养殖/畜牧作业
export function createLandJob(data) {
return request({
url: '/product/land-job/create',
method: 'post',
data: data
})
}
// 更新种植/养殖/畜牧作业
export function updateLandJob(data) {
return request({
url: '/product/land-job/update',
method: 'put',
data: data
})
}
// 删除种植/养殖/畜牧作业
export function deleteLandJob(id) {
return request({
url: '/product/land-job/delete?id=' + id,
method: 'delete'
})
}
// 获得种植/养殖/畜牧作业
export function getLandJob(id) {
return request({
url: '/product/land-job/get?id=' + id,
method: 'get'
})
}
// 获得种植/养殖/畜牧作业分页
export function getLandJobPage(query) {
return request({
url: '/product/land-job/page',
method: 'get',
params: query
})
}
// 导出种植/养殖/畜牧作业 Excel
export function exportLandJobExcel(query) {
return request({
url: '/product/land-job/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 批量新增作业计划
export function createLandJobBatch(data) {
  return request({
    url: '/product/land-job/LandJobBatch',
    method: 'post',
data: data
  })
}
// 上链
export function landJobUpChain(id) {
  return request({
    url: '/product/land-job/upChain?id='+id,
    method: 'put',
  })
}
// 冻结
export function landJobFreeze(id) {
  return request({
    url: '/product/land-job/freeze?id='+id,
    method: 'put',
  })
}
// 激活
export function landJobActive(id) {
  return request({
    url: '/product/land-job/active?id='+id,
    method: 'put',
  })
}

@ -1,9 +0,0 @@
import request from '@/utils/request'
// 删除地块作业农资
export function deleteLandJobInputs(id) {
return request({
url: '/product/land-job-inputs/delete?id=' + id,
method: 'delete',
})
}

@ -1,72 +0,0 @@
import request from '@/utils/request'
// 创建作业类型
export function createLandJobType(data) {
return request({
url: '/product/land-job-type/create',
method: 'post',
data: data
})
}
// 更新作业类型
export function updateLandJobType(data) {
return request({
url: '/product/land-job-type/update',
method: 'put',
data: data
})
}
// 删除作业类型
export function deleteLandJobType(id) {
return request({
url: '/product/land-job-type/delete?id=' + id,
method: 'delete'
})
}
// 获得作业类型
export function getLandJobType(id) {
return request({
url: '/product/land-job-type/get?id=' + id,
method: 'get'
})
}
// 获得作业类型分页
export function getLandJobTypePage(query) {
return request({
url: '/product/land-job-type/page',
method: 'get',
params: query
})
}
// 导出作业类型 Excel
export function exportLandJobTypeExcel(query) {
return request({
url: '/product/land-job-type/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 根据belongBusinessName获取所以地块类型
export function getLandJobTypesByBelongBusinessName(params) {
return request({
url: '/product/land-job-type/getLandJobTypesByBelongBusinessName',
method: 'get',
params,
})
}
// 根据商户ID获得作业类型
export function getByBusinessInfoId(params) {
return request({
url: '/product/land-job-type/getByBusinessInfoId',
method: 'get',
params,
})
}

@ -1,81 +0,0 @@
import request from '@/utils/request'
// 创建地块作业计划
export function createLandPlan(data) {
return request({
url: '/product/land-plan/create',
method: 'post',
data: data
})
}
// 更新地块作业计划
export function updateLandPlan(data) {
return request({
url: '/product/land-plan/update',
method: 'put',
data: data
})
}
// 删除地块作业计划
export function deleteLandPlan(id) {
return request({
url: '/product/land-plan/delete?id=' + id,
method: 'delete'
})
}
// 获得地块作业计划
export function getLandPlan(id) {
return request({
url: '/product/land-plan/get?id=' + id,
method: 'get'
})
}
// 获得地块作业计划分页
export function getLandPlanPage(query) {
return request({
url: '/product/land-plan/page',
method: 'get',
params: query
})
}
// 导出地块作业计划 Excel
export function exportLandPlanExcel(query) {
return request({
url: '/product/land-plan/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得地块作业计划列表
export function getLandPlanByGoodsId(params) {
return request({
url: '/product/land-plan/getLandPlanByGoodsId',
method: 'get',
params,
})
}
// 批量创建地块作业计划
export function createLandPlanList(data) {
  return request({
    url: '/product/land-plan/createList',
    method: 'post',
    data: data
  })
}
// 获得地块作业计划列表,用于农事活动配置
export function getLandFarmingConfig(params) {
  return request({
    url: '/product/land-plan/getLandPlanForFarmingConfig',
    method: 'get',
params,
  })
}

@ -1,468 +0,0 @@
<template>
<div class="app-container">
<div class="app-container-search main-bgcolor main-radius">
<h1 class="">农资管理</h1>
<br />
<!-- 搜索工作栏 -->
<SearchInfo
ref="searchForm"
:searchFormParam="searchFormParam"
:showSearch.sync="showSearch"
@handleQuery="handleQuery"
@resetQuery="resetQuery"
></SearchInfo>
</div>
<div class="app-container-list main-bgcolor main-radius shopping">
<div class="shopping-top">
<div class="shopping-title">农资列表</div>
<el-button class="shopping-add-btn" type="primary" plain @click="handleAdd"
v-hasPermi="['basic:inputs-info:create']">添加农资</el-button>
</div>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" type="index" width="80" >
<template v-slot="{ $index }">
<span>{{($index+1)+ (searchFormParam.queryParams.pageNo-1)*searchFormParam.queryParams.pageSize }}</span>
</template>
</el-table-column>
<el-table-column label="农资名称" align="center" prop="inputsName" width="160"/>
<el-table-column label="农资图片" align="center" prop="inputsName" width="250">
<template slot-scope="{ row }">
<template v-if="Array.isArray(row.inputsPhotoUrl)">
<el-image
style="width: 60px; height: 60px;margin: 5px;"
v-for="(item,index) in row.inputsPhotoUrl"
:key="index"
:src="item"
:preview-src-list="row.inputsPhotoUrl"
fit="fill"></el-image>
</template>
<template v-else>{{row.inputsPhotoUrl}}</template>
</template>
</el-table-column>
<el-table-column label="农资编码" align="center" prop="inputsId" width="200">
<template slot-scope="{ row }">
<el-tooltip class="item" effect="dark" :content="row.inputsId" placement="top">
<div class="flex-acenter">
<span class="more-width-20">{{row.inputsId}}</span>
<el-button type="text" icon="el-icon-copy-document" @click.stop="copyContent(row.inputsId)"></el-button>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="所属商户" align="center" prop="belongBusinessName" width="140"/>
<el-table-column label="农资规格" align="center" prop="inputsSpecs" width="150"/>
<el-table-column label="农资单位" align="center" prop="inputsUnitName" width="150"/>
<el-table-column label="保质期(天)" align="center" prop="shelfLife" width="150"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="150" >
<template v-slot="{ row }">
<span>{{parseTime(row.createTime)}}</span>
</template>
</el-table-column>
<el-table-column label="农资说明" align="center" prop="inputsRemarks" width="150"/>
<el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width" width="160">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['basic:inputs-info:update']">编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['basic:inputs-info:delete']">删除</el-button>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog class="add-dialog" :title="title" :visible.sync="open" width="800px" append-to-body @open="handleDialogOpen">
<el-form ref="form" :model="form" :rules="rules" label-width="80px" label-position="top">
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="农资名称" prop="inputsName">
<el-input v-model="form.inputsName" placeholder="请输入农资名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属商户" prop="belongBusinessName">
<el-select class="w100" ref="businessName" @change="handchangeBusiness" v-model="form.belongBusinessId" :placeholder=this.belongBusinessPlaceholder>
<el-option v-for="item in businessNameList" :key="item.id" :label="item.businessName" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item label="农资编码" prop="inputsId">
<el-input v-model="form.inputsId" placeholder="请输入农资编码" />
</el-form-item>
</el-col> -->
<!-- <el-col :span="12">
<el-form-item label="农资单位" prop="inputsUnit">
<el-input v-model="form.inputsUnit" placeholder="请输入农资单位" />
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item label="保质期(天)" prop="shelfLife">
<el-input v-model="form.shelfLife" placeholder="请输入保质期天" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="单位规格" prop="isBaseUnit">
<el-radio v-model="form.isBaseUnit" :label="true" @change="resetConversionFields" >默认(kg)</el-radio>
<el-radio v-model="form.isBaseUnit" :label="false">
<el-input style="width: 150px;" placeholder="请输入" v-model="form.conversionValue" @input="changeConversion" type="number" min="0" step="1"></el-input>
<span>kg/</span>
<el-select style="width: 150px;" v-model="form.inputsUnitId" placeholder="请选择" @change="changeConversion">
<el-option
v-for="item in unitList"
:key="item.id"
:label="item.unitName"
:value="item.id">
</el-option>
</el-select>
</el-radio>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item label="农资规格" prop="inputsSpecs">
<el-input v-model="form.inputsSpecs" placeholder="请输入农资规格" />
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item label="农资说明" prop="inputsRemarks">
<el-input v-model="form.inputsRemarks" placeholder="请输入农资说明" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="农资图片(最多上传6张)" prop="inputsPhotoUrl">
<imageUpload v-model="form.inputsPhotoUrl" :limit="6"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createInputsInfo, updateInputsInfo, deleteInputsInfo, getInputsInfo, getInputsInfoPage } from "@/api/basic/inputsInfo";
import { getBusinessNameList } from '@/api/basic/businessInfo';
import { getUnitPage } from '@/api/basic/unit';
import SearchInfo from '@/components/Customer/SearchForm'
import EmptyTable from '@/components/EmptyTable'
import ImageUpload from '@/components/ImageUpload';
export default {
name: "InputsInfo",
components: {
SearchInfo,
EmptyTable,
ImageUpload
},
data() {
return {
//
belongBusinessPlaceholder:'请选择所属商户',
//
loading: true,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
searchFormParam:{
//
queryParams: {
pageNo: 1,
pageSize: 10,
inputs_name: null,
goodsId: null,
belongBusinessName:null,
inputsId:null,
},
dataSource:[
{
key:'inputsName',
itemType:'input',
label:'农资名称',
placeholder:'请输入农资名称',
onEnterKeyUp:this.handleQuery
},
{
key:'inputsId',
itemType:'input',
label:'农资编码',
placeholder:'请输入农资编码',
onEnterKeyUp:this.handleQuery
},
{
key:'belongBusinessName',
itemType:'input',
label:'所属商户',
placeholder:'请输入所属商户',
onEnterKeyUp:this.handleQuery
},
],
},
//
queryParams: {
pageNo: 1,
pageSize: 10,
inputsName: null,
inputsId: null,
inputsUnit: null,
inputsSpecs: null,
inputsRemarks: null,
inputsPhotoUrl: null,
shelfLife: null,
belongBusinessId: null,
belongBusinessName: null,
createTime: [],
},
//
form: {},
//
rules: {
inputsName: [{ required: true, message: "农资名称不能为空", trigger: "blur" }],
inputsId: [{ required: true, message: "农资id不能为空", trigger: "blur" }],
inputsUnit: [{ required: true, message: "农资单位不能为空", trigger: "blur" }],
shelfLife: [
{
required: true,
message: "保质期天数不能为空",
trigger: "blur"
},
{
pattern: /(^[0-9]*$)/,
message: "保质期天数只能为数字",
trigger: "blur"
}
],
belongBusinessId: [{ required: true, message: "所属商户不能为空", trigger: "blur" }],
belongBusinessName: [{ required: true, message: "所属商户不能为空", trigger: "blur" }],
isBaseUnit: [{ required: true, message: "所属商户不能为空", trigger: "blur" }],
},
//
businessNameList: [],
//
unitList: [],
};
},
created() {
this.getList();
//this.getBusinessNameList();
},
methods: {
//
handleDialogOpen() {
this.getUnitPage();
},
getUnitPage() {
// getUnitPage unitList
getUnitPage().then(res => {
this.unitList = res.data.list;
}).catch(error => {
console.error(error);
});
},
/** 查询列表 */
getList() {
this.loading = true;
if(this.searchFormParam.queryParams.inputsId == ''){
this.searchFormParam.queryParams.inputsId = null;
}
//
getInputsInfoPage(this.searchFormParam.queryParams).then(response => {
let list = response.data.list;
list.map(item => {
if( item.inputsPhotoUrl ){
if( item.inputsPhotoUrl.indexOf(',') != -1 ) {
item.inputsPhotoUrl = item.inputsPhotoUrl.split(',');
}else{
item.inputsPhotoUrl = [item.inputsPhotoUrl];
}
}else{
item.inputsPhotoUrl = '--';
}
});
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 获取当前分页列表 */
getInputsInfoList() {
this.loading = true;
let queryParams = {
pageNo: this.searchFormParam.queryParams.pageNo,
pageSize: this.searchFormParam.queryParams.pageSize,
}
//
getInputsInfoPage(queryParams).then(response => {
let list = response.data.list;
list.map(item => {
if( item.inputsPhotoUrl ){
if( item.inputsPhotoUrl.indexOf(',') != -1 ) {
item.inputsPhotoUrl = item.inputsPhotoUrl.split(',');
}else{
item.inputsPhotoUrl = [item.inputsPhotoUrl];
}
}else{
item.inputsPhotoUrl = '--';
}
});
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
//
getBusinessNameList(){
getBusinessNameList().then(res => {
this.businessNameList = res.data;
});
},
handchangeBusiness(e){
this.$nextTick(()=>{
this.form.belongBusinessName = this.$refs.businessName.selected.label;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
inputsName: undefined,
inputsId: undefined,
inputsUnit: undefined,
inputsRemarks: undefined,
inputsPhotoUrl: undefined,
shelfLife: undefined,
isBaseUnit: undefined,//
inputsUnitId: undefined,// id(kg)0
inputsSpecs: undefined,// 5kg/(kg)
conversionValue: undefined,//
belongBusinessId: undefined,
belongBusinessName: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm", "searchForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.getBusinessNameList();
this.belongBusinessPlaceholder = '请选择所属商户'
this.open = true;
this.title = "添加农资";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
this.getBusinessNameList();
getInputsInfo(id).then(response => {
this.form = response.data;
//
let isTip = true;
for(var x=0;x<this.businessNameList.length;x++){
if(this.businessNameList[x].id == this.form.belongBusinessId){
isTip = false;
}
}
if( isTip ) {
this.form.belongBusinessId = undefined
this.form.belongBusinessName = undefined
this.belongBusinessPlaceholder = '所属商户已删除,请重新选择'
}else{
this.belongBusinessPlaceholder = '请选择所属商户'
}
this.open = true;
this.title = "修改农资";
// resetConversionFields
if (this.form.isBaseUnit) {
this.resetConversionFields();
}
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
let form = JSON.parse(JSON.stringify(this.form));
if(!form.isBaseUnit && ( !form.conversionValue || !form.inputsUnitId )){
this.$message.error("单位规则非默认时,规格数量和规格单位不能为空");
return false;
}
//
if (this.form.id != null) {
updateInputsInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getInputsInfoList();
});
return;
}
//
createInputsInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getInputsInfoList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除该农资?').then(function() {
return deleteInputsInfo(id);
}).then(() => {
this.getInputsInfoList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
resetConversionFields() {
if (this.form.isBaseUnit) {
this.form.conversionValue = '';
this.form.inputsUnitId = null;
}
},
changeConversion(e){
this.form.isBaseUnit = false;
},
}
};
</script>

@ -1,270 +0,0 @@
<template>
<div class="app-container">
<el-row :gutter="50">
<el-col :span="18">
<div class="app-container-search main-bgcolor main-radius">
<h1 class="">溯源链证书配置</h1>
<br />
<div class="flex-acenter mb-16">
<div class="fs-14">所属商户:</div>
<div class="ml10">
<el-select class="w200" ref="businessName" @change="handchangeBusiness" v-model="info.belongBusinessId"
placeholder="请选择所属商户">
<el-option v-for="item in businessNameList" :key="item.id" :label="item.businessName"
:value="item.id" />
</el-select>
</div>
</div>
<div class="setting-card">
<div class="card-title">链信息</div>
<div class="card-content">
<div class="flex-acenter w100 mb-16">
<div class="card-label">所在链:</div>
<div class="setting-radio" style="margin: 0 10px 0 10px;">
<el-radio v-model="info.selectChain" :label="0">({{info.chainNameDefault}})</el-radio>
<el-radio v-model="info.selectChain" :label="1"></el-radio>
</div>
<el-input class="setting-radio-input w200" :disabled="info.selectChain==0?true:false" placeholder="请输入"
v-model="info.chainName"></el-input>
</div>
<div class="w100 mb20">
<div class="card-label">所在区块</div>
<div class="flex-acenter">
<span>扫码展示</span>
<el-switch v-model="info.showBlock"></el-switch>
</div>
</div>
<div class="w100 mb20">
<div class="card-label">成块时间</div>
<div class="flex-acenter">
<span>扫码展示</span>
<el-switch v-model="info.showBlockTime"></el-switch>
</div>
</div>
<div class="w100 mb20">
<div class="card-label">唯一编码</div>
<div class="flex-acenter">
<span>扫码展示</span>
<el-switch v-model="info.showIdentity"></el-switch>
</div>
</div>
</div>
</div>
<div class="setting-card">
<div class="card-title">身份信息</div>
<div class="card-content">
<div class="flex-acenter w100 mb-16">
<div class="card-label">上传者身份:</div>
<div class="setting-radio" style="margin: 0 10px 0 10px;">
<el-radio v-model="info.selectIdentity" :label="0">({{info.uploadUserDefault}})</el-radio>
<el-radio v-model="info.selectIdentity" :label="1"></el-radio>
</div>
<el-input class="setting-radio-input w200" :disabled="info.selectIdentity==0?true:false"
placeholder="请输入" v-model="info.uploadUser"></el-input>
</div>
<div class="w100 mb20">
<div class="card-label">上传主题证明</div>
<div class="flex-acenter">
<span>扫码展示</span>
<el-switch v-model="info.showSubjectProof"></el-switch>
</div>
</div>
<div class="w100 mb20">
<div class="card-label">上传时间</div>
<div class="flex-acenter">
<span>扫码展示</span>
<el-switch v-model="info.showUploadTime"></el-switch>
</div>
</div>
<div class="w100 mb20">
<div class="card-label">上传位置</div>
<div class="flex-acenter">
<span>扫码展示</span>
<el-switch v-model="info.showUploadLocation"></el-switch>
</div>
</div>
</div>
</div>
<div class="app-container-search main-bgcolor main-radius">
<el-button type="primary" @click="submitSave"></el-button>
</div>
</div>
</el-col>
<el-col :span="6">
<div class="card-show">
<div class="card-show-title">溯源链证书</div>
<div class="card-show-group mb-16">
<div class="show-group-label">所在链</div>
<div class="show-group-content">{{info.selectChain?info.chainName:info.chainNameDefault}}</div>
</div>
<div class="card-show-group mb-16" v-if="info.showBlock">
<div class="show-group-label">所在区块</div>
<div class="show-group-content">{{info.blockId}}</div>
</div>
<div class="card-show-group mb-16" v-if="info.showBlockTime">
<div class="show-group-label">成块时间</div>
<div class="show-group-content">{{parseTime(info.blockingTime)}}</div>
</div>
<div class="card-show-group mb-16" v-if="info.showIdentity">
<div class="show-group-label">唯一编码</div>
<div class="show-group-content">{{info.code}}</div>
</div>
<div class="flex-jcenter mb-16">
<div>上传者身份</div>
<div>{{info.selectIdentity?info.uploadUser:info.uploadUserDefault}}</div>
</div>
<div class="flex-jcenter mb-16" v-if="info.showSubjectProof">
<div>上传主题证明</div>
<div>{{info.uploadProve}}</div>
</div>
<div class="flex-jcenter mb-16" v-if="info.showUploadTime">
<div>上传时间</div>
<div>{{parseTime(info.uploadTime)}}</div>
</div>
<div class="flex-jcenter mb-16" v-if="info.showUploadLocation">
<div>上传位置</div>
<div>{{info.uploadPosition}}</div>
</div>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import {
getBusinessNameList
} from '@/api/basic/businessInfo';
import {
createTraceCert,
updateTraceCert,
getByBelongBusinessId
} from '@/api/configure/traceCert';
export default {
name: "TraceCert",
components: {},
data() {
return {
info: {
belongBusinessName: '',
belongBusinessId: '',
selectChain: 0, // 0 1
showBlock: true, //
showBlockTime: true, //
showIdentity: true, //
selectIdentity: 0, // 0 1
showSubjectProof: true, //
showUploadTime: true, //
showUploadLocation: true, //
chainNameDefault: '请先选择所属商户', //-
chainName: '', //-
blockId: '1684130468', //
blockingTime: '1684130468', //
code: 'ds0d1da5s4d5sad321sd5sa4d6as2d13asdds0d1da5s4d5sad321sd5sa4d6as2d13asd', //
uploadUserDefault: '请先选择所属商户', //-
uploadUser: '', //-
uploadProve: '91441881MA51RR...1993', //
uploadTime: '1684130468', //
uploadPosition: '30.1983,120.065101', //
},
//
businessNameList: [],
};
},
created() {
this.initDate();
},
methods: {
//
async submitSave() {
let info = JSON.parse(JSON.stringify(this.info));
if (!info.belongBusinessId) {
this.$message.error("所属商户不能为空");
return false;
}
if (info.selectChain && !info.chainName) {
this.$message.error("所在链备选项不能为空");
return false;
}
if (info.selectIdentity && !info.uploadUser) {
this.$message.error("上传者身份备选项不能为空");
return false;
}
info.chainName = info.selectChain ? info.chainName : info.chainNameDefault;
info.uploadUser = info.selectIdentity ? info.uploadUser : info.uploadUserDefault;
info.showBlock = info.showBlock?1:0;
info.showBlockTime = info.showBlockTime?1:0;
info.showIdentity = info.showIdentity?1:0;
info.showSubjectProof = info.showSubjectProof?1:0;
info.showUploadTime = info.showUploadTime?1:0;
info.showUploadLocation = info.showUploadLocation?1:0;
if (info.id) {
let res = await updateTraceCert(info);
if(res.data) this.$message.success("更新成功");
return false;
}
let rest = await createTraceCert(info);
if(rest.data) {
this.info.id = rest.data;
this.$message.success("创建成功");
};
console.log('配置', rest);
},
//
async initDate() {
let res = await getBusinessNameList();
this.businessNameList = res.data;
},
handchangeBusiness(e) {
this.$nextTick(async () => {
let label = this.$refs.businessName.selected.label;
this.info.belongBusinessName = label;
this.info.chainName = label;
this.info.uploadUser = label;
let { data } = await getByBelongBusinessId(e);
if(data){
data.chainNameDefault = data.chainName?data.chainName:label;
data.uploadUserDefault = data.uploadUser?data.uploadUser:label;
data.showBlock = data.showBlock?true:false;
data.showBlockTime = data.showBlockTime?true:false;
data.showIdentity = data.showIdentity?true:false;
data.showSubjectProof = data.showSubjectProof?true:false;
data.showUploadTime = data.showUploadTime?true:false;
data.showUploadLocation = data.showUploadLocation?true:false;
this.info = {
...this.info,
...data,
}
}else {
// data.chainNameDefault = label;
// data.uploadUserDefault = label;
// data.showBlock = true;
// data.showBlockTime = true;
// data.showIdentity = true;
// data.showSubjectProof = true;
// data.showUploadTime = true;
// data.showUploadLocation = true;
// data.id = 0;
data = {
chainNameDefault: label,
uploadUserDefault: label,
showBlock: true,
showBlockTime: true,
showIdentity: true,
showSubjectProof: true,
showUploadTime: true,
showUploadLocation: true,
id: 0,
};
this.info = {
...this.info,
...data,
}
}
});
},
}
};
</script>

@ -97,7 +97,7 @@
<div>{{filterText()}}</div>
</el-form-item>
<el-form-item label="生码数量" prop="codeNum">
<el-input type="number" min="0" v-model="form.codeNum" placeholder="单次上限50000个"></el-input>
<el-input type="number" @input.native="onCodeNumInput" v-model="form.codeNum" placeholder="单次上限500个"></el-input>
</el-form-item>
<el-form-item label="采收批次" prop="batchId">
<el-select ref="batchId" class="w100" @change="changeBatchId" :placeholder="placeholderBatchId" v-model="form.batchId" filterable>
@ -134,8 +134,8 @@
<script>
import SearchInfo from '@/components/Customer/SearchForm'
import EmptyBound from '@/components/EmptyTable'
import { createBusinessRule, updateBusinessRule, deleteBusinessRule, getBusinessRule, getBusinessRulePage, exportBusinessRuleExcel } from "@/api/identity/businessRule";
import { createGenerateRecord , createG } from '@/api/identity/generateRecord';
import { updateBusinessRule, deleteBusinessRule, getBusinessRulePage, exportBusinessRuleExcel } from "@/api/identity/businessRule";
import { createGenerateRecord } from '@/api/identity/generateRecord';
import { getBlockState } from '@/api/product/harvestBatch';
import { getDealerInfoByGoodsId } from '@/api/basic/dealerInfo';
export default {
@ -233,6 +233,11 @@ export default {
return;
}
},
onCodeNumInput() {
if (this.form.codeNum > 500) {
this.form.codeNum = 500;
}
},
/** 查询列表 */
getList() {
this.loading = true;

@ -268,7 +268,7 @@
<script>
import * as echarts from 'echarts';
import { getBusinessNameList } from '@/api/basic/businessInfo';
import { getBusinessNamesByLandId } from '@/api/product/landInfo';
// import { getBusinessNamesByLandId } from '@/api/product/landInfo';
import { createDeviceInfo, updateDeviceInfo, deleteDeviceInfo, getDeviceInfo, getDeviceInfoPage, exportDeviceInfoExcel , changeEnabled , changeSwitch } from "@/api/iot/deviceInfo";
import { getAllEnvType } from '@/api/iot/envType';
import { getAVGEnvDatasByTypeIds } from '@/api/iot/envData';

@ -51,7 +51,7 @@
<script>
import { createEnvData, updateEnvData, deleteEnvData, getEnvData, getEnvDataPage, exportEnvDataExcel } from "@/api/iot/envData";
import { getBusinessNameList } from '@/api/basic/businessInfo';
import { getBusinessNamesByLandId } from '@/api/product/landInfo';
// import { getBusinessNamesByLandId } from '@/api/product/landInfo';
import SearchInfo from "@/components/Customer/SearchForm/index.vue"
import EmptyTable from '@/components/EmptyTable'
export default {

@ -1,183 +0,0 @@
<template>
<div class="app-container">
<div class="app-container-search main-bgcolor main-radius">
<h1 class="">农资批次管理</h1>
<br />
<!-- 搜索工作栏 -->
<SearchForm
ref="searchForm"
:searchFormParam="{ queryParams , dataSource }"
:showSearch.sync="showSearch"
@handleQuery="handleQuery"
@resetQuery="resetQuery"
></SearchForm>
</div>
<div class="app-container-list main-bgcolor main-radius shopping">
<div class="shopping-top">
<div class="shopping-title">农资批次列表</div>
</div>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" type="index" width="80" >
<template v-slot="{ $index }">
<span>{{($index+1)+ (queryParams.pageNo-1)*queryParams.pageSize }}</span>
</template>
</el-table-column>
<el-table-column label="农资批次编号" align="center" prop="inputsBatchId" width="250" />
<el-table-column label="农资采购单号" align="center" prop="inputsBuyId" width="250" />
<el-table-column label="生产日期" align="center" prop="productData">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.productData) }}</span>
</template>
</el-table-column>
<el-table-column label="农资名称" align="center" prop="inputsName" />
<el-table-column label="所属商户名称" align="center" prop="belongBusinessName" />
<el-table-column label="备注" align="center" prop="remarks" />
<!-- <el-table-column label="状态" align="center" prop="blockState">
<template slot-scope="scope">
<span>{{ scope.row.blockState === 1 ? '已上传' : '冻结' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" @click="handleUpChain(scope.row)" v-if=" scope.row.blockState == 2 "
v-hasPermi="['product:inputs-batch:update']">激活</el-button>
<el-button size="mini" type="text" @click="handleUpChain(scope.row)" v-if=" scope.row.blockState == 1 "
v-hasPermi="['product:inputs-batch:update']">冻结</el-button>
</template>
</el-table-column> -->
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
</div>
</template>
<script>
import SearchForm from '@/components/Customer/SearchForm/index.vue';
import EmptyTable from '@/components/EmptyTable'
import { getInputsBatchPage } from "@/api/material/inputsBatch";
export default {
name: "InputsBatch",
components: {
SearchForm,
EmptyTable
},
data() {
return {
//
loading: true,
//
showSearch: true,
//
total: 0,
//
list: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
inputsName: null,
inputsBatchId: null,
inputsBuyId: null,
productData: null,
belongBusinessName: null,
},
//
dataSource: [
{
key: 'inputsName',
itemType: 'input',
label: '农资名称',
placeholder: '请输入农资名称',
onEnterKeyUp: this.handleQuery,
},
{
key: 'inputsBatchId',
itemType: 'input',
label: '批次编号',
placeholder: '请输入批次编号',
onEnterKeyUp: this.handleQuery,
},
{
key: 'inputsBuyId',
itemType: 'input',
label: '采购单号',
placeholder: '请输入采购单号',
onEnterKeyUp: this.handleQuery,
},
{
key: 'productData',
itemType: 'datePicker',
label: '生产日期',
onEnterKeyUp: this.handleQuery,
},
{
key: 'belongBusinessName',
itemType: 'input',
label: '所属商户',
placeholder: '请输入所属商户',
onEnterKeyUp: this.handleQuery,
},
],
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getInputsBatchPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false
this.reset()
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
inputsName: undefined,
inputsId: undefined,
inputsBuyId: undefined,
productData: undefined,
belongBusinessId: undefined,
belongBusinessName: undefined,
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm',"searchForm");
this.handleQuery();
},
/** 上传 */
handleUpChain() {
},
}
};
</script>

File diff suppressed because it is too large Load Diff

@ -1,257 +0,0 @@
<template>
<div class="app-container">
<div class="app-container-search main-bgcolor main-radius">
<h1 class="">地块状态</h1>
<br />
<!-- 搜索工作栏 -->
<SearchForm
ref="searchForm"
:searchFormParam="{queryParams, dataSource}"
:showSearch.sync="showSearch"
@handleQuery="handleQuery"
@resetQuery="resetQuery"
></SearchForm>
</div>
<div class="app-container-list main-bgcolor main-radius shopping">
<div class="shopping-top">
<div class="shopping-title">地块状态列表</div>
<el-button class="shopping-add-btn" type="primary" plain @click="handleAdd"
v-hasPermi="['product:land-block-state:create']">新增</el-button>
</div>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="序号" align="center" type="index" width="80" >
<template v-slot="{ $index }">
<span>{{($index+1)+ (queryParams.pageNo-1)*queryParams.pageSize }}</span>
</template>
</el-table-column>
<el-table-column label="地块状态" align="center" prop="landStateName" />
<el-table-column label="所属商户" align="center" prop="belongBusinessName" />
<el-table-column label="创建时间" align="center" prop="createTime" >
<template v-slot="{ row }">
<span>{{parseTime(row.createTime)}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['product:land-block-state:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['product:land-block-state:delete']">删除</el-button>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="地块状态" prop="landStateName">
<el-input v-model="form.landStateName" placeholder="请输入地块状态名称" />
</el-form-item>
<el-form-item label="所属商户" prop="belongBusinessId">
<el-select class="w100" :disabled="idEdit" v-model="form.belongBusinessId" ref="business">
<el-option
v-for="(item,index) in businessNameList"
:key="index"
:label="item.businessName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createLandBlockState, updateLandBlockState, deleteLandBlockState, getLandBlockState, getLandBlockStatePage, exportLandBlockStateExcel } from "@/api/product/landBlockState";
import { getBusinessNameList } from '@/api/basic/businessInfo';
import SearchForm from '@/components/Customer/SearchForm'
import EmptyTable from '@/components/EmptyTable'
export default {
name: "LandBlockState",
components: {
SearchForm,
EmptyTable,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
landStateName: null,
belongBusinessId: null,
belongBusinessName: null,
createTime: [],
},
dataSource:[
{
key: 'landStateName',
itemType: 'input',
label: '地块状态',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'belongBusinessName',
itemType: 'input',
label: '所属商户',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
],
//
form: {},
//
rules: {
landStateName: [{ required: true, message: "地块状态不能为空", trigger: "blur" }],
belongBusinessId: [{ required: true, message: "所属商户id不能为空", trigger: "blur" }],
},
businessNameList: [],
idEdit: false,
};
},
created() {
this.getList();
this.initDate();
},
methods: {
//
async initDate(){
let res = await getBusinessNameList();
this.businessNameList = res.data;
console.log('所有商户列表',res);
},
/** 查询列表 */
getList() {
this.loading = true;
//
getLandBlockStatePage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
landStateName: undefined,
belongBusinessId: undefined,
belongBusinessName: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加地块状态";
this.idEdit = false;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getLandBlockState(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改地块状态";
this.idEdit = true;
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateLandBlockState(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createLandBlockState(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除地块状态编号为"' + id + '"的数据项?').then(function() {
return deleteLandBlockState(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有地块状态数据项?').then(() => {
this.exportLoading = true;
return exportLandBlockStateExcel(params);
}).then(response => {
this.$download.excel(response, '地块状态.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>

@ -1,433 +0,0 @@
<template>
<div class="app-container">
<div class="app-container-search main-bgcolor main-radius">
<h1 class="">地块管理</h1>
<br />
<!-- 搜索工作栏 -->
<RecordForm
ref="searchForm"
:searchFormParam="{queryParams, dataSource}"
:showSearch.sync="showSearch"
@handleQuery="handleQuery"
@resetQuery="resetQuery"
@selectChage="selectChage"
></RecordForm>
</div>
<div class="app-container-list main-bgcolor main-radius">
<!-- 操作工具栏 -->
<h1>地块列表</h1>
<el-button
style="float: right; margin-bottom: 10px"
type="primary"
:loading="exportLoading"
@click="handleAdd"
v-hasPermi="['product:land-info:create']"
>添加地块</el-button>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" type="index" width="80" >
<template v-slot="{ $index }">
<span>{{($index+1)+ (queryParams.pageNo-1)*queryParams.pageSize }}</span>
</template>
</el-table-column>
<el-table-column label="地块名称" align="center" prop="landName" />
<el-table-column label="地块编码" align="center" prop="landId" />
<el-table-column label="类型" align="center" prop="infoTypeName" >
</el-table-column>
<el-table-column label="所属商户" align="center" prop="belongBusinessName" />
<el-table-column label="面积" align="center" prop="size" />
<el-table-column label="状态" align="center" prop="infoStateName" >
</el-table-column>
<el-table-column label="备注" align="center" prop="remarks" />
<el-table-column label="操作" fixed="right" class-name="small-padding fixed-width" width="150">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['product:land-info:update']">编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['product:land-info:delete']">删除</el-button>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" class="goods-verify" :visible.sync="open" width="530px" v-dialogDrag append-to-body>
<el-form ref="form" :rules="rules" label-position="top" :model="form" label-width="80px">
<el-form-item label="所属商户" prop="belongBusinessId">
<el-select ref="businessName" @change="handchangeBusiness" v-model="form.belongBusinessId" placeholder="请选择所属商户">
<el-option v-for="item in businessNameList" :key="item.id" :label="item.businessName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="地块名称" prop="landName">
<el-input v-model="form.landName" placeholder="请输入" />
</el-form-item>
<el-form-item label="地块类型" prop="landType">
<el-select v-model="form.landType" placeholder="请先选择所属商户">
<el-option :key="item.id" v-for="item in landTypeList" :label="item.landTypeName" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="state">
<el-select v-model="form.state" placeholder="请先选择所属商户">
<el-option :key="item.id" v-for="item in stateList" :label="item.landStateName" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="面积" prop="size">
<el-input placeholder="请输入" v-model="form.size" type="number" min="0" step="0.01" @change="changeSize">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input type="textarea" class="w150" v-model="form.remarks" placeholder="请输入" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createLandInfo, updateLandInfo, deleteLandInfo, getLandInfo, getLandInfoPage, exportLandInfoExcel } from "@/api/product/landInfo";
import { getBusinessNameList } from '@/api/basic/businessInfo';
import { getByBusinessInfoId } from '@/api/product/landInfoType';
import { getBusinessInfoByListLandBlockState } from '@/api/product/landBlockState';
import RecordForm from '@/components/Customer/SearchForm'
import EmptyTable from '@/components/EmptyTable'
export default {
name: "LandInfo",
components: {
RecordForm,
EmptyTable,
},
data() {
return {
options: [{
value: 0,
label: '修整'
},{
value: 1,
label: '种植'
}],
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
landName: null,
landId: null,
size: null,
state: null,
remarks: null,
landType: null,
belongBusinessId: null,
belongBusinessName: null,
createTime: [],
status: null,
},
dataSource: [
{
key: 'landName',
itemType: 'input',
label: '地块名称',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'landId',
itemType: 'input',
label: '地块编码',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'belongBusinessName',
itemType: 'select',
label: '所属商户',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
options:[],
isNet: true,
},
{
key: 'state',
itemType: 'select',
label: '状态',
placeholder: '请先选择所属商户',
onEnterKeyUp: this.handleQuery,
options: [],
},
],
//
form: {},
//
rules: {
belongBusinessName: [{ required: true, message: "所属商户名称不能为空", trigger: "blur" }],
landName: [{ required: true, message: "地块名称不能为空", trigger: "blur" }],
landType: [{ required: true, message: "地块类型不能为空", trigger: "blur" }],
landId: [{ required: true, message: "地块编码不能为空", trigger: "blur" }],
status: [{ required: true, message: "状态不能为空", trigger: "blur" }],
},
//
businessNameList: [],
landTypeList:[],
stateList: [],
};
},
created() {
this.getList();
this.initDate();
},
methods: {
async initDate(){
//
let res = await getBusinessNameList();
this.businessNameList = res.data;
res.data.map(item=>{
item.label = item.businessName;
item.value = item.businessName;
});
this.dataSource[2].options = res.data;
},
//
handchangeBusiness(e){
this.$nextTick(async ()=>{
this.form.belongBusinessName = this.$refs.businessName.selected.label;
let res = await getByBusinessInfoId({id: e});
console.log("获取商户昵称对应的地块类型列表",res);
if(res.data) this.landTypeList = res.data;
if(!res.data) this.landTypeList = [];
let resState = await getBusinessInfoByListLandBlockState({id: e});
console.log("获取商户对应的地块状态列表",resState);
if(res.data) this.stateList = resState.data;
if(!res.data) this.stateList = [];
});
},
/** 查询列表 */
getList() {
this.loading = true;
//
getLandInfoPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
landName: undefined,
landId: undefined,
size: undefined,
state: undefined,
remarks: undefined,
landType: undefined,
belongBusinessId: undefined,
belongBusinessName: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dataSource[3].options = []
this.resetForm("queryForm","searchForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加地块";
this.landTypeList = [];
this.stateList = [];
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getLandInfo(id).then(async response => {
this.form = response.data;
this.form.state = Number( this.form.state );
this.open = true;
this.title = "修改农事土地信息";
let res = await getByBusinessInfoId({id: response.data.belongBusinessId});
console.log("获取商户昵称对应的地块类型列表",res);
if(res.data) this.landTypeList = res.data;
if(!res.data) this.landTypeList = [];
let resState = await getBusinessInfoByListLandBlockState({id: response.data.belongBusinessId});
console.log("获取商户对应的地块状态列表",resState);
if(res.data) this.stateList = resState.data;
if(!res.data) this.stateList = [];
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateLandInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createLandInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除农事土地信息编号为"' + id + '"的数据项?').then(function() {
return deleteLandInfo(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有农事土地信息数据项?').then(() => {
this.exportLoading = true;
return exportLandInfoExcel(params);
}).then(response => {
this.$download.excel(response, '农事土地信息.xls');
this.exportLoading = false;
}).catch(() => {});
},
selectChage({ value, type, book }) {
if (type != 'state') {
this.queryParams.state = ''
}
if (!book) {
return
}
if(value == null || value == ''){
this.dataSource[3].options = []
return
}
let businessInfo = this.businessNameList.find(item=>item.businessName == value);
getBusinessInfoByListLandBlockState({
id: businessInfo.id,
}).then((res) => {
this.$nextTick(() => {
this.dataSource[3].options = res.data.map((el) => {
let obj = {
label: el.landStateName,
value: el.id,
key: el.id,
}
return obj
})
})
})
},
//
changeSize(e){
this.form.size = Number(e).toFixed(2);
},
}
};
</script>
<style scoped lang="scss">
.goods-verify{
.el-select{
width: 100%;
}
.el-date-editor{
width: 90%;
}
}
.hide {
::v-deep .el-upload--picture-card {
display: none !important;
}
}
.verifyFileUpload{
::v-deep .el-icon-document{
white-space:nowrap;
text-overflow: ellipsis;
overflow: hidden;
width: 240px;
}
}
.table-column{
display: flex;
align-items: center;
justify-content: center;
.dian{
width: 5px;
height: 5px;
border-radius: 100%;
background-color: rgb(217, 217, 217);
display: inline-block;
}
.dian-active{
background-color: rgb(82, 196, 26);
}
.column-content{
display: inline-block;
padding-left: 6px;
}
}
</style>

@ -1,256 +0,0 @@
<template>
<div class="app-container">
<div class="app-container-search main-bgcolor main-radius">
<h1 class="">地块类型</h1>
<br />
<!-- 搜索工作栏 -->
<SearchForm
ref="searchForm"
:searchFormParam="{queryParams, dataSource}"
:showSearch.sync="showSearch"
@handleQuery="handleQuery"
@resetQuery="resetQuery"
></SearchForm>
</div>
<div class="app-container-list main-bgcolor main-radius shopping">
<div class="shopping-top">
<div class="shopping-title">地块类型列表</div>
<el-button class="shopping-add-btn" type="primary" plain @click="handleAdd"
v-hasPermi="['product:land-info-type:create']">新增</el-button>
</div>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="序号" align="center" type="index" width="80" >
<template v-slot="{ $index }">
<span>{{($index+1)+ (queryParams.pageNo-1)*queryParams.pageSize }}</span>
</template>
</el-table-column>
<el-table-column label="地块类型" align="center" prop="landTypeName" />
<el-table-column label="所属商户" align="center" prop="belongBusinessName" />
<el-table-column label="创建时间" align="center" prop="createTime" >
<template v-slot="{ row }">
<span>{{parseTime(row.createTime)}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['product:land-info-type:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['product:land-info-type:delete']">删除</el-button>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="地块类型" prop="landTypeName">
<el-input v-model="form.landTypeName" placeholder="请输入地块类型名称" />
</el-form-item>
<el-form-item label="所属商户" prop="belongBusinessId">
<el-select class="w100" :disabled="idEdit" v-model="form.belongBusinessId" ref="business">
<el-option
v-for="(item,index) in businessNameList"
:key="index"
:label="item.businessName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createLandInfoType, updateLandInfoType, deleteLandInfoType, getLandInfoType, getLandInfoTypePage, exportLandInfoTypeExcel } from "@/api/product/landInfoType";
import { getBusinessNameList } from '@/api/basic/businessInfo';
import SearchForm from '@/components/Customer/SearchForm'
import EmptyTable from '@/components/EmptyTable'
export default {
name: "LandInfoType",
components: {
SearchForm,
EmptyTable,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
landTypeName: null,
belongBusinessId: null,
belongBusinessName: null,
createTime: [],
},
dataSource:[
{
key: 'landTypeName',
itemType: 'input',
label: '地块类型',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'belongBusinessName',
itemType: 'input',
label: '所属商户',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
],
//
form: {},
//
rules: {
landTypeName: [{ required: true, message: "地块类型不能为空", trigger: "blur" }],
belongBusinessId: [{ required: true, message: "所属商户id不能为空", trigger: "blur" }],
},
businessNameList: [],
idEdit: false,
};
},
created() {
this.getList();
this.initDate();
},
methods: {
//
async initDate(){
let res = await getBusinessNameList();
this.businessNameList = res.data;
console.log('所有商户列表',res);
},
/** 查询列表 */
getList() {
this.loading = true;
//
getLandInfoTypePage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
landTypeName: undefined,
belongBusinessId: undefined,
belongBusinessName: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm","searchForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加地块类型";
this.idEdit = false;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getLandInfoType(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改地块类型";
this.idEdit = true;
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateLandInfoType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createLandInfoType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除此地块类型?').then(function() {
return deleteLandInfoType(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有地块类型数据项?').then(() => {
this.exportLoading = true;
return exportLandInfoTypeExcel(params);
}).then(response => {
this.$download.excel(response, '地块类型.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>

@ -1,912 +0,0 @@
<template>
<div class="app-container">
<div class="app-container-search main-bgcolor main-radius">
<h1 class="">种植作业</h1>
<br />
<!-- 搜索工作栏 -->
<RecordForm
ref="searchForm"
:searchFormParam="{queryParams, dataSource}"
:showSearch.sync="showSearch"
@handleQuery="handleQuery"
@resetQuery="resetQuery"
@selectChage="selectChage"
></RecordForm>
</div>
<div class="app-container-list main-bgcolor main-radius shopping">
<div class="shopping-top">
<div class="shopping-title">作业列表</div>
<el-button class="shopping-add-btn" type="primary" :loading="exportLoading" @click="handleAdd"
v-hasPermi="['basic:goods-info:create']">添加作业</el-button>
</div>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" type="index" width="80" >
<template v-slot="{ $index }">
<span>{{($index+1)+ (queryParams.pageNo-1)*queryParams.pageSize }}</span>
</template>
</el-table-column>
<el-table-column label="地块名称" align="center" prop="landName" width="160" />
<el-table-column label="地块编码" align="center" prop="landId" min-width="200" />
<el-table-column label="任务类型" align="center" prop="jobTypeName" width="160" >
<!-- <template v-slot="{ row }">
<span>{{filterJobType(row.jobType)}}</span>
</template> -->
</el-table-column>
<el-table-column label="所属商户" align="center" prop="belongBusinessName" width="160" />
<el-table-column label="作业时间" align="center" prop="jobDate" width="160" >
<template v-slot="{row}">
<span>{{parseTime(row.jobDate)}}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="blockState" >
<template v-slot="{ row }">
<el-tag
:type="row.blockState==0?'info':row.blockState == 1?'success':'danger'">
{{filterState(row.blockState)}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="作业员工" align="center" prop="jobWorker" />
<el-table-column label="备注" align="center" prop="remarks" />
<el-table-column label="操作" align="center" fixed="right" width="200" class-name="small-padding fixed-width">
<template v-slot="{ row }">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(row,false)" v-if="row.blockState == 0"
v-hasPermi="['product:land-job:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(row,true)" v-if="row.blockState != 0"
v-hasPermi="['product:land-job:update']">查看</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(row)"
v-hasPermi="['product:land-job:delete']">删除</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleState(row,'upChain')" v-if="row.blockState == 0"
v-hasPermi="['product:land-job:update']">上传</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleState(row,'freeze')" v-if="row.blockState == 1"
v-hasPermi="['product:land-job:update']">冻结</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleState(row,'active')" v-if="row.blockState == 2"
v-hasPermi="['product:land-job:update']">激活</el-button>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog class="add-dialog" :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px" label-position="top">
<div class="add-items">
<el-form-item label="所属商户" prop="belongBusinessId">
<el-select ref="businessName" @change="handchangeBusiness" v-model="form.belongBusinessId" placeholder="请选择" :disabled="isEdit">
<el-option v-for="item in businessNameList" :key="item.id" :label="item.businessName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="地块名称" prop="landId">
<el-select ref="landName" @change="handChangelands" v-model="form.landId" placeholder="请选择所属商户" :disabled="isWatch">
<el-option v-for="item in landNameList" :key="item.landId" :type="item.landType" :label="item.landName" :value="item.landId" />
</el-select>
</el-form-item>
</div>
<div class="add-items">
<el-form-item label="任务类型" prop="jobType">
<el-select v-model="form.jobType" placeholder="请选择所属商户" :disabled="isWatch">
<el-option v-for="item in typeList" :label="item.typeName" :key="item.id" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="作业员工" prop="jobWorkerId">
<el-select ref="workerName" @change="handChangeworker" v-model="form.jobWorkerId" placeholder="请选择所属商户" :disabled="isWatch">
<el-option v-for="item in workerNameList" :key="item.id" :label="item.workersName" :value="item.id" />
</el-select>
</el-form-item>
</div>
<div class="add-items">
<el-form-item label="作业日期" prop="jobDate">
<el-date-picker style="width: 100%;" clearable v-model="form.jobDate" :disabled="isWatch" type="datetime" value-format="timestamp" placeholder="选择作业日期" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" :disabled="isWatch" />
</el-form-item>
</div>
<div style="width: 60%;">
<el-form-item label="作业图片" prop="jobImgUrl">
<imageUpload class="imageUpload" :disabled="isWatch" v-model="form.jobImgUrl" :limit="6"/>
</el-form-item>
</div>
<div class="add-items">
<el-form-item label="作业视频" prop="jobVideoUrl">
<videoUpload class="videoUpload" :disabled="isWatch" v-model="form.jobVideoUrl" :value="form.jobVideoUrl" />
</el-form-item>
</div>
</el-form>
<el-button
v-if="!isWatch"
style="float: right; margin-bottom: 10px"
type="primary"
:loading="exportLoading"
@click="handleAddInputs"
>添加农资</el-button
>
<el-table v-loading="loading" :data="inputsList">
<el-table-column label="农资名称" align="center" prop="inputsName" width="100" />
<el-table-column label="农资编码" align="center" prop="inputsId" width="240" />
<el-table-column label="农资批次编号" align="center" prop="inputsBatchId" width="180" >
<template v-slot="{ row , $index }">
<el-select v-model="row.inputsBatchId" :disabled="isWatch" placeholder="请选择" @focus="getHarvestOptions($index,row)" :loading="row.harvestLoading">
<el-option
v-for="item in harvestOptions"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="inputsNum" width="140" >
<template v-slot="{ row }">
<el-input-number class="w100" :disabled="isWatch" v-model="row.inputsNum" controls-position="right" :min="1"></el-input-number>
</template>
</el-table-column>
<el-table-column label="图片" align="center" prop="image" width="80" >
<template v-slot="{ row , $index }">
<el-button size="mini" type="text" :disabled="isWatch" @click="handleEditImage(row,$index)"
>编辑</el-button>
</template>
</el-table-column>
<el-table-column label="视频" align="center" prop="video" width="80" >
<template v-slot="{ row , $index }">
<el-button size="mini" type="text" :disabled="isWatch" @click="handleEditVideo(row,$index)"
>编辑</el-button>
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="inputsUnit" width="70" />
<!-- 目前说明字段用的是备注 后续可能还需要确定 数据库缺少说明字段 -->
<el-table-column label="说明" align="center" prop="inputsDesc" width="160" v-if="!isWatch">
<template v-slot="{ row }">
<el-input v-model="row.inputsDesc" :disabled="isWatch" placeholder="请输入"></el-input>
</template>
</el-table-column>
<el-table-column label="说明" align="center" prop="inputsDesc" fixed="right" width="160" v-if="isWatch">
<template v-slot="{ row }">
<el-input v-model="row.inputsDesc" :disabled="isWatch" placeholder="请输入"></el-input>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" v-if="!isWatch" class-name="small-padding fixed-width" width="100">
<template v-slot="scope">
<el-popconfirm
title="确定删除此作业农资?"
@confirm="handleDeleteInputs(scope.row,scope.$index)">
<el-button slot="reference" size="mini" type="text" icon="el-icon-delete">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog class="add-dialog" :title="titleInputs" :visible.sync="openInputs" width="900px" append-to-body>
<Transfer
ref="goodsTransfer"
:data="inputInfoOptions"
:vModel="inputCheckedIdList"
:renderContent="renderTransferLabel"
:titles="['可选', '已选']"
@change="handleSelectChange"
:leftCurrentPage="leftCurrentPage"
:rightCurrentPage="rightCurrentPage"
@handlePageChange="handlePageChange"
:leftDefaultChecked="leftDefaultChecked"
:rightDefaultChecked="rightDefaultChecked"
></Transfer>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormTransfer"> </el-button>
<el-button @click="openInputs = false"> </el-button>
</div>
</el-dialog>
<el-dialog
:title="titleEdit"
:visible.sync="openEdit"
width="600px"
append-to-body>
<imageUpload v-if="titleEdit==''" class="imageUpload" v-model="inputsImgUrl" :limit="6"/>
<videoUpload v-if="titleEdit==''" class="videoUpload" v-model="inputsVideoUrl" :value="inputsVideoUrl" />
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitEditFile"> </el-button>
<el-button @click="openEdit = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
createLandJob,
updateLandJob,
deleteLandJob,
getLandJob,
getLandJobPage,
exportLandJobExcel,
landJobUpChain,
landJobFreeze,
landJobActive,
} from "@/api/product/landJob";
import RecordForm from '@/components/Customer/SearchForm'
import EmptyTable from '@/components/EmptyTable'
import Transfer from '@/components/Customer/Transfer'
import VideoUpload from '@/components/VideoUpload'
import ImageUpload from '@/components/ImageUpload'
import { getLandInfoLandNameList , getBusinessNamesByLandId } from '@/api/product/landInfo';
import { getInputsInfoInputsInfoList , getInputsInfoListByBelongBusinessId } from '@/api/basic/inputsInfo';
import { getBusinessNameList } from '@/api/basic/businessInfo';
import { getFindByBelongBusinessId } from '@/api/basic/workersInfo';
import { getInputsBatchInputsBatchIdList } from '@/api/product/inputsBatch';
import { deleteLandJobInputs } from '@/api/product/landJobInputs';
import { getByBusinessInfoId } from '@/api/product/landJobType';
export default {
name: "LandJob",
components: {
RecordForm,
EmptyTable,
Transfer,
VideoUpload,
ImageUpload,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
// //
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
landId: null,
landName: null,
landType: null,
jobType: null,
jobWorker: null,
jobWorkerId: null,
jobDate: [],
remarks: null,
belongBusinessId: null,
belongBusinessName: null,
createTime: [],
blockState: null,
},
dataSource: [
{
key: 'landName',
itemType: 'input',
label: '地块名称',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'landId',
itemType: 'input',
label: '地块编码',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'belongBusinessName',
itemType: 'select',
label: '所属商户',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
options:[],
isNet: true,
},
{
key: 'jobType',
itemType: 'select',
label: '任务类型',
placeholder: '请先选择所属商户',
onEnterKeyUp: this.handleQuery,
options: [],
},
],
//
form: {},
//
rules: {
landId: [{ required: true, message: "地块ID不能为空", trigger: "blur" }],
landName: [{ required: true, message: "地块名称不能为空", trigger: "blur" }],
landType: [{ required: true, message: "类型0地块 1鱼塘 2牧场不能为空", trigger: "change" }],
jobType: [{ required: true, message: "任务类型不能为空", trigger: "change" }],
jobWorker: [{ required: true, message: "作业员工不能为空", trigger: "blur" }],
jobWorkerId: [{ required: true, message: "作业ID不能为空", trigger: "blur" }],
jobDate: [{ required: true, message: "作业日期不能为空", trigger: "blur" }],
belongBusinessId: [{ required: true, message: "所属商户id不能为空", trigger: "blur" }],
belongBusinessName: [{ required: true, message: "所属商户名称不能为空", trigger: "blur" }],
},
//
businessNameList: [],
//
landNameList: [],
//
workerNameList: [],
//
inputsInfoList: [],
// ********************* *********************
openInputs: false,//-
titleInputs: '',//-
/*********************** 选择农资弹窗相关参数 ************************/
//
inputInfoOptions: [],
inputsList: [],
//
inputCheckedIdList: [],
// 1
leftCurrentPage: 1,
rightCurrentPage: 1,
leftDefaultChecked: [],
rightDefaultChecked: [],
// /
inputInfoList: [],
harvestOptions: [],
// /
openEdit: false,
// /
titleEdit: '',
//
inputsVideoUrl: [],
//
inputsImgUrl: [],
// /
indexEdit: 0,
// truefalse
isWatch: false,
// false true
isEdit: false,
//
typeList: [],
};
},
created() {
this.getList();
this.initDate();
},
methods: {
filterState(state){
let text = '';
switch(state){
case 0:
text = '未上传';
break;
case 1:
text = '已上传';
break;
case 2:
text = '冻结';
break;
default:
text = '未知';
break;
}
return text;
},
handleState(row,type){
const id = row.id;
let text;
switch(type){
case 'upChain':
text = '上传';
break;
case 'freeze':
text = '冻结';
break;
case 'active':
text = '激活';
break;
}
this.$modal.confirm(`是否确认${text}种植作业编号为${id}的数据项?`).then(function() {
switch(type){
case 'upChain':
return landJobUpChain(id);
case 'freeze':
return landJobFreeze(id);
case 'active':
return landJobActive(id);
}
}).then(() => {
this.getList();
this.$modal.msgSuccess(`${text}成功`);
}).catch(() => {});
},
async initDate(){
//
let res = await getBusinessNameList();
this.businessNameList = res.data;
res.data.map(item=>{
item.label = item.businessName;
item.value = item.businessName;
});
this.dataSource[2].options = res.data;
//
// let rest = await getLandInfoLandNameList();
// this.landNameList = rest.data;
//
// let inps = await getInputsInfoInputsInfoList();
// this.inputInfoList = inps.data;
},
searchDate(e){
let belongBusinessInfo = this.businessNameList.find(item=>item.id == e);
getBusinessNamesByLandId({ belongBusinessId: e }).then(res => {
this.landNameList = res.data;
});
getFindByBelongBusinessId({ belongBusinessId: e }).then(res=>{
this.workerNameList = res.data;
});
getInputsInfoListByBelongBusinessId({ belongBusinessId: e }).then((res)=>{
this.inputInfoList = res.data;
});
getByBusinessInfoId({ id: e }).then((res)=>{
this.typeList = res.data;
});
},
/** 查询列表 */
getList() {
this.loading = true;
//
getLandJobPage(this.queryParams).then(response => {
let list = response.data.list;
list.map(item => {
if( item.jobImgUrl ){
if( item.jobImgUrl.indexOf(',') != -1 ) {
item.jobImgUrl = item.jobImgUrl.split(',');
}else{
item.jobImgUrl = [item.jobImgUrl];
}
}
});
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
landId: undefined,
landName: undefined,
landType: undefined,
jobType: undefined,
jobWorker: undefined,
jobWorkerId: undefined,
jobDate: undefined,
remarks: undefined,
belongBusinessId: undefined,
belongBusinessName: undefined,
blockState: undefined,
jobImgUrl: undefined,
jobVideoUrl: undefined,
};
this.resetForm("form");
},
//id
handChangelands(){
this.$nextTick(()=>{
this.form.landName = this.$refs.landName.selected.label;
this.form.landType = this.$refs.landName.selected.$attrs.type;
console.log(this.form)
});
},
//id
handChangeworker(){
this.$nextTick(()=>{
this.form.jobWorker = this.$refs.workerName.selected.label;
});
},
handchangeBusiness(e){
this.$nextTick(()=>{
this.form.belongBusinessName = this.$refs.businessName.selected.label;
this.form.landId = '';
this.form.jobWorkerId = '';
this.inputsList = [];
this.inputCheckedIdList = [];
this.searchDate(e);
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dataSource[3].options = []
this.resetForm("queryForm", "searchForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.inputsList = [];
this.title = "添加种植/养殖/畜牧作业";
this.isWatch = false;
this.isEdit = false;
},
/** 修改按钮操作 */
// status true false
handleUpdate(row,status) {
this.reset();
const id = row.id;
getLandJob(id).then(res => {
res.data.jobType = Number(res.data.jobType);
this.searchDate(res.data.belongBusinessId);
this.form = res.data;
this.inputsList = res.data.landJobIds;
this.open = true;
this.isWatch = status;
let text = status?'查看':'修改';
this.title = `${text}种植/养殖/畜牧作业`;
this.isEdit = true;
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
// if( this.inputsList.length == 0 ){
// this.$message.error("");
// return;
// }
this.inputsList.inputsImgUrl = this.inputsList.concat(this.inputsList.inputsVideoUrl);
let form = JSON.parse(JSON.stringify(this.form));
form = {
...form,
landJobIds: this.inputsList,
}
//
if (form.id != null) {
updateLandJob(form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createLandJob(form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除种植/养殖/畜牧作业编号为"' + id + '"的数据项?').then(function() {
return deleteLandJob(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有种植/养殖/畜牧作业数据项?').then(() => {
this.exportLoading = true;
return exportLandJobExcel(params);
}).then(response => {
this.$download.excel(response, '种植/养殖/畜牧作业.xls');
this.exportLoading = false;
}).catch(() => {});
},
/** 添加农资 */
handleAddInputs(){
if(!this.form.belongBusinessId){
this.$message.error("请先选择商户");
return false;
}
this.titleInputs = '农资信息列表';
this.openInputs = true;
let data = JSON.parse(JSON.stringify(this.inputInfoList));
const options = [];
for(let i in data) {
options.push({
key: data[i].inputsId,
label: data[i].inputsName,
isNewInputs: 1,
...data[i]
});
}
this.inputInfoOptions = options;
this.leftCurrentPage = 1;
this.rightCurrentPage = 1;
this.leftDefaultChecked = [];
this.rightDefaultChecked = [];
},
//
getHarvestOptions(index,row){
if(row.harvestRes){
this.harvestOptions = this.inputsList[index].harvestOptions;
return false;
}
this.$set(this.inputsList[index],'harvestLoading',true);
getInputsBatchInputsBatchIdList({
inputsId: row.inputsId,
}).then(res=>{
let arr = []
if(res.data){
res.data.map((item)=>{
arr.push({
label: item,
value: item,
})
});
}
this.$nextTick(()=>{
this.harvestOptions = arr;
this.$set(this.inputsList[index],'harvestOptions',arr);
this.$set(this.inputsList[index],'harvestRes',true);
this.$set(this.inputsList[index],'harvestLoading',false);
});
});
},
async handleDeleteInputs(row,index){
if(!row.isNewInputs){
if(row.id){
let res = await deleteLandJobInputs(row.id);
if(res.data){
this.$message.success("删除成功");
}
console.log('删除结果',res);
}
this.inputsList.splice(index,1);
}else{
this.inputsList.splice(index,1);
this.$message.success("删除成功");
}
},
handleEditImage(row,index){
this.titleEdit = "编辑图片";
this.openEdit = true;
this.indexEdit = index;
this.inputsImgUrl = row.inputsImgUrl?row.inputsImgUrl:[];
},
handleEditVideo(row,index){
this.titleEdit = "编辑视频";
this.openEdit = true;
this.indexEdit = index;
this.inputsVideoUrl = row.inputsVideoUrl?row.inputsVideoUrl:undefined;
console.log('视频列表',this.inputsVideoUrl);
},
submitEditFile(){
if( this.titleEdit == "编辑图片" ){
this.inputsList[this.indexEdit].inputsImgUrl = this.inputsImgUrl;
}else{
this.inputsList[this.indexEdit].inputsVideoUrl = this.inputsVideoUrl;
}
this.openEdit = false;
this.inputsImgUrl = [];
this.inputsVideoUrl = [];
},
/*********************** 选择商品弹窗相关事件 ************************/
// 1
getCheckGoods(start,end,target){
let total = this.inputInfoOptions.length;
let list = this.inputCheckedIdList;
let options = this.inputInfoOptions;
for( var x=0; x<total ; x++ ){
if( options[x].inputsId == list[start] ){
options[x].harvestLoading = false;
options[x].harvestOptions = [];
options[x].harvestRes = false;//()
let isHas = true;
for(let i=0;i<this[target].length;i++){
if(this[target][i].inputsId == options[x].inputsId) isHas = false;
}
if(isHas) this[target].push(options[x]);
if(end>start) this.getCheckGoods(start+1,end,target);
return false;
}
}
},
/** 穿梭框提交按钮 */
submitFormTransfer(){
let num = this.inputCheckedIdList.length;
this.getCheckGoods(0,num,'inputsList');
this.openInputs = false;
},
/**
*
* @param {*} value 已选中的值[数组]
* @param {*} direction 移动方向 leftright
* @param {*} movedKeys 移动的key数组
*/
handleSelectChange(value, direction, movedKeys) {
this.inputCheckedIdList = value;
},
renderTransferLabel(h, option) {
return <div style="display:flex;align-item: center;">
<span title={option.inputsId} style="display: inline-block;max-width: 110px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{ option.inputsId }</span>
<span style='margin: 0px 30px; color: #e6ebf5;display: inline-block;'>|</span><span>{ option.inputsName }</span>
</div>;
},
/* 左侧分页参数变化时 */
// vue
//
// dialog if
handlePageChange(value, type) {
if(type === 'left') {
this.leftCurrentPage = value;
} else {
this.rightCurrentPage = value;
}
},
selectChage({ value, type, book }) {
if (type != 'jobType') {
this.queryParams.jobType = ''
}
if (!book) {
return
}
if(value == null || value == ''){
this.dataSource[3].options = []
return
}
let businessInfo = this.businessNameList.find(item=>item.businessName == value);
getByBusinessInfoId({
id: businessInfo.id,
}).then((res) => {
this.$nextTick(() => {
this.dataSource[3].options = res.data.map((el) => {
let obj = {
label: el.typeName,
value: el.id,
key: el.id,
}
return obj
})
})
})
},
}
};
</script>
<style scoped lang="scss">
.shopping{
line-height: 32px;
padding: 16px;
.shopping-top{
display: flex;
justify-content: space-between;
padding-bottom: 16px;
.shopping-title{
font-size: 16px;
}
.shopping-add-btn{
width: 88px;
height: 32px;
padding: 0;
background-color: #1890ff;
color: white;
}
}
.flex-acenter{
display: flex;
align-items: center;
}
.more-width-20,.more-width-full{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
}
.more-width-20{
width: calc(100% - 20px);
}
.more-width-full{
width: 100%;
}
}
.add-dialog{
.add-items{
display: flex;
align-items: center;
justify-content: space-between;
.el-form-item {
width: 48%;
}
.el-select{
width: 100%;
}
::v-deep .el-form-item__label{
line-height: 22px;
padding: 0 0 8px 0;
}
.el-cascader{
width: 100%;
}
}
}
.hide {
::v-deep .el-upload--picture-card {
display: none !important;
}
}
.imageUpload{
::v-deep .el-upload--picture-card{
line-height: 148px;
}
}
.videoUpload{
::v-deep .el-upload--picture-card{
// line-height: 80px;
}
::v-deep .el-upload--picture-card>div{
position: relative;
.success {
position: absolute;
top: 0;
}
}
}
</style>

@ -1,255 +0,0 @@
<template>
<div class="app-container">
<div class="app-container-search main-bgcolor main-radius">
<h1 class="">作业类型</h1>
<br />
<!-- 搜索工作栏 -->
<SearchForm
ref="searchForm"
:searchFormParam="{queryParams, dataSource}"
:showSearch.sync="showSearch"
@handleQuery="handleQuery"
@resetQuery="resetQuery"
></SearchForm>
</div>
<div class="app-container-list main-bgcolor main-radius shopping">
<div class="shopping-top">
<div class="shopping-title">类型列表</div>
<el-button class="shopping-add-btn" type="primary" plain @click="handleAdd"
v-hasPermi="['basic:goods-info:create']">新增</el-button>
</div>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="序号" align="center" type="index" width="80" >
<template v-slot="{ $index }">
<span>{{($index+1)+ (queryParams.pageNo-1)*queryParams.pageSize }}</span>
</template>
</el-table-column>
<el-table-column label="作业名称" align="center" prop="typeName" />
<el-table-column label="所属商户" align="center" prop="belongBusinessName" />
<el-table-column label="创建时间" align="center" prop="createTime" >
<template v-slot="{ row }">
<span>{{parseTime(row.createTime)}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['product:land-job-type:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['product:land-job-type:delete']">删除</el-button>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="类型名称" prop="typeName">
<el-input v-model="form.typeName" placeholder="请输入类型名称" />
</el-form-item>
<el-form-item label="所属商户" prop="belongBusinessId">
<el-select class="w100" :disabled="idEdit" v-model="form.belongBusinessId" ref="business">
<el-option
v-for="(item,index) in businessNameList"
:key="index"
:label="item.businessName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createLandJobType, updateLandJobType, deleteLandJobType, getLandJobType, getLandJobTypePage, exportLandJobTypeExcel } from "@/api/product/landJobType";
import { getBusinessNameList } from '@/api/basic/businessInfo';
import SearchForm from '@/components/Customer/SearchForm'
import EmptyTable from '@/components/EmptyTable'
export default {
name: "LandJobType",
components: {
SearchForm,
EmptyTable,
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
typeName: null,
belongBusinessId: null,
belongBusinessName: null,
createTime: [],
},
dataSource:[
{
key: 'typeName',
itemType: 'input',
label: '类型名称',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'belongBusinessName',
itemType: 'input',
label: '所属商户',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
],
//
form: {},
//
rules: {
typeName: [{ required: true, message: "地块名称不能为空", trigger: "blur" }],
belongBusinessId: [{ required: true, message: "所属商户id不能为空", trigger: "blur" }],
},
businessNameList: [],
idEdit: false,
};
},
created() {
this.getList();
this.initDate();
},
methods: {
//
async initDate(){
let res = await getBusinessNameList();
this.businessNameList = res.data;
console.log('所有商户列表',res);
},
/** 查询列表 */
getList() {
this.loading = true;
//
getLandJobTypePage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
typeName: undefined,
belongBusinessId: undefined,
belongBusinessName: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm","searchForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加作业类型";
this.idEdit = false;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getLandJobType(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改作业类型";
this.idEdit = true;
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateLandJobType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createLandJobType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除作业类型编号为"' + id + '"的数据项?').then(function() {
return deleteLandJobType(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有作业类型数据项?').then(() => {
this.exportLoading = true;
return exportLandJobTypeExcel(params);
}).then(response => {
this.$download.excel(response, '作业类型.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>

@ -1,613 +0,0 @@
<template>
<div class="app-container">
<div class="app-container-search main-bgcolor main-radius">
<h1 class="">种植计划</h1>
<br />
<!-- 搜索工作栏 -->
<RecordForm
ref="searchForm"
:searchFormParam="{queryParams, dataSource}"
:showSearch.sync="showSearch"
@handleQuery="handleQuery"
@resetQuery="resetQuery"
></RecordForm>
</div>
<div class="app-container-list main-bgcolor main-radius shopping">
<div class="shopping-top">
<div class="shopping-title">计划列表</div>
<el-button class="shopping-add-btn" type="primary" plain @click="handleAdd"
v-hasPermi="['product:land-plan:create']">添加计划</el-button>
</div>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" type="index" width="80" >
<template v-slot="{ $index }">
<span>{{($index+1)+ (queryParams.pageNo-1)*queryParams.pageSize }}</span>
</template>
</el-table-column>
<el-table-column label="计划编码" align="center" prop="landPlanId" width="200" />
<el-table-column label="地块名称" align="center" prop="landName" width="200" />
<el-table-column label="地块编码" align="center" prop="landId" width="200" />
<el-table-column label="所属商户" align="center" prop="belongBusinessName" width="160" />
<el-table-column label="商品名称" align="center" prop="goodsName" width="160" />
<el-table-column label="商品编号" align="center" prop="goodsId" width="200" />
<el-table-column label="种植时间" align="center" prop="planStartTime" width="120" >
<template v-slot="{row}">
<span>{{parseTime(row.planStartTime,'{y}-{m}-{d}')}}</span>
</template>
</el-table-column>
<el-table-column label="采收时间" align="center" prop="planEndTime" width="120" >
<template v-slot="{row}">
<span>{{parseTime(row.planEndTime,'{y}-{m}-{d}')}}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" fixed="right" width="130" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['product:land-plan:update']" >编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['product:land-plan:delete']" >删除</el-button>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog class="add-dialog" :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px" label-position="top">
<div class="add-items">
<el-form-item label="所属商户" prop="belongBusinessId">
<el-select ref="businessName" @change="handchangeBusiness" :disabled="isDisable" v-model="form.belongBusinessId" placeholder="请选择">
<el-option v-for="item in businessNameList" :key="item.id" :label="item.businessName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="地块名称" prop="landName">
<el-select ref="landName" @change="handChangelands" v-model="form.landId" placeholder="请先选择所属商户">
<el-option v-for="item in landNameList" :key="item.landId" :label="item.landName" :value="item.landId" />
</el-select>
</el-form-item>
</div>
</el-form>
<el-button
v-if="!isDisable"
style="float: right; margin-bottom: 50px"
type="primary"
:loading="exportLoading"
@click="handleAddGoods"
>添加商品</el-button>
<el-table v-loading="loading" :data="goodsList">
<el-table-column label="商品昵称" align="center" prop="goodsName" width="150"/>
<el-table-column label="商品编号" align="center" prop="goodsId" width="150"/>
<el-table-column label="种植时间" align="center" prop="planStartTime" width="230">
<template v-slot="{row}">
<el-date-picker
class="w100"
v-model="row.planStartTime"
value-format="timestamp"
type="date"
placeholder="选择日期">
</el-date-picker>
</template>
</el-table-column>
<el-table-column label="采收时间" align="center" prop="planEndTime" width="230">
<template v-slot="{row}">
<el-date-picker
class="w100"
v-model="row.planEndTime"
value-format="timestamp"
type="date"
placeholder="选择日期">
</el-date-picker>
</template>
</el-table-column>
<el-table-column label="说明" align="center" prop="remark">
<template v-slot="{row}">
<el-input placeholder="请输入" v-model="row.remark"></el-input>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog class="add-dialog" :title="titleGoods" :visible.sync="openGoods" width="800px" append-to-body>
<Transfer
ref="goodsTransfer"
:data="goodsOptions"
:vModel="inputCheckedIdList"
:renderContent="renderTransferLabel"
:titles="['可选', '已选']"
@change="handleSelectChange"
:leftCurrentPage="leftCurrentPage"
:rightCurrentPage="rightCurrentPage"
@handlePageChange="handlePageChange"
:leftDefaultChecked="leftDefaultChecked"
:rightDefaultChecked="rightDefaultChecked"
></Transfer>
<div slot="footer" class="dialog-footer">
<el-button @click="openGoods = false"> </el-button>
<el-button type="primary" @click="submitGoods"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createLandPlan , createLandPlanList , updateLandPlan, deleteLandPlan, getLandPlan, getLandPlanPage, exportLandPlanExcel } from "@/api/product/landPlan";
import RecordForm from '@/components/Customer/SearchForm'
import EmptyTable from '@/components/EmptyTable'
import { getBusinessNamesByLandId } from '@/api/product/landInfo';
import { createLandJobBatch } from '@/api/product/landJob';
import { getBusinessNameList } from '@/api/basic/businessInfo';
import { getGoodsNameLists , getGoodsListByBelongBusinessId } from '@/api/basic/goodsInfo'
import Transfer from '@/components/Customer/Transfer';
export default {
name: "LandPlan",
components: {
RecordForm,
EmptyTable,
Transfer
},
data() {
return {
//
loading: true,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
//
list: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
landId: null,
landName: null,
landPlanId: null,
goodsId: null,
goodsName: null,
planStartTime: [],
planEndTime: [],
belongBusinessId: null,
belongBusinessName: null,
remark: null,
createTime: [],
},
//
dataSource: [
{
key: 'landPlanId',
itemType: 'input',
label: '计划编码',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'landName',
itemType: 'input',
label: '地块名称',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'landId',
itemType: 'input',
label: '地块编码',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'belongBusinessName',
itemType: 'input',
label: '所属商户',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'goodsName',
itemType: 'input',
label: '商品名称',
placeholder: '请输入',
onEnterKeyUp: this.handleQuery,
},
{
key: 'planStartTime',
itemType: 'datePicker',
label: '种植时间',
onEnterKeyUp: this.handleQuery,
},
{
key: 'planEndTime',
itemType: 'datePicker',
label: '采收时间',
onEnterKeyUp: this.handleQuery,
},
],
//
form: {},
//
rules: {
landId: [{ required: true, message: "地块ID不能为空", trigger: "blur" }],
landName: [{ required: true, message: "地块名称不能为空", trigger: "blur" }],
landPlanId: [{ required: true, message: "种植计划ID不能为空", trigger: "blur" }],
goodsId: [{ required: true, message: "商品ID不能为空", trigger: "blur" }],
goodsName: [{ required: true, message: "商品名称不能为空", trigger: "blur" }],
planStartTime: [{ required: true, message: "计划种植时间不能为空", trigger: "blur" }],
planEndTime: [{ required: true, message: "计划收获时间不能为空", trigger: "blur" }],
belongBusinessId: [{ required: true, message: "所属商户id不能为空", trigger: "blur" }],
belongBusinessName: [{ required: true, message: "所属商户名称不能为空", trigger: "blur" }],
},
//
businessNameList: [],
//
landNameList: [],
isDisable: false,
/*********************** 商品信息列表 ************************/
//
titleGoods: '',
//
openGoods: false,
/*********************** 选择商品弹窗相关参数 ************************/
//
goodsOptions: [],
//
goodsList: [],
//
inputCheckedIdList: [],
// 1
leftCurrentPage: 1,
rightCurrentPage: 1,
leftDefaultChecked: [],
rightDefaultChecked: [],
// /
inputInfoList: [],
};
},
created() {
this.getList();
// this.getLandInfoLandNameList();
this.getBusinessNameList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
getLandPlanPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
landId: undefined,
landName: undefined,
landPlanId: undefined,
goodsId: undefined,
goodsName: undefined,
planStartTime: undefined,
planEndTime: undefined,
belongBusinessId: undefined,
belongBusinessName: undefined,
remark: undefined,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm","searchForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加计划";
this.isDisable = false;
this.goodsList = [];
},
/** 修改按钮操作 */
async handleUpdate(row) {
this.reset();
this.goodsList = [];
this.isDisable = true;
const id = row.id;
getBusinessNamesByLandId({ belongBusinessId: row.belongBusinessId }).then(res => {
this.landNameList = res.data;
});
getLandPlan(id).then(response => {
this.form = response.data;
this.goodsList.push(response.data);
this.open = true;
this.title = "修改地块作业计划";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
if(this.goodsList.length == 0){
this.$message.error("商品不能为空");
return false;
}
this.form.landJobList = JSON.parse(JSON.stringify(this.goodsList));
this.form.landJobList.map(item=>{
item.landId = this.form.landId;
item.landName = this.form.landName;
});
//
if (this.form.id != null) {
updateLandPlan(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createLandPlanList(this.form.landJobList).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
this.reset();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除地块作业计划编号为"' + id + '"的数据项?').then(function() {
return deleteLandPlan(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
selectChage({ value, type, book }) {
if (type != 'belongBusinessName') {
this.queryParams.belongBusinessName = ''
}
if (!book) {
return
}
getBusinessNameList({
ids: value,
}).then((res) =>{
console.log(res,'res')
this.$nextTick(() =>{
this.dataSource[1].options = res.data.map((el) => {
let obj = {
label: el.belongBusinessName,
value: el.id,
key: el.id,
}
return obj
})
})
})
},
// id
handChangelands(e){
this.$nextTick(()=>{
this.form.landName = this.$refs.landName.selected.label;
console.log('change',e);
});
},
//
getBusinessNameList(){
getBusinessNameList().then(res => {
this.businessNameList = res.data;
});
},
handchangeBusiness(e){
this.$nextTick(()=>{
this.form.belongBusinessName = this.$refs.businessName.selected.label;
getBusinessNamesByLandId({ belongBusinessId: e }).then(res => {
this.landNameList = res.data;
});
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有地块作业计划数据项?').then(() => {
this.exportLoading = true;
return exportLandPlanExcel(params);
}).then(response => {
this.$download.excel(response, '地块作业计划.xls');
this.exportLoading = false;
}).catch(() => {});
},
/** 新增商品按钮操作 */
handleAddGoods() {
if(!this.form.belongBusinessId){
this.$message.error("请先选择所属商户");
return;
}
this.initTreesferDate();
this.openGoods = true;
this.titleGoods = "商品信息列表";
},
/*********************** 选择商品弹窗相关事件 ************************/
// 1
// 2 ---------------------
getCheckGoods(start,end,target){
let total = this.goodsOptions.length;
let list = this.inputCheckedIdList;
let options = this.goodsOptions;
for( var x=0; x<total ; x++ ){
if( options[x].id == list[start] ){
this[target].push(options[x]);
if(end>start) this.getCheckGoods(start+1,end,target);
return false;
}
}
},
//
initTreesferDate(){
getGoodsListByBelongBusinessId({belongBusinessId: this.form.belongBusinessId}).then(response => {
const { data } = response;
const options = [];
for(let i in data) {
options.push({
key: data[i].id,
label: data[i].name,
...data[i]
});
}
// /
this.goodsOptions = options;
this.leftCurrentPage = 1;
this.rightCurrentPage = 1;
this.leftDefaultChecked = [];
this.rightDefaultChecked = [];
});
},
//
submitGoods(){
this.goodsList = [];
this.form.landJobList = [];
let num = this.inputCheckedIdList.length;
this.getCheckGoods(0,num,'goodsList',1);
this.openGoods = false;
},
/**
*
* @param {*} value 已选中的值[数组]
* @param {*} direction 移动方向 leftright
* @param {*} movedKeys 移动的key数组
*/
handleSelectChange(value, direction, movedKeys) {
this.inputCheckedIdList = value;
},
renderTransferLabel(h, option) {
return <div style="display:flex;align-item: center;">
<span title={option.goodsId} style="display: inline-block;max-width: 110px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{ option.goodsId }</span>
<span style='margin: 0px 30px; color: #e6ebf5;display: inline-block;'>|</span><span>{ option.goodsName }</span>
</div>;
},
/* 左侧分页参数变化时 */
// vue
//
// dialog if
handlePageChange(value, type) {
if(type === 'left') {
this.leftCurrentPage = value;
} else {
this.rightCurrentPage = value;
}
},
}
};
</script>
<style scoped lang="scss">
.shopping{
line-height: 32px;
padding: 16px;
.shopping-top{
display: flex;
justify-content: space-between;
padding-bottom: 16px;
.shopping-title{
font-size: 16px;
}
.shopping-add-btn{
width: 88px;
height: 32px;
padding: 0;
background-color: #1890ff;
color: white;
}
}
.flex-acenter{
display: flex;
align-items: center;
}
.more-width-20,.more-width-full{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
}
.more-width-20{
width: calc(100% - 20px);
}
.more-width-full{
width: 100%;
}
}
.add-dialog{
.add-items{
display: flex;
align-items: center;
justify-content: space-between;
.el-form-item {
width: 48%;
}
.el-select{
width: 100%;
}
::v-deep .el-form-item__label{
line-height: 22px;
padding: 0 0 8px 0;
}
.el-cascader{
width: 100%;
}
}
}
.hide {
::v-deep .el-upload--picture-card {
display: none !important;
}
}
</style>

@ -1,450 +0,0 @@
<template>
<div class="app-container setting-main">
<div class="app-container-search main-radius">
<h1 style="margin: 0;">农事活动</h1>
</div>
<div class="app-container-search main-bgcolor main-radius setting-container">
<div class="setting-title flex-jcenter">
<div class="">
<span class="mr-6">农事活动</span>
<template>
<div class="setting-tag mr-6">{{info.isChainState?'已上传':'未上传'}}</div>
<span class="fs-12 mr-6" v-if="!info.isChainState"></span>
<el-switch v-model="info.chainState" :active-value="1" :inactive-value="0" v-if="info.isChainState === 0"></el-switch>
</template>
</div>
<el-button type="primary" @click="setOpenPlan" >选择地块计划</el-button>
</div>
<div>
<div
class="setting-massifList"
v-for="(item,index) in info.farmingPlans"
:key="index">
<div class="flex-jcenter" style="margin-bottom: 10px;">
<div class="setting-title setExpand" @click="item.isExpand = !item.isExpand" style="width: 22px;">
<i class="el-icon-arrow-down mr-10" :class="[item.isExpand?'expand-active':'expand']"></i>
</div>
<span style="display: flex; width: 190px;">
<el-input v-model="item.linkName" @click="e=> e.stopPropagation()" />
</span>
<div style="flex: 1;"></div>
<div style="display: flex;align-items: center;">
<div v-if="info.chainState && info.isChainState">
<span class="fs-12 mr-6" >扫码展示</span>
<el-switch v-model="item.scanShow" @change="changeScanShowMain($event,index)" :active-value="true" :inactive-value="false"></el-switch>
</div>
<el-popconfirm
title="确定删除吗?"
@confirm="info.farmingPlans.splice(index,1)">
<el-button slot="reference" type="text" class="mlr-10">删除</el-button>
</el-popconfirm>
</div>
</div>
<div class="infos" :class="[item.isExpand?'infos-active':'']">
<el-form ref="form" :model="item.form" label-width="80px">
<el-row :gutter="40">
<el-col :span="5">
<el-form-item label="地块编码:">
<el-input disabled v-model="item.operateDetails[0].content"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="计划编号:">
<el-input disabled v-model="item.operateDetails[1].content"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="种植时间:">
<el-input disabled v-model="item.operateDetails[2].content"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="采收时间:">
<el-input disabled v-model="item.operateDetails[3].content"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="说明:">
<el-input v-model="item.operateDetails[4].content"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:data="item.tableData"
style="width: 100%">
<el-table-column
prop="jobType"
label="任务类型">
</el-table-column>
<el-table-column
prop="inputsName"
label="农资名称">
</el-table-column>
<el-table-column
prop="inputsBatchId"
label="农资批次编号">
<template slot-scope="{ row }">
<div class="flex-acenter">
<el-tooltip class="item" effect="dark" :content="row.inputsBatchId" placement="top">
<span class="more-width-full">{{row.inputsBatchId}}</span>
</el-tooltip>
</div>
</template>
</el-table-column>
<el-table-column
prop="jobDate"
label="作业日期">
<template slot-scope="{row}">
<div class="flex-acenter">
<span>{{row.jobDate}}</span>
</div>
</template>
</el-table-column>
<el-table-column
prop="jobWorker"
label="作业员工">
<template slot-scope="{row}">
<div class="flex-acenter">
<span>{{row.jobWorker}}</span>
</div>
</template>
</el-table-column>
<el-table-column
prop="remarks"
label="图片">
<template v-slot="{ row }">
<div class="flex-acenter">
<div v-if="row.jobImage" @click="watchImage(row.jobImage)"></div>
<div v-if="!row.jobImage">-</div>
</div>
</template>
</el-table-column>
<el-table-column
prop="remarks"
label="视频">
<template v-slot="{ row }">
<div class="flex-acenter">
<div v-if="row.jobVideo" @click="watchVideo(row.jobVideo)"></div>
<div v-if="!row.jobVideo">-</div>
</div>
</template>
</el-table-column>
<el-table-column
prop="remarks"
label="说明">
<template v-slot="{ row }">
<div class="flex-acenter">
<el-input v-model="row.remarks" @input="changeRemarks($event,index)" placeholder="请输入"></el-input>
</div>
</template>
</el-table-column>
<el-table-column
label="扫码展示">
<template slot-scope="{row}">
<el-switch @change="changeScanShow($event,index)" v-model="row.scanShow"></el-switch>
</template>
</el-table-column>
<el-table-column
label="操作">
<template slot-scope="{ row, $index }">
<el-button @click="item.tableData.splice($index,1)" type="text" size="small">删除</el-button>
</template>
</el-table-column>
<div slot="empty">
<EmptyTable />
</div>
</el-table>
</div>
</div>
</div>
<div v-if="info.farmingPlans && info.farmingPlans.length == 0">
<EmptyTable />
</div>
</div>
<div class="setting-footer-btn">
<el-button @click="$router.go(-1);"></el-button>
<el-button type="primary" @click="submitSave"></el-button>
</div>
<el-dialog class="add-dialog" :title="titlePlan" :visible.sync="openPlan" width="1200px" append-to-body>
<Transfer
ref="transfer"
:data="planOptions"
:vModel="inputCheckedIdList"
:renderContent="renderTransferLabel"
:titles="['可选', '已选']"
@change="handleSelectChange"
:leftCurrentPage="leftCurrentPage"
:rightCurrentPage="rightCurrentPage"
@handlePageChange="handlePageChange"
:leftDefaultChecked="leftDefaultChecked"
:rightDefaultChecked="rightDefaultChecked"
></Transfer>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitTransferForm"> </el-button>
<el-button @click="openPlan = false"> </el-button>
</div>
</el-dialog>
<el-dialog class="add-dialog" title="查看图片" :visible.sync="openImage" width="600px" append-to-body>
<ImageUpload v-model="imageList" :disabled="true"></ImageUpload>
<div slot="footer" class="dialog-footer">
<el-button @click="openImage = false"> </el-button>
</div>
</el-dialog>
<el-dialog class="add-dialog" title="查看视频" :visible.sync="openVideo" width="600px" append-to-body>
<VideoUpload v-model="videoList" :value="videoList" :disabled="true"></VideoUpload>
<div slot="footer" class="dialog-footer">
<el-button @click="openVideo = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import Transfer from '@/components/Customer/Transfer'
import EmptyTable from '@/components/EmptyTable'
import ImageUpload from '@/components/ImageUpload';
import VideoUpload from '@/components/VideoUpload';
import { getLandPlanByGoodsId , getLandFarmingConfig } from '@/api/product/landPlan';
import { getFarmingConfig , updateFarmingConfig } from '@/api/product/harvestBatch';
export default{
components: {
EmptyTable,
Transfer,
ImageUpload,
VideoUpload,
},
data(){
return{
form: {},
info: {},
/*********************** 穿梭弹窗相关参数 ************************/
titlePlan: '地块计划信息列表',
// 穿
openPlan: false,
planOptions: [],
//
planList: [],
//
inputCheckedIdList: [],
// 1
leftCurrentPage: 1,
rightCurrentPage: 1,
leftDefaultChecked: [],
rightDefaultChecked: [],
imageList: [],
videoList: [],
openImage: false,
openVideo: false,
}
},
created() {
this.initDate();
},
mounted() {
},
methods:{
async initDate(){
let id = this.$route.query.id;
// -
let active = await getFarmingConfig({id});
this.inputCheckedIdList = [];
active.data.farmingPlans.length && active.data.farmingPlans.map((item,index)=>{
item.isExpand = false;
if( index == 0) item.isExpand = true;
console.log('上传',item.chainState);
active.data.isChainState = item.chainState?1:0;
active.data.chainState = item.chainState?1:0;
active.data.scanShow = item.scanShow;
// this.inputCheckedIdList.push(item.operateDetails[1].content);
item.tableData = [];
let indexKey = 0;
item.farmingJobs.length && item.farmingJobs.map(items=>{
items.indexKey = indexKey;
item.tableData.push({
jobType: items.operateDetails[0].content,
inputsName: items.operateDetails[1].content,
inputsBatchId: items.operateDetails[2].content,
jobDate: items.operateDetails[3].content,
jobWorker: items.operateDetails[4].content,
jobImage: items.operateDetails[5].content,
jobVideo: items.operateDetails[6].content,
remarks: items.operateDetails[7].content,
scanShow: items.scanShow,
indexKey,
});
indexKey ++;
});
});
this.info = active.data;
console.log('获得农事活动配置 - 溯源环节相关',this.info);
console.log('当前已选地块计划',this.inputCheckedIdList);
// 使
let landForm = {
goodsId: active.data.goodsId,
};
let res = await getLandPlanByGoodsId(landForm);
const options = [];
for(let i=0; i<res.data.length; i++) {
options.push({
key: res.data[i].id,
label: res.data[i].landName,
...res.data[i]
});
}
this.planOptions = options;
console.log('地块计划列表',res);
},
async submitTransferForm(){
this.openPlan = false;
let checkList = this.inputCheckedIdList.join(',');
console.log('checkList',checkList);
let res = await getLandFarmingConfig({
goodsId: this.info.goodsId,
ids: checkList,
});
if(res.data){
res.data.map((item,index)=>{
item.isExpand = false;
if( index == 0) item.isExpand = true;
res.data.isChainState = item.chainState?1:0;
res.data.chainState = item.chainState?1:0;
res.data.scanShow = item.scanShow;
item.tableData = [];
let indexKey = 0;
item.farmingJobs.length && item.farmingJobs.map(items=>{
items.indexKey = indexKey;
item.tableData.push({
jobType: items.operateDetails[0].content,
inputsName: items.operateDetails[1].content,
inputsBatchId: items.operateDetails[2].content,
jobDate: items.operateDetails[3].content,
jobWorker: items.operateDetails[4].content,
jobImage: items.operateDetails[5].content,
jobVideo: items.operateDetails[6].content,
remarks: items.operateDetails[7].content,
scanShow: items.scanShow,
indexKey,
});
indexKey ++;
});
});
this.info.farmingPlans = res.data;
this.info.isChainState = 0;
}
console.log('获得地块作业计划列表,用于农事活动配置',res);
},
//
initTreesferDate(){
// /
this.leftCurrentPage = 1;
this.rightCurrentPage = 1;
this.leftDefaultChecked = [];
this.rightDefaultChecked = [];
},
//
async submitSave(){
const farmingPlans = this.info.farmingPlans.map(plan => {
//
const indexKeys = plan.tableData.map(data => data.indexKey);
const farmingJobs = plan.farmingJobs.filter(job => indexKeys.includes(job.indexKey)).map(job => {
plan.tableData.map(data => {
if(data.indexKey == job.indexKey) {
//
job.operateDetails.map(detail => {
if(detail.title === '说明') {
detail.content = data.remarks;
}
});
}
});
return job;
});
return {
...plan,
farmingJobs,
}
});
let form = {
chainState: this.info.chainState,
id: this.$route.query.id,
farmingPlans,
};
let res = await updateFarmingConfig(form);
if(res.data){
this.$message.success("提交成功");
//
this.initDate();
}
console.log('更新结果',res);
},
//
setOpenPlan(){
this.initTreesferDate();
this.openPlan = true;
},
changeRemarks(e,index){
this.info.farmingPlans[index].farmingJobs[0].operateDetails[5].content = e;
},
changeScanShow(e,index){
this.info.farmingPlans[index].farmingJobs[0].scanShow = e;
},
changeScanShowMain(e,index){
this.info.farmingPlans[index].scanShow = e;
},
/**
*
* @param {*} value 已选中的值[数组]
* @param {*} direction 移动方向 leftright
* @param {*} movedKeys 移动的key数组
*/
handleSelectChange(value, direction, movedKeys) {
this.inputCheckedIdList = value;
console.log('已选择',this.inputCheckedIdList,this.planOptions);
},
renderTransferLabel(h, option) {
return <div style="display:flex;align-item: center;">
<span title={ option.landId } style="display: inline-block;min-width: 80px;max-width: 80px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{ option.landId }</span>
<span style='color: #e6ebf5;display: inline-block;margin:0 5px;'>|</span>
<span>{ option.landName }</span>
<span style='color: #e6ebf5;display: inline-block;margin:0 5px;'>|</span>
<span title={ option.landPlanId } style="display: inline-block;min-width: 40px;max-width: 80px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{ option.landPlanId }</span>
<span style='color: #e6ebf5;display: inline-block;margin:0 5px;'>|</span>
<span>{ this.parseTime(option.planStartTime, '{y}-{m}-{d}') }</span>
<span style='color: #e6ebf5;display: inline-block;margin:0 5px;'>|</span>
<span>{ this.parseTime(option.planEndTime, '{y}-{m}-{d}') }</span>
</div>;
},
/* 左侧分页参数变化时 */
// vue
//
// dialog if
handlePageChange(value, type) {
if(type === 'left') {
this.leftCurrentPage = value;
} else {
this.rightCurrentPage = value;
}
},
watchVideo(list){
this.videoList = list;
this.openVideo = true;
},
watchImage(list){
this.imageList = list;
this.openImage = true;
},
},
}
</script>
<style>
.setting-massifList{
margin-bottom: 20px;
}
</style>

@ -603,11 +603,11 @@
import { getTempListGoodsId , copyToTemplate , getTemplateDetail } from '@/api/configure/traceTemplate';
import { exportLinkConfig } from '@/api/product/harvestBatch';
import { getDictDataListByType } from '@/api/system/dict/data';
import { getLandPlanByGoodsId, getLandFarmingConfig } from '@/api/product/landPlan';
// import { getLandPlanByGoodsId, getLandFarmingConfig } from '@/api/product/landPlan';
import { getInspectionByHarvestBatchId } from '@/api/production/inspection';
import { getAvailableEnvType, getEnvTypeConfigGroupByLandId } from '@/api/iot/envType';
import { getAVGEnvDatasByTypeIds } from '@/api/iot/envData';
import { getBusinessNamesByLandId } from '@/api/product/landInfo';
// import { getBusinessNamesByLandId } from '@/api/product/landInfo';
import { getMonitorPreviewURLByLandId } from '@/api/iot/deviceInfo';
import { getLanguageType } from "@/api/system/languageType";
import { getUniTemplateOptions } from '@/api/configure/uniTemplate';
@ -876,30 +876,6 @@
operateDetails,
}
});
//
// this.farmingPlans = farmingPlans.map((item, index)=>{
// item.isExpand = false;
// if(index == 0) item.isExpand = true;
// // item.scanShow = true;
// item.tableData = [];
// item.farmingJobs?.map((job, index) => {
// job.indexKey = index;
// // job.scanShow = true;
// item.tableData.push({
// jobType: job.operateDetails[0].content,
// inputsName: job.operateDetails[1].content,
// inputsBatchId: job.operateDetails[2].content,
// jobDate: job.operateDetails[3].content,
// jobWorker: job.operateDetails[4].content,
// jobImage: job.operateDetails[5].content,
// jobVideo: job.operateDetails[6].content,
// remarks: job.operateDetails[7].content,
// scanShow: job.scanShow,
// indexKey: index,
// });
// });
// return item;
// });
//
this.inspections = inspections.map((item, index)=>{
@ -1077,20 +1053,10 @@
//
getLandInfoList(belongBusinessId) {
getBusinessNamesByLandId({ belongBusinessId }).then(({ data }) => {
this.landInfos = data.map(item => {
return {
label: item.landName,
value: item.landId,
}
});
//
this.currentLandInfoId = data[0]?.landId;
//
this.getEnvTypeConfig(belongBusinessId);
//
this.getMonitorList();
});
//
this.getEnvTypeConfig(belongBusinessId);
//
this.getMonitorList();
},
//

Loading…
Cancel
Save