| | |
| | | addStandardMethod: "/standardMethod/addStandardMethod", //添加标准方法 |
| | | upStandardMethod: "/standardMethod/upStandardMethod", //修改标准方法 |
| | | delStandardMethod: "/standardMethod/delStandardMethod", //删除标准方法 |
| | | importStandardDetails: "/standardMethod/importStandardDetails", // 导入标准明细 |
| | | } |
| | | |
| | | const StandardTemplate = { |
| | |
| | | <el-dialog title="数据导入" :visible.sync="uploadDia" width="500px"> |
| | | <div style="margin: 0 auto;"> |
| | | <el-upload ref="upload" drag :action="javaApi + inputUrl" :headers="token" :file-list="fileList" name="file" |
| | | :auto-upload="false" accept=".csv" :limit="1" :on-change="beforeUpload" :on-success="onSuccess" |
| | | :auto-upload="false" :accept="data.accept===undefined?'.csv':data.accept" :limit="1" :on-change="beforeUpload" :on-success="onSuccess" |
| | | :on-error="onError" :data="{param: data.uploadStr}"> |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | |
| | | this.uploadDia = true |
| | | }, |
| | | beforeUpload(file, fileList) { |
| | | if (file.raw.type != 'text/csv') { |
| | | console.log(file.raw.type); |
| | | if (file.raw.type != (this.data.inputType===undefined?'text/csv':this.data.inputType)) { |
| | | this.$message.error('上传文件格式不正确'); |
| | | this.$refs.upload.clearFiles() |
| | | return false; |
| | |
| | | <el-row class="title"> |
| | | <el-col :span="12" style="padding-left: 20px;">标准方法</el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-button size="medium" @click="$refs.ValueTable.openUpload()" v-if="inPower"> |
| | | <i class="el-icon-upload2" style="color: #3A7BFA;"></i> |
| | | <span style="color: #3A7BFA;">导入</span></el-button> |
| | | <el-button size="medium" type="primary" @click="openAdd" v-if="addPower">新增</el-button> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <div class="table"> |
| | | <ValueTable ref="ValueTable" :url="$api.standardMethod.selectStandardMethodList" |
| | | :delUrl="$api.standardMethod.delStandardMethod" :upUrl="$api.standardMethod.upStandardMethod" |
| | | :componentData="componentData" :key="upIndex" /> |
| | | :componentData="componentData" :key="upIndex" :inputUrl="$api.standardMethod.importStandardDetails"/> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | }, |
| | | }, |
| | | requiredAdd: ['code', 'name', 'isProduct', 'isUse', 'nameEn'], |
| | | requiredUp: ['code', 'name', 'isProduct', 'isUse', 'nameEn'] |
| | | requiredUp: ['code', 'name', 'isProduct', 'isUse', 'nameEn'], |
| | | accept: '.xlsx', |
| | | inputType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
| | | }, |
| | | entityCopy: {}, |
| | | upIndex: 0, |
| | | addDia: false, |
| | | addPower: true |
| | | addPower: true, |
| | | inPower: true, |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | let up = false |
| | | let del = false |
| | | let add = false |
| | | let inPower = false |
| | | for (var i = 0; i < power.length; i++) { |
| | | if (power[i].menuMethod == 'addStandardMethod') { |
| | | add = true |
| | |
| | | if (power[i].menuMethod == 'upStandardMethod') { |
| | | up = true |
| | | } |
| | | if (power[i].menuMethod == 'importStandardDetails') { |
| | | inPower = true |
| | | } |
| | | } |
| | | if (!del) { |
| | | this.componentData.do.splice(1, 1) |
| | |
| | | this.componentData.do.splice(0, 1) |
| | | } |
| | | this.addPower = add |
| | | this.inPower = inPower |
| | | }, |
| | | openAdd() { |
| | | this.$refs.ValueTable.openAddDia(this.$api.standardMethod.addStandardMethod); |