2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
"use strict";(self["webpackChunkmodel"]=self["webpackChunkmodel"]||[]).push([[680],{6959:function(e,t,a){a.d(t,{j:function(){return i}});var o=a(7327);class l{constructor(){(0,o.Z)(this,"beClear",void 0),this.beClear=!0}clear(){}}let n=null;class i extends l{constructor(){super(),(0,o.Z)(this,"datas",void 0),this.datas=new Set}has(e){return this.datas.has(e)}leaveClear(e){e.ctrlKey||this.clear()}select(e,t){n!==this&&(n?.clear(),n=this),t.ctrlKey?this.datas.has(e)?(this.datas.delete(e),delete e.$flag):(e.$flag=!0,this.datas.add(e)):(this.clear(),this.datas.add(e),e.$flag=!0)}supplement(e,t){n!==this&&(n?.clear(),n=this),this.beClear=!1,!1===t.ctrlKey&&this.clear(),this.datas.add(e),e.$flag=!0}getNodeCount(){return this.datas.size}singleSelection(){return 1===this.getNodeCount()}isSelected(e){return this.datas.has(e)}getData(){return Array.from(this.datas)}getDataAndClear(){const e=this.getData();return this.clear(),e}clear(){this.datas.forEach((e=>delete e.$flag)),this.datas.clear()}}},5784:function(e,t,a){a.r(t),a.d(t,{default:function(){return G}});var o=a(9003);const l={class:"dialog-footer"},n={class:"table-manage"},i={class:"attributebar"},r=(0,o._)("span",{class:"iconfont icon-close"},null,-1);function s(e,t,a,s,c,d){const u=(0,o.up)("el-table-column"),h=(0,o.up)("el-table"),p=(0,o.up)("el-button"),m=(0,o.up)("el-dialog"),g=(0,o.up)("ProjectManageList"),f=(0,o.up)("pane"),w=(0,o.up)("SubTitleBar"),y=(0,o.up)("ProjectAttribute"),b=(0,o.up)("splitpanes");return(0,o.wg)(),(0,o.iD)("div",null,[(0,o.Wm)(m,{modelValue:e.importDialogShow,"onUpdate:modelValue":t[0]||(t[0]=t=>e.importDialogShow=t),title:"待导入项目列表",modal:!1,"close-on-click-modal":!1,draggable:""},{footer:(0,o.w5)((()=>[(0,o._)("span",l,[(0,o.Wm)(p,{size:"small",onClick:e.closeImportDialog},{default:(0,o.w5)((()=>[(0,o.Uk)("取消")])),_:1},8,["onClick"]),(0,o.Wm)(p,{size:"small",type:"primary",onClick:e.onImportProject,disabled:e.importSelection.length<1},{default:(0,o.w5)((()=>[(0,o.Uk)("导入 ")])),_:1},8,["onClick","disabled"])])])),default:(0,o.w5)((()=>[(0,o._)("div",null,[(0,o.Wm)(h,{data:e.importProjectDataList,size:"small",height:"200",onSelectionChange:e.handleSelectionChange},{default:(0,o.w5)((()=>[(0,o.Wm)(u,{type:"selection",width:"36"}),(0,o.Wm)(u,{property:"id",label:"编号",width:"60"}),(0,o.Wm)(u,{property:"name",label:"名称","min-width":"120"}),(0,o.Wm)(u,{property:"type",label:"类型",width:"140"},{default:(0,o.w5)((t=>[(0,o.Uk)((0,o.zw)(e.projectManage.formatType(t.row.type)),1)])),_:1}),(0,o.Wm)(u,{property:"author",label:"创建者",width:"140"})])),_:1},8,["data","onSelectionChange"])])])),_:1},8,["modelValue"]),(0,o.Wm)(b,{horizontal:e.horizontal},{default:(0,o.w5)((()=>[(0,o.Wm)(f,{"min-size":"20"},{default:(0,o.w5)((()=>[(0,o._)("div",n,[(0,o.Wm)(g,{ref:"projectManageListRef",onImport:e.onOpenImportProject,onCreate:e.onCreateNewProject},null,8,["onImport","onCreate"])])])),_:1}),e.creating?((0,o.wg)(),(0,o.j4)(f,{key:0,size:e.paneSize},{default:(0,o.w5)((()=>[(0,o._)("div",i,[(0,o.Wm)(w,null,{title:(0,o.w5)((()=>[(0,o.Uk)("新建项目")])),default:(0,o.w5)((()=>[(0,o.Wm)(p,{onClick:e.onCancelPane},{default:(0,o.w5)((()=>[r])),_:1},8,["onClick"])])),_:1}),(0,o.Wm)(y,{onCancel:e.onCancelPane},null,8,["onCancel"])])])),_:1},8,["size"])):(0,o.kq)("",!0)])),_:1},8,["horizontal"])])}var c=a(7178),d=a(5321),u=a(7627),h=a(5620);function p(e,t,a,l,n,i){const r=(0,o.up)("el-col"),s=(0,o.up)("el-input"),c=(0,o.up)("el-row"),d=(0,o.up)("el-option"),u=(0,o.up)("el-select"),h=(0,o.up)("ConfirmBar");return(0,o.wg)(),(0,o.iD)("div",null,[(0,o.Wm)(c,null,{default:(0,o.w5)((()=>[(0,o.Wm)(r,{span:8},{default:(0,o.w5)((()=>[(0,o.Uk)("项目名称:")])),_:1}),(0,o.Wm)(r,{span:16},{default:(0,o.w5)((()=>[(0,o.Wm)(s,{size:"small",modelValue:e.localModel.name,"onUpdate:modelValue":t[0]||(t[0]=t=>e.localModel.name=t),placeholder:"输入名称"},null,8,["modelValue"])])),_:1})])),_:1}),(0,o.Wm)(c,null,{default:(0,o.w5)((()=>[(0,o.Wm)(r,{span:8},{default:(0,o.w5)((()=>[(0,o.Uk)("项目类型:")])),_:1}),(0,o.Wm)(r,{span:16},{default:(0,o.w5)((()=>[(0,o.Wm)(u,{size:"small",placeholder:"选择类型",modelValue:e.localModel.type,"onUpdate:modelValue":t[1]||(t[1]=t=>e.localModel.type=t)},{default:(0,o.w5)((()=>[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(e.typeoptions,(e=>((0,o.wg)(),(0,o.j4)(d,{key:e.code,label:e.name,value:e.code},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1})])),_:1}),(0,o.Wm)(c,null,{default:(0,o.w5)((()=>[(0,o.Wm)(r,{span:8},{default:(0,o.w5)((()=>[(0,o.Uk)("创建人:")])),_:1}),(0,o.Wm)(r,{span:16},{default:(0,o.w5)((()=>[(0,o.Wm)(u,{size:"small",placeholder:"选择创建人","allow-create":"",filterable:"",modelValue:e.localModel.author,"onUpdate:modelValue":t[2]||(t[2]=t=>e.localModel.author=t)},{default:(0,o.w5)((()=>[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(e.authoroptions,(e=>((0,o.wg)(),(0,o.j4)(d,{key:e.value,label:e.text,value:e.value},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1})])),_:1}),(0,o.Wm)(h,{"commit-name":"保存",onCommit:e.commit,onCancel:e.cancel},null,8,["onCommit","onCancel"])])}a(7658);var m=a(3841),g=a(7327),f=a(986),w=a(9841);class y{constructor(){(0,g.Z)(this,"allAuthors",void 0),(0,g.Z)(this,"typeoptions",void 0),(0,g.Z)(this,"dataSource",void 0),this.allAuthors=[],this.typeoptions=null,this.dataSource=(0,o.qj)([])}GetProjectTypes(){this.typeoptions=f.p.getDictionaryByInnerName("ProjectType")}GetAuthors(){if(this.dataSource){this.allAuthors=[];const e=f.p.localFileProfile["author"],t=[];e&&e.length>0&&t.push(e),this.dataSource.forEach((e=>{t.push(e.author)}));const a=[...new Set(t)];a.forEach((e=>{this.allAuthors.push({text:e,value:e})}))}}validate(e){if(!e)return"输入项为空";const t=f.p.validate(e,f.s.common);return t||null}findTypeByID(e){return this.typeoptions?.children?.find((t=>t.code===e))}async validateModel(e,t){if(!e)return!1;let a=this.validate(e.name);if(a)return c.z8.warning("项目名称"+a),!1;const o=this.typeoptions?.children?.find((t=>t.code===e.type));if(a=this.validate(o?.name),a)return c.z8.warning("项目类型"+a),!1;if(a=this.validate(e.author),a)return c.z8.warning("创建者"+a),!1;const l=await this.getAllProject();return t&&l.find((t=>t.name===e.name&&t.id!==e.id))?(c.z8.warning("项目名称不能重复"),!1):!(!t&&l.find((t=>t.name===e.name)))||(c.z8.warning("项目名称不能重复"),!1)}formatType(e){return this.typeoptions?this.typeoptions?.children?.find((t=>t.code===e))?.name:""}async getAllProject(){const{error:e,data:t}=await(0,w.kZ)("ProjectManager","get-all-project");if(!e)return t;c.z8.error(e)}async updateProjectSource(){const e=await this.getAllProject();b.dataSource.splice(0,b.dataSource.length),e.constructor===Array&&b.dataSource.push(...e),b.GetAuthors()}}const b=(0,o.qj)(new y);var j=a(3363),C=(0,o.aZ)({name:"ProjectAttribute",data(){return{localModel:new m.Hy,projectManage:b}},components:{ConfirmBar:j.Z},computed:{typeoptions(){return b.typeoptions?.children},authoroptions(){return b.allAuthors}},mounted(){b.GetProjectTypes(),b.GetAuthors()},methods:{async commit(){await b.validateModel(this.localModel)&&this.QTSend("add-project",{name:this.localModel.name,type:this.localModel.type,author:this.localModel.author}).then((({error:e,data:t})=>{e?c.z8.error(e):(b.dataSource.push(t),this.cancel())}))},cancel(){this.$emit("cancel")}}}),D=a(89);const k=(0,D.Z)(C,[["render",p]]);var S=k;const v={class:"work-area"},P={class:"table-title"},z={class:"editable-row-operations"},T={key:0},_=["onClick"],x={key:1};function M(e,t,a,l,n,i){const r=(0,o.up)("el-table-column"),s=(0,o.up)("el-button"),c=(0,o.up)("el-input"),d=(0,o.up)("el-option"),u=(0,o.up)("el-select"),h=(0,o.up)("el-table");return(0,o.wg)(),(0,o.iD)("div",v,[(0,o._)("div",{class:"table-area",onContextmenu:t[4]||(t[4]=(...t)=>e.onListContextMenu&&e.onListContextMenu(...t))},[(0,o.Wm)(h,{data:e.projectManage.dataSource,ref:"projectTableRef",size:"small",height:"100%","row-class-name":e.onRowClassName,onRowDblclick:e.onEnterDataModel,onRowContextmenu:e.onRowContextMenu,onRowClick:e.onRowClick,"default-sort":{prop:"updateTime",order:"descending"}},{default:(0,o.w5)((()=>[(0,o.Wm)(r,{label:"编号",type:"index",width:"60","class-name":"indexcolumn"}),(0,o.Wm)(r,{label:"项目名称","min-width":"120",prop:"name",sortable:"","sort-method":e.sortName,filters:[{text:"关注",value:!0}],"filter-method":e.filterHandler},{default:(0,o.w5)((a=>[(0,o._)("span",P,[(0,o.Wm)(s,{text:"",size:"small",onClick:t=>e.onChangeFocus(a.row),style:{"margin-right":"4px"}},{default:(0,o.w5)((()=>[(0,o._)("span",{class:(0,o.C_)(["start iconfont",a.row.focus?"icon-star-fill":"icon-star"])},null,2)])),_:2},1032,["onClick"]),e.editableData&&e.editableData.id===a.row.id?((0,o.wg)(),(0,o.j4)(c,{key:0,size:"small",modelValue:e.editableData.name,"onUpdate:modelValue":t[0]||(t[0]=t=>e.editableData.name=t)},null,8,["modelValue"])):((0,o.wg)(),(0,o.iD)(o.HY,{key:1},[(0,o.Uk)((0,o.zw)(a.row.name),1)],64))])])),_:1},8,["sort-method","filter-method"]),(0,o.Wm)(r,{label:"类型",filterable:"",prop:"type",width:"120",filters:e.typefilter,"filter-method":e.filterTypes,sortable:"","sort-method":e.sortType},{default:(0,o.w5)((a=>[e.editableData&&e.editableData.id===a.row.id?((0,o.wg)(),(0,o.j4)(u,{key:0,modelValue:e.editableData.type,"onUpdate:modelValue":t[1]||(t[1]=t=>e.editableData.type=t),size:"small"},{default:(0,o.w5)((()=>[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(e.typeoptions,(e=>((0,o.wg)(),(0,o.j4)(d,{key:e.code,label:e.name,value:e.code},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])):((0,o.wg)(),(0,o.iD)(o.HY,{key:1},[(0,o.Uk)((0,o.zw)(e.projectManage.formatType(a.row.type)),1)],64))])),_:1},8,["filters","filter-method","sort-method"]),(0,o.Wm)(r,{label:"创建者",width:"120",sortable:"",filterable:"",prop:"author","sort-method":e.sortAuthor,filters:e.authoroptions,"filter-method":e.filterAuthor},{default:(0,o.w5)((a=>[e.editableData&&e.editableData.id===a.row.id?((0,o.wg)(),(0,o.j4)(u,{key:0,modelValue:e.editableData.author,"onUpdate:modelValue":t[2]||(t[2]=t=>e.editableData.author=t),filterable:"",size:"small","allow-create":""},{default:(0,o.w5)((()=>[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(e.authoroptions,(e=>((0,o.wg)(),(0,o.j4)(d,{key:e.value,label:e.text,value:e.value},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])):((0,o.wg)(),(0,o.iD)(o.HY,{key:1},[(0,o.Uk)((0,o.zw)(a.row.author),1)],64))])),_:1},8,["sort-method","filters","filter-method"]),(0,o.Wm)(r,{label:"生成时间",prop:"createTime",width:"160",sortable:""}),(0,o.Wm)(r,{label:"更新时间",prop:"updateTime",width:"160",sortable:""}),(0,o.Wm)(r,{class:"operation",label:"操作",fixed:"right",width:"120"},{default:(0,o.w5)((a=>[(0,o._)("div",z,[e.editableData&&e.editableData.id===a.row.id?((0,o.wg)(),(0,o.iD)("span",T,[(0,o._)("a",{onClick:t=>e.onSaveEditProject(a.row)},"保存",8,_),(0,o._)("a",{onClick:t[3]||(t[3]=(...t)=>e.onCloseEditProject&&e.onCloseEditProject(...t))},"取消")])):((0,o.wg)(),(0,o.iD)("span",x,[(0,o.Wm)(s,{text:"",icon:e.Edit,onClick:t=>e.onEdit(a.row.id)},null,8,["icon","onClick"])]))])])),_:1})])),_:1},8,["data","row-class-name","onRowDblclick","onRowContextmenu","onRowClick"])],32)])}var W=a(6468),Z=a(6e3),A=a(2748),V=a(3758),E=a(7198),R=a(4704),I=a(6959);const U=new I.j;var N=(0,o.aZ)({name:"ProjectManageList",data(){return{typefilter:[],editableData:null,searchValue:"",searchRegular:!0}},watch:{},computed:{typeoptions(){return b.typeoptions?.children},authoroptions(){return b.allAuthors},editing(){return u.Z.state.editing}},setup(){const e=(0,o.iH)();return{Edit:A.I8b,More:A.Tkc,Delete:A.HG3,projectManage:b,projectTableRef:e}},components:{},async mounted(){u.Z.commit("setEditing",!1),U.clear(),this.getTypes(),b.GetAuthors(),R.Z.$on("search",this.onSearch),b.updateProjectSource().then((()=>{}))},unmounted(){R.Z.$off("search",this.onSearch)},methods:{sortName(e,t){return m.jr.localeCompare(e.name,t.name)},sortType(e,t){let a=b.formatType(t.type),o=b.formatType(e.type);return a||(a=""),o||(o=""),m.jr.localeCompare(o,a)},sortAuthor(e,t){return m.jr.localeCompare(e.author,t.author)},onRowClassName({row:e}){return e.$flag?"current-row":""},onRowClick(e,t,a){U.select(e,a)},onListContextMenu(e){(0,E.x)(e.clientX,e.clientY,{props:{commands:[{key:1,label:"新建项目",command:this.onCreateNewProject,disabled:this.editing,icon:"icon-jia"},{key:2,label:"导入项目",command:this.onOpenImportProject,disabled:this.editing,icon:"icon-xiazaidaoru"}]}})},onRowContextMenu(e,t,a){a.preventDefault(),a.stopPropagation(),U.supplement(e,a);const o=U.getNodeCount()<1,l=[{key:1,label:"新建项目",command:this.onCreateNewProject,disabled:this.editing,icon:"icon-jia"},{key:2,label:"删除",command:this.onDelete,disabled:this.editing||o,icon:"icon-delete-fill"},{splitter:!0},{key:3,label:"文档生成",command:this.onExortDocument,disabled:this.editing||1!==U.getNodeCount(),icon:"icon-send_page-o"},{key:4,label:"导入项目",command:this.onOpenImportProject,disabled:this.editing,icon:"icon-xiazaidaoru"},{key:5,label:"导出项目",command:this.onOpenExportProject,disabled:this.editing||U.getNodeCount()<1,icon:"icon-shangchuandaochu"}];(0,E.x)(a.clientX,a.clientY,{props:{data:e,commands:l}})},onCreateNewProject(){this.$emit("create")},onOpenImportProject(){this.$emit("import")},onOpenExportProject(){const e=U.getDataAndClear();if(e.length>0){const t=e.length>1?'"等项目?':'"项目?';Z.T.confirm('确认导出"'+e[0].name+t,"导出项目",{confirmButtonText:"导出",cancelButtonText:"取消",type:"warning"}).then((()=>{setTimeout((()=>{this.QTSend("export-project",e.map((e=>e.id))).then((({error:e,data:t})=>{e?c.z8.error(e):t.status&&c.z8.success("导出项目成功")}))}),300)}))}},onExortDocument(e){this.editing||this.QTSend("export-document",{id:e.id}).then((({error:e,data:t})=>{e?c.z8.error(e):t.status&&c.z8.success("导出数据需求文档成功")}))},filterHandler(e,t){return t.focus===e},getTypes(){b.GetProjectTypes(),b.typeoptions&&(this.typefilter=b.typeoptions?.children?.map((e=>({text:e.name,value:e.code}))))},onSearch(e){const{value:t,regular:a}=e;this.searchValue=t,this.searchRegular=a,b.updateProjectSource().then((()=>{if(this.searchValue.length>0){let e=[];if(this.searchRegular){const t=new RegExp(this.searchValue,"i");e=b.dataSource?.filter((e=>~e.name.search(t)))}else e=b.dataSource?.filter((e=>~e.name.indexOf(this.searchValue)));b.dataSource.splice(0,b.dataSource.length),b.dataSource.push(...e)}}))},onChangeFocus(e){this.QTSend("change-project-focus",{id:e.id,focus:!e.focus}).then((({error:t,data:a})=>{t?c.z8.error(t):e.focus=a.focused}))},filterTypes(e,t){return t.type===e},filterAuthor(e,t){return t.author===e},onEnterDataModel(e){this.editing||V.t.toDataModel(e.id)},async onSaveEditProject(e){this.editableData&&await b.validateModel(this.editableData,!0)&&Z.T.confirm("确认保存修改?","保存项目",{confirmButtonText:"保存",cancelButtonText:"取消",type:"warning"}).then((()=>{this.QTSend("save-project",this.editableData).then((({error:t,data:a})=>{if(t)return void c.z8.error(t);const o=a;Object.assign(e,o),b.GetAuthors()})),this.onCloseEditProject()}))},onCloseEditProject(){this.editableData=null,u.Z.commit("setEditing",null!==this.editableData)},onDelete(){if(this.editing)return;const e=U.getData();if(e.length<1)return;const t=e.length>1?'"等项目?':'"项目?';Z.T.confirm('确认删除"'+e[0].name+t,"删除项目",{confirmButtonText:"删除",cancelButtonText:"取消",type:"warning"}).then((async()=>{U.clear();for(const t of e)await this.QTSend("delete-project",{id:t.id}).then((({error:e})=>{if(e)return void c.z8.error(e);const a=b.dataSource?.findIndex((e=>e.id===t.id));~a&&b.dataSource?.splice(a,1)}))})).catch((()=>{U.clear()}))},onEdit(e){this.editing||(this.getTypes(),b.GetAuthors(),this.editableData=(0,W.Z)(b.dataSource?.find((t=>t.id===e))),u.Z.commit("setEditing",null!==this.editableData))}}});const H=(0,D.Z)(N,[["render",M],["__scopeId","data-v-2c892f9c"]]);var B=H,$=(0,o.aZ)({name:"ProjectManage",data(){return{creating:!1,value:"",importDialogShow:!1,importProjectDataList:[]}},computed:{horizontal(){return u.Z.state.splitPane.horizontal},paneSize(){return u.Z.state.splitPane.size}},components:{Splitpanes:d.F,ProjectManageList:B,Pane:d.X,SubTitleBar:h.Z,ProjectAttribute:S},setup(){const e=(0,o.iH)([]);return{importSelection:e,projectManage:b}},mounted(){u.Z.commit("setCurrentModule","ProjectManage"),this.QTRegister("ProjectManager"),R.Z.$emit("change-title","项目管理")},methods:{editing(){return u.Z.state.editing},onCreateNewProject(){this.editing()||(this.creating=!0,u.Z.commit("setEditing",this.creating))},onCancelPane(){this.creating=!1,u.Z.commit("setEditing",this.creating)},onOpenImportProject(){this.QTSend("preimport-project").then((({error:e,data:t})=>{e?c.z8.error(e):t&&t.length>0&&(this.importProjectDataList=t,this.importDialogShow=!0)}))},handleSelectionChange(e){this.importSelection=e},closeImportDialog(){this.importDialogShow=!1,this.importProjectDataList=[]},onImportProject(){this.closeImportDialog(),this.importSelection.length>0&&this.QTSend("import-project",this.importSelection.map((e=>e.id))).then((({error:e})=>{e?c.z8.error(e):b.updateProjectSource()}))}}});const L=(0,D.Z)($,[["render",s]]);var G=L}}]);
|
|
//# sourceMappingURL=680.d26cb353.js.map
|