Best JavaScript code snippet using best
ProjectNewView.js
Source:ProjectNewView.js
1/**2 * è¿ä¸ªæ件主è¦æ¯3 * created by LilyLee on 2019/9/19.4 **/5import Utils from "../../lib/utils/Utils";6export default {7 name: "ProjectNewView",8 props: ['returnProjectInfo', 'type', 'drawerClick', 'reCommitProjectInfo'],9 data() {10 return {11 dialog: false,12 drawer: false,13 drawerCreated: false,14 loading: false,15 direction: 'rtl',16 defaultDate: new Date(),17 newProject: [],18 projectInstitution: [],19 createProject: {20 projectInstitution: "",21 projectFinance: "è¡æ¿æ¿æ³è¡",22 projectName: "",23 projectType: "æ°å»º",24 projectMoney: "",25 projectIndustry: {26 first: "",27 second: ""28 },29 projectMoneyFrom: [],30 projectBeginTime: "",31 projectContactUserName: "",32 projectContactUserPhone: "",33 projectSituation: "",34 projectYears: 135 },36 rules: {37 projectInstitution: [38 {required: true, message: '请éæ©é¡¹ç®åä½', trigger: 'change'}39 ],40 projectFinance: [41 {required: true, message: '请éæ©è´¢æ¿å½å£è¡å®¤', trigger: 'change'}42 ],43 projectName: [44 {required: true, message: '请è¾å
¥é¡¹ç®å称', trigger: 'blur'},45 ],46 projectMoney: [47 {required: true, message: '请è¾å
¥æèµä¼°ç®æ»é¢', trigger: 'blur', validator:Utils.validateMoney},48 ],49 projectYears: [50 {required: true, message: '请éæ©é¡¹ç®å»ºè®¾å¨æ', trigger: 'change'},51 ],52 projectBeginTime: [53 {required: true, message: '请éæ©é¡¹ç®å¼å·¥æ¶é´', trigger: 'change'},54 ]55 },56 newIndustry: [],57 selectIndustry: Utils.getIndustryData(),58 moneyFrom: Utils.getMoneyFrom(),59 projectType: Utils.getProjectType(),60 getProjectYears: Utils.getProjectYears(),61 user: {},62 }63 },64 mounted: function () {65 var self = this;66 self.user = JSON.parse(sessionStorage.getItem('user'));67 //self.projectInstitution = JSON.parse(window.sessionStorage.getItem('institution'));68 self.queryInstitution(function (list) {69 self.projectInstitution = list;70 })71 }72 ,73 methods: {74 //æ¥è¯¢åä½75 queryInstitution: function (callback) {76 let self = this;77 let data = {};78 data.userName = self.user.role;79 self.$http.post('/api/institution/queryAllInstitution', data).then(res => {80 let status = res.status;81 let statusText = res.statusText;82 if (status !== 200) {83 self.$message({84 message: statusText,85 type: 'error'86 });87 } else {88 if (res.data.length != 0) {89 //self.dataList = res.data.recordset;90 callback(res.data.recordset);91 } else {92 console.log("æ¥è¯¢åä½å¤±è´¥");93 callback([]);94 }95 }96 })97 },98 closeForm: function () {99 //this.$emit('onListen', false);100 this.drawerClick.drawerNew.hide();101 },102 //æ°å»ºè¡¨åï¼é¡¹ç®103 commitForm: function () {104 //this.$emit('onListen');105 var self = this;106 self.$refs.createProject.validate((valid) => {107 if (valid) {108 let createProject = _.cloneDeep(self.createProject);109 if (createProject.projectIndustry.first) {110 createProject.projectIndustry = '{"' + createProject.projectIndustry.first + '","' + createProject.projectIndustry.second + '"}';111 } else {112 createProject.projectIndustry = "";113 }114 if (createProject.projectMoneyFrom) {115 createProject.projectMoneyFrom = JSON.stringify(createProject.projectMoneyFrom).replace("[", "{").replace("]", "}");116 } else {117 createProject.projectMoneyFrom = [];118 }119 createProject.approvalStep = 1;120 createProject.ifReturned = 0;121 createProject.stepOneApp = 2;122 createProject.commitName = self.user.role;123 delete createProject.id;124 createProject.projectCommitTime = Utils.formatDate(new Date()) + ".000";125 for (var i = 0; i < self.getProjectYears.length; i++) {126 if (createProject.projectYears == self.getProjectYears[i].name) {127 createProject.projectYears = self.getProjectYears[i].value;128 }129 }130 self.$http.post('/api/project/createProject', createProject).then(res => {131 let status = res.status;132 let statusText = res.statusText;133 if (status !== 200) {134 self.$message({135 message: statusText,136 type: 'error'137 });138 } else {139 if (res.data.length != 0) {140 self.$message({141 message: "æ交æå",142 type: 'success'143 });144 //å
³éå½å页ï¼å¹¶æ¸
ç©ºè¡¨æ ¼æ°æ®145 self.clearFormData();146 self.closeForm();147 //å·æ°å½å页148 self.$emit("refreshPro");149 } else {150 self.$message({151 message: "æ交失败",152 type: 'warning'153 });154 }155 }156 })157 .catch(error =>158 self.$message({159 message: error.message,160 type: 'error'161 }),162 self.logining = false163 );164 } else {165 console.log('error submit!!');166 return false;167 }168 });169 },170 clearFormData: function () {171 var self = this;172 self.createProject.projectInstitution = "";173 self.createProject.projectFinance = "è¡æ¿æ¿æ³è¡";174 self.createProject.projectName = "";175 self.createProject.projectType = "æ°å»º";176 self.createProject.projectMoney = "";177 self.createProject.projectIndustry = {first: "", second: ""};178 self.createProject.projectMoneyFrom = [];179 self.createProject.projectBeginTime = "";180 self.createProject.projectContactUserName = "";181 self.createProject.projectContactUserPhone = "";182 self.createProject.projectSituation = "";183 self.createProject.projectYears = 1;184 },185 //éæ©ä¸çº§186 selectFirstChange(value) {187 var self = this;188 var index = _.findIndex(self.selectIndustry, function (o) {189 return o.value == value;190 });191 self.newIndustry = self.selectIndustry[index].childrens;192 self.createProject.projectIndustry.second = self.newIndustry[0].name;193 },194 //éæ©äºçº§195 selectSecondChange(value) {196 this.createProject.projectIndustry.second = value;197 },198 //éæ°å
¥åº199 updateForm: function (oldStep) {200 let self = this;201 self.$refs.createProject.validate((valid) => {202 if (valid) {203 //æ´æ°æ°å»ºè¡¨çéåºç¶æ为falseï¼æ´æ°è¡¨çstep为1204 let data = _.cloneDeep(self.createProject);205 data.step = 1;206 data.ifReturned = 0;207 data.oldStep = oldStep;208 if (oldStep == 1) {209 data.stepOneApp = 2;210 }211 if (data.projectIndustry.first) {212 data.projectIndustry = '{"' + data.projectIndustry.first + '","' + data.projectIndustry.second + '"}';213 } else {214 data.projectIndustry = "";215 }216 if (data.projectMoneyFrom) {217 data.projectMoneyFrom = JSON.stringify(data.projectMoneyFrom).replace("[", "{").replace("]", "}");218 } else {219 data.projectMoneyFrom = [];220 }221 data.commitName = self.user.role;222 data.projectCommitTime = Utils.formatDate(new Date()) + ".000";223 for (var i = 0; i < self.getProjectYears.length; i++) {224 if (data.projectYears == self.getProjectYears[i].name) {225 data.projectYears = self.getProjectYears[i].value;226 }227 }228 self.$http.post('/api/project/updateProject', data).then(res => {229 let status = res.status;230 let statusText = res.statusText;231 if (status !== 200) {232 self.$message({233 message: statusText,234 type: 'error'235 });236 } else {237 if (res.data.length != 0) {238 self.$message({239 message: "æ交æå",240 type: 'success'241 });242 //å
³éå½å页ï¼å¹¶æ¸
ç©ºè¡¨æ ¼æ°æ®243 self.clearFormData();244 self.closeForm();245 //å·æ°å½å页246 if (oldStep == 0) {247 self.$emit('updateReturnForm');248 } else {249 self.$emit('refreshPro');250 }251 } else {252 self.$message({253 message: "æ交失败",254 type: 'warning'255 });256 }257 }258 })259 .catch(error =>260 self.$message({261 message: error.message,262 type: 'error'263 }),264 );265 }266 else {267 console.log('error submit!!');268 return false;269 }270 });271 }272 ,273 handleClose(done) {274 this.$confirm('确认å
³éï¼')275 .then(_ => {276 done();277 })278 .catch(_ => {279 });280 }281 ,282 queryNewProject: function () {283 }284 ,285 queryNewProjectCount: function () {286 }287 ,288 showDefaultQuickQuery: function () {289 }290 ,291 handleSelectionChange: function () {292 }293// //ç¹å»è¯¦æ
æ¥å£è¿åçæ°æ®294// this.wids = res.data.result.wids //ç¹å»è¯¦æ
æ¥å£è¿åç tableé被éä¸çè¡çwids295// let a = res.data.result.wids.split(',') //åå²ææ°ç»296// console.log(a)297// let b = []298// this.tableData1.forEach(res=>{ //æè¡¨æ ¼éææçidå å
¥å°bé299// b.push(res.id.toString())300// })301// console.log(b)302// // console.log(typeof(b[0]))303// for(let c = 0;c<b.length;c++){ //对bå¾ªç¯ å¦æbéé¢æaï¼aæ¯è¢«éä¸çè¡ï¼ åæç´¢å¼ä»£å
¥å°firstå½æ°é 让è¿äºè¡çå¤éæ¡éä¸304// // console.log(b[c])305// // console.log(a.indexOf(b[c]))306// if(b.indexOf(a[c])>=0){307// console.log(a.indexOf(b[c]))308// this.first([this.tableData1[b.indexOf(a[c])]])309// }310// }311//312//313//314// //å°è£
ç让tableè¡¨æ ¼çå¤éæ¡é»è®¤éä¸çå½æ°315// first(rows){316// this.$nextTick(()=>{317// rows.forEach(row => {318// this.$refs.multipleTable.toggleRowSelection(row,true);319// });320// })321// },322// //æ¸
é¤ç323// clear(){324// this.$nextTick(()=>{325// this.$refs.multipleTable.clearSelection();326// })327// },328 },329 watch: {330 "returnProjectInfo": {331 immediate: true,332 handler: function (val) {333 var self = this;334 if (val) {335 self.createProject.id = val.id;336 self.createProject.projectInstitution = val.projectInstitution;337 self.createProject.projectFinance = val.projectFinance;338 self.createProject.projectName = val.projectName;339 self.createProject.projectType = val.projectType;340 self.createProject.projectMoney = val.projectMoney;341 self.createProject.projectIndustry = val.projectIndustry;342 if (val.projectIndustry) {343 var ins1 = val.projectIndustry.split(",")[0].replace("{", "");344 var ins2 = val.projectIndustry.split(",")[1].replace("}", "");345 } else {346 var ins1 = "";347 var ins2 = "";348 }349 // console.log(ins1);350 // console.log(ins2);351 // self.createProject.projectIndustry.first = ins1;352 // self.createProject.projectIndustry.second = ins2;353 self.createProject.projectIndustry = {first: ins1, second: ins2};354 if (val.projectMoneyFrom) {355 self.createProject.projectMoneyFrom = JSON.parse(val.projectMoneyFrom.replace("{", "[").replace("}", "]"));356 } else {357 self.createProject.projectMoneyFrom = [];358 }359 self.createProject.projectBeginTime = val.projectBeginTime;360 self.createProject.projectContactUserName = val.projectContactUserName;361 self.createProject.projectContactUserPhone = val.projectContactUserPhone;362 self.createProject.projectSituation = val.projectSituation;363 self.createProject.projectYears = val.projectYears;364 }365 }366 },367 "reCommitProjectInfo": {368 immediate: true,369 handler: function (val) {370 var self = this;371 if (val) {372 self.createProject.id = val.id;373 self.createProject.projectInstitution = val.projectInstitution;374 self.createProject.projectFinance = val.projectFinance;375 self.createProject.projectName = val.projectName;376 self.createProject.projectType = val.projectType;377 self.createProject.projectMoney = val.projectMoney;378 self.createProject.projectIndustry = val.projectIndustry;379 if (val.projectIndustry) {380 var ins1 = val.projectIndustry.split(",")[0].replace("{", "");381 var ins2 = val.projectIndustry.split(",")[1].replace("}", "");382 } else {383 var ins1 = "";384 var ins2 = "";385 }386 // console.log(ins1);387 // console.log(ins2);388 // self.createProject.projectIndustry.first = ins1;389 // self.createProject.projectIndustry.second = ins2;390 self.createProject.projectIndustry = {first: ins1, second: ins2};391 if (val.projectMoneyFrom) {392 self.createProject.projectMoneyFrom = JSON.parse(val.projectMoneyFrom.replace("{", "[").replace("}", "]"));393 } else {394 self.createProject.projectMoneyFrom = [];395 }396 self.createProject.projectBeginTime = val.projectBeginTime;397 self.createProject.projectContactUserName = val.projectContactUserName;398 self.createProject.projectContactUserPhone = val.projectContactUserPhone;399 self.createProject.projectSituation = val.projectSituation;400 self.createProject.projectYears = val.projectYears;401 }402 }403 },404 'type': {405 immediate: true,406 handler: function (val) {407 var self = this;408 if (val == 'new') {409 self.clearFormData();410 }411 }412 }413 },...
projects.ts
Source:projects.ts
...19 Project.load(Path.resolve(REPO_ROOT, rootRelativePath), options, {20 cache: PROJECT_CACHE,21 });22const findProjects = (patterns: string[]) =>23 globby.sync(patterns, { cwd: REPO_ROOT }).map((path) => createProject(path));24export const PROJECTS = [25 createProject('tsconfig.json'),26 createProject('test/tsconfig.json', { name: 'kibana/test' }),27 createProject('x-pack/test/tsconfig.json', { name: 'x-pack/test' }),28 createProject('x-pack/performance/tsconfig.json', { name: 'x-pack/performance' }),29 createProject('src/core/tsconfig.json'),30 createProject('.buildkite/tsconfig.json'),31 createProject('kbn_pm/tsconfig.json'),32 createProject('x-pack/plugins/drilldowns/url_drilldown/tsconfig.json', {33 name: 'security_solution/cypress',34 }),35 createProject('x-pack/plugins/security_solution/cypress/tsconfig.json', {36 name: 'security_solution/cypress',37 }),38 createProject(39 'x-pack/plugins/enterprise_search/public/applications/shared/cypress/tsconfig.json',40 { name: 'enterprise_search/shared/cypress' }41 ),42 createProject(43 'x-pack/plugins/enterprise_search/public/applications/enterprise_search_overview/cypress/tsconfig.json',44 { name: 'enterprise_search/overview/cypress' }45 ),46 createProject(47 'x-pack/plugins/enterprise_search/public/applications/app_search/cypress/tsconfig.json',48 { name: 'enterprise_search/app_search/cypress' }49 ),50 createProject(51 'x-pack/plugins/enterprise_search/public/applications/workplace_search/cypress/tsconfig.json',52 { name: 'enterprise_search/workplace_search/cypress' }53 ),54 createProject('x-pack/plugins/osquery/cypress/tsconfig.json', {55 name: 'osquery/cypress',56 }),57 createProject('x-pack/plugins/apm/ftr_e2e/tsconfig.json', {58 name: 'apm/ftr_e2e',59 disableTypeCheck: true,60 }),61 createProject('x-pack/plugins/fleet/cypress/tsconfig.json', {62 name: 'fleet/cypress',63 }),64 createProject('x-pack/plugins/synthetics/e2e/tsconfig.json', {65 name: 'uptime/synthetics-e2e-tests',66 disableTypeCheck: true,67 }),68 createProject('x-pack/plugins/ux/e2e/tsconfig.json', {69 name: 'ux/synthetics-e2e-tests',70 disableTypeCheck: true,71 }),72 createProject('x-pack/plugins/observability/e2e/tsconfig.json', {73 name: 'observability/synthetics-e2e-tests',74 disableTypeCheck: true,75 }),76 createProject('x-pack/plugins/threat_intelligence/cypress/tsconfig.json', {77 name: 'threat_intelligence/cypress',78 disableTypeCheck: true,79 }),80 // Glob patterns to be all search at once81 ...findProjects([82 'src/plugins/*/tsconfig.json',83 'src/plugins/chart_expressions/*/tsconfig.json',84 'src/plugins/vis_types/*/tsconfig.json',85 'x-pack/plugins/*/tsconfig.json',86 'x-pack/plugins/cloud_integrations/*/tsconfig.json',87 'examples/*/tsconfig.json',88 'x-pack/examples/*/tsconfig.json',89 'test/analytics/fixtures/plugins/*/tsconfig.json',90 'test/plugin_functional/plugins/*/tsconfig.json',...
createProject.steps.js
Source:createProject.steps.js
...27});28When('I create(d) new project', () => {29 CreateProject.projectName = CREATE_PROJECT.title.valid;30 browser.refresh();31 CreateProject.createProject(CreateProject.projectName);32 clickElement(CreateProject.finishBtn());33});34When('I edit the data', () => {35 CreateProject.createProject(CreateProject.projectName);36 setValue(CreateProject.titleInput(), CREATE_PROJECT.title.edited);37 setValue(CreateProject.descriptionInput(), CREATE_PROJECT.description.edited);38 setValue(CreateProject.domainInput(), CREATE_PROJECT.domain.edited);39});40When(/^I enter title and description longer than required$/, () => {41 setValue(CreateProject.titleInput(), CREATE_PROJECT.title.tooLong);42 setValue(CreateProject.descriptionInput(), CREATE_PROJECT.description.tooLong);43 clickElement(CreateProject.domainInput());44 clickElement(CreateProject.finishBtn());45});46Then('{string} status is displayed', status => {47 expect(CreateProject.statusDropdown()).toHaveText(status);48});49Then('created project is at the top of the list', () => {...
Using AI Code Generation
1var BestPracticeService = require('./BestPracticeService');2var bestPracticeService = new BestPracticeService();3var project = bestPracticeService.createProject("Project 1");4function BestPracticeService() {5}6BestPracticeService.prototype.createProject = function(projectName) {7 var project = new Project();8 project.name = projectName;9 return project;10};11function Project() {12}13module.exports = BestPracticeService;14var Project = require('./Project');15var Project = require('./Project');16var Project = require('./Project');17var Project = require('./Project');18var Project = require('./Project');
Using AI Code Generation
1var BestProject = require("bestProject.js");2var project = new BestProject("test4");3project.createProject();4var BestProject = require("bestProject.js");5var project = new BestProject("test4");6project.createProject();7var BestProject = require("bestProject.js");8var project = new BestProject("test4");9project.createProject();10var BestProject = require("bestProject.js");11var project = new BestProject("test4");12project.createProject();13var BestProject = require("bestProject.js");14var project = new BestProject("test4");15project.createProject();16var BestProject = require("bestProject.js");17var project = new BestProject("test4");18project.createProject();19var BestProject = require("bestProject.js");20var project = new BestProject("test4");21project.createProject();22var BestProject = require("bestProject.js");23var project = new BestProject("test4");24project.createProject();25var BestProject = require("bestProject.js");26var project = new BestProject("test4");27project.createProject();28var BestProject = require("bestProject.js");29var project = new BestProject("test4");30project.createProject();31var BestProject = require("bestProject.js");32var project = new BestProject("test4");33project.createProject();34var BestProject = require("bestProject.js");35var project = new BestProject("test4");36project.createProject();37var BestProject = require("bestProject.js");38var project = new BestProject("test4");39project.createProject();40var BestProject = require("bestProject.js");41var project = new BestProject("test4");42project.createProject();43var BestProject = require("best
Using AI Code Generation
1var BestProject = require('./bestProject');2var project = new BestProject();3console.log(project.createProject('My Project'));4console.log(project.startProject());5var BestProject = function() {6 this.createProject = function(name) {7 return 'Project ' + name + ' created';8 };9 this.startProject = function() {10 return 'Project started';11 };12};13module.exports = BestProject;14var BestProject = function() {15 this.createProject = function(name) {16 return 'Project ' + name + ' created';17 };18 this.startProject = function() {19 return 'Project started';20 };21};22module.exports = new BestProject();23var BestProject = function() {24 this.createProject = function(name) {25 return 'Project ' + name + ' created';26 };27 this.startProject = function() {28 return 'Project started';29 };30};31exports = new BestProject();
Using AI Code Generation
1var Project = require("./project");2var BestPractice = require("./bestPractice");3var bp = new BestPractice();4bp.createProject("project1");5bp.createProject("project2");6bp.createProject("project3");7bp.addProject("project1", "task1");8bp.addProject("project1", "task2");9bp.addProject("project2", "task1");10bp.addProject("project2", "task2");11bp.addProject("project3", "task1");12bp.addProject("project3", "task2");13bp.showProjects();14var Project = require("./project");15var BestPractice = require("./bestPractice");16var bp = new BestPractice();17bp.createProject("project1");18bp.createProject("project2");19bp.createProject("project3");20bp.addProject("project1", "task1");21bp.addProject("project1", "task2");22bp.addProject("project2", "task1");23bp.addProject("project2", "task2");24bp.addProject("project3", "task1");25bp.addProject("project3", "task2");26bp.showProjects();27var Project = require("./project");28var BestPractice = require("./bestPractice");29var bp = new BestPractice();30bp.createProject("project1");31bp.createProject("project2");32bp.createProject("project3");33bp.addProject("project1", "task1");34bp.addProject("project1", "task2");35bp.addProject("project2", "task1");36bp.addProject("project2", "task2");37bp.addProject("project3", "task1");38bp.addProject("project3", "task2");39bp.showProjects();40var Project = require("./project");41var BestPractice = require("./bestPractice");42var bp = new BestPractice();43bp.createProject("project1");44bp.createProject("project2");45bp.createProject("project3");46bp.addProject("project1", "task1");47bp.addProject("project1
Using AI Code Generation
1var bestProject = require('./bestProject');2var project = new bestProject();3var projectName = 'Best Project';4var projectLocation = 'Bangalore';5var projectDuration = 4;6var projectBudget = 100000;7var projectTeamSize = 10;8var projectDescription = 'This is the best project';9var projectDetails = project.createProject(projectName, projectLocation, projectDuration, projectBudget, projectTeamSize, projectDescription);10console.log('Project Details: ' + projectDetails);11var BestProject = (function () {12 function BestProject() {13 }14 BestProject.prototype.createProject = function (projectName, projectLocation, projectDuration, projectBudget, projectTeamSize, projectDescription) {15 'Project Description: ' + projectDescription;16 return projectDetails;17 };18 return BestProject;19}());20module.exports = BestProject;21var bestProject = require('./bestProject');22var project = new bestProject();23var projectName = 'Best Project';24var projectLocation = 'Bangalore';25var projectDuration = 4;26var projectBudget = 100000;27var projectTeamSize = 10;28var projectDescription = 'This is the best project';29var projectDetails = project.createProject(projectName, projectLocation, projectDuration, projectBudget, projectTeamSize, projectDescription);30console.log('Project Details: ' + projectDetails);31var BestProject = (function () {32 function BestProject() {33 }34 BestProject.prototype.createProject = function (projectName, projectLocation, projectDuration, projectBudget, projectTeamSize, projectDescription) {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!