{"remainingRequest":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\bzzgj-fvue\\src\\views\\Device\\resourceManage\\components\\taskFormDialog.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\src\\views\\Device\\resourceManage\\components\\taskFormDialog.vue","mtime":1667545182676},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport req from '@/request.js'\r\nimport collection from '@/api/device/collection.js'\r\nexport default {\r\n name: 'TaskFormDialog',\r\n data() {\r\n return {\r\n visible: false,\r\n title: '新增',\r\n params: {\r\n taskName: '', //任务名称\r\n taskType: undefined, //任务类别\r\n taskClass: '', //任务执行类\r\n taskRate: null, //任务调用频率\r\n taskRateUnit: 'm', //任务调用频率单位(m:分钟,h:小时,d:天,w:周,M:月,Y:年)\r\n sourceCode: '', //数据源\r\n sourceTable: '', //源表名\r\n taskMemo: '', //任务说明\r\n taskStatus: '',\r\n },\r\n dataSources: [], //数据源列表\r\n sourceTables: [], //源表名列表\r\n taskTypes: [\r\n {value: 1, label: '定时任务'},\r\n {value: 2, label: '非定时任务'},\r\n ], //任务类别列表\r\n taskRateUnits: [\r\n {value: 0, label: 'm'},\r\n {value: 1, label: 'h'},\r\n {value: 2, label: 'd'},\r\n {value: 3, label: 'w'},\r\n {value: 4, label: 'M'},\r\n {value: 5, label: 'Y'},\r\n ], //任务调用频率单位列表\r\n rules: {\r\n taskName: [\r\n {\r\n required: true,\r\n message: '请输入任务名称',\r\n trigger: 'blur',\r\n },\r\n ],\r\n taskType: [\r\n {\r\n required: true,\r\n message: '请选择任务类别',\r\n trigger: 'blur',\r\n },\r\n ],\r\n taskClass: [\r\n {\r\n required: true,\r\n message: '请输入任务执行类',\r\n trigger: 'blur',\r\n },\r\n ],\r\n taskRate: [\r\n {\r\n required: true,\r\n message: '请输入任务调用频率',\r\n trigger: 'blur',\r\n },\r\n ],\r\n },\r\n }\r\n },\r\n methods: {\r\n add() {\r\n this.visible = true\r\n this.getDataSources()\r\n },\r\n edit(row) {\r\n this.title = '修改'\r\n this.getDataSources()\r\n this.getDetail(row.id)\r\n },\r\n // 关闭新增窗口\r\n handleClose() {\r\n this.params = {\r\n taskName: '', //任务名称\r\n taskType: undefined, //任务类别\r\n taskClass: '', //任务执行类\r\n taskRate: null, //任务调用频率\r\n taskRateUnit: 'm', //任务调用频率单位(m:分钟,h:小时,d:天,w:周,M:月,Y:年)\r\n sourceCode: '', //数据源\r\n sourceTable: '', //源表名\r\n taskMemo: '', //任务说明\r\n taskStatus: '',\r\n }\r\n this.title = '新增'\r\n this.$refs.formInfo.resetFields()\r\n this.visible = false\r\n },\r\n //获取源表名\r\n remoteMethod(query) {\r\n let obj = {\r\n dsalias: this.params.sourceCode,\r\n isTable: '1',\r\n objName: query,\r\n }\r\n this.sourceTables = []\r\n collection.sourceTables(obj, (res) => {\r\n this.sourceTables = res\r\n })\r\n },\r\n // 根据ID查询\r\n getDetail(id) {\r\n collection.detailId(id, (res) => {\r\n this.params = res\r\n this.visible = true\r\n })\r\n },\r\n // 保存新增任务\r\n handleSave() {\r\n this.$refs.formInfo.validate((valid) => {\r\n console.log(valid)\r\n if (valid) {\r\n if (this.title === '新增') {\r\n let arr = JSON.parse(JSON.stringify(this.params))\r\n collection.addSave(this.params, (response) => {\r\n if (response.state) {\r\n this.$notify({\r\n type: 'success',\r\n message: '新增成功',\r\n duration: 2000,\r\n })\r\n this.handleClose()\r\n this.$emit('reload')\r\n }\r\n })\r\n }\r\n if (this.title === '修改') {\r\n collection.upData(this.params, (response) => {\r\n if (response.state) {\r\n this.$notify({\r\n type: 'success',\r\n message: '修改成功',\r\n duration: 2000,\r\n })\r\n this.handleClose()\r\n this.$emit('reload')\r\n }\r\n })\r\n }\r\n }else{\r\n this.$notify({\r\n type: 'warning',\r\n message: \"请完善表单信息!\",\r\n duration: 2000,\r\n })\r\n }\r\n })\r\n },\r\n // 验证任务执行\r\n verification() {\r\n let className = this.params.taskClass\r\n if (!className) {\r\n this.$message({\r\n message: '任务执行类为空!',\r\n type: 'warning',\r\n duration: 2000,\r\n })\r\n return\r\n }\r\n collection.verification(className, (res) => {\r\n console.log(res)\r\n if (res.state) {\r\n this.$message({\r\n message: '验证成功',\r\n type: 'success',\r\n duration: 2000,\r\n })\r\n }\r\n })\r\n },\r\n // 获取数据源\r\n getDataSources() {\r\n let portal = window.context.portal\r\n req.get(portal + '/sys/sysDataSource/v1/getDataSources').then((res) => {\r\n this.dataSources = res.data\r\n })\r\n },\r\n },\r\n}\r\n",null]}