Browse Source

多项状态回显导致卡死问题

master
陈薪名 10 months ago
parent
commit
19856d2b04
  1. 47
      src/components/DictTag/src/DictTag.vue
  2. 1
      src/components/SearchHigh/src/SearchHigh.vue
  3. 1
      src/hooks/web/useTable.ts
  4. 24
      src/views/wms/basicDataManage/documentSetting/businesstype/businesstype.data.ts
  5. 22
      src/views/wms/basicDataManage/documentSetting/businesstype/index.vue

47
src/components/DictTag/src/DictTag.vue

@ -2,7 +2,7 @@
import { defineComponent, PropType, ref } from 'vue'
import { isHexColor } from '@/utils/color'
import { ElTag } from 'element-plus'
import { DictDataType, getDictOptions } from '@/utils/dict'
import { DictDataType, getStrDictOptions } from '@/utils/dict'
export default defineComponent({
name: 'DictTag',
@ -22,28 +22,13 @@ export default defineComponent({
const getDictObj = (dictType: string, value: string) => {
//
if (value.indexOf(',') == -1) {
const dictOptions = getDictOptions(dictType)
dictOptions.forEach((dict: DictDataType) => {
if (dict.value === value) {
if (dict.colorType + '' === 'primary' || dict.colorType + '' === 'default') {
dict.colorType = ''
}
dictData.value = dict
}
})
const dictOptions = getStrDictOptions(dictType)
dictData.value = dictOptions.find(dictOptionsItem => (dictOptionsItem.value == value))
} else {
dictDataList = []
value.split(',').forEach(item => {
const dictOptions = getDictOptions(dictType)
dictOptions.forEach((dict: DictDataType) => {
if (dict.value === item) {
if (dict.colorType + '' === 'primary' || dict.colorType + '' === 'default') {
dict.colorType = ''
}
dictData.value = dict
dictDataList.push(dictData.value)
}
})
const dictOptions = getStrDictOptions(dictType)
dictDataList.push(dictOptions.find(dictOptionsItem => (dictOptionsItem.value == item)))
})
}
}
@ -60,17 +45,17 @@ export default defineComponent({
// dictDataList
if (dictDataList.length == 0) {
return (
<ElTag
style={dictData.value?.cssClass ? 'color: #fff' : ''}
type={dictData.value?.colorType}
color={
dictData.value?.cssClass && isHexColor(dictData.value?.cssClass)
? dictData.value?.cssClass
: ''
}
disableTransitions={true}
>
{dictData.value?.label}
<ElTag
style={dictData.value?.cssClass ? 'color: #fff' : ''}
type={dictData.value?.colorType}
color={
dictData.value?.cssClass && isHexColor(dictData.value?.cssClass)
? dictData.value?.cssClass
: ''
}
disableTransitions={true}
>
{dictData.value?.label}
</ElTag>
)
} else {

1
src/components/SearchHigh/src/SearchHigh.vue

@ -79,7 +79,6 @@ const message = useMessage() // 消息弹窗
const route = useRoute() //
const popoverVisible = ref(false)
const searchOption_high = ref(props.allSchemas?.tableColumns.filter(item => (item.field != "action")))
console.log(searchOption_high.value);
const moreListData = ref({
filters:[]
})

1
src/hooks/web/useTable.ts

@ -150,7 +150,6 @@ export const useTable = <T = any>(config?: UseTableConfig<T>) => {
const res = await config?.getListApi(unref(paramsObj)).finally(() => {
tableObject.loading = false
})
console.log('res',res)
if (res) {
tableObject.tableList = (res as unknown as ResponseType).list
tableObject.total = (res as unknown as ResponseType).total ?? 0

24
src/views/wms/basicDataManage/documentSetting/businesstype/businesstype.data.ts

@ -50,8 +50,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '可用物品类型范围',
field: 'itemTypes',
// dictType: DICT_TYPE.ITEM_TYPE,
// dictClass: 'string',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
@ -67,8 +67,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '可用物品状态范围',
field: 'itemStatuses',
// dictType: DICT_TYPE.ITEM_STATUS,
// dictClass: 'string',
dictType: DICT_TYPE.ITEM_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
@ -78,8 +78,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '出库库位类型范围',
field: 'outLocationTypes',
// dictType: DICT_TYPE.LOCATION_TYPE,
// dictClass: 'string',
dictType: DICT_TYPE.LOCATION_TYPE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
@ -95,8 +95,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '入库库位类型范围',
field: 'inLocationTypes',
// dictType: DICT_TYPE.LOCATION_TYPE,
// dictClass: 'string',
dictType: DICT_TYPE.LOCATION_TYPE,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
@ -150,8 +150,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '出库库存状态范围',
field: 'outInventoryStatuses',
// dictType: DICT_TYPE.INVENTORY_STATUS,
// dictClass: 'string',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
@ -167,8 +167,8 @@ export const Businesstype = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '入库库存状态范围',
field: 'inInventoryStatuses',
// dictType: DICT_TYPE.INVENTORY_STATUS,
// dictClass: 'string',
dictType: DICT_TYPE.INVENTORY_STATUS,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {

22
src/views/wms/basicDataManage/documentSetting/businesstype/index.vue

@ -149,13 +149,13 @@ const butttondata = [
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
// const res = await BusinesstypeApi.getItempackaging(row.id)
// row.itemTypes = row.itemTypes.split(',')
// row.outLocationTypes = row.outLocationTypes.split(',')
// row.inLocationTypes = row.inLocationTypes.split(',')
// row.outInventoryStatuses = row.outInventoryStatuses.split(',')
// row.inInventoryStatuses = row.inInventoryStatuses.split(',')
openForm('update', row)
const rowSplit = JSON.parse(JSON.stringify(row))
rowSplit.itemTypes = rowSplit.itemTypes.split(',')
rowSplit.outLocationTypes = rowSplit.outLocationTypes.split(',')
rowSplit.inLocationTypes = rowSplit.inLocationTypes.split(',')
rowSplit.outInventoryStatuses = rowSplit.outInventoryStatuses.split(',')
rowSplit.inInventoryStatuses = rowSplit.inInventoryStatuses.split(',')
openForm('update', rowSplit)
} else if (val == 'delete') {
//
handleDelete(row.id)
@ -165,7 +165,6 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
console.log(row)
basicFormRef.value.open(type, row)
}
@ -289,13 +288,6 @@ const searchFormClick = (searchData) => {
/** 初始化 **/
onMounted(async () => {
await getList()
// tableObject.tableList.forEach((item) => {
// item.itemTypes = item.itemTypes.split(',')
// item.outLocationTypes = item.outLocationTypes.split(',')
// item.inLocationTypes = item.inLocationTypes.split(',')
// item.outInventoryStatuses = item.outInventoryStatuses.split(',')
// item.inInventoryStatuses = item.inInventoryStatuses.split(',')
// })
// console.log(300, tableObject.tableList)
importTemplateData.templateUrl = await BusinesstypeApi.importTemplate()
})

Loading…
Cancel
Save