index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <el-card class="box-card">
  3. <byTable
  4. :source="sourceList.data"
  5. :pagination="sourceList.pagination"
  6. :config="config"
  7. :loading="loading"
  8. :searchConfig="searchConfig"
  9. highlight-current-row
  10. :action-list="[
  11. {
  12. text: '快速登记打样',
  13. action: () => clickModal(),
  14. },
  15. ]"
  16. @get-list="getList"
  17. @clickReset="clickReset">
  18. <template #size="{ item }">
  19. <div>{{ item.length }} * {{ item.width }} * {{ item.height }}</div>
  20. </template>
  21. </byTable>
  22. <el-dialog title="快速登记打样" v-if="openDialog" v-model="openDialog" width="700">
  23. <el-form :model="formData.data" label-width="120px" :rules="rules" ref="submit">
  24. <el-form-item label="事业部:" prop="departmentId">
  25. <el-select v-model="formData.data.departmentId" placeholder="请选择事业部" style="width: 100%">
  26. <el-option v-for="item in departmentList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="订单号:" prop="orderId">
  30. <el-select-v2
  31. v-model="formData.data.orderId"
  32. :options="productionOrder"
  33. placeholder="请选择订单号"
  34. style="width: 100%"
  35. filterable
  36. remote
  37. :loading="loadingSelect"
  38. :remote-method="remoteMethod" />
  39. </el-form-item>
  40. <el-form-item label="尺寸(cm)" required>
  41. <el-row>
  42. <el-col :span="8">
  43. <el-form-item label="" prop="length">
  44. <el-select v-model="formData.data.length" placeholder="请选择长" style="width: 100%">
  45. <el-option label="183" :value="183" />
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="8">
  50. <el-form-item label="" prop="width">
  51. <el-select v-model="formData.data.width" placeholder="请选择宽" style="width: 100%">
  52. <el-option label="61" :value="61" />
  53. <el-option label="68" :value="68" />
  54. <el-option label="80" :value="80" />
  55. </el-select>
  56. </el-form-item>
  57. </el-col>
  58. <el-col :span="8">
  59. <el-form-item label="" prop="height">
  60. <el-select v-model="formData.data.height" placeholder="请选择高" style="width: 100%">
  61. <el-option label="0.6" :value="0.6" />
  62. <el-option label="0.8" :value="0.8" />
  63. <el-option label="1.0" :value="1.0" />
  64. </el-select>
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. </el-form-item>
  69. <el-form-item label="是否新废垫:" prop="useNewBom">
  70. <el-select v-model="formData.data.useNewBom" placeholder="请选择是否新废垫" style="width: 100%">
  71. <el-option label="是" :value="1" />
  72. <el-option label="否" :value="0" />
  73. </el-select>
  74. </el-form-item>
  75. <el-row :gutter="20">
  76. <el-col :span="12">
  77. <el-form-item label="定制加工类型:" prop="customProcessingType">
  78. <el-select v-model="formData.data.customProcessingType" placeholder="请选择定制加工类型" style="width: 100%">
  79. <el-option label="体位线" :value="10" />
  80. <el-option label="logo" :value="20" />
  81. </el-select>
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="12">
  85. <el-form-item label="加工次数:" prop="processingNum">
  86. <el-input-number
  87. onmousewheel="return false;"
  88. v-model="formData.data.processingNum"
  89. placeholder="加工次数"
  90. style="width: 100%"
  91. :controls="false"
  92. :min="0"
  93. :precision="0" />
  94. </el-form-item>
  95. </el-col>
  96. </el-row>
  97. </el-form>
  98. <template #footer>
  99. <el-button @click="openDialog = false" size="large">取 消</el-button>
  100. <el-button type="primary" @click="clickSubmit()" size="large" v-preReClick>确 定</el-button>
  101. </template>
  102. </el-dialog>
  103. </el-card>
  104. </template>
  105. <script setup>
  106. import byTable from "/src/components/byTable/index";
  107. import { ElMessage } from "element-plus";
  108. const { proxy } = getCurrentInstance();
  109. const departmentList = ref([]);
  110. const sourceList = ref({
  111. data: [],
  112. pagination: {
  113. pageNum: 1,
  114. pageSize: 10,
  115. total: 0,
  116. orderCode: "",
  117. departmentId: "",
  118. },
  119. });
  120. const loading = ref(false);
  121. const searchConfig = computed(() => {
  122. return [
  123. {
  124. type: "input",
  125. prop: "orderCode",
  126. label: "订单号",
  127. },
  128. {
  129. type: "select",
  130. prop: "departmentId",
  131. data: departmentList.value,
  132. label: "事业部",
  133. },
  134. ];
  135. });
  136. const config = computed(() => {
  137. return [
  138. {
  139. attrs: {
  140. label: "事业部",
  141. prop: "departmentName",
  142. width: 140,
  143. },
  144. },
  145. {
  146. attrs: {
  147. label: "订单号",
  148. prop: "orderCode",
  149. "min-width": 160,
  150. },
  151. },
  152. {
  153. attrs: {
  154. label: "废垫尺寸",
  155. slot: "size",
  156. width: 160,
  157. },
  158. },
  159. {
  160. attrs: {
  161. label: "是否新废垫",
  162. prop: "useNewBom",
  163. },
  164. render(val) {
  165. if (val == 1) {
  166. return "是";
  167. }
  168. return "否";
  169. },
  170. },
  171. {
  172. attrs: {
  173. label: "打样类型",
  174. prop: "customProcessingType",
  175. },
  176. render(val) {
  177. if (val == 10) {
  178. return "体位线";
  179. }
  180. return "logo";
  181. },
  182. },
  183. {
  184. attrs: {
  185. label: "废垫费用",
  186. prop: "unitPrice",
  187. },
  188. },
  189. {
  190. attrs: {
  191. label: "加工次数",
  192. prop: "processingNum",
  193. },
  194. },
  195. {
  196. attrs: {
  197. label: "加工费用",
  198. prop: "customProcessingFee",
  199. },
  200. },
  201. {
  202. attrs: {
  203. label: "操作人",
  204. prop: "operator",
  205. width: 140,
  206. },
  207. },
  208. {
  209. attrs: {
  210. label: "时间",
  211. prop: "createTime",
  212. width: 160,
  213. },
  214. },
  215. ];
  216. });
  217. const getDemandData = () => {
  218. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  219. if (res.rows && res.rows.length > 0) {
  220. departmentList.value = departmentList.value.concat(
  221. res.rows.map((item) => {
  222. return {
  223. dictKey: item.id,
  224. dictValue: item.name,
  225. };
  226. })
  227. );
  228. }
  229. });
  230. };
  231. getDemandData();
  232. const getList = (req, status) => {
  233. if (status) {
  234. sourceList.value.pagination = {
  235. pageNum: sourceList.value.pagination.pageNum,
  236. pageSize: sourceList.value.pagination.pageSize,
  237. };
  238. } else {
  239. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  240. }
  241. loading.value = true;
  242. proxy.post("/orderProofingRegistration/page", sourceList.value.pagination).then((res) => {
  243. sourceList.value.data = res.rows;
  244. sourceList.value.pagination.total = res.total;
  245. setTimeout(() => {
  246. loading.value = false;
  247. }, 200);
  248. });
  249. };
  250. getList();
  251. const clickReset = () => {
  252. getList("", true);
  253. };
  254. const openDialog = ref(false);
  255. const formData = reactive({
  256. data: {},
  257. });
  258. const rules = ref({
  259. departmentId: [{ required: true, message: "请选择事业部", trigger: "change" }],
  260. orderId: [{ required: true, message: "请选择订单", trigger: "change" }],
  261. length: [{ required: true, message: "请选择长", trigger: "change" }],
  262. width: [{ required: true, message: "请选择宽", trigger: "change" }],
  263. height: [{ required: true, message: "请选择高", trigger: "change" }],
  264. useNewBom: [{ required: true, message: "请选择是否新废垫", trigger: "change" }],
  265. customProcessingType: [{ required: true, message: "请选择定制加工类型", trigger: "change" }],
  266. processingNum: [{ required: true, message: "请输入加工次数", trigger: "blur" }],
  267. });
  268. const productionOrder = ref([]);
  269. const loadingSelect = ref(false);
  270. const remoteMethod = (query) => {
  271. if (query !== "") {
  272. loadingSelect.value = true;
  273. proxy.post("/orderInfo/getOrderSelectList", { pageNum: 1, pageSize: 200, code: query }).then(
  274. (res) => {
  275. if (res.rows && res.rows.length > 0) {
  276. productionOrder.value = res.rows.map((item) => {
  277. if (item.wlnCode) {
  278. return {
  279. value: item.id,
  280. label: item.code + " (" + item.wlnCode + ")",
  281. };
  282. } else {
  283. return {
  284. value: item.id,
  285. label: item.code,
  286. };
  287. }
  288. });
  289. } else {
  290. productionOrder.value = [];
  291. }
  292. loadingSelect.value = false;
  293. },
  294. (err) => {
  295. console.log(err);
  296. productionOrder.value = [];
  297. loadingSelect.value = false;
  298. }
  299. );
  300. } else {
  301. productionOrder.value = [];
  302. }
  303. };
  304. const clickModal = () => {
  305. formData.data = {};
  306. openDialog.value = true;
  307. };
  308. const priceList = ref({
  309. 61: {
  310. 0.6: 7.5,
  311. 0.8: 8.5,
  312. 1.0: 11.5,
  313. },
  314. 68: {
  315. 0.6: 8,
  316. 0.8: 10,
  317. 1.0: 13,
  318. },
  319. 80: {
  320. 0.6: 9,
  321. 0.8: 12,
  322. 1.0: 15,
  323. },
  324. });
  325. const clickSubmit = () => {
  326. proxy.$refs.submit.validate((valid) => {
  327. if (valid) {
  328. if (formData.data.useNewBom === 1) {
  329. formData.data.unitPrice = priceList.value[formData.data.width][formData.data.height];
  330. } else {
  331. formData.data.unitPrice = 0;
  332. }
  333. let price = 0;
  334. if (formData.data.customProcessingType == 10) {
  335. price = 1.5;
  336. } else {
  337. price = 0.5;
  338. }
  339. formData.data.customProcessingFee = Number(Math.round(price * formData.data.processingNum * 100) / 100);
  340. proxy.post("/orderProofingRegistration/add", formData.data).then(() => {
  341. ElMessage({ message: "提交成功", type: "success" });
  342. getList();
  343. openDialog.value = false;
  344. });
  345. }
  346. });
  347. };
  348. </script>
  349. <style lang="scss" scoped>
  350. ::v-deep(.el-input-number .el-input__inner) {
  351. text-align: left;
  352. }
  353. </style>