| | |
| | | <template> |
| | | <div> |
| | | <avue-crud ref="crud" class="l-mes" rowKey="oneId" :data="tableData" :option="option" :span-method="spanMethod" |
| | | :page="page" :table-loading="loading"> |
| | | <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"> |
| | | <avue-text-ellipsis use-tooltip :text="scope.row.code" :height="textEllipsisHeight" :width="textEllipsisWidth"> |
| | | <small slot="more">...</small> |
| | | </avue-text-ellipsis> |
| | | </template> |
| | | <template slot="paramValue" slot-scope="scope"> |
| | | <el-input @blur="checkType(scope.row)" :disabled="routingTemplateId!=null" :placeholder="'请输入'+scope.row.paramType" v-model="scope.row.paramValue"/> |
| | | <el-input @blur="checkType(scope.row)" :disabled="routingTemplateId!=null || !scope.row.isUpdate" :placeholder="'请输入'+scope.row.paramType" v-model="scope.row.paramValue"/> |
| | | </template> |
| | | <template slot="menu" slot-scope="scope"> |
| | | <el-button type="text" v-if="scope.row.isUpdate && isModel" size="mini" |
| | | @click="handleParamSave(scope.$index, scope.row)">保存</el-button> |
| | | <el-button type="text" v-if="!scope.row.isUpdate && isModel" size="mini" |
| | | @click="handleParamEdit(scope.$index, scope.row)">编辑</el-button> |
| | | <el-button type="text" size="mini" v-if="isModel" |
| | | @click.stop="handleParamInsert(scope.row)">插入</el-button> |
| | | <el-button type='text' :disabled="routingTemplateId!=null" |
| | | @click.stop="handleParamDelete(scope.row, scope.index)">删除</el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <!-- <el-table :data="tableData" ref="commonTree" :span-method="objectSpanMethod" border row-key="id" style="width: 100%"> |
| | | <el-table-column prop="code" label="编码"></el-table-column> |
| | | <el-table-column prop="paramItem" label="一级"></el-table-column> |
| | | <el-table-column prop="paramItemTwo" label="二级"></el-table-column> |
| | | <el-table-column prop="paramItemThree" label="三级"></el-table-column> |
| | | <el-table-column prop="paramType" label="类型"></el-table-column> |
| | | <el-table-column prop="paramValue" label="值"></el-table-column> |
| | | <el-table-column prop="unit" label="单位"></el-table-column> |
| | | </el-table> --> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | // props: ["tableTreeData"], |
| | | data() { |
| | | return { |
| | | checkType(row) { |
| | | if (row.paramType == '数值格式') { |
| | | let val = row.paramValue |
| | | const reg = /^[0-9]*$/ |
| | | if (!reg.test(val)) { |
| | | row.paramValue = '' |
| | | this.$message.warning("请输入数值格式的数据!") |
| | | } |
| | | } |
| | | }, |
| | | mergeObj: {}, |
| | | mergeArr: ['code','paramItem', 'paramItemTwo',], |
| | | tableData: [], |
| | | // routingTemplateId: null |
| | | } |
| | | }, |
| | | props: { |
| | | //是否为参数模板 |
| | | isModel:{ |
| | | type: Boolean, |
| | | default:()=>{ |
| | | return false |
| | | } |
| | | }, |
| | | textEllipsisWidth:{ |
| | | type: Number, |
| | | default:()=>{ |
| | | return 100 |
| | | } |
| | | }, |
| | | textEllipsisHeight:{ |
| | | type: Number, |
| | | default:()=>{ |
| | | return 40 |
| | | } |
| | | }, |
| | | option: { |
| | | type: Object, |
| | | default: () => { |
| | | return { |
| | | height: 600, |
| | | loadingText: "加载中...", |
| | | columnBtn: false, |
| | | index: true, |
| | | indexLabel: '序号', |
| | | menu: false, |
| | | menu: true, |
| | | menuWidth: 100, |
| | | menuAlign: 'center', |
| | | editBtn: false, |
| | | delBtn: false, |
| | |
| | | message: "单位不能为空", |
| | | trigger: "blur" |
| | | }] |
| | | },] |
| | | },] |
| | | } |
| | | } |
| | | }, |
| | |
| | | return [] |
| | | }, |
| | | required: true |
| | | }, |
| | | loading: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | page: { |
| | | type: Object, |
| | |
| | | routingTemplateId: { |
| | | type: String, |
| | | default: () => { |
| | | return '' |
| | | return null |
| | | } |
| | | } |
| | | }, |
| | | handleParamDelete:{ |
| | | type: Function |
| | | }, |
| | | handleParamEdit:{ |
| | | type: Function |
| | | }, |
| | | handleParamInsert:{ |
| | | type: Function |
| | | }, |
| | | handleParamSave:{ |
| | | type: Function |
| | | }, |
| | | }, |
| | | watch:{ |
| | | table(val) { |
| | | this.doLayout() |
| | | }, |
| | | tableTreeData:{ |
| | | handler(old,newval){ |
| | | console.log(this.tableTreeData); |
| | | this.tableData=JSON.parse(JSON.stringify(this.tableTreeData)) |
| | | // this.getSpanArr(this.tableData); |
| | | this.rowSort() |
| | | this.rowCalc() |
| | | this.loading = true |
| | | this.tableData=JSON.parse(JSON.stringify(this.tableTreeData)) |
| | | this.rowSort() |
| | | this.rowCalc() |
| | | this.loading = false |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | // this.$nextTick(() => { |
| | | // this.$refs.crud.doLayout() |
| | | // }) |
| | | this.loading = true |
| | | this.tableData=JSON.parse(JSON.stringify(this.tableTreeData)) |
| | | this.rowSort() |
| | | this.rowCalc() |
| | | }, |
| | | beforeDestroy(){ |
| | | console.log("销毁前"); |
| | | setTimeout(()=>{ |
| | | this.loading = false |
| | | },3000) |
| | | }, |
| | | data(){ |
| | | return { |
| | | |
| | | tableData: [], |
| | | loading: false, |
| | | } |
| | | }, |
| | | methods:{ |
| | |
| | | </script> |
| | | |
| | | <style> |
| | | .avue-crud__menu { |
| | | display: none; |
| | | .avue-crud .el-table th { |
| | | word-break: break-word; |
| | | color: rgba(102,102,102,1); |
| | | background-color: white; |
| | | } |
| | | </style> |