陈薪名 12 months ago
parent
commit
3c41cbd5b9
  1. 6
      src/components/Descriptions/src/Descriptions.vue
  2. 236
      src/views/wms/basicDataManage/documentSetting/businesstype/index.vue

6
src/components/Descriptions/src/Descriptions.vue

@ -131,9 +131,11 @@ const toggleClick = () => {
data[item.field] !== null ? dayjs(data[item.field]).format(item.dateFormat) : '' data[item.field] !== null ? dayjs(data[item.field]).format(item.dateFormat) : ''
}} }}
</slot> </slot>
<!-- v-else-if="item.dictType && data[item.field].indexOf(',') == -1" -->
<slot v-else-if="item.dictType"> <slot v-else-if="item.dictType">
<DictTag :type="item.dictType" :value="data[item.field] + ''" /> <div v-if="data[item.field]&&Array.isArray(data[item.field])" >
<DictTag :type="item.dictType" :value="cur" v-for="(cur,key) in data[item.field]" :key="key" style="margin-right: 6px;margin-bottom: 6px;"/>
</div>
<DictTag :type="item.dictType" :value="data[item.field] + ''" v-if="data[item.field]&&!Array.isArray(data[item.field])"/>
</slot> </slot>
<slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot> <slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot>
</template> </template>

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

@ -1,18 +1,22 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="Businesstype.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="Businesstype.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick" @button-base-click="buttonBaseClick"
:route-name="routeName" :route-name="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="Businesstype.allSchemas" :allSchemas="Businesstype.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -27,38 +31,68 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #code="{row}"> <template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span> <span>{{ row.code }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
<template #itemTypes="{row}"> <template #itemTypes="{ row }">
<span>{{ strFor(row.itemTypes,DICT_TYPE.ITEM_TYPE)}}</span> <el-tag v-for="tag in row.itemTypes" :key="tag" :disable-transitions="true" class="mr-5px">
{{ getDictLabel(DICT_TYPE.ITEM_TYPE, tag) }}
</el-tag>
</template> </template>
<template #outLocationTypes="{row}"> <template #outLocationTypes="{ row }">
<span>{{ strFor(row.outLocationTypes,DICT_TYPE.LOCATION_TYPE)}}</span> <el-tag
v-for="tag in row.outLocationTypes"
:key="tag"
:disable-transitions="true"
class="mr-5px"
>
{{ getDictLabel(DICT_TYPE.LOCATION_TYPE, tag) }}
</el-tag>
</template> </template>
<template #inLocationTypes="{row}"> <template #inLocationTypes="{ row }">
<span>{{ strFor(row.inLocationTypes,DICT_TYPE.LOCATION_TYPE)}}</span> <el-tag
v-for="tag in row.inLocationTypes"
:key="tag"
:disable-transitions="true"
class="mr-5px"
>
{{ getDictLabel(DICT_TYPE.LOCATION_TYPE, tag) }}
</el-tag>
</template> </template>
<template #outInventoryStatuses="{row}"> <template #outInventoryStatuses="{ row }">
<span>{{ strFor(row.outInventoryStatuses,DICT_TYPE.INVENTORY_STATUS)}}</span> <el-tag
v-for="tag in row.outInventoryStatuses"
:key="tag"
:disable-transitions="true"
class="mr-5px"
>
{{ getDictLabel(DICT_TYPE.INVENTORY_STATUS, tag) }}
</el-tag>
</template> </template>
<template #inInventoryStatuses="{row}"> <template #inInventoryStatuses="{ row }">
<span>{{ strFor(row.inInventoryStatuses,DICT_TYPE.INVENTORY_STATUS)}}</span> <el-tag
v-for="tag in row.inInventoryStatuses"
:key="tag"
:disable-transitions="true"
class="mr-5px"
>
{{ getDictLabel(DICT_TYPE.INVENTORY_STATUS, tag) }}
</el-tag>
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="formsSuccess" @success="formsSuccess"
:rules="BusinesstypeRules" :rules="BusinesstypeRules"
:formAllSchemas="Businesstype.allSchemas" :formAllSchemas="Businesstype.allSchemas"
:apiUpdate="BusinesstypeApi.updateBusinesstype" :apiUpdate="BusinesstypeApi.updateBusinesstype"
:apiCreate="BusinesstypeApi.createBusinesstype" :apiCreate="BusinesstypeApi.createBusinesstype"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
@ -69,40 +103,29 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="Businesstype.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="Businesstype.allSchemas" />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/businesstype/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm
ref="importFormRef"
url="/wms/businesstype/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { getDictLabel,DICT_TYPE } from '@/utils/dict' import { getDictLabel, DICT_TYPE } from '@/utils/dict'
import * as BusinesstypeApi from '@/api/wms/businesstype' import * as BusinesstypeApi from '@/api/wms/businesstype'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import { Businesstype, BusinesstypeRules } from './businesstype.data' import { Businesstype, BusinesstypeRules } from './businesstype.data'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import Detail from '@/components/Detail/src/Detail.vue'
import { Console } from 'console'
// //
defineOptions({ name: 'Businesstype' }) defineOptions({ name: 'Businesstype' })
const strFor = (str,type)=> {
let stradd = ''
if(typeof(str)=='string'){
str.split(',').forEach(element => {
let str1=getDictLabel(type,element)
stradd = stradd+str1+','
})
return stradd.substring(0,stradd.length-1)
}else{
str.join(',').split(',').forEach(element => {
let str2=getDictLabel(type,element)
stradd = stradd+str2+','
})
return stradd.substring(0,stradd.length-1)
}
}
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -128,9 +151,9 @@ const HeadButttondata = [
// defaultButtons.defaultAddBtn({hasPermi:'wms:businesstype:create'}), // // defaultButtons.defaultAddBtn({hasPermi:'wms:businesstype:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'wms:businesstype:import'}), // // defaultButtons.defaultImportBtn({hasPermi:'wms:businesstype:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'wms:businesstype:export'}), // // defaultButtons.defaultExportBtn({hasPermi:'wms:businesstype:export'}), //
defaultButtons.defaultFreshBtn(null),// defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -141,39 +164,47 @@ const HeadButttondata = [
// }, // },
] ]
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:businesstype:update'}), // defaultButtons.mainListEditBtn({ hasPermi: 'wms:businesstype:update' }) //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:businesstype:delete'}), // // defaultButtons.mainListDeleteBtn({hasPermi:'wms:businesstype:delete'}), //
] ]
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') {
//
// const res = await BusinesstypeApi.getItempackaging(row.id) // const res = await BusinesstypeApi.getItempackaging(row.id)
row.itemTypes=row.itemTypes.split(',') // row.itemTypes = row.itemTypes.split(',')
row.outLocationTypes = row.outLocationTypes.split(',') // row.outLocationTypes = row.outLocationTypes.split(',')
row.inLocationTypes = row.inLocationTypes.split(',') // row.inLocationTypes = row.inLocationTypes.split(',')
row.outInventoryStatuses = row.outInventoryStatuses.split(',') // row.outInventoryStatuses = row.outInventoryStatuses.split(',')
row.inInventoryStatuses = row.inInventoryStatuses.split(',') // row.inInventoryStatuses = row.inInventoryStatuses.split(',')
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.id) handleDelete(row.id)
} }
} }
@ -181,36 +212,57 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
console.log(row)
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType, data) => {
var isHave =Businesstype.allSchemas.formSchema.some(function (item) { var isHave = Businesstype.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'; return item.field === 'activeTime' || item.field === 'expireTime'
}); })
if(isHave){ if (isHave) {
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return
} }
} }
if(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null
if(data.expireTime==0)data.expireTime = null; if (data.expireTime == 0) data.expireTime = null
data.itemTypes = data.itemTypes.join(',') data.itemTypes = data.itemTypes.join(',')
data.outLocationTypes = data.outLocationTypes.join(',') data.outLocationTypes = data.outLocationTypes.join(',')
data.inLocationTypes = data.inLocationTypes.join(',') data.inLocationTypes = data.inLocationTypes.join(',')
data.outInventoryStatuses = data.outInventoryStatuses.join(',') data.outInventoryStatuses = data.outInventoryStatuses.join(',')
data.inInventoryStatuses = data.inInventoryStatuses.join(',') data.inInventoryStatuses = data.inInventoryStatuses.join(',')
if (formType === 'create') { if (formType === 'create') {
await BusinesstypeApi.createBusinesstype(data) await BusinesstypeApi.createBusinesstype(data)
.then(() => {
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { basicFormRef.value.dialogVisible = false
await BusinesstypeApi.updateBusinesstype(data) getList()
})
.catch(() => {
data.itemTypes = data.itemTypes.split(',')
data.outLocationTypes = data.outLocationTypes.split(',')
data.inLocationTypes = data.inLocationTypes.split(',')
data.outInventoryStatuses = data.outInventoryStatuses.split(',')
data.inInventoryStatuses = data.inInventoryStatuses.split(',')
})
} else {
await BusinesstypeApi.updateBusinesstype(data)
.then(() => {
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} basicFormRef.value.dialogVisible = false
basicFormRef.value.dialogVisible = false getList()
getList() })
.catch(() => {
data.itemTypes = data.itemTypes.split(',')
data.outLocationTypes = data.outLocationTypes.split(',')
data.inLocationTypes = data.inLocationTypes.split(',')
data.outInventoryStatuses = data.outInventoryStatuses.split(',')
data.inInventoryStatuses = data.inInventoryStatuses.split(',')
})
}
} }
// //
@ -282,8 +334,16 @@ const searchFormClick = (searchData) => {
} }
/** 初始化 **/ /** 初始化 **/
onMounted(async() => { onMounted(async () => {
getList() 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(tableObject.tableList)
importTemplateData.templateUrl = await BusinesstypeApi.importTemplate() importTemplateData.templateUrl = await BusinesstypeApi.importTemplate()
}) })
</script> </script>

Loading…
Cancel
Save