懒羊羊
2023-12-14 03bb7a267ef4daa31ee435b4e540df385053d198
jcdm-ui/src/views/main/om/productionOrde/index.vue
@@ -142,7 +142,7 @@
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
      <el-table border @row-click="handleRowClick" v-loading="loading" :data="productionOrdeList" @selection-change="handleSelectionChange">
      <el-table border v-loading="loading" :data="productionOrdeList" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="生产工单号" width="160" align="center">
          <template slot-scope="scope">
@@ -205,60 +205,32 @@
        <el-table-column fixed="right" width="500" label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <!--  工单状态(1创建、2已发布、3生产中、4已冻结、5已完工、6已关闭) -->
            <el-button type="success"  style="width: 72px" plain @click="handleCommand('3',scope.row.id)" v-if="scope.row.orderStatus === '1'" size="mini">开始</el-button>
            <el-button style="width: 72px"  plain @click="handleCommand('4',scope.row.id)" v-if="scope.row.orderStatus === '2'|| scope.row.orderStatus === '3'" type="warning" size="mini">冻结</el-button>
            <el-button style="width: 72px" plain @click="handleCommand('3',scope.row.id)" v-if="scope.row.orderStatus === '4'" type="warning" size="mini">解冻</el-button>
            <el-button style="width: 72px" plain @click="handleCommand('6',scope.row.id)" v-if="scope.row.orderStatus === '1'" type="danger" size="mini">关闭</el-button>
            <el-button style="width: 72px" plain @click="handleCommand('1',scope.row.id)" v-if="scope.row.orderStatus === '6' " type="success" size="mini">启用</el-button>
            <el-button style="width: 72px" @click="handleCommand('5',scope.row.id)" v-if="scope.row.orderStatus === '3' || scope.row.orderStatus === '1'" type="success" size="mini">完成</el-button>
            <el-button style="width: 72px" v-if="scope.row.orderStatus === '5'" type="success" size="mini">已完工</el-button>
            <el-button type="success" :disabled="scope.row.orderStatus !== '1'"  style="width: 72px" plain @click="handleCommand('3',scope.row.id)" size="mini">开始</el-button>
            <el-button style="width: 72px" :disabled="scope.row.orderStatus !== '2' && scope.row.orderStatus !== '3'" v-if="scope.row.orderStatus !== '2'&&  scope.row.orderStatus !== '4'" plain @click="handleCommand('4',scope.row.id)" type="warning" size="mini">冻结</el-button>
            <el-button style="width: 72px" :disabled="scope.row.orderStatus !== '4'" v-if="scope.row.orderStatus === '4'" plain @click="handleCommand('3',scope.row.id)" type="warning" size="mini">解冻</el-button>
            <el-button style="width: 72px" :disabled="scope.row.orderStatus !== '1'" plain @click="handleCommand('6',scope.row.id)" v-if="scope.row.orderStatus === '1'||scope.row.orderStatus === '3'||scope.row.orderStatus === '4'||scope.row.orderStatus === '5'" type="danger" size="mini">关闭</el-button>
            <el-button style="width: 72px" :disabled="scope.row.orderStatus !== '6'" plain @click="handleCommand('1',scope.row.id)" v-if="scope.row.orderStatus === '6' " type="success" size="mini">启用</el-button>
            <el-button
              :disabled="scope.row.orderStatus !== '1'"
              size="mini"
              type="success"
              style="width: 72px"
              v-if="scope.row.orderStatus === '1'"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['om:productionOrde:edit']"
            >修改</el-button>
            <el-button
              :disabled="scope.row.orderStatus !== '1'"
              size="mini"
              type="warning"
              style="width: 72px"
              v-if="scope.row.orderStatus === '1'"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
              v-hasPermi="['om:productionOrde:remove']"
            >删除</el-button>
            <!--  工单状态(1创建、2已发布、3生产中、4已冻结、5已完工、6已关闭) -->
<!--            <el-button type="success" :disabled="isDisabled1" style="width: 72px" plain @click="handleCommandStart('3',scope.row.id)" size="mini">开始</el-button>-->
<!--            <el-button style="width: 72px" :disabled="isDisabled2" plain @click="handleCommandDonejie('4',scope.row.id)" v-if="scope.row.orderStatus === '1'|| scope.row.orderStatus === '3'|| scope.row.orderStatus === '5'" type="warning" size="mini">冻结</el-button>-->
<!--            <el-button style="width: 72px" :disabled="isDisabled3" plain @click="handleCommandJieDong('3',scope.row.id)" v-if="scope.row.orderStatus === '4'" type="warning" size="mini">解冻</el-button>-->
<!--            <el-button style="width: 72px" :disabled="isDisabled4" plain @click="handleCommand('6',scope.row.id)" v-if="scope.row.orderStatus === '3' || scope.row.orderStatus === '1'|| scope.row.orderStatus === '4'|| scope.row.orderStatus === '5'" type="danger" size="mini">关闭</el-button>-->
<!--            <el-button style="width: 72px" :disabled="isDisabled5" plain @click="handleCommand('1',scope.row.id)" v-if="scope.row.orderStatus === '6' " type="success" size="mini">启用</el-button>-->
<!--            <el-button-->
<!--              size="mini"-->
<!--              type="success"-->
<!--              :disabled="isDisabled8"-->
<!--              style="width: 72px"-->
<!--              v-if="scope.row.orderStatus === '3' || scope.row.orderStatus === '1'|| scope.row.orderStatus === '4'|| scope.row.orderStatus === '5'"-->
<!--              icon="el-icon-edit"-->
<!--              @click="handleUpdate(scope.row)"-->
<!--              v-hasPermi="['om:productionOrde:edit']"-->
<!--            >修改</el-button>-->
<!--            <el-button-->
<!--              size="mini"-->
<!--              type="warning"-->
<!--              :disabled="isDisabled9"-->
<!--              style="width: 72px"-->
<!--              v-if="scope.row.orderStatus === '3'|| scope.row.orderStatus === '1'|| scope.row.orderStatus === '4'|| scope.row.orderStatus === '5'"-->
<!--              icon="el-icon-delete"-->
<!--              @click="handleDelete(scope.row)"-->
<!--              v-hasPermi="['om:productionOrde:remove']"-->
<!--            >删除</el-button>-->
<!--            <el-button style="width: 72px" :disabled="isDisabled6" v-if="scope.row.orderStatus === '1'|| scope.row.orderStatus === '3'|| scope.row.orderStatus === '4'" @click="handleCommandFinish('5',scope.row.id)"  type="success" size="mini">完成</el-button>-->
<!--            <el-button style="width: 72px" :disabled="isDisabled7" v-if="scope.row.orderStatus === '5'" type="success" size="mini">已完工</el-button>-->
            <el-button style="width: 72px" :disabled="scope.row.orderStatus === '4'||scope.row.orderStatus === '6'" v-if="scope.row.orderStatus !== '5'" @click="handleCommand('5',scope.row.id)" type="success" size="mini">完成</el-button>
            <el-button style="width: 72px" :disabled="scope.row.orderStatus === '5'" v-if="scope.row.orderStatus === '5'" type="success" size="mini">已完工</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -296,7 +268,7 @@
          <el-input v-model="form.productName" disabled placeholder="请输入产品名称" />
        </el-form-item>
        <el-form-item label="车间编号" prop="workshopCode">
          <el-select style="width: 93%" @change="handleSelectChange(form.processesCode)" v-model="form.processesCode" placeholder="请选择车间编号">
          <el-select style="width: 93%" @change="handleSelectChange(form.processesCode)" v-model="form.workshopCode" placeholder="请选择车间编号">
            <el-option
              v-for="item in options"
              :key="item.workshopCode"
@@ -398,17 +370,6 @@
  data() {
    return {
      titleName: '',
      isDisabled1: false,
      isDisabled2: false,
      isDisabled3: false,
      isDisabled4: false,
      isDisabled5: false,
      isDisabled6: false,
      isDisabled7: false,
      isDisabled8: false,
      isDisabled9: false,
      options: [],
      lineOptions: [],
      showFlag:false,
@@ -472,47 +433,6 @@
    this.initWorkshop();
  },
  methods: {
    //完成
    handleCommandFinish(status,id){
      this.updateOrderState(status,id)
      this.isDisabled1 = true;
      this.isDisabled4 = true;
      this.isDisabled8 = true;
      this.isDisabled9 = true;
      this.isDisabled6 = true;
      this.isDisabled7 = true;
      this.isDisabled2 = true;
    },
    //解冻
    handleCommandJieDong(status,id){
      this.updateOrderState(status,id)
      this.isDisabled1 = true;
      this.isDisabled4 = true;
      this.isDisabled8 = true;
      this.isDisabled9 = true;
      this.isDisabled6 = false;
      this.isDisabled2 = false;
    },
    //冻结
    handleCommandDonejie(status,id){
      this.updateOrderState(status,id)
      this.isDisabled1 = true;
      this.isDisabled4 = true;
      this.isDisabled8 = true;
      this.isDisabled9 = true;
      this.isDisabled6 = true;
      this.isDisabled2 = true;
    },
    //开始
    handleCommandStart(status,id){
      this.updateOrderState(status,id)
      this.isDisabled1 = true;
      this.isDisabled4 = true;
      this.isDisabled8 = true;
      this.isDisabled9 = true;
      this.isDisabled2 = false;
    },
    initWorkshop(){
      listWorkshop(this.queryParams).then(response => {
        this.options = response.rows;
@@ -547,15 +467,7 @@
      this.advancedShowSearch = (this.advancedShowSearch) ? this.advancedShowSearch = false : this.advancedShowSearch = true;
    },
    handleCommand(status,id) {
      this.updateStatusParameter.id = id;
      this.updateStatusParameter.orderStatus = status;
      updateProductionOrde(this.updateStatusParameter).then(response => {
        this.$modal.msgSuccess("修改成功");
        this.open = false;
        this.getList();
      });
    },
    updateOrderState(status,id){
      console.log(status)
      this.updateStatusParameter.id = id;
      this.updateStatusParameter.orderStatus = status;
      updateProductionOrde(this.updateStatusParameter).then(response => {
@@ -649,6 +561,7 @@
      this.reset();
      const id = row.id || this.ids
      getProductionOrde(id).then(response => {
        console.log(response.data)
        this.form = response.data;
        this.open = true;
        this.titleName = "修改生产工单";