| | |
| | | import {computed, onMounted, reactive, ref, watch} from "vue" |
| | | import {filterChanged} from "@/hook" |
| | | import {useI18n} from "vue-i18n" |
| | | import {ElMessage} from "element-plus"; |
| | | import {ElMessage, ElMessageBox,} from "element-plus" |
| | | import request from "@/utils/request" |
| | | import {useRouter,useRoute} from "vue-router" |
| | | const { t } = useI18n() |
| | | const router = useRouter() |
| | | const route = useRoute() |
| | | let rowClickIndex = ref(null) |
| | | const xGrid = ref() |
| | | const gridOptions = reactive({ |
| | |
| | | },//表头参数 |
| | | columns:[ |
| | | // {field: 'buildingNumber',width:120, title: '楼号',editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter'}, sortable: true,filterMethod:filterChanged}, |
| | | {field: 'alias', title:'其他加工',editRender: { name: 'input'},minWith:'130'}, |
| | | {field: 'alias', title:'其他加工',minWith:'130'}, |
| | | {field: 'price', title:'单价',editRender: { name: 'input'}}, |
| | | {field: 'quantity', title:'数量' }, |
| | | {field: 'money', slots:{default:'default'}, title:'金额'} |
| | |
| | | if ($grid) { |
| | | switch (code) { |
| | | case 'add': { |
| | | if ($grid.getTableData().tableData.length >=240){ |
| | | ElMessage.error(t('order.msg.tableLengthMax')) |
| | | return |
| | | } |
| | | $grid.insert({}) |
| | | addColumn() |
| | | break |
| | | } |
| | | case 'delete': { |
| | |
| | | ElMessage.warning('请先单击选择行') |
| | | return |
| | | } |
| | | $grid.remove(rowClickIndex.value) |
| | | deleteColum(rowClickIndex.value.id) |
| | | rowClickIndex.value = null |
| | | break |
| | | } |
| | |
| | | validate |
| | | }) |
| | | |
| | | |
| | | const addColumn = () => { |
| | | ElMessageBox.prompt( '新增列名:', { |
| | | confirmButtonText: '新增', |
| | | cancelButtonText: '取消', |
| | | inputPattern:/^.{1,20}$/, |
| | | inputErrorMessage: '请输入20个字符以内的且不为空的字符', |
| | | }) |
| | | .then(({ value }) => { |
| | | request.post('/basicOtherMoney/save',{alias:value}).then(res=>{ |
| | | if (res.code==='200' && res.data!==false){ |
| | | ElMessage.success('新增成功') |
| | | setTimeout(()=>{ |
| | | window.location.reload() |
| | | },1500) |
| | | |
| | | }else{ |
| | | ElMessage.error('新增失败,不能重复添加或超过100条列') |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | const deleteColum = (id) => { |
| | | ElMessageBox.confirm( |
| | | '确认删除此列名?', |
| | | 'Warning', |
| | | { |
| | | confirmButtonText: '删除', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | request.post(`/basicOtherMoney/deleteById/${id}`,).then(res=>{ |
| | | if (res.code==='200' && res.data!==false){ |
| | | ElMessage.success('删除成功') |
| | | setTimeout(()=>{ |
| | | window.location.reload() |
| | | },1500) |
| | | }else{ |
| | | ElMessage.error('删除失败') |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <span>{{ countAmount(row) }} </span> |
| | | </template> |
| | | </vxe-grid> |
| | | |
| | | </div> |
| | | |
| | | |