//商品选择setPopupIteminfo
function setPopupIteminfo(obj = {}) {
  let vName = '商品'
  let code = 'item'
  let baseObject = { itemcode: true, label: '选择线路', remoteData: {}, required: false, ...obj }
  const { name, targetValueKey, itemcode, label, remoteData, search, ok, change, required } = baseObject

  return [
    {
      type: 'searchModal',
      label,
      targetClick: true,
      required,
      name: name || 'chnname',
      targetValueKey: targetValueKey || 'chnname',
      remoteUrl: { url: '/api/oms-std-maindata/pubIteminfo/popupIteminfo/v1.0', method: 'post' },
      remoteData: { chnname: '', [code + 'code']: '', ...remoteData },
      tableConfig: {
        rowKey: code + 'id',
        columns: [
          {
            hidden: true,
            dataIndex: 'id',
            title: 'id'
          },
          {
            dataIndex: code + 'code',
            title: vName + '编码'
          },
          {
            dataIndex: 'chnname',
            title: vName + '名称'
          }
        ]
      },
      toolBar: {
        items: [
          {
            type: 'input',
            name: code + 'code',
            label: vName + '编码',
            value: ''
          },
          {
            type: 'input',
            name: 'chnname',
            label: vName + '名称',
            value: ''
          }
        ]
      },
      on: {
        change,
        search,
        ok
      }
    },
    { name: code + 'code', required, label: vName + '编码', type: 'input', hidden: !itemcode, disabled: true },
    { name: code + 'id', required, label: vName + 'ID', type: 'input', hidden: true }
  ]
}
export default setPopupIteminfo
