webpackJsonp([14],{QBql:function(e,t){},QiTB:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=a("mvHQ"),s=a.n(o),r=(a("ftAF"),a("wuJz")),l=a("9G5k"),n=a.n(l),i={created:function(){this.getTableBase()},data:function(){return{saving:!1,formData:{},rules:{},tableColumns:[],databasetype:"Mysql",tableName:"",modules:[]}},methods:{onSave:function(){var e=this;this.$refs.form.validate(function(t){if(!t)return!1;e.submit()})},submit:function(){var e=this,t=JSON.parse(s()(this.formData));for(var a in t){var o=0,l="text";this.tableColumns.forEach(function(e){e.value==a&&(o=1,l=e.type)}),o?"date"==l&&(t[a]=Object(r.format)(t[a],"YYYY/MM/DD HH:mm",{locale:n.a})):delete t[a]}var i={formData:s()(t),tableName:this.tableName,primaryKey:this.formData.id||this.formData.ID,databasetype:this.databasetype};this.$http.post({url:this.formData.id||this.formData.ID?"/commonQuery/update":"/commonQuery/save",data:i}).then(function(t){t.success?(e.$message.success("成功"),e.$router.go(-1)):e.$message.warning("失败")})},getData:function(){var e=this;this.$route.query.id&&this.$http.get({url:"/commonQuery/one",data:{tableName:this.tableName,primaryKey:this.$route.query.id,databasetype:this.databasetype}}).then(function(t){t.success&&(e.tableColumns.forEach(function(e){"date"==e.type&&(t.data[e.value]=new Date(t.data[e.value]))}),e.formData=t.data)})},getTableBase:function(){var e=this;this.$http.get({url:"/queryConfig/getOne",data:{code:this.$route.query.code}}).then(function(t){t.success&&(t.data&&(e.modules=t.data.modules.split(","),e.tableName=t.data.tableName,e.databasetype=t.data.databasetype,e.tableColumns=[],t.data.tablecolumns.split("_;").forEach(function(t){var a=t.split("_,"),o={label:a[0],value:a[1],type:a[2]?a[2]:"text",show:!0};e.tableColumns.push(o)}),e.getData()))})},onDelete:function(){var e=this;this.$route.query.id&&this.$alert("删除将无法恢复，确认要删除么？","警告",{type:"error"}).then(function(){return e.$http.post({url:"/commonQuery/del",data:{tableName:e.tableName,primaryKey:e.$route.query.id,databasetype:e.databasetype}})}).then(function(){e.$message.success("删除成功"),e.$router.go(-1)}).catch(function(t){"cancel"===t?e.$message.info("删除取消"):e.$message.error("删除失败")})},isModulesShow:function(e){return!!this.modules.find(function(t){return t===e})}}},u={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("el-form",{ref:"form",staticStyle:{"max-width":"500px"},attrs:{model:e.formData,rules:e.rules,"label-width":"80px","label-position":"right",size:"small"}},[e._l(e.tableColumns,function(t){return[a("el-form-item",{attrs:{prop:t.value,label:t.label}},["text"==t.type?a("el-input",{model:{value:e.formData[t.value],callback:function(a){e.$set(e.formData,t.value,a)},expression:"formData[item.value]"}}):e._e(),e._v(" "),"date"==t.type?[a("div",{staticClass:"block"},[a("el-date-picker",{attrs:{type:"datetime",placeholder:"选择日期"},model:{value:e.formData[t.value],callback:function(a){e.$set(e.formData,t.value,a)},expression:"formData[item.value]"}})],1)]:e._e(),e._v(" "),"image"==t.type?a("single-upload",{model:{value:e.formData[t.value],callback:function(a){e.$set(e.formData,t.value,a)},expression:"formData[item.value]"}}):e._e()],2)]}),e._v(" "),a("el-form-item",[a("el-button",{attrs:{loading:e.$store.state.fetchingData,type:"primary"},on:{click:e.onSave}},[e._v("保存")]),e._v(" "),e.$route.query.id&&e.isModulesShow("del")?a("el-button",{attrs:{type:"danger"},on:{click:e.onDelete}},[e._v("删除")]):e._e(),e._v(" "),a("el-button",{on:{click:function(t){e.$router.go(-1)}}},[e._v("取消")])],1)],2)],1)},staticRenderFns:[]};var m=a("VU/8")(i,u,!1,function(e){a("QBql")},"data-v-dab2e0c0",null);t.default=m.exports}});
//# sourceMappingURL=14.8e9b1d8bd4bc79616a30.js.map