Browse Source

工位前端导入代码demo测试

master
chenfang 1 year ago
parent
commit
e783ebafa4
  1. 5
      src/api/wms/workstation/index.ts
  2. 4
      src/views/wms/workstation/WorkstationForm.vue
  3. 20
      src/views/wms/workstation/index.vue

5
src/api/wms/workstation/index.ts

@ -44,3 +44,8 @@ export const deleteWorkstation = async (id: number) => {
export const exportWorkstation = async (params) => {
return await request.download({ url: `/wms/workstation/export-excel`, params })
}
// 下载用户导入模板
export const importWorkstationTemplate = () => {
return request.download({ url: '/wms/workstation/get-import-template' })
}

4
src/views/wms/workstation/WorkstationForm.vue

@ -66,7 +66,7 @@
<el-form-item label="是否可用" prop="available">
<el-select v-model="formData.available" placeholder="请选择是否可用">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)"
v-for="dict in getStrDictOptions(DICT_TYPE.TRUE_FALSE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -110,7 +110,7 @@
</Dialog>
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as WorkstationApi from '@/api/wms/workstation'
const { t } = useI18n() //

20
src/views/wms/workstation/index.vue

@ -80,7 +80,7 @@
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)"
v-for="dict in getStrDictOptions(DICT_TYPE.TRUE_FALSE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -148,6 +148,12 @@
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="warning"
@click="handleImport"
v-hasPermi="['wms:workstation:import']">
<Icon icon="ep:upload" /> 导入
</el-button>
<el-button
type="success"
@click="handleExport"
@ -235,14 +241,18 @@
<!-- 表单弹窗添加/修改 -->
<WorkstationForm ref="formRef" @success="getList" />
<!-- 用户导入对话框 -->
<WorkstationImportForm ref="importFormRef" @success="getList" />
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import { DICT_TYPE, getStrDictOptions} from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as WorkstationApi from '@/api/wms/workstation'
import WorkstationForm from './WorkstationForm.vue'
import WorkstationImportForm from './WorkstationImportForm.vue'
defineOptions({ name: 'Workstation' })
@ -297,6 +307,12 @@ const resetQuery = () => {
handleQuery()
}
/** 用户导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {

Loading…
Cancel
Save