| | |
| | | import {paramLow,callPreEvent,callPostEvent} from './BaseAction'; |
| | | import {validatenull} from "@/util/validate"; |
| | | import Vue from "vue"; |
| | | import AddEditDialog from "@/components/actions/AddEditDialog"; |
| | | |
| | | export const doAction = (options) => { |
| | | options.paramVOS = paramLow(options.paramVOS) |
| | | const paramVOS = Object.assign({ |
| | | getdataurl: 'uiDataController/dataFormQuery', |
| | | getdataurl: '/api/uiDataController/dataFormQuery', |
| | | getdatamethod: 'post', |
| | | url: 'uiDataController/editSave', |
| | | url: '/api/uiDataController/editSave', |
| | | method: 'put', |
| | | uploadfileurl: 'vciFileUploadController/uploadFile' |
| | | }, options.paramVOS) |
| | |
| | | if (!paramVOS.multi && options.dataStore.length > 1) { |
| | | Vue.prototype.$message.error("仅能选择一条数据来操作"); |
| | | return false; |
| | | } |
| | | |
| | | if(!validatenull(paramVOS.checknotedit)) { |
| | | let notedit = paramVOS.checknotedit.split('&'); |
| | | let checknotedit=false; |
| | | notedit.forEach((item,i)=>{ |
| | | if (options.dataStore[0][item.split('=')[0]] == item.split('=')[1]) { |
| | | checknotedit=true; |
| | | return false; |
| | | } |
| | | }) |
| | | if (checknotedit) { |
| | | Vue.prototype.$message.error(replaceFreeMarker(paramVOS.checknoteditmsg,options.dataStore,{}) || "当前数据不允许修改"); |
| | | return false; |
| | | } |
| | | } |
| | | callPreEvent(options, doBefore, function (options) { |
| | | doAdd(options, function () { |
| | |
| | | Vue.prototype.$message.error("按钮配置不正确"); |
| | | return false; |
| | | } |
| | | Vue.prototype.$message.success('执行'+paramVOS.title); |
| | | const dialogConstructor = Vue.extend(AddEditDialog); |
| | | let instance = new dialogConstructor(); |
| | | instance.sourceData = options.sourceData; |
| | | instance.dataStore = options.dataStore; |
| | | instance.paramVOS = paramVOS |
| | | |
| | | instance.type = 'edit'; |
| | | instance.dialogClose = function () { |
| | | vm.visible = false; |
| | | document.body.removeChild(vm.$el); |
| | | instance.$destroy(); |
| | | instance = null; |
| | | }; |
| | | if (callback) { |
| | | callback(options); |
| | | instance.saveCallback = callback; |
| | | } |
| | | let vm = instance.$mount(); |
| | | document.body.appendChild(vm.$el); |
| | | instance.visible = true; |
| | | } |
| | | /** |
| | | * 前置事件 |