addInspection.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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-form-item label="跟进结果" prop="code">
  12. <el-radio-group v-model="form.code" size="medium">
  13. <el-radio-button label="1">完成</el-radio-button>
  14. <el-radio-button label="2">跟进中</el-radio-button>
  15. </el-radio-group>
  16. </el-form-item>
  17. <el-row>
  18. <el-col :span="8">
  19. <el-form-item label="跟进人" prop="code">
  20. <el-select
  21. v-model="form.inWarehouseId"
  22. :placeholder="$t('pleaseSelect')"
  23. style="width: 100%"
  24. >
  25. <el-option
  26. v-for="item in warehouseSelectList"
  27. :key="item.id"
  28. :label="item.name"
  29. :value="item.id"
  30. >
  31. </el-option>
  32. </el-select>
  33. </el-form-item>
  34. </el-col>
  35. </el-row>
  36. <el-row>
  37. <el-col :span="10">
  38. <el-form-item label="跟进时间" prop="clearancePeriod">
  39. <el-date-picker
  40. v-model="form.clearancePeriod"
  41. type="datetime"
  42. :placeholder="$t('pleaseSelect')"
  43. value-format="yyyy-MM-dd HH:mm:ss"
  44. >
  45. </el-date-picker>
  46. </el-form-item>
  47. </el-col>
  48. </el-row>
  49. <el-form-item label="跟进记录" prop="remark">
  50. <el-input
  51. v-model="form.remark"
  52. placeholder="请输入"
  53. type="textarea"
  54. :rows="3"
  55. >
  56. </el-input>
  57. </el-form-item>
  58. </el-form>
  59. </div>
  60. <div style="text-align: center; margin-top: 15px">
  61. <el-button size="small" @click="handleCancel"
  62. >{{ $t("cancel") }}
  63. </el-button>
  64. <el-button type="primary" size="small" @click="handleSubmit">
  65. {{ $t("submit") }}</el-button
  66. >
  67. </div>
  68. <!-- <el-dialog
  69. :title="$t('goodsSelect')"
  70. v-if="selectDialog"
  71. :visible.sync="selectDialog"
  72. width="80%"
  73. top="60px"
  74. >
  75. <selectProduct @select="handleSelect"></selectProduct>
  76. </el-dialog> -->
  77. </div>
  78. </template>
  79. <script>
  80. import labelTitle from "@/components/label-title/index.vue";
  81. import selectProduct from "@/components/select-product/index.vue";
  82. import { getToken } from "@/util/auth";
  83. export default {
  84. name: "addManualOutbound",
  85. components: { labelTitle, selectProduct },
  86. props: {
  87. form: {
  88. type: Object,
  89. default: () => {},
  90. },
  91. warehouseSelectList: {
  92. type: Array,
  93. default: () => [],
  94. },
  95. },
  96. data() {
  97. return {
  98. uploadHeader: {
  99. Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0",
  100. "Blade-Auth": "bearer " + getToken(),
  101. },
  102. loading: false,
  103. selectDialog: false,
  104. formRules: {
  105. quantity: [
  106. {
  107. required: true,
  108. message: "请输入质检合格数量",
  109. trigger: "blur",
  110. },
  111. ],
  112. outWarehouseId: [
  113. {
  114. required: true,
  115. message: "请选择调出仓库",
  116. trigger: "change",
  117. },
  118. ],
  119. inWarehouseId: [
  120. {
  121. required: true,
  122. message: "请选择调入仓库",
  123. trigger: "change",
  124. },
  125. ],
  126. },
  127. };
  128. },
  129. created() {},
  130. methods: {
  131. handleSubmit() {
  132. this.$refs.form.validate((valid) => {
  133. if (valid) {
  134. if (!this.form.changeProductList.length > 0)
  135. return this.msgInfo("请添加调仓明细");
  136. this.loading = true;
  137. this.$emit("submit");
  138. }
  139. });
  140. },
  141. handleCancel() {
  142. this.$emit("cancel");
  143. },
  144. handleAddProduct() {
  145. if (this.form.outWarehouseId === this.form.inWarehouseId)
  146. return this.msgInfo("调出和调入仓库不可一致");
  147. if (!(this.form.outWarehouseId && this.form.inWarehouseId))
  148. return this.msgInfo("请先选择要调的仓库");
  149. this.selectDialog = true;
  150. },
  151. handleSelect(row) {
  152. const flag = this.form.changeProductList.some(
  153. (x) => x.productId === row.id
  154. );
  155. if (flag) return this.msgInfo("该物品已经选择");
  156. const product = {
  157. productCode: row.code,
  158. productName: row.name,
  159. productId: row.id,
  160. quantity: "",
  161. };
  162. this.form.changeProductList.push(product);
  163. },
  164. deleteRow(index) {
  165. this.form.changeProductList.splice(index, 1);
  166. this.msgSuccess(this.$t("deleteSuccess"));
  167. },
  168. },
  169. };
  170. </script>
  171. <style lang="scss" scoped>
  172. .form-box {
  173. height: calc(100vh - 280px);
  174. overflow: auto;
  175. box-sizing: border-box;
  176. padding: 10px;
  177. }
  178. ::v-deep {
  179. .el-form-item {
  180. margin-bottom: 3px;
  181. }
  182. .el-form--label-top .el-form-item__label {
  183. padding: 8px 0 0 0;
  184. }
  185. }
  186. </style>