123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655 |
- import { isSpecialSymbol, hasSpace } from '@/utils/validate'
- const validate_budget_price = (rule, value, callback) => {
- if (value === '') {
- callback(new Error('预算单价不能为空!'))
- } else if (
- value === '0' ||
- value === '0.' ||
- value === '0.0' ||
- value === '0.00'
- ) {
- callback(new Error('预算单价不能为零!'))
- } else {
- callback()
- }
- }
- const validate_num = (rule, value, callback) => {
- if (value === '') {
- callback(new Error('购买数量不能为空!'))
- } else if (value === '0') {
- callback(new Error('购买数量不能为零!'))
- } else {
- callback()
- }
- }
- const validate_total_weight = (rule, value, callback) => {
- const { required } = rule
- if (required && value === '') {
- callback(new Error('商品重量不能为空!'))
- } else if (
- required &&
- (value === '0' ||
- value === '0.' ||
- value === '0.0' ||
- value === '0.00' ||
- value === '0.000')
- ) {
- callback(new Error('商品重量不能为零!'))
- } else {
- callback()
- }
- }
- const validate_specs_weight = (rule, value, callback) => {
- const { required } = rule
- if (required && value === '') {
- callback(new Error('金属克重不能为空!'))
- } else if (
- required &&
- (value === '0' ||
- value === '0.' ||
- value === '0.0' ||
- value === '0.00' ||
- value === '0.000')
- ) {
- callback(new Error('金属克重不能为零!'))
- } else {
- callback()
- }
- }
- const validate_desc = (rule, value, callback) => {
- const { required } = rule
- if (required && value === '') {
- callback(new Error('不能为空!'))
- } else if (value.length > 0 && isSpecialSymbol(value)) {
- callback(new Error('不能使用英文特殊字符!'))
- } else {
- callback()
- }
- }
- const validate_good_name = (rule, value, callback) => {
- const { required } = rule
- if (required && value.length == 0) {
- callback(new Error('不能为空!'))
- } else if (hasSpace(value)) {
- callback(new Error('不能出现/回车/换行符!'))
- } else if (isSpecialSymbol(value)) {
- callback(new Error('不能使用英文特殊字符!'))
- } else {
- callback()
- }
- }
- const rules = {
- arrival_time: [
- {
- required: true,
- message: '到货时间不能为空',
- trigger: 'change'
- }
- ],
- budget_price: [
- {
- required: true,
- validator: validate_budget_price,
- trigger: 'change'
- }
- ],
- num: [
- {
- required: true,
- validator: validate_num,
- trigger: 'change'
- }
- ],
- brand_id: [
- {
- type: 'array',
- required: true,
- message: '请选择品牌',
- trigger: 'change'
- }
- ],
- unit: [
- {
- type: 'array',
- required: true,
- message: '请选择单位',
- trigger: 'change'
- }
- ],
- cat_id: [
- {
- type: 'array',
- required: true,
- message: '请选择商品分类',
- trigger: 'change'
- }
- ],
- good_img: [
- {
- required: true,
- message: '商品图片不能为空',
- trigger: 'change'
- }
- ],
- good_name: [{ required: true, validator: validate_good_name, trigger: 'blur' }],
- model: [
- {
- required: true,
- message: '型号不能为空',
- trigger: 'blur'
- }
- ],
- color: [
- {
- required: true,
- message: '颜色不能为空',
- trigger: 'blur'
- }
- ],
- material: [
- {
- required: true,
- message: '材质不能为空',
- trigger: 'blur'
- }
- ],
- total_weight: [
- {
- required: false,
- validator: validate_total_weight,
- trigger: 'blur'
- }
- ],
- is_addrs: [
- {
- required: true,
- message: '请选择是否多地',
- trigger: 'change'
- }
- ],
- is_custom: [
- {
- required: true,
- message: '请选择是否定制',
- trigger: 'change'
- }
- ],
- is_gold_price: [
- {
- required: true,
- message: '请选择是否启用实时金价',
- trigger: 'change'
- }
- ],
- config: [
- {
- required: true,
- type: 'array',
- message: '至少选择一个配置',
- trigger: 'change'
- }
- ],
- specs_weight: [
- {
- required: true,
- validator: validate_specs_weight,
- trigger: 'blur'
- }
- ],
- other_config: [
- {
- required: true,
- message: '其他要求不能为空',
- trigger: 'blur'
- }
- ],
- cost_desc: [
- {
- required: false,
- validator: validate_desc,
- trigger: 'blur'
- }
- ],
- // use_desc: [
- // {
- // required: true,
- // validator: validate_desc,
- // trigger: 'blur'
- // }
- // ],
- remark: [
- {
- required: true,
- validator: validate_desc,
- trigger: 'blur'
- }
- ],
- metal_id: [
- {
- required: true,
- message: '贵金属种类不能为空',
- trigger: 'blur'
- }
- ],
- gold_price: [
- {
- required: true,
- message: '当前金价不能为空',
- trigger: 'blur'
- }
- ],
- enclosure_file: [
- {
- required: false,
- message: '请上传附件',
- trigger: 'change'
- }
- ]
- }
- const edutRules = {
- companyNo: [
- {
- required: true,
- message: '请选择销售方公司',
- trigger: 'change'
- }
- ],
- khNo: [
- {
- type: 'array',
- required: true,
- message: '请选择购买方公司',
- trigger: 'change'
- }
- ],
- platform_code: [
- {
- // type: "array",
- required: true,
- message: '请选择所属平台',
- trigger: 'change'
- }
- ],
- endtime: [
- {
- required: true,
- message: '竞价截止时间不能为空',
- trigger: 'change'
- }
- ],
- is_project: [
- {
- required: true,
- message: '请选择竞价类型!',
- trigger: 'change'
- }
- ],
- projectNo: [
- {
- type: 'array',
- required: true,
- message: '请选择项目',
- trigger: 'change'
- }
- ],
- arrival_time: [
- {
- required: true,
- message: '到货时间不能为空',
- trigger: 'change'
- }
- ],
- budget_price: [
- {
- required: true,
- validator: validate_budget_price,
- trigger: 'change'
- }
- ],
- num: [
- {
- required: true,
- validator: validate_num,
- trigger: 'change'
- }
- ],
- brand_id: [
- {
- type: 'array',
- required: true,
- message: '请选择品牌',
- trigger: 'change'
- }
- ],
- unit: [
- {
- type: 'array',
- required: true,
- message: '请选择单位',
- trigger: 'change'
- }
- ],
- cat_id: [
- {
- type: 'array',
- required: true,
- message: '请选择商品分类',
- trigger: 'change'
- }
- ],
- good_img: [
- {
- required: true,
- message: '商品图片不能为空',
- trigger: 'change'
- }
- ],
- good_name: [{ required: true, message: '商品名称不能为空', trigger: 'blur' }],
- model: [
- {
- required: true,
- message: '型号不能为空',
- trigger: 'blur'
- }
- ],
- color: [
- {
- required: true,
- message: '颜色不能为空',
- trigger: 'blur'
- }
- ],
- material: [
- {
- required: true,
- message: '材质不能为空',
- trigger: 'blur'
- }
- ],
- total_weight: [
- {
- required: true,
- validator: validate_total_weight,
- trigger: 'blur'
- }
- ],
- is_addrs: [
- {
- required: true,
- message: '请选择是否多地',
- trigger: 'change'
- }
- ],
- is_custom: [
- {
- required: true,
- message: '请选择是否定制',
- trigger: 'change'
- }
- ],
- is_gold_price: [
- {
- required: true,
- message: '请选择是否启用实时金价',
- trigger: 'change'
- }
- ],
- config: [
- {
- required: true,
- type: 'array',
- message: '至少选择一个配置',
- trigger: 'change'
- }
- ],
- specs_weight: [
- {
- required: true,
- validator: validate_specs_weight,
- trigger: 'blur'
- }
- ],
- other_config: [
- {
- required: true,
- message: '其他要求不能为空',
- trigger: 'blur'
- }
- ],
- cost_desc: [
- {
- required: false,
- message: '工艺说明不能为空',
- trigger: 'blur'
- }
- ],
- // use_desc: [
- // {
- // required: true,
- // message: '产品用途不能为空',
- // trigger: 'blur'
- // }
- // ],
- remark: [
- {
- required: true,
- message: '商品备注不能为空',
- trigger: 'blur'
- }
- ],
- metal_id: [
- {
- required: true,
- message: '贵金属种类不能为空',
- trigger: 'blur'
- }
- ],
- gold_price: [
- {
- required: true,
- message: '当前金价不能为空',
- trigger: 'blur'
- }
- ]
- }
- const feedbackListCol = [
- {
- prop: 'bidNo',
- label: '反馈商品编号',
- width: '160'
- },
- {
- prop: ' origin_price',
- label: '议价前销售单价',
- width: '110'
- },
- {
- prop: 'sale_price',
- label: '议价后销售单价',
- width: '110'
- },
- {
- prop: 'cost_fee',
- label: '议价前工艺费',
- width: '110'
- },
- {
- prop: 'sale_cost_fee',
- label: '议价后工艺费',
- width: '110'
- },
- // {
- // prop: "good_img",
- // label: "图片",
- // _slot_: "good_img",
- // "width": "50"
- // },
- {
- prop: 'good_name',
- label: '商品名称',
- 'min-width': '100'
- },
- {
- prop: 'specinfo',
- label: '型号',
- _slot_: 'specinfo',
- 'min-width': '100'
- },
- {
- prop: 'status',
- label: '状态',
- _slot_: 'status',
- width: '120px'
- },
- {
- prop: 'expire_day',
- label: '信息有效期',
- width: '85'
- },
- // {
- // prop: "origin_addr",
- // label: "产地",
- // "width": "135"
- // },
- {
- prop: 'delivery_place_cn',
- label: '发货地',
- width: '135'
- },
- {
- prop: 'delivery_day',
- label: '物流时间',
- width: '85'
- },
- {
- prop: 'work_day',
- label: '生产工期',
- width: '85'
- },
- {
- prop: 'cgder',
- label: '供应商负责人',
- width: '95'
- },
- {
- prop: 'good_creater',
- label: '商品创建人',
- width: '95'
- },
- {
- prop: 'addtime',
- label: '添加时间',
- width: 142
- },
- {
- prop: '',
- label: '操作',
- fixed: 'right',
- _noset_: true,
- _slot_: 'operation',
- width: 155
- }
- ]
- const listCol = [
- {
- prop: 'infoNo',
- label: '竞价编号',
- width: '160'
- },
- {
- prop: 'bargain_num',
- label: '竞价次数',
- width: '70'
- },
- {
- prop: 'good_img',
- label: '图片',
- _slot_: 'good_img',
- width: '50'
- },
- {
- prop: 'good_name',
- label: '商品名称',
- 'min-width': '120'
- },
- {
- prop: 'status',
- label: '状态',
- _slot_: 'status',
- width: '120px'
- },
- {
- prop: 'is_project',
- label: '竞价单类型',
- _slot_: 'is_project',
- width: '110px'
- },
- {
- prop: 'khNo',
- label: '客户编号',
- width: '160'
- },
- {
- prop: 'khname',
- label: '客户名称',
- 'min-width': '135'
- },
- {
- prop: 'companyNo',
- label: '业务公司编号',
- width: '160'
- },
- {
- prop: 'companyName',
- label: '业务公司名称',
- 'min-width': '135'
- },
- {
- prop: 'budget_price',
- label: '预算单价',
- width: 110
- },
- {
- prop: 'num',
- label: '竞价数量',
- width: 110
- },
- {
- prop: 'company_name',
- label: '申请人部门',
- minWidth: '150px'
- },
- {
- prop: 'creater',
- label: '申请人',
- width: '60'
- },
- {
- prop: 'addtime',
- label: '添加时间',
- width: 142
- },
- {
- prop: '',
- label: '操作',
- fixed: 'right',
- _noset_: true,
- _slot_: 'operation',
- width: 50
- }
- ]
- export { listCol, rules, edutRules, feedbackListCol }
|