Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
@@ -49,6 +49,12 @@ import { listByIds, delOss } from "@/api/system/oss";
|
||||
export default {
|
||||
props: {
|
||||
value: [String, Object, Array],
|
||||
// 值模式: 'ossId' - v-model绑定ossId字符串(默认), 'url' - v-model绑定url字符串
|
||||
valueMode: {
|
||||
type: String,
|
||||
default: 'ossId',
|
||||
validator: (val) => ['ossId', 'url'].includes(val)
|
||||
},
|
||||
// 图片数量限制
|
||||
limit: {
|
||||
type: Number,
|
||||
@@ -89,19 +95,26 @@ export default {
|
||||
value: {
|
||||
async handler(val) {
|
||||
if (val) {
|
||||
// 首先将值转为数组
|
||||
let list;
|
||||
if (Array.isArray(val)) {
|
||||
list = val;
|
||||
} else {
|
||||
await listByIds(val).then(res => {
|
||||
list = res.data;
|
||||
})
|
||||
if (this.valueMode === 'url') {
|
||||
list = val.split(',').filter(url => url).map(url => {
|
||||
return { name: url.slice(url.lastIndexOf('/') + 1), url: url };
|
||||
});
|
||||
} else {
|
||||
await listByIds(val).then(res => {
|
||||
list = res.data;
|
||||
})
|
||||
}
|
||||
}
|
||||
// 然后将数组转为对象数组
|
||||
this.fileList = list.map(item => {
|
||||
// 此处name使用ossId 防止删除出现重名
|
||||
item = { name: item.ossId, url: item.url, ossId: item.ossId };
|
||||
if (this.valueMode === 'url') {
|
||||
item = { name: item.url.slice(item.url.lastIndexOf('/') + 1), url: item.url };
|
||||
} else {
|
||||
item = { name: item.ossId, url: item.url, ossId: item.ossId };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
} else {
|
||||
@@ -172,8 +185,10 @@ export default {
|
||||
handleDelete(file) {
|
||||
const findex = this.fileList.map(f => f.name).indexOf(file.name);
|
||||
if(findex > -1) {
|
||||
let ossId = this.fileList[findex].ossId;
|
||||
delOss(ossId);
|
||||
if (this.valueMode === 'ossId') {
|
||||
let ossId = this.fileList[findex].ossId;
|
||||
delOss(ossId);
|
||||
}
|
||||
this.fileList.splice(findex, 1);
|
||||
this.$emit("input", this.listToString(this.fileList));
|
||||
}
|
||||
@@ -203,8 +218,12 @@ export default {
|
||||
let strs = "";
|
||||
separator = separator || ",";
|
||||
for (let i in list) {
|
||||
if (list[i].ossId) {
|
||||
strs += list[i].ossId + separator;
|
||||
if (this.valueMode === 'url') {
|
||||
strs += list[i].url + separator;
|
||||
} else {
|
||||
if (list[i].ossId) {
|
||||
strs += list[i].ossId + separator;
|
||||
}
|
||||
}
|
||||
}
|
||||
return strs != "" ? strs.substr(0, strs.length - 1) : "";
|
||||
|
||||
@@ -112,6 +112,13 @@
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="附件" align="center" prop="attachmentFiles" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="handleAttachment(scope.row)">
|
||||
{{ getAttachmentCount(scope.row) }}个
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="!readonly" size="mini" type="text" icon="el-icon-edit"
|
||||
@@ -366,6 +373,14 @@
|
||||
</el-dialog>
|
||||
|
||||
<SchemeSelect :visible.sync="schemeVisible" @confirm="handleSchemeConfirm" />
|
||||
|
||||
<el-dialog :title="attachmentTitle" :visible.sync="attachmentOpen" width="500px" append-to-body>
|
||||
<file-upload v-model="attachmentFiles" :limit="10" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="attachmentLoading" type="primary" @click="submitAttachment">确 定</el-button>
|
||||
<el-button @click="attachmentOpen = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -376,6 +391,7 @@ import { listInspectionItemTemplate } from "@/api/mes/qc/inspectionItemTemplate"
|
||||
import { SchemeSelect } from "@/components/KLPService";
|
||||
import CoilSelector from "@/components/CoilSelector/index.vue";
|
||||
import CurrentCoilNo from "@/components/KLPService/Renderer/CurrentCoilNo.vue";
|
||||
import FileUpload from "@/components/FileUpload";
|
||||
import { listCoilByIds, listMaterialCoil } from "@/api/wms/coil";
|
||||
|
||||
export default {
|
||||
@@ -389,7 +405,8 @@ export default {
|
||||
components: {
|
||||
SchemeSelect,
|
||||
CoilSelector,
|
||||
CurrentCoilNo
|
||||
CurrentCoilNo,
|
||||
FileUpload
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -471,6 +488,11 @@ export default {
|
||||
enterCoilNoLoading: false,
|
||||
selectedEnterCoilNos: [],
|
||||
tempEnterCoilNo: '',
|
||||
attachmentOpen: false,
|
||||
attachmentTitle: '',
|
||||
attachmentLoading: false,
|
||||
attachmentTaskRow: null,
|
||||
attachmentFiles: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -869,6 +891,29 @@ export default {
|
||||
};
|
||||
this.resetForm("itemForm");
|
||||
},
|
||||
getAttachmentCount(row) {
|
||||
if (!row.attachmentFiles) return 0;
|
||||
return row.attachmentFiles.split(',').filter(f => f).length;
|
||||
},
|
||||
handleAttachment(row) {
|
||||
this.attachmentTaskRow = row;
|
||||
this.attachmentTitle = `附件管理 - ${row.taskCode}`;
|
||||
this.attachmentFiles = row.attachmentFiles || '';
|
||||
this.attachmentOpen = true;
|
||||
},
|
||||
submitAttachment() {
|
||||
this.attachmentLoading = true;
|
||||
updateInspectionTask({
|
||||
taskId: this.attachmentTaskRow.taskId,
|
||||
attachmentFiles: this.attachmentFiles
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess('附件保存成功');
|
||||
this.attachmentTaskRow.attachmentFiles = this.attachmentFiles;
|
||||
this.attachmentOpen = false;
|
||||
}).finally(() => {
|
||||
this.attachmentLoading = false;
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -52,17 +52,22 @@
|
||||
<!-- 0表示否,1表示是 -->
|
||||
<el-checkbox v-model="formData.mainMark" :true-label="1" :false-label="0">是否为主缺陷</el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item label="缺陷图片" v-if="formData.mainMark === 1">
|
||||
<image-upload v-model="formData.attachmentFiles" value-mode="url" :limit="3" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CoilSelector from '@/components/CoilSelector'
|
||||
import ImageUpload from '@/components/ImageUpload'
|
||||
|
||||
export default {
|
||||
name: "AbnormalForm",
|
||||
components: {
|
||||
CoilSelector
|
||||
CoilSelector,
|
||||
ImageUpload
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
@@ -141,7 +146,8 @@ export default {
|
||||
productionLine: undefined,
|
||||
defectCode: undefined,
|
||||
degree: undefined,
|
||||
remark: undefined
|
||||
remark: undefined,
|
||||
attachmentFiles: undefined
|
||||
};
|
||||
},
|
||||
/** 计算缺陷长度 */
|
||||
|
||||
@@ -23,12 +23,26 @@
|
||||
<dict-tag :options="dict.type.coil_abnormal_code" :value="scope.row.defectCode" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否为主缺陷" prop="mainMark">
|
||||
<el-table-column label="主缺陷" prop="mainMark">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.mainMark" type="success">是</el-tag>
|
||||
<el-tag v-else type="danger">否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="缺陷图片" align="center" prop="attachmentFiles" width="120">
|
||||
<template slot-scope="scope">
|
||||
<template v-if="scope.row.attachmentFiles">
|
||||
<div v-for="(url, idx) in scope.row.attachmentFiles.split(',')" :key="idx" style="margin-right: 4px;">
|
||||
<el-image
|
||||
style="width: 30px; height: 30px; vertical-align: middle; border-radius: 2px;"
|
||||
:src="url"
|
||||
:preview-src-list="scope.row.attachmentFiles.split(',')"
|
||||
fit="cover"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="程度" align="center" prop="degree">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.coil_abnormal_degree" :value="scope.row.degree" />
|
||||
|
||||
@@ -87,6 +87,11 @@
|
||||
<el-checkbox v-model="scope.row.mainMark" :true-label="1" :false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="缺陷图片" prop="attachmentFiles" width="180">
|
||||
<template slot-scope="scope">
|
||||
<image-upload v-if="scope.row.mainMark === 1" v-model="scope.row.attachmentFiles" value-mode="url" :limit="3" :is-show-tip="false" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.abnormalId" type="text" size="mini" @click="handleDelete(scope.row)" style="color: #f56c6c;">
|
||||
@@ -106,11 +111,13 @@
|
||||
import { addCoilAbnormal, listCoilAbnormal, delCoilAbnormal, updateCoilAbnormal } from '@/api/wms/coilAbnormal'
|
||||
import { getMaterialCoil } from '@/api/wms/coil'
|
||||
import AbnormalForm from './AbnormalForm'
|
||||
import ImageUpload from '@/components/ImageUpload'
|
||||
|
||||
export default {
|
||||
name: 'ExceptionManager',
|
||||
components: {
|
||||
AbnormalForm
|
||||
AbnormalForm,
|
||||
ImageUpload
|
||||
},
|
||||
dicts: ['coil_abnormal_code', 'coil_abnormal_degree', 'coil_abnormal_position', 'sys_lines'],
|
||||
props: {
|
||||
@@ -223,7 +230,8 @@ export default {
|
||||
productionLine: null,
|
||||
defectCode: null,
|
||||
degree: null,
|
||||
remark: null
|
||||
remark: null,
|
||||
attachmentFiles: null
|
||||
})
|
||||
}
|
||||
return emptyRows
|
||||
@@ -390,6 +398,7 @@ export default {
|
||||
row.mainMark = 0
|
||||
row.defectCode = null
|
||||
row.degree = null
|
||||
row.attachmentFiles = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user