Browse Source

组件修改配置文件传参

master
陈薪名 1 year ago
parent
commit
c22eb08d12
  1. 7
      src/components/SearchHigh/src/SearchHigh.vue
  2. 10
      src/components/TableHead/src/TableHead.vue
  3. 24
      src/components/rowDrop/index.vue
  4. 1
      src/views/wms/basicDataManage/itemManage/itembasic/index.vue
  5. 475
      src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts

7
src/components/SearchHigh/src/SearchHigh.vue

@ -55,7 +55,6 @@
</template>
<script setup >
import { Minus } from '@element-plus/icons-vue'
import * as tableColumnsFun from '@/utils/disposition/tableColumns'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
@ -69,13 +68,17 @@ const props = defineProps({
masterId: {
type: String,
default: ''
},
allSchemas: {
type: Object,
default: null
}
})
const message = useMessage() //
const route = useRoute() //
const popoverVisible = ref(false)
const searchOption_high = ref(tableColumnsFun[props.routeName?props.routeName:route.name]?.allSchemas.tableColumns.filter(item => (item.field != "action")))
const searchOption_high = ref(props.allSchemas.tableColumns.filter(item => (item.field != "action")))
const moreListData = ref({
filters:[]
})

10
src/components/TableHead/src/TableHead.vue

@ -26,7 +26,8 @@
<!-- 字段设置弹窗 -->
<rowDrop
ref="rowDropRef"
@updataTableColumns="updataTableColumns"
@updata-table-columns="updataTableColumns"
:allSchemas="allSchemas"
/>
<!-- 高级筛选 -->
<SearchHigh
@ -35,10 +36,11 @@
:routeName="routeName"
:masterId="masterId"
:showPrimaryBaseButton="false"
@searchFormClick="searchFormClick"
@search-form-click="searchFormClick"
:isHighExcludePrimary="false"
:primarySearchCustomButton="[]"
:highSearchCustomButton="[]"
:allSchemas="allSchemas"
/>
</template>
<script setup>
@ -62,6 +64,10 @@ import rowDrop from "@/components/rowDrop/index.vue"
masterId: {
type: String,
default: ''
},
allSchemas: {
type: Object,
default: null
}
})

24
src/components/rowDrop/index.vue

@ -18,20 +18,18 @@
</template>
<script setup lang="ts">
import { ElMessageBox } from 'element-plus'
import * as tableColumnsFun from '@/utils/disposition/tableColumns'
import * as RedisApi from '@/api/redis'
import draggable from "vuedraggable";
defineOptions({ name: 'RowDrop' })
// const props = defineProps({
// HeadButttondata: {
// type: Array,
// default: () => {
// return []
// }
// }
// })
const props = defineProps({
allSchemas: {
type: Object,
default: null
}
})
const popoverVisible = ref(false)
const route = useRoute() //
const routeName = ref(route.name)
@ -77,9 +75,9 @@ const closeRowDrop = () => {
const save = () => {
let saveDate:any[] = []
//
saveDate.push(tableColumnsFun[routeName.value].allSchemas.tableColumns[0])
saveDate.push(props.allSchemas.tableColumns[0])
allData.value.forEach((item) => {
const _item:any = tableColumnsFun[routeName.value].allSchemas.tableColumns.find(itemColumns => (itemColumns.label == item ))
const _item:any = props.allSchemas.tableColumns.find(itemColumns => (itemColumns.label == item ))
_item.isTable = false
if (checkedDataList.value.indexOf(_item.label) > -1) {
_item.isTable = true
@ -87,7 +85,7 @@ const save = () => {
}
})
//
saveDate.push(tableColumnsFun[routeName.value].allSchemas.tableColumns[tableColumnsFun[routeName.value].allSchemas.tableColumns.length-1])
saveDate.push(props.allSchemas.tableColumns[props.allSchemas.tableColumns.length-1])
updataTableColumns(saveDate)
console.log(99, saveDate)
RedisApi.addRedis({key: routeName.value,value: JSON.stringify(saveDate)}).then(() => {
@ -121,7 +119,7 @@ const dragover = (e) => {
//
const initSelectSta = () => {
RedisApi.getRedis(routeName.value).then(res => {
const _myTableColumns = tableColumnsFun[routeName.value].allSchemas.tableColumns
const _myTableColumns = props.allSchemas.tableColumns
//
if (res) {
checkedDataList.value = []

1
src/views/wms/basicDataManage/itemManage/itembasic/index.vue

@ -12,6 +12,7 @@
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Itembasic.allSchemas"
/>
<!-- 列表 -->

475
src/views/wms/basicDataManage/itemManage/itembasic/itembasic.data.ts

@ -0,0 +1,475 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
const crudSchemas = reactive<CrudSchema[]>([
{
label: '代码',
field: 'code',
sort: 'custom',
isSearch: true,
table: {
width: 150,
fixed: 'left'
},
// tableForm:{
// minWidth:200,
// sortable:false
// }
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
},
{
label: '描述1',
field: 'desc1',
sort: 'custom',
table: {
width: 150
} ,
// isTableForm:false
},
{
label: '描述2',
field: 'desc2',
sort: 'custom',
table: {
width: 150
} ,
},
{
label: '状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.ITEM_STATUS,
dictClass: 'string',
isForm: true,
isSearch: true,
isTable: true,
table: {
width: 100
} ,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
} ,
},
{
label: '替代计量单位',
field: 'altUom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
table: {
width: 150
} ,
},
{
label: '是否标包',
field: 'isStdPack',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
// colorType: 'danger',
isTable: true,
table: {
width: 120
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
// tableForm:{
// width: 180,
// type:'Radio',
// }
},
{
label: '可采购',
field: 'enableBuy',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 100
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '可制造',
field: 'enableMake',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '可委外加工',
field: 'enableOutsourcing',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 120
} ,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '回收件',
field: 'isRecycled',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 100
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '虚零件',
field: 'isPhantom',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: 'ABC类',
field: 'abcClass',
sort: 'custom',
dictType: DICT_TYPE.ABC_CLASS,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '类型',
field: 'type',
sort: 'custom',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '种类',
field: 'category',
sort: 'custom',
dictType: DICT_TYPE.ITEM_CATEGORY,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '分组',
field: 'itemGroup',
sort: 'custom',
dictType: DICT_TYPE.ITEM_GROUP,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '颜色',
field: 'color',
sort: 'custom',
dictType: DICT_TYPE.ITEM_COLOR,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '配置',
field: 'configuration',
sort: 'custom',
dictType: DICT_TYPE.ITEM_CONFIGURATION,
dictClass: 'string',
isTable: true,
table: {
width: 100
} ,
},
{
label: '项目',
field: 'project',
sort: 'custom',
table: {
width: 100
} ,
},
{
label: '质量等级',
field: 'eqLevel',
sort: 'custom',
dictType: DICT_TYPE.EQ_LEVEL,
dictClass: 'string',
isTable: true,
table: {
width: 120
} ,
},
{
label: '有效天数',
field: 'validityDays',
sort: 'custom',
table: {
width: 120
},
form: {
component: 'InputNumber',
},
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 120
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '生效时间',
field: 'activeTime',
sort: 'custom',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
} ,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
},
// tableForm:{
// width: 200,
// type:'FormDateTime',
// }
},
{
label: '失效时间',
field: 'expireTime',
sort: 'custom',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
} ,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
}
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
isTable: true,
formatter: dateFormatter,
isForm: false,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
} ,
},
{
label: '创建者',
field: 'creator',
isForm: false,
isTable: false
},
{ label: '备注', field: 'remark', sort: 'custom', isTable: false},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false ,
table: {
width: 150,
fixed: 'right'
},
}
])
// 表单校验
export const rules = reactive({
code: [
{ required: true, message: '请输入代码', trigger: 'blur' }
],
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
uom: [
{ required: true, message: '请选择计量单位', trigger: 'change' }
],
altUom: [
{ required: true, message: '请选择替代计量单位', trigger: 'change' }
],
isStdPack: [
{ required: true, message: '请选择是否标包', trigger: 'change' }
],
enableBuy: [
{ required: true, message: '请选择是否可采购', trigger: 'change' }
],
enableMake: [
{ required: true, message: '请选择是否可制造', trigger: 'change' }
],
enableOutsourcing: [
{ required: true, message: '请选择是否可委外加工', trigger: 'change' }
],
isRecycled: [
{ required: true, message: '请选择回收件', trigger: 'change' }
],
isPhantom: [
{ required: true, message: '请选择虚零件', trigger: 'change' }
],
abcClass: [
{ required: true, message: '请选择ABC类', trigger: 'change' }
],
type: [
{ required: true, message: '请选择类型', trigger: 'change' }
],
category: [
{ required: true, message: '请选择种类', trigger: 'change' }
],
itemGroup: [
{ required: true, message: '请选择分组', trigger: 'change' }
],
color: [
{ required: true, message: '请选择颜色', trigger: 'change' }
],
configuration: [
{ required: true, message: '请选择配置', trigger: 'change' }
],
project: [
{ required: true, message: '请输入项目', trigger: 'blur' }
],
eqLevel: [
{ required: true, message: '请选择质量等级', trigger: 'change' }
],
validityDays: [
{ required: true, message: '请输入有效天数', trigger: 'change' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
activeTime: [
{ required: true, message: '请输入生效时间', trigger: 'change' }
],
expireTime: [
{ required: true, message: '请输入失效时间', trigger: 'change' }
],
})
export const { allSchemas } = useCrudSchemas(crudSchemas)
Loading…
Cancel
Save