123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- <template>
- <div v-loading="loading">
- <div class="form-box">
- <el-form
- label-position="top"
- :model="form"
- ref="form"
- :rules="formRules"
- label-width="100px"
- >
- <el-row :gutter="10">
- <el-col :span="4">
- <el-form-item label="采购单号" prop="purchaseCode">
- <el-input v-model="form.purchaseCode" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="10">
- <el-form-item label="供应商" prop="supplierName">
- <el-input v-model="form.supplierName" disabled></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="10">
- <el-col :span="4">
- <el-form-item label="物流公司" prop="logisticsCompanyName">
- <el-input v-model="form.logisticsCompanyName" disabled></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="物流/快递单号" prop="code">
- <el-input v-model="form.code" disabled></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <div style="margin-bottom: 20px">
- <labelTitle content="质检明细"></labelTitle>
- </div>
- <el-form-item>
- <el-table :data="form.changeProductList">
- <el-table-column label="物品编码" prop="productCode">
- </el-table-column>
- <el-table-column label="物品名称" prop="productName">
- </el-table-column>
- <el-table-column label="待质检数量" prop="totalQuantity">
- </el-table-column>
- <el-table-column label="质检合格" prop="qualifiedQuantity">
- <template slot-scope="scope">
- <el-form-item
- :prop="
- 'changeProductList.' + scope.$index + '.qualifiedQuantity'
- "
- :rules="formRules.qualifiedQuantity"
- :inline-message="true"
- label-width="0"
- >
- <el-input-number
- v-model="scope.row.qualifiedQuantity"
- label="请输入"
- style="width: 100%"
- size="mini"
- :controls="false"
- :min="0"
- :max="9999"
- >
- </el-input-number>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="质检不合格" prop="disqualificationQuantity">
- <template slot-scope="scope">
- <el-form-item
- :prop="
- 'changeProductList.' +
- scope.$index +
- '.disqualificationQuantity'
- "
- :rules="formRules.disqualificationQuantity"
- :inline-message="true"
- label-width="0"
- >
- <el-input-number
- v-model="scope.row.disqualificationQuantity"
- label="请输入"
- style="width: 100%"
- size="mini"
- :controls="false"
- :min="0"
- :max="9999"
- >
- </el-input-number>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="备注" prop="remark">
- <template slot-scope="scope">
- <el-form-item
- :prop="'changeProductList.' + scope.$index + '.remark'"
- :rules="formRules.remark"
- :inline-message="true"
- label-width="0"
- >
- <el-input
- v-model="scope.row.remark"
- placeholder="请输入"
- size="mini"
- >
- </el-input>
- </el-form-item>
- </template>
- </el-table-column>
- </el-table>
- </el-form-item>
- </el-form>
- </div>
- <div style="text-align: center; margin-top: 15px">
- <el-button size="small" @click="handleCancel">取消 </el-button>
- <el-button type="primary" size="small" @click="handleSubmit">
- 确定</el-button
- >
- </div>
- </div>
- </template>
- <script>
- import labelTitle from "@/components/label-title/index.vue";
- import { getToken } from "@/util/auth";
- export default {
- name: "addInspection",
- components: { labelTitle },
- props: {
- form: {
- type: Object,
- default: () => {},
- },
- warehouseSelectList: {
- type: Array,
- default: () => [],
- },
- },
- data() {
- return {
- uploadHeader: {
- Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
- "Blade-Auth": "bearer " + getToken(),
- },
- loading: false,
- selectDialog: false,
- formRules: {
- qualifiedQuantity: [
- {
- required: true,
- message: "请输入质检合格数量",
- trigger: "blur",
- },
- ],
- disqualificationQuantity: [
- {
- required: true,
- message: "请输入质检不合格数量",
- trigger: "blur",
- },
- ],
- },
- };
- },
- created() {},
- methods: {
- handleSubmit() {
- this.$refs.form.validate((valid) => {
- if (valid) {
- for (let i = 0; i < this.form.changeProductList.length; i++) {
- if (
- this.form.changeProductList[i].qualifiedQuantity +
- this.form.changeProductList[i].disqualificationQuantity ===
- 0
- ) {
- return this.msgInfo("质检合格和质检不合格总合不能为0");
- }
- if (
- Number(this.form.changeProductList[i].qualifiedQuantity) +
- Number(
- this.form.changeProductList[i].disqualificationQuantity
- ) >
- Number(this.form.changeProductList[i].totalQuantity)
- ) {
- return this.msgInfo("质检合格和质检不合格总合不能大于待质检数量");
- }
- }
- this.loading = true;
- this.$emit("submit");
- }
- });
- },
- handleCancel() {
- this.$emit("cancel");
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .form-box {
- height: calc(100vh - 280px);
- overflow: auto;
- box-sizing: border-box;
- padding: 10px;
- }
- ::v-deep {
- .el-form-item {
- margin-bottom: 3px;
- }
- .el-form--label-top .el-form-item__label {
- padding: 8px 0 0 0;
- }
- }
- </style>
|