columns.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. import { isSpecialSymbol, hasSpace } from '@/utils/validate'
  2. const validate_budget_price = (rule, value, callback) => {
  3. if (value === '') {
  4. callback(new Error('预算单价不能为空!'))
  5. } else if (
  6. value === '0' ||
  7. value === '0.' ||
  8. value === '0.0' ||
  9. value === '0.00'
  10. ) {
  11. callback(new Error('预算单价不能为零!'))
  12. } else {
  13. callback()
  14. }
  15. }
  16. const validate_num = (rule, value, callback) => {
  17. if (value === '') {
  18. callback(new Error('购买数量不能为空!'))
  19. } else if (value === '0') {
  20. callback(new Error('购买数量不能为零!'))
  21. } else {
  22. callback()
  23. }
  24. }
  25. const validate_total_weight = (rule, value, callback) => {
  26. const { required } = rule
  27. if (required && value === '') {
  28. callback(new Error('商品重量不能为空!'))
  29. } else if (
  30. required &&
  31. (value === '0' ||
  32. value === '0.' ||
  33. value === '0.0' ||
  34. value === '0.00' ||
  35. value === '0.000')
  36. ) {
  37. callback(new Error('商品重量不能为零!'))
  38. } else {
  39. callback()
  40. }
  41. }
  42. const validate_specs_weight = (rule, value, callback) => {
  43. const { required } = rule
  44. if (required && value === '') {
  45. callback(new Error('金属克重不能为空!'))
  46. } else if (
  47. required &&
  48. (value === '0' ||
  49. value === '0.' ||
  50. value === '0.0' ||
  51. value === '0.00' ||
  52. value === '0.000')
  53. ) {
  54. callback(new Error('金属克重不能为零!'))
  55. } else {
  56. callback()
  57. }
  58. }
  59. const validate_desc = (rule, value, callback) => {
  60. const { required } = rule
  61. if (required && value === '') {
  62. callback(new Error('不能为空!'))
  63. } else if (value.length > 0 && isSpecialSymbol(value)) {
  64. callback(new Error('不能使用英文特殊字符!'))
  65. } else {
  66. callback()
  67. }
  68. }
  69. const validate_good_name = (rule, value, callback) => {
  70. const { required } = rule
  71. if (required && value.length == 0) {
  72. callback(new Error('不能为空!'))
  73. } else if (hasSpace(value)) {
  74. callback(new Error('不能出现/回车/换行符!'))
  75. } else if (isSpecialSymbol(value)) {
  76. callback(new Error('不能使用英文特殊字符!'))
  77. } else {
  78. callback()
  79. }
  80. }
  81. const rules = {
  82. arrival_time: [
  83. {
  84. required: true,
  85. message: '到货时间不能为空',
  86. trigger: 'change'
  87. }
  88. ],
  89. budget_price: [
  90. {
  91. required: true,
  92. validator: validate_budget_price,
  93. trigger: 'change'
  94. }
  95. ],
  96. num: [
  97. {
  98. required: true,
  99. validator: validate_num,
  100. trigger: 'change'
  101. }
  102. ],
  103. brand_id: [
  104. {
  105. type: 'array',
  106. required: true,
  107. message: '请选择品牌',
  108. trigger: 'change'
  109. }
  110. ],
  111. unit: [
  112. {
  113. type: 'array',
  114. required: true,
  115. message: '请选择单位',
  116. trigger: 'change'
  117. }
  118. ],
  119. cat_id: [
  120. {
  121. type: 'array',
  122. required: true,
  123. message: '请选择商品分类',
  124. trigger: 'change'
  125. }
  126. ],
  127. good_img: [
  128. {
  129. required: true,
  130. message: '商品图片不能为空',
  131. trigger: 'change'
  132. }
  133. ],
  134. good_name: [{ required: true, validator: validate_good_name, trigger: 'blur' }],
  135. model: [
  136. {
  137. required: true,
  138. message: '型号不能为空',
  139. trigger: 'blur'
  140. }
  141. ],
  142. color: [
  143. {
  144. required: true,
  145. message: '颜色不能为空',
  146. trigger: 'blur'
  147. }
  148. ],
  149. material: [
  150. {
  151. required: true,
  152. message: '材质不能为空',
  153. trigger: 'blur'
  154. }
  155. ],
  156. total_weight: [
  157. {
  158. required: false,
  159. validator: validate_total_weight,
  160. trigger: 'blur'
  161. }
  162. ],
  163. is_addrs: [
  164. {
  165. required: true,
  166. message: '请选择是否多地',
  167. trigger: 'change'
  168. }
  169. ],
  170. is_custom: [
  171. {
  172. required: true,
  173. message: '请选择是否定制',
  174. trigger: 'change'
  175. }
  176. ],
  177. is_gold_price: [
  178. {
  179. required: true,
  180. message: '请选择是否启用实时金价',
  181. trigger: 'change'
  182. }
  183. ],
  184. config: [
  185. {
  186. required: true,
  187. type: 'array',
  188. message: '至少选择一个配置',
  189. trigger: 'change'
  190. }
  191. ],
  192. specs_weight: [
  193. {
  194. required: true,
  195. validator: validate_specs_weight,
  196. trigger: 'blur'
  197. }
  198. ],
  199. other_config: [
  200. {
  201. required: true,
  202. message: '其他要求不能为空',
  203. trigger: 'blur'
  204. }
  205. ],
  206. cost_desc: [
  207. {
  208. required: false,
  209. validator: validate_desc,
  210. trigger: 'blur'
  211. }
  212. ],
  213. // use_desc: [
  214. // {
  215. // required: true,
  216. // validator: validate_desc,
  217. // trigger: 'blur'
  218. // }
  219. // ],
  220. remark: [
  221. {
  222. required: true,
  223. validator: validate_desc,
  224. trigger: 'blur'
  225. }
  226. ],
  227. metal_id: [
  228. {
  229. required: true,
  230. message: '贵金属种类不能为空',
  231. trigger: 'blur'
  232. }
  233. ],
  234. gold_price: [
  235. {
  236. required: true,
  237. message: '当前金价不能为空',
  238. trigger: 'blur'
  239. }
  240. ],
  241. enclosure_file: [
  242. {
  243. required: false,
  244. message: '请上传附件',
  245. trigger: 'change'
  246. }
  247. ]
  248. }
  249. const edutRules = {
  250. companyNo: [
  251. {
  252. required: true,
  253. message: '请选择销售方公司',
  254. trigger: 'change'
  255. }
  256. ],
  257. khNo: [
  258. {
  259. type: 'array',
  260. required: true,
  261. message: '请选择购买方公司',
  262. trigger: 'change'
  263. }
  264. ],
  265. platform_code: [
  266. {
  267. // type: "array",
  268. required: true,
  269. message: '请选择所属平台',
  270. trigger: 'change'
  271. }
  272. ],
  273. endtime: [
  274. {
  275. required: true,
  276. message: '竞价截止时间不能为空',
  277. trigger: 'change'
  278. }
  279. ],
  280. is_project: [
  281. {
  282. required: true,
  283. message: '请选择竞价类型!',
  284. trigger: 'change'
  285. }
  286. ],
  287. projectNo: [
  288. {
  289. type: 'array',
  290. required: true,
  291. message: '请选择项目',
  292. trigger: 'change'
  293. }
  294. ],
  295. arrival_time: [
  296. {
  297. required: true,
  298. message: '到货时间不能为空',
  299. trigger: 'change'
  300. }
  301. ],
  302. budget_price: [
  303. {
  304. required: true,
  305. validator: validate_budget_price,
  306. trigger: 'change'
  307. }
  308. ],
  309. num: [
  310. {
  311. required: true,
  312. validator: validate_num,
  313. trigger: 'change'
  314. }
  315. ],
  316. brand_id: [
  317. {
  318. type: 'array',
  319. required: true,
  320. message: '请选择品牌',
  321. trigger: 'change'
  322. }
  323. ],
  324. unit: [
  325. {
  326. type: 'array',
  327. required: true,
  328. message: '请选择单位',
  329. trigger: 'change'
  330. }
  331. ],
  332. cat_id: [
  333. {
  334. type: 'array',
  335. required: true,
  336. message: '请选择商品分类',
  337. trigger: 'change'
  338. }
  339. ],
  340. good_img: [
  341. {
  342. required: true,
  343. message: '商品图片不能为空',
  344. trigger: 'change'
  345. }
  346. ],
  347. good_name: [{ required: true, message: '商品名称不能为空', trigger: 'blur' }],
  348. model: [
  349. {
  350. required: true,
  351. message: '型号不能为空',
  352. trigger: 'blur'
  353. }
  354. ],
  355. color: [
  356. {
  357. required: true,
  358. message: '颜色不能为空',
  359. trigger: 'blur'
  360. }
  361. ],
  362. material: [
  363. {
  364. required: true,
  365. message: '材质不能为空',
  366. trigger: 'blur'
  367. }
  368. ],
  369. total_weight: [
  370. {
  371. required: true,
  372. validator: validate_total_weight,
  373. trigger: 'blur'
  374. }
  375. ],
  376. is_addrs: [
  377. {
  378. required: true,
  379. message: '请选择是否多地',
  380. trigger: 'change'
  381. }
  382. ],
  383. is_custom: [
  384. {
  385. required: true,
  386. message: '请选择是否定制',
  387. trigger: 'change'
  388. }
  389. ],
  390. is_gold_price: [
  391. {
  392. required: true,
  393. message: '请选择是否启用实时金价',
  394. trigger: 'change'
  395. }
  396. ],
  397. config: [
  398. {
  399. required: true,
  400. type: 'array',
  401. message: '至少选择一个配置',
  402. trigger: 'change'
  403. }
  404. ],
  405. specs_weight: [
  406. {
  407. required: true,
  408. validator: validate_specs_weight,
  409. trigger: 'blur'
  410. }
  411. ],
  412. other_config: [
  413. {
  414. required: true,
  415. message: '其他要求不能为空',
  416. trigger: 'blur'
  417. }
  418. ],
  419. cost_desc: [
  420. {
  421. required: false,
  422. message: '工艺说明不能为空',
  423. trigger: 'blur'
  424. }
  425. ],
  426. // use_desc: [
  427. // {
  428. // required: true,
  429. // message: '产品用途不能为空',
  430. // trigger: 'blur'
  431. // }
  432. // ],
  433. remark: [
  434. {
  435. required: true,
  436. message: '商品备注不能为空',
  437. trigger: 'blur'
  438. }
  439. ],
  440. metal_id: [
  441. {
  442. required: true,
  443. message: '贵金属种类不能为空',
  444. trigger: 'blur'
  445. }
  446. ],
  447. gold_price: [
  448. {
  449. required: true,
  450. message: '当前金价不能为空',
  451. trigger: 'blur'
  452. }
  453. ]
  454. }
  455. const feedbackListCol = [
  456. {
  457. prop: 'bidNo',
  458. label: '反馈商品编号',
  459. width: '160'
  460. },
  461. {
  462. prop: ' origin_price',
  463. label: '议价前销售单价',
  464. width: '110'
  465. },
  466. {
  467. prop: 'sale_price',
  468. label: '议价后销售单价',
  469. width: '110'
  470. },
  471. {
  472. prop: 'cost_fee',
  473. label: '议价前工艺费',
  474. width: '110'
  475. },
  476. {
  477. prop: 'sale_cost_fee',
  478. label: '议价后工艺费',
  479. width: '110'
  480. },
  481. // {
  482. // prop: "good_img",
  483. // label: "图片",
  484. // _slot_: "good_img",
  485. // "width": "50"
  486. // },
  487. {
  488. prop: 'good_name',
  489. label: '商品名称',
  490. 'min-width': '100'
  491. },
  492. {
  493. prop: 'specinfo',
  494. label: '型号',
  495. _slot_: 'specinfo',
  496. 'min-width': '100'
  497. },
  498. {
  499. prop: 'status',
  500. label: '状态',
  501. _slot_: 'status',
  502. width: '120px'
  503. },
  504. {
  505. prop: 'expire_day',
  506. label: '信息有效期',
  507. width: '85'
  508. },
  509. // {
  510. // prop: "origin_addr",
  511. // label: "产地",
  512. // "width": "135"
  513. // },
  514. {
  515. prop: 'delivery_place_cn',
  516. label: '发货地',
  517. width: '135'
  518. },
  519. {
  520. prop: 'delivery_day',
  521. label: '物流时间',
  522. width: '85'
  523. },
  524. {
  525. prop: 'work_day',
  526. label: '生产工期',
  527. width: '85'
  528. },
  529. {
  530. prop: 'cgder',
  531. label: '供应商负责人',
  532. width: '95'
  533. },
  534. {
  535. prop: 'good_creater',
  536. label: '商品创建人',
  537. width: '95'
  538. },
  539. {
  540. prop: 'addtime',
  541. label: '添加时间',
  542. width: 142
  543. },
  544. {
  545. prop: '',
  546. label: '操作',
  547. fixed: 'right',
  548. _noset_: true,
  549. _slot_: 'operation',
  550. width: 155
  551. }
  552. ]
  553. const listCol = [
  554. {
  555. prop: 'infoNo',
  556. label: '竞价编号',
  557. width: '160'
  558. },
  559. {
  560. prop: 'bargain_num',
  561. label: '竞价次数',
  562. width: '70'
  563. },
  564. {
  565. prop: 'good_img',
  566. label: '图片',
  567. _slot_: 'good_img',
  568. width: '50'
  569. },
  570. {
  571. prop: 'good_name',
  572. label: '商品名称',
  573. 'min-width': '120'
  574. },
  575. {
  576. prop: 'status',
  577. label: '状态',
  578. _slot_: 'status',
  579. width: '120px'
  580. },
  581. {
  582. prop: 'is_project',
  583. label: '竞价单类型',
  584. _slot_: 'is_project',
  585. width: '110px'
  586. },
  587. {
  588. prop: 'khNo',
  589. label: '客户编号',
  590. width: '160'
  591. },
  592. {
  593. prop: 'khname',
  594. label: '客户名称',
  595. 'min-width': '135'
  596. },
  597. {
  598. prop: 'companyNo',
  599. label: '业务公司编号',
  600. width: '160'
  601. },
  602. {
  603. prop: 'companyName',
  604. label: '业务公司名称',
  605. 'min-width': '135'
  606. },
  607. {
  608. prop: 'budget_price',
  609. label: '预算单价',
  610. width: 110
  611. },
  612. {
  613. prop: 'num',
  614. label: '竞价数量',
  615. width: 110
  616. },
  617. {
  618. prop: 'company_name',
  619. label: '申请人部门',
  620. minWidth: '150px'
  621. },
  622. {
  623. prop: 'creater',
  624. label: '申请人',
  625. width: '60'
  626. },
  627. {
  628. prop: 'addtime',
  629. label: '添加时间',
  630. width: 142
  631. },
  632. {
  633. prop: '',
  634. label: '操作',
  635. fixed: 'right',
  636. _noset_: true,
  637. _slot_: 'operation',
  638. width: 50
  639. }
  640. ]
  641. export { listCol, rules, edutRules, feedbackListCol }