diff --git a/src/views/modules/qc/IQCFileTable.vue b/src/views/modules/qc/IQCFileTable.vue
index 04dedea..bca2e6c 100644
--- a/src/views/modules/qc/IQCFileTable.vue
+++ b/src/views/modules/qc/IQCFileTable.vue
@@ -215,7 +215,10 @@ export default {
预览
下载
- 删除
+ 删除
预览
下载
diff --git a/src/views/modules/qc/qcPartAttribute.vue b/src/views/modules/qc/qcPartAttribute.vue
index 579377c..12a7c48 100644
--- a/src/views/modules/qc/qcPartAttribute.vue
+++ b/src/views/modules/qc/qcPartAttribute.vue
@@ -32,7 +32,7 @@
新增
- 导入
+
检验模板
编辑
删除
- SOP文件
+
+ 物料SOP
@@ -638,6 +639,61 @@
+
+
+
+ 上传文件
+
+
+
+
+
+
+
+
+
+ 查看 |
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 将文件拖到此处,或点击上传
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -730,6 +786,7 @@
import {getFileContentList, downLoadObjectFile} from '@/api/eam/eam_object_list.js'
import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
import {deleteObjectFile} from '@/api/eam/eam.js'
+ import {queryOssFilePlus, ossUploadNoSaveOSSForYJY, previewOssFileById, removeOss} from '@/api/oss/oss'
import qcUpload from "./qc_upload"
import qcSOPUploadFile from "./qc_SOP_upload_file"
export default {
@@ -1312,6 +1369,19 @@
},
sopList: [],
sopFileModelFlag: false,
+ partSopFileModelFlag: false,
+ partSopLoading: false,
+ ossVisible: false,
+ uploadLoading: false,
+ partSopCurrent: {
+ site: '',
+ partNo: ''
+ },
+ partSopList: [],
+ fileList2: [],
+ ossForm: {
+ remark: ''
+ },
sopColumnList: [
{
columnProp: 'fileName',
@@ -2335,6 +2405,135 @@
})
},
+ // 物料SOP文件列表
+ openPartSopFileList (row) {
+ this.partSopCurrent = {
+ site: row.site,
+ partNo: row.partNo
+ }
+ this.fetchPartSopList()
+ this.partSopFileModelFlag = true
+ },
+
+ fetchPartSopList () {
+ if (!this.partSopCurrent || !this.partSopCurrent.site || !this.partSopCurrent.partNo) {
+ this.partSopList = []
+ return
+ }
+ const params = {
+ orderRef1: this.partSopCurrent.site,
+ orderRef2: this.partSopCurrent.partNo,
+ orderRef3: '',
+ orderReftype: 'PartSop'
+ }
+ this.partSopLoading = true
+ queryOssFilePlus(params).then(({data}) => {
+ if (data && data.code === 0) {
+ this.partSopList = data.rows || []
+ } else {
+ this.partSopList = []
+ }
+ }).catch(() => {
+ this.partSopList = []
+ }).finally(() => {
+ this.partSopLoading = false
+ })
+ },
+
+ openPartSopUploadDialog () {
+ if (!this.partSopCurrent || !this.partSopCurrent.site || !this.partSopCurrent.partNo) {
+ this.$message.warning('请先选择物料')
+ return
+ }
+ this.fileList2 = []
+ this.ossForm.remark = ''
+ this.ossVisible = true
+ this.$nextTick(() => {
+ if (this.$refs.upload) {
+ this.$refs.upload.clearFiles()
+ }
+ })
+ },
+
+ onRemoveFile (file, fileList) {
+ this.fileList2 = fileList
+ },
+
+ onChangeFile (file, fileList) {
+ this.fileList2 = fileList
+ },
+
+ handleUploadFiles () {
+ if (!this.partSopCurrent || !this.partSopCurrent.site || !this.partSopCurrent.partNo) {
+ this.$message.warning('请先选择物料')
+ return
+ }
+ if (!this.fileList2 || this.fileList2.length === 0) {
+ this.$message.warning('请选择文件')
+ return
+ }
+ let formData = new FormData()
+ for (let i = 0; i < this.fileList2.length; i++) {
+ formData.append('file', this.fileList2[i].raw)
+ }
+ formData.append('orderRef1', this.partSopCurrent.site)
+ formData.append('orderRef2', this.partSopCurrent.partNo)
+ formData.append('orderRef3', '')
+ formData.append('createdBy', this.$store.state.user.name)
+ formData.append('CAdditionalInfo', this.ossForm.remark || '')
+ formData.append('orderReftype', 'PartSop')
+ this.uploadLoading = true
+ ossUploadNoSaveOSSForYJY(formData).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success('上传成功')
+ this.ossVisible = false
+ this.fileList2 = []
+ this.ossForm.remark = ''
+ this.fetchPartSopList()
+ } else {
+ this.$message.warning(data.msg || '上传失败')
+ }
+ }).catch(() => {
+ this.$message.error('上传失败')
+ }).finally(() => {
+ this.uploadLoading = false
+ })
+ },
+
+ previewPartSopFile (row) {
+ let params = {
+ id: row.id
+ }
+ previewOssFileById(params).then((response) => {
+ const contentType = (response.headers && response.headers['content-type']) || 'application/octet-stream'
+ const blob = new Blob([response.data], { type: contentType })
+ const link = document.createElement('a')
+ link.href = URL.createObjectURL(blob)
+ link.setAttribute('download', row.fileName)
+ link.target = '_blank'
+ link.click()
+ URL.revokeObjectURL(link.href)
+ })
+ },
+
+ removePartSopFile (row) {
+ this.$confirm('确定要删除该文件吗?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ removeOss([row.id]).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success('删除成功')
+ this.fetchPartSopList()
+ } else {
+ this.$message.warning(data.msg || '删除失败')
+ }
+ })
+ }).catch(() => {
+ })
+ },
+
// 动态列开始 获取 用户保存的 格式列
async getTableUserColumn (tableId, columnId) {
let queryTableUser = {
@@ -2443,4 +2642,9 @@
height: auto;
line-height: 1.5;
}
+
+.rq .auto /deep/ .el-form-item__content {
+ height: auto;
+ line-height: 1.5;
+}
diff --git a/src/views/modules/srmBaseInformation/srmPartFamily.vue b/src/views/modules/srmBaseInformation/srmPartFamily.vue
index f1e74bf..4502788 100644
--- a/src/views/modules/srmBaseInformation/srmPartFamily.vue
+++ b/src/views/modules/srmBaseInformation/srmPartFamily.vue
@@ -102,15 +102,17 @@
align="center"
- width="120"
+ width="210"
label="操作">
- 编辑 |
+ 编辑
- 删除
+ | 删除
+
+ | SOP上传
@@ -138,6 +140,108 @@
+
+
+
+
+
+
+ 上传文件
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查看 |
+
+ 删除
+
+
+
+
+
+
+
+
+
+ 关闭
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 将文件拖到此处,或点击上传
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -273,6 +377,12 @@ import {
deletePartFamily
} from '@/api/baseInformation/srmPartFamily.js'
+import {
+ queryOssFilePlus,
+ ossUploadNoSaveOSSForYJY,
+ previewOssFileById,
+ removeOss
+} from '@/api/oss/oss'
@@ -382,6 +492,26 @@ export default {
modalDisableFlag: false,
+ sopDialogVisible: false,
+
+ ossVisible: false,
+
+ sopLoading: false,
+
+ uploadLoading: false,
+
+ sopCurrentRow: null,
+
+ sopFileList: [],
+
+ fileList2: [],
+
+ ossForm: {
+
+ remark: ''
+
+ },
+
modalData: {
site: this.$store.state.user.site,
@@ -1172,6 +1302,229 @@ export default {
},
+ buildSopQueryParams (row) {
+
+ return {
+
+ orderRef1: row.site,
+
+ orderRef2: row.familyId,
+
+ orderRef3: '',
+
+ orderReftype: 'PartFamilySop'
+
+ }
+
+ },
+ openSopList (row) {
+
+ this.sopCurrentRow = {
+
+ site: row.site,
+
+ familyId: row.familyId
+
+ }
+
+ this.sopDialogVisible = true
+
+ this.fetchSopFileList()
+
+ },
+ fetchSopFileList () {
+
+ if (!this.sopCurrentRow) {
+
+ this.sopFileList = []
+
+ return
+
+ }
+
+ this.sopLoading = true
+
+ queryOssFilePlus(this.buildSopQueryParams(this.sopCurrentRow)).then(({ data }) => {
+
+ if (data && data.code === 0) {
+
+ this.sopFileList = data.rows || []
+
+ } else {
+
+ this.sopFileList = []
+
+ }
+
+ }).catch(() => {
+
+ this.sopFileList = []
+
+ }).finally(() => {
+
+ this.sopLoading = false
+
+ })
+
+ },
+ openSopUploadDialog () {
+
+ if (!this.sopCurrentRow) {
+
+ this.$message.warning('请先选择分类')
+
+ return
+
+ }
+
+ this.fileList2 = []
+
+ this.ossForm.remark = ''
+
+ this.ossVisible = true
+
+ this.$nextTick(() => {
+ if (this.$refs.upload) {
+ this.$refs.upload.clearFiles()
+ }
+ })
+
+ },
+ onRemoveFile (file, fileList) {
+
+ this.fileList2 = fileList
+
+ },
+ onChangeFile (file, fileList) {
+
+ this.fileList2 = fileList
+
+ },
+ handleUploadFiles () {
+
+ if (!this.sopCurrentRow) {
+
+ this.$message.warning('请先选择分类')
+
+ return
+
+ }
+
+ if (!this.fileList2 || this.fileList2.length === 0) {
+
+ this.$message.warning('请选择文件')
+
+ return
+
+ }
+
+ const formData = new FormData()
+
+ for (let i = 0; i < this.fileList2.length; i++) {
+
+ formData.append('file', this.fileList2[i].raw)
+
+ }
+
+ formData.append('orderRef1', this.sopCurrentRow.site)
+
+ formData.append('orderRef2', this.sopCurrentRow.familyId)
+
+ formData.append('orderRef3', '')
+
+ formData.append('createdBy', this.$store.state.user.name)
+
+ formData.append('CAdditionalInfo', this.ossForm.remark || '')
+
+ formData.append('orderReftype', 'PartFamilySop')
+
+ this.uploadLoading = true
+
+ ossUploadNoSaveOSSForYJY(formData).then(({ data }) => {
+
+ if (data && data.code === 0) {
+
+ this.$message.success('上传成功')
+
+ this.ossVisible = false
+
+ this.fileList2 = []
+
+ this.ossForm.remark = ''
+
+ this.fetchSopFileList()
+
+ } else {
+
+ this.$message.warning((data && data.msg) || '上传失败')
+
+ }
+
+ }).catch(() => {
+
+ this.$message.error('上传失败')
+
+ }).finally(() => {
+
+ this.uploadLoading = false
+
+ })
+
+ },
+ previewSopFile (row) {
+
+ previewOssFileById({ id: row.id }).then((response) => {
+
+ const contentType = (response.headers && response.headers['content-type']) || 'application/octet-stream'
+
+ const blob = new Blob([response.data], { type: contentType })
+
+ const link = document.createElement('a')
+
+ link.href = URL.createObjectURL(blob)
+
+ link.setAttribute('download', row.fileName)
+
+ link.target = '_blank'
+
+ link.click()
+
+ URL.revokeObjectURL(link.href)
+
+ })
+
+ },
+ removeSopFile (row) {
+
+ this.$confirm('确定要删除该文件吗?', '提示', {
+
+ confirmButtonText: '确定',
+
+ cancelButtonText: '取消',
+
+ type: 'warning'
+
+ }).then(() => {
+
+ removeOss([row.id]).then(({ data }) => {
+
+ if (data && data.code === 0) {
+
+ this.$message.success('删除成功')
+
+ this.fetchSopFileList()
+
+ } else {
+
+ this.$message.warning((data && data.msg) || '删除失败')
+
+ }
+
+ })
+
+ }).catch(() => {})
+
+ },
getButtonAuthData () {
let searchFlag = this.isAuth(this.menuId + ':search')
@@ -1208,6 +1561,14 @@ export default {
}
+.rq .auto /deep/ .el-form-item__content {
+
+ height: auto;
+
+ line-height: 1.5;
+
+}
+