|
@@ -0,0 +1,267 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="app-container">
|
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
+ <el-button
|
|
|
|
+ type="warning"
|
|
|
|
+ plain
|
|
|
|
+ icon="el-icon-download"
|
|
|
|
+ size="mini"
|
|
|
|
+ @click="handleExport"
|
|
|
|
+ v-hasPermi="['agricultural_machinery_info:AgriculturalMachineryInfo:export']"
|
|
|
|
+ >导出
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-table v-loading="loading" :data="AgriculturalMachineryInfoList" @selection-change="handleSelectionChange">
|
|
|
|
+ <el-table-column label="所属部门" align="center" prop="deptName"/>
|
|
|
|
+ <el-table-column label="设计存栏总数" align="center" prop="designMaintainCount">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ {{scope.row.designMaintainCount | filterText }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="设计出栏总数" align="center" prop="designOfftakeCount">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ {{scope.row.designOfftakeCount | filterText }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="实际存栏总数" align="center" prop="realityMaintainCount">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ {{scope.row.realityMaintainCount | filterText }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="实际出栏总数" align="center" prop="realityOfftakeCount">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ {{scope.row.realityOfftakeCount | filterText }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import {
|
|
|
|
+ listAgriculturalMachineryInfo,
|
|
|
|
+ getAgriculturalMachineryInfo,
|
|
|
|
+ delAgriculturalMachineryInfo,
|
|
|
|
+ addAgriculturalMachineryInfo,
|
|
|
|
+ updateAgriculturalMachineryInfo, listAnimalHusbandryInfo, listLivestockCount
|
|
|
|
+} from "@/api/data/digitalagriculture/agricultural_machinery_info/AgriculturalMachineryInfo";
|
|
|
|
+import deptselector from '@/views/components/deptselector'
|
|
|
|
+import {getToken} from '@/utils/auth'
|
|
|
|
+import {treeselectAll} from "@/api/system/dept";
|
|
|
|
+import {treeselect, addDeptToTreeSelect} from "@/api/rfh/community/community";
|
|
|
|
+import Treeselect from '@riophae/vue-treeselect'
|
|
|
|
+import supermap from '@/views/components/supermap'
|
|
|
|
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
|
+import {checkPositiveDecimal, checkNonnegativeInteger, validPhoneMobile,checkLon, checkLat} from "@/api/rules/rules";
|
|
|
|
+import {format_date} from "@/views/data/common/dateExport";
|
|
|
|
+import request from "@/utils/request";
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ name: "AgriculturalMachineryInfo",
|
|
|
|
+ dicts: ['centerdata_breeding_variety'],
|
|
|
|
+ components: {
|
|
|
|
+ deptselector,
|
|
|
|
+ Treeselect,
|
|
|
|
+ supermap,
|
|
|
|
+ },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ // 遮罩层
|
|
|
|
+ loading: true,
|
|
|
|
+ // 选中数组
|
|
|
|
+ ids: [],
|
|
|
|
+ // 非单个禁用
|
|
|
|
+ single: true,
|
|
|
|
+ // 非多个禁用
|
|
|
|
+ multiple: true,
|
|
|
|
+ // 显示搜索条件
|
|
|
|
+ showSearch: true,
|
|
|
|
+ // 显示超图经纬度
|
|
|
|
+ showLongitude: false,
|
|
|
|
+ // 显示超图弹层标题
|
|
|
|
+ titleLongitude: '经纬度',
|
|
|
|
+ // 总条数
|
|
|
|
+ total: 0,
|
|
|
|
+ // 弹出层宽度
|
|
|
|
+ labelWidth: '150px',
|
|
|
|
+ // 文本框宽度
|
|
|
|
+ inputStyle: 'width: 310px',
|
|
|
|
+ // 畜牧信息统计信息表格数据
|
|
|
|
+ AgriculturalMachineryInfoList: [],
|
|
|
|
+ // 弹出层标题
|
|
|
|
+ title: "",
|
|
|
|
+ // 是否显示弹出层
|
|
|
|
+ open: false,
|
|
|
|
+ // 部门名称
|
|
|
|
+ deptName: undefined,
|
|
|
|
+ // 部门树选项
|
|
|
|
+ deptOptions: undefined,
|
|
|
|
+ // 导入参数
|
|
|
|
+ upload: {
|
|
|
|
+ // 是否显示导入弹出层
|
|
|
|
+ open: false,
|
|
|
|
+ // 导入弹出层标题
|
|
|
|
+ title: '',
|
|
|
|
+ // 是否禁用上传
|
|
|
|
+ isUploading: false,
|
|
|
|
+ // 是否更新已经存在的数据
|
|
|
|
+ updateSupport: 0,
|
|
|
|
+ // 设置上传的请求头部
|
|
|
|
+ headers: {Authorization: 'Bearer ' + getToken()},
|
|
|
|
+ // 上传的地址
|
|
|
|
+ url: process.env.VUE_APP_BASE_API + '/center-data/AgriculturalMachineryInfo/import/importData'
|
|
|
|
+ },
|
|
|
|
+ // 是否禁用弹出层表单
|
|
|
|
+ disable: false,
|
|
|
|
+ // 查询参数
|
|
|
|
+ queryParams: {
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ name: null,
|
|
|
|
+ deptId: null,
|
|
|
|
+ deptName: null,
|
|
|
|
+ varieties: null,
|
|
|
|
+ designMaintainCount: null,
|
|
|
|
+ designOfftakeCount: null,
|
|
|
|
+ realityMaintainCount: null,
|
|
|
|
+ realityOfftakeCount: null,
|
|
|
|
+ },
|
|
|
|
+ // 表单参数
|
|
|
|
+ form: {},
|
|
|
|
+ // 正整数校验
|
|
|
|
+ checkNonnegativeInteger: checkNonnegativeInteger,
|
|
|
|
+ validPhoneMobile: validPhoneMobile,
|
|
|
|
+ checkPositiveDecimal: checkPositiveDecimal,
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.getList();
|
|
|
|
+ this.getTreeselect();
|
|
|
|
+ },
|
|
|
|
+ filters:{
|
|
|
|
+ //标题截取前20
|
|
|
|
+ filterText(value) {
|
|
|
|
+ if (!value) return "";
|
|
|
|
+ if (value.toString().indexOf('.0')!==-1) {
|
|
|
|
+ return value.slice(0, value.toString().length-2);
|
|
|
|
+ }
|
|
|
|
+ // alert(value)
|
|
|
|
+ return value;
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ showMap() {
|
|
|
|
+ this.showLongitude = true
|
|
|
|
+ },
|
|
|
|
+ showLatLng: function (lat, lng) {
|
|
|
|
+ this.form.latitude = lat
|
|
|
|
+ this.form.longitude = lng
|
|
|
|
+ },
|
|
|
|
+ setDeptId(deptId) {
|
|
|
|
+ this.form.deptId = deptId
|
|
|
|
+ },
|
|
|
|
+ setDataDeptId(e) {
|
|
|
|
+ this.form.deptId = e.deptId
|
|
|
|
+ this.form.deptName = e.deptName
|
|
|
|
+ },
|
|
|
|
+ // 筛选节点
|
|
|
|
+ filterNode(value, data) {
|
|
|
|
+ if (!value) return true
|
|
|
|
+ return data.label.indexOf(value) !== -1
|
|
|
|
+ },
|
|
|
|
+ // 节点单击事件
|
|
|
|
+ handleNodeClick(data) {
|
|
|
|
+ this.queryParams.deptId = data.id
|
|
|
|
+ this.handleQuery()
|
|
|
|
+ },
|
|
|
|
+ /** 查询畜牧信息技术列表 */
|
|
|
|
+ getList() {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ listLivestockCount(this.queryParams).then(response => {
|
|
|
|
+ this.AgriculturalMachineryInfoList = response.rows;
|
|
|
|
+ // const firstItem = this.AgriculturalMachineryInfoList.shift(); // 移除第一条数据并保存到firstItem
|
|
|
|
+ // this.AgriculturalMachineryInfoList.push(firstItem); // 将firstItem添加到数据源的末尾
|
|
|
|
+ this.total = response.total;
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ getTreeselect() {
|
|
|
|
+ request({
|
|
|
|
+ url: '/system/dept/treeselect',
|
|
|
|
+ method: 'get'
|
|
|
|
+ }).then(response => {
|
|
|
|
+ this.deptOptions = response.data;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ hx(node) {
|
|
|
|
+ this.queryParams.deptId = node.id
|
|
|
|
+ },
|
|
|
|
+ // 取消按钮
|
|
|
|
+ cancel() {
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.reset();
|
|
|
|
+ },
|
|
|
|
+ // 表单重置
|
|
|
|
+ reset() {
|
|
|
|
+ this.form = {
|
|
|
|
+ name: null,
|
|
|
|
+ deptId: null,
|
|
|
|
+ deptName: null,
|
|
|
|
+ varieties: null,
|
|
|
|
+ designMaintainCount: null,
|
|
|
|
+ designOfftakeCount: null,
|
|
|
|
+ realityMaintainCount: null,
|
|
|
|
+ realityOfftakeCount: null,
|
|
|
|
+ };
|
|
|
|
+ this.resetForm("form");
|
|
|
|
+ },
|
|
|
|
+ /** 搜索按钮操作 */
|
|
|
|
+ handleQuery() {
|
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ /** 重置按钮操作 */
|
|
|
|
+ resetQuery() {
|
|
|
|
+ this.queryParams.deptId = undefined;
|
|
|
|
+ this.queryParams.varieties = undefined;
|
|
|
|
+ this.resetForm("queryForm");
|
|
|
|
+ this.handleQuery();
|
|
|
|
+ },
|
|
|
|
+ // 多选框选中数据
|
|
|
|
+ handleSelectionChange(selection) {
|
|
|
|
+ this.ids = selection.map(item => item.id)
|
|
|
|
+ this.single = selection.length !== 1
|
|
|
|
+ this.multiple = !selection.length
|
|
|
|
+ },
|
|
|
|
+ /** 下载模板操作 */
|
|
|
|
+ importTemplate() {
|
|
|
|
+ this.download('/center-data/AgriculturalMachineryInfo/importTemplate', {}, `AgriculturalMachineryInfo_template_${new Date().getTime()}.xlsx`)
|
|
|
|
+ },
|
|
|
|
+ // 文件上传中处理
|
|
|
|
+ handleFileUploadProgress(event, file, fileList) {
|
|
|
|
+ this.upload.isUploading = true
|
|
|
|
+ },
|
|
|
|
+ // 文件上传成功处理
|
|
|
|
+ handleFileSuccess(response, file, fileList) {
|
|
|
|
+ this.upload.open = false
|
|
|
|
+ this.upload.isUploading = false
|
|
|
|
+ this.$refs.upload.clearFiles()
|
|
|
|
+ this.$alert('<div style=\'overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;\'>' + response.msg + '</div>', '导入结果', {dangerouslyUseHTMLString: true})
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+ // 提交上传文件
|
|
|
|
+ submitFileForm() {
|
|
|
|
+ this.$refs.upload.submit()
|
|
|
|
+ },
|
|
|
|
+ /** 导出按钮操作 */
|
|
|
|
+ handleExport() {
|
|
|
|
+ this.download('/center-data/livestockinfo/export', {
|
|
|
|
+ ...this.queryParams
|
|
|
|
+ }, `种畜禽养殖场台账_${format_date(new Date())}.xlsx`)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+</script>
|