audit-model-forms.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <!-- todo 所属分类 cid问题 共享发布按钮显示问题 -->
  3. <audit-form-top-banner>
  4. <template slot="afterbtn"> </template>
  5. <SdDetailForm
  6. ref="docform"
  7. form-id="iamModelMaintain"
  8. page-id="audit/maintain/iamModelMaintain"
  9. :record-id="this.$route.query.record ? parseInt(this.$route.query.record) : null"
  10. :read-only="true"
  11. :class="$style.form"
  12. @close="close(true)"
  13. @saved="saved"
  14. >
  15. <template v-slot="{ model, fields }">
  16. <table>
  17. <tr>
  18. <td style="padding-left:5px;border:none">
  19. <audit-advanced-group
  20. :expand="templateExpand"
  21. :expand-str="'templateExpand'"
  22. :group-label="'基本信息'"
  23. tablestyle="''"
  24. @changedClick="changedClick"
  25. ></audit-advanced-group> </td></tr
  26. ></table>
  27. <table v-show="templateExpand">
  28. <tr style="display:none">
  29. <!-- 模型编号 -->
  30. <SdFormItemTd name="auditOrgId" />
  31. </tr>
  32. <tr>
  33. <!-- 模型编号 -->
  34. <!-- <SdFormItemTd name="id" :label="'模型编号'" /> -->
  35. <SdFormItemTd name="modelCode" :label="'模型编号'" />
  36. <!-- 模型名称 -->
  37. <SdFormItemTd name="modelName" />
  38. </tr>
  39. <tr>
  40. <!-- 模型类型 new -->
  41. <SdFormItemTd
  42. v-if="modelTypeFocus(fields.modelType.attr.selectListItem, 'init')"
  43. name="modelType"
  44. >
  45. <a-select
  46. v-model="model.modelType"
  47. @change="modelTypeChange"
  48. @focus="modelTypeFocus(fields.modelType.attr.selectListItem)"
  49. >
  50. <a-select-option
  51. v-for="(item, i) in fields.modelType.attr.selectListItem"
  52. :key="i"
  53. :value="item.value"
  54. >{{ item.label }}</a-select-option
  55. >
  56. </a-select>
  57. </SdFormItemTd>
  58. <!-- 事件标签 -->
  59. <SdFormItemTd name="eventTagName" :colspan="1" label="事件标签分类"> </SdFormItemTd>
  60. </tr>
  61. <tr>
  62. <!-- 整改截至时间 , 状态-->
  63. <SdFormItemTd name="reformTime" :label="filterType(model, fields)">
  64. <sd-form-item name="reformTimeType" label=""></sd-form-item>
  65. </SdFormItemTd>
  66. <!-- todo 模型下发数据表 -->
  67. <SdFormItemTd name="viewAddress" />
  68. <!-- <SdFormItemTd name="jmTable" label="模型下发数据表"> </SdFormItemTd> -->
  69. </tr>
  70. <tr>
  71. <!-- 模型领域, 模型阶段 -->
  72. <SdFormItemTd name="modelDomainName"> </SdFormItemTd>
  73. <SdFormItemTd name="modelPhaseName"> </SdFormItemTd>
  74. </tr>
  75. <!-- 查看数据地址, 编辑数据地址 -->
  76. <tr>
  77. <!-- 是否追责 -->
  78. <!-- <SdFormItemTd name="isAccountable" /> -->
  79. <!-- <SdFormItemTd name="editAddress" /> -->
  80. </tr>
  81. <tr>
  82. <!--todo 所属分类 -->
  83. <SdFormItemTd name="catalogName" label="所属分类"> </SdFormItemTd>
  84. <SdFormItemTd name="datacubeType" label="建模类型">
  85. <a-select v-model="model.datacubeType" :disabled="true" @change="cataLogChange">
  86. <a-select-option v-for="(item, i) in modelTypeList" :key="i" :value="item.id">{{
  87. item.name
  88. }}</a-select-option>
  89. </a-select>
  90. </SdFormItemTd>
  91. </tr>
  92. <tr>
  93. <!-- 整改说明 -->
  94. <SdFormItemTd name="reformDesc" :colspan="3">
  95. <a-textarea v-model="model.reformDesc" :rows="3" />
  96. </SdFormItemTd>
  97. </tr>
  98. <SdFormItemTd :hidden="true" name="catalogName" />
  99. </table>
  100. <table>
  101. <tr>
  102. <td style="padding-left:5px;border:none">
  103. <audit-advanced-group
  104. :expand="devExpand"
  105. :expand-str="'devExpand'"
  106. :group-label="'模型逻辑'"
  107. @changedClick="changedClick"
  108. ></audit-advanced-group>
  109. </td>
  110. </tr>
  111. </table>
  112. <table v-if="devExpand">
  113. <tr>
  114. <sd-quill-editor v-model="model.developIdea" :options="editorOption" />
  115. </tr>
  116. </table>
  117. <!-- // 代码逻辑,开发思路,配置思路 -->
  118. <!-- 每个模块下只有一个 a-textarea -->
  119. <table>
  120. <tr>
  121. <td style="padding-left:5px;border:none">
  122. <audit-advanced-group
  123. :expand="codeExpand"
  124. :expand-str="'codeExpand'"
  125. :group-label="'代码逻辑'"
  126. @changedClick="changedClick"
  127. ></audit-advanced-group>
  128. </td>
  129. </tr>
  130. </table>
  131. <table v-if="codeExpand">
  132. <sd-quill-editor v-model="model.codeLogic" :options="editorOption" />
  133. </table>
  134. </template>
  135. </SdDetailForm>
  136. </audit-form-top-banner>
  137. </template>
  138. <script>
  139. import { Message } from 'ant-design-vue'
  140. import auditFormTopBanner from '@product/iam/components/audit-form-top-banner.vue'
  141. import components from './_import-components/audit-model-form-import'
  142. import SdDetailForm from '@/common/components/sd-detail-form.vue'
  143. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  144. import auditMaintainService from '../maintain/audit-maintain-service'
  145. import auditAdvancedGroup from '../../components/audit-advanced-group.vue'
  146. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  147. import SdFormItemTd from '@/common/components/sd-form-item-td.vue'
  148. import auditModelService from './audit-model-service'
  149. export default {
  150. name: 'AuditModelForms',
  151. metaInfo: {
  152. title: '模型信息管理',
  153. },
  154. components: {
  155. ...components,
  156. SdFormItemTd,
  157. auditAdvancedGroup,
  158. auditFormTopBanner,
  159. SdDetailForm,
  160. },
  161. mixins: [auditAdvancedGroupMixins],
  162. data() {
  163. return {
  164. regularExpand: true,
  165. templateExpand: true,
  166. // 代码逻辑,开发思路,配置思路
  167. codeExpand: true,
  168. configExpand: true,
  169. devExpand: true,
  170. orgId: '',
  171. eventList: [],
  172. // 模型领域 ,模型阶段
  173. areaOption: [],
  174. stageOption: [],
  175. // 所属分类
  176. catalogOption: [],
  177. // 分类id
  178. // 名称
  179. optionSelect: {
  180. area: '',
  181. stage: '',
  182. event: '',
  183. },
  184. flagAll: [],
  185. allStatus: false,
  186. // 时间类型
  187. eventClassOption: [],
  188. // 是否追责
  189. isAccountable: false,
  190. // 刷新表单
  191. key: 0,
  192. // 类型option
  193. typeOption: [],
  194. // 富文本
  195. editorOption: {
  196. modules: {
  197. toolbar: {
  198. container: [
  199. ['bold', 'italic', 'underline', 'strike'], // toggled buttons
  200. ['blockquote', 'code-block'],
  201. [{ header: 1 }, { header: 2 }], // custom button values
  202. [{ list: 'ordered' }, { list: 'bullet' }],
  203. [{ script: 'sub' }, { script: 'super' }], // superscript/subscript
  204. [{ indent: '-1' }, { indent: '+1' }], // outdent/indent
  205. [{ direction: 'rtl' }], // text direction
  206. [{ size: ['small', false, 'large', 'huge'] }], // custom dropdown
  207. [{ header: [1, 2, 3, 4, 5, 6, false] }],
  208. [{ color: [] }, { background: [] }], // dropdown with defaults from theme
  209. [{ font: [] }],
  210. [{ align: [] }],
  211. ['clean'], // remove formatting button
  212. ['link', 'image'], // link and image, video
  213. ],
  214. },
  215. },
  216. },
  217. modelFiled: {},
  218. times: null,
  219. modelTypeList: [
  220. {
  221. id: 1,
  222. name: 'SQL建模',
  223. },
  224. {
  225. id: 0,
  226. name: '数据集建模',
  227. },
  228. ],
  229. }
  230. },
  231. computed: {
  232. isAddStatus() {
  233. return this.$route.query.record === undefined
  234. },
  235. },
  236. watch: {
  237. flagAll: {
  238. handler(val) {
  239. if (val.length === 2) {
  240. setTimeout(() => {
  241. if (this.$refs.docform?.SdForm?.model !== undefined) {
  242. const {
  243. modelPhase,
  244. modelDomain,
  245. modelDomainName,
  246. modelPhaseName,
  247. } = this.$refs.docform.SdForm.model
  248. if (modelPhase !== null) {
  249. const stage = this.stageOption.filter((item) => item.id === modelPhase)
  250. stage.length === 0 &&
  251. this.stageOption.push({
  252. id: modelPhase,
  253. name: modelPhaseName,
  254. })
  255. }
  256. if (modelDomain !== null) {
  257. const area = this.areaOption.filter((item) => item.id === modelDomain)
  258. area.length === 0 &&
  259. this.areaOption.push({
  260. id: modelDomain,
  261. name: modelDomainName,
  262. })
  263. }
  264. }
  265. if (this.times) {
  266. clearTimeout(this.times)
  267. }
  268. }, 100)
  269. }
  270. },
  271. deep: true,
  272. },
  273. },
  274. created() {
  275. if (this.$route.query.orgId) this.orgId = this.$route.query.orgId
  276. this.getFormOption()
  277. },
  278. methods: {
  279. filterType(model, fields) {
  280. if (model.reformTimeType === undefined) {
  281. return '整改截至时间'
  282. }
  283. return (
  284. '整改截至时间(' +
  285. fields.reformTimeType.attr.selectListItem.find((val) => val.value === model.reformTimeType)
  286. .label +
  287. ')'
  288. )
  289. },
  290. openPage(type) {
  291. const recordId = this.$route.query.record
  292. type === 'fb' && window.open('#/sd-flow-guide?code=PRODUCT_IAM_MLFBSQ&record=' + recordId)
  293. type === 'gx' && window.open('#/sd-flow-guide?code=PRODUCT_IAM_MLGXSQ&record=' + recordId)
  294. },
  295. getFormOption() {
  296. auditMaintainService.getEventTagList().then((res) => {
  297. this.eventList = res.data
  298. })
  299. auditMaintainService.getAreaListAll().then((res) => {
  300. this.areaOption = res.data
  301. this.flagAll.push(true)
  302. })
  303. auditMaintainService.getStageListAll().then((res) => {
  304. this.stageOption = res.data
  305. this.flagAll.push(true)
  306. })
  307. // 获取全部分类
  308. auditModelService.getAuditModelTreeAll().then((res) => {
  309. this.catalogOption = res.data
  310. })
  311. },
  312. modelTypeChange(val) {
  313. this.isAccountable = val === '1'
  314. const name = this.typeOption.find((item) => item.value === val).label
  315. this.$refs.docform.setFieldValue('modelTypeName', name)
  316. },
  317. modelTypeFocus(filter, type) {
  318. this.typeOption = filter
  319. if (type === 'init') {
  320. this.$nextTick(() => {
  321. const val = this.$refs.docform.getFieldValue('modelType')
  322. const name = this.typeOption.find((item) => item.value === val).label
  323. this.$refs.docform.setFieldValue('modelTypeName', name)
  324. })
  325. }
  326. return true
  327. },
  328. areaChange(val) {
  329. // 根据val的值过滤选项
  330. this.optionSelect.area = this.areaOption.find((item) => item.id === val).name
  331. },
  332. stageChange(val) {
  333. this.optionSelect.stage = this.stageOption.find((item) => item.id === val).name
  334. },
  335. // 事件标签变化
  336. eventChange(val) {
  337. this.optionSelect.event = this.eventList.find((item) => item.id === val).tagName
  338. },
  339. cataLogChange(val) {
  340. this.$refs.docform.setFieldValue('catalogId', val)
  341. this.$refs.docform.setFieldValue(
  342. 'catalogName',
  343. this.catalogOption.find((item) => item.id === val).categoryName
  344. )
  345. },
  346. close(flag) {
  347. crossWindowWatcher.notifyChange(this.$route.fullPath, flag)
  348. window.close()
  349. },
  350. // 保存
  351. saveForm() {
  352. if (this.orgId !== '') {
  353. this.$refs.docform.setFieldValue('auditOrgId', parseInt(this.orgId))
  354. }
  355. // 是否增加名字
  356. const { area, stage, event } = this.optionSelect
  357. area !== '' && this.$refs.docform.setFieldValue('modelDomainName', area)
  358. stage !== '' && this.$refs.docform.setFieldValue('modelPhaseName', stage)
  359. event !== '' && this.$refs.docform.setFieldValue('eventTagName', event)
  360. //
  361. // reservelong2 :1
  362. this.$refs.docform.setFieldValue('reservelong2', 1)
  363. this.$refs.docform.validateFields().then(() => {
  364. this.$refs.docform.saveBtnClick()
  365. })
  366. },
  367. saved() {
  368. Message.success({ content: '保存成功!' }, 1).then(() => {
  369. // this.close(true)
  370. window.close()
  371. })
  372. },
  373. initParam(model) {
  374. // 设置父id
  375. const catalogId = this.$route.query.catalogId
  376. const catalogName = this.$route.query.catalogName
  377. if (catalogId) {
  378. model.catalogId = Number(catalogId)
  379. }
  380. if (catalogName) {
  381. model.catalogName = catalogName
  382. }
  383. },
  384. createEditor() {
  385. // 创建编辑器
  386. // const editor3 = new wangEditor('#editor3')
  387. // editor3.config.height = 500
  388. // this.editor3 = editor3
  389. // editor3.create()
  390. // editor3.txt.html('<p>用 JS 设置的内容</p>')
  391. return true
  392. },
  393. setModelFiled(model) {
  394. this.modelFiled = model
  395. this.flagAll.push(true)
  396. },
  397. },
  398. }
  399. </script>
  400. <style module lang="scss">
  401. @import '@/webflow/sd-flow-form.scss';
  402. .btns button {
  403. top: 8px;
  404. float: right;
  405. margin-right: 10px;
  406. font-size: 16px;
  407. font-weight: 400;
  408. cursor: pointer;
  409. }
  410. </style>
  411. <style>
  412. .reform-time-maintain-from {
  413. display: flex;
  414. }
  415. .reform-time-data {
  416. margin-top: 4px;
  417. }
  418. </style>