From 7dba00a80cee072bc9e193d5d2a75c1f7cf72d28 Mon Sep 17 00:00:00 2001
From: gaoluyang <gaoluyang@rengu.cc>
Date: 星期四, 04 七月 2024 10:51:41 +0800
Subject: [PATCH] 表格输入框转换为科学计数法

---
 src/components/view/a5-capacity-scope.vue |  960 ++++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 641 insertions(+), 319 deletions(-)

diff --git a/src/components/view/a5-capacity-scope.vue b/src/components/view/a5-capacity-scope.vue
index 1c4aa14..34de083 100644
--- a/src/components/view/a5-capacity-scope.vue
+++ b/src/components/view/a5-capacity-scope.vue
@@ -1,333 +1,655 @@
 <style scoped>
-	.title {
-		height: 60px;
-		line-height: 60px;
-	}
+  .title {
+    height: 60px;
+    line-height: 60px;
+  }
 
-	.bodys {
-		height: 100%;
-	}
+  .bodys {
+    height: 100%;
+  }
 
-	.search {
-		background-color: #fff;
-		height: 80px;
-		display: flex;
-		align-items: center;
-	}
+  .search {
+    background-color: #fff;
+    height: 80px;
+    display: flex;
+    align-items: center;
+  }
 
-	.search_thing {
-		width: 350px;
-		display: flex;
-		align-items: center;
-	}
+  .search_thing {
+    width: 350px;
+    display: flex;
+    align-items: center;
+  }
 
-	.search_label {
-		width: 110px;
-		font-size: 14px;
-		text-align: right;
-	}
+  .search_label {
+    width: 110px;
+    font-size: 14px;
+    text-align: right;
+  }
 
-	.search_input {
-		width: calc(100% - 110px);
-	}
+  .search_input {
+    width: calc(100% - 110px);
+  }
 
-	.table {
-		margin-top: 10px;
-		background-color: #fff;
-		width: calc(100% - 40px);
-		height: calc(100% - 60px - 80px - 10px - 40px);
-		padding: 20px;
-	}
+  .table {
+    margin-top: 10px;
+    background-color: #fff;
+    width: calc(100% - 40px);
+    height: calc(100% - 60px - 80px - 10px - 40px);
+    padding: 20px;
+  }
+
+  >>> .el-upload {
+    width: 100% !important;
+  }
+
+  >>> .el-upload-dragger {
+    width: 100% !important;
+  }
 </style>
 
 <template>
-	<div class="capacity-scope">
-		<div>
-			<el-row class="title">
-				<el-col :span="12">
-					<el-radio-group v-model="radio" @input="selectorSwitch" size="medium" fill="#3A7BFA" v-if="select==3">
-						<el-radio-button label="0">妫�楠岄」鐩弬鏁�</el-radio-button>
-						<el-radio-button label="1">妫�楠屽璞�</el-radio-button>
-					</el-radio-group>
-					<el-button size="medium" type="primary" v-else-if="select==1">妫�楠岄」鐩弬鏁�</el-button>
-					<el-button size="medium" type="primary" v-else-if="select==2">妫�楠屽璞�</el-button>
-				</el-col>
-				<el-col :span="12" style="text-align: right;">
-					<el-button size="medium" type="primary" @click="openAdd" v-if="addPower">鏂板</el-button>
-					<el-button size="medium" icon="el-icon-delete">鍒犻櫎</el-button>
-				</el-col>
-			</el-row>
-		</div>
-		<div v-if="radio==0" class="bodys">
-			<div class="search">
-				<div class="search_thing">
-					<div class="search_label">妫�楠岄」锛�</div>
-					<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
-							v-model="itemParameterData.entity.inspectionItem" @keyup.enter.native="refreshTable()"></el-input></div>
-				</div>
-				<div class="search_thing">
-					<div class="search_label">瀹為獙瀹わ細</div>
-					<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
-							v-model="itemParameterData.entity.laboratory" @keyup.enter.native="refreshTable()"></el-input></div>
-				</div>
-				<div class="search_thing">
-					<div class="search_label">璁惧缁勶細</div>
-					<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
-							v-model="itemParameterData.entity.deviceGroup" @keyup.enter.native="refreshTable()"></el-input></div>
-				</div>
-				<div class="search_thing" style="padding-left: 30px;">
-					<el-button size="small" @click="refresh()">閲� 缃�</el-button>
-					<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
-				</div>
-			</div>
-			<div class="table">
-				<ValueTable ref="itemParameterTable" :url="$api.capacityScope.selectItemParameterList"
-					:upUrl="$api.capacityScope.upItemParameter" :delUrl="$api.capacityScope.delItemParameter"
-					:componentData="itemParameterData" :key="upIndex" />
-			</div>
-		</div>
-		<div class="bodys">
-			<div class="search" v-if="radio==1">
-				<div class="search_thing">
-					<div class="search_label">鏍峰搧鍚嶇О锛�</div>
-					<div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
-							v-model="testObjectData.entity.specimenName" @keyup.enter.native="refreshTable()"></el-input></div>
-				</div>
-				<div class="search_thing" style="padding-left: 30px;">
-					<el-button size="small" @click="refresh()">閲� 缃�</el-button>
-					<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
-				</div>
-			</div>
-			<div class="table" v-if="radio==1">
-				<ValueTable ref="testObjectTable" :url="$api.capacityScope.selectTestObjectList"
-					:upUrl="$api.capacityScope.upTestObject" :delUrl="$api.capacityScope.delTestObject"
-					:componentData="testObjectData" :key="upIndex" />
-			</div>
-		</div>
-	</div>
+  <div class="capacity-scope">
+    <div>
+      <el-row class="title">
+        <el-col :span="12" style="text-align: left">
+          <el-radio-group v-model="radio" @input="selectorSwitch" size="medium" fill="#3A7BFA" v-if="select==3">
+            <el-radio-button label="0">妫�楠岄」鐩弬鏁�</el-radio-button>
+            <el-radio-button label="1">妫�楠屽璞�</el-radio-button>
+          </el-radio-group>
+          <el-button size="medium" type="primary" v-else-if="select==1">妫�楠岄」鐩弬鏁�</el-button>
+          <el-button size="medium" type="primary" v-else-if="select==2">妫�楠屽璞�</el-button>
+        </el-col>
+        <el-col :span="12" style="text-align: right;">
+          <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-col>
+      </el-row>
+    </div>
+    <div v-if="radio==0" class="bodys">
+      <div class="search">
+        <div class="search_thing">
+          <div class="search_label">妫�楠岄」锛�</div>
+          <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
+              v-model="itemParameterData.entity.inspectionItem" @keyup.enter.native="refreshTable()"></el-input></div>
+        </div>
+        <div class="search_thing">
+          <div class="search_label">妫�楠屽瓙椤癸細</div>
+          <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
+              v-model="itemParameterData.entity.inspectionItemSubclass" @keyup.enter.native="refreshTable()"></el-input>
+          </div>
+        </div>
+        <div class="search_thing">
+          <div class="search_label">妫�楠屽璞★細</div>
+          <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
+              v-model="itemParameterData.entity.sample" @keyup.enter.native="refreshTable()"></el-input>
+          </div>
+        </div>
+        <div class="search_thing" style="padding-left: 30px;">
+          <el-button size="small" @click="refresh()">閲� 缃�</el-button>
+          <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
+        </div>
+      </div>
+      <div class="table">
+        <ValueTable ref="itemParameterTable" :url="$api.capacityScope.selectItemParameterList"
+          :upUrl="$api.capacityScope.upItemParameter" :delUrl="$api.capacityScope.delItemParameter"
+          :inputUrl="$api.capacityScope.importData" :componentData="itemParameterData" :key="upIndex" />
+      </div>
+    </div>
+    <div class="bodys">
+      <div class="search" v-if="radio==1">
+        <div class="search_thing">
+          <div class="search_label">妫�楠屽璞★細</div>
+          <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
+              v-model="testObjectData.entity.specimenName" @keyup.enter.native="refreshTable()"></el-input></div>
+        </div>
+        <div class="search_thing" style="padding-left: 30px;">
+          <el-button size="small" @click="refresh()">閲� 缃�</el-button>
+          <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
+        </div>
+      </div>
+      <div class="table" v-if="radio==1">
+        <ValueTable ref="testObjectTable" :url="$api.capacityScope.selectTestObjectList"
+          :upUrl="$api.capacityScope.upTestObject" :delUrl="$api.capacityScope.delTestObject"
+          :componentData="testObjectData" :key="upIndex" />
+      </div>
+    </div>
+    <el-dialog title="浜у搧缁存姢" :visible.sync="diaProduct" width="600px">
+      <div class="body" v-if="diaProduct" style="height: 350px;overflow-y: auto;padding: 5px 0;">
+        <ValueTable ref="productData" :url="$api.capacityScope.selectProductListByObjectId"
+          :upUrl="$api.capacityScope.upProduct" :delUrl="$api.capacityScope.delProduct"
+          :componentData="productData" :key="upIndex"/>
+      </div>
+      <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>
 </template>
 
 <script>
-	import ValueTable from '../tool/value-table.vue'
-	export default {
-		components: {
-			ValueTable
-		},
-		data() {
-			return {
-				radio: '-1',
-				showItemParameter: true,
-				showTestObject: false,
-				itemParameterData: {
-					entity: {
-						inspectionItem: null,
-						laboratory: null,
-						deviceGroup: null,
-						orderBy: {
-							field: 'id',
-							order: 'desc'
-						}
-					},
-					isIndex: false,
-					showSelect: true,
-					select: true,
-					row: 2,
-					do: [{
-						id: 'update',
-						font: '缂栬緫',
-						type: 'text',
-						method: 'doDiy',
-						field: []
-					}, {
-						id: 'delete',
-						font: '鍒犻櫎',
-						type: 'text',
-						method: 'doDiy'
-					}],
-					tagField: {
-						inspectionItemType: {
-							select: []
-						},
-						valueType: {
-							select: []
-						},
-						bsm:{
-							select: []
-						}
-					},
-					selectField: {
-						inspectionItemType: {
-							select: []
-						},
-						valueType: {
-							select: []
-						},
-						bsm:{
-							select: []
-						}
-					},
-					requiredAdd: ['inspectionItem', 'manHour', 'inspectionItemType','inspectionItemClassify','laboratory','unit','method','price','manDay','deviceGroup','checkoutNumber','valueType'],
-					requiredUp: ['inspectionItem', 'manHour', 'inspectionItemType','inspectionItemClassify','laboratory','unit','method','price','manDay','deviceGroup','checkoutNumber','valueType']
-				},
-				testObjectData: {
-					entity: {
-						specimenName: null,
-						orderBy: {
-							field: 'id',
-							order: 'desc'
-						}
-					},
-					isIndex: false,
-					showSelect: true,
-					select: true,
-					do: [{
-						id: 'update',
-						font: '缂栬緫',
-						type: 'text',
-						method: 'doDiy',
-						field: ['createUserName', 'updateUserName']
-					}, {
-						id: 'delete',
-						font: '鍒犻櫎',
-						type: 'text',
-						method: 'doDiy'
-					}],
-					tagField: {},
-					selectField: {},
-					requiredAdd: ['specimenName'],
-					requiredUp: ['specimenName']
-				},
-				itemParameterEntityCopy: {},
-				testObjectDataEntityCopy: {},
-				upIndex: 0,
-				addDia: false,
-				addPower: true,
-				select: 0
-			}
-		},
-		mounted() {
-			this.itemParameterEntityCopy = this.HaveJson(this.itemParameterData.entity)
-			this.testObjectDataEntityCopy = this.HaveJson(this.testObjectData.entity)
-			this.selectEnumByCategory()
-			this.selectEnumByCategoryForValue()
-			this.selectEnumByCategoryForSpecial()
-			this.getPower('0')
-		},
-		methods: {
-			selectorSwitch(radio) {
-				if (this.radio === '0') {
-					this.showItemParameter = true;
-					this.showTestObject = false;
-					/* this.$nextTick(() => {
-						this.$refs.itemParameterTable.selectList()
-					}) */
-				} else {
-					this.showTestObject = true;
-					this.showItemParameter = false;
-				}
-				this.getPower(radio)
-			},
-			refreshTable() {
-				if (this.radio === '0') {
-					this.$refs['itemParameterTable'].selectList()
-				} else {
-					this.$refs['testObjectTable'].selectList()
-				}
-			},
-			refresh() {
-				this.itemParameterData.entity = this.HaveJson(this.itemParameterEntityCopy)
-				this.testObjectData.entity = this.HaveJson(this.testObjectDataEntityCopy)
-				this.upIndex++
-			},
-			openAdd() {
-				if (this.radio === '0') {
-					this.$refs.itemParameterTable.openAddDia(this.$api.capacityScope.addItemParameter);
-				} else {
-					this.$refs.testObjectTable.openAddDia(this.$api.capacityScope.addTestObject);
-				}
-			},
-			selectEnumByCategory() {
-				this.$axios.post(this.$api.enums.selectEnumByCategory, {
-					category: "妫�楠岄」绫诲瀷"
-				}).then(res => {
-					this.itemParameterData.selectField.inspectionItemType.select = res.data
-					res.data[1].type = 'info'
-					this.itemParameterData.tagField.inspectionItemType.select = res.data
-				})
-			},
-			selectEnumByCategoryForValue() {
-				this.$axios.post(this.$api.enums.selectEnumByCategory, {
-					category: "鍙栧�肩被鍨�"
-				}).then(res => {
-					this.itemParameterData.selectField.valueType.select = res.data
-					this.itemParameterData.tagField.valueType.select = res.data
-				})
-			},
-			selectEnumByCategoryForSpecial() {
-				this.$axios.post(this.$api.enums.selectEnumByCategory, {
-					category: "鐗规畩鏍囪瘑"
-				}).then(res => {
-					this.itemParameterData.selectField.bsm.select = res.data
-					this.itemParameterData.tagField.bsm.select = res.data
-				})
-			},
-			// 鏉冮檺鍒嗛厤
-			getPower(radio) {
-				let power = JSON.parse(sessionStorage.getItem('power'))
-				let up = false
-				let add = false
-				let del = false
-				let select = 0
-				for (var i = 0; i < power.length; i++) {
-					if (power[i].menuMethod == 'selectItemParameterList') {
-						select += 1
-					}
-					if (power[i].menuMethod == 'selectTestObjectList') {
-						select += 2
-					}
-					if (this.radio === '0') {
-						if (power[i].menuMethod == 'upItemParameter') {
-							up = true
-						}
-						if (power[i].menuMethod == 'delItemParameter') {
-							del = true
-						}
-						if (power[i].menuMethod == 'addItemParameter') {
-							add = true
-						}
-					} else {
-						if (power[i].menuMethod == 'upTestObject') {
-							up = true
-						}
-						if (power[i].menuMethod == 'delTestObject') {
-							del = true
-						}
-						if (power[i].menuMethod == 'addTestObject') {
-							add = true
-						}
-					}
-				}
-				if (this.radio === '0') {
-					if (!del) {
-						this.itemParameterData.do.splice(1, 1)
-					}
-					if (!up) {
-						this.itemParameterData.do.splice(0, 1)
-					}
-				} else {
-					if (!del) {
-						this.testObjectData.do.splice(1, 1)
-					}
-					if (!up) {
-						this.testObjectData.do.splice(0, 1)
-					}
-				}
-				this.addPower = add
-				this.select = select
-				if (select == 1 || select == 3) this.radio = radio
-				else if (select == 2) this.radio = '1'
-				else this.radio = '-1'
-			}
-		}
-	}
+  import ValueTable from '../tool/value-table.vue'
+  export default {
+    components: {
+      ValueTable
+    },
+    data() {
+      return {
+        logining:false,
+        radio: '-1',
+        showItemParameter: true,
+        showTestObject: false,
+        itemParameterData: {
+          entity: {
+            inspectionItem: null,
+            inspectionItemSubclass: null,
+            sample: null,
+            orderBy: {
+              field: 'id',
+              order: 'asc'
+            }
+          },
+          isIndex: true,
+          showSelect: false,
+          select: true,
+          row: 2,
+          do: [{
+            id: 'update',
+            font: '缂栬緫',
+            type: 'text',
+            method: 'doDiy',
+            field: []
+          }, {
+            id: 'delete',
+            font: '鍒犻櫎',
+            type: 'text',
+            method: 'doDiy'
+          }],
+          tagField: {
+            inspectionItemType: {
+              select: []
+            },
+            bsm: {
+              select: []
+            },
+            inspectionValueType: {
+              select: []
+            },
+            laboratory: {
+              select: []
+            },
+            method: {
+              select: []
+            },
+            templateId: {
+              select: []
+            },
+            sonLaboratory: {
+              select: []
+            },
+            unit: {
+              select: []
+            },
+            dic: {
+              select: []
+            },
+          },
+          selectField: {
+            inspectionItemType: {
+              select: []
+            },
+            bsm: {
+              select: []
+            },
+            inspectionValueType: {
+              select: []
+            },
+            laboratory: {
+              select: []
+            },
+            templateId: {
+              select: []
+            },
+            method: {
+              select: [],
+              choose: true
+            },
+            sonLaboratory: {
+              select: []
+            },
+            unit: {
+              select: []
+            },
+            dic: {
+              select: []
+            },
+          },
+          cascaderField:{
+            sample:{
+              tree:[]
+            },
+            // 瀛楁閰嶇疆
+            props:{
+              value:'name',
+              label:'name',
+              checkStrictly: true,
+              multiple: true
+            }
+          },
+          requiredAdd: ['sonLaboratory', 'inspectionItem', 'inspectionItemType', 'inspectionValueType',
+            'unit', 'method', 'manDay', 'templateId'
+          ],
+          requiredUp: ['sonLaboratory', 'inspectionItem', 'inspectionItemType', 'inspectionValueType',
+            'unit', 'method', 'manDay', 'templateId'
+          ],
+          accept: '.xlsx',
+          inputType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
+        },
+        testObjectData: {
+          entity: {
+            specimenName: null,
+            orderBy: {
+              field: 'id',
+              order: 'asc'
+            }
+          },
+          isIndex: true,
+          showSelect: false,
+          select: true,
+          do: [{
+            id: 'update',
+            font: '缂栬緫',
+            type: 'text',
+            method: 'doDiy',
+            field: ['createUserName', 'updateUserName', 'product']
+          }, {
+            id: 'delete',
+            font: '鍒犻櫎',
+            type: 'text',
+            method: 'doDiy'
+          }, {
+            font: '浜у搧缁存姢',
+            type: 'text',
+            method: 'upProduct'
+          }],
+          tagField: {
+            laboratoryId: {
+              select: []
+            }
+          },
+          selectField: {
+            laboratoryId: {
+              select: []
+            }
+          },
+          requiredAdd: ['specimenName', 'code', 'laboratoryId'],
+          requiredUp: ['specimenName', 'code', 'laboratoryId']
+        },
+        itemParameterEntityCopy: {},
+        testObjectDataEntityCopy: {},
+        upIndex: 0,
+        addDia: false,
+        addPower: true,
+        select: 0,
+        laboratory: [],
+        productLoad: false,
+        diaProduct: false,
+        productData: {
+          entity: {
+            objectId: 0,
+            orderBy: {
+              field: 'id',
+              order: 'asc'
+            }
+          },
+          isPage: false,
+          isIndex: true,
+          showSelect: false,
+          select: true,
+          do: [{
+            id: 'update',
+            font: '缂栬緫',
+            type: 'text',
+            method: 'doDiy',
+            field: []
+          }, {
+            id: 'delete',
+            font: '鍒犻櫎',
+            type: 'text',
+            method: 'doDiy'
+          }],
+          tagField: {},
+          selectField: {},
+          requiredAdd: ['name','nameEn'],
+          requiredUp: ['name','nameEn'],
+        },
+        inPower: true,
+        importExcel: false,
+        uploadDia: false,
+        fileList: [],
+        token: null,
+        uploading: false,
+      }
+    },
+    mounted() {
+      this.token = {
+        'token': sessionStorage.getItem('token')
+      },
+      this.itemParameterEntityCopy = this.HaveJson(this.itemParameterData.entity)
+      this.testObjectDataEntityCopy = this.HaveJson(this.testObjectData.entity)
+      this.selectEnumByCategory()
+      // this.selectEnumByCategoryForValue()
+      this.selectEnumByCategoryForSpecial()
+      this.selectEnumByCategoryForInspectionValueType()
+      this.obtainItemParameterList()
+      this.selectStandardMethods()
+      this.selectTestObjectByName()
+      this.getStandardTemplate()
+      this.selectEnumByCategoryForSLaboratory()
+      this.selectDocUnit()
+      this.selectEnumByCategoryForUnit()
+      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;
+          this.showTestObject = false;
+          this.selectTestObjectByName()
+          /* this.$nextTick(() => {
+          	this.$refs.itemParameterTable.selectList()
+          }) */
+        } else {
+          this.showTestObject = true;
+          this.showItemParameter = false;
+        }
+        this.getPower(radio)
+      },
+      refreshTable() {
+        if (this.radio === '0') {
+          this.$refs['itemParameterTable'].selectList()
+        } else {
+          this.$refs['testObjectTable'].selectList()
+
+        }
+      },
+      refresh() {
+        this.itemParameterData.entity = this.HaveJson(this.itemParameterEntityCopy)
+        this.testObjectData.entity = this.HaveJson(this.testObjectDataEntityCopy)
+        this.upIndex++
+      },
+      openAdd() {
+        if (this.radio === '0') {
+          this.$refs.itemParameterTable.openAddDia(this.$api.capacityScope.addItemParameter);
+        } else {
+          this.$refs.testObjectTable.openAddDia(this.$api.capacityScope.addTestObject);
+        }
+      },
+      selectEnumByCategory() {
+        this.$axios.post(this.$api.enums.selectEnumByCategory, {
+          category: "妫�楠岄」绫诲瀷"
+        }).then(res => {
+          this.itemParameterData.selectField.inspectionItemType.select = res.data
+          res.data[1].type = 'info'
+          this.itemParameterData.tagField.inspectionItemType.select = res.data
+        })
+      },
+      selectEnumByCategoryForValue() {
+        this.$axios.post(this.$api.enums.selectEnumByCategory, {
+          category: "鍙栧�肩被鍨�"
+        }).then(res => {
+          this.itemParameterData.selectField.valueType.select = res.data
+          this.itemParameterData.tagField.valueType.select = res.data
+        })
+      },
+      selectEnumByCategoryForSpecial() {
+        this.$axios.post(this.$api.enums.selectEnumByCategory, {
+          category: "鏄惁"
+        }).then(res => {
+          this.itemParameterData.selectField.bsm.select = res.data
+          this.itemParameterData.tagField.bsm.select = res.data
+        })
+      },
+      selectEnumByCategoryForInspectionValueType() {
+        this.$axios.post(this.$api.enums.selectEnumByCategory, {
+          category: "妫�楠屽�肩被鍨�"
+        }).then(res => {
+          this.itemParameterData.selectField.inspectionValueType.select = res.data
+          this.itemParameterData.tagField.inspectionValueType.select = res.data
+        })
+      },
+      selectEnumByCategoryForSLaboratory() {
+        this.$axios.post(this.$api.enums.selectEnumByCategory, {
+          category: "瀛愬疄楠屽"
+        }).then(res => {
+          this.itemParameterData.selectField.sonLaboratory.select = res.data
+          this.itemParameterData.tagField.sonLaboratory.select = res.data
+        })
+      },
+      selectEnumByCategoryForUnit() {
+        this.$axios.post(this.$api.enums.selectEnumByCategory, {
+          category: "鍗曚綅"
+        }).then(res => {
+          this.itemParameterData.selectField.unit.select = res.data
+          this.itemParameterData.tagField.unit.select = res.data
+        })
+      },
+      selectDocUnit() {
+        this.$axios.post(this.$api.enums.getDic).then(res => {
+          this.itemParameterData.selectField.dic.select = res.data.map(m => {
+            return {
+              label: m,
+              value: m
+            }
+          })
+          this.itemParameterData.tagField.dic.select = res.data.map(m => {
+            return {
+              label: m,
+              value: m
+            }
+          })
+        })
+      },
+      obtainItemParameterList() {
+        this.$axios.get(this.$api.laboratoryScope.obtainItemParameterList).then(res => {
+          let data = []
+          let data0 = []
+          res.data.forEach(a => {
+            data.push({
+              label: a.laboratoryName,
+              value: a.id
+            })
+            data0.push({
+              label: a.laboratoryName,
+              value: a.laboratoryName
+            })
+          })
+          this.itemParameterData.selectField.laboratory.select = data0
+          this.itemParameterData.tagField.laboratory.select = data0
+          this.testObjectData.selectField.laboratoryId.select = data
+          this.testObjectData.tagField.laboratoryId.select = data
+          this.laboratory = data
+        })
+      },
+      selectStandardMethods() {
+        this.$axios.get(this.$api.standardMethod.selectStandardMethods).then(res => {
+          let data = []
+          res.data.forEach(a => {
+            data.push({
+              label: a.code,
+              value: a.code
+            })
+          })
+          this.itemParameterData.selectField.method.select = data
+          this.itemParameterData.tagField.method.select = data
+        })
+      },
+      selectTestObjectByName() {
+        this.$axios.get(this.$api.capacityScope.getItemTree).then(res => {
+          res.data.forEach(a=>{
+            this.cascaderFieldData(a)
+          })
+          this.itemParameterData.cascaderField.sample.tree = res.data
+        })
+      },
+      cascaderFieldData(val){
+        if(val.children === undefined) {
+          return
+        }else if(val.children.length==0){[
+          delete val.children
+        ]}else{
+          val.children.forEach(a=>{
+            this.cascaderFieldData(a)
+          })
+        }
+      },
+      getStandardTemplate() {
+        this.$axios.get(this.$api.StandardTemplate.getStandardTemplate).then(res => {
+          let data = []
+          res.data.forEach(a => {
+            data.push({
+              label: a.name,
+              value: a.id,
+              type: 'success'
+            })
+          })
+          this.itemParameterData.selectField.templateId.select = data
+          this.itemParameterData.tagField.templateId.select = data
+        })
+      },
+      // 鏉冮檺鍒嗛厤
+      getPower(radio) {
+        let power = JSON.parse(sessionStorage.getItem('power'))
+        let up = false
+        let add = false
+        let del = false
+        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
+          }
+          if (power[i].menuMethod == 'selectTestObjectList') {
+            select += 2
+          }
+          if (radio === '0') {
+            if (power[i].menuMethod == 'upItemParameter') {
+              up = true
+            }
+            if (power[i].menuMethod == 'delItemParameter') {
+              del = true
+            }
+            if (power[i].menuMethod == 'addItemParameter') {
+              add = true
+            }
+            if (power[i].menuMethod == 'importData') {
+              inPower = true
+            }
+          } else {
+            if (power[i].menuMethod == 'upTestObject') {
+              up = true
+            }
+            if (power[i].menuMethod == 'delTestObject') {
+              del = true
+            }
+            if (power[i].menuMethod == 'addTestObject') {
+              add = true
+            }
+            if (power[i].menuMethod == 'selectProductListByObjectId') {
+              product = true
+            }
+            if (power[i].menuMethod == 'importExcel') {
+              importExcel = true
+            }
+          }
+        }
+        if (radio === '0') {
+          if (!del) {
+            this.itemParameterData.do.splice(1, 1)
+          }
+          if (!up) {
+            this.itemParameterData.do.splice(0, 1)
+          }
+        } else {
+          if (!product) {
+            this.testObjectData.do.splice(2, 1)
+          }
+          if (!del) {
+            this.testObjectData.do.splice(1, 1)
+          }
+          if (!up) {
+            this.testObjectData.do.splice(0, 1)
+          }
+        }
+        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'
+      },
+      upProduct(row) {
+        this.productData.entity.objectId = row.id
+        this.diaProduct = true
+      },
+      openAdd2(){
+      	this.$refs.productData.openAddDia(this.$api.capacityScope.addProduct, {objectId: this.productData.entity.objectId});
+      },
+    }
+  }
 </script>

--
Gitblit v1.9.3