index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. <template>
  2. <div class='point-box'>
  3. <div class='left'>
  4. <ul>
  5. <li>
  6. <span>原始点位信息</span>&nbsp;&nbsp;&nbsp;
  7. <span :title="editData.Point.Description || '--'">{{editData.Point.Description || '--'}}</span>
  8. </li>
  9. <li>
  10. <span>位置标签</span>&nbsp;&nbsp;&nbsp;
  11. <span :title="editData.Point.LocationFlag.toString() || '--'">{{editData.Point.LocationFlag.toString() || '--'}}</span>
  12. </li>
  13. <li>
  14. <span>对象类型</span>&nbsp;&nbsp;&nbsp;
  15. <span :title="editData.Point.KeyEquipmentType || '--'">{{editData.Point.KeyEquipmentType || '--'}}</span>
  16. </li>
  17. <li>
  18. <span>对象参数</span>&nbsp;&nbsp;&nbsp;
  19. <span :title="editData.Point.KeyEquipmentParameter || '--'">{{editData.Point.KeyEquipmentParameter || '--'}}</span>
  20. </li>
  21. <li>
  22. <span>值/单位说明</span>&nbsp;&nbsp;&nbsp;
  23. <span :title="editData.Point.ValueDescription || '--'">{{editData.Point.ValueDescription || '--'}}</span>
  24. </li>
  25. <li>
  26. <span>备注</span>&nbsp;&nbsp;&nbsp;
  27. <span :title="editData.Point.Remarks || '--'">{{editData.Point.Remarks || '--'}}</span>
  28. </li>
  29. </ul>
  30. </div>
  31. <div class='right'>
  32. <el-form class='form' :rules='rules' ref='form' :model='form' label-width='140px'>
  33. <el-form-item label='对应数据字典' prop='diction'>
  34. <dictionary-cas @change="changeDictionaryCas" ref="dictionaryCas"></dictionary-cas>
  35. </el-form-item>
  36. <el-form-item label='对象标识' prop="EquipmentMark">
  37. <el-input v-model='form.EquipmentMark'></el-input>
  38. </el-form-item>
  39. <template v-for="(it,index) in typeList">
  40. <div class='dict' :key="index">
  41. <label class="el-form-item__label" style="width:140px;">信息点名称:</label><span style="line-height:40px">{{it.name||''}}</span>
  42. <p class='btm'>
  43. <el-input readonly type='textarea' :rows='2' placeholder='信息点的单位及值的说明' v-model='it.ValueDescription'>
  44. </el-input>
  45. <el-form-item style="margin-top:15px;" label='值处理方式' prop='DataRuleType'>
  46. <el-select v-model='it.DataRuleType' placeholder='请选择'>
  47. <el-option v-for='item in handleTypeArr' :key='item.value' :label='item.label' :value='item.value'></el-option>
  48. </el-select>
  49. </el-form-item>
  50. </p>
  51. <!-- components -->
  52. <no-handle :ref='"noHandle"+index' v-if='it.DataRuleType == "无需处理,直接使用"' :noHandleShow='noHandleShow'></no-handle>
  53. <auto-handle :ref='"autoHandle"+index' v-else-if='it.DataRuleType == "需自动单位转换"' :unitObj='it' :autoHandleShow='autoHandleShow'>
  54. </auto-handle>
  55. <enum-handle :ref='"enumHandle"+index' v-else-if='it.DataRuleType == "需按设置枚举转换"' :enumHandleShow='enumHandleShow'></enum-handle>
  56. <formula-handle :ref='"formulaHandle"+index' v-else-if='it.DataRuleType == "需按公式转换"' :formulaHandleShow='formulaHandleShow'>
  57. </formula-handle>
  58. <split-handle :ref='"splitHandle"+index' v-else-if='it.DataRuleType == "需拆分处理"' :splitHandleShow='splitHandleShow'></split-handle>
  59. </div>
  60. </template>
  61. </el-form>
  62. <div class='btn-box'>
  63. <el-button type='primary' @click='save'>保存</el-button>
  64. </div>
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. //components
  70. import noHandle from './no_handle'
  71. import autoHandle from './auto_handle'
  72. import enumHandle from './enum_handle'
  73. import formulaHandle from './formula_handle'
  74. import splitHandle from './split_handle'
  75. import { mapGetters, mapActions } from 'vuex'
  76. //api
  77. import { getEquipmentAll, getQueryProperty } from '@/fetch/data_plat'
  78. import { updatePoint, batchCreate } from '@/fetch/point_http'
  79. import dictionaryCas from '@/components/config_point/dictionaryCascader'
  80. export default {
  81. name: 'point_config_step3_edit',
  82. computed: {
  83. ...mapGetters('project', ['projectId', 'datasourceId', 'protocolType'])
  84. },
  85. data() {
  86. return {
  87. options: [],
  88. optionObj: {},
  89. infoDict: {}, //信息点字典
  90. dataDict: {}, //数据字典
  91. InfomationPoint: null, //信息点
  92. unitObj: {}, //传给自动单位转换的obj
  93. ValueDescription: {}, //值/点位描述
  94. form: {
  95. diction: '1',//占位
  96. DataRuleType: '无需处理,直接使用',
  97. EquipmentMark: ''
  98. },
  99. rules: {
  100. DataRuleType: [{ required: true, message: '请选择值处理方式', trigger: 'change' }],
  101. diction: [{ required: true }],
  102. EquipmentMark: [{ required: true, message: '请输入对象标识', trigger: 'blur' }],
  103. },
  104. handleTypeArr: [
  105. {
  106. label: '无需处理,直接使用',
  107. value: '无需处理,直接使用'
  108. },
  109. {
  110. label: '需自动单位转换',
  111. value: '需自动单位转换'
  112. },
  113. {
  114. label: '需按设置枚举转换',
  115. value: '需按设置枚举转换'
  116. },
  117. {
  118. label: '需按公式转换',
  119. value: '需按公式转换'
  120. },
  121. {
  122. label: '需拆分处理',
  123. value: '需拆分处理'
  124. }
  125. ],
  126. /**值回显******* */
  127. noHandleShow: {},
  128. autoHandleShow: {},
  129. enumHandleShow: {},
  130. formulaHandleShow: {},
  131. splitHandleShow: {},
  132. dictionaryData: [],
  133. typeList: []
  134. }
  135. },
  136. props: {
  137. editData: {
  138. type: Object,
  139. default: {}
  140. }
  141. },
  142. components: {
  143. noHandle,
  144. autoHandle,
  145. enumHandle,
  146. formulaHandle,
  147. splitHandle,
  148. dictionaryCas
  149. },
  150. methods: {
  151. //保存
  152. save() {
  153. if (!this.form.EquipmentMark) {
  154. this.errMsg();
  155. return false;
  156. }
  157. this.$refs.dictionaryCas.validate(valid => {
  158. if (valid) {
  159. for (let i = 0; i < this.typeList.length; i++) {
  160. let flag = this.typeList[i].DataRuleType
  161. switch (flag) {
  162. case '无需处理,直接使用':
  163. let componnoHandle = `noHandle${i}`
  164. this.$refs[componnoHandle][0].getForm(noHandle => {
  165. if (noHandle) {
  166. this.typeList[i].other = noHandle
  167. // this.saveForm(this.form, noHandle)
  168. } else {
  169. this.errMsg();
  170. return false;
  171. }
  172. })
  173. break
  174. case '需自动单位转换':
  175. let componautoHandle = `autoHandle${i}`
  176. this.$refs[componautoHandle][0].getForm(autoHandle => {
  177. if (autoHandle) {
  178. this.typeList[i].other = autoHandle
  179. // this.saveForm(this.form, autoHandle)
  180. } else {
  181. this.errMsg()
  182. return false;
  183. }
  184. })
  185. break
  186. case '需按设置枚举转换':
  187. let componenumHandle = `enumHandle${i}`
  188. this.$refs[componenumHandle][0].getForm(enumHandle => {
  189. if (enumHandle) {
  190. this.typeList[i].other = enumHandle
  191. // this.saveForm(this.form, enumHandle)
  192. } else {
  193. this.errMsg()
  194. return false;
  195. }
  196. })
  197. break
  198. case '需按公式转换':
  199. let componformulaHandle = `formulaHandle${i}`
  200. this.$refs[componformulaHandle][0].getForm(formulaHandle => {
  201. if (formulaHandle) {
  202. this.typeList[i].other = formulaHandle
  203. // this.saveForm(this.form, formulaHandle)
  204. } else {
  205. this.errMsg()
  206. return false;
  207. }
  208. })
  209. break
  210. case '需拆分处理':
  211. let componsplitHandle = `splitHandle${i}`
  212. this.$refs[componsplitHandle][0].getForm(splitHandle => {
  213. if (splitHandle) {
  214. this.typeList[i].other = formulaHandle
  215. // this.saveForm(this.form, splitHandle)
  216. } else {
  217. this.errMsg()
  218. return false;
  219. }
  220. })
  221. break
  222. }
  223. }
  224. this.saveForm()
  225. } else {
  226. this.errMsg()
  227. return false
  228. }
  229. })
  230. },
  231. saveForm() {
  232. let updateParams = {
  233. data: {
  234. Content: [{ Id: this.editData.Point.Id }]
  235. },
  236. type: this.protocolType
  237. }
  238. let params = this.typeList.map((t, i) => {
  239. let temp = this.dictionaryData[i],
  240. tempNames = t.name.split('-');
  241. let eachData = {
  242. InfomationPointCode: temp[temp.length - 1],
  243. InfomationPoint: tempNames[tempNames.length - 1],
  244. DataRuleType: t.DataRuleType,
  245. DataSourceId: this.datasourceId, //数据源id
  246. PointId: this.editData.Point.Id, //点位ID
  247. TypeCode: temp[0],
  248. Type: tempNames[0],
  249. EquipmentMark: this.form.EquipmentMark
  250. }
  251. if (temp.length == 3) {
  252. //设备-部件-空间
  253. eachData.EquipmentTypeCode = temp[1]
  254. eachData.EquipmentType = tempNames[1]
  255. } else if (temp.length == 4) {
  256. eachData.SpecialtyCode = temp[1]
  257. eachData.Specialty = tempNames[1]
  258. eachData.SystemCode = temp[2]
  259. eachData.System = tempNames[2]
  260. eachData.EquipmentTypeCode = eachData.SystemCode //为了配置从动参取值存储
  261. eachData.EquipmentType = eachData.System
  262. }
  263. let type = t.DataRuleType;
  264. updateParams.data.Content[0].EquipmentMark = eachData.EquipmentMark
  265. switch (type) {
  266. case '无需处理,直接使用':
  267. // otherParams = {
  268. // EquipmentMark: other.EquipmentMark
  269. // }
  270. // updateParams.data.Content[0].EquipmentMark = other.EquipmentMark
  271. break
  272. case '需自动单位转换':
  273. let DataRuleContent1 = JSON.stringify([
  274. {
  275. seq: 1,
  276. ruletype: 'type1',
  277. content: [
  278. {
  279. from: t.other.unit[0] + '-' + t.other.unit[1],
  280. to: this.unitObj[eachData.InfomationPointCode].unit
  281. }
  282. ]
  283. }
  284. ])
  285. eachData.DataRuleContent = DataRuleContent1;
  286. // otherParams = {
  287. // DataRuleContent: DataRuleContent1,
  288. // EquipmentMark: other.EquipmentMark
  289. // }
  290. // updateParams.data.Content[0].EquipmentMark = other.EquipmentMark
  291. break
  292. case '需按设置枚举转换':
  293. let DataRuleContent2 = t.other.pointArr.length
  294. ? JSON.stringify([{ seq: 1, ruletype: 'type2', content: t.other.pointArr }])
  295. : undefined
  296. // otherParams = {
  297. // EquipmentMark: other.EquipmentMark,
  298. // DataRuleContent: DataRuleContent2
  299. // }
  300. eachData.DataRuleContent = DataRuleContent2;
  301. // updateParams.data.Content[0].EquipmentMark = other.EquipmentMark
  302. break
  303. case '需按公式转换':
  304. let subRule = t.other.from
  305. ? {
  306. seq: 1,
  307. ruletype: 'type4',
  308. content: [
  309. {
  310. from: t.other.from,
  311. to: t.other.to
  312. }
  313. ]
  314. }
  315. : undefined
  316. let extractRule = {
  317. seq: 2,
  318. ruletype: 'type5',
  319. content: t.other.extract
  320. ? [
  321. {
  322. extract: 'number'
  323. }
  324. ]
  325. : []
  326. }
  327. let countRule = t.other.mark
  328. ? {
  329. seq: 3,
  330. ruletype: 'type6',
  331. content: [
  332. {
  333. calculationtype: t.other.mark,
  334. value: t.other.markValue
  335. }
  336. ]
  337. }
  338. : undefined
  339. let DataRuleContent3 = []
  340. if (subRule) {
  341. DataRuleContent3.push(subRule)
  342. }
  343. DataRuleContent3.push(extractRule)
  344. if (countRule) {
  345. DataRuleContent3.push(countRule)
  346. }
  347. DataRuleContent3 = DataRuleContent3.length ? JSON.stringify(DataRuleContent3) : undefined
  348. eachData.DataRuleContent = DataRuleContent3;
  349. // otherParams = {
  350. // EquipmentMark: other.EquipmentMark,
  351. // DataRuleContent: DataRuleContent3
  352. // }
  353. // updateParams.data.Content[0].EquipmentMark = other.EquipmentMark
  354. break
  355. case '需拆分处理':
  356. let SplitPoints = t.other.devArr.length ? t.other.devArr : undefined
  357. let DataRuleContent4 = undefined
  358. var enum5 = null
  359. if (t.other.tranfVal) {
  360. enum5 = { seq: 2, ruletype: 'type2', content: t.other.pointArr }
  361. } else {
  362. enum5 = { seq: 2, ruletype: 'type2', content: [] }
  363. }
  364. SplitPoints.forEach(ele => {
  365. let cutStr = {
  366. seq: 1,
  367. ruletype: 'type4',
  368. content: [
  369. {
  370. from: ele.SplitStart,
  371. to: ele.SplitEnd
  372. }
  373. ]
  374. }
  375. ele.DataRuleContent = JSON.stringify([cutStr, enum5])
  376. })
  377. eachData.SplitPoints = SplitPoints;
  378. // otherParams = {
  379. // SplitPoints: SplitPoints
  380. // }
  381. updateParams.data.Content[0].EquipmentMark = t.other.eqMark
  382. break
  383. }
  384. return eachData;
  385. })
  386. updatePoint(updateParams, res => { this.create(params) })
  387. },
  388. create(params) {
  389. batchCreate(params, res => {
  390. if (res.Result == 'success') {
  391. this.$message({
  392. message: '保存成功',
  393. type: 'success'
  394. })
  395. this.$emit('refresh')
  396. }
  397. })
  398. },
  399. errMsg() {
  400. this.$message({
  401. message: '有必填项未填',
  402. type: 'warning'
  403. })
  404. },
  405. handleChange(arr) {
  406. this.unitObj = this.infoDict[arr[3]]
  407. this.InfomationPoint = this.unitObj ? this.unitObj.infoPointName || '--' : '--'
  408. },
  409. handleItemChange(val, cb) {
  410. if (val.length == 3) {
  411. if (val[2] != 'null') {
  412. let params = { type: val[2] }
  413. getQueryProperty(params, res => {
  414. if (res.Result == 'success') {
  415. let data = res.Content
  416. let arr = data
  417. .filter(item => {
  418. return item.inputMode == 'L' || item.inputMode == 'M'
  419. })
  420. .map(item => {
  421. return {
  422. code: item.infoPointCode,
  423. name: item.infoPointName
  424. }
  425. })
  426. this.infoDict = {}
  427. data.forEach(item => {
  428. this.infoDict[item.infoPointCode] = item
  429. })
  430. this.optionObj = {}
  431. this.getOptionItem(this.options, val[2])
  432. if (arr.length) {
  433. this.optionObj.content = arr
  434. } else {
  435. this.optionObj.content = undefined
  436. }
  437. if (typeof cb == 'function') {
  438. cb()
  439. }
  440. }
  441. })
  442. }
  443. }
  444. },
  445. getOptionItem(arr, code) {
  446. for (var i = 0; i < arr.length; i++) {
  447. if (arr[i].code == code) {
  448. this.optionObj = arr[i]
  449. }
  450. if (arr[i].content && arr[i].content.length > 0) {
  451. this.getOptionItem(arr[i].content, code)
  452. }
  453. }
  454. },
  455. //缓存数据字典
  456. getDataDict(arr) {
  457. for (var i = 0; i < arr.length; i++) {
  458. this.dataDict[arr[i].code] = arr[i]
  459. if (arr[i].content && arr[i].content.length > 0) {
  460. this.getDataDict(arr[i].content)
  461. } else {
  462. this.$set(arr[i], 'content', [])
  463. }
  464. }
  465. },
  466. getEqAll() {
  467. let params = { format: true }
  468. getEquipmentAll(params, res => {
  469. if (res.Result == 'success') {
  470. this.options = res.Content
  471. this.getDataDict(this.options)
  472. }
  473. })
  474. },
  475. init() {
  476. //获取所有的设备
  477. // this.getEqAll()
  478. },
  479. //回显数值
  480. async showValue(val) {
  481. // await this.getEqAll()
  482. let length = val.RelationList.length
  483. let eqMark = this.editData.Point.EquipmentMark
  484. this.form.EquipmentMark = eqMark;
  485. console.log('-------------')
  486. console.log(val)
  487. if (length) {
  488. var data = val.RelationList[0]
  489. let dict = [data.SpecialtyCode, data.SystemCode, data.EquipmentTypeCode]
  490. //回显字典
  491. let tempArr = val.RelationList.map(t => {
  492. let eachData = [];
  493. if (t.TypeCode == 'Eq' || t.TypeCode == 'Ec' || t.TypeCode == 'Sp') {
  494. eachData = [t.TypeCode, t.EquipmentTypeCode, t.InfomationPointCode]
  495. } else if (t.TypeCode == 'Sy') {
  496. eachData = [t.TypeCode, t.SpecialtyCode, t.SystemCode, t.InfomationPointCode]
  497. } else {
  498. eachData = [t.TypeCode, t.InfomationPointCode]
  499. }
  500. return eachData;
  501. })
  502. this.$nextTick(() => {
  503. this.$refs.dictionaryCas.setCascaderVal(tempArr);
  504. })
  505. this.typeList = val.RelationList.map(t => {
  506. if (t.TypeCode == 'Eq' || t.TypeCode == 'Ec' || t.TypeCode == 'Sp') {
  507. t.name = `${t.Type}-${t.EquipmentType}-${t.InfomationPoint}`
  508. } else if (t.TypeCode == 'Sy') {
  509. t.name = `${t.Type}-${t.Specialty}-${t.System}-${t.InfomationPoint}`
  510. } else {
  511. t.name = `${t.Type}-${t.InfomationPoint}`
  512. }
  513. return t;
  514. });
  515. this.form.DataRuleType = data.DataRuleType
  516. // this.handleItemChange(dict, () => {
  517. // this.unitObj = this.infoDict[data.InfomationPointCode]
  518. // this.InfomationPoint = this.unitObj.infoPointName || '--'
  519. // if (typeof this.unitObj.dataSource == 'string') {
  520. // if (this.unitObj.dataSource.length) {
  521. // this.ValueDescription = this.unitObj.dataSource
  522. // } else {
  523. // this.ValueDescription = '无信息点单位及值说明'
  524. // }
  525. // } else {
  526. // let str = ''
  527. // this.unitObj.dataSource.forEach(ele => {
  528. // str += ele.code + '.' + ele.name + ' '
  529. // })
  530. // this.ValueDescription = str
  531. // }
  532. // })
  533. if (length == 1) {
  534. let flag = data.DataRuleType
  535. var dataRules = null
  536. switch (flag) {
  537. case '无需处理,直接使用':
  538. this.noHandleShow = {
  539. EquipmentMark: eqMark
  540. }
  541. break
  542. case '需自动单位转换':
  543. dataRules = JSON.parse(data.DataRuleContent)
  544. let auto = dataRules[0].content[0].from.split('-')
  545. this.autoHandleShow = {
  546. EquipmentMark: eqMark,
  547. unit: auto
  548. }
  549. break
  550. case '需按设置枚举转换':
  551. dataRules = JSON.parse(data.DataRuleContent)
  552. let pointArr = dataRules[0].content
  553. this.enumHandleShow = {
  554. EquipmentMark: eqMark,
  555. pointArr: pointArr
  556. }
  557. break
  558. case '需按公式转换':
  559. var cut = null
  560. var count = null
  561. var extractArr = []
  562. if (data.DataRuleContent) {
  563. dataRules = JSON.parse(data.DataRuleContent)
  564. cut = dataRules[0].content[0]
  565. extractArr = dataRules[1].content
  566. count = dataRules[2].content[0]
  567. }
  568. this.formulaHandleShow = {
  569. EquipmentMark: eqMark,
  570. cut: cut,
  571. count: count,
  572. extractArr: extractArr
  573. }
  574. break
  575. case '需拆分处理':
  576. let dataRules = JSON.parse(data.DataRuleContent)
  577. let devArr = val.RelationList.map(ele => {
  578. let arr = JSON.parse(ele.DataRuleContent)
  579. return {
  580. EquipmentMark: ele.EquipmentMark,
  581. SplitStart: arr[0].content[0].from,
  582. SplitEnd: arr[0].content[0].to
  583. }
  584. })
  585. var pointArr = dataRules[1].content
  586. this.splitHandleShow = {
  587. eqMark: eqMark,
  588. EquipmentMark: data.EquipmentMark,
  589. pointArr: pointArr,
  590. devArr: devArr
  591. }
  592. break
  593. }
  594. } else {
  595. let dataRules = JSON.parse(data.DataRuleContent)
  596. let devArr = val.RelationList.map(ele => {
  597. let arr = JSON.parse(ele.DataRuleContent)
  598. return {
  599. EquipmentMark: ele.EquipmentMark,
  600. SplitStart: arr[0].content[0].from,
  601. SplitEnd: arr[0].content[0].to
  602. }
  603. })
  604. let pointArr = dataRules[1].content
  605. this.splitHandleShow = {
  606. eqMark: eqMark,
  607. EquipmentMark: data.EquipmentMark,
  608. pointArr: pointArr,
  609. devArr: devArr
  610. }
  611. }
  612. } else {
  613. this.noHandleShow = {
  614. EquipmentMark: eqMark
  615. }
  616. }
  617. this.noHandleShow.EquipmentMark = eqMark
  618. this.autoHandleShow.EquipmentMark = eqMark
  619. this.enumHandleShow.EquipmentMark = eqMark
  620. this.enumHandleShow.pointArr = this.enumHandleShow.pointArr ? this.enumHandleShow.pointArr : [{ from: '', to: '' }]
  621. this.formulaHandleShow.EquipmentMark = eqMark
  622. this.splitHandleShow.eqMark = eqMark
  623. this.splitHandleShow.devArr = this.splitHandleShow.devArr ? this.splitHandleShow.devArr : [{ EquipmentMark: '', SplitStart: 1, SplitEnd: 1 }]
  624. this.splitHandleShow.pointArr = this.splitHandleShow.pointArr ? this.splitHandleShow.pointArr : [{ from: '', to: '' }]
  625. },
  626. //处理函数
  627. delDataSource(val) {
  628. if (!val) {
  629. return '--'
  630. }
  631. val = JSON.parse(val)
  632. let str = ''
  633. val.forEach(el => {
  634. str += el.Code + '.' + el.Name + ' '
  635. })
  636. return str
  637. },
  638. //对应数据字典变化
  639. changeDictionaryCas({ val, labels, data }) {
  640. this.dictionaryData = val;
  641. this.dictionaryNames = labels || '';
  642. this.unitObj = data || {}
  643. if (this.typeList.length) {
  644. this.typeList = this.typeList.map(t => {
  645. if (labels.indexOf(t.name) < 0) {
  646. return undefined
  647. }
  648. return t;
  649. }).filter(item => item)
  650. let temp = this.typeList.map(t => {
  651. return t.name;
  652. })
  653. for (let i = 0; i < labels.length; i++) {
  654. if (temp.indexOf(labels[i]) < 0) {
  655. this.typeList.push({
  656. name: labels[i],
  657. DataRuleType: '无需处理,直接使用'
  658. })
  659. }
  660. }
  661. } else {
  662. this.typeList = labels.map(t => {
  663. return {
  664. name: t,
  665. DataRuleType: '无需处理,直接使用'
  666. }
  667. })
  668. }
  669. this.typeList = this.typeList.map((t, i) => {
  670. t.ValueDescription = this.delDataSource(data[val[i][val[i].length - 1]].DataSource)
  671. return t;
  672. })
  673. // this.infoDict = this.$refs.dictionaryCas.pointDataSource
  674. // this.InfomationPoint = this.unitObj.InfoPointName || ''
  675. // this.ValueDescription = this.delDataSource(this.unitObj.DataSource)
  676. }
  677. },
  678. mounted() {
  679. this.init()
  680. },
  681. watch: {
  682. editData: {
  683. immediate: true,
  684. handler(val) {
  685. this.showValue(val)
  686. }
  687. }
  688. }
  689. }
  690. </script>
  691. <style lang='scss' scoped>
  692. .point-box {
  693. border: 1px solid #ccc;
  694. display: flex;
  695. padding: 20px 0;
  696. max-height: 500px;
  697. overflow: auto;
  698. .left {
  699. width: 40%;
  700. ul li {
  701. display: flex;
  702. height: 40px;
  703. line-height: 40px;
  704. span:nth-of-type(1) {
  705. text-align: right;
  706. width: 120px;
  707. }
  708. span:nth-of-type(2) {
  709. width: calc(100% - 120px);
  710. overflow: hidden;
  711. text-overflow: ellipsis;
  712. white-space: nowrap;
  713. }
  714. }
  715. }
  716. .right {
  717. width: 60%;
  718. text-align: left;
  719. background: #fff;
  720. .form {
  721. width: 80%;
  722. .dict {
  723. .top {
  724. text-align: right;
  725. line-height: 33px;
  726. }
  727. .btm {
  728. margin-top: 5px;
  729. margin-left: 140px;
  730. }
  731. }
  732. }
  733. .btn-box {
  734. width: 80%;
  735. margin-top: 20px;
  736. text-align: center;
  737. }
  738. }
  739. }
  740. </style>