From 86a84c327007a1fb398fa2aefff1bffc03a83cfb Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期二, 06 八月 2024 22:36:02 +0800
Subject: [PATCH] 委托下单,禁止下拉框输入
---
src/components/view/a5-capacity-scope.vue | 93 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 89 insertions(+), 4 deletions(-)
diff --git a/src/components/view/a5-capacity-scope.vue b/src/components/view/a5-capacity-scope.vue
index 55e1e40..074fd34 100644
--- a/src/components/view/a5-capacity-scope.vue
+++ b/src/components/view/a5-capacity-scope.vue
@@ -38,6 +38,14 @@
height: calc(100% - 60px - 80px - 10px - 40px);
padding: 20px;
}
+
+ >>> .el-upload {
+ width: 100% !important;
+ }
+
+ >>> .el-upload-dragger {
+ width: 100% !important;
+ }
</style>
<template>
@@ -56,8 +64,9 @@
<el-button size="medium" @click="$refs.itemParameterTable.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" v-if="radio == 1 && importExcel" @click="uploadDia = true">瀵煎叆</el-button>
<el-button size="medium" type="primary" @click="openAdd" v-if="addPower">鏂板</el-button>
- <el-button size="medium" icon="el-icon-delete">鍒犻櫎</el-button>
+ <el-button size="medium" icon="el-icon-delete">鍒犻櫎</el-button>
</el-col>
</el-row>
</div>
@@ -86,9 +95,12 @@
</div>
</div>
<div class="table">
- <ValueTable ref="itemParameterTable" :url="$api.capacityScope.selectItemParameterList"
+ <ValueTable ref="itemParameterTable" :url="$api.capacityScope.selectItemParameterList" v-if="PROJECT === '妫�娴嬩腑蹇�'"
:upUrl="$api.capacityScope.upItemParameter" :delUrl="$api.capacityScope.delItemParameter"
:inputUrl="$api.capacityScope.importData" :componentData="itemParameterData" :key="upIndex" />
+ <ValueTable ref="itemParameterTable" :url="$api.capacityScope.selectItemParameterList" v-if="PROJECT === '瑁呭鐢电紗'"
+ :upUrl="$api.capacityScope.upItemParameter" :delUrl="$api.capacityScope.delItemParameter"
+ :inputUrl="$api.capacityScope.importEquipData" :componentData="itemParameterData" :key="upIndex" />
</div>
</div>
<div class="bodys">
@@ -118,6 +130,20 @@
<span slot="footer" class="dialog-footer">
<el-button @click="diaProduct = false">鍙� 娑�</el-button>
<el-button type="primary" @click="openAdd2" :loading="productLoad">鏂� 澧�</el-button>
+ </span>
+ </el-dialog>
+ <el-dialog title="鏁版嵁瀵煎叆" :visible.sync="uploadDia" width="500px">
+ <div style="margin: 0 auto;">
+ <el-upload ref="upload" drag :action="javaApi + $api.capacityScope.importExcel" :headers="token" :file-list="fileList" name="file"
+ :auto-upload="false" accept=".xlsx" :limit="1" :on-change="beforeUpload" :on-success="onSuccess"
+ :on-error="onError">
+ <i class="el-icon-upload"></i>
+ <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+ </el-upload>
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="uploadDia = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitUpload()" :loading="uploading">涓� 浼�</el-button>
</span>
</el-dialog>
</div>
@@ -239,7 +265,8 @@
'unit', 'method', 'manDay', 'templateId'
],
accept: '.xlsx',
- inputType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+ inputType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ needSort: ['createTime', 'updateTime', 'inspectionItem', 'inspectionItemSubclass', 'sample'],
},
testObjectData: {
entity: {
@@ -279,7 +306,8 @@
}
},
requiredAdd: ['specimenName', 'code', 'laboratoryId'],
- requiredUp: ['specimenName', 'code', 'laboratoryId']
+ requiredUp: ['specimenName', 'code', 'laboratoryId'],
+ needSort: ['createTime', 'updateTime', 'specimenName'],
},
itemParameterEntityCopy: {},
testObjectDataEntityCopy: {},
@@ -320,9 +348,28 @@
requiredUp: ['name','nameEn'],
},
inPower: true,
+ importExcel: false,
+ uploadDia: false,
+ fileList: [],
+ token: null,
+ uploading: false,
+ }
+ },
+ created() {
+ if (this.PROJECT === '瑁呭鐢电紗') {
+ this.itemParameterData.requiredUp = ['sonLaboratory', 'inspectionItem', 'inspectionItemType', 'inspectionValueType',
+ 'unit', 'manDay', 'templateId'
+ ]
+ } else {
+ this.itemParameterData.requiredUp = ['sonLaboratory', 'inspectionItem', 'inspectionItemType', 'inspectionValueType',
+ 'unit', 'method', 'manDay', 'templateId'
+ ]
}
},
mounted() {
+ this.token = {
+ 'token': sessionStorage.getItem('token')
+ },
this.itemParameterEntityCopy = this.HaveJson(this.itemParameterData.entity)
this.testObjectDataEntityCopy = this.HaveJson(this.testObjectData.entity)
this.selectEnumByCategory()
@@ -339,6 +386,39 @@
this.getPower('0')
},
methods: {
+ submitUpload() {
+ if (this.$refs.upload.uploadFiles.length == 0) {
+ this.$message.error('鏈�夋嫨鏂囦欢')
+ return
+ }
+ this.uploading = true
+ this.$refs.upload.submit();
+ },
+ onSuccess(response, file, fileList) {
+ this.$refs.upload.clearFiles()
+ this.uploadDia = false
+ this.uploading = false
+ if (response.code == 201) {
+ this.$message.error(response.message)
+ return
+ }
+ this.$message.success('涓婁紶鎴愬姛')
+ this.standardList = []
+ this.productList = []
+ this.refreshTable()
+ },
+ onError(err, file, fileList) {
+ this.$message.error('涓婁紶澶辫触')
+ this.$refs.upload.clearFiles()
+ this.uploading = false
+ },
+ beforeUpload(file, fileList) {
+ if (file.raw.type != 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
+ this.$message.error('涓婁紶鏂囦欢鏍煎紡涓嶆纭�');
+ this.$refs.upload.clearFiles()
+ return false;
+ }
+ },
selectorSwitch(radio) {
if (this.radio === '0') {
this.showItemParameter = true;
@@ -514,6 +594,7 @@
let product = false
let select = 0
let inPower=false
+ let importExcel = false
for (var i = 0; i < power.length; i++) {
if (power[i].menuMethod == 'selectItemParameterList') {
select += 1
@@ -547,6 +628,9 @@
if (power[i].menuMethod == 'selectProductListByObjectId') {
product = true
}
+ if (power[i].menuMethod == 'importExcel') {
+ importExcel = true
+ }
}
}
if (radio === '0') {
@@ -570,6 +654,7 @@
this.addPower = add
this.inPower=inPower
this.select = select
+ this.importExcel = importExcel
if (select == 1 || select == 3) this.radio = radio
else if (select == 2) this.radio = '1'
else this.radio = '-1'
--
Gitblit v1.9.3