wangfei
2024-10-25 f8cfa3dc2450b88d0ba42006cb50e2073cc7ea0e
UI-Project/src/views/GlassStorage/rawfilmstorage.vue
@@ -17,6 +17,8 @@
const dialogFormVisiblea = ref(false)
const dialogFormVisibleb = ref(false)
const dialogFormVisiblec = ref(false)
const dialogFormVisiblee = ref(false)
const Edit = ref(false)
const timeRange = ref(["2022-01-01 00:00:00", "2025-01-01 00:00:00"])
const selectValuesa = reactive([]);
  const patternWidth = ref('');
@@ -25,15 +27,17 @@
  const filmsId = ref('');
  const remainQuantity = ref('');
  const slot = ref('');
  const leftingStation = ref('');
const loadingline = ref('');
  let webSocket: WebSocket | null = null;  
const value = ref('')
const options = [
  {
    value: 1,
    value: 98,
    label: t('film.warehousing1'),
  },
  {
    value: 2,
    value: 99,
    label: t('film.warehousing2'),
  }
]
@@ -59,7 +63,6 @@
  // console.log("--------------webSocket")
    socket = initializeWebSocket(socketUrl, handleMessage);
});
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/glassStorage/api/talk/rawGlass`;
const handleMessage = (data) => {
@@ -68,27 +71,21 @@
  }
  if(data.rawStationDetailsList !=null){
  tableDatab.value = data.rawStationDetailsList[0]
  console.log(tableDatab.value);
  }
};
// 修改数量
const handleConfirmb = async () => {
  let slotId = window.localStorage.getItem('slotId')
  try {
    const response = await request.post('/glassStorage/rawGlassStorageDetails/updateQuantity', {
      slotId: slotId,
      remainQuantity: remainQuantity.value,
  }
  );
    if (response.code === 200) {
      ElMessage.success(response.message);
      dialogFormVisiblec.value = false;
      tableDatab.value = response.data;
    } else {
      ElMessage.error(response.message);
    }
  } catch (error) {
    console.error(error);
  }
const handleEdit = (row) => {
  window.localStorage.setItem('slotId', row.slotId)
  Edit.value = true;
};
const handleBinda = (row) => {
  dialogFormVisibleb.value = true;
};
const handleBindc = (row) => {
  dialogFormVisiblec.value = true;
};
const handleBinde = (row) => {
  dialogFormVisiblee.value = true;
};
  // 删除 
 const deleteWarehousing = async(row) => {  
@@ -116,8 +113,72 @@
  } catch (error) {
    console.error('发生错误:', error);  
  }  
};
};
// 原片入库
const handleup = async () => {
  try {
    const response = await request.post('/glassStorage/rawGlassStorageDetails/patternWarehousing', {
      patternWidth: patternWidth.value,
      patternHeight: patternHeight.value,
      patternThickness: patternThickness.value,
      filmsId: filmsId.value,
      remainQuantity: remainQuantity.value,
      slot: slot.value,
    });
    if (response.code === 200) {
      ElMessage.success(response.message);
      dialogFormVisibleb.value = false;
      patternWidth.value = '';
      patternHeight.value = '';
      patternThickness.value = '';
      filmsId.value = '';
      remainQuantity.value = '';
      slot.value = '';
    } else {
      ElMessage.error(response.message);
    }
  } catch (error) {
    console.error(error);
  }
};
// 入库请求
const handleupc = async () => {
  try  {
    var url="/glassStorage/rawGlassStorageDetails/warehousingRequest?leftingStation="+leftingStation.value;
      const response = await request.post(url)
    if (response.code == 200) {
      ElMessage.success(response.message);
      dialogFormVisiblec.value = false;
      leftingStation.value = '';
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
    }
}
catch (error) {
    // 处理错误
    console.error(error);
  }
}
// 出库请求
const handleupe = async () => {
  try  {
    var url="/glassStorage/rawGlassStorageDetails/outWarehousingRequest?leftingStation="+leftingStation.value;
      const response = await request.post(url)
    if (response.code == 200) {
      ElMessage.success(response.message);
      dialogFormVisiblee.value = false;
      leftingStation.value = '';
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
    }
}
catch (error) {
    // 处理错误
    console.error(error);
  }
}
  // 出库 
  const openc = async(row) => {  
  try {
@@ -172,33 +233,6 @@
    ElMessage.error(response.message);
  }
};
// 入库
const handleConfirma = async () => {
  try {
    const response = await request.post('/glassStorage/rawGlassStorageDetails/patternWarehousing', {
      patternWidth: patternWidth.value,
      patternHeight: patternHeight.value,
      patternThickness: patternThickness.value,
      filmsId: filmsId.value,
      remainQuantity: remainQuantity.value,
      slotId: slot.value,
    });
    if (response.code === 200) {
      ElMessage.success(response.message);
      dialogFormVisibleb.value = false;
      patternWidth.value = '';
      patternHeight.value = '';
      patternThickness.value = '';
      filmsId.value = '';
      remainQuantity.value = '';
      slot.value = '';
    } else {
      ElMessage.error(response.message);
    }
  } catch (error) {
    console.error(error);
  }
};
// 是否禁用
const toggleEnableState = async (row: any) => {
  if (!row.deviceId) {  
@@ -220,9 +254,25 @@
    ElMessage.error(t('basicData.glassnull'));
  }
};
const handleEdit = (row) => {
  window.localStorage.setItem('slotId', row.slotId)
  dialogFormVisiblec.value = true;
// 修改数量
const Editclick = async () => {
  let slotId = window.localStorage.getItem('slotId')
  try {
    const response = await request.post('/glassStorage/rawGlassStorageDetails/updateQuantity', {
      slotId: slotId,
      remainQuantity: remainQuantity.value,
  }
  );
    if (response.code === 200) {
      ElMessage.success(response.message);
      Edit.value = false;
      tableDatab.value = response.data;
    } else {
      ElMessage.error(response.message);
    }
  } catch (error) {
    console.error(error);
  }
};
function getStatusType1(taskType) {  
switch (taskType) {  
@@ -277,7 +327,9 @@
  <div>
  <div style="display: flex; flex-direction: row; align-items: center; margin-top: 20px;">  
    <el-button style="margin-left: 20px;" id="searchButton" type="success" @click="dialogFormVisiblea = true">{{ $t('film.mes') }}</el-button>
  <el-button style="margin-left: 20px;" id="searchButton" type="success" @click="dialogFormVisibleb = true">{{ $t('film.warehousing') }}</el-button>
  <el-button style="margin-left: 20px;" id="searchButton" type="success" @click="handleBinda">{{ $t('film.warehousing') }}</el-button>
  <el-button style="margin-left: 20px;" id="searchButton" type="success" @click="handleBindc">{{ $t('film.pwarehousing') }}</el-button>
  <el-button style="margin-left: 20px;" id="searchButton" type="success" @click="handleBinde">{{ $t('film.pwareout') }}</el-button>
    <el-date-picker style="margin-left: 10px;"  v-model="timeRange" type="datetimerange"
        format="YYYY/MM/DD HH:mm:ss"  
        value-format="YYYY-MM-DD HH:mm:ss"
@@ -327,19 +379,17 @@
    </template> 
        </el-table-column>
          <el-table-column prop="createTime" align="center" :label="$t('film.createtime')" />
        </el-table>
      </div>
    </el-card>
    <div class="awatch">
    <img src="../../assets/ypcc.png" alt="" style="width: 100%;height: 120%;margin-left: 10px;position: relative;margin-top: -20px;"> 
</div>
    <el-dialog v-model="dialogFormVisiblea" top="5vh" width="85%" >
    <el-table  ref="table" style="margin-top: 20px;height: 700px;"
        :data="tableDatab" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column prop="deviceId" fixed align="center" :label="$t('film.station')" min-width="80"/>
          <el-table-column prop="slotId" fixed align="center" :label="$t('film.slot')" min-width="80"/>
          <el-table-column prop="slot" fixed align="center" :label="$t('film.slot')" min-width="80"/>
          <el-table-column prop="patternWidth" align="center" :label="$t('film.width')"  min-width="80" />
          <el-table-column prop="patternHeight" align="center" :label="$t('film.height')" min-width="80" />
          <el-table-column prop="patternThickness" align="center" :label="$t('film.thickness')" min-width="80" />
@@ -362,14 +412,14 @@
          </el-table-column>
          <el-table-column fixed="right" :label="$t('film.operate')" align="center" width="270">
            <template #default="scope">
              <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">{{ $t('film.exit') }}</el-button>
              <el-button size="mini" type="text" plain @click="deleteWarehousing(scope.row)">{{ $t('film.delete') }}</el-button>
              <el-button size="mini" type="text" plain @click="openc(scope.row)">{{ $t('film.outbound') }}</el-button>
              <el-button :disabled="!scope.row.remainQuantity" size="mini" type="text" plain @click="handleEdit(scope.row)">{{ $t('film.exit') }}</el-button>
              <el-button :disabled="!scope.row.remainQuantity" size="mini" type="text" plain @click="deleteWarehousing(scope.row)">{{ $t('film.delete') }}</el-button>
              <el-button :disabled="!scope.row.remainQuantity || scope.row.remainQuantity === 0" size="mini" type="text" plain @click="openc(scope.row)">{{ $t('film.outbound') }}</el-button>
            </template>
        </el-table-column>
        </el-table>
</el-dialog>
<el-dialog v-model="dialogFormVisibleb" top="23vh" width="55%" :title="$t('basicData.addglass')" >
<el-dialog v-model="dialogFormVisibleb" top="23vh" width="55%" :title="$t('film.addglass')" >
    <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;">
            <el-form  size="mini" label-width="150px">
      <el-form label-width="100px" label-position="right">
@@ -438,14 +488,50 @@
          </div>
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="handleConfirma">
        <el-button type="primary" @click="handleup">
          {{ $t('basicData.confirm') }}
        </el-button>
        <el-button @click="dialogFormVisibleb = false">{{ $t('basicData.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog>
<el-dialog v-model="dialogFormVisiblec" top="21vh" width="40%">
<el-dialog v-model="dialogFormVisiblec" top="24vh" width="30%" :title="$t('film.pwarehousing')">
    <div style="margin-left: 50px;margin-bottom: 10px;">
    <el-form-item :label="$t('film.position')" :required="true">
    <el-select v-model="leftingStation" clearable :placeholder="$t('film.cposition')" style="margin-left: 20px;" >
      <el-option :label="$t('film.position1')" value="98"></el-option>
      <el-option :label="$t('film.position2')" value="99"></el-option>
    </el-select>
    </el-form-item>
    </div>
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="handleupc">
          {{ $t('basicData.confirm') }}
        </el-button>
        <el-button @click="dialogFormVisiblec = false">{{ $t('basicData.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog>
<el-dialog v-model="dialogFormVisiblee" top="24vh" width="30%" :title="$t('film.pwareout')">
    <div style="margin-left: 50px;margin-bottom: 10px;">
    <el-form-item :label="$t('film.position')" :required="true">
    <el-select v-model="leftingStation" clearable :placeholder="$t('film.cposition')" style="margin-left: 20px;" >
      <el-option :label="$t('film.position1')" value="98"></el-option>
      <el-option :label="$t('film.position2')" value="99"></el-option>
    </el-select>
    </el-form-item>
    </div>
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="handleupe">
          {{ $t('basicData.confirm') }}
        </el-button>
        <el-button @click="dialogFormVisiblee = false">{{ $t('basicData.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog>
  <el-dialog v-model="Edit" top="21vh" width="40%">
    <div style="margin-left: 50px;margin-top: 10px;margin-bottom: 10px;">
      <el-form size="mini" label-width="100px">
        <el-form label-width="210px" label-position="right">
@@ -457,10 +543,10 @@
    </div>
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="handleConfirmb">
        <el-button type="primary" @click="Editclick">
          {{ $t('reportWork.sure') }}
        </el-button>
        <el-button @click="dialogFormVisiblec = false">{{ $t('reportWork.cancel') }}</el-button>
        <el-button @click="Edit = false">{{ $t('reportWork.cancel') }}</el-button>
      </div>
    </template>
  </el-dialog>