|
@@ -123,7 +123,7 @@
|
|
|
</el-button>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
<el-dropdown-item
|
|
|
- icon="el-icon-edit"
|
|
|
+ icon="el-icon-zoom-in"
|
|
|
command="catOperationInstruction"
|
|
|
>查看作业指导书</el-dropdown-item
|
|
|
>
|
|
@@ -159,9 +159,23 @@
|
|
|
<el-form-item label="作业名称" prop="jobName">
|
|
|
<el-input v-model="form.jobName" placeholder="请输入作业名称" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="组件名称" prop="componentPath">
|
|
|
- <el-input v-model="form.componentPath" placeholder="请输入组件名称" />
|
|
|
+ <el-form-item label="作业指导书" prop="imageSrc">
|
|
|
+ <!-- :before-upload="beforeUpload" -->
|
|
|
+ <el-upload
|
|
|
+ :action="uploadImgUrl"
|
|
|
+ class="avatar-uploader"
|
|
|
+ :before-upload="beforeUpload"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleUploadSuccess"
|
|
|
+ :headers="headers"
|
|
|
+ >
|
|
|
+ <img v-if="form.imageSrc" :src="form.imageSrc" class="avatar" />
|
|
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ </el-upload>
|
|
|
</el-form-item>
|
|
|
+ <!-- <el-form-item label="组件名称" prop="componentPath">
|
|
|
+ <el-input v-model="form.componentPath" placeholder="请输入组件名称" />
|
|
|
+ </el-form-item> -->
|
|
|
<!-- <el-form-item label="路由地址" prop="routingAddress">-->
|
|
|
<!-- <el-input v-model="form.routingAddress" placeholder="请输入路由地址" />-->
|
|
|
<!-- </el-form-item>-->
|
|
@@ -194,6 +208,29 @@
|
|
|
>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <!-- 图片式预览 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="previewTitle"
|
|
|
+ :visible.sync="previewShow"
|
|
|
+ width="1500px"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <!-- 动态加载组件 -->
|
|
|
+ <!-- <component :is="catOperationInstructionCurrentComponent"></component> -->
|
|
|
+ <div class="previewWrap">
|
|
|
+ <img class="preImg" :src="previewUrl" :alt="previewTitle" />
|
|
|
+ </div>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="catOperationInstructionBoolean = false"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
+ <el-button @click="catOperationInstructionBoolean = false"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -217,15 +254,26 @@ import {
|
|
|
addInstruction,
|
|
|
updateInstruction,
|
|
|
} from "@/api/amichi/operationInstruction/instruction";
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
|
|
|
export default {
|
|
|
name: "MaterialInfo",
|
|
|
dicts: ["wlsx"],
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 图片上传 相关 start
|
|
|
+ baseUrl: process.env.VUE_APP_BASE_API,
|
|
|
+ uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
|
|
+ headers: {
|
|
|
+ Authorization: "Bearer " + getToken(),
|
|
|
+ },
|
|
|
+ // 图片上传 相关 end
|
|
|
catOperationInstructionTitle: "",
|
|
|
catOperationInstructionCurrentComponent: "", // 默认显示ComponentA
|
|
|
catOperationInstructionBoolean: false,
|
|
|
+ previewShow: false,
|
|
|
+ previewUrl: "",
|
|
|
+ previewTitle: "",
|
|
|
tableData: [
|
|
|
{
|
|
|
id: "1",
|
|
@@ -322,6 +370,23 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 上传成功回调
|
|
|
+ handleUploadSuccess(res, file) {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.form.imageSrc = res.url;
|
|
|
+ } else {
|
|
|
+ this.$message.error("网络异常,请稍后上传");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeUpload(file) {
|
|
|
+ if (file.type.indexOf("image/") == -1) {
|
|
|
+ this.$modal.msgError(
|
|
|
+ "文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。"
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 覆盖默认的上传行为
|
|
|
+ requestUpload() {},
|
|
|
handleClick(row) {
|
|
|
console.log(row);
|
|
|
this.catOperationInstructionTitle = row.instructionName;
|
|
@@ -330,6 +395,12 @@ export default {
|
|
|
// path: row.path
|
|
|
// })
|
|
|
},
|
|
|
+ previewHandler(row) {
|
|
|
+ console.log(row);
|
|
|
+ this.previewUrl = row.imageSrc;
|
|
|
+ this.previewTitle = row.instructionName;
|
|
|
+ this.previewShow = true;
|
|
|
+ },
|
|
|
//下拉菜单点击事件
|
|
|
handleCommand(command, row) {
|
|
|
switch (command) {
|
|
@@ -340,8 +411,9 @@ export default {
|
|
|
this.handleDelete(row);
|
|
|
break;
|
|
|
case "catOperationInstruction":
|
|
|
- this.catOperationInstructionBoolean = true;
|
|
|
- this.handleClick(row);
|
|
|
+ // this.catOperationInstructionBoolean = true;
|
|
|
+ // this.handleClick(row);
|
|
|
+ this.previewHandler(row);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -373,6 +445,7 @@ export default {
|
|
|
jobName: null,
|
|
|
componentPath: null,
|
|
|
routingAddress: null,
|
|
|
+ imageSrc: null,
|
|
|
remark: null,
|
|
|
createById: null,
|
|
|
createBy: null,
|
|
@@ -469,3 +542,36 @@ export default {
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.previewWrap {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ .preImg {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.avatar-uploader .el-upload {
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+.avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409eff;
|
|
|
+}
|
|
|
+.avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ line-height: 178px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.avatar {
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ display: block;
|
|
|
+}
|
|
|
+</style>
|