From af75159618b6b090710b9515bc789fa9accdc3bd Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 06 九月 2023 15:44:35 +0800
Subject: [PATCH] 	modified:   src/api/standardLibrary.js 	modified:   src/views/basicData/index.vue 	modified:   src/views/experiment/inspectionApplication/index.vue 	modified:   src/views/laboratory/ledger/index.vue 	modified:   src/views/standardLibrary/index.vue

---
 src/views/basicData/index.vue                        |    1 
 src/views/experiment/inspectionApplication/index.vue |   75 ++++++++-------
 src/views/standardLibrary/index.vue                  |  133 +++++++++++++++++++++-----
 src/api/standardLibrary.js                           |    8 +
 src/views/laboratory/ledger/index.vue                |   30 -----
 5 files changed, 157 insertions(+), 90 deletions(-)

diff --git a/src/api/standardLibrary.js b/src/api/standardLibrary.js
index 2eb0e96..8e8857b 100644
--- a/src/api/standardLibrary.js
+++ b/src/api/standardLibrary.js
@@ -1,5 +1,13 @@
 import request from '@/utils/request'
 
+export function addProduct(data) {
+  return request({
+    url: '/product/addProduct',
+    method: 'post',
+    data
+  })
+}
+
 export function getMaterialList() {
   return request({
     url: '/material/list',
diff --git a/src/views/basicData/index.vue b/src/views/basicData/index.vue
index cb8c8f9..4ec917c 100644
--- a/src/views/basicData/index.vue
+++ b/src/views/basicData/index.vue
@@ -247,7 +247,6 @@
 					this.selectProductModelTable();
 				});
 			},
-
 			// 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆
 			// 鍏ㄩ��/鍙栨秷閫夋搷浣�
 			selectAll(val) {
diff --git a/src/views/experiment/inspectionApplication/index.vue b/src/views/experiment/inspectionApplication/index.vue
index 5f63b6c..6df3ed6 100644
--- a/src/views/experiment/inspectionApplication/index.vue
+++ b/src/views/experiment/inspectionApplication/index.vue
@@ -105,14 +105,13 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="鏉ユ枡鏃ユ湡锛�">
-											<!-- <el-input style="width: 300px" type="text" :value="infoForm.startTime" placeholder="璇疯緭鍏ユ潵鏂欐棩鏈�" autocomplete="off" /> -->
-											<el-date-picker style="width: 300px" v-model="infoForm.formTime" type="date" placeholder="閫夋嫨鏃ユ湡">
+											<el-date-picker style="width: 300px" disabled v-model="infoForm.formTime" type="date" placeholder="閫夋嫨鏃ユ湡">
 											</el-date-picker>
 										</el-form-item>
 									</el-col>
 									<el-col :span="10">
 										<el-form-item label="渚涘簲鍟嗗悕绉帮細">
-											<el-input style="width: 300px" type="text" :value="infoForm.supplier" placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О"
+											<el-input style="width: 300px" type="text" disabled :value="infoForm.supplier" placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -120,13 +119,13 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="鍘熸潗鏂欑紪鐮侊細">
-											<el-input style="width: 300px" type="text" :value="infoForm.mcode" placeholder="璇疯緭鍏ュ師鏉愭枡缂栫爜"
+											<el-input style="width: 300px" type="text" disabled :value="infoForm.mcode" placeholder="璇疯緭鍏ュ師鏉愭枡缂栫爜"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
 									<el-col :span="10">
 										<el-form-item label="鍘熸潗鏂欏悕绉帮細">
-											<el-input style="width: 300px" type="text" :value="infoForm.name" placeholder="璇疯緭鍏ュ師鏉愭枡鍚嶇О"
+											<el-input style="width: 300px" type="text" disabled :value="infoForm.name" placeholder="璇疯緭鍏ュ師鏉愭枡鍚嶇О"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -134,13 +133,13 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="瑙勬牸鍨嬪彿锛�">
-											<el-input style="width: 300px" type="text" :value="infoForm.specifications" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
+											<el-input style="width: 300px" type="text" disabled :value="infoForm.specifications" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
 									<el-col :span="10">
 										<el-form-item label="鍗曚綅锛�">
-											<el-input style="width: 300px" type="text" :value="infoForm.unit" placeholder="璇疯緭鍏ュ崟浣�"
+											<el-input style="width: 300px" type="text" disabled :value="infoForm.unit" placeholder="璇疯緭鍏ュ崟浣�"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -148,7 +147,7 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="鏁伴噺锛�">
-											<el-input style="width: 300px" type="text" :value="infoForm.num" placeholder="璇疯緭鍏ユ暟閲�"
+											<el-input style="width: 300px" type="text" disabled :value="infoForm.num" placeholder="璇疯緭鍏ユ暟閲�"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -168,13 +167,13 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="濮旀墭缂栧彿">
-											<el-input style="width: 300px" type="text" :value="commisionSelection.entrust_coding"
+											<el-input style="width: 300px" type="text" disabled :value="commisionSelection.entrust_coding"
 												placeholder="璇疯緭鍏ユ潵鏂欐棩鏈�" autocomplete="off" />
 										</el-form-item>
 									</el-col>
 									<el-col :span="10">
 										<el-form-item label="濮旀墭鍗曚綅">
-											<el-input style="width: 300px" type="text" :value="commisionSelection.supplier"
+											<el-input style="width: 300px" type="text" disabled :value="commisionSelection.supplier"
 												placeholder="璇疯緭鍏ュ鎵樺崟浣�" autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -182,13 +181,13 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="鏍峰搧缂栧彿">
-											<el-input style="width: 300px" type="text" :value="commisionSelection.mcode" placeholder="璇疯緭鍏ユ牱鍝佺紪鍙�"
+											<el-input style="width: 300px" type="text" disabled :value="commisionSelection.mcode" placeholder="璇疯緭鍏ユ牱鍝佺紪鍙�"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
 									<el-col :span="10">
 										<el-form-item label="鏍峰搧鍚嶇О">
-											<el-input style="width: 300px" type="text" :value="commisionSelection.name" placeholder="璇疯緭鍏ユ牱鍝佸悕绉�"
+											<el-input style="width: 300px" type="text" disabled :value="commisionSelection.name" placeholder="璇疯緭鍏ユ牱鍝佸悕绉�"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -196,13 +195,13 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="瑙勬牸鍨嬪彿锛�">
-											<el-input style="width: 300px" type="text" :value="commisionSelection.specifications"
+											<el-input style="width: 300px" type="text" disabled :value="commisionSelection.specifications"
 												placeholder="璇疯緭鍏ュ瀷鍙疯鏍�" autocomplete="off" />
 										</el-form-item>
 									</el-col>
 									<el-col :span="10">
 										<el-form-item label="閫佽揪鏃堕棿">
-											<el-input style="width: 300px" type="text" :value="commisionSelection.supplier"
+											<el-input style="width: 300px" type="text" disabled :value="commisionSelection.supplier"
 												placeholder="璇疯緭鍏ュ崟浣�" autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -210,7 +209,7 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="瀹屾垚鏈熼檺">
-											<el-input style="width: 300px" type="text" :value="commisionSelection.completionDeadline"
+											<el-input style="width: 300px" type="text" disabled :value="commisionSelection.completionDeadline"
 												placeholder="璇疯緭鍏ユ暟閲�" autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -230,27 +229,27 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="鏉ユ枡鏃ユ湡锛�">
-											<el-input style="width: 300px" type="text" v-model="finishedTable.deliverydate"
+											<el-input style="width: 300px" type="text" disabled v-model="finishedTable.deliverydate"
 												placeholder="璇疯緭鍏ユ潵鏂欐棩鏈�" autocomplete="off" />
 										</el-form-item>
 									</el-col>
 									<el-col :span="10">
 										<el-form-item label="渚涘簲鍟嗗悕绉帮細">
-											<el-input style="width: 300px" type="text" v-model="finishedTable.supplier" placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О"
+											<el-input style="width: 300px" type="text" disabled v-model="finishedTable.supplier" placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
 								</el-row>
 								<el-row :gutter="100">
 									<el-col :span="10">
-										<el-form-item label="鍘熸潗鏂欑紪鐮侊細">
-											<el-input style="width: 300px" type="text" v-model="finishedTable.code" placeholder="璇疯緭鍏ュ師鏉愭枡缂栫爜"
+										<el-form-item label="鎴愬搧缂栫爜锛�">
+											<el-input style="width: 300px" type="text" disabled v-model="finishedTable.code" placeholder="璇疯緭鍏ユ垚鍝佺紪鐮�"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
 									<el-col :span="10">
-										<el-form-item label="鍘熸潗鏂欏悕绉帮細">
-											<el-input style="width: 300px" type="text" v-model="finishedTable.name" placeholder="璇疯緭鍏ュ師鏉愭枡鍚嶇О"
+										<el-form-item label="鎴愬搧鍚嶇О锛�">
+											<el-input style="width: 300px" type="text" disabled v-model="finishedTable.name" placeholder="璇疯緭鍏ユ垚鍝佸悕绉�"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -258,13 +257,13 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="瑙勬牸鍨嬪彿锛�">
-											<el-input style="width: 300px" type="text" v-model="finishedTable.modelandspecification"
+											<el-input style="width: 300px" type="text" disabled v-model="finishedTable.modelandspecification"
 												placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" autocomplete="off" />
 										</el-form-item>
 									</el-col>
 									<el-col :span="10">
 										<el-form-item label="鍗曚綅锛�">
-											<el-input style="width: 300px" type="text" v-model="finishedTable.unit" placeholder="璇疯緭鍏ュ崟浣�"
+											<el-input style="width: 300px" type="text" disabled v-model="finishedTable.unit" placeholder="璇疯緭鍏ュ崟浣�"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -272,7 +271,7 @@
 								<el-row :gutter="100">
 									<el-col :span="10">
 										<el-form-item label="鏁伴噺锛�">
-											<el-input style="width: 300px" type="text" v-model="finishedTable.amount" placeholder="璇疯緭鍏ユ暟閲�"
+											<el-input style="width: 300px" type="text" disabled v-model="finishedTable.amount" placeholder="璇疯緭鍏ユ暟閲�"
 												autocomplete="off" />
 										</el-form-item>
 									</el-col>
@@ -299,7 +298,7 @@
 					<template slot-scope="scope">
 						<span>鐗堟湰閫夋嫨锛�</span>
 						<el-select @change="getProductVerison" v-model="version" size="small" slot="append" style="width: 220px;">
-							<el-option v-for="item in BANben" :key="item" :label="item" :value="item"></el-option>
+							<el-option v-for="(item,index) in BANben" :key="index" :label="item.label" :value="item.value"></el-option>
 						</el-select>
 					</template>
 				</el-card>
@@ -471,7 +470,7 @@
 				pageSize: 10, // 姣忛〉鐨勬暟鎹潯鏁�
 				radioValue: '鍏ㄩ儴',
 				checkTypeVisible: false,
-				type: 0, // 榛樿涓嶉�変腑鐨勭姸鎬�
+				type: 2, // 榛樿涓嶉�変腑鐨勭姸鎬�
 				rawmaterialVisible: false,
 				commisionVisible: false,
 				tmp: {},
@@ -524,28 +523,31 @@
 				const res = await chooseVer({
 					mcode: this.tmp.mcode,
 					name: this.tmp.name,
-					specifications: this.tmp.specifications
+					specifications: this.tmp.specificationsId
 				})
 				this.BANben = []
 				res.data.forEach(a => {
-					this.BANben.push('V ' + a)
+					this.BANben.push({
+						label: "V" + a,
+						value: a
+					})
 				})
-				this.version = this.BANben[0]
-				this.lookProByVer()
+				this.version = this.BANben[0].value;
+				this.lookProByVerFun()
 			},
 			//鏍囧噯搴�
-			async lookProByVer() {
+			async lookProByVerFun() {
 				const res = await lookProByVer({
 					mcode: this.tmp.mcode,
 					name: this.tmp.name,
-					specifications: this.tmp.specifications,
-					version: this.version.replace('V ', '')
+					specifications: this.tmp.specificationsId,
+					version: this.version
 				})
 				this.tableData = res.data
 			},
 			getProductVerison(val) {
 				this.version = val
-				this.lookProByVer()
+				this.lookProByVerFun()
 			},
 			async selectInspectsList() {
 				// 鑾峰彇鍒嗛〉鍒楄〃
@@ -679,17 +681,20 @@
 						name: this.infoForm.name,
 						num: this.infoForm.num,
 						specifications: this.infoForm.specifications,
+						specificationId: this.infoForm.specificationsId,
 						startTime: this.infoForm.checkdate[0],
 						supplier: this.infoForm.supplier,
 						type: this.type,
 						unit: this.infoForm.unit,
-						version: this.version.replace('V ', '')
+						version: this.version
 					}).then(res => {
 						this.$message({
 							message: '娣诲姞鎴愬姛锛�',
 							type: 'success'
 						});
 						this.$router.push(`Viewdetails/${res.data}`)
+					}).catch(error=>{
+						this.$message.error(error.message);
 					})
 				}
 				if (this.type === 1) {
diff --git a/src/views/laboratory/ledger/index.vue b/src/views/laboratory/ledger/index.vue
index 51edbca..0bf4c01 100644
--- a/src/views/laboratory/ledger/index.vue
+++ b/src/views/laboratory/ledger/index.vue
@@ -606,7 +606,7 @@
     },
     measureFormVisible(newVal){
       if(newVal === false){
-        this.resetForm("addmeasureForm");
+        this.cancelAddMeasure();
       }
     }
   },
@@ -639,7 +639,6 @@
     // 鑾峰彇鍒嗙被鏁版嵁
     async getThreeData() {
       const { data } = await getClassifyList()
-      // console.log(data)
       this.classTree = data.map(item => {
         if (item.children) {
           item.children = item.children.map(childrenItem => {
@@ -672,17 +671,14 @@
       const { data } = await getInstrumentDetail({ InstrumentId: row.id })
       this.equipmentDetail = data
       this.equipmentform = data
-      console.log(this.equipmentform)
       const { data: pointList } = await getEquipmentPointList({ InstrumentId: this.equipmentDetail.id })
       this.codePointsTable = pointList
       const { data: informationList } = await getMetricalInformationList({ InstrumentId: this.equipmentDetail.id })
       this.measureTable = informationList
-      console.log(informationList)
     },
     // 鑺傜偣鐐瑰嚮澶勭悊
     nodeClickHandler(data, node, element) {
       this.nodeclicked = data
-      console.log(data)
       // 鍙湁鏁版嵁涓惡甯d鎵嶈兘鍙戦�佹煡璇㈣姹�
       if (data.id) {
         this.getEquipmentTable({ classifyId: data.id, pageSize: this.pageSize, pageNo: this.currentPage, whetherWhether: this.isOut })
@@ -690,7 +686,6 @@
     },
     // 鑾峰彇浠櫒鍒楄〃鏁版嵁
     async getEquipmentTable(ages) {
-      // console.log('鏉′欢瀵硅薄', ages)
       const { data } = await getInstrumentList(ages)
       this.equipmentTable = data.row
       this.total = data.total
@@ -709,14 +704,8 @@
     handleCurrentChange() {
       // 褰撳墠椤垫洿鏀�
     },
-    // 鏄剧ず璁惧鐮佺偣
-    addCodePoints() {
-      // 娣诲姞鏂扮爜鐐癸紝娓呯┖鍘熸暟缁�
-      this.codePointesTableStatus = true
-    },
     // 鏂板璁惧鐮佺偣
     addNewCodePoints() {
-      console.log(this.equipmentDetail.id);
       this.codePointesTableStatus = true;
       const newObj = {}
       newObj.isInput = true,
@@ -814,10 +803,10 @@
       this.$refs[formName].resetFields();
     },
     cancelAddMeasure() {
-      this.$refs['upload'].clearFiles();
       this.measureForm.file = null;
       this.measureFormVisible = false
       this.resetForm('addmeasureForm');
+      this.$refs['upload'].clearFiles();
     },
     // 娣诲姞璁¢噺淇℃伅
     async addMeasure() {
@@ -829,7 +818,6 @@
             this.measureForm.beginDate = parseTime(this.measureForm.date[0], '{y}-{m}-{d}')
             this.measureForm.endDate = parseTime(this.measureForm.date[1], '{y}-{m}-{d}')
           }
-          console.log(this.measureForm)
           const formData = new FormData()
           if(this.measureForm.file == null || this.measureForm.file == ""){
             this.$message.warning("璇烽�夋嫨瑕佷笂浼犵殑鏂囦欢!");
@@ -837,16 +825,11 @@
           }else{
             formData.append('file', this.measureForm.file?.raw, this.measureForm.file?.name)
           }
-          console.log(this.measureForm)
           for (const key in this.measureForm) {
-            console.log(key)
-            // if (key === 'file') return
             formData.append(key, this.measureForm[key])
           }
-          console.log(formData)
           try {
-            const { data } = await addMetricalInformation(formData)
-            console.log(data)
+            await addMetricalInformation(formData)
             this.$message.success('娣诲姞鎴愬姛')
             const { data: informationList } = await getMetricalInformationList({ InstrumentId: this.equipmentDetail.id })
             this.measureTable = informationList
@@ -857,8 +840,6 @@
           }
           this.measureForm.file = null;
           this.$refs['upload'].clearFiles();
-        }else{
-          console.log(32);
         }
       });
     },
@@ -868,7 +849,6 @@
       this.codePointsTable = []
       this.measureTable = []
       this.measureForm.file = null;
-      this.$refs['upload'].clearFiles();
     },
     // 鍏抽棴娣诲姞淇敼璁惧鎶藉眽
     closeAddOrChangeDrawer() {
@@ -878,7 +858,6 @@
     },
     // 鏂囦欢涓婁紶
     handleUpload(file, fileList) {
-      console.log(file, fileList)
       this.measureForm.file = file
     },
     // 鏍规嵁杈撳叆鐨勮澶囩紪鍙凤紝璁惧鍚嶇О鎴栬�呭瀷鍙疯鏍煎叧閿瓧杩涜杩囨护鍒楄〃
@@ -896,7 +875,6 @@
       this.equipmentTable = this.oldtableData
     },
     getConditionTable() {
-      // console.log(this.radioValue)
       let filteredTable = this.oldtableData.filter(item => {
         return item.conditions === this.radioValue
       })
@@ -939,12 +917,10 @@
             let expireItem
             for (expireItem of this.expireData) {
               this.equipmentTable = this.oldtableData.filter(item => {
-                console.log(this.radioValue)
                 console.log('item', item)
                 console.log('expireItem', expireItem)
                 return item.conditions === this.radioValue && item.equipment_code === expireItem.equipment_code
               })
-              console.log(this.equipmentTable)
             }
           } else {
             this.equipmentTable = this.expireData
diff --git a/src/views/standardLibrary/index.vue b/src/views/standardLibrary/index.vue
index e694db0..f6088c1 100644
--- a/src/views/standardLibrary/index.vue
+++ b/src/views/standardLibrary/index.vue
@@ -2,7 +2,14 @@
 	<div class="standard-library-main">
 		<div class="content-main">
 			<div class="library-bom" style="width: 300px">
-				<el-input clearable v-model="filterText" placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�"></el-input>
+				<el-row :gutter="10">
+					<el-col :span="19">
+					<el-input clearable v-model="filterText" placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�"></el-input>
+					</el-col>
+					<el-col :span="5">
+						<el-button type="primary" icon="el-icon-plus" @click="addTreeFormVisible = true"></el-button>
+					</el-col>
+				</el-row>
 				<el-button type="text">鍏ㄩ儴</el-button>
 				<el-tree ref="tree" style="width: 100%" class="filter-tree" :data="standardTree" :props="defaultProps"
 					node-key="id" :highlight-current="true" :default-expand-all="true" :filter-node-method="filterNode"
@@ -17,7 +24,7 @@
 							</el-option>
 						</el-select>
 						<el-button type="primary" @click="addVersionFun">鏂板鐗堟湰鍙�</el-button>
-						<el-button type="primary" icon="el-icon-plus" @click="addTreeFormVisible = true">鏂板</el-button>
+						<el-button type="primary" @click="centerDialogVisible = true">鏂板椤圭洰</el-button>
 						<el-button class="top_div_button" icon="el-icon-delete-solid" style="color: #00a5ff"
 							@click="deleteListClick">鍒犻櫎</el-button>
 					</div>
@@ -83,6 +90,33 @@
 				<el-button @click="clear">鍙� 娑�</el-button>
 			</div>
 		</el-dialog>
+		<el-dialog :visible.sync="centerDialogVisible" width="30%" title="鏂板" :hide-required-asterisk="false">
+			<el-form :model="form" :rules="rules" ref="ruleForm" class="addForm">
+				<el-form-item prop="father">
+					<span>椤圭洰鍒嗙粍锛�</span>
+					<el-autocomplete class="inline-input" v-model="form.father" :fetch-suggestions="querySearch"
+						placeholder="璇疯緭鍏ユ牱鍝佸垎缁�" style="width: calc(100% - 70px);"></el-autocomplete>
+				</el-form-item>
+				<el-row :gutter="24">
+					<el-col :span="12">
+						<el-form-item prop="name">
+							<span>椤圭洰鍚嶇О锛�</span>
+							<el-input style="width: calc(100% - 70px);" v-model="form.name" placeholder="璇疯緭鍏ラ」鐩悕绉�"></el-input>
+						</el-form-item>
+					</el-col>
+					<el-col :span="12">
+						<el-form-item prop="unit">
+							<span v-html="'鍗�&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;浣嶏細'"></span>
+							<el-input style="width: calc(100% - 70px);" v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�"></el-input>
+						</el-form-item>
+					</el-col>
+				</el-row>
+			</el-form>
+			<span slot="footer" class="dialog-footer">
+				<el-button @click="centerDialogVisible = false" size="small ">鍙� 娑�</el-button>
+				<el-button type="primary" @click="submitAdd" size="small ">纭</el-button>
+			</span>
+		</el-dialog>
 	</div>
 </template>
 
@@ -97,17 +131,32 @@
 		blurUpdateApi,
 		getVersion,
 		addVersion,
+		addProduct
 	} from "@/api/standardLibrary";
-
 	import {
-		selectproductModelApi
+		addStandardProjectGroupApi,
 	} from "@/api/basicData/index";
-	import {
-		Tree
-	} from "element-ui";
 	export default {
 		data() {
 			return {
+				projectGroupingOptions:[],
+				form: {
+					father: "", // 椤圭洰鍒嗙粍
+					name: "", // 椤圭洰鍚嶇О
+					unit: "", // 鍗曚綅
+				},
+				rules: {
+					fater:[{required:true,message:"璇烽�夋嫨椤圭洰鍚嶇О",trigger:"blur"}],
+					name: [
+						{required: true,message: "璇疯緭鍏ラ」鐩悕绉�",trigger: "blur"},
+						{min: 2,max: 25,message: "闀垮害鍦� 2 鍒� 25 涓瓧绗�",trigger: "blur",},
+					],
+					unit: [
+						{required: true,message: "璇疯緭鍏ュ崟浣�",trigger: "blur"},
+						{min: 1,max: 25,message: "闀垮害鍦� 1 鍒� 25 涓瓧绗�",trigger: "blur"}
+					],
+				},
+				centerDialogVisible : false,
 				filterNodeData: [],
 				options: [],
 				versionValue: "",
@@ -144,13 +193,45 @@
 				if(newVal === false){
 					this.clear();
 				}
-			}
+			},
+			centerDialogVisible: {
+				handler(newVal, oldVal) {
+					if (newVal == true) {
+						addStandardProjectGroupApi().then((res) => {
+							this.projectGroupingOptions = res.data;
+						});
+					} else {
+						// 璇锋眰鎴愬姛娓呴櫎鏁版嵁
+						this.form = {};
+						// 鎻愪氦鎴愬姛娓呴櫎妫�楠�
+						this.$refs.ruleForm.resetFields();
+					}
+				},
+			},
 		},
 		created() {
 			this.getStandardTree();
 		},
-		mounted() {},
+		mounted() {
+
+		},
 		methods: {
+			querySearch(queryString, cb) {
+				var restaurants = []
+				this.projectGroupingOptions.forEach(a => {
+					restaurants.push({
+						value: a
+					})
+				})
+				var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
+				// 璋冪敤 callback 杩斿洖寤鸿鍒楄〃鐨勬暟鎹�
+				cb(results);
+			},
+			createFilter(queryString) {
+				return (restaurant) => {
+					return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
+				};
+			},
 			clear(){
 				this.addTreeFormVisible = false;
 				this.addTreeForm.addTypeArr=[];
@@ -159,9 +240,6 @@
 				this.addTreeForm.standardName=''
 			},
 			changeSample(){
-				// console.log(this.standardTree);
-				// console.log(this.addTreeForm);
-				// console.log(this.addTreeForm.addTypeArr.length);
 				let selectType=this.standardTree.filter(item=>{
 					return item.id===this.addTreeForm.addTypeArr[0]
 				})[0];
@@ -206,6 +284,22 @@
 			changeSelect() {
 				this.tableData = [];
 				this.getTableByClick(this.selectData, this.versionValue);
+			},
+			async submitAdd(){
+				await addProduct({
+					father : this.form.father,
+					name : this.form.name,
+					specificationId: this.selectData.id,
+					unit : this.form.unit,
+					version : this.versionValue
+				}).then(res=>{
+					console.log(res);
+					this.$message.success(res.message);
+					this.centerDialogVisible = false;
+					this.getTableByClick(this.selectData, this.versionValue);
+				}).catch(error=>{
+					this.$message.error(error.message);
+				})
 			},
 			async insertVersion() {
 				const resp = await addVersion({
@@ -406,21 +500,6 @@
 			},
 			changeCascader(data) {
 				this.addTreeForm.addTypeArr = data;
-			},
-			selectProductModelTable() {
-				selectproductModelApi(this.params).then((res) => {
-					res.data.forEach((i) => {
-						if (i.name === undefined) {
-							i.name = i.children[0].name;
-							i.unit = i.children[0].unit;
-							i.id = i.children[0].id;
-							i.edit = true;
-							delete i.children;
-						}
-					});
-					this.tableData = res.data;
-					this.selectDataList();
-				});
 			},
 			selectDataList() {
 				let i=0

--
Gitblit v1.9.3