Junjie
13 小时以前 f305e5244e059c5e43566412f69b180e2e790026
src/main/webapp/components/WatchDualCrnCard.js
@@ -47,8 +47,28 @@
              <el-descriptions border direction="vertical">
                <el-descriptions-item label="模式">{{ item.mode }}</el-descriptions-item>
                <el-descriptions-item label="异常码">{{ item.warnCode }}</el-descriptions-item>
                <el-descriptions-item label="工位1任务号">{{ item.taskNo }}</el-descriptions-item>
                <el-descriptions-item label="工位2任务号">{{ item.taskNoTwo }}</el-descriptions-item>
                <el-descriptions-item label="工位1任务号">
                  <span v-if="readOnly">{{ item.taskNo }}</span>
                  <el-button
                    v-else
                    type="text"
                    size="mini"
                    style="padding:0;"
                    @click.stop="editTaskNo(item, 1)"
                  >{{ item.taskNo }}</el-button>
                </el-descriptions-item>
                <el-descriptions-item label="工位2任务号">
                  <span v-if="readOnly">{{ item.taskNoTwo }}</span>
                  <el-button
                    v-else
                    type="text"
                    size="mini"
                    style="padding:0;"
                    @click.stop="editTaskNo(item, 2)"
                  >{{ item.taskNoTwo }}</el-button>
                </el-descriptions-item>
                <el-descriptions-item label="设备工位1任务号">{{ item.deviceTaskNo }}</el-descriptions-item>
                <el-descriptions-item label="设备工位2任务号">{{ item.deviceTaskNoTwo }}</el-descriptions-item>
                <el-descriptions-item label="工位1状态">{{ item.status }}</el-descriptions-item>
                <el-descriptions-item label="工位2状态">{{ item.statusTwo }}</el-descriptions-item>
                <el-descriptions-item label="工位1是否有物">{{ item.loading }}</el-descriptions-item>
@@ -163,6 +183,50 @@
    openControl() {
      this.showControl = !this.showControl;
    },
    editTaskNo(item, station) {
      let that = this;
      const isStationOne = station === 1;
      const fieldName = isStationOne ? "taskNo" : "taskNoTwo";
      const stationName = isStationOne ? "工位1" : "工位2";
      const currentTaskNo = item[fieldName] == null ? "" : String(item[fieldName]);
      that.$prompt("请输入" + stationName + "任务号", "编辑任务号", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        inputValue: currentTaskNo,
        inputPattern: /^\d+$/,
        inputErrorMessage: "任务号必须是非负整数",
      }).then(({ value }) => {
        const taskNo = Number(value);
        $.ajax({
          url: baseUrl + "/dualcrn/command/updateTaskNo",
          headers: {
            token: localStorage.getItem("token"),
          },
          contentType: "application/json",
          method: "post",
          data: JSON.stringify({
            crnNo: item.crnNo,
            station: station,
            taskNo: taskNo,
          }),
          success: (res) => {
            if (res.code == 200) {
              item[fieldName] = taskNo;
              that.$message({
                message: stationName + "任务号更新成功",
                type: "success",
              });
              that.getDualCrnStateInfo();
            } else {
              that.$message({
                message: res.msg,
                type: "warning",
              });
            }
          },
        });
      }).catch(() => {});
    },
    getDualCrnStateInfo() {
      if (this.$root.sendWs) {
        this.$root.sendWs(JSON.stringify({