addInspection.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div v-loading="loading">
  3. <div class="form-box">
  4. <el-form
  5. label-position="top"
  6. :model="form"
  7. ref="form"
  8. :rules="formRules"
  9. label-width="100px"
  10. >
  11. <el-row :gutter="10">
  12. <el-col :span="4">
  13. <el-form-item label="采购单号" prop="purchaseCode">
  14. <el-input v-model="form.purchaseCode" disabled></el-input>
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="10">
  18. <el-form-item label="供应商" prop="supplierName">
  19. <el-input v-model="form.supplierName" disabled></el-input>
  20. </el-form-item>
  21. </el-col>
  22. </el-row>
  23. <el-row :gutter="10">
  24. <el-col :span="4">
  25. <el-form-item label="物流公司" prop="logisticsCompanyName">
  26. <el-input v-model="form.logisticsCompanyName" disabled></el-input>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="8">
  30. <el-form-item label="物流/快递单号" prop="code">
  31. <el-input v-model="form.code" disabled></el-input>
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. <div style="margin-bottom: 20px">
  36. <labelTitle content="质检明细"></labelTitle>
  37. </div>
  38. <el-form-item>
  39. <el-table :data="form.changeProductList">
  40. <el-table-column label="物品编码" prop="productCode">
  41. </el-table-column>
  42. <el-table-column label="物品名称" prop="productName">
  43. </el-table-column>
  44. <el-table-column label="待质检数量" prop="totalQuantity">
  45. </el-table-column>
  46. <el-table-column label="质检合格" prop="qualifiedQuantity">
  47. <template slot-scope="scope">
  48. <el-form-item
  49. :prop="
  50. 'changeProductList.' + scope.$index + '.qualifiedQuantity'
  51. "
  52. :rules="formRules.qualifiedQuantity"
  53. :inline-message="true"
  54. label-width="0"
  55. >
  56. <el-input-number
  57. v-model="scope.row.qualifiedQuantity"
  58. label="请输入"
  59. style="width: 100%"
  60. size="mini"
  61. :controls="false"
  62. :min="0"
  63. :max="9999"
  64. >
  65. </el-input-number>
  66. </el-form-item>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="质检不合格" prop="disqualificationQuantity">
  70. <template slot-scope="scope">
  71. <el-form-item
  72. :prop="
  73. 'changeProductList.' +
  74. scope.$index +
  75. '.disqualificationQuantity'
  76. "
  77. :rules="formRules.disqualificationQuantity"
  78. :inline-message="true"
  79. label-width="0"
  80. >
  81. <el-input-number
  82. v-model="scope.row.disqualificationQuantity"
  83. label="请输入"
  84. style="width: 100%"
  85. size="mini"
  86. :controls="false"
  87. :min="0"
  88. :max="9999"
  89. >
  90. </el-input-number>
  91. </el-form-item>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="备注" prop="remark">
  95. <template slot-scope="scope">
  96. <el-form-item
  97. :prop="'changeProductList.' + scope.$index + '.remark'"
  98. :rules="formRules.remark"
  99. :inline-message="true"
  100. label-width="0"
  101. >
  102. <el-input
  103. v-model="scope.row.remark"
  104. placeholder="请输入"
  105. size="mini"
  106. >
  107. </el-input>
  108. </el-form-item>
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. </el-form-item>
  113. </el-form>
  114. </div>
  115. <div style="text-align: center; margin-top: 15px">
  116. <el-button size="small" @click="handleCancel">取消 </el-button>
  117. <el-button type="primary" size="small" @click="handleSubmit">
  118. 确定</el-button
  119. >
  120. </div>
  121. </div>
  122. </template>
  123. <script>
  124. import labelTitle from "@/components/label-title/index.vue";
  125. import { getToken } from "@/util/auth";
  126. export default {
  127. name: "addInspection",
  128. components: { labelTitle },
  129. props: {
  130. form: {
  131. type: Object,
  132. default: () => {},
  133. },
  134. warehouseSelectList: {
  135. type: Array,
  136. default: () => [],
  137. },
  138. },
  139. data() {
  140. return {
  141. uploadHeader: {
  142. Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
  143. "Blade-Auth": "bearer " + getToken(),
  144. },
  145. loading: false,
  146. selectDialog: false,
  147. formRules: {
  148. qualifiedQuantity: [
  149. {
  150. required: true,
  151. message: "请输入质检合格数量",
  152. trigger: "blur",
  153. },
  154. ],
  155. disqualificationQuantity: [
  156. {
  157. required: true,
  158. message: "请输入质检不合格数量",
  159. trigger: "blur",
  160. },
  161. ],
  162. },
  163. };
  164. },
  165. created() {},
  166. methods: {
  167. handleSubmit() {
  168. this.$refs.form.validate((valid) => {
  169. if (valid) {
  170. for (let i = 0; i < this.form.changeProductList.length; i++) {
  171. if (
  172. this.form.changeProductList[i].qualifiedQuantity +
  173. this.form.changeProductList[i].disqualificationQuantity ===
  174. 0
  175. ) {
  176. return this.msgInfo("质检合格和质检不合格总合不能为0");
  177. }
  178. if (
  179. Number(this.form.changeProductList[i].qualifiedQuantity) +
  180. Number(
  181. this.form.changeProductList[i].disqualificationQuantity
  182. ) >
  183. Number(this.form.changeProductList[i].totalQuantity)
  184. ) {
  185. return this.msgInfo("质检合格和质检不合格总合不能大于待质检数量");
  186. }
  187. }
  188. this.loading = true;
  189. this.$emit("submit");
  190. }
  191. });
  192. },
  193. handleCancel() {
  194. this.$emit("cancel");
  195. },
  196. },
  197. };
  198. </script>
  199. <style lang="scss" scoped>
  200. .form-box {
  201. height: calc(100vh - 280px);
  202. overflow: auto;
  203. box-sizing: border-box;
  204. padding: 10px;
  205. }
  206. ::v-deep {
  207. .el-form-item {
  208. margin-bottom: 3px;
  209. }
  210. .el-form--label-top .el-form-item__label {
  211. padding: 8px 0 0 0;
  212. }
  213. }
  214. </style>