| | |
| | | import request from "@/utils/request" |
| | | import deepClone from "@/utils/deepClone" |
| | | import useUserInfoStore from '@/stores/userInfo' |
| | | import SelectProduct from "@/views/sd/product/SelectProduct.vue" |
| | | import {changeFilterEvent,filterChanged} from "@/hook" |
| | | |
| | | let dialogTableVisible = ref(false) |
| | | let productVisible = ref(false) |
| | | const userStore = useUserInfoStore() |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | |
| | | saleMan:[] |
| | | }) |
| | | let filterData = ref({}) |
| | | const filterChanged = ({ option, row, column }) => { |
| | | if (option.data) { |
| | | return row[column.field].toString().toLowerCase().indexOf(option.data) > -1 |
| | | } |
| | | return true |
| | | //@filter-change="filterChanged" |
| | | } |
| | | let rowIndex = ref(null) |
| | | let rowClickIndex = ref(null) |
| | | |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | |
| | | body: { |
| | | options: [ |
| | | [ |
| | | { code: 'addRow', name: '添加', prefixIcon: 'vxe-icon-square-plus', visible: true, disabled: false } |
| | | { code: 'addRow', name: '添加', prefixIcon: 'vxe-icon-square-plus', visible: true, disabled: false }, |
| | | { code: 'deleteRow', name: '删除', prefixIcon: 'vxe-icon-delete', visible: true, disabled: true } |
| | | ] |
| | | ] |
| | | } |
| | |
| | | } |
| | | ], |
| | | quantity: [ |
| | | { type: 'number', min: 0, message: '请输入大于等于0的数值' } |
| | | //type: 'number', min: 0, message: '请输入大于等于0的数值' , |
| | | { |
| | | validator ({ cellValue }) { |
| | | const regex = /^[1-9]\d*$/ |
| | | if (!regex.test(cellValue)) { |
| | | return new Error('输入大于0的整数') |
| | | } |
| | | }} |
| | | ], |
| | | width:[ |
| | | { |
| | |
| | | return |
| | | } |
| | | $grid.insert({}) |
| | | //console.log($grid.getRecordset().insertRecords) |
| | | break |
| | | } |
| | | case 'deleteRow':{ |
| | | |
| | | $grid.remove(rowClickIndex.value) |
| | | rowClickIndex.value = null |
| | | gridOptions.menuConfig.body.options[0][1].disabled=true |
| | | break |
| | | } |
| | | } |
| | |
| | | }, |
| | | cellDblclick (params) {//表格内容双击打开产品界面 |
| | | const { row } = params |
| | | //alert("我打开了产品界面") |
| | | productVisible.value = true |
| | | rowIndex=row |
| | | }, |
| | | cellClick({ row }){ |
| | | rowClickIndex.value = row |
| | | //右键菜单删除启用 |
| | | gridOptions.menuConfig.body.options[0][1].disabled=false |
| | | } |
| | | } |
| | | //获取子页面产品方法 |
| | | const getProductRow = (row) => { |
| | | rowIndex.productName = row.productName |
| | | rowIndex.productId = row.id |
| | | productVisible.value = false |
| | | } |
| | | |
| | | //初始化判断是否有id传入 |
| | |
| | | const area = parseFloat((row.width * row.height/1000000).toFixed(2)) |
| | | return parseFloat((area * row.quantity).toFixed(2)) |
| | | } |
| | | |
| | | //计算金钱 |
| | | const countMoney = (list) => { |
| | | let countMoney = 0 |
| | | list.forEach((item)=>{ |
| | |
| | | titleUploadData.value.money=countMoney(xGrid.value.getTableData().fullData).toString() |
| | | } |
| | | |
| | | // 手动触发筛选 |
| | | const changeFilterEvent = (event, option, $panel) => { |
| | | // 手动触发筛选 |
| | | $panel.changeOption(event, !!option.data, option) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | :autosize="{ minRows: 2, maxRows: 20 }" |
| | | /> |
| | | </el-dialog> |
| | | <el-dialog v-model="productVisible" style="width: 80%;height:75% "> |
| | | <select-product :rowIndex="rowIndex" @getProductRow="getProductRow" style="width: 100%;height: 100%" /> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | </template> |
| | | |