modified: src/views/basic/template/index.vue
modified: src/views/common/param-mergeTemplate.vue
modified: src/views/technology/routing/routing-form.vue
| | |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <el-table |
| | | <paramMergeTemplate |
| | | :key="isShowTree" |
| | | :isModel="true" |
| | | :option="paramTemplateOption" |
| | | :page="{}" |
| | | :textEllipsisWidth="60" |
| | | :handleParamDelete="deleteOperationParam" |
| | | :handleParamEdit="editSample" |
| | | :handleParamInsert="insertTechnologyOperationParam" |
| | | :handleParamSave="saveSample" |
| | | :tableTreeData="operationParams"> |
| | | </paramMergeTemplate> |
| | | <!-- <component :is="paramMergeTemplate" |
| | | :key="isShowTree" |
| | | :tableTreeData="operationParams"></component> --> |
| | | <!-- <el-table |
| | | :data="operationParams" |
| | | id="templateParamTable" |
| | | ref="operationParam" |
| | |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-table> --> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | relateOperationParamTemplate |
| | | } from '../../../api/basic/template' |
| | | import { remote } from '@/api/admin/dict' |
| | | import paramMergeTemplate from '../../common/param-mergeTemplate.vue' |
| | | export default { |
| | | data() { |
| | | return { |
| | | isShowTree: false, |
| | | paramMergeTemplate: '', |
| | | paramSelArr: [], |
| | | paramSelCol: 'code', |
| | | templateIndex: null, |
| | |
| | | minWidth: 100 |
| | | } |
| | | }, |
| | | addOrUpdateVisible: false |
| | | addOrUpdateVisible: false, |
| | | paramTemplateOption: { |
| | | height: 300, |
| | | columnBtn: false, |
| | | index: true, |
| | | indexLabel: '序号', |
| | | indexWidth: 50, |
| | | menu: true, |
| | | menuWidth: 130, |
| | | menuAlign: 'center', |
| | | editBtn: false, |
| | | delBtn: false, |
| | | addBtn: false, |
| | | border: true, |
| | | size: 'small', |
| | | refreshBtn: false, |
| | | align: 'center', |
| | | column: [ |
| | | { |
| | | label: '参数编号', |
| | | prop: 'code', |
| | | width:80, |
| | | 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', |
| | | minWidth: 100, |
| | | slot: true, |
| | | formslot: true, |
| | | labelslot: true |
| | | }, { |
| | | label: '单位', |
| | | prop: 'unit', |
| | | rules: [{ |
| | | required: true, |
| | | message: "单位不能为空", |
| | | trigger: "blur" |
| | | }] |
| | | },] |
| | | } |
| | | } |
| | | }, |
| | | components: { |
| | | ttable, |
| | | TableForm, |
| | | ParamDialog |
| | | ParamDialog, |
| | | paramMergeTemplate |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['permissions']) |
| | |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.templateId = val.id |
| | | if(this.isShowTree){ |
| | | this.isShowTree=false |
| | | }else{ |
| | | this.isShowTree=true |
| | | } |
| | | if (val != null) { |
| | | this.operationParams = [] |
| | | this.getJoinParamTemplateData() |
| | |
| | | technologyOperationTemplateId: this.templateId |
| | | }) |
| | | ).then((response) => { |
| | | this.operationParams = response.data.data.records |
| | | let data = response.data.data |
| | | data.forEach(obj=>{ |
| | | obj.templateId = this.templateId |
| | | }) |
| | | this.operationParams = data |
| | | |
| | | }) |
| | | }, |
| | | rowDrop() { |
| | |
| | | saveSample(index, row) { |
| | | console.log('row', row) |
| | | var obj = {} |
| | | obj.technologyOperationParamId = row.id |
| | | obj.technologyOperationTemplateId = row.technologyOperationTemplateId |
| | | obj.defaultValue = row.defaultValue |
| | | let id = null |
| | | if(row.threeId && row.threeId!='null'){ |
| | | id = row.threeId |
| | | }else{ |
| | | if(row.twoId && row.twoId!='null'){ |
| | | id = row.twoId |
| | | }else{ |
| | | id = row.oneId |
| | | } |
| | | } |
| | | obj.technologyOperationParamId = id |
| | | obj.technologyOperationTemplateId = row.templateId |
| | | obj.defaultValue = row.paramValue |
| | | console.log(obj); |
| | | putRelateOperationParamTemplate(obj).then((response) => { |
| | | this.$message.success('参数保存成功') |
| | | this.$set(row, 'isUpdate', false) |
| | |
| | | <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, |
| | |
| | | routingTemplateId: { |
| | | type: String, |
| | | default: () => { |
| | | return '' |
| | | return null |
| | | } |
| | | } |
| | | }, |
| | | handleParamDelete:{ |
| | | type: Function |
| | | }, |
| | | handleParamEdit:{ |
| | | type: Function |
| | | }, |
| | | handleParamInsert:{ |
| | | type: Function |
| | | }, |
| | | handleParamSave:{ |
| | | type: Function |
| | | }, |
| | | }, |
| | | watch:{ |
| | | 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.tableData=JSON.parse(JSON.stringify(this.tableTreeData)) |
| | | this.rowSort() |
| | | this.rowCalc() |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | created() { |
| | | // this.$nextTick(() => { |
| | | // this.$refs.crud.doLayout() |
| | | // }) |
| | | this.tableData=JSON.parse(JSON.stringify(this.tableTreeData)) |
| | | this.rowSort() |
| | | this.rowCalc() |
| | | }, |
| | | beforeDestroy(){ |
| | | console.log("销毁前"); |
| | | }, |
| | | data(){ |
| | | return { |
| | | |
| | | tableData: [], |
| | | } |
| | | }, |
| | | methods:{ |
| | |
| | | </div> |
| | | </div> |
| | | <div> |
| | | <!-- <paramMergeTemplate :key="isShowTree" :tableTreeData="paramData" :routingTemplateId="routingTemplateId"/> --> |
| | | <component |
| | | :is="paramMergeTemplate" |
| | | :key="isShowTree" |
| | | :tableTreeData="paramData" |
| | | :routingTemplateId="routingTemplateId" |
| | | :handleParamDelete="handleParamDelete" |
| | | ></component> |
| | | </div> |
| | | <!-- <paramMergeTemplate |
| | | :tableData="paramData" |
| | | :page="{}" |
| | | > |
| | | </paramMergeTemplate> --> |
| | | <!-- <component |
| | | :is="paramMergeTemplate" |
| | | :key="isShowTree" |
| | | :tableData="paramData" |
| | | :routingTemplateId="routingTemplateId" |
| | | ></component> --> |
| | | <!-- <el-table :data="paramData" class="l-mes" height="600"> |
| | | <el-table-column |
| | | label="参数项" |
| | | prop="parameterItem" |
| | | align="center" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <span |
| | | >{{ scope.row.parameterItem }}({{ |
| | | scope.row.unit |
| | | }})</span |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | label="参数类型" |
| | | prop="type" |
| | | align="center" |
| | | :formatter="getParam" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column label="值" prop="paramValue" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-input |
| | | v-model="scope.row.paramValue" |
| | | placeholder="值" |
| | | :disabled="!editable" |
| | | ></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | type="text" |
| | | size="mini" |
| | | v-if="editable && routingTemplateId != null" |
| | | @click.stop="handleParamDelete(scope.row, scope.$index)" |
| | | >删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> --> |
| | | </el-card> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | |
| | | }else{ |
| | | this.isShowTree=true |
| | | } |
| | | console.log(this.isShowTree); |
| | | this.paramData=[] |
| | | this.getRoutingTemplateParam(row.id) |
| | | }, |
| | |
| | | |
| | | // 删除参数 |
| | | handleParamDelete(row, index) { |
| | | this.$confirm('是否确认删除参数项为' + row.parameterItem, '提示', { |
| | | this.$confirm('是否确认删除参数项为【' + row.paramItem +'】的数据?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(function() { |
| | | return deleteRoutingTemplateParam(row.id) |
| | | let id = null |
| | | if(row.treeId && row.treeId!='null'){ |
| | | id = row.treeId |
| | | }else{ |
| | | if(row.twoId && row.twoId!='null'){ |
| | | id = row.twoId |
| | | }else{ |
| | | id = row.oneId |
| | | } |
| | | } |
| | | return deleteRoutingTemplateParam(id) |
| | | }) |
| | | .then((response) => { |
| | | const data = response.data |