New file |
| | |
| | | |
| | | <!doctype html> |
| | | <html> |
| | | <head> |
| | | <meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache"> |
| | | <title>终端更改信息</title> |
| | | |
| | | <script type="text/javascript"> |
| | | var pageVue = null; |
| | | function loadJsCss(callback) { |
| | | var jscss_urls = []; |
| | | window.top.initJsCss(document, jscss_urls, callback); |
| | | }; |
| | | |
| | | function initVue() { |
| | | new FormVue({ |
| | | el: "#vbody", |
| | | data: { |
| | | dataname: "md_hospital", |
| | | title: "终端更改信息", |
| | | newformData: {}, |
| | | formAttr: { |
| | | istitle: false, |
| | | title: "表单名称", |
| | | columnnumber: 3, |
| | | labelwidth: "120px", |
| | | labelposition: "left",//"left",// right//top |
| | | size: "mini", |
| | | border: "10px solid #c6c6c600" |
| | | }, |
| | | dataRequest: [ |
| | | { |
| | | name: "md_geo_province", |
| | | dataname: "md_geo_province", |
| | | isnotoption: false, //true:不是选项 |
| | | code:"id",//是下拉选项时设置 |
| | | label:"name",//是下拉选项时设置 |
| | | filter: "", |
| | | orderby: "name" |
| | | }, |
| | | { |
| | | name: "md_geo_city", |
| | | dataname: "md_geo_city", |
| | | isnotoption: false, //true:不是选项 |
| | | code:"id",//是下拉选项时设置 |
| | | label:"name",//是下拉选项时设置 |
| | | filter: "", |
| | | orderby: "name" |
| | | }, |
| | | { |
| | | name: "md_geo_county", |
| | | dataname: "md_geo_county", |
| | | isnotoption: false, //true:不是选项 |
| | | code:"id",//是下拉选项时设置 |
| | | label:"name",//是下拉选项时设置 |
| | | filter: "", |
| | | orderby: "name" |
| | | }, |
| | | ], |
| | | options_md_geo_province: [], |
| | | md_geo_city_obj: {}, |
| | | md_geo_county_obj:{}, |
| | | formFields: [], |
| | | |
| | | formData: {}, |
| | | |
| | | //按键权限设置 |
| | | isedit: false,//提交前编辑,保存/提交 |
| | | isrefuseedit: false,//拒绝后编辑,保存/再次提交 |
| | | isapproval: false,//审批,同意/拒绝/转办/退回 |
| | | |
| | | iscommit: false,//提交标记 |
| | | |
| | | //弹窗参数 |
| | | popupParames: {}, |
| | | //字段设置 |
| | | tablefieldClick: {}, |
| | | formfieldClick: {}, |
| | | dheight: null |
| | | }, |
| | | created() { |
| | | this.popupParames = clone(Root.popupParames); |
| | | this.title = this.popupParames.title || this.popupParames.text |
| | | if (this.popupParames.data) { |
| | | this.formData = clone(this.popupParames.data); |
| | | } |
| | | |
| | | if (this.popupParames.sceneCode) { |
| | | if (this.popupParames.sceneCode == "add") {//新增 |
| | | |
| | | //动态获取默认数据 |
| | | var newEntity_ = { |
| | | name: "newEntity", |
| | | url: "root/data/newEntity", |
| | | paramsobj: {dataname: this.dataname}, |
| | | isnotoption: true, //true:不是选项 |
| | | } |
| | | this.dataRequest.push(newEntity_); |
| | | this.isedit = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "browse") {//只读 |
| | | this.formAttr.disabled = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "edit") {//编辑 |
| | | this.isedit = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "approval") {//审批 |
| | | this.formAttr.disabled = true; |
| | | this.isapproval = true; |
| | | } |
| | | else if (this.popupParames.sceneCode == "refuseedit") {//拒绝后的编辑 |
| | | this.isrefuseedit = true; |
| | | } |
| | | } |
| | | }, |
| | | |
| | | mounted() { |
| | | var me = this; |
| | | var title_h = 0; |
| | | if (me.popupParames.totab){ |
| | | title_h = 42; |
| | | } |
| | | me.dheight = document.documentElement.clientHeight - 50 - title_h; |
| | | |
| | | //预加载数据 |
| | | if (this.dataRequest && this.dataRequest.length) { |
| | | var result = {}; |
| | | this.loadRequestData(this.dataRequest, result, function(data) { |
| | | me.dataRequestObj = data; |
| | | //预加载数据后给哪些字段设置options或formatterjson |
| | | if (me.dataRequestObj.md_geo_province) { |
| | | me.options_md_geo_province = me.dataRequestObj.md_geo_province |
| | | } |
| | | if (me.dataRequestObj.md_geo_city) { |
| | | var md_geo_city_obj_ = {}; |
| | | var options_md_geo_city_ = [] |
| | | var options_md_geo_city_ = clone(me.dataRequestObj.md_geo_city) |
| | | options_md_geo_city_.map(o=>{ |
| | | if (!md_geo_city_obj_[o.province]) { |
| | | md_geo_city_obj_[o.province] = [] |
| | | } |
| | | md_geo_city_obj_[o.province].push(o) |
| | | }) |
| | | me.md_geo_city_obj = clone(md_geo_city_obj_) |
| | | } |
| | | if (me.dataRequestObj.md_geo_county) { |
| | | var md_geo_county_obj_ = {}; |
| | | var options_md_geo_county_ = [] |
| | | var options_md_geo_county_ = clone(me.dataRequestObj.md_geo_county) |
| | | options_md_geo_county_.map(o=>{ |
| | | if (!md_geo_county_obj_[o.city]) { |
| | | md_geo_county_obj_[o.city] = [] |
| | | } |
| | | md_geo_county_obj_[o.city].push(o) |
| | | }) |
| | | me.md_geo_county_obj = clone(md_geo_county_obj_) |
| | | } |
| | | if (me.dataRequestObj.newEntity) { |
| | | var formData = clone(me.dataRequestObj.newEntity.data[me.dataname]); |
| | | // formData.product_category_name = []; |
| | | if (me.newformData) { |
| | | let formData_ = clone(formData); |
| | | |
| | | for (var k in me.newformData) { |
| | | if (!formData_[k]) { |
| | | formData_[k] = me.newformData[k]; |
| | | } |
| | | } |
| | | |
| | | me.formData = formData_; |
| | | } |
| | | } |
| | | me.initData(); |
| | | }); |
| | | } |
| | | else { |
| | | this.initData(); |
| | | } |
| | | |
| | | // 以服务的方式调用的 Loading 需要异步关闭 |
| | | this.$nextTick(() => { |
| | | hideLoading(); |
| | | |
| | | //重新设置弹窗宽高 |
| | | // this.$nextTick(function(){ |
| | | // //let w_ = this.$refs.popup_body.offsetWidth + "px"; |
| | | // let w_ = "900px"; |
| | | // let h_ = this.$refs.popup_body.offsetHeight + "px"; |
| | | // Root.setPopupWH(w_, h_); |
| | | // }) |
| | | }); |
| | | }, |
| | | |
| | | methods:{ |
| | | //关闭弹窗 |
| | | closeDialog() { |
| | | var me = this; |
| | | if (me.popupParames.totab){ |
| | | Root.tab.removeItem(Root.tab.selected); |
| | | Root.tab.open(me.popupParames.parentOption, false); |
| | | } |
| | | else { |
| | | Root.hidePopup(); |
| | | } |
| | | }, |
| | | //关闭前调回调 |
| | | saveAfter() { |
| | | var me = this; |
| | | if(this.popupParames.callback) { |
| | | let obj = { |
| | | //row: this.formData |
| | | } |
| | | this.popupParames.callback(obj, function() { |
| | | me.closeDialog(); |
| | | }); |
| | | } |
| | | else { |
| | | me.closeDialog(); |
| | | } |
| | | }, |
| | | |
| | | initData() { |
| | | let me = this; |
| | | var id_ = null; |
| | | if (this.formData.id) { |
| | | id_ = this.formData.id; |
| | | } |
| | | this.getRowDataById(id_, function(result) {//查询后的回调,用于获取字段的 |
| | | if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) { |
| | | var metas = clone(result.meta[me.dataname].fields); |
| | | var formFields_ = []; |
| | | |
| | | metas.map(f=>{ |
| | | f.isshow = "T"; |
| | | if (f.field == "province") { |
| | | f.options = me.options_md_geo_province; |
| | | } |
| | | if (f.field == "code") { |
| | | f.disabled = true |
| | | } |
| | | if (f.field == "is_active") { |
| | | f.optionsgroup = "truefalse" |
| | | } |
| | | formFields_.push(clone(f)); |
| | | }) |
| | | if (!me.formFields || (me.formFields && me.formFields.length == 0)) { |
| | | me.formFields = clone(formFields_); |
| | | |
| | | //字段数组转字段obj,目的为了筛选时获取字段属性 |
| | | me.fieldsToFieldsObj(); |
| | | |
| | | //设置字段事件 |
| | | me.tableFieldClick(); |
| | | } |
| | | me.formData = getDataByFields(me.formData, me.formFields); |
| | | |
| | | if (me.rowData[me.dataname]) { |
| | | me.formData = clone(me.rowData[me.dataname]); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | tableFieldClick() { |
| | | var me = this; |
| | | //表格字段事件设置 |
| | | this.tablefieldClick = {}; |
| | | |
| | | //表单字段事件设置 |
| | | this.formfieldClick = { |
| | | province: {//字段事件设置 |
| | | select: { |
| | | onchange: function(obj, refreshCallback) {//下拉展开事件 |
| | | obj.data.province = obj.selectoption.value || ""; |
| | | obj.data.city = ""; |
| | | obj.data.county = ""; |
| | | refreshCallback(); |
| | | // me.$set(me.tabsobj.DDWL, "formData", me.tabsobj.DDWL.formData); |
| | | // var formData_ = clone(me.tabsobj.DDWL.formData); |
| | | // me.tabsobj.DDWL.formData = formData_; |
| | | }, |
| | | }, |
| | | }, |
| | | city: {//字段事件设置 |
| | | visible: { |
| | | onchange: function(obj,row,callback) {//下拉展开事件 |
| | | if (me.formData.province) { |
| | | var formFields_ = clone(me.formFields); |
| | | formFields_.map(f=>{ |
| | | if (f.field == "city") { |
| | | if (me.md_geo_city_obj[me.formData.province] && me.md_geo_city_obj[me.formData.province].length) { |
| | | f.options = clone(me.md_geo_city_obj[me.formData.province]) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | me.formFields = clone(formFields_); |
| | | } |
| | | }, |
| | | select: { |
| | | onchange: function(obj,refreshCallback) {//下拉展开事件 |
| | | obj.data.city = obj.selectoption.value || ""; |
| | | obj.data.county = ""; |
| | | refreshCallback() |
| | | }, |
| | | }, |
| | | }, |
| | | county: { |
| | | visible: { |
| | | onchange: function(fieldObj, row, callback) {//下拉展开事件 |
| | | let param_p = { |
| | | dataname: "md_geo_city", |
| | | filter: "name='" + row.city + "'", |
| | | } |
| | | Server.call("root/data/getEntitySet", param_p, function(resultp) { |
| | | if (resultp && resultp.data) { |
| | | let param_ = { |
| | | dataname: "md_geo_county", |
| | | filter:"city_id='" + resultp.data.entityset[0].id + "'", |
| | | } |
| | | Server.call("root/data/getEntitySet", param_, function(result) { |
| | | if (result && result.data) { |
| | | var options_ = result.data.entityset; |
| | | for(var i=0; i<options_.length;i++) { |
| | | options_[i].code = options_[i].name; |
| | | options_[i].value = options_[i].name; |
| | | } |
| | | var formFields_ = clone(me.formFields); |
| | | formFields_.map(f=>{ |
| | | if (f.field == "county") { |
| | | f.options = options_; |
| | | } |
| | | }) |
| | | me.formFields = clone(formFields_); |
| | | //重新设置选择项 |
| | | // if (callback) { |
| | | // var obj_ = { |
| | | // options: options_ |
| | | // }; |
| | | // callback(obj_); |
| | | // } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | | select: { |
| | | onchange: function(obj,refreshCallback) {//下拉展开事件 |
| | | obj.data.county = obj.selectoption.value |
| | | refreshCallback() |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | }, |
| | | |
| | | //提交 |
| | | submitRowTable() { |
| | | //必填项校验 |
| | | var bo1 = this.$refs.form1.checkForm(); |
| | | if(!bo1){ |
| | | Root.message({ |
| | | type: 'error', |
| | | message: '请填写必填项' |
| | | }); |
| | | return; |
| | | } |
| | | this.iscommit = true; |
| | | this.saveRowTable(); |
| | | }, |
| | | |
| | | //保存 |
| | | saveRowTable() { |
| | | var me = this; |
| | | var bo1 = this.$refs.form1.checkForm(); |
| | | if(!bo1){ |
| | | Root.message({ |
| | | type: 'error', |
| | | message: '请填写必填项' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | var operator_ = "saveEntity";//保存 |
| | | |
| | | var entity_ = clone(this.formData); |
| | | var entity = {}; |
| | | for (var r in entity_) { |
| | | // if (entity_[r] || entity_[r] == "" || entity_[r] == false || entity_[r] == 0) { |
| | | entity[r] = entity_[r]; |
| | | // } |
| | | } |
| | | // if(me.iscommit) { |
| | | // // operator_ = "commit";//提交 |
| | | // entity.state_code = "Open" |
| | | // entity.state_name = "生效" |
| | | // } |
| | | let param = { |
| | | dataname: this.dataname, |
| | | data: {}, |
| | | } |
| | | param.data[this.dataname] = entity; |
| | | if (this.formData.id) { |
| | | param.id = this.formData.id |
| | | } |
| | | Server.call("root/data/" + operator_, param, function(result) { |
| | | console.log(result); |
| | | if (result.success) { |
| | | if(me.iscommit){ |
| | | me.iscommit = false; |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '提交成功' |
| | | }); |
| | | me.saveAfter(); |
| | | } |
| | | else { |
| | | Root.message({ |
| | | type: 'success', |
| | | message: '保存成功' |
| | | }); |
| | | me.saveAfter(); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | loadJsCss(function () { |
| | | initVue(); |
| | | }); |
| | | </script> |
| | | <style> |
| | | /* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */ |
| | | [v-cloak] { |
| | | display: none !important; |
| | | } |
| | | </style> |
| | | |
| | | </head> |
| | | |
| | | <body style="margin: 0px;"> |
| | | <div v-cloak id="vbody"> |
| | | <div id="page_root"> |
| | | <div ref="popup_body" style="padding: 0 20px;"> |
| | | <div v-if="popupParames.totab" class="el-dialog__header"> |
| | | <div class="dialog-title"> |
| | | <i class="iconfont icon-customermanagement"></i> |
| | | <span> {{title}}</span> |
| | | </div> |
| | | </div> |
| | | <div :style="{height: dheight + 'px', 'overflow-y': 'auto'}"> |
| | | <!-- <div style="position: absolute; top:40px; bottom: 50px; left: 0px; right: 0px; overflow-y: auto;"> --> |
| | | <div class="el-dialog__body"> |
| | | <h-form |
| | | ref="form1" |
| | | :form-attr="formAttr" |
| | | :table-fields="formFields" |
| | | :form-data="formData" |
| | | :table-field-click="formfieldClick" |
| | | > |
| | | </h-form> |
| | | </div> |
| | | </div> |
| | | <div class="el-dialog__footer" style="position: absolute; bottom: 0px; left: 0px; right: 0px;"> |
| | | <el-button size="small" type="default" @click="closeDialog">取 消</el-button> |
| | | <el-button size="small" v-if="isedit || isrefuseedit" type="primary" :loading="loading_save" @click="saveRowTable":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button> |
| | | <!-- <el-button size="small" v-if="isedit" type="success" :loading="loading_submit" @click="submitRowTable":icon="buttonsconfig.submit.icon">{{buttonsconfig.submit.name}}</el-button> --> |
| | | <el-button size="small" v-if="isrefuseedit" type="success" @click="">再次提交</el-button> |
| | | |
| | | <el-button size="small" v-if="isapproval" type="success" @click="">通 过</el-button> |
| | | <el-button size="small" v-if="isapproval" type="danger" @click="">拒 绝</el-button> |
| | | <el-button size="small" v-if="isapproval" type="primary" @click="">转 办</el-button> |
| | | <el-button size="small" v-if="isapproval" type="success" @click="">退 回</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;"> |
| | | <div class="spinner"> |
| | | <div class="cube1"></div> |
| | | <div class="cube2"></div> |
| | | </div> |
| | | </div> |
| | | <!-- Code injected by live-server --> |
| | | </body> |
| | | </html> |