InterlockSummarySet.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. <template>
  2. <a-spin :spinning="confirmLoading" class="interlock-summary-set">
  3. <div class="u-flex-jab top-title">
  4. <div class="left">
  5. <a-icon type="arrow-left" @click="goBack"/>
  6. <span>{{ summaryType }}</span>
  7. </div>
  8. <div>
  9. <a-button @click="goBackCheck" style="margin-right: 10px;font-size: 16px;">关闭</a-button>
  10. <a-button @click="handleOk" type="primary">提交</a-button>
  11. </div>
  12. </div>
  13. <j-form-container class="content-container">
  14. <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  15. <div class="interlock-summary-item">
  16. <div class="interlock-summary-item-title">联锁基本信息</div>
  17. <a-row>
  18. <a-col :span="12">
  19. <a-form-model-item label="联锁名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockName">
  20. <a-input v-model="model.interlockName" placeholder="请输入联锁名称"></a-input>
  21. </a-form-model-item>
  22. </a-col>
  23. <a-col :span="12">
  24. <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
  25. <a-input v-model="model.remark" placeholder="请输入备注"></a-input>
  26. </a-form-model-item>
  27. </a-col>
  28. </a-row>
  29. </div>
  30. <!-- 联锁条件信息 -->
  31. <div class="interlock-summary-item" style="padding-bottom: 12px;">
  32. <div class="interlock-summary-item-title u-flex-jab">
  33. <div>联锁条件信息</div>
  34. <a-button @click="handleAddCondition" type="primary" icon="plus">新增联锁条件</a-button>
  35. </div>
  36. <a-row>
  37. <a-col :span="12">
  38. <a-form-model-item label="逻辑关系" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ljgx">
  39. <!-- <a-input v-model="model.ljgx" placeholder="请输入逻辑关系"></a-input> -->
  40. <!-- <j-dict-select-tag v-model="model.ljgx" placeholder="请选择操作类型" dictCode="ljgx"/> -->
  41. <a-auto-complete :data-source="ljgxOptions" v-model="model.ljgx" :filter-option="filterOption" placeholder="请设置逻辑关系"></a-auto-complete>
  42. </a-form-model-item>
  43. </a-col>
  44. </a-row>
  45. <!-- 联锁条件表格 -->
  46. <a-table
  47. ref="table"
  48. size="middle"
  49. :scroll="{x:true}"
  50. :pagination="false"
  51. :rowKey="(record,index)=>{return index}"
  52. :columns="columns"
  53. :dataSource="conditionDataSource"
  54. class="j-table-force-nowrap"
  55. style="margin: 0 12px;">
  56. <!-- 仪表状态依据 -->
  57. <span slot="instrumentStatusJuge" slot-scope="text, record">
  58. <template v-if="record.instrumentStatusJuge === '3'">
  59. <span>默认正常</span>
  60. </template>
  61. <template v-if="record.instrumentStatusJuge === '0'">
  62. <span>位号读取</span>
  63. </template>
  64. <template v-if="record.instrumentStatusJuge === '1'">
  65. <span>高低限判断</span>
  66. </template>
  67. <template v-if="record.instrumentStatusJuge === '2'">
  68. <span>突变超限判断</span>
  69. </template>
  70. </span>
  71. <!-- 仪表状态内容 -->
  72. <span slot="instrumentStatusContent" slot-scope="text, record">
  73. <template v-if="record.instrumentStatusJuge === '3'">
  74. {{ (record.instrumentStatusNormalName?record.instrumentStatusNormalName:itSystemDefaultValue.instrumentStatusNormalName)+'('+record.instrumentStatusValue+')' }}
  75. </template>
  76. <template v-if="record.instrumentStatusJuge === '0'">
  77. <span>位号:{{ record.instrumentStatusTag }}</span>
  78. </template>
  79. <template v-if="record.instrumentStatusJuge === '1'">
  80. <span>位号:{{ record.ysmnlTag }}</span><br/>
  81. <span>
  82. <span>高限值:{{ record.upperLimit }}</span>&nbsp;
  83. <span>低限值:{{ record.lowerLimit }}</span>
  84. </span>
  85. </template>
  86. <template v-if="record.instrumentStatusJuge === '2'">
  87. <span>位号:{{ record.ysmnlTag }}</span><br/>
  88. <span>
  89. <span>高限值:{{ record.upperLimit }}</span> &nbsp;
  90. <span>低限值:{{ record.lowerLimit }}</span>
  91. </span><br/>
  92. <span>
  93. <span>时间:{{ record.thresholdTime }}</span>&nbsp;
  94. <span>阈值:{{ record.thresholdValue }}</span>
  95. </span>
  96. </template>
  97. </span>
  98. <!-- 是否旁路 -->
  99. <span slot="ifBypass" slot-scope="text, record">
  100. <!-- 否:正常状态 -->
  101. <span v-if="record.ifBypass === '0'">{{ (record.bypassYesName?record.bypassYesName:itSystemDefaultValue.bypassYesName)+'('+record.bypass+')' }}</span>
  102. <!-- 是 -->
  103. <span v-if="record.ifBypass === '1'">{{ record.bypassTag }}</span>
  104. <!-- 现场旁路 -->
  105. <template v-if="record.ifBypass === '2'">
  106. <!-- 选择为正常状态 -->
  107. <span v-if="record.bypass === itSystemDefaultValue.bypassYes">{{ (record.bypassYesName?record.bypassYesName:itSystemDefaultValue.bypassYesName)+'('+record.bypass+')' }}</span>
  108. <!-- 选择为异常状态 -->
  109. <span v-else>{{ (record.bypassNoName?record.bypassNoName:itSystemDefaultValue.bypassNoName)+'('+record.bypass+')' }}</span>
  110. </template>
  111. </span>
  112. <!-- 操作 -->
  113. <span slot="action" slot-scope="text, record, index">
  114. <a-tooltip>
  115. <template slot="title"> 设置 </template>
  116. <span class="edit-btn" @click="handleEditCondition(record, index)"></span>
  117. </a-tooltip>
  118. <a-tooltip>
  119. <template slot="title"> 复制 </template>
  120. <span class="copy-btn" @click="handleCopyCondition(record, index)"></span>
  121. </a-tooltip>
  122. <a-popconfirm title="确定删除吗?" @confirm="() => handleDeleteCondition(record, index)">
  123. <a-tooltip>
  124. <template slot="title"> 删除 </template>
  125. <span class="delete-btn"></span>
  126. </a-tooltip>
  127. </a-popconfirm>
  128. </span>
  129. </a-table>
  130. </div>
  131. <!-- 联锁输出 -->
  132. <div class="interlock-summary-item">
  133. <div class="interlock-summary-item-title">联锁输出</div>
  134. <a-row>
  135. <a-col :span="12">
  136. <a-form-model-item label="联锁输出值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockOutValueData">
  137. <a-cascader
  138. v-model="model.interlockOutValueData"
  139. :options="tagDataOptions"
  140. :fieldNames="customFieldNames"
  141. :show-search="{ filter }"
  142. expand-trigger="hover"
  143. placeholder="请选择"
  144. @change="changeCascader"
  145. />
  146. <!-- :display-render="displayRender" -->
  147. </a-form-model-item>
  148. </a-col>
  149. </a-row>
  150. </div>
  151. <!-- 新增联锁条件 -->
  152. <j-modal
  153. :title="conditionTitle"
  154. :visible="conditionVisible"
  155. @ok="handleConditionOk"
  156. @cancel="handleConditionCancel"
  157. :width="800"
  158. cancelText="关闭"
  159. class="interlock-condition-form">
  160. <!-- :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" -->
  161. <interlock-condition-form ref="conditionForm" :itSystemDefaultValue="itSystemDefaultValue" :tagDataOptions="tagDataOptions" @ok="submitCallback"></interlock-condition-form>
  162. </j-modal>
  163. </a-form-model>
  164. </j-form-container>
  165. </a-spin>
  166. </template>
  167. <script>
  168. import { httpAction, getAction, postAction } from '@/api/manage'
  169. import { validateDuplicateValue } from '@/utils/util'
  170. import InterlockConditionForm from './InterlockConditionForm.vue'
  171. import {ajaxGetDictItems,getDictItemsFromCache} from '@/api/api'
  172. // import { mixinDevice } from '@/utils/mixin'
  173. // import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  174. export default {
  175. name: 'InterlockSummaryForm',
  176. // mixins:[JeecgListMixin, mixinDevice],
  177. components: {
  178. InterlockConditionForm
  179. },
  180. data () {
  181. return {
  182. originalData: null, // 原始数据,退出时新老数据比较
  183. model:{
  184. },
  185. labelCol: {
  186. xs: { span: 24 },
  187. sm: { span: 5 },
  188. },
  189. wrapperCol: {
  190. xs: { span: 24 },
  191. sm: { span: 16 },
  192. },
  193. confirmLoading: true,
  194. validatorRules: {
  195. interlockName: [
  196. { required: true, message: '请输入联锁名称!', },
  197. { validator: (rule, value, callback) => validateDuplicateValue('interlock_summary ', 'interlock_name', value, this.model.id, callback)},
  198. ],
  199. // ljgx: [{
  200. // required: true, message: '请输入逻辑关系!',
  201. // }],
  202. // interlockOutValueData: [{
  203. // required: true, message: '请选择联锁输出值!',
  204. // }],
  205. },
  206. url: {
  207. interLockSelect: '/sys/dict/loadTreeData',
  208. add: "/summary/interlockSummary/addLS",
  209. edit: "/summary/interlockSummary/editLS",
  210. queryById: "/summary/interlockSummary/queryById",
  211. getLsAllData: "/summary/interlockSummary/xxxxLS",
  212. getTagInfo: "/iotedgeCollectData/iotedgeCollectData/getTagInfo",
  213. },
  214. customFieldNames: {
  215. label: 'name',
  216. value: 'info',
  217. children: 'children'
  218. },
  219. apparatusData: [],
  220. systemData: [],
  221. interLockData: [],
  222. // 设备-模块-位号
  223. tagDataOptions: [],
  224. // 新增联锁条件
  225. conditionTitle: '设置联锁条件',
  226. conditionVisible: false,
  227. // 联锁条件表格
  228. conditionDataSource: [],
  229. columns: [
  230. // {
  231. // title: '序号',
  232. // dataIndex: '',
  233. // key:'rowIndex',
  234. // width:60,
  235. // align:"center",
  236. // customRender:function (t,r,index) {
  237. // return parseInt(index)+1;
  238. // }
  239. // },
  240. {
  241. title:'联锁条件',
  242. align:"center",
  243. dataIndex: 'interlockConditionTag'
  244. },
  245. {
  246. title:'仪表状态依据',
  247. align:"center",
  248. // dataIndex: 'instrumentStatusJuge',
  249. scopedSlots: { customRender: 'instrumentStatusJuge' }
  250. },
  251. {
  252. title:'仪表状态内容',
  253. align:"center",
  254. // dataIndex: 'instrumentStatusTag',
  255. scopedSlots: { customRender: 'instrumentStatusContent' }
  256. },
  257. {
  258. title:'描述',
  259. align:"center",
  260. dataIndex: 'description'
  261. },
  262. {
  263. title:'联锁设定值',
  264. align:"center",
  265. dataIndex: 'interlockSetValue'
  266. },
  267. // {
  268. // title:'当前值',
  269. // align:"center",
  270. // dataIndex: 'currentValueTag'
  271. // },
  272. {
  273. title:'旁路状态',
  274. align:"center",
  275. scopedSlots: { customRender: 'ifBypass' }
  276. },
  277. {
  278. title:'输入卡件状态',
  279. align:"center",
  280. dataIndex: 'inputStatusTag',
  281. customRender: (text, record, index)=> {
  282. if(record.inputStatusTag){
  283. return record.inputStatusTag
  284. } else {
  285. var name = record.controlSystemStatusNormalName ? record.controlSystemStatusNormalName : this.itSystemDefaultValue.controlSystemStatusNormalName
  286. return name +'('+ record.inputStatus+')'
  287. }
  288. }
  289. },
  290. {
  291. title:'输出卡件状态',
  292. align:"center",
  293. dataIndex: 'outputStatusTag',
  294. customRender: (text, record, index)=> {
  295. if(record.outputStatusTag){
  296. return record.outputStatusTag
  297. } else {
  298. var name = record.controlSystemStatusNormalName ? record.controlSystemStatusNormalName : this.itSystemDefaultValue.controlSystemStatusNormalName
  299. return name +'('+ record.outputStatus+')'
  300. }
  301. }
  302. },
  303. {
  304. title:'MP状态',
  305. align:"center",
  306. dataIndex: 'mpStatusTag',
  307. customRender: (text, record, index)=> {
  308. if(record.mpStatusTag){
  309. return record.mpStatusTag
  310. } else {
  311. var name = record.controlSystemStatusNormalName ? record.controlSystemStatusNormalName : this.itSystemDefaultValue.controlSystemStatusNormalName
  312. return name +'('+ record.mpStatus+')'
  313. }
  314. }
  315. },
  316. {
  317. title: '操作',
  318. dataIndex: 'action',
  319. align:"center",
  320. fixed:"right",
  321. width:147,
  322. scopedSlots: { customRender: 'action' }
  323. }
  324. ],
  325. tableClickRowIndex: -1,
  326. itSystemDefaultValue: {}, // 该系统设置的默认值
  327. ljgxOptions: [],
  328. }
  329. },
  330. computed: {
  331. summaryEditInfo() {
  332. return this.$store.getters.summaryEditInfo
  333. },
  334. summaryType() {
  335. return this.$store.getters.summaryType
  336. },
  337. clickSystemNode() {
  338. return this.$store.getters.clickSystemNode
  339. },
  340. },
  341. // watch: {
  342. // 'model.interlockName'(val) {
  343. // console.log('value', val);
  344. // },
  345. // },
  346. mounted(){
  347. window.addEventListener('onunload', this.handleRefresh);
  348. },
  349. beforeDestroy() {
  350. // 一定要在组件销毁前移除事件监听,避免内存泄露
  351. window.removeEventListener('onunload', this.handleRefresh);
  352. },
  353. created () {
  354. if(this.summaryType === '编辑'){
  355. this.getEditData()
  356. } else if(this.summaryType === '新增'){
  357. this.setAdd()
  358. } else {
  359. this.getCopyData()
  360. }
  361. // this.getTagInfo()
  362. this.initDictData()
  363. // this.getData('0', 'apparatusData')
  364. },
  365. methods: {
  366. handleRefresh(){
  367. console.log(1111)
  368. this.$router.go(-1)
  369. // this.$router.replace("*")
  370. },
  371. // 获取逻辑关系字典
  372. initDictData() {
  373. //优先从缓存中读取字典配置
  374. if(getDictItemsFromCache('ljgx')){
  375. var dicts = getDictItemsFromCache('ljgx');
  376. this.ljgxOptions = dicts.map(item => item.label)
  377. return
  378. }
  379. //根据字典Code, 初始化字典数组
  380. ajaxGetDictItems('ljgx', null).then((res) => {
  381. if (res.success) {
  382. var dicts = res.result;
  383. this.ljgxOptions = dicts.map(item => item.label)
  384. }
  385. })
  386. },
  387. // 设置装置系统id并获取该系统默认设置值
  388. getZzXtData(){
  389. console.log('model', this.model)
  390. getAction('/base/interlockBase/queryById', {id: this.model.interlockSystemId}).then(res => {
  391. if(res.success){
  392. this.itSystemDefaultValue = res.result
  393. }
  394. })
  395. },
  396. // 获取所有位号
  397. getTagInfo(groupId){
  398. // console.log('this.clickSystemNode', this.clickSystemNode)
  399. // console.log('groupId', groupId)
  400. postAction(this.url.getTagInfo, {groupId: groupId}).then(res => {
  401. this.tagDataOptions = res.result
  402. this.confirmLoading = false
  403. })
  404. },
  405. // 逻辑关系过滤
  406. filterOption(input, option) {
  407. return (
  408. option.componentOptions.children[0].text.toUpperCase().indexOf(input.toUpperCase()) >= 0
  409. );
  410. },
  411. // 联锁条件弹窗-取消
  412. handleConditionCancel(){
  413. this.conditionVisible = false
  414. },
  415. // 联锁条件弹窗-确认
  416. handleConditionOk(){
  417. this.$refs.conditionForm.submitForm();
  418. },
  419. // 联锁条件弹窗-确认回调
  420. submitCallback(model){
  421. if(this.tableClickRowIndex >= 0){
  422. // 编辑回调
  423. this.conditionDataSource[this.tableClickRowIndex] = model
  424. } else {
  425. // 新增回调
  426. this.conditionDataSource.push(model)
  427. }
  428. this.conditionVisible = false
  429. },
  430. interLockSearch(searchText){
  431. console.log(searchText)
  432. // this.interLockData = !searchText ? [] : [searchText, searchText.repeat(2), searchText.repeat(3)]
  433. },
  434. // displayRender({ labels }) {
  435. // // 设置选择最后一位
  436. // return labels[labels.length - 1];
  437. // },
  438. // 位号选择改变
  439. changeCascader(value, selectedOptions){
  440. // console.log(value, selectedOptions)
  441. this.model = {...this.model}
  442. this.model.deviceId = value[0]
  443. this.model.moduleName = value[1]
  444. this.model.interlockOutValueTag = value[2]
  445. this.model.interlockOutValue = selectedOptions[2].value
  446. },
  447. // 级联选择过滤搜索
  448. filter(inputValue, path) {
  449. return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
  450. },
  451. // 新增联锁条件
  452. handleAddCondition(){
  453. this.tableClickRowIndex = -1
  454. this.conditionVisible = true
  455. this.$nextTick(()=>{
  456. this.$refs.conditionForm.add();
  457. })
  458. },
  459. // 编辑联锁条件
  460. handleEditCondition(record, index){
  461. console.log(index)
  462. this.tableClickRowIndex = index
  463. this.conditionVisible = true
  464. this.$nextTick(()=>{
  465. this.$refs.conditionForm.edit(record);
  466. })
  467. },
  468. // 复制联锁条件
  469. handleCopyCondition(record){
  470. this.tableClickRowIndex = -1
  471. this.conditionVisible = true
  472. this.$nextTick(()=>{
  473. this.$refs.conditionForm.edit(record);
  474. })
  475. },
  476. // 删除联锁条件
  477. handleDeleteCondition(record, index){
  478. this.conditionDataSource.splice(index, 1)
  479. },
  480. // 新增联锁-弹窗
  481. setAdd() {
  482. if(this.clickSystemNode && this.clickSystemNode.interlockType === '1'){
  483. // 当前是新增-用树选择的装置系统进行赋值
  484. this.model.interlockApparatusId = this.clickSystemNode.pid
  485. this.model.interlockSystemId = this.clickSystemNode.id
  486. }
  487. this.getZzXtData()
  488. this.getTagInfo(this.clickSystemNode.groupId)
  489. //备份model原始值
  490. this.originalData = JSON.parse(JSON.stringify(this.model));
  491. this.originalData.interlockDetailAddDTOList = [];
  492. },
  493. // 编辑联锁-弹窗
  494. getEditData() {
  495. var record = this.summaryEditInfo
  496. // console.log(record)
  497. // this.model = Object.assign({}, record);
  498. // 编辑时获取当前联锁所有详细信息
  499. getAction(this.url.getLsAllData, {id: record.summaryid}).then(res => {
  500. var resultArr = res.result
  501. this.model = resultArr
  502. this.conditionDataSource = resultArr.interlockDetailEditQueryVOList // 表格数据
  503. this.model.interlockOutValueData = [resultArr.deviceId, resultArr.moduleName, resultArr.interlockOutValueTag]
  504. this.getZzXtData()
  505. this.getTagInfo(this.model.groupId)
  506. //备份model原始值
  507. this.originalData = JSON.parse(JSON.stringify(this.model));
  508. this.originalData.interlockDetailAddDTOList = JSON.parse(JSON.stringify(resultArr.interlockDetailEditQueryVOList));
  509. })
  510. },
  511. // 复制联锁-弹窗
  512. getCopyData() {
  513. var record = this.summaryEditInfo
  514. // this.model = Object.assign({}, record);
  515. // 编辑时获取当前联锁所有详细信息
  516. getAction(this.url.getLsAllData, {id: record.summaryid}).then(res => {
  517. // console.log("复制model数据:", res.result)
  518. var resultArr = res.result
  519. this.model = resultArr
  520. // 清空主表与子表的id
  521. this.model.id = null;
  522. this.model.interlockDetailEditQueryVOList.forEach(function(item, index, array) {
  523. item.id = null;
  524. item.summaryid = null;
  525. });
  526. this.conditionDataSource = resultArr.interlockDetailEditQueryVOList // 表格数据
  527. this.model.interlockOutValueData = [resultArr.deviceId, resultArr.moduleName, resultArr.interlockOutValueTag]
  528. this.getZzXtData()
  529. this.getTagInfo(this.model.groupId)
  530. //备份model原始值,不能直接用等于(等于的话,就传递指针了),必须用JSON.parse(JSON.stringify())方法
  531. this.originalData = JSON.parse(JSON.stringify(this.model));
  532. this.originalData.interlockDetailAddDTOList = JSON.parse(JSON.stringify(resultArr.interlockDetailEditQueryVOList));
  533. })
  534. },
  535. goBackCheck(){
  536. var _this = this
  537. // 转换数据
  538. this.model.interlockDetailAddDTOList = this.conditionDataSource
  539. console.log("原始数据:", JSON.stringify(_this.originalData), "新的数据:", JSON.stringify(_this.model))
  540. if (JSON.stringify(_this.originalData) !== JSON.stringify(_this.model)) {
  541. _this.$confirm({
  542. title: '提示',
  543. content: '联锁信息已修改,是否确定退出?',
  544. okButtonProps: {
  545. style: {
  546. backgroundColor: '#008cd6',
  547. fontSize: '16px',
  548. }
  549. },
  550. cancelButtonProps: {
  551. style: {
  552. fontSize: '16px',
  553. }
  554. },
  555. onOk() {
  556. _this. goBack()
  557. },
  558. onCancel() {},
  559. });
  560. }
  561. else {
  562. _this. goBack()
  563. }
  564. },
  565. goBack(){
  566. this.$router.go(-1)
  567. this.$store.commit('SET_SUMMARYEDITINFO', []);
  568. // this.$router.push({path: '/interLock/summary'})
  569. },
  570. handleOk(){
  571. var _this = this
  572. // 触发表单验证
  573. this.$refs.form.validate((ok, err) => {
  574. if (ok) {
  575. if(this.conditionDataSource.length===0){
  576. this.$message.error('联锁条件未设置')
  577. return false
  578. }
  579. _this.$confirm({
  580. title: '提示',
  581. content: '是否确定提交',
  582. okButtonProps: {
  583. style: {
  584. backgroundColor: '#008cd6',
  585. fontSize: '16px',
  586. }
  587. },
  588. cancelButtonProps: {
  589. style: {
  590. fontSize: '16px',
  591. }
  592. },
  593. onOk() {
  594. _this.submitForm()
  595. },
  596. onCancel() {},
  597. });
  598. }
  599. })
  600. },
  601. submitForm () {
  602. const that = this;
  603. that.confirmLoading = true;
  604. let httpurl = '';
  605. let method = '';
  606. if(!this.model.id){
  607. httpurl+=this.url.add;
  608. method = 'post';
  609. }else{
  610. httpurl+=this.url.edit;
  611. method = 'put';
  612. }
  613. // 转换数据
  614. this.model.interlockDetailAddDTOList = this.conditionDataSource
  615. // 联锁输出值位号
  616. // if(this.model.interlockOutValueData && this.model.interlockOutValueData.length > 0){
  617. // this.model.deviceId = this.model.interlockOutValueData[0]
  618. // this.model.moduleName = this.model.interlockOutValueData[1]
  619. // this.model.interlockOutValueTag = this.model.interlockOutValueData[2]
  620. // // this.model.interlockOutValue = (this.model.interlockOutValueData[2].split('&'))[1]
  621. // }
  622. console.log(this.model)
  623. httpAction(httpurl,this.model,method).then((res)=>{
  624. if(res.success){
  625. that.$message.success(res.message);
  626. this.$router.go(-1)
  627. this.$store.commit('SET_SUMMARYEDITINFO', []);
  628. // that.$emit('ok');
  629. }else{
  630. that.$message.warning(res.message);
  631. }
  632. }).finally(() => {
  633. that.confirmLoading = false;
  634. })
  635. },
  636. // 获取装置/系统/联锁数据--默认获取装置数据-方式一需要方法
  637. // getData(pid, dataName){
  638. // let param = {
  639. // pid: pid,
  640. // tableName: 'interlock_base',
  641. // text: 'interlock_name',
  642. // code: 'id',
  643. // pidField: 'pid',
  644. // hasChildField: 'has_child',
  645. // condition: ''
  646. // }
  647. // getAction(this.url.interLockSelect,param).then(res=>{
  648. // if(res.success){
  649. // this[dataName] = res.result
  650. // }
  651. // })
  652. // },
  653. // 装置选择改变时-方式一需要方法
  654. // handleApparatusChange(e){
  655. // console.log(e)
  656. // this.getData(e, 'systemData')
  657. // },
  658. // 系统选择改变时-方式一需要方法
  659. // handleSystemChange(e){
  660. // console.log(e)
  661. // this.getData(e, 'interLockData')
  662. // },
  663. }
  664. }
  665. </script>
  666. <style lang="less">
  667. .interlock-summary-set{
  668. height: 100%;
  669. overflow: hidden;
  670. .ant-spin-container{
  671. height: 100%;
  672. overflow: hidden;
  673. }
  674. .top-title{
  675. padding: 12px 10px 12px 20px;
  676. .left{
  677. font-size: 20px;
  678. font-weight: 700;
  679. color: #323233;
  680. line-height: 40px;
  681. }
  682. .anticon{
  683. color: #008cd6;
  684. padding-right: 8px;
  685. }
  686. }
  687. .content-container{
  688. height: calc(100% - 64px);
  689. background: #fff;
  690. overflow: auto;
  691. .interlock-summary-item{
  692. // box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
  693. margin-bottom: 12px;
  694. // border-radius: 4px;
  695. }
  696. .interlock-summary-item-title{
  697. background-color: #F5F7FA;
  698. line-height: 44px;
  699. font-size: 16px;
  700. padding: 0 10px 0 20px;
  701. margin-bottom: 10px;
  702. border-bottom: 1px solid #f3f3f3;
  703. color: #323233;
  704. font-weight: 600;
  705. }
  706. }
  707. .u-flex-jab{
  708. display: flex;
  709. justify-content: space-between;
  710. align-items: center;
  711. }
  712. .interlock-condition-form{
  713. .ant-modal{
  714. top: 4px;
  715. }
  716. }
  717. }
  718. </style>