小小儁爺
2024-08-08 d20654ba067e5c0621d4d7d95915cbe47a10fe87
src/views/makeModel/InventoryList.vue
@@ -48,21 +48,28 @@
              <el-input v-model="form.partspec" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="存货类型" style=" display: flex;">
              <el-select
                v-model="form.stocktypecode"
              <el-cascader
                ref="cascader"
                :options="stocktypeArr"
                filterable
                :popper-append-to-body="false"
                style="width: 200px"
                placeholder="请选择"
              >
                <!--                @change="val=>stocktypecodeChange(val,'form')"-->
                <el-option
                  v-for="item in stocktypeArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
                :props="defaultProps"
                @change="val=>cascaderChange(val,'form')"
              />
              <!--              <el-select-->
              <!--                v-model="form.stocktypecode"-->
              <!--                filterable-->
              <!--                :popper-append-to-body="false"-->
              <!--                style="width: 200px"-->
              <!--                placeholder="请选择"-->
              <!--              >-->
              <!--                &lt;!&ndash;                @change="val=>stocktypecodeChange(val,'form')"&ndash;&gt;-->
              <!--                <el-option-->
              <!--                  v-for="item in stocktypeArr"-->
              <!--                  :key="item.code"-->
              <!--                  :label="item.name"-->
              <!--                  :value="item.code"-->
              <!--                />-->
              <!--              </el-select>-->
            </el-form-item>
            <el-form-item v-if="false" label="物料类型" style=" display: flex;">
              <el-select
@@ -218,7 +225,7 @@
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="total,prev, pager, next,sizes"
        layout="total,prev, pager, next,sizes,jumper"
        popper-class="select_bottom"
        @pagination="getInventoryFileSelect"
      />
@@ -272,22 +279,31 @@
          </el-select>
        </el-form-item>
        <el-form-item label="存货类型" prop="stocktypecode">
          <el-select
            v-model="dialogForm.stocktypecode"
            filterable
            :popper-append-to-body="false"
            style="width: 200px"
            placeholder="请选择"
          >
            <!--            @change="val=>stocktypecodeChange(val,'dialogForm')"-->
            <el-option
              v-for="item in stocktypeArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
          <el-cascader
            ref="cascaderDialog"
            :options="stocktypeArr"
            filterable
            :props="defaultPropsDialog"
            @change="val=>cascaderChange(val,'dialogForm')"
          />
          <!--          <el-select-->
          <!--            v-model="dialogForm.stocktypecode"-->
          <!--            filterable-->
          <!--            :popper-append-to-body="false"-->
          <!--            style="width: 200px"-->
          <!--            placeholder="请选择"-->
          <!--          >-->
          <!--            &lt;!&ndash;            @change="val=>stocktypecodeChange(val,'dialogForm')"&ndash;&gt;-->
          <!--            <el-option-->
          <!--              v-for="item in stocktypeArr"-->
          <!--              :key="item.code"-->
          <!--              :label="item.name"-->
          <!--              :value="item.code"-->
          <!--            />-->
          <!--          </el-select>-->
        </el-form-item>
        <el-form-item label="所属仓库" prop="warehousecode">
          <el-select
@@ -336,85 +352,85 @@
        </el-form-item>
      </el-form>
      <el-collapse>
        <el-collapse-item title="一致性 Consistency" name="1">
          <template slot="title">
            <div>
              <i
                class="el-icon-s-operation"
                :style="{color:$store.state.settings.theme}"
                style="margin: -20px 10px 20px 20px"
              />高级设置:
            </div>
          </template>
          <div
            style="display: flex;flex-direction: column;height: 140px; align-content: center;justify-content: space-between"
          >
            <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">
              <div>
                <el-tooltip
                  class="item"
                  effect="dark"
                  content=""
                  placement="top"
                >
                  <div slot="content" style="width: 300px">
                    启用管理后库存数量会按标签分开显示,需要做采购到货才能入库,且生产发料需要扫码标签进行发料,不启用批次管理的不需要采购到货,可以直接选择物料采购入库,且入库后会合并显示该物料的库存,生产发料则按库位进行出库。
                  </div>
                  <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />
                </el-tooltip>
              </div>
      <!--      <el-collapse>-->
      <!--        <el-collapse-item title="一致性 Consistency" name="1">-->
      <!--          <template slot="title">-->
      <!--            <div>-->
      <!--              <i-->
      <!--                class="el-icon-s-operation"-->
      <!--                :style="{color:$store.state.settings.theme}"-->
      <!--                style="margin: -20px 10px 20px 20px"-->
      <!--              />高级设置:-->
      <!--            </div>-->
      <!--          </template>-->
      <!--          <div-->
      <!--            style="display: flex;flex-direction: column;height: 140px; align-content: center;justify-content: space-between"-->
      <!--          >-->
      <!--            <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">-->
      <!--              <div>-->
      <!--                <el-tooltip-->
      <!--                  class="item"-->
      <!--                  effect="dark"-->
      <!--                  content=""-->
      <!--                  placement="top"-->
      <!--                >-->
      <!--                  <div slot="content" style="width: 300px">-->
      <!--                    启用管理后库存数量会按标签分开显示,需要做采购到货才能入库,且生产发料需要扫码标签进行发料,不启用批次管理的不需要采购到货,可以直接选择物料采购入库,且入库后会合并显示该物料的库存,生产发料则按库位进行出库。-->
      <!--                  </div>-->
      <!--                  <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />-->
      <!--                </el-tooltip>-->
      <!--              </div>-->
              <div style="margin: 0 3px">批次管理:</div>
              <el-switch
                v-model="isBatchNo"
              />
            </div>
            <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">
              <div style="margin: 0 3px">先进先出:</div>
              <el-switch
                v-model="isFifo"
              />
            </div>
            <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">
              <div>
                <el-tooltip
                  class="item"
                  effect="dark"
                  content=""
                  placement="top"
                >
                  <div slot="content" style="width: 300px">开启后该物料必须做入厂检验或质量判断合格后才能做入厂反则该物料质量状态为待检状态是不允许入厂的。</div>
                  <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />
                </el-tooltip>
              </div>
      <!--              <div style="margin: 0 3px">批次管理:</div>-->
      <!--              <el-switch-->
      <!--                v-model="isBatchNo"-->
      <!--              />-->
      <!--            </div>-->
      <!--            <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">-->
      <!--              <div style="margin: 0 3px">先进先出:</div>-->
      <!--              <el-switch-->
      <!--                v-model="isFifo"-->
      <!--              />-->
      <!--            </div>-->
      <!--            <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">-->
      <!--              <div>-->
      <!--                <el-tooltip-->
      <!--                  class="item"-->
      <!--                  effect="dark"-->
      <!--                  content=""-->
      <!--                  placement="top"-->
      <!--                >-->
      <!--                  <div slot="content" style="width: 300px">开启后该物料必须做入厂检验或质量判断合格后才能做入厂反则该物料质量状态为待检状态是不允许入厂的。</div>-->
      <!--                  <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />-->
      <!--                </el-tooltip>-->
      <!--              </div>-->
              <div style="margin: 0 3px">入厂检验:</div>
              <el-switch
                v-model="isInCheck"
              />
            </div>
            <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">
              <div>
                <el-tooltip
                  class="item"
                  effect="dark"
                  content=""
                  placement="top"
                >
                  <div slot="content" style="width: 300px">开启后该物料必须做出厂检验或质量判断合格后才能做出厂,反则该物料质量状态为待检状态是不允许出厂的。</div>
                  <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />
                </el-tooltip>
              </div>
      <!--              <div style="margin: 0 3px">入厂检验:</div>-->
      <!--              <el-switch-->
      <!--                v-model="isInCheck"-->
      <!--              />-->
      <!--            </div>-->
      <!--            <div style="display: flex;width: 200px;align-content: center;justify-content: flex-end">-->
      <!--              <div>-->
      <!--                <el-tooltip-->
      <!--                  class="item"-->
      <!--                  effect="dark"-->
      <!--                  content=""-->
      <!--                  placement="top"-->
      <!--                >-->
      <!--                  <div slot="content" style="width: 300px">开启后该物料必须做出厂检验或质量判断合格后才能做出厂,反则该物料质量状态为待检状态是不允许出厂的。</div>-->
      <!--                  <i class="el-icon-question" :style="{color:$store.state.settings.theme}" />-->
      <!--                </el-tooltip>-->
      <!--              </div>-->
              <div style="margin: 0 3px">出厂检验:</div>
              <el-switch
                v-model="isOutCheck"
              />
            </div>
          </div>
        </el-collapse-item>
      </el-collapse>
      <!--              <div style="margin: 0 3px">出厂检验:</div>-->
      <!--              <el-switch-->
      <!--                v-model="isOutCheck"-->
      <!--              />-->
      <!--            </div>-->
      <!--          </div>-->
      <!--        </el-collapse-item>-->
      <!--      </el-collapse>-->
      <!--      </div>-->
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
@@ -615,26 +631,26 @@
        </div>
      </div>
      <el-divider />
      <div>
        <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 默认工艺路线
      </div>
      <div style="margin-top: 20px">
        <el-select
          v-model="defaultroute_code"
          filterable
          style="width: 200px;"
          placeholder="请选择"
          class="defaultroute_code"
        >
          <el-option
            v-for="item in defaultroute_codeArr"
            :key="item.code"
            :label="item.name"
            :value="item.code"
          />
        </el-select>
      </div>
      <!--      <el-divider   />-->
      <!--      <div  >-->
      <!--        <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 默认工艺路线-->
      <!--      </div>-->
      <!--      <div  style="margin-top: 20px">-->
      <!--        <el-select-->
      <!--          v-model="defaultroute_code"-->
      <!--          filterable-->
      <!--          style="width: 200px;"-->
      <!--          placeholder="请选择"-->
      <!--          class="defaultroute_code"-->
      <!--        >-->
      <!--          <el-option-->
      <!--            v-for="item in defaultroute_codeArr"-->
      <!--            :key="item.code"-->
      <!--            :label="item.name"-->
      <!--            :value="item.code"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </div>-->
      <el-divider />
      <div style="margin-bottom: 10px">
        <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 工序列表
@@ -720,9 +736,10 @@
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import TableColumnSettings from '@/components/TableColumnSettings'
import arrayToTree from 'array-to-tree'
export default {
  name: 'CHDA',
  name: 'InventoryList',
  components: {
    Pagination, TableColumnSettings
  },
@@ -976,12 +993,25 @@
        // routeOperationSelectedArr: [] // 工艺路线选中集合数组
      },
      defaultroute_code: '', // 默认工艺路线选中值
      defaultroute_codeArr: '', // 默认工艺路线数组
      defaultroute_codeArr: [], // 默认工艺路线数组
      projectTableData: [], // 设备列表
      isBatchNo: false, // 是否批次管理
      isFifo: false, // 是否先进先出
      isInCheck: false, // 是否入库检验
      isOutCheck: false// 是否出厂检验
      isOutCheck: false, // 是否出厂检验
      defaultProps: {
        checkStrictly: true,
        expandTrigger: 'hover',
        value: 'code',
        label: 'name'
      },
      defaultPropsDialog: {
        // checkStrictly: true,
        expandTrigger: 'hover',
        value: 'code',
        label: 'name'
      }
    }
  },
  created() {
@@ -1079,6 +1109,34 @@
        }, 10000)
      }
    },
    cascaderChange(val, type) {
      if (type === 'form') {
        this.form.stocktypecode = val[val.length - 1]
      }
      if (type === 'dialogForm') {
        this.dialogForm.stocktypecode = val[val.length - 1]
      }
    },
    // parents:用于返回的数组,childNode:要查询的节点,treeData:json树形数据
    findParent(parents, childNode, treeData) {
      for (let i = 0; i < treeData.length; i++) {
        // 父节点查询条件
        if (treeData[i].code === childNode) {
          // 如果找到结果,保存当前节点
          parents.push(treeData[i].code)
          // 用当前节点再去原数据查找当前节点的父节点
          this.findParent(parents, treeData[i].iparent_id, this.stocktypeArr)
          break
        } else {
          if (treeData[i].children instanceof Array) {
            //   没找到,遍历该节点的子节点
            this.findParent(parents, childNode, treeData[i].children)
          }
        }
      }
      return parents
    },
    async getInventoryFileSelect() {
      const res = await InventoryFileSelect(this.form)
      this.tableData = res.data
@@ -1087,7 +1145,13 @@
    },
    async getStockTypeSelect() {
      const { data: res } = await StockTypeSelect()
      this.stocktypeArr = res
      this.stocktypeArr = arrayToTree(res, {
        parentProperty: 'iparent_id',
        customID: 'code',
        childrenProperty: 'children'
      })
      console.log(this.stocktypeArr, 2)
    },
    async getWareHouseSelect() {
      const { data: res } = await WareHouseSelect()
@@ -1139,6 +1203,7 @@
      this.form.stocktypecode = ''
      this.form.materialtypecode = ''
      this.form.storehousecode = ''
      this.$refs.cascader.checkedValue = ''
      this.getInventoryFileSelect()
    },
    // 新增按钮
@@ -1149,10 +1214,14 @@
    },
    // 修改按钮
    async edit(operation, row) {
      const cascaderCheckedValue = this.findParent([], row.stocktypecode, this.stocktypeArr)
      this.operation = operation
      this.dialogVisible = true
      // await this.stocktypecodeChange(row.stocktypecode, 'dialogForm')
      this.$nextTick(() => {
        this.$refs.cascaderDialog.checkedValue = cascaderCheckedValue.reverse()
        this.dialogForm.id = row.id
        this.dialogForm.materialcode = row.partcode
        this.dialogForm.materialname = row.partname
@@ -1205,6 +1274,7 @@
      this.isFifo = false
      this.isInCheck = false
      this.isOutCheck = false
      this.$refs.cascaderDialog.checkedValue = ''
      this.$refs.dialogForm.clearValidate()
    },
    // 对话框取消
@@ -1271,7 +1341,8 @@
        background: 'rgba(0, 0, 0, 0.7)'
      })
      this.defaultroute_code = row.default_route
      // this.defaultroute_code = row.default_route
      // this.defaultroute_code = ''
      this.dialogFormRoute.projectCode = row.partcode
      this.dialogFormRoute.projectName = row.partname
@@ -1310,7 +1381,7 @@
              }
            })
            this.defaultroute_codeArr = this.dialogFormRoute.routeOperationArr.filter(item => item.flag === 'Y')
            // this.defaultroute_codeArr = this.dialogFormRoute.routeOperationArr.filter(item => item.flag === 'Y')
          }, 1000)
        } else {
          loading.close()
@@ -1320,7 +1391,7 @@
    // 对话框关闭
    handleCloseRoute() {
      this.dialogFormRoute.routeOperationArr = []
      this.defaultroute_codeArr = []
      // this.defaultroute_codeArr = []
    },
    // 取消
    routeDialogVisibleCancel() {
@@ -1328,20 +1399,26 @@
    },
    // 确定
    async routeDialogVisibleConfirm() {
      console.log(this.defaultroute_code)
      if (this.defaultroute_code === null || this.defaultroute_code === 'null') {
        return this.$message.info('默认工艺路线不能为空!')
      }
      // console.log(this.defaultroute_code)
      // if (this.defaultroute_code === null || this.defaultroute_code === 'null') {
      //   return this.$message.info('默认工艺路线不能为空!')
      // }
      // 提交格式
      const data = []
      this.dialogFormRoute.routeOperationArr.forEach(item => {
        if (item.isSelected2) {
          data.push({ code: item.code, name: item.name })
          data.push({
            code: item.code,
            name: item.name,
            wkshopcode: item.wkshopcode,
            wkshopname: item.wkshopname
          })
        }
      })
      this.$store.state.app.buttonIsDisabled = true
      const res = await SaveInventoryFile(this.dialogFormRoute.projectCode, this.defaultroute_code, data)
      // const res = await SaveInventoryFile(this.dialogFormRoute.projectCode, this.defaultroute_code, data)
      const res = await SaveInventoryFile(this.dialogFormRoute.projectCode, '', data)
      if (res.code === '200') {
        this.dialogVisibleRoute = false
        this.$message.success('保存成功!')
@@ -1368,10 +1445,11 @@
          item.flag = !item.flag
        }
      })
      if (val.code === this.defaultroute_code) {
        this.defaultroute_code = ''
      }
      this.defaultroute_codeArr = this.dialogFormRoute.routeOperationArr.filter(item => item.isSelected2)
      // if (val.code === this.defaultroute_code) {
      //   this.defaultroute_code = ''
      // }
      // this.defaultroute_codeArr = this.dialogFormRoute.routeOperationArr.filter(item => item.isSelected2)
      this.$forceUpdate()
    },
    /* 单位模块*/
    // 单位按钮点击事件
@@ -1562,12 +1640,12 @@
  }
}
.defaultroute_code ::v-deep .el-input__suffix-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -3px;
}
//.defaultroute_code ::v-deep .el-input__suffix-inner {
//  display: flex;
//  align-items: center;
//  justify-content: center;
//  margin-top: -3px;
//}
</style>
<!--公共页面样式-->