new file: src/views/common/param-mergeTemplate.vue
modified: src/views/technology/routing/routing-form.vue
modified: vue.config.js
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <avue-crud |
| | | ref="crud" |
| | | class="l-mes" |
| | | rowKey="oneId" |
| | | :data="tableData" |
| | | :option="option" |
| | | :span-method="spanMethod" |
| | | :page="page" |
| | | :table-loading="loading" |
| | | > |
| | | <template slot="code" slot-scope="scope"> |
| | | <avue-text-ellipsis use-tooltip :text="scope.row.code" :height="40" :width="100"> |
| | | <small slot="more">...</small> |
| | | </avue-text-ellipsis> |
| | | </template> |
| | | <template slot="paramValue" slot-scope="scope"> |
| | | <el-input @blur="checkType(scope.row)" :readonly="routingTemplateId!=null" :placeholder="'请è¾å
¥'+scope.row.paramType" v-model="scope.row.paramValue"/> |
| | | </template> |
| | | </avue-crud> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | props:{ |
| | | option:{ |
| | | type: Object, |
| | | default: ()=>{ |
| | | return { |
| | | height: 600, |
| | | loadingText: "å è½½ä¸...", |
| | | columnBtn: false, |
| | | index: true, |
| | | indexLabel: 'åºå·', |
| | | menu: false, |
| | | menuAlign: 'center', |
| | | editBtn: false, |
| | | delBtn: false, |
| | | addBtn: false, |
| | | border: true, |
| | | size: 'small', |
| | | refreshBtn: false, |
| | | align: 'center', |
| | | column: [ |
| | | { |
| | | label: 'åæ°ç¼å·', |
| | | prop: 'code', |
| | | slot: true |
| | | }, |
| | | { |
| | | label: '忰项', |
| | | prop: 'paramItem', |
| | | }, |
| | | { |
| | | label: 'äºçº§åæ°', |
| | | prop: 'paramItemTwo', |
| | | }, |
| | | { |
| | | label: 'ä¸çº§åæ°', |
| | | prop: 'paramItemThree', |
| | | }, |
| | | { |
| | | label: 'åæ°ç±»å', |
| | | prop: 'paramType', |
| | | formslot: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "è¯·éæ©åæ°ç±»å", |
| | | trigger: "change" |
| | | }] |
| | | }, |
| | | { |
| | | label: 'å¼', |
| | | prop: 'paramValue', |
| | | slot: true, |
| | | formslot: true, |
| | | labelslot: true |
| | | }, { |
| | | label: 'åä½', |
| | | prop: 'unit', |
| | | rules: [{ |
| | | required: true, |
| | | message: "åä½ä¸è½ä¸ºç©º", |
| | | trigger: "blur" |
| | | }] |
| | | },] |
| | | } |
| | | } |
| | | }, |
| | | tableData:{ |
| | | type: Array, |
| | | default: () => { |
| | | return [] |
| | | }, |
| | | required: true |
| | | }, |
| | | loading:{ |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | page:{ |
| | | type: Object, |
| | | default:()=>{ |
| | | return { |
| | | total: 10, |
| | | currentPage: 1, |
| | | pageSize: 10 |
| | | } |
| | | } |
| | | }, |
| | | spanArr:{ |
| | | type: Array, |
| | | default: ()=>{ |
| | | return [{ |
| | | prop: 'code', |
| | | span: [] |
| | | }, { |
| | | prop: 'paramItem', |
| | | span: [] |
| | | }, { |
| | | prop: 'paramItemTwo', |
| | | span: [] |
| | | }] |
| | | } |
| | | }, |
| | | routingTemplateId:{ |
| | | type: String, |
| | | default: ()=>{ |
| | | return '' |
| | | } |
| | | } |
| | | }, |
| | | created(){ |
| | | // this.rowSort() |
| | | // this.rowCalc() |
| | | }, |
| | | beforeMount(){ |
| | | this.rowSort() |
| | | this.rowCalc() |
| | | }, |
| | | mounted(){ |
| | | }, |
| | | data(){ |
| | | return { |
| | | checkType(row){ |
| | | if(row.paramType == 'æ°å¼æ ¼å¼'){ |
| | | let val = row.paramValue |
| | | const reg = /^[0-9]*$/ |
| | | if(!reg.test(val)){ |
| | | row.paramValue = '' |
| | | this.$message.warning("请è¾å
¥æ°å¼æ ¼å¼çæ°æ®ï¼") |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | methods:{ |
| | | //卿åå¹¶æ¹æ³ |
| | | rowCalc() { |
| | | this.spanArr.forEach((ele, index) => { |
| | | let parent |
| | | if (index !== 0) parent = this.spanArr[ele.parent || index - 1].span |
| | | ele.span = this.rowSpan(ele.prop, parent) |
| | | }) |
| | | }, |
| | | rowSort(list) { |
| | | let propList = this.spanArr.map(ele => ele.prop) |
| | | this.spanArr.forEach((ele, index) => { |
| | | let key = ele.prop |
| | | this.tableData = this.tableData.sort((a, b) => { |
| | | let flag = true; |
| | | for (let i = 0; i < index; i++) { |
| | | let prop = this.spanArr[i].prop |
| | | flag = flag && a[prop] == b[prop] |
| | | } |
| | | if (flag) { |
| | | if (a[key] < b[key]) { return 1; } |
| | | else if (a[key] > b[key]) { return -1; } |
| | | return 0; |
| | | } |
| | | return 0; |
| | | }) |
| | | }) |
| | | }, |
| | | rowSpan(key, parent) { |
| | | let list = []; |
| | | let position = 0; |
| | | this.tableData.forEach((item, index) => { |
| | | if (index === 0) { |
| | | list.push(1) |
| | | let position = 0; |
| | | } else { |
| | | if (this.tableData[index][key] === this.tableData[index - 1][key]) { |
| | | if (parent && parent[index] !== 0) { |
| | | list.push(1) |
| | | position = index |
| | | } else { |
| | | list[position] += 1; |
| | | list.push(0) |
| | | } |
| | | } else { |
| | | list.push(1) |
| | | position = index |
| | | } |
| | | } |
| | | }) |
| | | return list |
| | | }, |
| | | spanMethod({ row, column, rowIndex, columnIndex }) { |
| | | for (let i = 0; i < this.spanArr.length; i++) { |
| | | const ele = this.spanArr[i] |
| | | if (column.property == ele.prop) { |
| | | const _row = ele.span[rowIndex]; |
| | | const _col = _row > 0 ? 1 : 0; |
| | | return { |
| | | rowspan: _row, |
| | | colspan: _col |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .avue-crud__menu{ |
| | | display: none; |
| | | } |
| | | </style> |
| | |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <el-table :data="paramData" class="l-mes" height="600"> |
| | | <!-- <paramMergeTemplate |
| | | :tableData="paramData" |
| | | :page="{}" |
| | | > |
| | | </paramMergeTemplate> --> |
| | | <component |
| | | :is="paramMergeTemplate" |
| | | :tableData="paramData" |
| | | :routingTemplateId="routingTemplateId" |
| | | ></component> |
| | | <!-- <el-table :data="paramData" class="l-mes" height="600"> |
| | | <el-table-column |
| | | label="忰项" |
| | | prop="parameterItem" |
| | |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-table> --> |
| | | </el-card> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | |
| | | import ElRow from 'element-ui/packages/row/src/row' |
| | | import ElCol from 'element-ui/packages/col/src/col' |
| | | import { getOperationParam } from '../../../api/basic/template' |
| | | import paramMergeTemplate from '../../common/param-mergeTemplate.vue' |
| | | import zttdraggable from 'vuedraggable' |
| | | |
| | | const capabilityArray = [ |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | paramMergeTemplate: '', |
| | | itemKey: '', |
| | | typeOptions: [], |
| | | paramTemplateSelArr: [], |
| | |
| | | operationPartDialog, |
| | | RichText, |
| | | editRoutingOperation, |
| | | zttdraggable |
| | | zttdraggable, |
| | | paramMergeTemplate |
| | | }, |
| | | mounted() { |
| | | window.addEventListener( |
| | |
| | | ).then((response) => { |
| | | if (response.data.data.length > 0) { |
| | | this.paramData = response.data.data |
| | | this.paramMergeTemplate = 'paramMergeTemplate' |
| | | } else { |
| | | this.paramData = [] |
| | | } |
| | |
| | | }, |
| | | // ä¿åææåæ°çä¿®æ¹ |
| | | saveAllParamChange() { |
| | | const paramJson = { routingOperationParam: this.paramData } |
| | | let data = [] |
| | | this.paramData.forEach(ele=>{ |
| | | let o = { |
| | | id: null, |
| | | paramValue: ele.paramValue |
| | | } |
| | | if(ele.threeId && ele.threeId != 'null'){ |
| | | o.id = ele.threeId |
| | | }else{ |
| | | if(ele.twoId && ele.twoId != 'null'){ |
| | | o.id = ele.twoId |
| | | }else{ |
| | | o.id = ele.oneId |
| | | } |
| | | } |
| | | data.push(o) |
| | | }) |
| | | const paramJson = { routingOperationParam: data } |
| | | putRoutingTemplateParam(paramJson).then((response) => { |
| | | const data = response.data |
| | | if (data.code == 0) { |
| | |
| | | * https://cli.vuejs.org/zh/config/ |
| | | */ |
| | | //const url = 'http://ztt-gateway:9999' |
| | | const url = 'http://ztt-gateway:9999' |
| | | const url = 'http://192.168.0.15:9999' |
| | | const localUrl = 'http://localhost:8089' |
| | | //const localUrl = 'http://10.88.15.95:8089' |
| | | const CompressionWebpackPlugin = require('compression-webpack-plugin') |