6 files modified
2 files added
| | |
| | | |
| | | export const add = (row) => { |
| | | return request({ |
| | | url: '/api/land/land/submit', |
| | | url: '/api/land/land/save', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| New file |
| | |
| | | import request from '@/router/axios'; |
| | | |
| | | export const getList = (current, size, params) => { |
| | | return request({ |
| | | url: '/api/soldrecord/soldrecord/page', |
| | | method: 'get', |
| | | params: { |
| | | ...params, |
| | | current, |
| | | size, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const getDetail = (id) => { |
| | | return request({ |
| | | url: '/api/soldrecord/soldrecord/detail', |
| | | method: 'get', |
| | | params: { |
| | | id |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const remove = (ids) => { |
| | | return request({ |
| | | url: '/api/soldrecord/soldrecord/remove', |
| | | method: 'post', |
| | | params: { |
| | | ids, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const add = (row) => { |
| | | return request({ |
| | | url: '/api/soldrecord/soldrecord/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | return request({ |
| | | url: '/api/soldrecord/soldrecord/submit', |
| | | method: 'post', |
| | | data: row |
| | | }) |
| | | } |
| | | |
| | |
| | | component: Layout, |
| | | children: [{ |
| | | path: 'stockrecord', |
| | | name: '农事操作', |
| | | name: '农资记录', |
| | | meta: { |
| | | i18n: 'index', |
| | | }, |
| | |
| | | }] |
| | | }, |
| | | { |
| | | path: '/farmingrecord', |
| | | redirect: '/farm/farmingrecord', |
| | | component: Layout, |
| | | children: [{ |
| | | path: 'farmingrecord', |
| | | name: '农事记录', |
| | | meta: { |
| | | i18n: 'index', |
| | | }, |
| | | component: () => |
| | | import( /* webpackChunkName: "views" */ '@/views/farm/farmingrecord') |
| | | }] |
| | | }, |
| | | { |
| | | path: '/soldrecord', |
| | | redirect: '/soldrecord/soldrecord', |
| | | component: Layout, |
| | | children: [{ |
| | | path: 'soldrecord', |
| | | name: '已出库待使用农资', |
| | | meta: { |
| | | i18n: 'index', |
| | | }, |
| | | component: () => |
| | | import( /* webpackChunkName: "views" */ '@/views/soldrecord/soldrecord') |
| | | }] |
| | | }, |
| | | { |
| | | path: '/dict-horizontal', |
| | | component: Layout, |
| | | redirect: '/dict-horizontal/index', |
| | |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | var datas = this.$route.query.id; |
| | | params.landId=datas; |
| | | getList( |
| | | page.currentPage, |
| | | page.pageSize, |
| | |
| | | //农事操作 |
| | | start(row) { |
| | | this.$router.push({ |
| | | path: `/framing`, |
| | | path: `/farmingrecord`, |
| | | query: row |
| | | }); |
| | | }, |
| New file |
| | |
| | | <template> |
| | | <basic-container> |
| | | <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" |
| | | @on-load="onLoad"> |
| | | <template slot="menuLeft"> |
| | | <el-button type="danger" |
| | | size="small" |
| | | icon="el-icon-delete" |
| | | plain |
| | | v-if="permission.soldrecord_delete" |
| | | @click="handleDelete">删 除 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getList, getDetail, add, update, remove} from "@/api/soldrecord/soldrecord"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | selectionList: [], |
| | | option: { |
| | | height:'auto', |
| | | calcHeight: 30, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | viewBtn: true, |
| | | selection: true, |
| | | align: "center", |
| | | menu:false, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: "农资", |
| | | prop: "stockId1", |
| | | span: 23, |
| | | type: "select", |
| | | dicUrl: "/api/stockfactory/stockfactory/selectStockFa", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey" |
| | | }, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请输入农资", |
| | | trigger: "blur" |
| | | }] |
| | | }, |
| | | { |
| | | label: "农资类型", |
| | | prop: "stype", |
| | | addDisplay: false, |
| | | searchLabelWidth: 80, |
| | | searchSpan: 4, |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=stockType", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey" |
| | | }, |
| | | dataType: "number", |
| | | search: true, |
| | | }, |
| | | { |
| | | label: "厂家名称", |
| | | prop: "factoryName", |
| | | addDisplay: false, |
| | | }, |
| | | { |
| | | label: "规格", |
| | | disabled: true, |
| | | span: 6, |
| | | prop: "spn", |
| | | addDisplay: false, |
| | | }, |
| | | { |
| | | label: "数量", |
| | | disabled: true, |
| | | span: 6, |
| | | prop: "amount1", |
| | | }, |
| | | ] |
| | | }, |
| | | data: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.soldrecord_add, false), |
| | | viewBtn: this.vaildData(this.permission.soldrecord_view, false), |
| | | delBtn: this.vaildData(this.permission.soldrecord_delete, false), |
| | | editBtn: this.vaildData(this.permission.soldrecord_edit, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | }); |
| | | return ids.join(","); |
| | | } |
| | | }, |
| | | methods: { |
| | | rowSave(row, done, loading) { |
| | | add(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; |
| | | var datas = this.$route.query.stockId; |
| | | params.stockId1=datas; |
| | | 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> |
| | |
| | | v-if="permission.stock_delete" |
| | | @click="handleDelete">删 除 |
| | | </el-button> |
| | | |
| | | </template> |
| | | <template slot-scope="{ type, size, row }" slot="menu"> |
| | | <el-button |
| | |
| | | >农资记录 |
| | | </el-button |
| | | > |
| | | <el-button |
| | | icon="el-icon-circle-plus-outline" |
| | | type="text" |
| | | size="mini" |
| | | @click="startc(row)" |
| | | :size="size" |
| | | >已出库农资 |
| | | </el-button |
| | | > |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog |
| | |
| | | return { |
| | | addBtn: this.vaildData(this.permission.stock_add, false), |
| | | viewBtn: this.vaildData(this.permission.stock_view, false), |
| | | delBtn: this.vaildData(this.permission.stock_delete, false), |
| | | delBtn: this.vaildData(this.permission.stock_delete, true), |
| | | editBtn: this.vaildData(this.permission.stock_edit, false) |
| | | }; |
| | | }, |
| | |
| | | query: row |
| | | }); |
| | | }, |
| | | //已出库存农资 |
| | | startc(row) { |
| | | this.$router.push({ |
| | | path: `/soldrecord`, |
| | | query: row |
| | | }); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | |
| | | var datas = this.$route.query.stockId; |
| | | params.stockId1=datas; |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |