/*
 *    Copyright (c) 2018-2025, cyweb All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 */

import global from "@/components/tools/commondict";

export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  editBtn: false,
  delBtn: false,
  addBtn: false,
  dialogHeight:600,
  selection: true,
  selectable:(row,index)=>{
    return index===1;
  },
  dic: [],
  column: [
    {
      label: '部门名称',
      prop: 'deptCode',
      span: 12,
      labelWidth: 80,
      width: 120,
      filterable:true,
      searchFilterable:true,
      type:'select',
      dicUrl: '/basic/basicdept/getDeptListByLevelTwo',
      props: {
        label: 'deptName',
        value: 'deptCode'
      },
      editDisabled:true,
      search:true,
    },
    {
      label: '物品分类',
      prop: 'serialType',
      span: 12,
      labelWidth: 80,
      width: 120,
      search:true,
      type:'select',
      dicUrl: '/finance/inventoryclassification/classificationList',
      props: {
        label: 'name',
        value: 'code'
      },
      editDisabled:true
    },
    {
      label: '物品名称',
      prop: 'serialName',
      search:true,
      editDisabled:true
    },
    {
      label: '规格型号',
      prop: 'serialSpc',
      editDisabled:true
    },
    {
      label: '物品单位',
      prop: 'sprialUnit',
      editDisabled:true
    },
    {
      label: '物品单价',
      prop: 'serialPrice',
      editDisabled:true
    },
    {
      label: '价格类型',
      prop: 'priceType',
      search:true,
      type:'select',
      hide:true,
      addDisplay:false,
      editDisplay:false,
      dicData: [ {
        label:'小于',
        value:'0'
      },
        {
          label:'等于',
          value:'1'
        },
        {
          label:'大于',
          value:'2'
        }]
    },
    {
      label: '单价',
      prop: 'serialPrice',
      hide:true,
      search: true,
      addDisplay:false,
      editDisplay:false
    },
    {
      label: '库存数量',
      type:'number',
      span:24,
      prop: 'serialNum',
      editDisabled:true
    },
    {
      label: '备注',
      search: true,
      span:24,
      prop: 'remark'
    },
    {
      label: '盘点状态',
      prop: 'pdState',
      search:true,
      type:'select',
      dicData:global.pdState,
      editDisplay:false,
      props:{
        label:'label',
        value:'value'
      }
    },
    {
      label: '库存为零',
      prop: 'isZero',
      search:true,
      type:'select',
      hide:true,
      dicData:global.YES_OR_NO,
      display:false,
      props:{
        label:'label',
        value:'value'
      }
    },
    {
      label: '盘点审核意见',
      prop: 'pdExam',
      editDisplay:false,
    },
    {
      label: '盘点数量',
      type:'number',
      span:24,
      prop: 'pdNum',
      rules: [{
        required: true,
        message: '盘点数量不能为空',
        trigger: 'blur'
      }]
    },
    {
      label: '盘点备注',
      type:'textarea',
      row:true,
      span:24,
      prop: 'pdRemark',
      rules: [{
        required: true,
        message: '盘点备注不能为空',
        trigger: 'blur'
      },{
        min: 1,
        max: 100,
        message: '长度在 1 到 100 个字符',
        trigger: 'blur'
      }]
    },

  ]
}

export const tableUseOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  editBtn: false,
  delBtn: false,
  addBtn: false,
  selection: true,
  selectable:(row,index)=>{
    return index===1;
  },
  defaultSort:{
    prop: 'serialNum',
    order: 'descending'
  },
  dic: [],
  column: [
    {
      label: '部门名称',
      prop: 'deptCode',
      span: 12,
      filterable:true,
      searchFilterable:true,
      labelWidth: 80,
      width: 120,
      type:'select',
      dicUrl: '/basic/basicdept/getDeptListByLevelTwo',
      props: {
        label: 'deptName',
        value: 'deptCode'
      },
      editDisabled:true,
      sortable:false,
      search:true
    },
    {
      label: '物品分类',
      prop: 'serialType',
      span: 12,
      labelWidth: 80,
      width: 120,
      search:true,
      type:'select',
      dicUrl: '/finance/inventoryclassification/classificationList',
      props: {
        label: 'name',
        value: 'code'
      },
      sortable:false,
      editDisabled:true
    },
    {
      label: '物品名称',
      prop: 'serialName',
      search:true,
      sortable:false,
      editDisabled:true
    },
    {
      label: '规格型号',
      prop: 'serialSpc',
      sortable:false,
      editDisabled:true
    },
    {
      label: '物品单位',
      prop: 'sprialUnit',
      sortable:false,
      editDisabled:true
    },
    {
      label: '物品单价',
      prop: 'serialPrice',
      sortable:false,
      editDisabled:true
    },
    {
      label: '库存数量',
      type:'number',
      prop: 'serialNum',
      sortable:true,
      editDisabled:true
    },
    {
      label: '备注',
      prop: 'remark',
      sortable:false,

      search:true
    },
  ]
}

export const tableSelectOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  editBtn: false,
  delBtn: false,
  addBtn: false,
  dic: [],
  column: [
    {
      label: '部门名称',
      prop: 'deptCode',
      span: 12,
      filterable:true,
      searchFilterable:true,
      labelWidth: 80,
      width: 80,
      type:'select',
      dicUrl: '/basic/basicdept/getDeptListByLevelTwo',
      props: {
        label: 'deptName',
        value: 'deptCode'
      },
      editDisabled:true
    },
    {
      label: '物品分类',
      prop: 'serialType',
      span: 12,
      labelWidth: 80,
      width: 80,
      type:'select',
      dicUrl: '/finance/inventoryclassification/classificationList',
      props: {
        label: 'name',
        value: 'code'
      },
      editDisabled:true
    },
    {
      label: '物品名称',
      labelWidth: 80,
      width: 100,

      prop: 'serialName',
      editDisabled:true
    },
    {
      label: '规格型号',
      labelWidth: 80,
      width: 100,

      prop: 'serialSpc',
      editDisabled:true
    },
    {
      label: '物品单位',
      labelWidth: 80,
      width: 100,

      prop: 'sprialUnit',
      editDisabled:true
    },
    {
      label: '物品单价',
      labelWidth: 80,
      width: 100,

      prop: 'serialPrice',
      editDisabled:true
    },
    {
      label: '领用数量',
      labelWidth: 200,
      width: 250,
      type:'number',
      prop: 'serialNum',
      slot: true,
      formslot: true
    },
  ]
}
