loulijun2021
2023-03-06 3b956ef69d23f52e5a52812259c6ff967723695e
src/views/scgl/gd.vue
@@ -182,7 +182,12 @@
            label="源单单号"
            sortable="custom"
            min-width="160"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.m_po">{{ row.m_po }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="wotype"
            label="单据类型"
@@ -314,11 +319,6 @@
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip class="item" effect="dark" content="打印工单" placement="top">
                  <!--                  <i-->
                  <!--                    class="el-icon-tickets"-->
                  <!--                    style="cursor: pointer;color: #42b983;margin-right: 15px"-->
                  <!--                    @click="check(row)"-->
                  <!--                  />-->
                  <i
                    class="el-icon-tickets"
                    style="cursor: pointer;color: #42b983;margin-right: 15px"
@@ -418,6 +418,9 @@
                    style="cursor: pointer;color: #42b983;margin-right: 15px"
                    @click="supplementSmallClick(row)"
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="预览" placement="top">
                  <i class="el-icon-files" style="cursor: pointer;color:#42b983;" @click="check(row)" />
                </el-tooltip>
              </div>
            </template>
@@ -578,6 +581,7 @@
              style="width: 200px;"
              placeholder="请选择"
              :disabled="dialogForm.routecode===''"
              @change="wkshopcodeChange"
            >
              <el-option
                v-for="item in wkshopArr"
@@ -593,6 +597,7 @@
            v-model="dialogForm.planstartdate"
            type="date"
            :clearable="false"
            :picker-options="pickerOptions"
            value-format="yyyy-MM-dd"
            style="width: 200px"
            placeholder="选择日期"
@@ -603,6 +608,7 @@
            v-model="dialogForm.planenddate"
            type="date"
            :clearable="false"
            :picker-options="pickerOptions"
            value-format="yyyy-MM-dd"
            style="width: 200px"
            placeholder="选择日期"
@@ -682,9 +688,19 @@
          <el-button @click="dialogVisibleCancel">取 消</el-button>
          <!--          <el-button v-if="operation==='add'" type="primary" @click="dialogVisibleConfirmPreview('add')">预览</el-button>-->
          <el-button
            v-if="!sumbitBottonIsDisabled"
            v-waves
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirm"
          >确 定</el-button>
          <el-button
            v-if="sumbitBottonIsDisabled"
            v-waves
            type="primary"
            disabled
            @click="dialogVisibleConfirm"
          >确 定</el-button>
        </div>
@@ -1550,6 +1566,46 @@
      </span>
    </el-dialog>
    <el-dialog
      title="文件预览"
      :visible.sync="dialogVisibleCheck"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleCloseCheck"
      @close="handleCloseCheck"
    >
      <el-form label-width="80px">
        <el-form-item label="文件版本">
          <el-select
            v-model="sopSelectValue"
            style="width: 200px"
            placeholder="请选择"
            filterable
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in sopSelectArr"
              :key="item.id"
              :label="item.define_name"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisibleCancelCheck">返 回</el-button>
          <el-button
            type="primary"
            @click="dialogVisibleConfirmCheck"
          >预 览</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>
@@ -1559,7 +1615,7 @@
  AddUpdateMesOrder,
  ClosedMesOrder,
  DeleteMesOrder, ErpOrderSearch,
  MesOrderSearch, PartSelectRoute, RouteSelectWkshop, SearchWorkStep,
  MesOrderSearch, PartSelectRoute, RouteSelectWkshop, SearchWorkStep, SearchWorkStepSopList, SelectRouteOrWkshop,
  SelectRouteStep
} from '@/api/scgl'
import { InventoryFileAssociationRoute, PartSelect, SaveInventoryFile } from '@/api/zzmx'
@@ -1569,6 +1625,7 @@
import { urlAddRandomNo, webapp_ws_ajax_run, webapp_ws_autoupdate } from '@/utils/grwebapp'
import QRCode from 'qrcodejs2'
import $ from 'jquery'
import { SystemSopView } from '@/api/xtsz'
export default {
  name: 'GD',
@@ -1786,7 +1843,18 @@
        // { code: 3, name: '50*40' },
        // { code: 4, name: '50*80' },
        // { code: 5, name: '40*30' }
      ]
      ],
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7
        }
      },
      /* 文件预览部分*/
      dialogVisibleCheck: false,
      sopSelectArr: [], // sop下拉选项数组
      sopSelectValue: '', // sop下拉选中值
      sumbitBottonIsDisabled: false
    }
  },
  created() {
@@ -1895,6 +1963,20 @@
    getCurrentRow(wo_code) {
      this.radioSelected = wo_code
    },
    // 生产车间值改变时
    wkshopcodeChange(val) {
      const data = {
        partcode: this.dialogForm.partcode,
        routecode: this.dialogForm.routecode,
        wkshopcode: val
      }
      SelectRouteOrWkshop(data).then((res) => {
        // console.log(res, 1)
      }).catch(err => {
        // console.log(err, 2)
        this.sumbitBottonIsDisabled = true
      })
    },
    // 新增按钮
    async add(operation) {
      this.operation = operation
@@ -1923,6 +2005,8 @@
      }
      this.dialogForm.wkshopcode = ''
      this.sumbitBottonIsDisabled = false
    },
    // 工艺路线值改变
    async routecodeChange(val) {
@@ -1934,18 +2018,34 @@
      const { data: res2 } = await RouteSelectWkshop(data)
      this.wkshopArr = res2
      this.dialogForm.wkshopcode = ''
      this.sumbitBottonIsDisabled = false
    },
    // 工序任务
    // 预览
    async check(row) {
      const { data: res } = await SearchWorkStep({ wo_code: row.wo_code })
      this.taskTableData = res
      if (this.taskTableData.length === 0) {
        return this.$message.info('无生产任务数据!')
      this.dialogVisibleCheck = true
      const data = {
        partcode: row.partcode,
        routecode: this.tableData.find(i => i.wo_code === this.radioSelected).route_code,
        stepcode: row.stepcode
      }
      this.dialogForm.mesordercode = res[0].wo_code
      this.dialogVisibleTask = true
      const { data: res } = await SearchWorkStepSopList(data)
      this.sopSelectArr = res
      this.sopSelectValue = res[0].id
    },
    // 预览关闭
    handleCloseCheck() {
      this.sopSelectValue = ''
    },
    // 预览返回
    dialogVisibleCancelCheck() {
      this.dialogVisibleCheck = false
    },
    // 预览新开浏览器页签
    async dialogVisibleConfirmCheck() {
      const { data: res } = await SystemSopView({ id: this.sopSelectValue, filepath: this.sopSelectArr.find(i => i.id === this.sopSelectValue).file_path })
      window.open(res)
    },
    dialogVisibleBack() {
      this.dialogVisibleTask = false
    },
@@ -2079,6 +2179,7 @@
      this.dialogForm.orderlev = '' // 工单等级
      this.$refs.dialogForm.clearValidate()
      this.sumbitBottonIsDisabled = false
    },
    // 对话框取消
    dialogVisibleCancel() {
@@ -2210,9 +2311,9 @@
            // div.scrollTop = div.scrollHeight // 滚动条位于最底部
            div.scrollTop = 0 // 滚动条位于最顶部
          })
          this.dialogVisibleApprove = true
        }
      })
      this.dialogVisibleApprove = true
    },
    dialogVisibleTaskClose() {
      this.dialogForm.mesordercode = ''