@qqt-product/system 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/.eslintignore +4 -0
  2. package/.eslintrc.cjs +22 -0
  3. package/.prettierignore +4 -0
  4. package/.prettierrc.cjs +41 -0
  5. package/.vscode/extensions.json +3 -0
  6. package/README.md +16 -0
  7. package/dist/index.es.d.ts +1 -0
  8. package/dist/index.es.js +14234 -0
  9. package/dist/index.umd.js +311 -0
  10. package/dist/lib/components/QAccountList/src/QAccountList.vue.d.ts +143 -0
  11. package/dist/lib/components/QAccountList/src/useConfigData.d.ts +37 -0
  12. package/dist/lib/components/QBackgroundFileTaskList/src/QBackgroundFileTaskList.vue.d.ts +66 -0
  13. package/dist/lib/components/QBackgroundFileTaskList/src/useConfigData.d.ts +14 -0
  14. package/dist/lib/components/QCompanyermissionList/src/form.vue.d.ts +80 -0
  15. package/dist/lib/components/QCompanyermissionList/src/types.d.ts +44 -0
  16. package/dist/lib/components/QElsEmailSendLogList/src/QElsEmailSendLogList.vue.d.ts +68 -0
  17. package/dist/lib/components/QElsEmailSendLogList/src/useConfigData.d.ts +13 -0
  18. package/dist/lib/components/QElsMsgRecordList/src/QElsMsgRecordList.vue.d.ts +72 -0
  19. package/dist/lib/components/QElsMsgRecordList/src/useConfigData.d.ts +16 -0
  20. package/dist/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsList.vue.d.ts +75 -0
  21. package/dist/lib/components/QI18nList/src/QI18nForm.vue.d.ts +47 -0
  22. package/dist/lib/components/QI18nList/src/QI18nList.vue.d.ts +136 -0
  23. package/dist/lib/components/QI18nList/src/useConfigData.d.ts +31 -0
  24. package/dist/lib/components/QImChatGroupList/src/QImChatGroupList.vue.d.ts +61 -0
  25. package/dist/lib/components/QImChatGroupList/src/useConfigData.d.ts +11 -0
  26. package/dist/lib/components/QMqRecordList/src/QMqRecordList.vue.d.ts +60 -0
  27. package/dist/lib/components/QMqRecordList/src/useConfigData.d.ts +12 -0
  28. package/dist/lib/components/QPasswordSecurityPolicy/src/QPasswordSecurityPolicy.vue.d.ts +49 -0
  29. package/dist/lib/components/QPermissionDataList/src/QPermissionDataAuth.vue.d.ts +3 -0
  30. package/dist/lib/components/QPermissionDataList/src/form.vue.d.ts +50 -0
  31. package/dist/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeList.vue.d.ts +86 -0
  32. package/dist/lib/components/QPurchaseNoticeList/src/useConfigData.d.ts +15 -0
  33. package/dist/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateList.vue.d.ts +47 -0
  34. package/dist/lib/components/QPurchaseNoticeTemplateList/src/useConfigData.d.ts +12 -0
  35. package/dist/lib/components/QQuartzJobList/src/QQuartzJobList.vue.d.ts +129 -0
  36. package/dist/lib/components/QQuartzJobList/src/components/JCron.vue.d.ts +23 -0
  37. package/dist/lib/components/QQuartzJobList/src/components/JCronModal.vue.d.ts +100 -0
  38. package/dist/lib/components/QQuartzJobList/src/components/QuartzJobModal.vue.d.ts +55 -0
  39. package/dist/lib/components/QQuartzJobList/src/useConfigData.d.ts +20 -0
  40. package/dist/lib/components/QRoleList/src/QRoleList.vue.d.ts +100 -0
  41. package/dist/lib/components/QRoleList/src/components/content-header/index.d.ts +23 -0
  42. package/dist/lib/components/QRoleList/src/components/userAuthorization/index.d.ts +79 -0
  43. package/dist/lib/components/QRoleList/src/useConfigData.d.ts +30 -0
  44. package/dist/lib/components/QSupplierAccountList/src/QSupplierAccountForm.vue.d.ts +55 -0
  45. package/dist/lib/components/QSupplierAccountList/src/QSupplierAccountList.vue.d.ts +104 -0
  46. package/dist/lib/components/QSupplierAccountList/src/useConfigData.d.ts +29 -0
  47. package/dist/lib/components/QUsageList/src/QUsageList.vue.d.ts +49 -0
  48. package/dist/lib/components/QUsageList/src/useConfigData.d.ts +14 -0
  49. package/dist/lib/components/QcustomConfigEdit/component/TempalePreviewModal.vue.d.ts +31 -0
  50. package/dist/lib/components/QcustomConfigEdit/component/dataFormatComponent.d.ts +46 -0
  51. package/dist/lib/components/QcustomConfigEdit/component/regexComponent.d.ts +41 -0
  52. package/dist/lib/components/QcustomConfigEdit/src/QcustomConfigRender.d.ts +12 -0
  53. package/dist/lib/components/QcustomConfigEdit/src/types.d.ts +61 -0
  54. package/dist/lib/components/QcustomConfigEdit/src/useConfigComputed.d.ts +7 -0
  55. package/dist/lib/components/QcustomConfigEdit/src/useConfigData.d.ts +85 -0
  56. package/dist/lib/components/QcustomConfigEdit/src/useConfigMethods.d.ts +16 -0
  57. package/dist/lib/components/QcustomConfigEdit/src/useConstant.d.ts +18 -0
  58. package/dist/lib/components/QcustomConfigList/component/ImportJsonCustomConfig.vue.d.ts +50 -0
  59. package/dist/lib/components/QcustomConfigList/src/QcustomConfigList.vue.d.ts +112 -0
  60. package/dist/lib/components/QcustomConfigList/src/useConfigData.d.ts +17 -0
  61. package/dist/lib/components/QcustomConfigList/src/useMethods.d.ts +15 -0
  62. package/dist/lib/components/QsysConfigList/src/QsysConfigList.vue.d.ts +66 -0
  63. package/dist/lib/components/QsysConfigList/src/useConfigData.d.ts +11 -0
  64. package/dist/lib/components/QsysConfigList/src/useMethods.d.ts +6 -0
  65. package/dist/lib/components/index.d.ts +39 -0
  66. package/dist/lib/components/integratedNodesList/src/index.vue.d.ts +107 -0
  67. package/dist/lib/components/integratedReportList/src/index.vue.d.ts +70 -0
  68. package/dist/lib/components/integratedReportSearchList/src/index.vue.d.ts +61 -0
  69. package/dist/lib/components/loginAbnormalLogList/src/index.vue.d.ts +46 -0
  70. package/dist/lib/components/loginLogList/src/index.vue.d.ts +45 -0
  71. package/dist/lib/components/loginSupplierLogList/src/index.vue.d.ts +45 -0
  72. package/dist/lib/components/operateLogList/src/index.vue.d.ts +53 -0
  73. package/dist/lib/index.d.ts +6 -0
  74. package/dist/lib/utils/global.hook.d.ts +31 -0
  75. package/dist/lib/utils/global.types.d.ts +41 -0
  76. package/dist/lib/utils/regexp.d.ts +27 -0
  77. package/dist/style.css +1 -0
  78. package/dist/vite-env.d.ts +13 -0
  79. package/dist/vite.svg +1 -0
  80. package/index.html +13 -0
  81. package/package.json +65 -0
  82. package/public/vite.svg +1 -0
  83. package/src/App.vue +8 -0
  84. package/src/lib/components/QAccountList/index.ts +6 -0
  85. package/src/lib/components/QAccountList/src/QAccountDetail.vue +191 -0
  86. package/src/lib/components/QAccountList/src/QAccountEdit.vue +241 -0
  87. package/src/lib/components/QAccountList/src/QAccountList.vue +530 -0
  88. package/src/lib/components/QAccountList/src/useConfigData.ts +53 -0
  89. package/src/lib/components/QBackgroundFileTaskList/index.ts +6 -0
  90. package/src/lib/components/QBackgroundFileTaskList/src/QBackgroundFileTaskList.vue +137 -0
  91. package/src/lib/components/QBackgroundFileTaskList/src/useConfigData.ts +20 -0
  92. package/src/lib/components/QCompanyermissionList/src/editTree.vue +291 -0
  93. package/src/lib/components/QCompanyermissionList/src/form.vue +238 -0
  94. package/src/lib/components/QCompanyermissionList/src/index.vue +309 -0
  95. package/src/lib/components/QCompanyermissionList/src/types.ts +44 -0
  96. package/src/lib/components/QElsEmailSendLogList/index.ts +6 -0
  97. package/src/lib/components/QElsEmailSendLogList/src/QElsEmailSendLogList.vue +166 -0
  98. package/src/lib/components/QElsEmailSendLogList/src/useConfigData.ts +19 -0
  99. package/src/lib/components/QElsMsgRecordList/index.ts +6 -0
  100. package/src/lib/components/QElsMsgRecordList/src/QElsMsgRecordDetail.vue +148 -0
  101. package/src/lib/components/QElsMsgRecordList/src/QElsMsgRecordList.vue +124 -0
  102. package/src/lib/components/QElsMsgRecordList/src/useConfigData.ts +22 -0
  103. package/src/lib/components/QElsTenantPortalNewsList/index.ts +6 -0
  104. package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsDetail.vue +139 -0
  105. package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsEdit.vue +196 -0
  106. package/src/lib/components/QElsTenantPortalNewsList/src/QElsTenantPortalNewsList.vue +122 -0
  107. package/src/lib/components/QElsTenantPortalNewsList/src/useConfigData.ts +20 -0
  108. package/src/lib/components/QI18nList/index.ts +6 -0
  109. package/src/lib/components/QI18nList/src/QI18nForm.vue +141 -0
  110. package/src/lib/components/QI18nList/src/QI18nList.vue +361 -0
  111. package/src/lib/components/QI18nList/src/useConfigData.ts +37 -0
  112. package/src/lib/components/QImChatGroupList/index.ts +6 -0
  113. package/src/lib/components/QImChatGroupList/src/QImChatGroupList.vue +94 -0
  114. package/src/lib/components/QImChatGroupList/src/useConfigData.ts +17 -0
  115. package/src/lib/components/QMqRecordList/index.ts +6 -0
  116. package/src/lib/components/QMqRecordList/src/QMqRecordList.vue +105 -0
  117. package/src/lib/components/QMqRecordList/src/useConfigData.ts +18 -0
  118. package/src/lib/components/QPasswordSecurityPolicy/index.ts +6 -0
  119. package/src/lib/components/QPasswordSecurityPolicy/src/QPasswordSecurityPolicy.vue +266 -0
  120. package/src/lib/components/QPermissionDataList/index.ts +6 -0
  121. package/src/lib/components/QPermissionDataList/src/QPermissionDataAuth.vue +3 -0
  122. package/src/lib/components/QPermissionDataList/src/QPermissionDataEdit.vue +221 -0
  123. package/src/lib/components/QPermissionDataList/src/QPermissionDataList.vue +117 -0
  124. package/src/lib/components/QPermissionDataList/src/form.vue +109 -0
  125. package/src/lib/components/QPurchaseNoticeList/index.ts +6 -0
  126. package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeDetail.vue +147 -0
  127. package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeEdit.vue +244 -0
  128. package/src/lib/components/QPurchaseNoticeList/src/QPurchaseNoticeList.vue +163 -0
  129. package/src/lib/components/QPurchaseNoticeList/src/useConfigData.ts +22 -0
  130. package/src/lib/components/QPurchaseNoticeTemplateList/index.ts +6 -0
  131. package/src/lib/components/QPurchaseNoticeTemplateList/src/QPurchaseNoticeTemplateList.vue +85 -0
  132. package/src/lib/components/QPurchaseNoticeTemplateList/src/useConfigData.ts +18 -0
  133. package/src/lib/components/QQuartzJobList/index.ts +6 -0
  134. package/src/lib/components/QQuartzJobList/src/QQuartzJobList.vue +263 -0
  135. package/src/lib/components/QQuartzJobList/src/components/JCron.vue +82 -0
  136. package/src/lib/components/QQuartzJobList/src/components/JCronModal.vue +985 -0
  137. package/src/lib/components/QQuartzJobList/src/components/QuartzJobModal.vue +176 -0
  138. package/src/lib/components/QQuartzJobList/src/useConfigData.ts +26 -0
  139. package/src/lib/components/QRoleList/index.ts +6 -0
  140. package/src/lib/components/QRoleList/src/QRoleList.vue +288 -0
  141. package/src/lib/components/QRoleList/src/components/content-header/contentHeader.less +31 -0
  142. package/src/lib/components/QRoleList/src/components/content-header/index.tsx +42 -0
  143. package/src/lib/components/QRoleList/src/components/userAuthorization/index.tsx +690 -0
  144. package/src/lib/components/QRoleList/src/components/userAuthorization/userAuthorization.less +97 -0
  145. package/src/lib/components/QRoleList/src/useConfigData.ts +33 -0
  146. package/src/lib/components/QSupplierAccountList/index.ts +6 -0
  147. package/src/lib/components/QSupplierAccountList/src/QSupplierAccountForm.vue +187 -0
  148. package/src/lib/components/QSupplierAccountList/src/QSupplierAccountList.vue +302 -0
  149. package/src/lib/components/QSupplierAccountList/src/useConfigData.ts +29 -0
  150. package/src/lib/components/QUsageList/index.ts +6 -0
  151. package/src/lib/components/QUsageList/src/QUsageList.vue +82 -0
  152. package/src/lib/components/QUsageList/src/useConfigData.ts +20 -0
  153. package/src/lib/components/QcustomConfigEdit/component/AddDictCodeModal.vue +140 -0
  154. package/src/lib/components/QcustomConfigEdit/component/TempalePreviewModal.vue +100 -0
  155. package/src/lib/components/QcustomConfigEdit/component/dataFormatComponent.tsx +100 -0
  156. package/src/lib/components/QcustomConfigEdit/component/regexComponent.tsx +71 -0
  157. package/src/lib/components/QcustomConfigEdit/index.ts +6 -0
  158. package/src/lib/components/QcustomConfigEdit/src/QcustomConfigEdit.vue +1807 -0
  159. package/src/lib/components/QcustomConfigEdit/src/QcustomConfigRender.tsx +242 -0
  160. package/src/lib/components/QcustomConfigEdit/src/types.ts +71 -0
  161. package/src/lib/components/QcustomConfigEdit/src/useConfigComputed.ts +75 -0
  162. package/src/lib/components/QcustomConfigEdit/src/useConfigData.ts +123 -0
  163. package/src/lib/components/QcustomConfigEdit/src/useConfigMethods.ts +117 -0
  164. package/src/lib/components/QcustomConfigEdit/src/useConstant.ts +301 -0
  165. package/src/lib/components/QcustomConfigEdit/style/index.less +41 -0
  166. package/src/lib/components/QcustomConfigList/component/ImportJsonCustomConfig.vue +135 -0
  167. package/src/lib/components/QcustomConfigList/index.ts +6 -0
  168. package/src/lib/components/QcustomConfigList/src/QcustomConfigList.vue +268 -0
  169. package/src/lib/components/QcustomConfigList/src/types.ts +1 -0
  170. package/src/lib/components/QcustomConfigList/src/useConfigData.ts +23 -0
  171. package/src/lib/components/QcustomConfigList/src/useMethods.ts +36 -0
  172. package/src/lib/components/QcustomConfigList/style/index.less +3 -0
  173. package/src/lib/components/QsysConfigList/index.ts +6 -0
  174. package/src/lib/components/QsysConfigList/src/QsysConfigList.vue +125 -0
  175. package/src/lib/components/QsysConfigList/src/types.ts +1 -0
  176. package/src/lib/components/QsysConfigList/src/useConfigData.ts +17 -0
  177. package/src/lib/components/QsysConfigList/src/useMethods.ts +11 -0
  178. package/src/lib/components/QsysConfigList/style/index.less +3 -0
  179. package/src/lib/components/index.ts +78 -0
  180. package/src/lib/components/integratedNodesList/src/QIntegratedNodesDetail.vue +49 -0
  181. package/src/lib/components/integratedNodesList/src/QIntegratedNodesEdit.vue +143 -0
  182. package/src/lib/components/integratedNodesList/src/index.vue +136 -0
  183. package/src/lib/components/integratedReportList/src/index.vue +86 -0
  184. package/src/lib/components/integratedReportSearchList/src/index.vue +66 -0
  185. package/src/lib/components/loginAbnormalLogList/src/index.vue +50 -0
  186. package/src/lib/components/loginLogList/src/index.vue +57 -0
  187. package/src/lib/components/loginSupplierLogList/src/index.vue +63 -0
  188. package/src/lib/components/operateLogList/src/index.vue +57 -0
  189. package/src/lib/index.ts +15 -0
  190. package/src/lib/utils/constant.ts +1 -0
  191. package/src/lib/utils/global.hook.ts +337 -0
  192. package/src/lib/utils/global.types.ts +49 -0
  193. package/src/lib/utils/regexp.ts +143 -0
  194. package/src/main.ts +11 -0
  195. package/src/vite-env.d.ts +13 -0
  196. package/tsconfig.json +24 -0
  197. package/tsconfig.node.json +9 -0
  198. package/vite.config.ts +61 -0
@@ -0,0 +1,1807 @@
1
+ <template>
2
+ <div class="page-container">
3
+ <div class="edit-page">
4
+ <a-spin size="large" :spinning="confirmLoading">
5
+ <div class="page-header">
6
+ <a-steps :current="currentStep" size="small">
7
+ <a-step title="基本信息" />
8
+ <a-step title="分组配置" />
9
+ <a-step title="表头配置" />
10
+ <a-step title="表行配置" />
11
+ </a-steps>
12
+ </div>
13
+ <div class="page-content">
14
+ <!--step 1 -->
15
+ <div class="content-step-one" v-show="currentStep === 0">
16
+ <!--弱提示-->
17
+ <a-row :getterr="12" class="p-t-10-px">
18
+ <a-alert
19
+ v-if="showBusinessTips == '1'"
20
+ class="business-tips"
21
+ message="提示"
22
+ description="业务模板的版本升级不对历史单据产生影响,如需修改历史单据配置,请直接编辑原模板。"
23
+ style="margin-bottom: 10px"
24
+ type="info"
25
+ @close="alertClose"
26
+ closable
27
+ show-icon
28
+ />
29
+ </a-row>
30
+ <!--表格-->
31
+ <a-form ref="formRef" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" :model="form" class="ant-advanced-rule-form" layout="inline">
32
+ <a-row :getterr="12">
33
+ <a-col :span="20">
34
+ <a-form-item name="templateNumber" label="模板编号">
35
+ <a-input disabled v-model:value="form.templateNumber" placeholder="请输入模板编号" />
36
+ </a-form-item>
37
+ </a-col>
38
+ <a-col :span="20">
39
+ <a-form-item name="templateName" label="模板名称" :rules="[{ required: true, message: '请输入模板名称!' }]">
40
+ <a-input v-model:value="form.templateName" placeholder="请输入模板名称" />
41
+ </a-form-item>
42
+ </a-col>
43
+ <a-col :span="20">
44
+ <a-form-item name="businessType" label="业务类型" :rules="[{ required: true, message: '请选择业务类型!' }]">
45
+ <q-select
46
+ v-model:value="form.businessType"
47
+ :busAccount="busAccount"
48
+ :disabled="currentEditRow.id ? true : false"
49
+ dict-code="srmBusinessType"
50
+ placeholder="请选择业务类型"
51
+ @change="changeBusinessTypeEvent"
52
+ />
53
+ <!-- <a-select v-model:value="form.businessType"></a-select> -->
54
+ </a-form-item>
55
+ </a-col>
56
+ <a-col :span="20">
57
+ <a-form-item label="模板排序">
58
+ <a-input-number style="width: 100%" v-model:value="form.sortOrder" :min="1" placeholder="按模板排序正序和创建时间倒序进行排序" />
59
+ </a-form-item>
60
+ </a-col>
61
+ <a-col :span="20">
62
+ <a-form-item name=" company" label="公司代码">
63
+ <q-select :busAccount="busAccount" v-model:value="form.company" :dict-code="companyCode" placeholder="请选择公司代码" />
64
+ </a-form-item>
65
+ </a-col>
66
+ <a-col :span="20">
67
+ <a-form-item name="purchaseOrg" label="采购组织">
68
+ <q-select :busAccount="busAccount" v-model:value="form.purchaseOrg" :dict-code="purchaseOrganization" placeholder="请选择采购组织" />
69
+ </a-form-item>
70
+ </a-col>
71
+ <a-col :span="20">
72
+ <a-form-item name=" purchaseGroup" label="采购组">
73
+ <q-select v-model:value="form.purchaseGroup" :dict-code="purchaseGroup" placeholder="请选择采购组" />
74
+ </a-form-item>
75
+ </a-col>
76
+ <a-col :span="20">
77
+ <a-form-item name="editLayout">
78
+ <template v-slot:label>
79
+ 编辑布局
80
+ <a-tooltip title="暂business模板支持"> <exclamation-circle-outlined /> </a-tooltip>
81
+ </template>
82
+ <q-select v-model:value="form.editLayout" dict-code="srmLayout" placeholder="请选择布局样式" />
83
+ </a-form-item>
84
+ </a-col>
85
+ <a-col :span="20">
86
+ <a-form-item name="examineLayout">
87
+ <template v-slot:label>
88
+ 查看/审批布局
89
+ <a-tooltip title="暂business模板支持">
90
+ <exclamation-circle-outlined />
91
+ </a-tooltip>
92
+ </template>
93
+ <q-select v-model:value="form.examineLayout" dict-code="srmLayout" placeholder="请选择布局样式" />
94
+ </a-form-item>
95
+ </a-col>
96
+ <a-col :span="20">
97
+ <a-form-item name="templateVersion" label="版本号">
98
+ <a-input disabled v-model:value="form.templateVersion" />
99
+ </a-form-item>
100
+ </a-col>
101
+ <a-col :span="20">
102
+ <a-form-item name="defaultType" label="是否默认">
103
+ <a-switch v-model:checked="form.defaultTypeFlag" @change="changeDefaultType" />
104
+ </a-form-item>
105
+ </a-col>
106
+ <a-col :span="20">
107
+ <a-form-item name="extend" label="扩展">
108
+ <q-code-editor-model v-if="currentStep === 0" :value="form.extend ? form.extend : ''" @handleSureClick="codeEditorSureClick"></q-code-editor-model>
109
+ </a-form-item>
110
+ </a-col>
111
+ </a-row>
112
+ </a-form>
113
+ <!-- <a-spin class="skeleton-wrap" name="skeleton"> 正在从缓存拉取数据</a-spin> -->
114
+ </div>
115
+ <!--step 2-->
116
+ <div v-show="currentStep === 1" class="content-step-trow">
117
+ <div id="groupGrid">
118
+ <vxe-grid
119
+ border
120
+ :row-config="{ useKey: true }"
121
+ auto-resize
122
+ resizable
123
+ row-key
124
+ column-key
125
+ highlight-hover-row
126
+ show-overflow
127
+ ref="groupGrid"
128
+ :height="gridHeight"
129
+ size="mini"
130
+ :checkbox-config="{ highlight: true, trigger: 'row' }"
131
+ :columns="groupColumns"
132
+ :data="groupData"
133
+ :scrollY="{ enabled: false }"
134
+ :edit-config="{ trigger: 'click', mode: 'row' }"
135
+ :edit-rules="groupRules"
136
+ :toolbar-config="{ slots: { buttons: 'toolbar_buttons' }, perfect: true }"
137
+ header-align="center"
138
+ align="center"
139
+ >
140
+ <template #drag_btn_default>
141
+ <span class="drag-btn" style="cursor: move">
142
+ <i class="vxe-icon--menu"></i>
143
+ </span>
144
+ </template>
145
+ <template #drag_btn_header>
146
+ <vxe-tooltip content="按住后可以上下拖动排序" enterable>
147
+ <i class="vxe-icon--question"></i>
148
+ </vxe-tooltip>
149
+ </template>
150
+ <template #group_filter="{ column, $panel }">
151
+ <div>
152
+ <div v-for="(option, index) in column.filters" :key="index">
153
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
154
+ </div>
155
+ </div>
156
+ </template>
157
+ <template #extend_col_render="{ row, column }">
158
+ <q-code-editor-model
159
+ v-if="currentStep === 1"
160
+ :value="row[column.property] ? row[column.property] : ''"
161
+ @handleSureClick="
162
+ (content:customConfigEdits.MapObjectNoneType) => {
163
+ {
164
+ row[column.property] = content
165
+ }
166
+ }
167
+ "
168
+ ></q-code-editor-model>
169
+ </template>
170
+ <template #toolbar_buttons>
171
+ <a-button type="primary" @click="() => groupGridAddEvent()"> 添加 </a-button>
172
+ <a-button @click="() => gridDeleteEvent('groupGridRef')"> 删除</a-button>
173
+ </template>
174
+ </vxe-grid>
175
+ </div>
176
+ <!-- <a-spin class="skeleton-wrap" slot="skeleton">{{ $srmI18n(`${$getLangAccount()}#i18n_alert_iKNSMnMWF_76e1a399`, '正在从缓存拉取数据') }}</a-spin> -->
177
+ </div>
178
+ <!--step 3-->
179
+ <div v-show="currentStep === 2" class="content-step-three">
180
+ <div id="headGrid" @after-enter="headRowDrop">
181
+ <vxe-grid
182
+ border
183
+ auto-resize
184
+ resizable
185
+ column-key
186
+ row-key
187
+ show-header-overflow
188
+ highlight-hover-row
189
+ show-overflow
190
+ ref="headGrid"
191
+ :height="gridHeight"
192
+ size="mini"
193
+ :checkbox-config="{ highlight: true, trigger: 'row' }"
194
+ :columns="headColumns"
195
+ :data="headData"
196
+ :scrollY="{ enabled: false }"
197
+ :edit-config="{ trigger: 'click', mode: 'cell', activeMethod: activeCellMethod }"
198
+ :edit-rules="headRules"
199
+ :sort-config="{ trigger: 'cell', remote: false }"
200
+ @edit-actived="editActivedEvent"
201
+ :toolbar-config="{ slots: { buttons: 'toolbar_buttons' }, perfect: true }"
202
+ align="center"
203
+ header-align="center"
204
+ >
205
+ <template #drag_btn_default>
206
+ <span class="drag-btn" style="cursor: move">
207
+ <i class="vxe-icon--menu"></i>
208
+ </span>
209
+ </template>
210
+ <template #drag_btn_header>
211
+ <vxe-tooltip content="按住后可以上下拖动排序" enterable>
212
+ <i class="vxe-icon--question"></i>
213
+ </vxe-tooltip>
214
+ </template>
215
+
216
+ <template #default_span="{ row, column }">
217
+ <span>{{ row[column.property] }}</span>
218
+ </template>
219
+
220
+ <template #fieldName_edit="{ row, column }">
221
+ <vxe-input v-if="busAccount == '100000'" v-model:value="row[column.property]" />
222
+ <span v-else>{{ row[column.property] }}</span>
223
+ </template>
224
+
225
+ <template #toolbar_buttons>
226
+ <a-button type="primary" @click="() => headGridAddEvent()"> 新增 </a-button>
227
+ <a-button @click="() => gridDeleteEvent('headGridRef')"> 删除</a-button>
228
+ <a-button @click="() => exportHeadEvent('TemplateConfigHeadList', 'head')"> 导出</a-button>
229
+ </template>
230
+ <template #custom_render="{ row }">
231
+ <a @click="() => showDictModal(row)">{{ row.dictCode || '请选择' }}</a>
232
+ <a-icon v-show="row.dictCode" style="margin-left: 6px" type="close-circle" @click="() => removeDictCode(row)"></a-icon>
233
+ </template>
234
+
235
+ <template #switch_render="{ row, column }">
236
+ <vxe-switch :disabled="column.property === 'sys' && busAccount !== '100000'" close-value="0" open-value="1" v-model="row[column.property]"></vxe-switch>
237
+ </template>
238
+
239
+ <template #groupCode_filter="{ column, $panel }">
240
+ <div>
241
+ <div v-for="(option, index) in column.filters" :key="index">
242
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
243
+ </div>
244
+ </div>
245
+ </template>
246
+
247
+ <template #group_filter="{ column, $panel }">
248
+ <div>
249
+ <div v-for="(option, index) in column.filters" :key="index">
250
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
251
+ </div>
252
+ </div>
253
+ </template>
254
+
255
+ <template #fieldName_filter="{ column, $panel }">
256
+ <div>
257
+ <div v-for="(option, index) in column.filters" :key="index">
258
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
259
+ </div>
260
+ </div>
261
+ </template>
262
+
263
+ <template #fieldLabel_filter="{ column, $panel }">
264
+ <div>
265
+ <div v-for="(option, index) in column.filters" :key="index">
266
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
267
+ </div>
268
+ </div>
269
+ </template>
270
+
271
+ <template #extend_col_render="{ row, column }">
272
+ <q-code-editor-model
273
+ v-if="currentStep === 2"
274
+ :value="row[column.property] ? row[column.property] : ''"
275
+ @handleSureClick="
276
+ (content:customConfigEdits.MapObjectNoneType) => {
277
+ {
278
+ row[column.property] = content
279
+ }
280
+ }
281
+ "
282
+ ></q-code-editor-model>
283
+ </template>
284
+
285
+ <!-- <template #calculate_col_render="{ row, column }">
286
+ <q-code-editor-model
287
+ :value="row[column.property] ? row[column.property] : ''"
288
+ @handleSureClick="
289
+ (content:customConfigEdits.MapObjectNoneType) => {
290
+ {
291
+ row[column.property] = content
292
+ }
293
+ }
294
+ "
295
+ ></q-code-editor-model>
296
+ </template> -->
297
+
298
+ <template #summary_render="params">
299
+ <vxe-switch close-value="0" open-value="1" @change="rowChangeSummary(params)" v-model="params.row[params.column.property]"></vxe-switch>
300
+ </template>
301
+ <template #custom_more_property_render="params">
302
+ <a-button @click="showDrawer(params)" type="primary" size="small"> 更多配置</a-button>
303
+ </template>
304
+ </vxe-grid>
305
+ </div>
306
+ <!-- <a-spin class="skeleton-wrap" slot="skeleton">{{ $srmI18n(`${$getLangAccount()}#i18n_alert_iKNSMnMWF_76e1a399`, '正在从缓存拉取数据') }}</a-spin> -->
307
+ <!-- </vue-lazy-component> -->
308
+ </div>
309
+ <!--step 4-->
310
+ <div v-show="currentStep === 3" class="content-step-four">
311
+ <div id="itemGrid" @after-enter="itemRowDrop">
312
+ <vxe-grid
313
+ border
314
+ auto-resize
315
+ resizable
316
+ column-key
317
+ row-key
318
+ show-header-overflow
319
+ highlight-hover-row
320
+ show-overflow
321
+ ref="itemGrid"
322
+ :height="gridHeight"
323
+ size="mini"
324
+ :checkbox-config="{ highlight: true, trigger: 'row' }"
325
+ :columns="itemColumns"
326
+ :data="itemData"
327
+ :scrollY="{ enabled: false }"
328
+ :edit-config="{ trigger: 'click', mode: 'cell', activeMethod: activeCellMethod }"
329
+ :edit-rules="itemRules"
330
+ :sort-config="{ trigger: 'cell', remote: false }"
331
+ @edit-actived="editActivedEvent"
332
+ :toolbar-config="{ slots: { buttons: 'toolbar_buttons' }, perfect: true }"
333
+ align="center"
334
+ header-align="center"
335
+ >
336
+ <template #drag_btn_default>
337
+ <span class="drag-btn" style="cursor: move">
338
+ <i class="vxe-icon--menu"></i>
339
+ </span>
340
+ </template>
341
+ <template #drag_btn_header>
342
+ <vxe-tooltip content="按住后可以上下拖动排序" enterable>
343
+ <i class="vxe-icon--question"></i>
344
+ </vxe-tooltip>
345
+ </template>
346
+
347
+ <template #default_span="{ row, column }">
348
+ <span>{{ row[column.property] }}</span>
349
+ </template>
350
+
351
+ <template #fieldName_edit="{ row, column }">
352
+ <vxe-input v-if="busAccount == '100000'" v-model:value="row[column.property]" />
353
+ <span v-else>{{ row[column.property] }}</span>
354
+ </template>
355
+
356
+ <template #toolbar_buttons>
357
+ <a-button type="primary" @click="() => headGridAddEvent()"> 新增 </a-button>
358
+ <a-button @click="() => gridDeleteEvent('headGridRef')"> 删除</a-button>
359
+ <a-button @click="() => exportHeadEvent('TemplateConfigHeadList', 'head')"> 导出</a-button>
360
+ </template>
361
+ <template #custom_render="{ row }">
362
+ <a @click="() => showDictModal(row)">{{ row.dictCode || '请选择' }}</a>
363
+ <a-icon v-show="row.dictCode" style="margin-left: 6px" type="close-circle" @click="() => removeDictCode(row)"></a-icon>
364
+ </template>
365
+
366
+ <template #switch_render="{ row, column }">
367
+ <vxe-switch :disabled="column.property === 'sys' && busAccount !== '100000'" close-value="0" open-value="1" v-model="row[column.property]"></vxe-switch>
368
+ </template>
369
+
370
+ <template #groupCode_filter="{ column, $panel }">
371
+ <div>
372
+ <div v-for="(option, index) in column.filters" :key="index">
373
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
374
+ </div>
375
+ </div>
376
+ </template>
377
+
378
+ <template #group_filter="{ column, $panel }">
379
+ <div>
380
+ <div v-for="(option, index) in column.filters" :key="index">
381
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
382
+ </div>
383
+ </div>
384
+ </template>
385
+
386
+ <template #fieldName_filter="{ column, $panel }">
387
+ <div>
388
+ <div v-for="(option, index) in column.filters" :key="index">
389
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
390
+ </div>
391
+ </div>
392
+ </template>
393
+
394
+ <template #fieldLabel_filter="{ column, $panel }">
395
+ <div>
396
+ <div v-for="(option, index) in column.filters" :key="index">
397
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
398
+ </div>
399
+ </div>
400
+ </template>
401
+
402
+ <template #extend_col_render="{ row, column }">
403
+ <q-code-editor-model
404
+ v-if="currentStep === 3"
405
+ :value="row[column.property] ? row[column.property] : ''"
406
+ @handleSureClick="
407
+ (content:customConfigEdits.MapObjectNoneType) => {
408
+ {
409
+ row[column.property] = content
410
+ }
411
+ }
412
+ "
413
+ ></q-code-editor-model>
414
+ </template>
415
+
416
+ <!-- <template #calculate_col_render="{ row, column }">
417
+ <q-code-editor-model
418
+ :value="row[column.property] ? row[column.property] : ''"
419
+ @handleSureClick="
420
+ (content:customConfigEdits.MapObjectNoneType) => {
421
+ {
422
+ row[column.property] = content
423
+ }
424
+ }
425
+ "
426
+ ></q-code-editor-model>
427
+ </template> -->
428
+
429
+ <template #summary_render="params">
430
+ <vxe-switch close-value="0" open-value="1" @change="rowChangeSummary(params)" v-model="params.row[params.column.property]"></vxe-switch>
431
+ </template>
432
+ <template #custom_more_property_render="params">
433
+ <a-button @click="showDrawer(params)" type="primary" size="small"> 更多配置</a-button>
434
+ </template>
435
+ </vxe-grid>
436
+ </div>
437
+ <!-- <a-spin class="skeleton-wrap" slot="skeleton">{{ $srmI18n(`${$getLangAccount()}#i18n_alert_iKNSMnMWF_76e1a399`, '正在从缓存拉取数据') }}</a-spin> -->
438
+ <!-- </vue-lazy-component> -->
439
+ </div>
440
+ </div>
441
+
442
+ <div class="page-footer">
443
+ <a-button v-show="currentStep > 0" @click="preSetup"> 上一步</a-button>
444
+ <a-button v-show="currentStep < 3" type="primary" style="margin-left: 6px" @click="currentStepEmit"> 下一步 </a-button>
445
+ <a-button v-show="currentStep == 3" style="margin-left: 6px" type="primary" @click="saveEvent('')">保存</a-button>
446
+ <a-button v-show="currentStep == 3" style="margin-left: 6px" type="primary" @click="saveEvent('publish')"> 生成配置 </a-button>
447
+ <!-- <a-button v-show="currentStep == 3" style="margin-left: 6px" type="primary" @click="tempaltePreview"> 预览</a-button> -->
448
+ <a-button type="default" style="margin-left: 6px" @click="handleReturn"> 返回</a-button>
449
+ </div>
450
+ </a-spin>
451
+ </div>
452
+ <!--新增-->
453
+ <vxe-modal v-model="visible" width="960" title="字段选择" type="confirm" show-footer @confirm="selectedHeadOk">
454
+ <vxe-grid border resizable height="350" row-id="id" size="mini" ref="selectGrid" :data="fieldData" :checkbox-config="{ highlight: true, reserve: true, trigger: 'row' }" :columns="fieldColumns">
455
+ <template #groupCode_filter="{ column, $panel }">
456
+ <div>
457
+ <div v-for="(option, index) in column.filters" :key="index">
458
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
459
+ </div>
460
+ </div>
461
+ </template>
462
+ <template #fieldName_filter="{ column, $panel }">
463
+ <div>
464
+ <div v-for="(option, index) in column.filters" :key="index">
465
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
466
+ </div>
467
+ </div>
468
+ </template>
469
+ <template #fieldLabel_filter="{ column, $panel }">
470
+ <div>
471
+ <div v-for="(option, index) in column.filters" :key="index">
472
+ <input type="type" v-model="option.data" @input="(evnt) => changeFilterEvent(evnt, option, $panel)" />
473
+ </div>
474
+ </div>
475
+ </template>
476
+ </vxe-grid>
477
+ </vxe-modal>
478
+ <!--数据字典弹窗-->
479
+ <AddDictCodeModal ref="dictCodeModal" @ok="fieldSelectOk" />
480
+ <!--更多配置-->
481
+ <a-drawer title="扩展属性" placement="right" :destroyOnClose="true" width="640" :visible="drawerVisible" @close="drawerVisible = false">
482
+ <a-tabs type="card">
483
+ <a-tab-pane class="tab-pane-business-inner" v-for="tab of commonDevelopTabs" :key="tab.field" :tab="tab.title">
484
+ <!-- 开发增强 -->
485
+ <template v-if="tab.field === 'developPlus' && tab.children.length">
486
+ <!-- 代码编辑器类型 -->
487
+ <template v-for="(tabItem, verifyIdx) of tab.children">
488
+ <a-row class="code-editror-flex-row" v-if="codeEditorFields.includes(tabItem.field)" :key="verifyIdx">
489
+ <a-row class="code-editror-flex-row" style="margin-bottom: 8px; margin-top: 8px">
490
+ <span>{{ tabItem.title }}</span
491
+ >:<a-button style="margin-left: 4px" size="small" @click="showSample(tabItem.field)">示例</a-button>
492
+ </a-row>
493
+ <a-row class="code-editror-flex-row">
494
+ <q-code-editor-model
495
+ showLabel="textarea"
496
+ :value="currentDrawer[tabItem.field] ? currentDrawer[tabItem.field] : ''"
497
+ @handleSureClick="
498
+ (content:customConfigEdits.MapObjectNoneType) => {
499
+ {
500
+ currentDrawer[tabItem.field] = content
501
+ }
502
+ }
503
+ "
504
+ ></q-code-editor-model>
505
+ </a-row>
506
+ </a-row>
507
+ <!-- 计算公式 -->
508
+ <a-row class="code-editror-flex-row" v-if="tabItem.field === 'formula'" :key="verifyIdx">
509
+ <a-row class="verify-config code-editror-flex-ro" style="margin-bottom: 8px; margin-top: 8px">
510
+ <span>{{ tabItem.title }}</span
511
+ >:
512
+ <a-button :disabled="currentDrawer.fieldType !== 'computed'" style="margin-left: 4px" size="small" @click="showSample('formula')">示例</a-button>
513
+ </a-row>
514
+ <a-row class="verify-config code-editror-flex-row">
515
+ <q-code-editor-model
516
+ showLabel="textarea"
517
+ :disabled="currentDrawer.fieldType !== 'computed'"
518
+ :value="currentDrawer[tabItem.field] ? currentDrawer[tabItem.field] : ''"
519
+ @handleSureClick="
520
+ (content:customConfigEdits.MapObjectNoneType) => {
521
+ {
522
+ currentDrawer[tabItem.field] = content
523
+ }
524
+ }
525
+ "
526
+ ></q-code-editor-model>
527
+ </a-row>
528
+ </a-row>
529
+ </template>
530
+ </template>
531
+ <!-- 开关类型 -->
532
+ <template v-if="tab.field === 'switchConfig' && tab.children.length">
533
+ <div class="switch-config" v-if="tab.children.length >= 2 && currentStep == 3">
534
+ <template v-for="(tabItem, index) of tab.children">
535
+ <div v-if="switchFields.includes(tabItem.field)" class="switch-config-item" :key="index">
536
+ <div>
537
+ {{ tabItem.title }}
538
+ <a-tooltip v-if="tabItem.helpText" :title="tabItem.helpText">
539
+ <a-icon type="question-circle-o" />
540
+ </a-tooltip>
541
+ </div>
542
+ <q-switch :disabled="tabItem.disabled || (tabItem.field === 'sys' && busAccount !== '100000')" :configData="currentDrawer" v-model="currentDrawer[tabItem.field]" />
543
+ </div>
544
+ <div v-if="tabItem.field === 'fold' && currentStep == 3" class="switch-config-item" :key="index">
545
+ <div>
546
+ {{ tabItem.title }}
547
+ <a-tooltip v-if="tabItem.helpText" :title="tabItem.helpText">
548
+ <a-icon type="question-circle-o" />
549
+ </a-tooltip>
550
+ </div>
551
+ <q-switch :disabled="tabItem.disabled" :configData="currentDrawer" v-model="currentDrawer[tabItem.field]" />
552
+ </div>
553
+ <div v-if="tabItem.field === 'sum'" class="switch-config-item" :key="index">
554
+ <div>{{ tabItem.title }}</div>
555
+ <q-switch @change="changeSummary(currentDrawer)" :configData="currentDrawer" v-model="currentDrawer[tabItem.field]" />
556
+ </div>
557
+ <div v-if="tabItem.field === 'fixType' && currentStep == 3" class="switch-config-item" :key="index">
558
+ <div>{{ tabItem.title }}</div>
559
+ <q-radio @change="changeFixSummary(currentDrawer)" :configData="currentDrawer" v-model="currentDrawer[tabItem.field]" dictCode="fixType" />
560
+ </div>
561
+ </template>
562
+ </div>
563
+ <div class="switch-config" v-else>
564
+ <template>
565
+ <div>暂无配置</div>
566
+ </template>
567
+ </div>
568
+ </template>
569
+ <template v-if="tab.field === 'verifyConfig' && tab.children.length">
570
+ <a-row v-for="(tabItem, verifyIdx) of tab.children" class="verify-config" :key="verifyIdx">
571
+ <template v-if="tabItem.field === 'dataFormat'">
572
+ <a-col :span="6" class="tab-clo-left"> {{ tabItem.title }}: </a-col>
573
+ <a-col :span="18">
574
+ <dataFormatComponent :configData="currentDrawer" :tabInfo="tabItem" @change="(newValue) => (currentDrawer[tabItem.field] = newValue)" :value="currentDrawer[tabItem.field]" />
575
+ </a-col>
576
+ </template>
577
+ <template v-if="tabItem.field === 'regex'">
578
+ <a-col :span="6" class="tab-clo-left"> {{ tabItem.title }}: </a-col>
579
+ <a-col :span="18">
580
+ <regexComponent
581
+ :configData="currentDrawer"
582
+ :tabInfo="tabItem"
583
+ @updateInfo="
584
+ ({ msg }) => {
585
+ currentDrawer.alertMsg = msg
586
+ }
587
+ "
588
+ :value="currentDrawer[tabItem.field]"
589
+ @change="
590
+ ({ msg }) => {
591
+ currentDrawer[tabItem.field] = msg
592
+ }
593
+ "
594
+ />
595
+ </a-col>
596
+ </template>
597
+ <template v-if="tabItem.field === 'alertMsg'">
598
+ <a-col :span="6" class="tab-clo-left"> {{ tabItem.title }}: </a-col>
599
+ <a-col :span="18">
600
+ <a-input
601
+ v-model:value="currentDrawer[tabItem.field]"
602
+ @change="
603
+ () => {
604
+ currentDrawer.alertMsgI18nKey = ''
605
+ }
606
+ "
607
+ />
608
+ </a-col>
609
+ </template>
610
+ <template v-if="tabItem.field === 'alertMsgI18nKey'">
611
+ <a-col :span="6" class="tab-clo-left"> {{ tabItem.title }}: </a-col>
612
+ <a-col :span="18">
613
+ <a-input v-model:value="currentDrawer[tabItem.field]" />
614
+ </a-col>
615
+ </template> </a-row
616
+ ></template>
617
+ </a-tab-pane>
618
+ </a-tabs>
619
+ </a-drawer>
620
+ <!--更多配置实例-->
621
+
622
+ <!-- <codemirror v-if="editorModalFlag" v-model="sampleCode" :options="editorOption"> </codemirror> -->
623
+ <q-code-editor-model
624
+ zIndex="1001"
625
+ :isAllowToOpenMode="true"
626
+ v-if="editorModalFlags"
627
+ :value="sampleCode ? sampleCode : ''"
628
+ @handleSureColse="editorModalFlags = false"
629
+ @handleSureClick="sampleSureClick"
630
+ ></q-code-editor-model>
631
+ <!-- {{ currentRow }} -->
632
+ <!--预览功能-->
633
+ <TempalePreviewModal :currentEditRow="currentRow" v-model:openTure="perviewOpen" />
634
+ </div>
635
+ </template>
636
+
637
+ <script lang="ts">
638
+ //JS引入
639
+ import { defineComponent, reactive, inject, onMounted, toRefs, nextTick, shallowReactive } from 'vue'
640
+ import Sortable from 'sortablejs'
641
+ //组件
642
+ import { message } from '@qqt-product/ui'
643
+ import AddDictCodeModal from '../component/AddDictCodeModal.vue'
644
+ import dataFormatComponent from '../component/dataFormatComponent'
645
+ import regexComponent from '../component/regexComponent'
646
+ import TempalePreviewModal from '../component/TempalePreviewModal.vue'
647
+ //ts
648
+ import * as customConfigEdits from './types'
649
+ import type { VxeTableDefines, VxeGridDefines, VxeGlobalRendererHandles } from 'vxe-table'
650
+ import { useConfigData } from './useConfigData'
651
+ import { useConfigComputed } from './useConfigComputed'
652
+ import { useConfigMethods, useConfigElsAccountMethods, useConigApiMethods } from './useConfigMethods'
653
+ import { useColumnSlots } from './QcustomConfigRender'
654
+ import { EditSample, url } from './useConstant'
655
+ import qqtUtils from '@qqt-product/utils'
656
+ export default defineComponent({
657
+ name: 'QcustomConfigEdit',
658
+ emits: ['handleReturn'],
659
+ components: {
660
+ AddDictCodeModal,
661
+ dataFormatComponent,
662
+ regexComponent,
663
+ TempalePreviewModal,
664
+ },
665
+ props: {
666
+ busAccount: {
667
+ type: String,
668
+ default: '100000',
669
+ },
670
+ currentEditRow: {
671
+ type: Object,
672
+ default() {
673
+ return {
674
+ id: '',
675
+ }
676
+ },
677
+ },
678
+ },
679
+
680
+ setup(props, { emit }) {
681
+ //inject
682
+ const qHttp = inject(customConfigEdits.INJECT_HTTP) as customConfigEdits.HttpClient
683
+ const { currentEditRow, busAccount } = toRefs(props)
684
+ //常量
685
+
686
+ /*
687
+ data
688
+ */
689
+ const {
690
+ switchFields,
691
+ nowFieldType,
692
+ editorModalFlags,
693
+ codeEditorFields,
694
+ drawerVisible,
695
+ currentDictRow,
696
+ dictCodeModal,
697
+ currentDrawer,
698
+ selectGrid,
699
+ formRef,
700
+ groupGrid,
701
+ form,
702
+ confirmLoading,
703
+ currentStep,
704
+ companyCode,
705
+ purchaseOrganization,
706
+ purchaseGroup,
707
+ groupData,
708
+ headGrid,
709
+ fieldTypeOptain,
710
+ fieldData,
711
+ visible,
712
+ currentItemGrid,
713
+ sampleCode,
714
+ itemGrid,
715
+ remoteJsFilePath,
716
+ perviewOpen,
717
+ currentRow,
718
+ } = useConfigData()
719
+
720
+ let { headData, itemData, headRules, itemRules } = useConfigData()
721
+ const { right_header, defaultValue_edit, defaultValue_header, purchaseOperation_defult, purchaseOperation_edit, saleOperation_default, saleOperation_edit, defaultValue_default } =
722
+ useColumnSlots(busAccount)
723
+ const { filterFieldNameMethod, removeDictCode, filterGroupCodeMethod, filterFieldLabelMethod, setGridValeByField, changeFilterEvent } = useConfigMethods()
724
+ const { activeCellMethod } = useConfigElsAccountMethods(busAccount)
725
+ const { handleExportXls } = useConigApiMethods(qHttp)
726
+ const groupColumns = reactive<VxeTableDefines.ColumnOptions[]>([
727
+ {
728
+ width: 60,
729
+ fixed: 'left',
730
+ slots: {
731
+ // 使用插槽模板渲染
732
+ default: 'drag_btn_default',
733
+ header: 'drag_btn_header',
734
+ },
735
+ },
736
+ { type: 'checkbox', width: 40 },
737
+ { field: 'sortOrder', title: '排序', align: 'center', width: 60 },
738
+ {
739
+ field: 'groupName',
740
+ title: '分组名',
741
+ editRender: {
742
+ events: {
743
+ change: (currentRow: object) => {
744
+ setGridValeByField(currentRow, 'groupNameI18nKey', '')
745
+ },
746
+ },
747
+ name: '$input',
748
+ props: { clearable: true },
749
+ },
750
+ },
751
+ { field: 'groupCode', title: '分组编码', editRender: { name: '$input', props: { clearable: true } } },
752
+ {
753
+ field: 'groupType',
754
+ title: '分组类型',
755
+ editRender: {
756
+ name: '$select',
757
+ props: { clearable: true },
758
+ options: [
759
+ { value: 'head', label: '头分组' },
760
+ { value: 'item', label: '行分组' },
761
+ // 主要作用于表行编辑规则,分组编码 gridEditConfig,分组名表行编辑规则
762
+ { value: 'gridEditConfig', label: '表行编辑规则' },
763
+ ],
764
+ },
765
+ },
766
+ { field: 'groupNameI18nKey', title: 'I18nKey' },
767
+ { field: 'extend', title: '扩展', slots: { default: 'extend_col_render' } },
768
+ ])
769
+
770
+ const filterGroupMethod = ({ option, row }: customConfigEdits.GridQConfigUnkownObj) => {
771
+ const groupRowData = groupData.value?.filter((item) => item.groupName.indexOf(option.data) > -1) as customConfigEdits.MapObjectNoneType[]
772
+ return row.groupCode.indexOf(groupRowData[0].groupCode) !== -1
773
+ }
774
+ const headColumns = reactive<VxeTableDefines.ColumnOptions[]>([
775
+ {
776
+ width: 60,
777
+ fixed: 'left',
778
+ slots: {
779
+ default: 'drag_btn_default',
780
+ header: 'drag_btn_header',
781
+ },
782
+ },
783
+ { type: 'checkbox', width: 40, fixed: 'left' },
784
+ { field: 'sortOrder', title: '排序', width: 80, fixed: 'left', editRender: { name: 'input' } },
785
+ {
786
+ field: 'groupCode',
787
+ title: '分组',
788
+ sortable: true,
789
+ width: 120,
790
+ fixed: 'left',
791
+ editRender: { name: '$select', props: { clearable: true }, options: [] },
792
+ filters: [{ data: '' }],
793
+ slots: {
794
+ filter: 'group_filter',
795
+ },
796
+ filterMethod: filterGroupMethod,
797
+ },
798
+ {
799
+ field: 'fieldName',
800
+ title: '字段编码',
801
+ width: 120,
802
+ fixed: 'left',
803
+ editRender: { name: '$input', props: { clearable: true } },
804
+ filters: [{ data: '' }],
805
+ slots: {
806
+ filter: 'fieldName_filter',
807
+ default: 'default_span',
808
+ edit: 'fieldName_edit',
809
+ },
810
+ filterMethod: filterFieldNameMethod,
811
+ },
812
+ {
813
+ field: 'fieldType',
814
+ title: '字段类型',
815
+ fixed: 'left',
816
+ width: 120,
817
+ editRender: {
818
+ name: '$select',
819
+ props: { clearable: true },
820
+ options: [...fieldTypeOptain],
821
+ },
822
+ },
823
+ {
824
+ field: 'fieldLabel',
825
+ title: '字段默认名称',
826
+ width: 120,
827
+ fixed: 'left',
828
+ editRender: {
829
+ events: {
830
+ change: (currentRow) => {
831
+ setGridValeByField(currentRow, 'fieldLabelI18nKey', '')
832
+ },
833
+ },
834
+ name: '$input',
835
+ props: { clearable: true },
836
+ },
837
+ filters: [{ data: '' }],
838
+ slots: {
839
+ filter: 'fieldLabel_filter',
840
+ },
841
+ filterMethod: filterFieldLabelMethod,
842
+ },
843
+ {
844
+ field: 'purchaseOperation',
845
+ title: '采购可操作',
846
+ width: 200,
847
+ editRender: {
848
+ enabled: true,
849
+ },
850
+ slots: {
851
+ default: purchaseOperation_defult,
852
+ edit: purchaseOperation_edit,
853
+ },
854
+ },
855
+ {
856
+ field: 'saleOperation',
857
+ title: '供应商可操作',
858
+ width: 200,
859
+ editRender: {
860
+ enabled: true,
861
+ },
862
+ slots: {
863
+ default: saleOperation_default,
864
+ edit: saleOperation_edit,
865
+ },
866
+ },
867
+ {
868
+ field: 'defaultValue',
869
+ width: 150,
870
+ editRender: {
871
+ enabled: true,
872
+ },
873
+ slots: {
874
+ default: defaultValue_default,
875
+ edit: defaultValue_edit,
876
+ header: defaultValue_header,
877
+ },
878
+ },
879
+ { field: 'dictCode', title: '数据字典编码', width: 180, slots: { default: 'custom_render' } },
880
+ { field: 'required', title: '是否必填', width: 120, slots: { default: 'switch_render' } },
881
+ { field: 'sys', title: '是否系统配置', width: 120, slots: { default: 'switch_render' } },
882
+ {
883
+ field: 'audit',
884
+ title: '是否审批页显示',
885
+ width: 120,
886
+ slots: { default: 'switch_render' },
887
+ },
888
+ {
889
+ field: 'mobile',
890
+ title: '移动端显示',
891
+ width: 120,
892
+ slots: { default: 'switch_render' },
893
+ },
894
+ {
895
+ field: 'sum',
896
+ title: '是否汇总',
897
+ width: 120,
898
+ slots: { default: 'summary_render' },
899
+ },
900
+ { field: 'helpText', title: '帮助说明', width: 120, editRender: { name: '$input', props: { clearable: true } } },
901
+ { field: 'fieldLabelI18nKey', title: '字段名称I18nKey', width: 200 },
902
+
903
+ {
904
+ width: 100,
905
+ fixed: 'right',
906
+ slots: {
907
+ default: 'custom_more_property_render',
908
+ header: right_header,
909
+ },
910
+ },
911
+ ])
912
+
913
+ const fieldColumns = reactive<VxeTableDefines.ColumnOptions[]>([
914
+ { type: 'checkbox', width: 40 },
915
+ { type: 'seq', width: 60 },
916
+ {
917
+ field: 'groupCode',
918
+ title: '分组编码',
919
+ filters: [{ data: '' }],
920
+ slots: {
921
+ filter: 'groupCode_filter',
922
+ },
923
+ filterMethod: filterGroupCodeMethod,
924
+ },
925
+ {
926
+ field: 'fieldName',
927
+ title: '字段名称',
928
+ filters: [{ data: '' }],
929
+ slots: {
930
+ filter: 'fieldName_filter',
931
+ },
932
+ filterMethod: filterFieldNameMethod,
933
+ },
934
+ {
935
+ field: 'fieldLabel',
936
+ title: '字段描述',
937
+ filters: [{ data: '' }],
938
+ slots: {
939
+ filter: 'fieldLabel_filter',
940
+ },
941
+ filterMethod: filterFieldLabelMethod,
942
+ },
943
+ ])
944
+ const itemColumns = reactive<VxeTableDefines.ColumnOptions[]>([
945
+ {
946
+ width: 60,
947
+ fixed: 'left',
948
+ slots: {
949
+ default: 'drag_btn_default',
950
+ header: 'drag_btn_header',
951
+ },
952
+ },
953
+ { type: 'checkbox', width: 40, fixed: 'left' },
954
+ { field: 'sortOrder', title: '排序', width: 80, fixed: 'left', editRender: { name: 'input' } },
955
+ {
956
+ field: 'groupCode',
957
+ title: '分组',
958
+ sortable: true,
959
+ width: 120,
960
+ fixed: 'left',
961
+ editRender: { name: '$select', props: { clearable: true }, options: [] },
962
+ filters: [{ data: '' }],
963
+ slots: {
964
+ filter: 'group_filter',
965
+ },
966
+ filterMethod: filterGroupMethod,
967
+ },
968
+ {
969
+ field: 'fieldName',
970
+ title: '字段名',
971
+ width: 120,
972
+ fixed: 'left',
973
+ editRender: { enabled: true },
974
+ slots: {
975
+ default: 'default_span',
976
+ edit: 'fieldName_edit',
977
+ },
978
+ },
979
+ {
980
+ field: 'fieldLabel',
981
+ title: '字段描述',
982
+ width: 120,
983
+ fixed: 'left',
984
+ editRender: {
985
+ events: {
986
+ change: (currentRow) => {
987
+ setGridValeByField(currentRow, 'fieldLabelI18nKey', '')
988
+ },
989
+ },
990
+ name: '$input',
991
+ props: { clearable: true },
992
+ },
993
+ },
994
+ {
995
+ field: 'fieldType',
996
+ title: '字段类型',
997
+ fixed: 'left',
998
+ width: 120,
999
+ editRender: {
1000
+ name: '$select',
1001
+ props: { clearable: true },
1002
+ options: [...fieldTypeOptain],
1003
+ },
1004
+ },
1005
+ // {
1006
+ // field: 'fieldLabel',
1007
+ // title: '字段默认名称',
1008
+ // width: 120,
1009
+ // fixed: 'left',
1010
+ // editRender: {
1011
+ // events: {
1012
+ // change: (currentRow) => {
1013
+ // setGridValeByField(currentRow, 'fieldLabelI18nKey', '')
1014
+ // },
1015
+ // },
1016
+ // name: '$input',
1017
+ // props: { clearable: true },
1018
+ // },
1019
+ // filters: [{ data: '' }],
1020
+ // slots: {
1021
+ // filter: 'fieldLabel_filter',
1022
+ // },
1023
+ // filterMethod: filterFieldLabelMethod,
1024
+ // },
1025
+ {
1026
+ field: 'purchaseOperation',
1027
+ title: '采购可操作',
1028
+ width: 200,
1029
+ editRender: {
1030
+ enabled: true,
1031
+ },
1032
+ slots: {
1033
+ default: purchaseOperation_defult,
1034
+ edit: purchaseOperation_edit,
1035
+ },
1036
+ },
1037
+ {
1038
+ field: 'saleOperation',
1039
+ title: '供应商可操作',
1040
+ width: 200,
1041
+ editRender: {
1042
+ enabled: true,
1043
+ },
1044
+ slots: {
1045
+ default: saleOperation_default,
1046
+ edit: saleOperation_edit,
1047
+ },
1048
+ },
1049
+ {
1050
+ field: 'defaultValue',
1051
+ width: 150,
1052
+ editRender: {
1053
+ enabled: true,
1054
+ },
1055
+ slots: {
1056
+ default: defaultValue_default,
1057
+ edit: defaultValue_edit,
1058
+ header: defaultValue_header,
1059
+ },
1060
+ },
1061
+ { field: 'dictCode', title: '数据字典编码', width: 180, slots: { default: 'custom_render' } },
1062
+ { field: 'columnWidth', title: '宽度', width: 120, editRender: { name: '$input', props: { clearable: true } } },
1063
+ {
1064
+ field: 'columnAlign',
1065
+ title: '对齐方式',
1066
+ width: 120,
1067
+ editRender: {
1068
+ name: '$select',
1069
+ props: { clearable: true },
1070
+ options: [
1071
+ { value: 'center', label: '居中对齐' },
1072
+ { value: 'left', label: '左对齐' },
1073
+ { value: 'right', label: '右对齐' },
1074
+ ],
1075
+ },
1076
+ },
1077
+ { field: 'required', title: '是否必填', width: 120, slots: { default: 'switch_render' } },
1078
+ { field: 'sys', title: '是否系统配置', width: 120, slots: { default: 'switch_render' } },
1079
+ {
1080
+ field: 'audit',
1081
+ title: '是否审批页显示',
1082
+ width: 120,
1083
+ slots: { default: 'switch_render' },
1084
+ },
1085
+ {
1086
+ field: 'mobile',
1087
+ title: '移动端显示',
1088
+ width: 120,
1089
+ slots: { default: 'switch_render' },
1090
+ },
1091
+ {
1092
+ field: 'sum',
1093
+ title: '是否汇总',
1094
+ width: 120,
1095
+ slots: { default: 'summary_render' },
1096
+ },
1097
+ { field: 'helpText', title: '帮助说明', width: 120, editRender: { name: '$input', props: { clearable: true } } },
1098
+ { field: 'fieldLabelI18nKey', title: '字段名称I18nKey', width: 200 },
1099
+
1100
+ {
1101
+ width: 100,
1102
+ fixed: 'right',
1103
+ slots: {
1104
+ default: 'custom_more_property_render',
1105
+ header: right_header,
1106
+ },
1107
+ },
1108
+ ])
1109
+
1110
+ //computed
1111
+ const { showBusinessTips, gridHeight, commonDevelopTabs } = useConfigComputed()
1112
+ /*
1113
+ method
1114
+ */
1115
+
1116
+ const currentStepFrist = () => {
1117
+ formRef.value.validate().then(() => {
1118
+ currentStep.value++
1119
+ nextTick(() => {
1120
+ rowDrop(groupData)
1121
+ })
1122
+ })
1123
+ }
1124
+ const currentStepSecond = () => {
1125
+ let { fullData } = groupGrid.value.getTableData()
1126
+ if (!fullData.length) {
1127
+ message.warning('请添加分组!')
1128
+ return
1129
+ }
1130
+ groupGrid.value.validate(fullData, (valid: customConfigEdits.MapObjectNoneType) => {
1131
+ if (!valid) {
1132
+ let headGroupList = fullData.filter((item: customConfigEdits.MapObjectNoneType) => {
1133
+ return item.groupType == 'head'
1134
+ })
1135
+ let itemGroupList = fullData.filter((item: customConfigEdits.MapObjectNoneType) => {
1136
+ return item.groupType == 'item'
1137
+ })
1138
+ let headGroupOpts = headGroupList.map((item: customConfigEdits.MapObjectNoneType) => {
1139
+ return {
1140
+ value: item.groupCode,
1141
+ label: item.groupName,
1142
+ }
1143
+ })
1144
+ let itemGroupOpts = itemGroupList.map((item: customConfigEdits.MapObjectNoneType) => {
1145
+ return {
1146
+ value: item.groupCode,
1147
+ label: item.groupName,
1148
+ }
1149
+ })
1150
+ if (headColumns[3].editRender) headColumns[3].editRender.options = headGroupOpts
1151
+ if (itemColumns[3].editRender) itemColumns[3].editRender.options = itemGroupOpts
1152
+ currentStep.value++
1153
+ }
1154
+ })
1155
+ }
1156
+ const currentStepThird = () => {
1157
+ // console.log(1)
1158
+
1159
+ let { fullData } = headGrid.value.getTableData()
1160
+ // if (!fullData.length) {
1161
+ // this.$message.warning(this.$srmI18n(`${this.$getLangAccount()}#i18n_title_pleaseAddHeaderConfiguration`, '请添加表头配置!'))
1162
+ // return
1163
+ // }
1164
+ headGrid.value.validate(fullData, (valid: customConfigEdits.MapObjectNoneType) => {
1165
+ if (!valid) {
1166
+ currentStep.value++
1167
+ }
1168
+ })
1169
+ }
1170
+ const currentMethodArry = [currentStepFrist, currentStepSecond, currentStepThird]
1171
+
1172
+ const validateCode = (rule: customConfigEdits.MapObjectNoneType) => {
1173
+ const xGrid = groupGrid
1174
+ let { fullData } = xGrid.value.getTableData()
1175
+ let { cellValue, row } = rule
1176
+ let rowIndex = row.sortOrder - 1
1177
+ let res: Error | null = null
1178
+ if (fullData.length > 0) {
1179
+ let fullNew = fullData.map((rs: customConfigEdits.MapObjectNoneType) => rs.groupCode)
1180
+ fullNew.splice(rowIndex, 1)
1181
+ let rep = fullNew.find((t: customConfigEdits.MapObjectNoneType) => t == cellValue)
1182
+ if (rep) {
1183
+ res = new Error('分组编码不能填写相同的值!')
1184
+ }
1185
+ }
1186
+ return res
1187
+ }
1188
+ const groupRules = shallowReactive<customConfigEdits.MapObjectNoneType>({
1189
+ sortOrder: [{ required: true, message: '请输入排序' }],
1190
+ groupName: [{ required: true, message: '请输入分组名称' }],
1191
+ groupCode: [{ required: true, message: '请输入分组编码' }, { validator: validateCode }],
1192
+ groupType: [{ required: true, message: '请选择分组类型' }],
1193
+ })
1194
+ const alertClose = () => {
1195
+ sessionStorage.setItem('businessTipsShow', '0')
1196
+ }
1197
+ const codeEditorSureClick = (contents: string) => {
1198
+ form.extend = contents
1199
+ }
1200
+ const changeBusinessTypeEvent = (type: string) => {
1201
+ qHttp
1202
+ .get({
1203
+ url: '/template/templateHead/querySysByBusinessType',
1204
+ params: {
1205
+ businessType: type,
1206
+ },
1207
+ })
1208
+ .then((res) => {
1209
+ // console.log(1)
1210
+ if (res.success) {
1211
+ let { templateGroupList, templateConfigHeadList, templateConfigItemList } = res.result
1212
+ groupData.value = templateGroupList
1213
+ headData.value = templateConfigHeadList
1214
+ itemData.value = templateConfigItemList
1215
+ }
1216
+ })
1217
+ }
1218
+ const changeDefaultType = (flag: boolean) => {
1219
+ form.defaultTypeFlag = flag
1220
+ }
1221
+
1222
+ const ajaxFindDictItems = (postData: object) => {
1223
+ return new Promise((resolve, reject) => {
1224
+ qHttp
1225
+ .post({
1226
+ url: '/base/dict/findDictItems',
1227
+ // params: {},
1228
+ data: postData,
1229
+ })
1230
+ .then((res) => {
1231
+ if (res.success) {
1232
+ resolve(res.result)
1233
+ } else {
1234
+ reject(res)
1235
+ }
1236
+ })
1237
+ .catch((err) => {
1238
+ reject(err)
1239
+ })
1240
+ })
1241
+ }
1242
+
1243
+ const editActivedEvent = ({ row, column }: VxeGridDefines.EditActivedEventParams) => {
1244
+ if (column.property == 'defaultValue') {
1245
+ if ((row.fieldType == 'select' || row.fieldType == 'multiple') && row.dictCode) {
1246
+ let postData = {
1247
+ busAccount: busAccount,
1248
+ dictCode: row.dictCode,
1249
+ }
1250
+ ajaxFindDictItems(postData).then((res: any) => {
1251
+ if (res.success) {
1252
+ let options = res.result.map((item: customConfigEdits.MapObjectNoneType) => {
1253
+ return {
1254
+ value: item.value,
1255
+ label: item.title,
1256
+ }
1257
+ })
1258
+ // that.defaultValueOpts = options
1259
+ row.defaultValueOpts = options
1260
+ }
1261
+ })
1262
+ }
1263
+ }
1264
+ }
1265
+
1266
+ const getDefaultOptions = (row: customConfigEdits.MapObjectNoneType) => {
1267
+ return new Promise<customConfigEdits.MapObjectNoneType>((resolve) => {
1268
+ let postData = {
1269
+ busAccount: busAccount.value,
1270
+ dictCode: row.dictCode,
1271
+ }
1272
+ ajaxFindDictItems(postData).then((res: any) => {
1273
+ if (res.success) {
1274
+ resolve(res.result)
1275
+ }
1276
+ })
1277
+ })
1278
+ }
1279
+
1280
+ const defaultAddOpts = async (arr: customConfigEdits.MapObjectNoneType[]) => {
1281
+ for (const row of arr) {
1282
+ if ((row.fieldType == 'select' || row.fieldType == 'multiple') && row.dictCode) {
1283
+ let options = await getDefaultOptions(row)
1284
+ options = options.map((item: customConfigEdits.MapObjectNoneType) => {
1285
+ return {
1286
+ value: item.value,
1287
+ label: item.title,
1288
+ }
1289
+ })
1290
+ row.defaultValueOpts = options
1291
+ }
1292
+ }
1293
+ }
1294
+
1295
+ const queryDetail = () => {
1296
+ qHttp
1297
+ .get({
1298
+ url: url.detail,
1299
+ params: {
1300
+ id: currentEditRow.value.id,
1301
+ },
1302
+ })
1303
+ .then((res: customConfigEdits.MapObjectNoneType) => {
1304
+ if (res.success) {
1305
+ currentRow.value = res.result
1306
+ let { templateGroupList, templateConfigHeadList, templateConfigItemList } = res.result
1307
+ Object.assign(form, res.result)
1308
+ groupData.value = templateGroupList
1309
+ let headDataTemp = templateConfigHeadList.map((item: customConfigEdits.MapObjectNoneType) => {
1310
+ if (item.mobile) {
1311
+ item.mobile += ''
1312
+ } else {
1313
+ item.mobile = '1'
1314
+ }
1315
+ return item
1316
+ })
1317
+ headData.value = headDataTemp
1318
+
1319
+ let itemDataTemp = templateConfigItemList.map((item: customConfigEdits.MapObjectNoneType) => {
1320
+ if (item.mobile) {
1321
+ item.mobile += ''
1322
+ } else {
1323
+ item.mobile = '1'
1324
+ }
1325
+ return item
1326
+ })
1327
+ itemData.value = itemDataTemp
1328
+ nextTick(() => {
1329
+ defaultAddOpts(headData.value as customConfigEdits.MapObjectNoneType[])
1330
+ defaultAddOpts(itemData.value as customConfigEdits.MapObjectNoneType[])
1331
+ })
1332
+ }
1333
+ })
1334
+ .finally(() => {
1335
+ confirmLoading.value = false
1336
+ })
1337
+ }
1338
+ const preSetup = () => {
1339
+ currentStep.value--
1340
+ }
1341
+ const currentStepEmit = () => {
1342
+ currentMethodArry[currentStep.value]()
1343
+ }
1344
+ const rowDrop = (currentData: customConfigEdits.MapObjectNoneType) => {
1345
+ const $table = groupGrid.value
1346
+ Sortable.create($table.$el.querySelector('.body--wrapper>.vxe-table--body tbody'), {
1347
+ handle: '.drag-btn',
1348
+ onEnd: (sortableEvent: customConfigEdits.MapObjectNoneType) => {
1349
+ const newIndex = sortableEvent.newIndex as number
1350
+ const oldIndex = sortableEvent.oldIndex as number
1351
+ const currRow = currentData.value.splice(oldIndex, 1)[0]
1352
+ currentData.value.splice(newIndex, 0, currRow)
1353
+ },
1354
+ })
1355
+ }
1356
+
1357
+ const groupGridAddEvent = () => {
1358
+ let { fullData } = groupGrid.value.getTableData()
1359
+ let length = fullData.length
1360
+ groupGrid.value.insertAt({ sortOrder: length + 1, groupType: 'head' }, -1)
1361
+ }
1362
+
1363
+ const getAllHeadDataPromiss = () => {
1364
+ if (form.businessType === 'costForm') {
1365
+ let url = '/cost/costField/queryAll'
1366
+ return qHttp.get({
1367
+ url,
1368
+ })
1369
+ } else {
1370
+ let url = '/template/templateHead/queryHeadFieldsByBusinessType'
1371
+ return qHttp.get({
1372
+ url,
1373
+ params: {
1374
+ businessType: form.businessType,
1375
+ },
1376
+ })
1377
+ }
1378
+ }
1379
+
1380
+ const headGridAddEvent = () => {
1381
+ let { fullData } = headGrid.value.getTableData()
1382
+ if (busAccount.value == '100000') {
1383
+ let length = fullData.length
1384
+ headGrid.value.insertAt({ sortOrder: length + 1, groupType: 'head' }, -1)
1385
+ return
1386
+ }
1387
+
1388
+ let fieldNameList = fullData.map((item: customConfigEdits.MapObjectNoneType) => {
1389
+ return item.fieldName + '_' + item.groupCode
1390
+ })
1391
+ getAllHeadDataPromiss().then((res) => {
1392
+ if (res.success) {
1393
+ if (form.businessType === 'costForm') {
1394
+ fieldData.value = res.result
1395
+ visible.value = true
1396
+ } else {
1397
+ let fieldDatas = res.result.templateConfigHeadList.filter((item: customConfigEdits.MapObjectNoneType) => {
1398
+ return !fieldNameList.includes(item.fieldName + '_' + item.groupCode)
1399
+ })
1400
+ fieldData.value = fieldDatas
1401
+ visible.value = true
1402
+ }
1403
+ } else {
1404
+ message.warning(res.message)
1405
+ }
1406
+ })
1407
+ }
1408
+
1409
+ const gridDeleteEvent = (type: string) => {
1410
+ const CurentGridRef = getCurentGridRef(type)
1411
+ let checkboxRecords = CurentGridRef.value.getCheckboxRecords()
1412
+ if (type === 'headGridRef' || type === 'itemGridRef') {
1413
+ let flag = checkboxRecords.some((n: customConfigEdits.GridQConfigUnkownObj) => n.sys === '1')
1414
+ if (flag) {
1415
+ message.error('系统配置字段不允许删除')
1416
+ return
1417
+ }
1418
+ }
1419
+ if (!checkboxRecords.length) {
1420
+ message.error('请选择数据!')
1421
+ return
1422
+ }
1423
+ CurentGridRef.value.removeCheckboxRow(checkboxRecords)
1424
+ resetSortOrder(type)
1425
+ // this.$refs[grid].removeCheckboxRow(checkboxRecords)
1426
+ }
1427
+
1428
+ const handleEpritXisCallBack = () => {
1429
+ confirmLoading.value = !confirmLoading.value
1430
+ }
1431
+
1432
+ const exportHeadEvent = (type: string, sets: string) => {
1433
+ if (!currentEditRow.value.id) {
1434
+ message.warning('请先保存模板配置')
1435
+ return
1436
+ }
1437
+ // confirmLoading.value = true
1438
+ handleExportXls('表头配置', currentEditRow.value.id, sets, type, '/template/templateHead/exportTemplateColumnConfig', handleEpritXisCallBack)
1439
+ }
1440
+
1441
+ let getCurentGridRef = (type: string) => {
1442
+ const curGridRefObj: customConfigEdits.GridQConfigEditRef = { groupGridRef: groupGrid, headGridRef: headGrid }
1443
+ return curGridRefObj[type]
1444
+ }
1445
+ const resetSortOrder = (type: string) => {
1446
+ const CurentGridRef = getCurentGridRef(type)
1447
+ let { fullData } = CurentGridRef.value.getTableData()
1448
+ fullData.forEach((item: customConfigEdits.GridQConfigUnkownObj, index: number) => {
1449
+ item.sortOrder = index + 1
1450
+ })
1451
+ }
1452
+ const selectedHeadOk = () => {
1453
+ let checkboxRecords = selectGrid.value.getCheckboxRecords()
1454
+ if (!checkboxRecords.length) {
1455
+ message.warning('请选择数据!')
1456
+ return
1457
+ }
1458
+
1459
+ let { fullData } = headGrid.value.getTableData()
1460
+ let length = fullData.length
1461
+ checkboxRecords.forEach((item: customConfigEdits.MapObjectNoneType, index: customConfigEdits.MapObjectNoneType) => {
1462
+ item.sortOrder = length + index + 1
1463
+ })
1464
+ headGrid.value?.insertAt(checkboxRecords, -1)
1465
+
1466
+ visible.value = false
1467
+ }
1468
+
1469
+ const setDisabledByData = (field: string, value: boolean) => {
1470
+ commonDevelopTabs.value.forEach((rs) => {
1471
+ let d = rs.children.find((it: customConfigEdits.MapObjectNoneType) => it.field == field)
1472
+ if (d) {
1473
+ d.disabled = value
1474
+ }
1475
+ })
1476
+ }
1477
+
1478
+ const handleBefore = (row: customConfigEdits.MapObjectNoneType) => {
1479
+ // 字段类型为文本,文本域,数字,小数,日期,且为不必填时,支持折叠
1480
+ let limitField = ['input', 'number', 'float', 'date', 'textArea']
1481
+ if (limitField.includes(row.fieldType) && row.required == '0') {
1482
+ setDisabledByData('fold', false)
1483
+ } else {
1484
+ // 重置
1485
+ setDisabledByData('fold', true)
1486
+ if (currentDrawer.value.fold) {
1487
+ currentDrawer.value.fold = '0'
1488
+ }
1489
+ }
1490
+ }
1491
+
1492
+ const rowChangeSummary = (currentDrawer: customConfigEdits.MapObjectNoneType) => {
1493
+ // 同一个分组只能有一个汇总字段
1494
+ handleBefore(currentDrawer.row)
1495
+ // debugger
1496
+ // this.currentItemGrid = currentDrawer // 当前所有列
1497
+ let itemGridData = currentDrawer.data
1498
+ let rowIndex = currentDrawer.$rowIndex
1499
+ nextTick(() => {
1500
+ itemGridData.forEach((item: customConfigEdits.MapObjectNoneType, index: number) => {
1501
+ if (item.groupCode === currentDrawer.row.groupCode && rowIndex !== index) {
1502
+ item.sum = 0
1503
+ // this.$forceUpdate()
1504
+ }
1505
+ })
1506
+ })
1507
+ }
1508
+
1509
+ const changeSummary = (currentDrawer: customConfigEdits.MapObjectNoneType) => {
1510
+ // 同一个分组只能有一个汇总字段
1511
+
1512
+ let itemGridData = currentItemGrid.value.data
1513
+ let rowIndex = currentItemGrid.value.$rowIndex
1514
+ nextTick(() => {
1515
+ itemGridData.forEach((item: customConfigEdits.MapObjectNoneType, index: customConfigEdits.MapObjectNoneType) => {
1516
+ if (item.groupCode === currentDrawer.groupCode && rowIndex !== index) {
1517
+ item.sum = 0
1518
+ // this.$forceUpdate()
1519
+ // getCurrentInstance()?.$forceUpdate()
1520
+ }
1521
+ })
1522
+ })
1523
+ }
1524
+
1525
+ const showDictModal = (row: customConfigEdits.MapObjectNoneType) => {
1526
+ currentDictRow.value = row
1527
+ // alert(1)
1528
+ console.log(dictCodeModal)
1529
+ dictCodeModal.value.open()
1530
+ }
1531
+ const headRowDrop = () => {
1532
+ console.log(1)
1533
+ }
1534
+
1535
+ const itemRowDrop = () => {
1536
+ console.log(1)
1537
+ }
1538
+
1539
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1540
+ const showDrawer = (param: any) => {
1541
+ handleBefore(param.row)
1542
+ currentDrawer.value = param.row
1543
+ currentItemGrid.value = param // 当前所有列
1544
+ drawerVisible.value = true
1545
+ }
1546
+
1547
+ const fieldSelectOk = (data: customConfigEdits.MapObjectNoneType) => (currentDictRow.value.dictCode = data.dictCode)
1548
+
1549
+ const showSample = (field: string) => {
1550
+ nowFieldType.value = field
1551
+ if (field === 'callback') {
1552
+ sampleCode.value = currentStep.value === 2 ? EditSample.bindFunctionHead : EditSample.bindFunctionRow
1553
+ } else if (field === 'initFunction') {
1554
+ sampleCode.value = currentStep.value === 2 ? EditSample.initFunctionHead : EditSample.initFunctionRow
1555
+ } else if (field === 'extend') {
1556
+ sampleCode.value = currentStep.value === 2 ? EditSample.extendHead : EditSample.extendRow
1557
+ } else if (field === 'fieldValidator') {
1558
+ sampleCode.value = currentStep.value === 2 ? EditSample.fieldValidatorHead : EditSample.fieldValidatorRow
1559
+ } else if (field === 'formula') {
1560
+ sampleCode.value = currentStep.value === 2 ? EditSample.formulaHead : EditSample.formulaRow
1561
+ }
1562
+ editorModalFlags.value = true
1563
+ }
1564
+ const sampleSureClick = (coValue: string) => {
1565
+ let warnTips = false
1566
+ sampleCode.value = coValue
1567
+ if (nowFieldType.value === 'callback' && !currentDrawer.value.callback) {
1568
+ currentDrawer.value.callback = coValue
1569
+ warnTips = true
1570
+ } else if (nowFieldType.value === 'initFunction' && !currentDrawer.value.initFunction) {
1571
+ currentDrawer.value.initFunction = coValue
1572
+ warnTips = true
1573
+ } else if (nowFieldType.value === 'extend' && !currentDrawer.value.extend) {
1574
+ currentDrawer.value.extend = coValue
1575
+ warnTips = true
1576
+ } else if (nowFieldType.value === 'fieldValidator' && !currentDrawer.value.fieldValidator) {
1577
+ currentDrawer.value.fieldValidator = coValue
1578
+ warnTips = true
1579
+ } else if (nowFieldType.value === 'formula' && !currentDrawer.value.formula) {
1580
+ currentDrawer.value.formula = coValue
1581
+ warnTips = true
1582
+ }
1583
+ if (!warnTips) {
1584
+ message.warning('函数已存在,不可导入示例')
1585
+ return
1586
+ }
1587
+ editorModalFlags.value = false
1588
+ }
1589
+
1590
+ const changeFixSummary = (currentDrawer: customConfigEdits.MapObjectNoneType) => {
1591
+ // 同一个分组只能有一个汇总字段
1592
+ let itemGridData = currentItemGrid.value.data
1593
+ let rowIndex = currentItemGrid.value.$rowIndex //当前修改的索引
1594
+ let temArryItemGridData = [...itemGridData]
1595
+ temArryItemGridData.reverse()
1596
+ let resetIndex = temArryItemGridData.findIndex((val) => val.fixType)
1597
+ let lastFrozenIndex = resetIndex > -1 ? itemGridData.length - resetIndex - 1 : resetIndex //最好一个设置了fixtype的索引
1598
+ // this.curLastFrozenIndex = lastFrozenIndex //打开时的最后一个设置fixtype的
1599
+ if (lastFrozenIndex > -1) {
1600
+ if (lastFrozenIndex <= rowIndex) {
1601
+ for (let [idx, v] of itemGridData.entries()) {
1602
+ if (idx <= rowIndex) {
1603
+ v.fixType = itemGridData[rowIndex].fixType
1604
+ } else {
1605
+ break
1606
+ }
1607
+ }
1608
+ }
1609
+ }
1610
+ nextTick(() => {
1611
+ itemGridData.forEach((item: customConfigEdits.MapObjectNoneType, index: customConfigEdits.MapObjectNoneType) => {
1612
+ if (item.groupCode === currentDrawer.groupCode && rowIndex !== index) {
1613
+ item.sum = 0
1614
+ // this.$forceUpdate()
1615
+ }
1616
+ })
1617
+ })
1618
+ }
1619
+
1620
+ const reorderData = (gird: customConfigEdits.MapObjectNoneType) => {
1621
+ let tableData = gird.getTableData().fullData
1622
+ tableData = qqtUtils
1623
+ .sortBy(tableData, function (item: customConfigEdits.MapObjectNoneType) {
1624
+ return parseInt(item.sortOrder)
1625
+ })
1626
+ .map((item: customConfigEdits.MapObjectNoneType, index: number) => {
1627
+ item.sortOrder = index + 1
1628
+ return item
1629
+ })
1630
+ gird.loadData(tableData)
1631
+ }
1632
+
1633
+ const reorder = () => {
1634
+ let headGridRef = headGrid.value
1635
+ let itemGridRef = itemGrid.value
1636
+ reorderData(headGridRef)
1637
+ reorderData(itemGridRef)
1638
+ }
1639
+
1640
+ const formatByType = (data: customConfigEdits.MapObjectNoneType, type: string) => {
1641
+ data.forEach((rs: customConfigEdits.MapObjectNoneType) => {
1642
+ if (rs.fieldType === type && rs.defaultValue instanceof Array) {
1643
+ rs.defaultValue = rs.defaultValue.join(',')
1644
+ }
1645
+ })
1646
+ }
1647
+
1648
+ const postData = (type?: string) => {
1649
+ let curl = url.add
1650
+ if (currentEditRow.value && currentEditRow.value.id) {
1651
+ curl = url.edit
1652
+ }
1653
+
1654
+ if (type == 'publish') {
1655
+ curl = url.publish
1656
+ }
1657
+ // console.log('headGrid', headGrid)
1658
+ // 根据序号重新排序
1659
+ reorder()
1660
+ let params = Object.assign({ templateGroupList: [], templateConfigHeadList: [], templateConfigItemList: [] }, form)
1661
+
1662
+ // 处理多选数据格式
1663
+ let templateConfigHeadList = headGrid.value.getTableData().fullData
1664
+
1665
+ let templateConfigItemList = itemGrid.value.getTableData().fullData
1666
+
1667
+ formatByType(templateConfigItemList, 'multiple')
1668
+ formatByType(templateConfigHeadList, 'multiple')
1669
+
1670
+ params.templateGroupList = groupGrid.value.getTableData().fullData
1671
+ params.templateConfigHeadList = templateConfigHeadList
1672
+ params.templateConfigItemList = templateConfigItemList
1673
+
1674
+ confirmLoading.value = true
1675
+ qHttp.post({ url: curl, data: params }).then((res) => {
1676
+ if (res.success) {
1677
+ form.id = res.result ? res.result.id : ''
1678
+ form.elsAccount = res.result ? res.result.elsAccount : ''
1679
+ currentEditRow.value.id = form.id
1680
+ currentRow.value = res.result
1681
+ form.templateVersion = res.result ? res.result.templateVersion : ''
1682
+ if (url.add == curl || type == 'publish') {
1683
+ const resultData = res.result
1684
+ form.templateNumber = resultData ? resultData.templateNumber : ''
1685
+ currentEditRow.value.templateStatus = resultData ? resultData.templateStatus : ''
1686
+ remoteJsFilePath.value = `${resultData.elsAccount}/purchase_${resultData.businessType}_${resultData.templateNumber}_${resultData.templateVersion}`
1687
+ }
1688
+ message.success('操作成功!')
1689
+ } else {
1690
+ message.warning(res.message)
1691
+ }
1692
+ confirmLoading.value = false
1693
+ })
1694
+ }
1695
+ const saveEvent = (type = '') => {
1696
+ let { fullData } = itemGrid.value.getTableData()
1697
+ // if (!fullData.length) {
1698
+ // message.warning('请添加表行信息!')
1699
+ // return
1700
+ // }
1701
+ // console.log('save', 1)
1702
+ itemGrid.value.validate(fullData, (valid: customConfigEdits.MapObjectNoneType) => {
1703
+ if (!valid) {
1704
+ postData(type)
1705
+ }
1706
+ })
1707
+ }
1708
+
1709
+ const tempaltePreview = () => {
1710
+ perviewOpen.value = true
1711
+ }
1712
+ const handleReturn = () => {
1713
+ emit('handleReturn')
1714
+ }
1715
+ //生命周期
1716
+
1717
+ onMounted(() => {
1718
+ if (currentEditRow.value && currentEditRow.value.id) {
1719
+ queryDetail()
1720
+ } else {
1721
+ nextTick(() => {
1722
+ confirmLoading.value = false
1723
+ })
1724
+ }
1725
+ })
1726
+
1727
+ return {
1728
+ confirmLoading,
1729
+ currentStep,
1730
+ alertClose,
1731
+ showBusinessTips,
1732
+ form,
1733
+ codeEditorSureClick,
1734
+ changeBusinessTypeEvent,
1735
+ changeDefaultType,
1736
+ currentStepEmit,
1737
+ companyCode,
1738
+ purchaseOrganization,
1739
+ purchaseGroup,
1740
+ formRef,
1741
+ preSetup,
1742
+ gridHeight,
1743
+ groupColumns,
1744
+ groupData,
1745
+ groupRules,
1746
+ changeFilterEvent,
1747
+ groupGrid,
1748
+ groupGridAddEvent,
1749
+ gridDeleteEvent,
1750
+ headRowDrop,
1751
+ headGrid,
1752
+ headData,
1753
+ headColumns,
1754
+ activeCellMethod,
1755
+ headRules,
1756
+ editActivedEvent,
1757
+ headGridAddEvent,
1758
+ visible,
1759
+ fieldData,
1760
+ fieldColumns,
1761
+ selectGrid,
1762
+ selectedHeadOk,
1763
+ exportHeadEvent,
1764
+ rowChangeSummary,
1765
+ removeDictCode,
1766
+ showDictModal,
1767
+ dictCodeModal,
1768
+ fieldSelectOk,
1769
+ showDrawer,
1770
+ drawerVisible,
1771
+ commonDevelopTabs,
1772
+ codeEditorFields,
1773
+ editorModalFlags,
1774
+ sampleCode,
1775
+ nowFieldType,
1776
+ showSample,
1777
+ currentDrawer,
1778
+ switchFields,
1779
+ changeSummary,
1780
+ changeFixSummary,
1781
+ sampleSureClick,
1782
+ itemColumns,
1783
+ itemRowDrop,
1784
+ itemData,
1785
+ itemRules,
1786
+ itemGrid,
1787
+ saveEvent,
1788
+ perviewOpen,
1789
+ tempaltePreview,
1790
+ // currentEditRow,
1791
+ currentRow,
1792
+ handleReturn,
1793
+ }
1794
+ },
1795
+ })
1796
+ </script>
1797
+
1798
+ <style lang="less" scoped>
1799
+ @import url(../style/index.less);
1800
+
1801
+ .content-step-one {
1802
+ justify-content: center;
1803
+ }
1804
+ .code-editror-flex-row {
1805
+ display: block;
1806
+ }
1807
+ </style>