lzhe
2024-06-06 a2441175073f8b09a7eff29effd7e3e617de2f7d
Merge branch 'master' of http://www.beijingsoft.cn:9090/r/smart-web
已修改4个文件
332 ■■■■■ 文件已修改
src/views/dnc/station-file/File.vue 268 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/station-file/Log.vue 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/station-file/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/MYTree.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/station-file/File.vue
@@ -1,34 +1,278 @@
<!--
 * @Date: 2024-05-22 23:37:07
 * @LastEditors: Sneed
 * @LastEditTime: 2024-05-26 15:42:35
 * @LastEditTime: 2024-06-05 22:52:06
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/station-file/File.vue
-->
<template>
    <el-container>
        <el-header>
            <el-button type="primary">归档</el-button>
            <el-button :disabled="selectionFile.length == 0 && selection.length == 0" type="primary"
                @click="archive">归档</el-button>
            <el-tree-select v-model="storageSpaceId" :data="treeData" :props="{
                label: 'name',
            }" node-key="id" default-expand-all check-strictly style="width: 240px">
                <template #prefix>
                    FTP目录
                </template>
            </el-tree-select>
        </el-header>
        <el-main>
            <h2>程序</h2>
            <el-table :data="tableData" style="width: 100%">
                <el-table-column label="文件名称" prop="" width=""></el-table-column>
                <el-table-column label="版本" prop="" width=""></el-table-column>
                <el-table-column label="大小" prop="" width=""></el-table-column>
            <h2 style="background-color: var(--el-color-primary);color: #fff;padding: 4px 20px;">程序</h2>
            <el-table :data="tableData" style="width: 100%" @selection-change="onSelectionChange">
                <el-table-column type="selection"></el-table-column>
                <el-table-column label="文件名称" prop="filename" width=""></el-table-column>
                <el-table-column label="版本" prop="versionDesc" width=""></el-table-column>
                <el-table-column label="大小" prop="contentLength" width=""></el-table-column>
                <el-table-column label="文件类型" prop="suffix" width=""></el-table-column>
                <el-table-column label="文件位置" prop="fileLocation" width=""></el-table-column>
                <el-table-column label="归档状态" prop="whetherArchiveDesc" width=""></el-table-column>
                <el-table-column label="更新人" prop="updateUserName" width=""></el-table-column>
                <el-table-column label="更新时间" prop="updateTime" width=""></el-table-column>
                <el-table-column label="操作" prop="" width="">
                    <template #default="scope">
                        <el-button-group>
                            <el-button text type="primary" size="small"
                                @click="download(scope.row, scope.$index)">下载</el-button>
                            <el-popconfirm width="220" title="确定将选择的数据删除" @confirm="table_del(scope.row)">
                                <template #reference>
                                    <el-button text type="primary" size="small">删除</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </el-table>
            <h2>文件</h2>
            <el-table :data="tableData" style="width: 100%">
                <el-table-column label="文件名称" prop="" width=""></el-table-column>
                <el-table-column label="版本" prop="" width=""></el-table-column>
                <el-table-column label="大小" prop="" width=""></el-table-column>
            <h2 style="margin-top: 10px;background-color: var(--el-color-primary);color: #fff;padding: 4px 20px;">文件
            </h2>
            <el-table :data="tableDataFile" style="width: 100%" @selection-change="onSelectionChangeFile">
                <el-table-column type="selection"></el-table-column>
                <el-table-column label="文件名称" prop="filename" width=""></el-table-column>
                <el-table-column label="版本" prop="versionDesc" width=""></el-table-column>
                <el-table-column label="大小" prop="contentLength" width=""></el-table-column>
                <el-table-column label="文件类型" prop="suffix" width=""></el-table-column>
                <el-table-column label="文件位置" prop="fileLocation" width=""></el-table-column>
                <el-table-column label="归档状态" prop="whetherArchiveDesc" width=""></el-table-column>
                <el-table-column label="更新人" prop="updateUserName" width=""></el-table-column>
                <el-table-column label="更新时间" prop="updateTime" width=""></el-table-column>
                <el-table-column label="操作" prop="" width="">
                    <template #default="scope">
                        <el-button-group>
                            <el-button text type="primary" size="small"
                                @click="download(scope.row, scope.$index)">下载</el-button>
                            <el-popconfirm width="220" title="确定将选择的数据删除" @confirm="table_del(scope.row)">
                                <template #reference>
                                    <el-button text type="primary" size="small">删除</el-button>
                                </template>
                            </el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </el-table>
        </el-main>
        <scDialog v-model="visible">
            <el-tabs v-model="activeName" type="card" class="demo-tabs">
                <el-tab-pane label="归档目录" name="1">
                    <el-tree v-if="activeName === '1'" ref="group" node-key="id" :props="{
                        label: 'name',
                        hasChildren: 'id'
                    }" show-checkbox :load="loadNode" lazy></el-tree>
                </el-tab-pane>
                <el-tab-pane label="工艺管理" name="2">
                    <el-tree v-if="activeName === '2'" ref="group" node-key="id" :props="{
                        label: 'name',
                        hasChildren: 'id'
                    }" show-checkbox :load="loadNode1" lazy></el-tree>
                </el-tab-pane>
            </el-tabs>
            <template #footer>
                <div style="text-align: right;">
                    <el-button type="primary" @click="confirm">确定</el-button>
                </div>
            </template>
        </scDialog>
    </el-container>
</template>
<script>
export default {
    props: {
        treeChecked: {
            type: Array,
        }
    },
    watch: {
        treeChecked(val) {
            console.log(val[0])
            if (val?.[0]) {
                this.init(val?.[0])
            } else {
                this.treeData = []
            }
        },
        storageSpaceId() {
            this.getFilelist()
        }
    },
    data() {
        return {
            treeData: [],
            storageSpaceId: '',
            tableData: [],
            tableDataFile: [],
            selection: [],
            selectionFile: [],
            visible: false,
            activeName: '1'
        }
    },
    methods: {
        init(workstationId) {
            this.$HTTP.get(`/api/blade-dnc/dnc-fixed-space/direct-loading-space-tree?workstationId=${workstationId}`).then(res => {
                this.storageSpaceId = res.data[0].id
                this.treeData = this.formatData(res.data)
            })
        },
        formatData(data, current, flag) {
            let newData = []
            if (!current) {
                newData = data.filter(item => item.parentId == 0).map(v => {
                    v.children = this.formatData(data, v, flag).sort((a, b) => {
                        return b.sort - a.sort
                    })
                    flag && (v.disabled = !v.isWorkstation)
                    return v
                })
            } else {
                let res = data.filter(v => v.parentId == current.id)
                res = res.map(item => {
                    item.children = this.formatData(data, item, flag).sort((a, b) => {
                        return b.sort - a.sort
                    })
                    flag && (item.disabled = !item.isWorkstation)
                    return item
                })
                return res
            }
            return newData
        },
        getFilelist() {
            this.$HTTP.post(`/api/blade-dnc/transfer-directory/fileList`, {
                storageSpaceId: this.storageSpaceId,
                fileLocations: [2],
                workstationId: this.treeChecked[0]
            }).then(res => {
                this.selection = []
                this.tableData = res.data.filter(v => v.fileType == 1)
                this.tableDataFile = res.data.filter(v => v.fileType == 2)
            })
        },
        onSelectionChange(selection) {
            this.selection = selection
        },
        onSelectionChangeFile(selection) {
            this.selectionFile = selection
        },
        download() {
        },
        table_del(row) {
            this.$HTTP.get(`/api/blade-dnc/transfer-directory/delete-file/${row.id}`).then(res => {
                this.getFilelist()
            })
        },
        loadNode(node, resolve) {
            let id = node.level === 0 ? '' : node.data.id
            this.$HTTP.get(`/api/blade-dnc/dnc-archive-directory/list?parentId=${id}`).then(res => {
                resolve(res.data)
            })
        },
        loadNode1(node, resolve) {
            let id = node.level === 0 ? '' : node.data.id
            this.$HTTP.get(`/api/blade-dnc/dnc-process-catalogue/lazy-art-list?parentId=${id}`).then(res => {
                resolve(res.data)
            })
        },
        archive() {
            this.visible = true
        },
        async confirm() {
            let archiveDirectoryIds = this.$refs.group.getCheckedNodes().map(v => v.id)
            console.log('>>>>>>', archiveDirectoryIds)
            if (archiveDirectoryIds.length === 0) {
                return this.$message.warning(`请选择文件夹`);
            }
            if (this.activeName === '1') {
                this.$HTTP.post(`/api/blade-dnc/dnc-archive-directory-file/checkFile`, {
                    archiveDirectoryIds,
                    voList: [...this.selection, ...this.selectionFile].map(v => {
                        return {
                            contentMd5: v.contentMd5,
                            filename: v.filename,
                            objectKey: v.objectKey,
                            workstationId: v.workstationId
                        }
                    })
                }).then(res => {
                    if (!res.data) {
                        this.$HTTP.post(`/api/blade-dnc/dnc-archive-directory-file/insert`, {
                            archiveDirectoryIds,
                            fileAddVOList: [...this.selection, ...this.selectionFile].map(v => {
                                return {
                                    contentLength: v.contentLength,
                                    contentMd5: v.contentMd5,
                                    contentType: v.contentType,
                                    fileOwnership: v.documentOwnerships || 1,
                                    filename: v.filename,
                                    link: v.link,
                                    objectKey: v.objectKey,
                                    originalFilename: v.originalFilename,
                                    suffix: v.suffix,
                                    workstationFileId: v.id,
                                    workstationId: v.workstationId,
                                }
                            })
                        }).then(res => {
                            this.visible = false
                            this.$message.success(res.msg);
                        })
                    }
                })
            } else {
                Promise.all(archiveDirectoryIds.map(v => {
                    return this.$HTTP.post(`/api/blade-dnc/dnc-art-file/duplicate-validation-file`, {
                        artBagId: v,
                        artFileAddVOList: [...this.selection, ...this.selectionFile].map(v => {
                            return {
                                contentMd5: v.contentMd5,
                                fileType: v.fileType,
                                filename: v.filename,
                                objectKey: v.objectKey,
                            }
                        })
                    })
                })).then(arr => {
                    let artBagIds = []
                    arr.forEach((item, index) => {
                        if (!item.data) artBagIds.push(archiveDirectoryIds[index])
                    });
                    if (artBagIds.length === 0) {
                        return this.$message.warning(`重复`);
                    }
                    this.$HTTP.post(`/api/blade-dnc/dnc-art-file/batch-insert`, {
                        artBagIds,
                        dncArtFileAddList: [...this.selection, ...this.selectionFile]
                    }).then(res => {
                        this.visible = false
                        this.$message.success(res.msg);
                    })
                })
            }
            // /api/blade-dnc/dnc-archive-directory-file/checkFile
        }
    },
}
</script>
src/views/dnc/station-file/Log.vue
@@ -1,34 +1,35 @@
<!--
 * @Date: 2024-05-22 23:18:15
 * @LastEditors: Sneed
 * @LastEditTime: 2024-05-26 16:04:41
 * @LastEditTime: 2024-06-05 23:03:45
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/station-file/Log.vue
-->
<template>
    <el-container>
        <el-header>
            <el-input v-model="params.name" style="width: 240px;margin-left: 8px;" placeholder="Please input">
            <el-input v-model="params.fileName" style="width: 240px;margin-left: 8px;" placeholder="">
                <template #prefix>文件名称</template>
            </el-input>
            <el-select v-model="params.typeId" style="width: 240px;margin-left: 8px;">
            <el-select v-model="params.fileType" style="width: 240px;margin-left: 8px;">
                <template #prefix>
                    文件类型
                </template>
                <el-option v-for="item in options.typeId" :key="item.value" :label="item.label" :value="item.value" />
                <el-option v-for="item in options.fileType" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
            <el-date-picker style="width: 260px;flex-grow: 0;margin-left: 8px;" v-model="params.name" type="daterange"
            <el-date-picker style="width: 260px;flex-grow: 0;margin-left: 8px;" v-model="params.time" type="daterange"
                range-separator="-" start-placeholder="操作开始时间" end-placeholder="操作结束时间">
            </el-date-picker>
            <el-select v-model="params.typeId" style="width: 240px;margin-left: 8px;margin-right: auto;">
            <el-select v-model="params.operationType" style="width: 240px;margin-left: 8px;margin-right: auto;">
                <template #prefix>
                    操作类型
                </template>
                <el-option v-for="item in options.typeId" :key="item.value" :label="item.label" :value="item.value" />
                <el-option v-for="item in options.operationType" :key="item.value" :label="item.label"
                    :value="item.value" />
            </el-select>
        </el-header>
        <el-main >
            <scTable v-if="id" highlight-current-row @dataChange="dataChange" @row-click="rowClick" ref="table" :params="params"
                :apiObj="apiObj" @selection-change="selectionChange" stripe>
            <scTable v-if="id" highlight-current-row @dataChange="dataChange" @row-click="rowClick" ref="table"
                :params="params" :apiObj="apiObj" @selection-change="selectionChange" stripe>
                <el-table-column label="文件名称" prop="fileName">
                </el-table-column>
                <el-table-column label="版本" prop="version"></el-table-column>
@@ -55,15 +56,24 @@
            this.$nextTick(() => {
                val && this.$refs?.table?.reload()
            })
        },
        params: {
            handler() {
                this.$refs.table.reload()
            },
            deep: true
        }
    },
    data() {
        return {
            params: {
                name: ''
                fileName: '',
                fileType: '',
                time: [],
                operationType: ''
            },
            options: {
                typeId: []
                fileType: []
            },
            apiObj: {
                get: async (data) => {
@@ -71,14 +81,32 @@
                        current: data.current,
                        size: data.size
                    }
                    return await this.$HTTP.post(`/api/blade-dnc/operation-file/page/${this.id}`, {}, { params,data:this.params }).then(res => {
                    let dataNew = {
                        ...this.params,
                        operationStartTime: this.params[0] || "",
                        operationEndTime: this.params[1] || ""
                    }
                    return await this.$HTTP.post(`/api/blade-dnc/operation-file/page/${this.id}`, {}, { params, data: dataNew }).then(res => {
                        return res
                    })
                }
            }
        }
    },
    created() {
        this.init()
    },
    methods: {
        init() {
            this.$HTTP.get(`/api/blade-dnc/operation-file/list/suffix`).then(res => {
                this.options.fileType = res.data.suffix.map(v => {
                    return {
                        value: v,
                        label: v
                    }
                })
            })
        },
        dataChange (data) {
            console.log(data)
        }
src/views/dnc/station-file/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-05-20 21:43:10
 * @LastEditors: Sneed
 * @LastEditTime: 2024-05-26 16:02:09
 * @LastEditTime: 2024-06-05 21:11:02
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/station-file/index.vue
-->
<template>
@@ -21,7 +21,7 @@
                <el-main>
                    <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="handleClick">
                        <el-tab-pane label="工位文件" name="1">
                            <File></File>
                            <File :treeChecked="treeChecked"></File>
                        </el-tab-pane>
                        <el-tab-pane label="操作日志" name="2">
                            <Log :id="id"/>
@@ -46,7 +46,7 @@
    data() {
        return {
            id: '',
            activeName: '2',
            activeName: '1',
            treeChecked: {},
            props: {
                disabled: function (data,node) {
src/views/mdc/MYTree.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-04-18 19:53:35
 * @LastEditors: Sneed
 * @LastEditTime: 2024-06-04 21:33:08
 * @LastEditTime: 2024-06-05 21:46:20
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/MYTree.vue
-->
<template>
@@ -139,8 +139,8 @@
</script>
<style lang="scss">
.is-current .el-tree-node__content {
    background: var(--el-color-primary) !important;
.is-current>.el-tree-node__content {
    // background: var(--el-color-primary) !important;
}
a.disabled {