chunk-c46a82fe.039e553a.js 49 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-c46a82fe"],{"24d2":function(t,e,a){"use strict";a.d(e,"k",(function(){return r})),a.d(e,"b",(function(){return o})),a.d(e,"n",(function(){return c})),a.d(e,"f",(function(){return s})),a.d(e,"d",(function(){return i})),a.d(e,"l",(function(){return l})),a.d(e,"c",(function(){return u})),a.d(e,"o",(function(){return d})),a.d(e,"g",(function(){return p})),a.d(e,"e",(function(){return m})),a.d(e,"j",(function(){return f})),a.d(e,"m",(function(){return h})),a.d(e,"h",(function(){return b})),a.d(e,"i",(function(){return g})),a.d(e,"a",(function(){return v}));var n=a("b775");function r(t){return Object(n["a"])({url:"/project/category/search",method:"post",data:t})}function o(t){return Object(n["a"])({url:"/project/category/create",method:"post",data:t})}function c(t){return Object(n["a"])({url:"/project/category/update",method:"post",data:t})}function s(t){return Object(n["a"])({url:"/project/category/info",method:"post",data:t})}function i(t){return Object(n["a"])({url:"/project/category/delete",method:"post",data:t})}function l(t){return Object(n["a"])({url:"/project/search",method:"post",data:t})}function u(t){return Object(n["a"])({url:"/project/create",method:"post",data:t})}function d(t){return Object(n["a"])({url:"/project/update",method:"post",data:t})}function p(t){return Object(n["a"])({url:"/project/info",method:"post",data:t})}function m(t){return Object(n["a"])({url:"/project/delete",method:"post",data:t})}function f(t){return Object(n["a"])({url:"/project/relate",method:"post",data:t})}function h(t){return Object(n["a"])({url:"/template/searchTemplateList",method:"post",data:t})}function b(t){return Object(n["a"])({url:"/project/getphases",method:"post",data:t})}function g(t){return Object(n["a"])({url:"/project/getstatus",method:"post",data:t})}function v(t){return Object(n["a"])({url:"/project/calculate",method:"post",data:t})}},3672:function(t,e,a){"use strict";a("eb4d")},"424e":function(t,e,a){"use strict";a.d(e,"i",(function(){return r})),a.d(e,"j",(function(){return o})),a.d(e,"e",(function(){return c})),a.d(e,"n",(function(){return s})),a.d(e,"a",(function(){return i})),a.d(e,"h",(function(){return l})),a.d(e,"c",(function(){return u})),a.d(e,"k",(function(){return d})),a.d(e,"b",(function(){return p})),a.d(e,"o",(function(){return m})),a.d(e,"g",(function(){return f})),a.d(e,"d",(function(){return h})),a.d(e,"l",(function(){return b})),a.d(e,"m",(function(){return g})),a.d(e,"f",(function(){return v}));var n=a("b775");function r(t){return Object(n["a"])({url:"/document/pageDocument",method:"post",data:t})}function o(t){return Object(n["a"])({url:"/document/search",method:"post",data:t})}function c(t){return Object(n["a"])({url:"/document/export",method:"post",data:t})}function s(t){return Object(n["a"])({url:"/document/update",method:"post",data:t})}function i(t){return Object(n["a"])({url:"/document/create",method:"post",data:t})}function l(t){return Object(n["a"])({url:"/document/info",method:"post",data:t})}function u(t){return Object(n["a"])({url:"/document/delete",method:"post",data:t})}function d(t){return Object(n["a"])({url:"/document/category/search",method:"post",data:t})}function p(t){return Object(n["a"])({url:"/document/category/create",method:"post",data:t})}function m(t){return Object(n["a"])({url:"/document/category/update",method:"post",data:t})}function f(t){return Object(n["a"])({url:"/document/category/info",method:"post",data:t})}function h(t){return Object(n["a"])({url:"/document/category/delete",method:"post",data:t})}function b(t){return Object(n["a"])({url:"/template/searchList",method:"post",data:t})}function g(t){return Object(n["a"])({url:"/document/searchlistDoc",method:"post",data:t})}function v(t){return Object(n["a"])({url:"document/exportToPDF",method:"post",data:t})}},"4ec9":function(t,e,a){"use strict";var n=a("6d61"),r=a("6566");t.exports=n("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),r)},5869:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"project-search"},[a("dataSearch",{on:{bindSetQuery:t.setQuery}}),a("dataList",{attrs:{queryForm:t.queryForm}})],1)},r=[],o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"data-search"},[a("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0,model:t.queryForm}},[a("el-form-item",{attrs:{label:"项目名称:"}},[a("el-input",{attrs:{placeholder:"请填写项目名称"},model:{value:t.queryForm.name,callback:function(e){t.$set(t.queryForm,"name",e)},expression:"queryForm.name"}})],1),a("el-form-item",{attrs:{label:"所属分类:"}},[a("el-select",{staticClass:"m-2",attrs:{placeholder:"请选择分类",size:"large"},model:{value:t.queryForm.categoryId,callback:function(e){t.$set(t.queryForm,"categoryId",e)},expression:"queryForm.categoryId"}},t._l(t.categoryList,(function(t){return a("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})})),1)],1),a("el-form-item",{attrs:{label:"状态:"}},[a("el-select",{staticClass:"m-2",attrs:{placeholder:"请选择状态",size:"large"},model:{value:t.queryForm.status,callback:function(e){t.$set(t.queryForm,"status",e)},expression:"queryForm.status"}},t._l(t.statusOptions,(function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})})),1)],1),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:t.onSubmit}},[a("svg-icon",{attrs:{"icon-class":"search"}}),t._v(" 搜索")],1),a("el-button",{attrs:{type:"success"},on:{click:t.onCreate}},[a("svg-icon",{attrs:{"icon-class":"edit"}}),t._v(" 新项目")],1),a("el-button",{attrs:{type:"danger"},on:{click:t.resetForm}},[t._v(" 重置")])],1)],1),a("el-dialog",{directives:[{name:"el-drag-dialog",rawName:"v-el-drag-dialog"}],attrs:{visible:t.dialogVisible,"append-to-body":"","custom-class":"prod-verify",title:"创建新项目"},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("dataInfo",{on:{onClose:t.onClose}})],1)],1)},c=[],s=(a("b0c0"),function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"data-info"},[a("el-card",[a("el-form",{ref:"dataFormRef",attrs:{model:t.dataForm,rules:t.rules,"label-width":"120px"}},[a("el-form-item",{staticClass:"form-item-half",attrs:{label:"客户名称:",prop:"customerId"}},[a("el-select",{attrs:{clearable:"",filterable:"",placeholder:"请选择客户",size:"large"},model:{value:t.dataForm.customerId,callback:function(e){t.$set(t.dataForm,"customerId",e)},expression:"dataForm.customerId"}},t._l(t.customerList,(function(t){return a("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})})),1)],1),a("el-form-item",{staticClass:"form-item-half",attrs:{label:"项目名称:",prop:"name"}},[a("el-input",{attrs:{placeholder:"请输入项目名称"},model:{value:t.dataForm.name,callback:function(e){t.$set(t.dataForm,"name",e)},expression:"dataForm.name"}})],1),a("el-form-item",{staticClass:"form-item-half",attrs:{label:"产品:",prop:"product"}},[a("el-select",{attrs:{clearable:"",filterable:"",placeholder:"请选择产品",size:"large"},model:{value:t.dataForm.product,callback:function(e){t.$set(t.dataForm,"product",e)},expression:"dataForm.product"}},t._l(t.productList,(function(t){return a("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})})),1)],1),a("el-form-item",{staticClass:"form-item-half",attrs:{label:"项目分类:",prop:"ProjectCategory"}},[a("el-select",{attrs:{clearable:"",filterable:"",placeholder:"请选择项目分类",size:"large"},model:{value:t.dataForm.ProjectCategory,callback:function(e){t.$set(t.dataForm,"ProjectCategory",e)},expression:"dataForm.ProjectCategory"}},t._l(t.allCategories,(function(t){return a("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})})),1)],1),a("el-form-item",{staticClass:"form-item-half",attrs:{label:"服务内容:",prop:"service_content"}},[a("el-input",{attrs:{placeholder:"请输入服务内容"},model:{value:t.dataForm.service_content,callback:function(e){t.$set(t.dataForm,"service_content",e)},expression:"dataForm.service_content"}})],1),a("el-form-item",{staticClass:"form-item-half",attrs:{label:"当前阶段:",prop:"current_phase"}},[a("el-select",{attrs:{clearable:"",filterable:"",placeholder:"请选择当前阶段",size:"large"},model:{value:t.dataForm.current_phase,callback:function(e){t.$set(t.dataForm,"current_phase",e)},expression:"dataForm.current_phase"}},t._l(t.currentPhaseList,(function(t){return a("el-option",{key:t.key,attrs:{label:t.label,value:t.value}})})),1)],1),a("el-form-item",{staticClass:"form-item-half",attrs:{label:"目前状态:",prop:"project_status"}},[a("el-select",{attrs:{clearable:"",filterable:"",placeholder:"请选择目前状态",size:"large"},model:{value:t.dataForm.project_status,callback:function(e){t.$set(t.dataForm,"project_status",e)},expression:"dataForm.project_status"}},t._l(t.getstatusList,(function(t){return a("el-option",{key:t.key,attrs:{label:t.label,value:t.value}})})),1)],1),a("el-form-item",{staticClass:"form-item-half",attrs:{label:"项目日期:",prop:"start_date"}},[a("el-date-picker",{attrs:{clearable:"",type:"date",placeholder:"请选择日期",format:"yyyy-MM-dd","value-format":"yyyy-MM-dd"},model:{value:t.dataForm.start_date,callback:function(e){t.$set(t.dataForm,"start_date",e)},expression:"dataForm.start_date"}})],1)],1)],1),a("div",{staticStyle:{"text-align":"right","margin-top":"20px"}},[a("el-button",{attrs:{type:"warning"},on:{click:t.btnSave}},[t._v("确认保存")])],1)],1)}),i=[],l=a("5530"),u=(a("fb6a"),a("a9e3"),a("8256")),d=a("24d2"),p=a("c4c8"),m=a("f6b0"),f=a("424e"),h={components:{Tinymce:u["default"]},emits:["onClose"],props:{id:{type:Number,default:0}},watch:{id:{handler:function(t){var e=this;null!=t&&(0!=t?e.getInfo(t):this.dataForm={id:0,name:"",intro:"",customerId:"",ProjectCategory:"",status:5,product:"",service_content:"",current_phase:"P1",project_status:1,start_date:(new Date).toISOString().slice(0,10)})},immediate:!0,deep:!0}},data:function(){return{activeName:"base",currentCategory:[],allCategories:[],imageUrl:"",customerList:[],articleList:[],currentPhaseList:[],getstatusList:[],productList:[],dataForm:{id:0,name:"",intro:"",customerId:"",ProjectCategory:"",status:5,product:"",service_content:"",current_phase:"P1",project_status:"1",start_date:(new Date).toISOString().slice(0,10)},statusOptions:[{status:5,name:"启用"},{status:6,name:"停用"}],rules:{name:[{required:!0,message:"请输入项目名称",trigger:"blur"},{min:1,max:50,message:"长度在 1 到 50 个字符之间",trigger:"blur"}],customerId:[{required:!0,message:"请选择客户",trigger:"change"}],service_content:[{required:!0,message:"请输入服务内容",trigger:"blur"},{min:1,max:200,message:"长度在 1 到 200 个字符之间",trigger:"blur"}],current_phase:[{required:!0,message:"请选择当前阶段",trigger:"change"}],project_status:[{required:!0,message:"请选择项目状态",trigger:"change"}],start_date:[{required:!0,message:"请选择项目日期",trigger:"change"}]}}},mounted:function(){var t=this;t.uploadUrl="http://183.195.216.54:8084/upload",t.initAllCategory(),this.initCustomer()},methods:{initDocList:function(){var t=this;Object(f["j"])({page:1,pageSize:10}).then((function(e){200==e.status&&(t.articleList=e.data.dataList)}))},onUploadSuccess:function(t){console.log("onUploadSuccess",t)},btnSave:function(t){var e=this;e.$refs.dataFormRef.validate((function(t){if(!t)return!1;var a=e.dataForm.id>0?Object(d["o"])(e.dataForm):Object(d["c"])(e.dataForm);a.then((function(t){200===t.status&&(e.$message.success(e.dataForm.id>0?"项目信息更新成功":"项目信息创建成功"),setTimeout((function(){e.$emit("onClose",!0)}),0))})).catch((function(t){console.error("Save failed:",t)}))}))},getInfo:function(t){var e=this,a={id:t};Object(d["g"])(a).then((function(t){var a,n,r,o;if(t&&200===t.status){var c=t.data;e.dataForm=Object(l["a"])(Object(l["a"])({},c),{},{ProjectCategory:null!==(a=null===c||void 0===c||null===(n=c.ProjectCategory)||void 0===n?void 0:n.id)&&void 0!==a?a:"",customerId:null!==(r=null===c||void 0===c?void 0:c.customerId)&&void 0!==r?r:"",product:null!==(o=null===c||void 0===c?void 0:c.productId)&&void 0!==o?o:""})}})).catch((function(t){console.error("获取项目信息失败:",t),e.$message.error("获取项目信息失败")}))},onChangeStatus:function(t){this.dataForm.status=t},onChangeCategory:function(t){var e=this;e.dataForm.categoryId=t},initAllCategory:function(){var t=this,e={page:1,pageSize:9999,status:5};Object(d["k"])(e).then((function(e){t.allCategories=e.data.dataList}))},initCustomer:function(){var t=this,e={page:1,pageSize:99};Object(m["c"])(e).then((function(e){t.customerList=e.data.dataList})),Object(d["h"])().then((function(e){t.currentPhaseList=e.data.options})),Object(d["i"])().then((function(e){t.getstatusList=e.data.options})),Object(p["h"])({page:1,pageSize:999}).then((function(e){t.productList=e.data.dataList,console.log(e.data.dataList)}))}}},b=h,g=(a("8656"),a("2877")),v=Object(g["a"])(b,s,i,!1,null,null,null),y=v.exports,j=a("a888"),O={components:{dataInfo:y},directives:{elDragDialog:j["a"]},props:{queryForm:{type:Object,default:function(){return{page:1,pageSize:10,name:"",category_id:"",status:"",isUpdate:!1}}}},data:function(){return{statusOptions:[{value:5,label:"启用"},{value:6,label:"停用"}],dialogVisible:!1,categoryList:[]}},created:function(){this.initCategory()},methods:{initCategory:function(){var t=this,e={page:1,pageSize:999,status:5};Object(d["k"])(e).then((function(e){t.categoryList=e.data.dataList}))},onCreate:function(t){this.dialogVisible=!0},onClose:function(t){this.dialogVisible=!1,this.queryForm.isUpdate=!this.queryForm.isUpdate,this.$emit("bindSetQuery",this.$props.queryForm)},onSubmit:function(){this.queryForm.isUpdate=!this.queryForm.isUpdate,this.$emit("bindSetQuery",this.$props.queryForm)},resetForm:function(){this.queryForm.name="",this.queryForm.categoryId="",this.queryForm.status="",this.onSubmit()}}},_=O,w=(a("9246"),Object(g["a"])(_,o,c,!1,null,null,null)),T=w.exports,x=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"data-list"},[a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.dataList,"header-row-class-name":"headerBg","empty-text":"没有项目信息"}},[a("el-table-column",{attrs:{prop:"id",label:"项目编号",align:"center",width:"80"}}),a("el-table-column",{attrs:{prop:"customer_id",label:"客户名称",align:"left"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(t.getCusomName(e.row.customer_id)))])]}}])}),a("el-table-column",{attrs:{prop:"name",label:"项目名称",align:"left"}}),a("el-table-column",{attrs:{prop:"categoryId",label:"产品类别",align:"left"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(t.getCategoryTypeName(e.row.product_id)))])]}}])}),a("el-table-column",{attrs:{prop:"productName",label:"产品名称",align:"left"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(t.getCategoryName(e.row.product_id)))])]}}])}),a("el-table-column",{attrs:{prop:"service_content",label:"服务内容",align:"left"}}),a("el-table-column",{attrs:{prop:"start_date",label:"项目开始日期",align:"center"}}),a("el-table-column",{attrs:{prop:"updateTime",label:"最后更新日期",align:"center"}}),a("el-table-column",{attrs:{prop:"calculate",label:"完成度",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",{class:t.getCompletionClass(e.row.calculate)},[t._v(" "+t._s(t.formatCompletion(e.row.calculate))+" ")])]}}])}),a("el-table-column",{attrs:{prop:"current_phase",label:"当前阶段",align:"left"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-tag",{attrs:{type:t.getPhaseType(e.row.current_phase),effect:"plain"}},[t._v(" "+t._s(t.getPhaseName(e.row.current_phase))+" ")])]}}])}),a("el-table-column",{attrs:{prop:"project_status",label:"目前状态",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-tag",{attrs:{type:t.getStatusType(e.row.project_status),effect:"plain"}},[t._v(" "+t._s(t.getStatusName(e.row.project_status))+" ")])]}}])}),a("el-table-column",{attrs:{label:"操作",align:"center",fixed:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-dropdown",{attrs:{data:e.row},on:{command:t.handleCommand},scopedSlots:t._u([{key:"dropdown",fn:function(){return[a("el-dropdown-menu",[a("el-dropdown-item",{attrs:{command:{type:"template",row:e.row}}},[t._v("选择模版")]),a("el-dropdown-item",{attrs:{command:{type:"enter",row:e.row}}},[t._v("输入项目")]),e.row.documentIds&&e.row.documentIds.length>0?a("el-dropdown-item",{attrs:{command:{type:"viewTemplates",row:e.row}}},[t._v(" 已绑定模版 ")]):t._e(),a("el-dropdown-item",{attrs:{command:{type:"edit",row:e.row}}},[a("svg-icon",{attrs:{"icon-class":"edit"}}),t._v("编辑 ")],1),a("el-dropdown-item",{attrs:{command:{type:"delete",row:e.row}}},[a("svg-icon",{attrs:{"icon-class":"delete"}}),t._v("删除 ")],1)],1)]},proxy:!0}],null,!0)},[a("span",{staticClass:"el-dropdown-link"},[a("el-button",{staticClass:"operation-button",staticStyle:{"font-size":"15px","margin-left":"10px"},attrs:{type:"text",size:"small",circle:"",icon:"el-icon-more"}})],1)])]}}])})],1),a("div",{staticClass:"page-info"},[a("el-pagination",{attrs:{currentPage:t.queryForm.page,"page-size":t.queryForm.pageSize,total:t.recordCount,"page-count":t.pageTotal,background:"",layout:"prev, pager, next"},on:{"current-change":t.ChangePage}})],1),a("el-dialog",{directives:[{name:"el-drag-dialog",rawName:"v-el-drag-dialog"}],attrs:{visible:t.dialogVisible,"append-to-body":"","custom-class":"prod-verify",title:"创建项目信息"},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("dataInfo",{attrs:{id:t.currentDataId},on:{onClose:t.onClose}})],1),a("el-dialog",{attrs:{title:"选择模版",visible:t.templateDialogVisible,width:"50%","append-to-body":""},on:{"update:visible":function(e){t.templateDialogVisible=e}}},[a("el-table",{ref:"templateTable",staticStyle:{width:"100%"},attrs:{data:t.templateList},on:{"selection-change":t.handleTemplateSelect,"select-all":t.handleSelectAll}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),a("el-table-column",{attrs:{prop:"id",label:"ID",width:"80",align:"center"}}),a("el-table-column",{attrs:{prop:"title",label:"模版名称",align:"left"}}),a("el-table-column",{attrs:{prop:"create_time",label:"创建时间",align:"center"}})],1),a("div",{staticClass:"pagination-container"},[a("el-pagination",{attrs:{"current-page":t.templateQueryForm.page,"page-size":t.templateQueryForm.pageSize,total:t.templateTotal,background:"",layout:"prev, pager, next"},on:{"current-change":t.handleTemplatePageChange}})],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.templateDialogVisible=!1}}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:t.confirmTemplateSelection}},[t._v("确 定")])],1)],1),a("el-dialog",{attrs:{title:"已绑定模版",visible:t.boundTemplatesDialogVisible,width:"50%","append-to-body":""},on:{"update:visible":function(e){t.boundTemplatesDialogVisible=e}}},[a("el-table",{ref:"boundTemplateTable",staticStyle:{width:"100%"},attrs:{data:t.boundTemplateList},on:{"selection-change":t.handleBoundTemplateSelect}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),a("el-table-column",{attrs:{prop:"id",label:"ID",width:"80",align:"center"}}),a("el-table-column",{attrs:{prop:"title",label:"模版名称",align:"left"}}),a("el-table-column",{attrs:{prop:"createTime",label:"绑定时间",align:"center"}}),a("el-table-column",{attrs:{label:"操作",align:"center",width:"320"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"primary"},on:{click:function(a){return t.previewTemplate(e.row)}}},[t._v("预览")]),a("el-button",{attrs:{type:"primary"},on:{click:function(a){return t.replaceTemplate(e.row)}}},[t._v("替换")]),a("el-dropdown",{staticStyle:{"margin-left":"10px"},attrs:{trigger:"click"},on:{command:function(a){return t.handleExport(a,e.row)}},scopedSlots:t._u([{key:"dropdown",fn:function(){return[a("el-dropdown-menu",[a("el-dropdown-item",{attrs:{command:"word"}},[t._v("Word格式")]),a("el-dropdown-item",{attrs:{command:"pdf"}},[t._v("PDF格式")])],1)]},proxy:!0}],null,!0)},[a("el-button",{attrs:{type:"success"}},[t._v(" 导出文档"),a("i",{staticClass:"el-icon-arrow-down el-icon--right"})])],1)]}}])})],1),a("div",{staticClass:"dialog-footer",staticStyle:{"margin-top":"20px","text-align":"right"}},[a("el-button",{attrs:{type:"primary",loading:t.batchReplaceLoading,disabled:0===t.selectedBoundTemplates.length},on:{click:t.batchReplace}},[t._v(" 批量替换 ")])],1)],1),a("el-dialog",{attrs:{title:"",visible:t.replaceVisible,width:"50%","append-to-body":""},on:{"update:visible":function(e){t.replaceVisible=e}}},[t.matchResults.length?a("div",{staticClass:"match-results"},[t._l(t.matchResults,(function(e,n){return a("div",{key:n,staticClass:"match-item"},[a("div",{staticClass:"match-content"},[a("span",[t._v("原始值: "+t._s(e))])]),a("div",{staticClass:"actions"},[a("el-button",{attrs:{size:"small"},on:{click:function(a){return t.replaceItem(e)}}},[t._v("替换")])],1)])})),a("div",{staticStyle:{display:"flex","justify-content":"flex-end","margin-top":"20px"}},[a("el-button",{attrs:{type:"primary"},on:{click:t.replaceAll}},[t._v("批量替换")])],1)],2):t._e()])],1)},k=[],C=a("ade3"),L=a("3835"),S=a("0d21"),F=a("db90"),I=a("06c5"),$=a("3d8c");function P(t){return Object(S["a"])(t)||Object(F["a"])(t)||Object(I["a"])(t)||Object($["a"])()}var E,A=a("2909"),D=a("b85c"),q=a("c7eb"),R=a("1da1"),N=(a("99af"),a("4de4"),a("7db0"),a("caad"),a("a15b"),a("d81d"),a("13d5"),a("e9c4"),a("4ec9"),a("b64b"),a("d3b7"),a("4d63"),a("ac1f"),a("2c3e"),a("25f0"),a("6062"),a("2532"),a("3ca3"),a("5319"),a("841c"),a("2ca0"),a("498a"),a("ad9d"),a("159b"),a("ddb0"),a("bc3a")),z=a.n(N),V=(a("8baf"),a("c0e9"),{components:{dataInfo:y},directives:{elDragDialog:j["a"]},props:{queryForm:{type:Object,default:function(){return{page:1,pageSize:10,name:"",category_id:"",status:""}}}},watch:{queryForm:{handler:function(t){this.search()},deep:!0}},data:function(){return{templateQueryForm:{page:1,pageSize:10},templateTotal:0,dialogVisible:!1,currentDataId:0,recordCount:0,pageTotal:1,dataList:[],currentData:{},categoryList:[],templateDialogVisible:!1,templateList:[],selectedTemplates:[],boundTemplatesDialogVisible:!1,previewDialogVisible:!1,boundTemplateList:[],templatePreviewContent:"",currentTemplateId:null,replaceVisible:!1,loading:!1,searchResult:{},matchResults:[],TemList:[],docAttr:{},templateLoading:!1,boundTemplateLoading:!1,selectedBoundTemplates:[],batchReplaceLoading:!1,getstatusList:[],customList:[],productList:[],currentPhaseList:[],selectedTemplateIds:new Set,isAllSelected:!1,selectedPageIds:new Map}},mounted:function(){this.search(),this.init()},methods:(E={exportDocument:function(t){var e=this;return Object(R["a"])(Object(q["a"])().mark((function a(){var n,r,o,c,s;return Object(q["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.prev=0,n=JSON.parse(t.data||"[]"),r=document.createElement("div"),r.className="content",n.forEach((function(t){var e=document.createElement("div");e.className="template-textarea",e.innerHTML=t.content,r.appendChild(e)})),r.querySelectorAll('input[type="text"]').forEach((function(t){var e=document.createElement("span");e.textContent=t.value,t.parentNode.replaceChild(e,t)})),o='<!DOCTYPE html>\n <html>\n <head>\n <meta charset="UTF-8">\n <style>\n @page {\n size: A4;\n margin: 2cm;\n }\n body {\n font-family: Arial, sans-serif;\n font-size: 12pt;\n line-height: 1.5;\n }\n table {\n width: 100%;\n border-collapse: collapse;\n }\n td, th {\n border: 1px solid black;\n padding: 5px;\n }\n .template-textarea {\n page-break-after: always;\n }\n .TOC {\n display: none !important;\n }\n </style>\n </head>\n <body>\n '.concat(r.innerHTML,"\n </body>\n </html>"),a.next=9,Object(f["e"])({content:o,title:t.title});case 9:if(c=a.sent,200===c.status){a.next=13;break}return e.$alert(c.errMsg),a.abrupt("return");case 13:s=document.createElement("a"),s.href=c.data.file_path,s.download=c.data.file_name,document.body.appendChild(s),s.click(),document.body.removeChild(s),e.$message.success("导出成功"),a.next=26;break;case 22:a.prev=22,a.t0=a["catch"](0),console.error("导出文档失败:",a.t0),e.$alert("导出文档时发生错误,请稍后重试。");case 26:case"end":return a.stop()}}),a,null,[[0,22]])})))()},getCusomName:function(t){var e=this.customList.find((function(e){return e.id===t}));return e?e.name:"未知客户"},getPhaseName:function(t){var e=this.currentPhaseList.find((function(e){return e.value===t}));return e?e.label:"未知阶段"},getPhaseType:function(t){var e=this.currentPhaseList.find((function(e){return e.value===t}));if(!e)return"info";switch(e.status){case 1:return"success";case 2:return"warning";case 3:return"danger";default:return"info"}},getStatusName:function(t){var e=this.getstatusList.find((function(e){return e.value===t}));return e?e.label:"未知状态"},getStatusType:function(t){var e=this.getstatusList.find((function(e){return e.value===t}));if(!e)return"info";switch(e.value){case 5:return"success";case 4:return"warning";case 3:return"danger";default:return"info"}},formatCompletion:function(t){return void 0===t||null===t?"0%":"".concat(t,"%")},getCompletionClass:function(t){return t?t>=100?"completion-high":t>=50?"completion-medium":"completion-low":"completion-low"},handleCommand:function(t){switch(t.type){case"template":this.selTemplate(t.row);break;case"enter":this.enterPro(t.row);break;case"edit":this.btnEdit(t.row);break;case"delete":this.btnDelete(t.row.id);break;case"viewTemplates":this.viewBoundTemplates(t.row);break}},viewBoundTemplates:function(t){var e=this;this.currentData=t,this.boundTemplateLoading=!0,Object(d["m"])({ids:t.documentIds.join(",")||0}).then((function(t){200===t.status&&(e.boundTemplateList=t.data,e.boundTemplatesDialogVisible=!0)})).finally((function(){e.boundTemplateLoading=!1}))},previewTemplate:function(t){var e=document.createElement("a");e.href="#/document/viewCreate?articleId="+t.id,e.target="_blank",e.click()},replaceTemplate:function(t){this.docAttr=t;var e=JSON.parse(t.data);this.replaceVisible=!0,this.searchEx(e)},handleBoundTemplateSelect:function(t){this.selectedBoundTemplates=t},batchReplace:function(){var t=this;return Object(R["a"])(Object(q["a"])().mark((function e(){var a,n,r,o;return Object(q["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(0!==t.selectedBoundTemplates.length){e.next=3;break}return t.$message.warning("请选择需要替换的模版"),e.abrupt("return");case 3:t.batchReplaceLoading=!0,e.prev=4,a=Object(D["a"])(t.selectedBoundTemplates),e.prev=6,a.s();case 8:if((n=a.n()).done){e.next=19;break}return r=n.value,t.docAttr=r,o=JSON.parse(r.data),e.next=14,t.searchEx(o);case 14:if(!(t.matchResults.length>0)){e.next=17;break}return e.next=17,t.replaceAll();case 17:e.next=8;break;case 19:e.next=24;break;case 21:e.prev=21,e.t0=e["catch"](6),a.e(e.t0);case 24:return e.prev=24,a.f(),e.finish(24);case 27:t.$message.success("批量替换完成"),t.boundTemplatesDialogVisible=!1,e.next=35;break;case 31:e.prev=31,e.t1=e["catch"](4),console.error("批量替换失败:",e.t1),t.$message.error("批量替换过程中发生错误");case 35:return e.prev=35,t.batchReplaceLoading=!1,e.finish(35);case 38:case"end":return e.stop()}}),e,null,[[4,31,35,38],[6,21,24,27]])})))()},searchEx:function(t){var e=this;return new Promise((function(a){var n=[];e.TemList=t,e.TemList.forEach((function(t){var e=document.createElement("div");e.innerHTML=t.content;var a=e.textContent||e.innerText,r=[/【([A-Z]{1,4}[0-9]{0,2})-([A-Z]{1,4}[0-9]{0,2})-([0-9]{2})-([0-9]{2,3})】/g,/\[([A-Z]{1,4}[0-9]{0,2})-([A-Z]{1,4}[0-9]{0,2})-([0-9]{2})-([0-9]{2,3})\]/g];r.forEach((function(t){var e;while(null!==(e=t.exec(a))){var r=e[0],o=[e[1],e[2],e[3],e[4]],c=o.every((function(t){return t.length>0}));c&&n.push(r)}}))})),e.matchResults=Object(A["a"])(new Set(n)),e.matchResults.forEach((function(t){var e=(t.startsWith("【"),t.slice(1,-1));e.split("-")})),a()}))},getDocumentType:function(t){return t.includes("-RP-")?"template_location":t.includes("-IR-")?"middle_layer_location":t.includes("-WE-")?"tech_report_location":"other_location"},formatRequestParams:function(t){var e=this,a=Array.isArray(t)?t:[t],n={template_location:[],middle_layer_location:[],tech_report_location:[],other_location:[]};return a.forEach((function(t){var a=t.replace(/[\[\]]/g,""),r=e.getDocumentType(a);console.log("params",r),Object.keys(n).forEach((function(t){r===t?n[t].push(a):n[t].push("")}))})),n},parseContent:function(t){if(!t)return"";var e=t;return e=e.replace(/\[图片:(.*?)\|style=(.*?)\|class=(.*?)\]/g,(function(t,e,a,n){return'<img src="'.concat(e,'" alt="图片" style="').concat(a,'" class="').concat(n,'">')})),e=e.replace(/\[表格\|style=(.*?)\|class=(.*?)\]\n([\s\S]*?)(?=\[|$)/g,(function(t,e,a,n){var r=n.trim().split("\n"),o='<table style="'.concat(e,'" class="').concat(a,'">');return r.forEach((function(t){o+="<tr>";var e=t.split(" | ").map((function(t){var e=t.split("[style="),a=P(e),n=a[0],r=a.slice(1);if(r.length){var o=r[0].slice(0,-1).split("|class="),c=Object(L["a"])(o,2),s=c[0],i=c[1];return'<td style="'.concat(s,'" class="').concat(i,'">').concat(n,"</td>")}return"<td>".concat(n,"</td>")}));o+=e.join("")+"</tr>"})),o+="</table>",o})),e=e.replace(/\[文本:(.*?)\|style=(.*?)\|class=(.*?)\]/g,(function(t,e,a,n){return'<span style="'.concat(a,'" class="').concat(n,'">').concat(e,"</span>")})),e},containsTableOrImage:function(t){return t.includes("<table")||t.includes("<img")},getTextNodes:function(t){var e,a=[],n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null,!1);while(e=n.nextNode())a.push(e);return a},onUpload:function(){var t=this;t.TemList.length<=0?t.$message.error("增加组件"):""!=t.docAttr.title?(t.docAttr.links=JSON.stringify(t.docAttr.linkProduct),t.docAttr.projects=JSON.stringify(t.docAttr.linkProject),t.docAttr.data=JSON.stringify(t.TemList),t.docAttr.is_template=1,t.docAttr.id=t.docAttr.id,t.docAttr.user_name=t.docAttr.name,t.docAttr.user_id=t.docAttr.id,Object(f["n"])(t.docAttr).then((function(e){200==e.status&&(t.docAttr.id=e.data,t.$message.success("模版更新成功"))}))):t.$message.error("请填写模版标题")},processAndReplaceContent:function(t,e){var a=this;return Object(R["a"])(Object(q["a"])().mark((function t(){var n,r,o,c;return Object(q["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,n=a.formatRequestParams(e),n.project_id=a.currentData.id,t.next=5,z.a.post("".concat("http://183.195.216.54:8084","/project-raw-data/batch-content"),n,{headers:{"Content-Type":"application/json"}});case 5:if(r=t.sent,200!==r.status||!r.data){t.next=11;break}if(c=null===(o=r.data.data.matched_data[0])||void 0===o?void 0:o.content,!c){t.next=11;break}return a.TemList.forEach((function(t,n){console.log(t,e,c);var r=a.processTableContent(t.content,e,c);a.$set(a.TemList[n],"content",r)})),t.abrupt("return",!0);case 11:return t.abrupt("return",!1);case 14:return t.prev=14,t.t0=t["catch"](0),console.error("处理内容失败:",t.t0),t.abrupt("return",!1);case 18:case"end":return t.stop()}}),t,null,[[0,14]])})))()},replaceItem:function(t){var e=this;return Object(R["a"])(Object(q["a"])().mark((function a(){var n,r;return Object(q["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,e.processAndReplaceContent(e.TemList,t);case 3:n=a.sent,n?(e.matchResults=e.matchResults.filter((function(e){return e!==t})),e.onUpload(),e.$message.success("替换成功")):e.$message.warning("未获取到替换内容"),a.next=11;break;case 7:a.prev=7,a.t0=a["catch"](0),console.error("替换失败:",a.t0),e.$message.error((null===(r=a.t0.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||"替换失败");case 11:case"end":return a.stop()}}),a,null,[[0,7]])})))()},replaceAll:function(){var t=this;return Object(R["a"])(Object(q["a"])().mark((function e(){var a,n,r,o,c;return Object(q["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.batchReplaceLoading=!0,e.prev=1,a=t.matchResults.map((function(t){return t.replace(/[\[\]【】]/g,"")})),n={template_location:[],middle_layer_location:[],tech_report_location:[],other_location:[]},a.forEach((function(e){var a=t.getDocumentType(e);Object.keys(n).forEach((function(t){a===t?n[t].push(e):n[t].push("")}))})),n.project_id=t.currentData.id,e.next=8,z.a.post("".concat("http://183.195.216.54:8084","/project-raw-data/batch-content"),n,{headers:{"Content-Type":"application/json"}});case 8:if(r=e.sent,200!==r.status||!r.data){e.next=21;break}if(o=r.data.data.matched_data,!(o&&o.length>0)){e.next=20;break}return t.TemList.forEach((function(e,a){var n=e.content;t.matchResults.forEach((function(e,a){var r,c=null===(r=o[a])||void 0===r?void 0:r.content;c&&(n=t.processTableContent(n,e,c))})),t.$set(t.TemList[a],"content",n)})),e.next=15,t.onUpload();case 15:t.matchResults=[],t.$message.success("批量替换成功"),t.replaceVisible=!1,e.next=21;break;case 20:t.$message.warning("未获取到替换内容");case 21:e.next=27;break;case 23:e.prev=23,e.t0=e["catch"](1),console.error("批量替换失败:",e.t0),t.$message.error((null===(c=e.t0.response)||void 0===c||null===(c=c.data)||void 0===c?void 0:c.message)||"批量替换失败");case 27:return e.prev=27,t.batchReplaceLoading=!1,e.finish(27);case 30:case"end":return e.stop()}}),e,null,[[1,23,27,30]])})))()}},Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(E,"getDocumentType",(function(t){return t.includes("-RP-")?"template_location":t.includes("-IR-")?"middle_layer_location":t.includes("-WE-")?"tech_report_location":"other_location"})),"processTableContent",(function(t,e,a){if(!t||!e)return t;try{var n=new RegExp(this.escapeRegExp(e),"g");return t.replace(n,a)}catch(r){return console.error("替换内容时出错:",r),t}})),"convertTextToHtml",(function(t){if(!t)return"";var e=t;return e=e.replace(/\[表格\|style=(.*?)\|class=(.*?)\]([\s\S]*?)(?=\[|$)/g,(function(t,e,a,n){var r=n.trim().split("\n"),o='<table style="'.concat(e,'; border-collapse: collapse;" class="').concat(a,'">');return r.forEach((function(t,e){var a=t.split("|").map((function(t){return t.trim()})),n=Object(L["a"])(a,2),r=n[0],c=n[1];r&&(o+="<tr>",o+=c?'\n <td style="border: 1px solid #000; padding: 8px;">'.concat(r,'</td>\n <td style="border: 1px solid #000; padding: 8px;">').concat(c,"</td>\n "):'\n <td style="border: 1px solid #000; padding: 8px; font-weight: '.concat(0===e?"bold":"normal",'">').concat(r,"</td>\n "),o+="</tr>")})),o+="</table>",o})),e=e.replace(/\[图片:(.*?)\|style=(.*?)\|class=(.*?)\]/g,(function(t,e,a,n){return'<img src="'.concat(e,'" alt="图片" style="').concat(a,'" class="').concat(n,'">')})),e=e.replace(/\[文本:(.*?)\|style=(.*?)\|class=(.*?)\]/g,(function(t,e,a,n){return'<span style="'.concat(a,'" class="').concat(n,'">').concat(e,"</span>")})),e})),"escapeRegExp",(function(t){var e=t.startsWith("【"),a=e?t.replace(/^【|】$/g,""):t.replace(/^\[|\]$/g,""),n=a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");return e?"\\【".concat(n,"\\】"):"\\[".concat(n,"\\]")})),"selTemplate",(function(t){this.currentData=t,this.selectedTemplates=[],this.templateQueryForm.page=1,this.loadTemplateList()})),"handleTemplatePageChange",(function(t){var e=this.$refs.templateTable.selection;e.length>0&&this.selectedPageIds.set(this.templateQueryForm.page,new Set(e.map((function(t){return t.id})))),this.templateQueryForm.page=t,this.loadTemplateList()})),"loadTemplateList",(function(){var t=this;this.templateLoading=!0,Object(f["l"])(this.templateQueryForm).then((function(e){200===e.status&&(t.templateList=e.data.dataList,t.templateTotal=e.data.totalRecord,t.templateDialogVisible=!0,t.$nextTick((function(){var e=t.templateQueryForm.page,a=t.selectedPageIds.get(e);t.templateList.forEach((function(e){var n=t.isAllSelected||a&&a.has(e.id)||t.selectedTemplateIds.has(e.id);n&&t.$refs.templateTable.toggleRowSelection(e,!0)}))})))})).finally((function(){t.templateLoading=!1}))})),"handleTemplateSelect",(function(t){var e=this,a=this.templateQueryForm.page,n=t.map((function(t){return t.id}));if(n.length>0?this.selectedPageIds.set(a,new Set(n)):this.selectedPageIds.delete(a),this.isAllSelected&&t.length<this.templateList.length){this.isAllSelected=!1;var r=new Set;this.selectedPageIds.forEach((function(t,e){e!==a&&t.forEach((function(t){return r.add(t)}))})),n.forEach((function(t){return r.add(t)})),this.selectedTemplateIds=r}else this.templateList.forEach((function(t){n.includes(t.id)?e.selectedTemplateIds.add(t.id):e.selectedTemplateIds.delete(t.id)}))})),"handleSelectAll",(function(t){var e=this,a=this.templateQueryForm.page;t.length>0?this.$confirm("是否选择所有页的模版?","提示",{confirmButtonText:"全部选择",cancelButtonText:"仅选择当前页",type:"info"}).then((function(){e.selectAllPages()})).catch((function(){e.selectCurrentPage(t),e.selectedPageIds.set(a,new Set(t.map((function(t){return t.id}))))})):(this.isAllSelected=!1,this.selectedTemplateIds.clear(),this.selectedPageIds.clear(),this.$refs.templateTable.clearSelection())})),"selectAllPages",(function(){var t=this;return Object(R["a"])(Object(q["a"])().mark((function e(){var a;return Object(q["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.isAllSelected=!0,t.selectedTemplateIds.clear(),e.prev=2,e.next=5,t.getAllTemplates();case 5:a=e.sent,a.forEach((function(e){t.selectedTemplateIds.add(e.id)})),t.templateList.forEach((function(e){t.$refs.templateTable.toggleRowSelection(e,!0)})),t.$message.success("已选择全部 ".concat(t.templateTotal," 条数据")),e.next=15;break;case 11:e.prev=11,e.t0=e["catch"](2),console.error("获取所有模版失败:",e.t0),t.$message.error("获取所有模版失败");case 15:case"end":return e.stop()}}),e,null,[[2,11]])})))()})),Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(E,"selectCurrentPage",(function(t){var e=this;this.isAllSelected=!1,this.selectedTemplateIds.clear(),t.forEach((function(t){e.selectedTemplateIds.add(t.id)}))})),"getAllTemplates",(function(){var t=this;return Object(R["a"])(Object(q["a"])().mark((function e(){var a,n,r;return Object(q["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=999,n=Object(l["a"])(Object(l["a"])({},t.templateQueryForm),{},{page:1,pageSize:a}),e.prev=2,e.next=5,Object(f["l"])(n);case 5:if(r=e.sent,200!==r.status){e.next=8;break}return e.abrupt("return",r.data.dataList);case 8:return e.abrupt("return",[]);case 11:return e.prev=11,e.t0=e["catch"](2),console.error("获取所有模版失败:",e.t0),e.abrupt("return",[]);case 15:case"end":return e.stop()}}),e,null,[[2,11]])})))()})),"confirmTemplateSelection",(function(){var t=this;0!==this.selectedTemplateIds.size?Object(d["j"])({project_id:this.currentData.id,doc_ids:JSON.stringify(Object(A["a"])(this.selectedTemplateIds))}).then((function(e){200===e.status&&(t.$message.success("模版关联成功"),t.closeTemplateDialog(),t.search())})):this.$message.warning("请至少选择一个模版")})),"closeTemplateDialog",(function(){this.templateDialogVisible=!1,this.selectedTemplateIds.clear(),this.selectedPageIds.clear(),this.isAllSelected=!1,this.$refs.templateTable.clearSelection()})),"enterPro",(function(t){var e=this;0!=t.documentIds.length?Object(d["m"])({ids:t.documentIds.join(",")||0}).then(function(){var a=Object(R["a"])(Object(q["a"])().mark((function a(n){var r,o,c,s,i,u,d;return Object(q["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(200!==n.status){a.next=18;break}return r=n.data,o=[],r.forEach((function(t){if(t.data){var a=JSON.parse(t.data);a.forEach((function(a){var n=document.createElement("div");n.innerHTML=a.content;var r=n.textContent||n.innerText,c=[/【([A-Z]{1,4}[0-9]{0,2})-([A-Z]{1,4}[0-9]{0,2})-([0-9]{2})-([0-9]{2,3})】/g,/\[([A-Z]{1,4}[0-9]{0,2})-([A-Z]{1,4}[0-9]{0,2})-([0-9]{2})-([0-9]{2,3})\]/g];c.forEach((function(a){var n;while(null!==(n=a.exec(r)))o.push({template_id:t.id,template_title:t.title,location:n[0],type:e.getDocumentType(n[0])})}))}))}})),a.prev=4,c={template_location:[],middle_layer_location:[],tech_report_location:[],other_location:[]},o.forEach((function(t){Object.keys(c).forEach((function(e){t.type===e?c[e].push(t.location.replace(/[\[\]【】]/g,"")):c[e].push("")}))})),c.project_id=t.id,a.next=10,z.a.post("".concat("http://183.195.216.54:8084","/project-raw-data/batch-content"),c,{headers:{"Content-Type":"application/json"}});case 10:s=a.sent,200===s.status&&s.data&&(i=s.data.data.matched_data,u=o.map((function(t,e){var a,n,r;return Object(l["a"])(Object(l["a"])({},t),{},{content:(null===(a=i[e])||void 0===a?void 0:a.content)||null,template_location:(null===(n=i[e])||void 0===n?void 0:n.template_location)||null,tech_report_location:(null===(r=i[e])||void 0===r?void 0:r.tech_report_location)||[]})})),d=u.reduce((function(t,e){var a=t.find((function(t){return t.template_id===e.template_id&&t.location===e.location}));return a?t:[].concat(Object(A["a"])(t),[e])}),[]),e.$router.push({path:"/project/ProjectInput",query:{id:t.id,projectData:encodeURIComponent(JSON.stringify({locations:d,templates:r.map((function(t){return{id:t.id,title:t.title}}))}))}})),a.next=18;break;case 14:a.prev=14,a.t0=a["catch"](4),console.error("获取替换内容失败:",a.t0),e.$message.error("获取替换内容失败");case 18:case"end":return a.stop()}}),a,null,[[4,14]])})));return function(t){return a.apply(this,arguments)}}()).catch((function(t){console.error("获取模版位置信息失败:",t),e.$message.error("获取模版位置信息失败")})):this.$message.warning("请先绑定模版!")})),"getCategoryTypeName",(function(t){if(!t)return"未分类";var e=this.productList.find((function(e){return e.id===t}));return e&&e.category?e.category.name:"未知分类"})),"getCategoryName",(function(t){if(!t)return"未知产品";var e=this.productList.find((function(e){return e.id===t}));return e?e.name:"未知产品"})),"searchData",(function(){var t=this;t.dialogVisible=!1,t.search()})),"btnDelete",(function(t){var e=this,a={id:t};e.$confirm("您是否确认删除该记录?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((function(t){Object(d["e"])(a).then((function(t){e.search()}))})).catch((function(){}))})),"btnEdit",(function(t){var e=this;e.currentDataId=t.id,e.dialogVisible=!0})),Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(Object(C["a"])(E,"onClose",(function(t){console.log("onClose triggered with needRefresh:",t),this.currentDataId=0,this.dialogVisible=!1,t&&this.search()})),"handleUpdate",(function(){this.search()})),"search",(function(){var t=this;return Object(R["a"])(Object(q["a"])().mark((function e(){var a,n;return Object(q["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Object(d["l"])(t.queryForm);case 3:if(a=e.sent,a){e.next=6;break}return e.abrupt("return");case 6:return n=a.data.dataList.map(function(){var t=Object(R["a"])(Object(q["a"])().mark((function t(e){var a;return Object(q["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Object(d["a"])({id:e.id});case 3:a=t.sent,200===a.status&&(e.calculate=a.data.completionRate),t.next=11;break;case 7:t.prev=7,t.t0=t["catch"](0),console.error("获取项目".concat(e.id,"完成度失败:"),t.t0),e.calculate=0;case 11:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}()),e.next=9,Promise.all(n);case 9:t.dataList=a.data.dataList,t.recordCount=a.data.totalRecord,t.pageTotal=a.data.totalPage,e.next=18;break;case 14:e.prev=14,e.t0=e["catch"](0),console.error("搜索失败:",e.t0),t.$message.error("获取项目列表失败");case 18:case"end":return e.stop()}}),e,null,[[0,14]])})))()})),"ChangePage",(function(t){var e=this;e.queryForm.page=t,e.search()})),"init",(function(){var t=this;Object(d["k"])().then((function(e){200===e.status&&(t.categoryList=e.data.dataList)})),Object(d["h"])().then((function(e){t.currentPhaseList=e.data.options})),Object(d["i"])().then((function(e){t.getstatusList=e.data.options})),Object(m["c"])({page:1,pageSize:999}).then((function(e){t.customList=e.data.dataList})),Object(p["h"])({page:1,pageSize:999}).then((function(e){t.productList=e.data.dataList}))})),"handleExport",(function(t,e){switch(t){case"word":this.exportDocument(e);break;case"pdf":this.exportToPDF(e);break}})),"exportToPDF",(function(t){var e=this;return Object(R["a"])(Object(q["a"])().mark((function a(){var n,r,o,c,s;return Object(q["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.prev=0,n=JSON.parse(t.data||"[]"),r=document.createElement("div"),r.className="content",n.forEach((function(t){var e=document.createElement("div");e.className="template-textarea",e.innerHTML=t.content,r.appendChild(e)})),r.querySelectorAll('input[type="text"]').forEach((function(t){var e=document.createElement("span");e.textContent=t.value,t.parentNode.replaceChild(e,t)})),o='<!DOCTYPE html>\n <html>\n <head>\n <meta charset="UTF-8">\n <style>\n @page {\n size: A4;\n margin: 2cm;\n }\n body {\n font-family: Arial, sans-serif;\n font-size: 12pt;\n line-height: 1.5;\n }\n table {\n width: 100%;\n border-collapse: collapse;\n }\n td, th {\n border: 1px solid black;\n padding: 5px;\n }\n .template-textarea {\n page-break-after: always;\n }\n .TOC {\n display: none !important;\n }\n </style>\n </head>\n <body>\n '.concat(r.innerHTML,"\n </body>\n </html>"),a.next=9,Object(f["f"])({content:o,title:t.title});case 9:if(c=a.sent,200===c.status){a.next=13;break}return e.$alert(c.errMsg),a.abrupt("return");case 13:s=document.createElement("a"),s.href=c.data.file_path,s.download=c.data.file_name,document.body.appendChild(s),s.click(),document.body.removeChild(s),e.$message.success("导出成功"),a.next=26;break;case 22:a.prev=22,a.t0=a["catch"](0),console.error("导出PDF失败:",a.t0),e.$alert("导出PDF时发生错误,请稍后重试。");case 26:case"end":return a.stop()}}),a,null,[[0,22]])})))()})))}),U=V,Q=(a("915f"),Object(g["a"])(U,x,k,!1,null,"34fa763f",null)),B=Q.exports,M={components:{dataSearch:T,dataList:B},data:function(){return{queryForm:{page:1,pageSize:10,name:"",category_id:"",status:"",isUpdate:!1}}},methods:{setQuery:function(t){this.queryForm=t}}},J=M,H=(a("3672"),Object(g["a"])(J,n,r,!1,null,null,null));e["default"]=H.exports},"744d":function(t,e,a){},8656:function(t,e,a){"use strict";a("cb8b")},"915f":function(t,e,a){"use strict";a("ded1")},9246:function(t,e,a){"use strict";a("744d")},c4c8:function(t,e,a){"use strict";a.d(e,"i",(function(){return r})),a.d(e,"b",(function(){return o})),a.d(e,"k",(function(){return c})),a.d(e,"e",(function(){return s})),a.d(e,"d",(function(){return i})),a.d(e,"g",(function(){return l})),a.d(e,"h",(function(){return u})),a.d(e,"a",(function(){return d})),a.d(e,"j",(function(){return p})),a.d(e,"f",(function(){return m})),a.d(e,"c",(function(){return f}));var n=a("b775");function r(t){return Object(n["a"])({url:"/product/category/search",method:"post",data:t})}function o(t){return Object(n["a"])({url:"/product/category/create",method:"post",data:t})}function c(t){return Object(n["a"])({url:"/product/category/update",method:"post",data:t})}function s(t){return Object(n["a"])({url:"/product/category/info",method:"post",data:t})}function i(t){return Object(n["a"])({url:"/product/category/delete",method:"post",data:t})}function l(t){return Object(n["a"])({url:"/product/category/all",method:"post",data:t})}function u(t){return Object(n["a"])({url:"/product/search",method:"post",data:t})}function d(t){return Object(n["a"])({url:"/product/create",method:"post",data:t})}function p(t){return Object(n["a"])({url:"/product/update",method:"post",data:t})}function m(t){return Object(n["a"])({url:"/product/info",method:"post",data:t})}function f(t){return Object(n["a"])({url:"/product/delete",method:"post",data:t})}},cb8b:function(t,e,a){},ded1:function(t,e,a){},eb4d:function(t,e,a){},f6b0:function(t,e,a){"use strict";a.d(e,"c",(function(){return r})),a.d(e,"d",(function(){return o})),a.d(e,"a",(function(){return c})),a.d(e,"e",(function(){return s})),a.d(e,"b",(function(){return i}));var n=a("b775");function r(t){return Object(n["a"])({url:"/customer/search",method:"post",data:t})}function o(){return Object(n["a"])({url:"/customer/sync",method:"post"})}function c(t){return Object(n["a"])({url:"/customer/create",method:"post",data:t})}function s(t){return Object(n["a"])({url:"/customer/update",method:"post",data:t})}function i(t){return Object(n["a"])({url:"/customer/delete",method:"post",data:t})}}}]);