| | |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad" |
| | | ></avue-crud> |
| | | @row-del="rowDel"> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getList } from "@/api/process/process" |
| | | |
| | | import { getList,remove } from "@/api/process/process" |
| | | import { mapGetters } from "vuex" |
| | | export default { |
| | | data () { |
| | | return { |
| | |
| | | total: 0, |
| | | }, |
| | | selectionList: [], |
| | | align: "center", |
| | | menu: true, |
| | | option: { |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | height: 520, |
| | | editBtn: false, |
| | | addBtn: false, |
| | | height: "auto", |
| | | calcHeight: '80', |
| | | delBtn: true, |
| | | viewBtn: true, |
| | | delBtnText:'删除', |
| | | delBtnIcon:'el-icon-delete', |
| | | editBtn:false, |
| | | menuWidth: 200, |
| | | menuAlign: "center", |
| | | align: "center", |
| | | selection: false, |
| | | showSummary: true, |
| | | indexFixed: false, |
| | | selectionFixed: false, |
| | | expandFixed: false, |
| | | menuFixed: false, |
| | | menu: false, |
| | | menu: true, |
| | | header:false, |
| | | column: [ |
| | | { |
| | | label: "品种", |
| | | prop: "strainId", |
| | | prop: "kind", |
| | | search: true, |
| | | hide: true, |
| | | display: false, |
| | | type: "select", |
| | | dicUrl: 'api/strain/strain-tree', |
| | | dicUrl: '/api/strain/kind-tree', |
| | | dicFormatter:(res)=>{ |
| | | this.kindList = res.data |
| | | return res.data |
| | | }, |
| | | props: { |
| | | label: "strainName", |
| | | value: "id" |
| | | label: "kindName", |
| | | value: "id" |
| | | } |
| | | }, |
| | | { |
| | | label:"品种", |
| | | prop:"strainName" |
| | | label:"品种 / 来源", |
| | | prop:"strainName", |
| | | formatter:function(row, column, cellValue, index) { |
| | | return row.strainName?row.strainName:row.parentName |
| | | } |
| | | }, |
| | | { |
| | | label:"加工数量", |
| | | prop:"saleNum" |
| | | }, |
| | | { |
| | | label: "产品", |
| | | label: "加工产品", |
| | | prop: "processName", |
| | | }, |
| | | { |
| | | label: "产品数量", |
| | | label: "加工产品数量", |
| | | prop: "processNum" |
| | | }, |
| | | { |
| | | label: "销售时间", |
| | | label: "加工时间", |
| | | prop: "saleTime", |
| | | }, |
| | | ], |
| | | }, |
| | | data: [], |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["$farmId"]), |
| | | }, |
| | | watch: { |
| | | '$farmId':{ |
| | | handler (newName, oldName) { |
| | | this.query ={} |
| | | this.onLoad(this.page) |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | }, |
| | | onLoad (page, params = {}) { |
| | | this.loading = true |
| | | params["farmId"] = this.$farmId |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then((res) => { |
| | | if (res.data.code == 200) { |
| | | console.log(res) |
| | | this.data = res.data.data.records |
| | | //单位处理 |
| | | this.data.forEach((e)=>{ |
| | | e.saleNum = e.saleNum + " 公斤" |
| | | e.processNum = e.processNum + " 公斤" |
| | | }) |
| | | this.page.total = res.data.data.total |
| | | this.loading = false |
| | | } |
| | |
| | | this.onLoad(this.page, params) |
| | | done() |
| | | }, |
| | | rowDel (row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | return remove(row.id,this.$farmId) |
| | | }).then((res) => { |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }) |
| | | }) |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | |
| | | </style> |
| | | </style> |