Browse Source

update:添加设备已损坏

zoie 1 month ago
parent
commit
2b547f5154

+ 16 - 2
src/views/storehouse/ValidationTool/modules/snAdd.vue

@@ -118,6 +118,7 @@ const submitForm = () => {
 				ElMessage.warning('已存在相同的SN,不能添加')
 				return
 			}
+			// 1-已出库 2-待使用(已入库)  3-维修中 4-已报废
 			if (data.title == '归还' ) {
 				const result: any = await readValidation({sn: extractedSN})
 				if (result.Code !== 200) {
@@ -128,10 +129,23 @@ const submitForm = () => {
 					ElMessage.error('当前SN已入库!')
 					return
 				}
+				if (result.Data.T_state == 5) {
+					ElMessage.warning('设备已损坏')
+
+					if ('speechSynthesis' in window) {
+						const utterance = new SpeechSynthesisUtterance('设备已损坏')
+						window.speechSynthesis.speak(utterance)
+					} else {
+						console.warn('Web Speech API 不被支持')
+					}
+				}
 			}
-
-			data.snItems.unshift({...data.fromData, T_sn: extractedSN})
 			data.fromData.T_sn = ''
+			data.snItems.unshift({...data.fromData, T_sn: extractedSN})
+			data.snItems.value = data.snItems.value.filter((value:any, index:any, self:any) => {  //去重
+				return self.findIndex((t:any) => (t.T_sn === value.T_sn)) === index;
+			});
+
 			ElMessage.success('已添加到待提交列表')
 			if ('speechSynthesis' in window) {
 				const utterance = new SpeechSynthesisUtterance('添加成功')

+ 17 - 1
src/views/storehouse/ValidationTool/validation.vue

@@ -54,7 +54,8 @@ const options = reactive([
 	{name: '已出库', id: 1},
 	{name: '未出库', id: 2},
 	{name: '维修中', id: 3},
-	{name: '已报废', id: 4}
+	{name: '已报废', id: 4},
+	{name: '已损坏', id: 5}
 ])
 const searchHandle = () => {
 	TableRef.value?.searchTable()
@@ -272,10 +273,21 @@ const submitLendForm = () => {
 				ElMessage.warning('当前SN未入库不能借出')
 				return
 			}
+			if (result.Data.T_state == 5) {
+				ElMessage.warning('设备已损坏')
+				if ('speechSynthesis' in window) {
+					const utterance = new SpeechSynthesisUtterance('设备已损坏')
+					window.speechSynthesis.speak(utterance)
+				} else {
+					console.warn('Web Speech API 不被支持')
+				}
+				return
+			}
 			if (result.Data.T_state != 2) {
 				ElMessage.warning('当前SN未入库不能借出')
 				return
 			}
+
 			pendingLendItems.value.unshift({
 				T_sn: extractedSN,
 				Validationnumber: lendForm.Validationnumber,
@@ -283,6 +295,9 @@ const submitLendForm = () => {
 				LendUser: lendForm.LendUser,
 				T_project: lendForm.T_project
 			})
+			pendingLendItems.value = pendingLendItems.value.filter((value:any, index:any, self:any) => {  //去重
+				return self.findIndex((t:any) => (t.T_sn === value.T_sn)) === index;
+			});
 			lendForm.T_sn = ''
 			lendForm.T_remark = ''
 			ElMessage.success('已添加到待提交列表')
@@ -569,6 +584,7 @@ onMounted(() => {
 				<el-tag v-if="row.T_state == 2" effect="dark">未出库</el-tag>
 				<el-tag v-if="row.T_state == 3" effect="dark" type="warning">维修中</el-tag>
 				<el-tag v-if="row.T_state == 4" effect="dark" type="danger">已报废</el-tag>
+				<el-tag v-if="row.T_state == 5" effect="dark" type="info">已损坏</el-tag>
 			</template>
 			<template #T_class="{ row }">
 				<el-tag>{{ Pruductoptions.find(option => option.Id === row.T_class)?.T_name || '' }}</el-tag>

+ 9 - 2
src/views/storehouse/outStock/modules/InStorageEdit.vue

@@ -172,6 +172,7 @@ const ProductSelectionAllChange = (selection: any[]) => {
   tableData.value = selection
 }
 
+
 const getStorehouseContractGet = async (Id:any) => {
   const res: any = await Storehouse_StockOut_Get({ User_tokey: globalStore.GET_User_tokey, T_number:Id })
   if (res.Code === 200) {
@@ -389,12 +390,18 @@ defineExpose({
       </el-form>
     </Drawer>
     <ReceiveUser ref="receiveUserdialog" :dept_leader="0" @onUserInfo="getReceiveInfo" title="选择经办人" />
-	  <OutStockProduct
+<!--	  <OutStockProduct-->
+<!--		  ref="drawerProductRef"-->
+<!--		  :depotId="form.T_depot_id"-->
+<!--		  @ontableData="ProductselectionChange"-->
+<!--		  @ontableDataAll="ProductSelectionAllChange"-->
+<!--	  />-->
+	  <InStorageProduct
 		  ref="drawerProductRef"
-		  :depotId="form.T_depot_id"
 		  @ontableData="ProductselectionChange"
 		  @ontableDataAll="ProductSelectionAllChange"
 	  />
+
   </div>
 </template>
 <style scoped lang="scss">