|
@@ -6,8 +6,7 @@
|
|
|
<el-col :xs="24" >
|
|
|
<el-card class="mt8" shadow="hover" >
|
|
|
<el-form :model="state.filterModel" :inline="true" @submit.stop.prevent>
|
|
|
- <el-form-item prop="name">
|
|
|
-
|
|
|
+ <el-form-item prop="name" style="width:100%">
|
|
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
|
|
|
<el-form-item label="物料编号">
|
|
|
<el-input v-model="state.filterModel.bomMateNo" placeholder="物料编号" clearable></el-input>
|
|
@@ -18,7 +17,6 @@
|
|
|
<el-input v-model="state.filterModel.bomName" placeholder="部件名称" clearable></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
|
|
|
<el-form-item label="部件类型">
|
|
|
<el-select v-model="state.filterModel.bomType" placeholder="请选择部件类型" clearable class="w100">
|
|
@@ -28,11 +26,12 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
|
|
|
- <el-button v-auth="'api:admin:file:upload-file'" type="primary" icon="ele-Upload" @click="onUpload"> 上传 </el-button>
|
|
|
+ <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4" class="mb20">
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
|
|
|
+ <el-button v-auth="'api:admin:file:upload-file'" type="primary" icon="ele-Upload" @click="onUpload"> 上传 </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-card>
|
|
@@ -99,7 +98,6 @@
|
|
|
<el-link
|
|
|
class="my-el-link mr12 ml12"
|
|
|
@click="$router.push(`/product/${row.guid}`)"
|
|
|
- :href="row.guid"
|
|
|
type="primary"
|
|
|
icon="ele-edit"
|
|
|
size="small"
|
|
@@ -131,111 +129,114 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <script lang="ts" setup name="admin/product/bom">
|
|
|
- import { ref, reactive, onMounted, onBeforeMount, computed } from 'vue'
|
|
|
- import { PageInputFileGetPageDto, FileGetPageOutput } from '/src/api/admin/data-contracts'
|
|
|
- import { ComponentTypeApi } from '/@/api/admin/productionManagement/ComponentType'
|
|
|
- import dayjs from 'dayjs'
|
|
|
- import eventBus from '/src/utils/mitt'
|
|
|
- import { isImage } from '/src/utils/test'
|
|
|
- //import commonFunction from '/@/utils/commonFunction'
|
|
|
-
|
|
|
- // const { proxy } = getCurrentInstance() as any
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- const fileUploadRef = ref()
|
|
|
-
|
|
|
- //部件的页面对象
|
|
|
- const state = reactive({
|
|
|
- loading: false,
|
|
|
- fileFormTitle: '',
|
|
|
- filterModel: {
|
|
|
- fileName: '',
|
|
|
- bomType: '',
|
|
|
- bomName: '',
|
|
|
- bomProNo: '',
|
|
|
- bomMateNo: '',
|
|
|
- },
|
|
|
- total: 0,
|
|
|
- pageInput: {
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 20,
|
|
|
- } as PageInputFileGetPageDto,
|
|
|
- bomListData: [] as Array<FileGetPageOutput>,
|
|
|
- bomLogsTitle: '',
|
|
|
- })
|
|
|
-
|
|
|
- //const { copyText } = commonFunction()
|
|
|
-
|
|
|
- const previewImglist = computed(() => {
|
|
|
- let imgList = [] as string[]
|
|
|
- state.bomListData.forEach((a) => {
|
|
|
- if (isImage(a.extension as string) && a.linkUrl) {
|
|
|
- imgList.push(a.linkUrl as string)
|
|
|
- }
|
|
|
- })
|
|
|
- return imgList
|
|
|
+<script lang="ts" setup name="admin/product/bom">
|
|
|
+import { ref, reactive, onMounted, onBeforeMount, computed } from 'vue'
|
|
|
+import { PageInputFileGetPageDto, FileGetPageOutput } from '/src/api/admin/data-contracts'
|
|
|
+import { ComponentTypeApi } from '/@/api/admin/productionManagement/ComponentType'
|
|
|
+import dayjs from 'dayjs'
|
|
|
+import eventBus from '/src/utils/mitt'
|
|
|
+import { isImage } from '/src/utils/test'
|
|
|
+//import commonFunction from '/@/utils/commonFunction'
|
|
|
+
|
|
|
+// const { proxy } = getCurrentInstance() as any
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+const fileUploadRef = ref()
|
|
|
+
|
|
|
+//部件的页面对象
|
|
|
+const state = reactive({
|
|
|
+ loading: false,
|
|
|
+ fileFormTitle: '',
|
|
|
+ filterModel: {
|
|
|
+ fileName: '',
|
|
|
+ bomType: '',
|
|
|
+ bomName: '',
|
|
|
+ bomProNo: '',
|
|
|
+ bomMateNo: '',
|
|
|
+ },
|
|
|
+ total: 0,
|
|
|
+ pageInput: {
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ } as PageInputFileGetPageDto,
|
|
|
+ bomListData: [] as Array<FileGetPageOutput>,
|
|
|
+ bomLogsTitle: '',
|
|
|
+})
|
|
|
+
|
|
|
+//const { copyText } = commonFunction()
|
|
|
+
|
|
|
+const previewImglist = computed(() => {
|
|
|
+ let imgList = [] as string[]
|
|
|
+ state.bomListData.forEach((a) => {
|
|
|
+ if (isImage(a.extension as string) && a.linkUrl) {
|
|
|
+ imgList.push(a.linkUrl as string)
|
|
|
+ }
|
|
|
})
|
|
|
+ return imgList
|
|
|
+})
|
|
|
|
|
|
- onMounted(() => {
|
|
|
+onMounted(() => {
|
|
|
+ onQuery()
|
|
|
+ eventBus.off('refreshFile')
|
|
|
+ eventBus.on('refreshFile', async () => {
|
|
|
onQuery()
|
|
|
- eventBus.off('refreshFile')
|
|
|
- eventBus.on('refreshFile', async () => {
|
|
|
- onQuery()
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
- onBeforeMount(() => {
|
|
|
- eventBus.off('refreshFile')
|
|
|
})
|
|
|
+})
|
|
|
|
|
|
- const formatterTime = (cellValue: any) => {
|
|
|
- return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss')
|
|
|
- }
|
|
|
+onBeforeMount(() => {
|
|
|
+ eventBus.off('refreshFile')
|
|
|
+})
|
|
|
|
|
|
- const getInitialIndex = (imgUrl: string) => {
|
|
|
- return previewImglist.value.indexOf(imgUrl)
|
|
|
- }
|
|
|
+const formatterTime = (cellValue: any) => {
|
|
|
+ return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss')
|
|
|
+}
|
|
|
|
|
|
- const onQuery = async () => {
|
|
|
- state.loading = true
|
|
|
- const res = await new ComponentTypeApi().getPage({ ...state.pageInput, filter: state.filterModel }).catch(() => {
|
|
|
- state.loading = false
|
|
|
- })
|
|
|
+const getInitialIndex = (imgUrl: string) => {
|
|
|
+ return previewImglist.value.indexOf(imgUrl)
|
|
|
+}
|
|
|
|
|
|
- state.bomListData = res?.data?.list ?? []
|
|
|
- state.total = res?.data?.total ?? 0
|
|
|
- state.loading = false
|
|
|
- }
|
|
|
-
|
|
|
- const onSizeChange = (val: number) => {
|
|
|
- state.pageInput.pageSize = val
|
|
|
- onQuery()
|
|
|
- }
|
|
|
+const onQuery = async () => {
|
|
|
+ state.loading = true
|
|
|
+ const res = await new ComponentTypeApi().getPage({ ...state.pageInput, filter: state.filterModel }).catch(() => {
|
|
|
+ state.loading = false
|
|
|
+ })
|
|
|
|
|
|
- const onCurrentChange = (val: number) => {
|
|
|
- state.pageInput.currentPage = val
|
|
|
- onQuery()
|
|
|
- }
|
|
|
-
|
|
|
- const onUpload = () => {
|
|
|
- fileUploadRef.value.open()
|
|
|
- }
|
|
|
-
|
|
|
- //const onDelete = (row: FileGetPageOutput) => {
|
|
|
- // proxy.$modal
|
|
|
- //.confirmDelete(`确定要删除文件【${row.fileName}${row.extension}】?`)
|
|
|
- //.then(async () => {
|
|
|
- // await new BomApi().delete({ id: row.id as number }, { loading: true, showSuccessMessage: true })
|
|
|
- // onQuery()
|
|
|
- // })
|
|
|
- // .catch(() => {})
|
|
|
- // }
|
|
|
- </script>
|
|
|
-
|
|
|
- <style scoped lang="scss">
|
|
|
- .my-el-link {
|
|
|
- font-size: 12px;
|
|
|
- }
|
|
|
- </style>
|
|
|
+ state.bomListData = res?.data?.list ?? []
|
|
|
+ state.total = res?.data?.total ?? 0
|
|
|
+ state.loading = false
|
|
|
+}
|
|
|
+
|
|
|
+const onSizeChange = (val: number) => {
|
|
|
+ state.pageInput.pageSize = val
|
|
|
+ onQuery()
|
|
|
+}
|
|
|
+
|
|
|
+const onCurrentChange = (val: number) => {
|
|
|
+ state.pageInput.currentPage = val
|
|
|
+ onQuery()
|
|
|
+}
|
|
|
+
|
|
|
+const onUpload = () => {
|
|
|
+ fileUploadRef.value.open()
|
|
|
+}
|
|
|
+
|
|
|
+//const onDelete = (row: FileGetPageOutput) => {
|
|
|
+ // proxy.$modal
|
|
|
+ //.confirmDelete(`确定要删除文件【${row.fileName}${row.extension}】?`)
|
|
|
+ //.then(async () => {
|
|
|
+ // await new BomApi().delete({ id: row.id as number }, { loading: true, showSuccessMessage: true })
|
|
|
+ // onQuery()
|
|
|
+ // })
|
|
|
+ // .catch(() => {})
|
|
|
+// }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.my-el-link {
|
|
|
+ font-size: 12px;
|
|
|
+}
|
|
|
+.el-form .el-col.mb20 {
|
|
|
+ margin: 0 !important;
|
|
|
+}
|
|
|
+</style>
|