{"id":16259986,"url":"https://github.com/songlin123/select-model-prase","last_synced_at":"2025-07-27T07:07:49.153Z","repository":{"id":126184014,"uuid":"360078829","full_name":"SongLin123/select-model-prase","owner":"SongLin123","description":"rollup + ts","archived":false,"fork":false,"pushed_at":"2021-04-21T07:53:00.000Z","size":216,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T13:51:34.464Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SongLin123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-21T07:51:56.000Z","updated_at":"2021-04-21T07:53:03.000Z","dependencies_parsed_at":"2023-07-04T23:32:14.889Z","dependency_job_id":null,"html_url":"https://github.com/SongLin123/select-model-prase","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"2e6f2810aeb7a4aa10c4cb912528a8119e04732d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SongLin123/select-model-prase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SongLin123%2Fselect-model-prase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SongLin123%2Fselect-model-prase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SongLin123%2Fselect-model-prase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SongLin123%2Fselect-model-prase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SongLin123","download_url":"https://codeload.github.com/SongLin123/select-model-prase/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SongLin123%2Fselect-model-prase/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267320256,"owners_count":24068527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T16:05:57.931Z","updated_at":"2025-07-27T07:07:49.136Z","avatar_url":"https://github.com/SongLin123.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n * @LastEditors  : BillySong\n--\u003e\n# select-model-prase （车型选配逻辑解析）\n\n解析车型json和约束规则，生成一个包含5种选择框的选项、选中值、不可选项的实例对象\n# Installation\n\n1. 复制包到工程目录内\n2. 引入工程\n## npm\n``` js\n// package.json 中 dependencies 字段添加 \"select-model-prase\": \"file:select-model-prase\",\n\n... \n \"dependencies\": {\n        \"select-model-prase\": \"file:select-model-prase\",\n }\n...\n```\n\n执行命令\n``` shell\nnpm i\n```\n\n``` js\nimport SelectModelPrase from \"select-model-prase\";\n```\n## cdn\n``` html\n\u003cscript src=\"./select-model-prase/dist/bundle.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nlet p = new SelectModelPrase(json)\n\n\u003c/script\u003e\n```\n# Quick start\n\n``` js\nlet p = new SelectModelPrase(json)\n\np.setModel('1358388885147336705')//旗舰版4座\n\nconsole.log('BAC',p.BAC)\nconsole.log('CRT',p.CRT)\nconsole.log('ITR', p.ITR)\nconsole.log('Opt', p.ITROpt)\nconsole.log('OptDisable', p.ITROptDisable)\nconsole.log('OptDisable',p.PKGOptDisable)\n```\n# API\n\n## Interfaces\n```typescript\ntype featrueCode = string // 特征编码\n\n// 特征\ntype featrue = {\n    faimlyId: string;\n    faimlyCode: string;\n    faimlyName: string;\n    faimlyNameEn: string;\n    featureId: string;\n    featureCode: string;\n    featureName: string;\n    featureNameEn: string;\n    relationShip: string;\n    price: string;\n    discountPrice: string;\n    featureType: string;\n  }\n// 车型\n  type model ={\n    \"carTypeId\": string;\n\t\"carTypeCode\": string;\n\t\"carTypeCn\": string;\n\t\"carTypeEn\": string;\n\t\"orderNo\": string;\n        ...\n  }\n\n```\n## 属性\n```typescript\ninterface SelectModelPrase {\n    BAC: featrueCode;// 选中的外色\n    BACOpt: featrue[]; // 外色选项\n    BACOptDisable: featrueCode[];// 外色不可选中选项的featrueCode\n\n    ITR: featrueCode;// 选中的内饰\n    ITROpt: featrue[];// 内饰选项\n    ITROptDisable: featrueCode[];// 内饰不可选中选项的featrueCode\n\n    WWA: featrueCode;// 选中的车轮或轮毂\n    WWAOpt: featrue[];// 车轮选项\n    WWAOptDisable: featrueCode[];// 车轮不可选中选项的featrueCode\n\n    CRT: featrueCode;// 选中的冰箱\n    CRTOpt: featrue[];// 冰箱选项\n    CRTOptDisable: featrueCode[];// 冰箱不可选中选项的featrueCode\n\n\n    PKG: featrueCode[];// 选中的选装包\n    PKGOpt: featrue[];// 选装包选项\n    PKGOptDisable: featrueCode[];// 选装包不可选中选项的featrueCode\n    \n}\n```\n\n### constructor\n``` js\nnew SelectModelPrase(json) // json 车型列表json\n```\n### getModels()\n``` js\nfunction getModels(): model[] \n```\n返回可选车型数组\n\n### setModel()\n``` js\nfunction setModel(carTypeId: string): model\n```\n设置选中车型,传入车型的 carTypeId\n\ncarTypeId 传空字符串或者不存在数组中的值，会清空 属性值、选项、不可选中的选项\n如：\n``` js\n\np.setModel('')\n\nconsole.log('BAC',p.BAC) // undefined\nconsole.log('CRT',p.CRT) // undefined\nconsole.log('ITR', p.ITR) // undefined\nconsole.log('Opt', p.ITROpt) // []\nconsole.log('OptDisable', p.ITROptDisable) // []\nconsole.log('OptDisable',p.PKGOptDisable) // []\n\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonglin123%2Fselect-model-prase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonglin123%2Fselect-model-prase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonglin123%2Fselect-model-prase/lists"}