add selectComponent & search form styles
This commit is contained in:
		@@ -10,13 +10,14 @@
 | 
			
		||||
        :prop="opt.prop ?? '' + index"
 | 
			
		||||
        :rules="opt.bind?.rules ? opt.bind.rules : undefined"
 | 
			
		||||
      >
 | 
			
		||||
        <el-input v-if="opt.input" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable />
 | 
			
		||||
        <el-select v-if="opt.select" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable>
 | 
			
		||||
        <el-input v-if="opt.input" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable size="small" />
 | 
			
		||||
        <el-select v-if="opt.select" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable size="small">
 | 
			
		||||
          <el-option v-for="item in opt.select" :key="item.value" :label="item.label" :value="item.value" />
 | 
			
		||||
        </el-select>
 | 
			
		||||
        <el-date-picker v-if="opt.timerange" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable />
 | 
			
		||||
        <el-date-picker v-if="opt.timerange" v-model="dataForm[opt.prop]" v-bind="opt.bind" clearable size="small" />
 | 
			
		||||
        <el-upload
 | 
			
		||||
          v-if="opt.upload"
 | 
			
		||||
          size="small"
 | 
			
		||||
          :key="'upload_' + Math.random().toString()"
 | 
			
		||||
          class="inline-block pl-3"
 | 
			
		||||
          action="https://jsonplaceholder.typicode.com/posts/"
 | 
			
		||||
@@ -26,7 +27,9 @@
 | 
			
		||||
        <el-button
 | 
			
		||||
          v-if="opt.button && (!opt.button.permission || $hasPermission(opt.button.permission))"
 | 
			
		||||
          :key="'button' + Math.random().toString()"
 | 
			
		||||
          size="small"
 | 
			
		||||
          :type="opt.button.type"
 | 
			
		||||
          v-bind="opt.bind"
 | 
			
		||||
          @click="handleBtnClick(opt.button.name)"
 | 
			
		||||
          >{{ opt.button.name }}</el-button
 | 
			
		||||
        >
 | 
			
		||||
@@ -37,7 +40,7 @@
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: "",
 | 
			
		||||
  name: "BaseSearchForm",
 | 
			
		||||
  props: {
 | 
			
		||||
    headConfig: {
 | 
			
		||||
      type: Object,
 | 
			
		||||
@@ -65,7 +68,7 @@ export default {
 | 
			
		||||
    console.log("[BaseSearchForm] configs:", JSON.parse(JSON.stringify(this.headConfig)));
 | 
			
		||||
 | 
			
		||||
    this.headConfig.fields.forEach((field, index) => {
 | 
			
		||||
			// 没有 field.prop ,则为按钮之类的
 | 
			
		||||
      // 没有 field.prop ,则为按钮之类的
 | 
			
		||||
      if (!field.prop) return;
 | 
			
		||||
 | 
			
		||||
      if (!this.dataForm[field.prop]) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										30
									
								
								src/components/noTemplateComponents/selectComponent.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/components/noTemplateComponents/selectComponent.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
// import i18n from '@/i18n'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'SelectComponent',
 | 
			
		||||
  props: {
 | 
			
		||||
    injectData: {
 | 
			
		||||
      type: Object,
 | 
			
		||||
      default: () => ({})
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      // TODO: i18n
 | 
			
		||||
      defaultText: '查看详情'
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    emitClick() {
 | 
			
		||||
      // console.log('inject data:' ,this.injectData)
 | 
			
		||||
      this.$emit('emit-data', {
 | 
			
		||||
        type: this.injectData.head?.actionName || 'select-change-action',
 | 
			
		||||
        data: this.injectData.head?.emitFullData ? this.injectData : this.injectData.id
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  render: function (h) {
 | 
			
		||||
    // console.log('button content:', this.injectData)
 | 
			
		||||
    return h('span', null, [h('el-button', { props: { type: 'text' }, style: { paddingLeft: 0 }, on: { click: this.emitClick } }, this.injectData.head?.buttonContent || this.defaultText)])
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -42,9 +42,12 @@ export default function () {
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      button: {
 | 
			
		||||
        type: 'plain',
 | 
			
		||||
        type: 'primary',
 | 
			
		||||
        name: '新增',
 | 
			
		||||
        permission: ''
 | 
			
		||||
      },
 | 
			
		||||
      bind: {
 | 
			
		||||
        plain: true,
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
 
 | 
			
		||||
@@ -40,9 +40,12 @@ export default function () {
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      button: {
 | 
			
		||||
        type: 'plain',
 | 
			
		||||
        type: 'primary',
 | 
			
		||||
        name: '新增',
 | 
			
		||||
        permission: 'pms:materialType:save'
 | 
			
		||||
      },
 | 
			
		||||
      bind: {
 | 
			
		||||
        plain: true,
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
 
 | 
			
		||||
@@ -39,10 +39,13 @@ export default function () {
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      button: {
 | 
			
		||||
        type: "plain",
 | 
			
		||||
        type: "primary",
 | 
			
		||||
        name: "新增",
 | 
			
		||||
        permission: "pms:productionLine:save",
 | 
			
		||||
        permission: "pms:productionLine:save"
 | 
			
		||||
      },
 | 
			
		||||
      bind: {
 | 
			
		||||
        plain: true,
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,9 +37,12 @@ export default function () {
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      button: {
 | 
			
		||||
        type: 'plain',
 | 
			
		||||
        type: 'primary',
 | 
			
		||||
        name: '新增',
 | 
			
		||||
        permission: 'pms:workSequence:save'
 | 
			
		||||
      },
 | 
			
		||||
      bind: {
 | 
			
		||||
        plain: true,
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user