|
|
|
|
@ -823,18 +823,34 @@
|
|
|
|
|
<el-dialog title="产品说明书配置" :visible.sync="instrumentInstructions.visible" width="50%">
|
|
|
|
|
<el-button size="mini" type="primary" icon="el-icon-add" @click="addInstrumentInstructionLine()">添加说明书
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-table :show-header="false" v-loading="loading" :data="instrumentInstructions.instructionList">
|
|
|
|
|
<el-table-column align="center" prop="name" width="200">
|
|
|
|
|
<el-table v-loading="loading" :data="instrumentInstructions.instructionList">
|
|
|
|
|
<el-table-column align="center" prop="name" width="200" label="说明书类型">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input placeholder="请输入说明书名称" v-model="scope.row.name" clearable/>
|
|
|
|
|
<el-input placeholder="请输入说明书类型" v-model="scope.row.name" clearable/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column align="center" prop="link" width="300">
|
|
|
|
|
<el-table-column align="center" prop="link" width="300" label="说明书">
|
|
|
|
|
<!-- scope.row.link -->
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.link" clearable/>
|
|
|
|
|
<el-upload
|
|
|
|
|
class="upload-demo"
|
|
|
|
|
:action="uploadUrl"
|
|
|
|
|
:headers="headers"
|
|
|
|
|
:limit="1"
|
|
|
|
|
:on-exceed="instructionUploadExceed"
|
|
|
|
|
:on-success="(response, file, fileList) => {
|
|
|
|
|
return instructionUploadSuccess(response, file, fileList, scope.$index);
|
|
|
|
|
}"
|
|
|
|
|
:on-error="uploadError"
|
|
|
|
|
:file-list="scope.row.fileList"
|
|
|
|
|
accept=".pdf,.PDF"
|
|
|
|
|
>
|
|
|
|
|
<el-button size="small" type="primary">点击上传</el-button>
|
|
|
|
|
<div slot="tip" class="el-upload__tip">只能上传一个文件</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column>
|
|
|
|
|
<el-table-column label="操作">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-save" @click="saveInstrumentInstruction(scope.row)">保存
|
|
|
|
|
</el-button>
|
|
|
|
|
@ -1061,7 +1077,14 @@ export default {
|
|
|
|
|
instrumentInstructions: {
|
|
|
|
|
visible: false,
|
|
|
|
|
instrumentId: null,
|
|
|
|
|
instructionList: []
|
|
|
|
|
instructionList: [{
|
|
|
|
|
id: null,
|
|
|
|
|
fileList: [],
|
|
|
|
|
instrumentId: null,
|
|
|
|
|
name: null,
|
|
|
|
|
link: null,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -1667,6 +1690,7 @@ export default {
|
|
|
|
|
addInstrumentInstructionLine() {
|
|
|
|
|
this.instrumentInstructions.instructionList.push({
|
|
|
|
|
id: null,
|
|
|
|
|
fileList: [],
|
|
|
|
|
instrumentId: this.instrumentInstructions.instrumentId,
|
|
|
|
|
name: null,
|
|
|
|
|
link: null,
|
|
|
|
|
@ -1680,9 +1704,17 @@ export default {
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
if (response.data != null && response.data.length > 0) {
|
|
|
|
|
this.instrumentInstructions.instructionList = response.data;
|
|
|
|
|
for (let i = 0; i < response.data.length; i++) {
|
|
|
|
|
let name = response.data.url;
|
|
|
|
|
this.instrumentInstructions.instructionList[i].fileList = [{
|
|
|
|
|
name: name,
|
|
|
|
|
url: response.data.url,
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.instrumentInstructions.instructionList = [{
|
|
|
|
|
id: null,
|
|
|
|
|
fileList: [],
|
|
|
|
|
instrumentId: this.instrumentInstructions.instrumentId,
|
|
|
|
|
name: null,
|
|
|
|
|
link: null,
|
|
|
|
|
@ -1705,7 +1737,18 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
saveInstrumentInstruction(item) {
|
|
|
|
|
console.log(item)
|
|
|
|
|
if (item.instrumentId == null) {
|
|
|
|
|
this.$modal.msgError('参数异常');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (item.name == null) {
|
|
|
|
|
this.$modal.msgError('请输入说明书名称');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (item.link == null) {
|
|
|
|
|
this.$modal.msgError('请上传说明书');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (item.id != null) {
|
|
|
|
|
updateInstructions(item).then((response) => {
|
|
|
|
|
this.$modal.msgSuccess('修改成功');
|
|
|
|
|
@ -1716,7 +1759,16 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
instructionUploadExceed(files, fileList) {
|
|
|
|
|
this.$message.warning(`您已上传了文件,如需更换,请先删除原上传的文件`)
|
|
|
|
|
},
|
|
|
|
|
instructionUploadSuccess(response, file, fileList, index) {
|
|
|
|
|
if (response.code == 200) {
|
|
|
|
|
this.instrumentInstructions.instructionList[index].link = response.data.url;
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error('图片插入失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|