zhouwx
2024-09-13 b0704ac893c4e96b535de03dba22868619f242a3
零头修改
已修改8个文件
216 ■■■■■ 文件已修改
src/api/hazardousChemicals/productRecord.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/hazardousChemicals/rawRecord.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/components/flowDetail.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hazardousChemicals/electronicWarehouse/components/rawDetail.vue 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hazardousChemicals/warehouseManage/components/addProDialog.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hazardousChemicals/warehouseManage/components/addRawDialog.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hazardousChemicals/warehouseManage/components/proDetail.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hazardousChemicals/warehouseManage/components/rawDetail.vue 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/hazardousChemicals/productRecord.js
@@ -109,3 +109,11 @@
        data: data
    })
}
export function changeProRemaining(data) {
    return request({
        url: '/product/changeRemaining',
        method: 'post',
        data: data
    })
}
src/api/hazardousChemicals/rawRecord.js
@@ -103,3 +103,12 @@
        params: params
    })
}
export function changeRawRemaining(data) {
    return request({
        url: '/hazmat/changeRemaining',
        method: 'post',
        data: data
    })
}
src/views/components/flowDetail.vue
@@ -117,7 +117,7 @@
          return {
            ...item,
            unit:item.hazmatBasic.unit,
            stateName: item.state ==0 ?'入库': item.state ==1 ? '取用' :item.state ==2 ? '归还': item.state ==3 ? '标签作废' : item.state ==4 ? '用尽登记':item.state ==5 ? '销售' : '',
            stateName: item.state ==0 ?'入库': item.state ==1 ? '取用' :item.state ==2 ? '归还': item.state ==3 ? '标签作废' : item.state ==4 ? '用尽登记':item.state ==5 ? '销售' : item.state ==6? '零头入库':'',
            description: `${item.updateTime}  ${item.user.departName ? item.user.departName +'部门'  : ''}   ${item.user.name}  进行了 `,
            size: 'large',
            type: 'primary',
@@ -146,7 +146,7 @@
            return {
              ...item,
              unit:item.hazmatBasic.unit,
              stateName: item.state ==0 ?'入库': item.state ==1 ? '取用' :item.state ==2 ? '归还': item.state ==3 ? '标签作废' : item.state ==4 ? '用尽登记':item.state ==5 ? '销售' : '',
              stateName: item.state ==0 ?'入库': item.state ==1 ? '取用' :item.state ==2 ? '归还': item.state ==3 ? '标签作废' : item.state ==4 ? '用尽登记':item.state ==5 ? '销售' : item.state ==6? '零头入库':'',
              description: `${item.updateTime}  ${item.user.departName ? item.user.departName +'部门'  : ''}   ${item.user.name}  进行了 `,
              size: 'large',
              type: 'primary',
src/views/hazardousChemicals/electronicWarehouse/components/rawDetail.vue
@@ -66,6 +66,7 @@
      <el-table-column label="所在仓库" prop="warehouseName" align="center" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180" >
        <template #default="scope">
          <el-button link type="primary" v-if="scope.row.state ===0 || scope.row.state === 1" @click="editNum(scope.row)">零头修改</el-button>
          <el-button link type="primary" @click="viewFlow(scope.row)">取用记录</el-button>
          <el-button link type="danger" v-if="scope.row.state === 0 || scope.row.state === 1|| scope.row.state === 2" @click="disCard(scope.row)">标签作废</el-button>
          <el-button link type="primary" @click="viewQR(scope.row)">查看二维码</el-button>
@@ -89,6 +90,26 @@
    >
      <flow-deail ref="flowRef"></flow-deail>
    </el-dialog>
    <el-dialog
        v-model="editNumDialog"
        width="650px"
        title="余量修改"
        :before-close="handleCloseNum"
        :close-on-press-escape="false"
        :close-on-click-modal="false"
    >
      <el-form :model="data.form" size="default" ref="busRef" :rules="data.formRules" label-width="150px" >
        <el-form-item label="在库余量:" prop="remaining" >
          <el-input v-model.trim="data.form.remaining" @input="requiredDurationEventMetering($event)"  placeholder="请输入余量"></el-input>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
            <el-button @click="handleCloseNum" size="default">取 消</el-button>
            <el-button type="primary"  @click="onSubmitNum" size="default" v-preReClick>确认</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>
@@ -99,13 +120,14 @@
import {disCardPro, getProDetail, getProductRecord} from "@/api/hazardousChemicals/productRecord";
import viewQRcode from './viewQR.vue'
import {ElMessage, ElMessageBox} from "element-plus";
import {disCardRaw, getRawDetail} from "@/api/hazardousChemicals/rawRecord";
import {changeRawRemaining, disCardRaw, getRawDetail} from "@/api/hazardousChemicals/rawRecord";
import Cookies from "js-cookie";
const route = useRoute()
const router = useRouter();
const dialogRef = ref();
const dialogVisible = ref(false)
const flowRef = ref();
const editNumDialog = ref(false)
const data = reactive({
  queryParams: {
    basicId: null,
@@ -139,7 +161,14 @@
      name: '标签作废'
    },
  ]
  ],
  form: {
    id: '',
    remaining: ''
  },
  formRules: {
    remaining: [{ required: true, trigger: "blur", message: '请输入余量' }],
  }
});
const loading = ref(false);
const backValue = ref({})
@@ -237,6 +266,58 @@
  }
};
const chooseItem = ref()
const editNum = (val) => {
  chooseItem.value = val
  data.form.id = val.id
  data.form.remaining = val.remaining
  editNumDialog.value = true
}
const handleCloseNum = () => {
  data.form = {
    id: '',
    remaining: ''
  }
  chooseItem.value = {}
  editNumDialog.value = false
}
const onSubmitNum = () => {
  if(chooseItem.value.remaining < data.form.remaining){
    ElMessage.warning('修改值不能大于等于在库余量')
    return;
  }
  ElMessageBox.confirm(
      '确定修改此条数据的余量?',
      '提示',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
      .then( async() => {
        const res = await changeRawRemaining(data.form)
        if(res.code == 200){
          ElMessage.success('数据修改成功')
          editNumDialog.value = false;
          await getList()
        }else{
          ElMessage.warning(res.message)
        }
      })
}
const requiredDurationEventMetering =(value) =>{
  let dat =
      ("" + value) // 第一步:转成字符串
          .replace(/[^\d^\.]+/g, "") // 第二步:把不是数字,不是小数点的过滤掉
          .replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字
          .replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全
          .match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 第五步:最终匹配得到结果 以数字开头,只有一个小数点,而且小数点后面只能有0到2位小数
  data.form.remaining = dat
}
</script>
<style scoped lang="scss">
src/views/hazardousChemicals/warehouseManage/components/addProDialog.vue
@@ -155,7 +155,13 @@
  }
  const res = await getWarehouse(param)
  if(res.code == 200){
    state.wareHouseList = res.data.list
    state.wareHouseList = res.data.list.map(item => {
      return{
        ...item,
        name: item.name + '—' + item.productSn + '(' + item.metering +item.unit+')'
      }
    })
  }else{
    ElMessage.warning(res.message)
  }
src/views/hazardousChemicals/warehouseManage/components/addRawDialog.vue
@@ -142,7 +142,14 @@
  }
  const res = await getBasicList(param)
  if(res.code == 200){
    state.rawList = res.data.list
    state.rawList = res.data.list.map(item => {
      return{
        ...item,
        name: item.name + '—' + item.productSn + '(' + item.metering +item.unit+')'
      }
    })
    console.log('111',state.rawList)
  }else{
    ElMessage.warning(res.message)
  }
src/views/hazardousChemicals/warehouseManage/components/proDetail.vue
@@ -220,7 +220,7 @@
  }
  for (let i = 0; i <= arr.length; i++) {
    if (arr[i] == row.basicId) {
      if(row.remaining < row.hproductBasic.metering){
      if(row.remaining < row.productBasic.metering){
        if (columnIndex === 11 || columnIndex === 10){
          return { color:' red' }
        }
src/views/hazardousChemicals/warehouseManage/components/rawDetail.vue
@@ -66,6 +66,7 @@
      <el-table-column label="所在仓库" prop="warehouseName" align="center" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180" >
        <template #default="scope">
          <el-button link type="primary" v-if="scope.row.state ===0 || scope.row.state === 1" @click="editNum(scope.row)">零头修改</el-button>
          <el-button link type="primary" @click="viewFlow(scope.row)">取用记录</el-button>
          <el-button link type="danger" v-if="scope.row.state === 0 || scope.row.state === 1|| scope.row.state === 2" @click="disCard(scope.row)">标签作废</el-button>
          <el-button link type="primary" @click="viewQR(scope.row)">查看二维码</el-button>
@@ -89,6 +90,26 @@
    >
      <flow-deail ref="flowRef"></flow-deail>
    </el-dialog>
    <el-dialog
        v-model="editNumDialog"
        width="650px"
        title="余量修改"
        :before-close="handleCloseNum"
        :close-on-press-escape="false"
        :close-on-click-modal="false"
    >
      <el-form :model="data.form" size="default" ref="busRef" :rules="data.formRules" label-width="150px" >
        <el-form-item label="在库余量:" prop="remaining" >
          <el-input v-model.trim="data.form.remaining" @input="requiredDurationEventMetering($event)"  placeholder="请输入余量"></el-input>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
            <el-button @click="handleCloseNum" size="default">取 消</el-button>
            <el-button type="primary"  @click="onSubmitNum" size="default" v-preReClick>确认</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>
@@ -97,13 +118,20 @@
import {useRoute, useRouter} from "vue-router";
import flowDeail from '../../../components/flowDetail.vue'
import {ElMessage, ElMessageBox} from "element-plus";
import {disCardRaw, getRawDetail, getWhRawDetail} from "@/api/hazardousChemicals/rawRecord";
import {
  changeRawRemaining,
  delRawRecord,
  disCardRaw,
  getRawDetail,
  getWhRawDetail
} from "@/api/hazardousChemicals/rawRecord";
import viewQRcode from '@/views/hazardousChemicals/electronicWarehouse/components/viewQR.vue'
import Cookies from "js-cookie";
const route = useRoute()
const router = useRouter();
const dialogRef = ref();
const dialogVisible = ref(false)
const editNumDialog = ref(false)
const flowRef = ref();
const data = reactive({
  queryParams: {
@@ -137,7 +165,14 @@
      name: '标签作废'
    },
  ]
  ],
  form: {
    id: '',
    remaining: ''
  },
  formRules: {
    remaining: [{ required: true, trigger: "blur", message: '请输入余量' }],
  }
});
const loading = ref(false);
const backValue = ref({})
@@ -232,6 +267,58 @@
    }
  }
};
const chooseItem = ref()
const editNum = (val) => {
  chooseItem.value = val
  data.form.id = val.id
  data.form.remaining = val.remaining
  editNumDialog.value = true
}
const handleCloseNum = () => {
  data.form = {
    id: '',
    remaining: ''
  }
  chooseItem.value = {}
  editNumDialog.value = false
}
const onSubmitNum = () => {
  if(chooseItem.value.remaining < data.form.remaining){
    ElMessage.warning('修改值不能大于等于在库余量')
    return;
  }
  ElMessageBox.confirm(
      '确定修改此条数据的余量?',
      '提示',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
      .then( async() => {
        const res = await changeRawRemaining(data.form)
        if(res.code == 200){
          ElMessage.success('数据修改成功')
          editNumDialog.value = false;
          await getList()
        }else{
          ElMessage.warning(res.message)
        }
      })
}
const requiredDurationEventMetering =(value) =>{
  let dat =
      ("" + value) // 第一步:转成字符串
          .replace(/[^\d^\.]+/g, "") // 第二步:把不是数字,不是小数点的过滤掉
          .replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字
          .replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全
          .match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 第五步:最终匹配得到结果 以数字开头,只有一个小数点,而且小数点后面只能有0到2位小数
  data.form.remaining = dat
}
</script>
<style scoped lang="scss">