From 4f3dcd0320e21fc31f1669a23cedfa28572b8c85 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期一, 18 三月 2024 13:17:00 +0800
Subject: [PATCH] 完成设备明细新增页面调整

---
 src/components/do/b1-ins-order/add.vue        |   86 ++++++++++++++++++++++++----
 src/components/view/b1-inspect-order-plan.vue |    4 
 src/components/view/a6-device-management.vue  |   36 +++++++++---
 3 files changed, 102 insertions(+), 24 deletions(-)

diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index b1b4b22..23d27c7 100644
--- a/src/components/do/b1-ins-order/add.vue
+++ b/src/components/do/b1-ins-order/add.vue
@@ -41,6 +41,12 @@
 		font-size: 18px;
 	}
 
+  .el-select-dropdown__item {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+  }
+
 </style>
 <style>
 	.ins_order_add .el-input-group__append,
@@ -82,13 +88,16 @@
 			<el-row class="title">
 				<el-col :span="6" style="padding-left: 20px;">濮旀墭鍗曚俊鎭�</el-col>
 				<el-col :span="18" style="text-align: right;">
-					<el-select v-model="template" size="medium" placeholder="涓嬪崟妯℃澘" style="margin-right: 10px;" v-show="active<2">
-						<el-option v-for="(a, ai) in templates" :key="ai" :value="a.value" :label="a.label"></el-option>
+					<el-select v-model="template" size="medium" placeholder="涓嬪崟妯℃澘" style="margin-right: 10px;" v-show="active==1">
+						<el-option v-for="(a, ai) in templates" :key="ai" :value="a.value" :label="a.label">
+              <span style="float: left">{{ a.label }}</span>
+              <i class="el-icon-delete" style="float: right; color: #66b1ff; font-size: 16px" @click.stop="handleDelete"></i>
+            </el-option>
 					</el-select>
-					<el-button size="medium" @click="" v-show="active<2">
+					<el-button size="medium" @click="templateDia=true" v-show="active==1">
 						<span style="color: #3A7BFA;">淇濆瓨妯℃澘</span>
 					</el-button>
-					<el-button size="medium" type="primary" @click="save" :loading="saveLoad" v-show="active<2">鎻愪氦</el-button>
+					<el-button size="medium" type="primary" @click="save" :loading="saveLoad" v-show="active==1">鎻愪氦</el-button>
           <el-button size="medium" @click="upInsOrderOfState(2)" :loading="saveLoad" v-show="active==3">瀹℃牳涓嶉�氳繃</el-button>
           <el-button size="medium" type="primary" @click="upInsOrderOfState(1)" :loading="saveLoad" v-show="active==3">瀹℃牳閫氳繃</el-button>
 					<el-button size="medium" @click="$parent.playOrder(0)">
@@ -160,14 +169,14 @@
 			</el-row>
 		</div>
 		<div>
-			<div style="text-align: right;line-height: 45px;">
-				<el-button type="primary" size="small" @click="addSampleDia = true" v-show="active<2">娣诲姞鏍峰搧</el-button>
+			<div style="text-align: right;line-height: 45px;" v-if="active<2">
+				<el-button type="primary" size="small" @click="addSampleDia = true"  >娣诲姞鏍峰搧</el-button>
 				<el-button size="small" @click="delSample">
-					<span style="color: #3A7BFA;" v-show="active<2">鍒犻櫎鏍峰搧</span>
+					<span style="color: #3A7BFA;">鍒犻櫎鏍峰搧</span>
 				</el-button>
 			</div>
-			<el-table class="el-table" ref="sampleTable" :data="sampleList" height="250px" tooltip-effect="dark" border
-				@selection-change="selectSample" highlight-current-row @row-click="rowClick">
+			<el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" height="250px" tooltip-effect="dark" border
+				@selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;">
 				<el-table-column type="selection" width="60"></el-table-column>
 				<el-table-column type="index" label="搴忓彿" width="65" align="center"></el-table-column>
 				<el-table-column prop="sample" label="鏍峰搧鍚嶇О" align="center" show-overflow-tooltip
@@ -340,6 +349,18 @@
 				<el-button type="primary" @click="onSample()" :loading="getProductLoad">纭� 瀹�</el-button>
 			</span>
 		</el-dialog>
+    <el-dialog title="淇濆瓨妯℃澘" :visible.sync="templateDia" width="30%">
+			<div class="body" style="height: 10vh;display: flex;align-items: center;" v-if="templateDia">
+        <div class="search_label"><span class="required-span">* </span>妯℃澘鍚嶇О锛�</div>
+        <div class="search_input">
+          <el-input size="small" clearable v-model="templateName"></el-input>
+        </div>
+			</div>
+			<span slot="footer" class="dialog-footer">
+				<el-button @click="templateDia = false">鍙� 娑�</el-button>
+				<el-button type="primary" @click="addTemplateDia" :loading="templateLoading">纭� 瀹�</el-button>
+			</span>
+		</el-dialog>
 	</div>
 </template>
 
@@ -362,7 +383,12 @@
 		data() {
 			return {
 				template: null,
-				templates: [],
+				templates: [
+          {
+            label:'0000',
+            value:1
+          }
+        ],
 				addObj: {
 					entrustCode: null,
 					custom: null,
@@ -426,7 +452,10 @@
 				productList: [],
 				productIds: [],
 				getProductLoad: false,
-				saveLoad: false
+				saveLoad: false,
+        templateDia:false,
+        templateLoading:false,
+        templateName:''
 			}
 		},
 		mounted() {
@@ -443,7 +472,10 @@
 				}).then(res => {
           this.addObj = {...res.data.insOrder};
           this.addObj.type = String(this.addObj.type)
-          this.sampleList = res.data.sampleProduct
+          this.sampleList = this.HaveJson(res.data.sampleProduct);
+          this.$nextTick(()=>{
+            this.$refs.sampleTable.doLayout()
+          })
 				})
       }
 		},
@@ -659,7 +691,35 @@
 					return 'warning-row';
 				}
 				return '';
-			}
+			},
+      // 鍒犻櫎妯℃澘--璋冪敤鎺ュ彛
+      handleDelete(){
+        this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", {
+							confirmButtonText: "纭畾",
+							cancelButtonText: "鍙栨秷",
+							type: "warning"
+						}).then(() => {
+							// this.$axios.post(this.delUrl, {
+							// 	id: row.id
+							// }).then(res => {
+							// 	if (res.code === 201) {
+							// 		return
+							// 	}
+							// 	this.$message.success('鍒犻櫎鎴愬姛')
+							// 	this.selectList()
+							// }).catch(e => {
+							// 	this.$message.error('鍒犻櫎澶辫触')
+							// })
+						}).catch(() => {})
+      },
+      // 淇濆瓨妯℃澘
+      addTemplateDia(){
+        if(this.templateName){
+          this.templateLoading = true;
+        }else{
+          this.$message.error('璇峰~鍐欐ā鏉垮悕绉�')
+        }
+      }
 		}
 	}
 </script>
diff --git a/src/components/view/a6-device-management.vue b/src/components/view/a6-device-management.vue
index 150759a..3e3fd6a 100644
--- a/src/components/view/a6-device-management.vue
+++ b/src/components/view/a6-device-management.vue
@@ -155,7 +155,7 @@
                     :key="item.value"
                     :label="item.label"
                     :value="item.value"
-                    > 
+                    >
                   </el-option>
                 </el-select>
               </el-form-item>
@@ -331,7 +331,7 @@
       <el-col  :span="7" >
         <el-col>
           <!-- 鍥剧墖 -->
-          <el-image class="img" style="width:100%;height: 320px;marginBottom:16px" :src="javaApi+'/img/'+formData2.imageUpload">
+          <el-image class="img" style="width:100%;height: 320px;margin-bottom:16px" :src="javaApi+'/img/'+formData2.imageUpload">
             <div slot="error" class="image-error" style="width: calc(100% -2px);
           height: 318px;
           border-radius: 16px;
@@ -503,12 +503,12 @@
             <el-form-item label="鏍″噯璇佷功:" >
             <el-input v-model="formData2.calibrationCerticate" size="small"></el-input>
             </el-form-item>
-            <el-form-item v-if="!isUp" label="鍥剧墖:" >
+            <el-form-item label="鍥剧墖:" >
               <div style="border: 1px solid #DCDFE6;border-radius:4px;height:32px;lineHeight:32px;display:flex;justify-content: space-around;font-size: 13px;">
                 <div v-show="formData2.imageName" class="picName">{{formData2.imageName}}</div>
                 <el-upload
                     :action="action"
-                    :on-success="handleSuccessUpImg"
+                    :on-success="handleSuccessUpImg2"
                     :show-file-list="false"
                     accept='image/jpg,image/jpeg,image/png'
                     :headers="headers"
@@ -526,7 +526,7 @@
     <span slot="footer" class="dialog-footer">
       <el-row >
         <el-button @click="handleClose2">鍙� 娑�</el-button>
-      <el-button type="primary" @click="submitForm" :loading="upLoad">纭� 瀹�</el-button>
+      <el-button type="primary" @click="submitForm2" :loading="upLoad2">纭� 瀹�</el-button>
       </el-row>
     </span>
   </el-dialog>
@@ -544,7 +544,10 @@
 				//鏄惁鏄。妗堜慨璁�  true涓嶆槸 false鏄�
 				isUp: true,
 				formData: {},
-        formData2: {},
+        formData2: {
+          imageUpload:'',
+          imageName:''
+        },
 				value: '',
 				options: [],
 				labelPosition: 'right',
@@ -615,6 +618,7 @@
         // 璁惧鐘舵�佸垪琛�
         deviceStatusList:[],
         upLoad:false,
+        upLoad2:false,
 			}
 		},
     computed: {
@@ -751,6 +755,14 @@
           this.formData.imageName = response.data.name;
         }
       },
+      handleSuccessUpImg2(response,){
+        if(response.code==200){
+          this.$nextTick(()=>{
+            this.formData2.imageUpload = response.data.url;
+            this.formData2.imageName = response.data.name;
+          })
+        }
+      },
       submitForm(){
         this.upLoad = true;
         let authorizedPerson = this.formData.authorizedPerson.length>0?this.formData.authorizedPerson.join(','):''
@@ -780,6 +792,8 @@
       },
       submitForm2(){
         this.upLoad2 = true;
+        let authorizedPerson = this.formData2.authorizedPerson.length>0?this.formData2.authorizedPerson.join(','):''
+        this.formData2.authorizedPerson = authorizedPerson
         this.$axios.post(this.$api.deviceScope.addDeviceParameter, this.formData2, {
 					headers: {
 						'Content-Type': 'application/json'
@@ -789,12 +803,16 @@
 						this.upLoad2 = false
 						return
 					}
-					this.$message.success('淇敼鎴愬姛')
-          this.upLoad = false
+					this.$message.success('鎻愪氦鎴愬姛')
+          this.upLoad2 = false
 					this.refreshTable()
           this.dialogVisible2 = false
+          this.formData2 = {
+            imageUpload:'',
+            imageName:''
+          }
 				}).catch(e => {
-					this.$message.error('淇敼澶辫触')
+					this.$message.error('鎻愪氦澶辫触')
 					this.dialogVisible2 = false
 					this.upLoad2 = false
 				})
diff --git a/src/components/view/b1-inspect-order-plan.vue b/src/components/view/b1-inspect-order-plan.vue
index 2c3f8b1..bb8dcaf 100644
--- a/src/components/view/b1-inspect-order-plan.vue
+++ b/src/components/view/b1-inspect-order-plan.vue
@@ -127,7 +127,7 @@
 				:url="$api.insOrderPlan.selectInsOrderPlanList" :upUrl="$api.user.updateUser" :componentData="componentData"
 				:key="upIndex" @upUser="upUser" />
 		</div>
-		<el-dialog title="鎻愮ず" :visible.sync="claimVisible" width="40%">
+		<el-dialog title="鎻愮ず" :visible.sync="claimVisible" width="400px">
 			鏄惁璁ら濮旀墭缂栧彿<span style="color:#33C130">{{sampleUserForm.entrustCode}}</span>鐨勪换鍔�
 			<span slot="footer" class="dialog-footer">
 				<el-button @click="claimVisible = false">鍙� 娑�</el-button>
@@ -364,4 +364,4 @@
 			}
 		}
 	}
-</script>
\ No newline at end of file
+</script>

--
Gitblit v1.9.3