2 files modified
1 files added
| | |
| | | methods: { |
| | | //新增 |
| | | rowSave(row, done, loading) { |
| | | row["deptId"] = this.farmId; |
| | | row["farmId"] = this.farmId; |
| | | row["type"] = 1; |
| | | save(row).then( |
| | | () => { |
| New file |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | title="检测报告" |
| | | :modal-append-to-body="false" |
| | | :append-to-body="true" |
| | | :close-on-click-modal="false" |
| | | @close="close" |
| | | width="60%" |
| | | :visible.sync="visible" |
| | | center |
| | | > |
| | | <avue-crud |
| | | :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | :page.sync="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | v-model="form" |
| | | ref="crud" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | > |
| | | <template slot="menuLeft"> |
| | | <el-button |
| | | type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | plain |
| | | @click="handleDelete" |
| | | >删 除 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | |
| | | <script> |
| | | import { getDetail, getList, update, remove, save } from "@/api/farm/farmPaper"; |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | props: ["farmId"], |
| | | data() { |
| | | return { |
| | | farmPlantId:null, |
| | | visible: true, |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | excelBox: false, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | selectionList: [], |
| | | option: { |
| | | tip: false, |
| | | searchSize: "mini", |
| | | searchMenuSpan: 8, |
| | | height: "400", |
| | | editBtn: true, |
| | | delBtn: true, |
| | | viewBtn: true, |
| | | menuWidth: 200, |
| | | menuAlign: "center", |
| | | align: "center", |
| | | selection: true, |
| | | column: [ |
| | | { |
| | | label: "检测项目", |
| | | prop: "name", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入检测项目", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "检测机构", |
| | | prop: "organName", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入检测机构", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "报告编号", |
| | | prop: "code", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请输入报告编号", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "颁发日期", |
| | | prop: "time", |
| | | type: "date", |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "请选择颁发日期", |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | label: "报告图片", |
| | | prop: "pictures", |
| | | type: "upload", |
| | | dataType: "string", |
| | | span: 24, |
| | | limit: 3, |
| | | listType: "picture-card", |
| | | tip: "只能上传jpg/png文件,最多上传3张", |
| | | propsHttp: { |
| | | res: "data", |
| | | url: "url" |
| | | }, |
| | | action: "/api/blade-resource/oss/endpoint/put-files" |
| | | }, |
| | | ], |
| | | }, |
| | | data: [], |
| | | }; |
| | | }, |
| | | created() { |
| | | |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission", "userInfo"]), |
| | | // permissionList() { |
| | | // return { |
| | | // addBtn: this.vaildData(this.permission.social_add, true), |
| | | // viewBtn: this.vaildData(this.permission.social_view, false), |
| | | // delBtn: this.vaildData(this.permission.social_delete, false), |
| | | // editBtn: this.vaildData(this.permission.social_edit, false), |
| | | // }; |
| | | // }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach((ele) => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | }, |
| | | }, |
| | | mounted() { |
| | | }, |
| | | methods: { |
| | | init(id) { |
| | | this.visible = true; |
| | | this.farmPlantId = id; |
| | | this.onLoad(this.page); |
| | | }, |
| | | //新增 |
| | | rowSave(row, done, loading) { |
| | | row["farmId"] = this.farmPlantId; |
| | | //种养品 |
| | | row["type"] = 3; |
| | | save(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | loading(); |
| | | window.console.log(error); |
| | | } |
| | | ); |
| | | }, |
| | | //修改 |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | done(); |
| | | }, |
| | | (error) => { |
| | | loading(); |
| | | console.log(error); |
| | | } |
| | | ); |
| | | }, |
| | | //删除 |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | }); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!", |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetail(this.form.id).then((res) => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | params['type'] = 3; |
| | | params['farmId'] = this.farmPlantId; |
| | | getList( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | Object.assign(params, this.query) |
| | | ).then((res) => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | |
| | | >删 除 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{ type, size, row }" slot="menu"> |
| | | <el-button |
| | | :type="type" |
| | | :size="size" |
| | | icon="el-icon-money" |
| | | @click="handleDetection(row)" |
| | | >检测报告 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <!-- 检测报告 --> |
| | | <detection v-if="detectionVisible" ref="detection"></detection> |
| | | </basic-container> |
| | | </template> |
| | | |
| | |
| | | import { getStrainList } from "@/api/farmplant/strain"; |
| | | import { getLandList } from "@/api/land/land"; |
| | | import { mapGetters } from "vuex"; |
| | | import detection from "./detection.vue"; |
| | | export default { |
| | | components: { |
| | | detection |
| | | }, |
| | | props:[ |
| | | "type","activeName" |
| | | ], |
| | | data() { |
| | | return { |
| | | detectionVisible:false, |
| | | visible: true, |
| | | form: {}, |
| | | query: {}, |
| | |
| | | editBtn: true, |
| | | delBtn: true, |
| | | viewBtn: true, |
| | | menuWidth: 200, |
| | | menuWidth: 280, |
| | | menuAlign: "center", |
| | | align: "center", |
| | | selection: true, |
| | |
| | | required: true, |
| | | message: "请输入作业方式", |
| | | trigger: "blur", |
| | | }, |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | |
| | | required: true, |
| | | message: "请选择移栽时间", |
| | | trigger: "blur", |
| | | }, |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | |
| | | required: false, |
| | | message: "请选预计采收时间", |
| | | trigger: "blur", |
| | | }, |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | |
| | | required: false, |
| | | message: "请输入预计亩产", |
| | | trigger: "blur", |
| | | }, |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | | { |
| | | label: "株数", |
| | | prop: "plantNumber", |
| | | prop: "plantNumber", |
| | | labelWidth:110, |
| | | type:"number", |
| | | hide:true, |
| | |
| | | required: false, |
| | | message: "请输入株数", |
| | | trigger: "blur", |
| | | }, |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | |
| | | required: false, |
| | | message: "请输入株间距", |
| | | trigger: "blur", |
| | | }, |
| | | }, |
| | | ], |
| | | // display:false, |
| | | }, |
| | |
| | | // required: true, |
| | | // message: "请选择投苗时间", |
| | | // trigger: "blur", |
| | | // }, |
| | | // }, |
| | | // ], |
| | | // display:false, |
| | | // }, |
| | |
| | | // required: true, |
| | | // message: "请输入养殖数量", |
| | | // trigger: "blur", |
| | | // }, |
| | | // }, |
| | | // ], |
| | | // display:false, |
| | | // }, |
| | |
| | | // required: false, |
| | | // message: "请输入预计亩产", |
| | | // trigger: "blur", |
| | | // }, |
| | | // }, |
| | | // ], |
| | | // plantNumbercolumn.display = true; |
| | | // plantSpacingcolumn.display = true; |
| | |
| | | // required: true, |
| | | // message: "请输入养殖数量", |
| | | // trigger: "blur", |
| | | // }, |
| | | // }, |
| | | // ], |
| | | // plantNumbercolumn.display = false; |
| | | // plantSpacingcolumn.display = false; |
| | |
| | | strainId.dicData = res.data.data; |
| | | } |
| | | }) |
| | | |
| | | |
| | | }, |
| | | //新增 |
| | | rowSave(row, done, loading) { |
| | |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | //检测报告 |
| | | handleDetection(row){ |
| | | this.detectionVisible = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.detection.init(row.id); |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |