guoyuji
2024-01-08 d5868d38cd7d46c52da971d7d0388d229495d729
north-glass-erp/northglass-erp/src/views/mm/purchaseOrder/Payment.vue
@@ -39,14 +39,13 @@
          @="gridEvents"
      >
        <!--            @="gridEvents"-->
        <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
        <!--      下拉显示所有信息插槽-->
        <template #content="{ row}">
          <ul class="expand-wrapper">
            <li v-for="(item,key,index) in row">
              <span style="font-weight: bold">{{ key + ':  ' }}</span>
              <span>{{ item }}</span>
            <li  v-for="(item,index) in gridOptions.columns" v-show="item.field!==undefined ">
              <span style="font-weight: bold">{{item.title+':  '}}</span>
              <span>{{ row[item.field] }}</span>
            </li>
          </ul>
        </template>
@@ -79,6 +78,9 @@
import {VXETable} from "vxe-table";
import {reactive} from "vue";
import {useRouter} from 'vue-router'
import {ElMessage, ElMessageBox} from "element-plus";
const datevalue = ref('')//时间
//组件接收参数
const PayOptions = reactive({
@@ -111,9 +113,9 @@
  },
  columns: [
   /* {title: '操作', width: '8%', slots: {default: 'button_slot'}, fixed: "left"},*/
    {type: 'seq', fixed: "left", title: ' ', width: '5%'},
    {type: 'expand', title: '', fixed: "left", slots: {content: 'content'}, width: '5%'},//详情
    {type: 'checkbox', fixed: "left", title: '', width: '5%'},
    {type: 'expand', title: '详情', fixed: "left", slots: {content: 'content'}, width: '5%'},
    {type: 'seq', fixed: "left", title: ' ', width: '5%'},
    {
      field: 'cgdh',
      width: '10%',
@@ -147,8 +149,22 @@
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: 'w', width: '10%', title: '本期已付', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {field: 'g', width: '10%', title: '期末余额', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {
      field: 'w',
      width: '10%',
      title: '本期已付',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {
      field: 'g',
      width: '10%',
      title: '期末余额',
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      sortable: true
    },
    {field: 'h', width: '9%', title: '税率', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true},
    {field: '6', width: '10%', title: '备注', filters: [{data: ''}], slots: {filter: 'num1_filter'}, sortable: true}
  ],//表头参数
@@ -192,49 +208,13 @@
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'Add': {//新增
          router.push({path: '/main/purchaseOrder/CreatePurchaseOrder'})
          break
        }
        case 'Storage': {//入库
          //应付确认
        case 'Sure': {
          if ($grid.getCheckboxRecords().length === 0) {
            openAlert({type: 'message', content: '请选择至少一条数据', status: 'warning'})
            //VXETable.modal.message( '请选择一条数据!')
            MessageShow("请选择至少一条数据!", 'warning');
            return
          } else {
            const type = VXETable.modal.confirm('您选择了' + $grid.getCheckboxRecords().length + '条数据!,是否确认入库?');
            //openAlert({type:'alert', content: '成功入库'+$grid.getCheckboxRecords().length+'条数据!', status: 'success' })
            //VXETable.modal.message( '请选择一条数据!')
            return
          }
          break
        }
        case 'Return': {//退库
          if ($grid.getCheckboxRecords().length === 0) {
            openAlert({type: 'message', content: '请选择至少一条数据', status: 'warning'})
            //VXETable.modal.message( '请选择一条数据!')
            return
          } else {
            /*            async ()=>{
              const type = await.VXETable.modal.confirm('您选择了'+$grid.getCheckboxRecords().length+'条数据!,是否确认退库?');
            }*/
            const type = VXETable.modal.confirm('您选择了' + $grid.getCheckboxRecords().length + '条数据!,是否确认退库?');
            /* if(VXETable.modal.confirm('您选择了'+$grid.getCheckboxRecords().length+'条数据!,是否确认退库?' )){
              //openAlert({type:'message', content: '成功退库'+$grid.getCheckboxRecords().length+'条数据!', status: 'success',lockView: false, mask: false })
            }*/
            /* if(type==='confirm'){
              openAlert({type:'message', content: '成功退库'+$grid.getCheckboxRecords().length+'条数据!', status: 'success' })
            }
*/
            //openAlert({type:'alert', content: '成功退库'+$grid.getCheckboxRecords().length+'条数据!', status: 'success' })
            //VXETable.modal.message( '请选择一条数据!')
            return
            MessageConfirmShow("确认应付", '您选择了' + $grid.getCheckboxRecords().length + '条数据!,是否确认应付?')
          }
          break
        }
@@ -254,16 +234,7 @@
  },
}
const openAlert = (options) => {
  if (options.type === 'message') {
    VXETable.modal.message(options)
  } else {
    VXETable.modal.alert(options)
  }
}
const datevalue = ref('')
const shortcuts = [
  {
@@ -294,6 +265,73 @@
    },
  },
]
//页面逻辑代码执行
function logicExecute(type){
  const $grid = xGrid.value
  switch (type) {
    case '确认应付':
      //入库逻辑代码TODO
      MessageShow('操作成功!', 'success');
      break;
    default:
      MessageShow('未知操作!', 'error');
      break;
  }
  return true;
}
//提示信息
//信息内容,显示方式,显示标题,类型
const MessageShow = (content, type = 'success') => {
  ElMessage({
    message: content,
    type: type,
    showClose: true,
  })
}
//操作确认类信息:操作类型,提示内容,提示标头,提示类型
const MessageConfirmShow = (czType, content, title = '操作确认提示', type = 'warning') => {
  ElMessageBox.confirm(
      content,
      title,
      {
        cancelButtonText: '取消',
        confirmButtonText: '确定',
        type: type,
        center: true,
      }
  )
      //点击了确定
      .then(() => {
        return  logicExecute(czType);
      })
      //点击了取消
      .catch(() => {
        return false;
      })
}
//弹窗信息
const MessageAlertShow = (content, title, type = 'info') => {
  ElMessageBox.alert(content, title, {
    // 禁止自动对焦
    //autofocus: false,
    confirmButtonText: 'OK',
    /*callback: (action: Action) => {
      MessageShow(`action: ${action}`,type)
    },*/
  })
}
</script>