| | |
| | | <a-spin :spinning="confirmLoading"> |
| | | <j-form-container :disabled="formDisabled"> |
| | | <!-- 主表单区域 --> |
| | | <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
| | | <a-form-model |
| | | ref="form" |
| | | :model="model" |
| | | :rules="validatorRules" |
| | | slot="detail" |
| | | > |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12" > |
| | | <a-form-model-item label="单据号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num"> |
| | | <a-input v-model="model.num" placeholder="系统自动生成" :disabled="true" ></a-input> |
| | | <a-col :span="12"> |
| | | <a-form-model-item |
| | | label="单据号" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | prop="num" |
| | | > |
| | | <a-input |
| | | v-model="model.num" |
| | | placeholder="系统自动生成" |
| | | :disabled="true" |
| | | ></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | |
| | | </a-row> |
| | | </a-form-model> |
| | | </j-form-container> |
| | | <!-- 子表单区域 --> |
| | | <a-tabs v-model="activeKey" @change="handleChangeTabs"> |
| | | <a-tab-pane tab="ABC评价" :key="refKeys[0]" :forceRender="true"> |
| | | <!-- 子表单区域 --> |
| | | <a-tabs |
| | | v-model="activeKey" |
| | | @change="handleChangeTabs" |
| | | > |
| | | <a-tab-pane |
| | | tab="ABC评价" |
| | | :key="refKeys[0]" |
| | | :forceRender="true" |
| | | > |
| | | <j-vxe-table |
| | | keep-source |
| | | :ref="refKeys[0]" |
| | |
| | | :alwaysEdit="true" |
| | | @valueChange="changeDate" |
| | | :toolbarConfig="toolbarConfig" |
| | | > |
| | | <template slot="toolbarPrefix"> |
| | | <a-button type="primary" @click="selectEquipmentList" :disabled="formDisabled">选择设备 |
| | | </a-button> |
| | | </template> |
| | | > |
| | | <template slot="toolbarPrefix"> |
| | | <a-button |
| | | type="primary" |
| | | @click="selectEquipmentList" |
| | | :disabled="formDisabled" |
| | | >选择设备 |
| | | </a-button> |
| | | </template> |
| | | </j-vxe-table> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | <equipment-select-model ref="EquipmentSelectModal" @selectionRows="addSelectedEquipments"></equipment-select-model> |
| | | <equipment-select-model |
| | | ref="EquipmentSelectModal" |
| | | @selectionRows="addSelectedEquipments" |
| | | ></equipment-select-model> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import { getAction } from '@/api/manage' |
| | | import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' |
| | | import { JVXETypes } from '@/components/jeecg/JVxeTable' |
| | | import { getRefPromise,VALIDATE_FAILED} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js' |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import JFormContainer from '@/components/jeecg/JFormContainer' |
| | | import EquipmentSelectModel from './EquipmentSelectModel' |
| | | import { getAction } from '@/api/manage' |
| | | import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' |
| | | import { JVXETypes } from '@/components/jeecg/JVxeTable' |
| | | import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js' |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import JFormContainer from '@/components/jeecg/JFormContainer' |
| | | import EquipmentSelectModel from './EquipmentSelectModel' |
| | | |
| | | export default { |
| | | name: 'StreamForm', |
| | | mixins: [JVxeTableModelMixin], |
| | | components: { |
| | | JFormContainer, |
| | | EquipmentSelectModel |
| | | }, |
| | | data() { |
| | | return { |
| | | toolbarConfig: { |
| | | export default { |
| | | name: 'StreamForm', |
| | | mixins: [JVxeTableModelMixin], |
| | | components: { |
| | | JFormContainer, |
| | | EquipmentSelectModel |
| | | }, |
| | | data() { |
| | | return { |
| | | toolbarConfig: { |
| | | // prefix 前缀;suffix 后缀 |
| | | slot: ['prefix', 'suffix'], |
| | | // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮 |
| | | btn: ['remove', 'clearSelection'] |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | }, |
| | | model:{ |
| | | }, |
| | | // 新增时子表默认添加几行空数据 |
| | | addDefaultRowNum: 0, |
| | | validatorRules: { |
| | | }, |
| | | refKeys: ['aBCAssessment' ], |
| | | tableKeys:[ 'aBCAssessment' ], |
| | | activeKey: 'streamOperation', |
| | | // ABC评价 |
| | | aBCAssessmentTable: { |
| | | loading: false, |
| | | dataSource: [], |
| | | columns: [ |
| | | { |
| | | title: '统一编码', |
| | | key: 'num', |
| | | type: JVXETypes.normal, |
| | | width:"160px", |
| | | placeholder: '请输入${title}', |
| | | disabled:true, |
| | | align:'center', |
| | | defaultValue:'', |
| | | }, |
| | | { |
| | | title: '设备名称', |
| | | key: 'name', |
| | | type: JVXETypes.normal, |
| | | width:"160px", |
| | | placeholder: '请输入${title}', |
| | | disabled:true, |
| | | align:'center', |
| | | defaultValue:'', |
| | | }, |
| | | { |
| | | title: '设备型号', |
| | | key: 'model', |
| | | type: JVXETypes.normal, |
| | | width:"160px", |
| | | placeholder: '请输入${title}', |
| | | disabled:true, |
| | | align:'center', |
| | | defaultValue:'', |
| | | }, |
| | | { |
| | | title: '设备ID', |
| | | key: 'equipmentId', |
| | | type: JVXETypes.hidden, |
| | | width:"250px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue:'', |
| | | align:'center', |
| | | }, |
| | | { |
| | | title: '平均使用率', |
| | | key: 'standardA', |
| | | type: JVXETypes.select, |
| | | width:"180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue:'', |
| | | dictCode:'ABC-standardA', |
| | | options:[], |
| | | align:'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '可替换性', |
| | | key: 'standardB', |
| | | type: JVXETypes.select, |
| | | width:"180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue:'', |
| | | dictCode:'ABC-standardB', |
| | | options:[], |
| | | align:'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '故障影响度', |
| | | key: 'standardC', |
| | | type: JVXETypes.select, |
| | | width:"230px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue:'', |
| | | dictCode:'ABC-standardC', |
| | | options:[], |
| | | align:'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '生产超差度', |
| | | key: 'standardD', |
| | | type: JVXETypes.select, |
| | | width:"180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue:'', |
| | | dictCode:'ABC-standardD', |
| | | options:[], |
| | | align:'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '故障频率', |
| | | key: 'standardE', |
| | | type: JVXETypes.select, |
| | | width:"180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue:'', |
| | | dictCode:'ABC-standardE', |
| | | options:[], |
| | | align:'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '设备价值', |
| | | key: 'standardF', |
| | | type: JVXETypes.select, |
| | | width:"180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue:'', |
| | | dictCode:'ABC-standardF', |
| | | options:[], |
| | | align:'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '旧标识', |
| | | key: 'oldStandard', |
| | | type: JVXETypes.select, |
| | | width:"180px", |
| | | disabled:true, |
| | | placeholder: '请输入${title}', |
| | | defaultValue:'', |
| | | dictCode:'ABC-standard-result', |
| | | options:[], |
| | | align:'center', |
| | | }, |
| | | { |
| | | title: '新标识', |
| | | key: 'finalStandard', |
| | | type: JVXETypes.select, |
| | | width:"180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue:'', |
| | | dictCode:'ABC-standard-result', |
| | | options:[], |
| | | align:'center', |
| | | validateRules: [ |
| | | { |
| | | required: true, // 必填 |
| | | message: '请输入${title}' // 显示的文本 |
| | | }, |
| | | ] |
| | | }, |
| | | ] |
| | | }, |
| | | url: { |
| | | add: "/eam/stream/add", |
| | | edit: "/eam/stream/edit", |
| | | queryById: "/eam/stream/queryById", |
| | | getNum:'/eam/sysIdentity/getNumNew', |
| | | aBCAssessment: { |
| | | list: '/eam/stream/queryABCAssessmentByMainId' |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | }, |
| | | model: { |
| | | }, |
| | | // 新增时子表默认添加几行空数据 |
| | | addDefaultRowNum: 0, |
| | | validatorRules: { |
| | | }, |
| | | refKeys: ['aBCAssessment'], |
| | | tableKeys: ['aBCAssessment'], |
| | | activeKey: 'streamOperation', |
| | | // ABC评价 |
| | | aBCAssessmentTable: { |
| | | loading: false, |
| | | dataSource: [], |
| | | columns: [ |
| | | { |
| | | title: '统一编码', |
| | | key: 'num', |
| | | type: JVXETypes.normal, |
| | | width: "160px", |
| | | placeholder: '请输入${title}', |
| | | disabled: true, |
| | | align: 'center', |
| | | defaultValue: '', |
| | | }, |
| | | } |
| | | } |
| | | }, |
| | | props: { |
| | | //表单禁用 |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled(){ |
| | | return this.disabled |
| | | { |
| | | title: '设备名称', |
| | | key: 'name', |
| | | type: JVXETypes.normal, |
| | | width: "160px", |
| | | placeholder: '请输入${title}', |
| | | disabled: true, |
| | | align: 'center', |
| | | defaultValue: '', |
| | | }, |
| | | { |
| | | title: '设备型号', |
| | | key: 'model', |
| | | type: JVXETypes.normal, |
| | | width: "160px", |
| | | placeholder: '请输入${title}', |
| | | disabled: true, |
| | | align: 'center', |
| | | defaultValue: '', |
| | | }, |
| | | { |
| | | title: '设备ID', |
| | | key: 'equipmentId', |
| | | type: JVXETypes.hidden, |
| | | width: "250px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue: '', |
| | | align: 'center', |
| | | }, |
| | | { |
| | | title: '平均使用率', |
| | | key: 'standardA', |
| | | type: JVXETypes.select, |
| | | width: "180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue: '', |
| | | dictCode: 'ABC-standardA', |
| | | options: [], |
| | | align: 'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '可替换性', |
| | | key: 'standardB', |
| | | type: JVXETypes.select, |
| | | width: "180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue: '', |
| | | dictCode: 'ABC-standardB', |
| | | options: [], |
| | | align: 'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '故障影响度', |
| | | key: 'standardC', |
| | | type: JVXETypes.select, |
| | | width: "230px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue: '', |
| | | dictCode: 'ABC-standardC', |
| | | options: [], |
| | | align: 'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '生产超差度', |
| | | key: 'standardD', |
| | | type: JVXETypes.select, |
| | | width: "180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue: '', |
| | | dictCode: 'ABC-standardD', |
| | | options: [], |
| | | align: 'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '故障频率', |
| | | key: 'standardE', |
| | | type: JVXETypes.select, |
| | | width: "180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue: '', |
| | | dictCode: 'ABC-standardE', |
| | | options: [], |
| | | align: 'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '设备价值', |
| | | key: 'standardF', |
| | | type: JVXETypes.select, |
| | | width: "180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue: '', |
| | | dictCode: 'ABC-standardF', |
| | | options: [], |
| | | align: 'center', |
| | | // validateRules: [ |
| | | // { |
| | | // required: true, // 必填 |
| | | // message: '请输入${title}' // 显示的文本 |
| | | // }, |
| | | // ] |
| | | }, |
| | | { |
| | | title: '旧标识', |
| | | key: 'oldStandard', |
| | | type: JVXETypes.select, |
| | | width: "180px", |
| | | disabled: true, |
| | | placeholder: '请输入${title}', |
| | | defaultValue: '', |
| | | dictCode: 'ABC-standard-result', |
| | | options: [], |
| | | align: 'center', |
| | | }, |
| | | { |
| | | title: '新标识', |
| | | key: 'finalStandard', |
| | | type: JVXETypes.select, |
| | | width: "180px", |
| | | placeholder: '请输入${title}', |
| | | defaultValue: '', |
| | | dictCode: 'ABC-standard-result', |
| | | options: [], |
| | | align: 'center', |
| | | validateRules: [ |
| | | { |
| | | required: true, // 必填 |
| | | message: '请输入${title}' // 显示的文本 |
| | | }, |
| | | ] |
| | | }, |
| | | ] |
| | | }, |
| | | }, |
| | | created () { |
| | | }, |
| | | methods: { |
| | | addBefore(){ |
| | | let that = this; |
| | | let param = { |
| | | type: 'ABCAssement', |
| | | length: 4 |
| | | }; |
| | | getAction(this.url.getNum,param).then(res=>{ |
| | | if(res.success){ |
| | | that.model.num = res.result; |
| | | } |
| | | }) |
| | | this.aBCAssessmentTable.dataSource=[] |
| | | }, |
| | | getAllTable() { |
| | | let values = this.tableKeys.map(key => getRefPromise(this, key)) |
| | | return Promise.all(values) |
| | | }, |
| | | /** 调用完edit()方法之后会自动调用此方法 */ |
| | | editAfter() { |
| | | this.$nextTick(() => { |
| | | }) |
| | | // 加载子表数据 |
| | | if (this.model.id) { |
| | | let params = { id: this.model.id } |
| | | this.requestSubTableData(this.url.aBCAssessment.list, params, this.aBCAssessmentTable) |
| | | } |
| | | }, |
| | | //校验所有一对一子表表单 |
| | | validateSubForm(allValues){ |
| | | return new Promise((resolve,reject)=>{ |
| | | Promise.all([ |
| | | ]).then(() => { |
| | | resolve(allValues) |
| | | }).catch(e => { |
| | | if (e.error === VALIDATE_FAILED) { |
| | | // 如果有未通过表单验证的子表,就自动跳转到它所在的tab |
| | | this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index] |
| | | } else { |
| | | console.error(e) |
| | | } |
| | | }) |
| | | }) |
| | | url: { |
| | | add: "/eam/stream/add", |
| | | edit: "/eam/stream/edit", |
| | | queryById: "/eam/stream/queryById", |
| | | getNum: '/eam/sysIdentity/getNumNew', |
| | | aBCAssessment: { |
| | | list: '/eam/stream/queryABCAssessmentByMainId' |
| | | }, |
| | | /** 整理成formData */ |
| | | classifyIntoFormData(allValues) { |
| | | let main = Object.assign(this.model, allValues.formValue) |
| | | return { |
| | | ...main, // 展开 |
| | | assessmentList: allValues.tablesValue[0].tableData |
| | | } |
| | | } |
| | | }, |
| | | props: { |
| | | //表单禁用 |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled() { |
| | | return this.disabled |
| | | }, |
| | | }, |
| | | created() { |
| | | }, |
| | | methods: { |
| | | addBefore() { |
| | | let that = this; |
| | | let param = { |
| | | type: 'ABCAssement', |
| | | length: 4 |
| | | }; |
| | | getAction(this.url.getNum, param).then(res => { |
| | | if (res.success) { |
| | | that.model.num = res.result; |
| | | } |
| | | }, |
| | | validateError(msg){ |
| | | this.$message.error(msg) |
| | | }, |
| | | standardResultCompute(e,index) { |
| | | let keyIndex = 'standard'+index; |
| | | let tableData =this.$refs.aBCAssessment.getTableData(); |
| | | for(var i = 0;i<tableData.length;i++){ |
| | | let row = this.$refs.aBCAssessment.getRowById(tableData[i].equipmentId); |
| | | row[keyIndex]=e |
| | | this.changeDateByRow(row); |
| | | }) |
| | | this.aBCAssessmentTable.dataSource = [] |
| | | }, |
| | | getAllTable() { |
| | | let values = this.tableKeys.map(key => getRefPromise(this, key)) |
| | | return Promise.all(values) |
| | | }, |
| | | /** 调用完edit()方法之后会自动调用此方法 */ |
| | | editAfter() { |
| | | this.$nextTick(() => { |
| | | }) |
| | | // 加载子表数据 |
| | | if (this.model.id) { |
| | | let params = { id: this.model.id } |
| | | this.requestSubTableData(this.url.aBCAssessment.list, params, this.aBCAssessmentTable) |
| | | } |
| | | }, |
| | | //校验所有一对一子表表单 |
| | | validateSubForm(allValues) { |
| | | return new Promise((resolve, reject) => { |
| | | Promise.all([ |
| | | ]).then(() => { |
| | | resolve(allValues) |
| | | }).catch(e => { |
| | | if (e.error === VALIDATE_FAILED) { |
| | | // 如果有未通过表单验证的子表,就自动跳转到它所在的tab |
| | | this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index] |
| | | } else { |
| | | console.error(e) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | /** 整理成formData */ |
| | | classifyIntoFormData(allValues) { |
| | | let main = Object.assign(this.model, allValues.formValue) |
| | | return { |
| | | ...main, // 展开 |
| | | assessmentList: allValues.tablesValue[0].tableData |
| | | } |
| | | }, |
| | | validateError(msg) { |
| | | this.$message.error(msg) |
| | | }, |
| | | standardResultCompute(e, index) { |
| | | let keyIndex = 'standard' + index; |
| | | let tableData = this.$refs.aBCAssessment.getTableData(); |
| | | for (var i = 0; i < tableData.length; i++) { |
| | | let row = this.$refs.aBCAssessment.getRowById(tableData[i].equipmentId); |
| | | row[keyIndex] = e |
| | | this.changeDateByRow(row); |
| | | } |
| | | var standardA = this.model.standardA == null || this.model.standardA == undefined || this.model.standardA == '' ? 0 : parseInt(this.model.standardA); |
| | | var standardB = this.model.standardB == null || this.model.standardB == undefined || this.model.standardB == '' ? 0 : parseInt(this.model.standardB); |
| | |
| | | } else { |
| | | this.model.finalStandard = 'C' |
| | | } |
| | | this.model = Object.assign({}, this.model); |
| | | }, |
| | | //选择设备 |
| | | selectEquipmentList() { |
| | | let ids = [] |
| | | let tableData = this.$refs.aBCAssessment.getTableData() |
| | | let deleteData = this.$refs.aBCAssessment.getDeleteData() |
| | | for (let i = 0; i < tableData.length; i++) { |
| | | ids.push(tableData[i].equipmentId) |
| | | } |
| | | this.$refs.EquipmentSelectModal.showModals(ids) |
| | | this.$refs.EquipmentSelectModal.title = '选择设备' |
| | | this.$refs.EquipmentSelectModal.disableSubmit = false |
| | | }, |
| | | addSelectedEquipments(data) { |
| | | let tableData = this.$refs.aBCAssessment.getTableData() |
| | | // const seletedEquipmentIds = tableData. |
| | | var tableStr = JSON.stringify(tableData) |
| | | const addRows = [] |
| | | for (let i = 0; i < data.length; i++) { |
| | | var equipment = {} |
| | | if (tableStr.indexOf(data[i].id)==-1) { |
| | | equipment = { |
| | | id:data[i].id, |
| | | equipmentId: data[i].id, |
| | | num: data[i].num, |
| | | name: data[i].name, |
| | | model:data[i].model, |
| | | standardA:data[i].standardA, |
| | | standardB:data[i].standardB, |
| | | standardC:data[i].standardC, |
| | | standardD:data[i].standardD, |
| | | standardE:data[i].standardE, |
| | | standardF:data[i].standardF, |
| | | oldStandard:data[i].equipmentImportanceId, |
| | | finalStandard:'D', |
| | | } |
| | | this.model = Object.assign({}, this.model); |
| | | }, |
| | | //选择设备 |
| | | selectEquipmentList() { |
| | | let ids = [] |
| | | let tableData = this.$refs.aBCAssessment.getTableData() |
| | | let deleteData = this.$refs.aBCAssessment.getDeleteData() |
| | | for (let i = 0; i < tableData.length; i++) { |
| | | ids.push(tableData[i].equipmentId) |
| | | } |
| | | this.$refs.EquipmentSelectModal.showModals(ids) |
| | | this.$refs.EquipmentSelectModal.title = '选择设备' |
| | | this.$refs.EquipmentSelectModal.disableSubmit = false |
| | | }, |
| | | addSelectedEquipments(data) { |
| | | let tableData = this.$refs.aBCAssessment.getTableData() |
| | | debugger |
| | | // const seletedEquipmentIds = tableData. |
| | | var tableStr = JSON.stringify(tableData) |
| | | const addRows = [] |
| | | for (let i = 0; i < data.length; i++) { |
| | | var equipment = {} |
| | | if (tableStr.indexOf(data[i].id) == -1) { |
| | | equipment = { |
| | | id: data[i].id, |
| | | equipmentId: data[i].id, |
| | | num: data[i].num, |
| | | name: data[i].name, |
| | | model: data[i].model, |
| | | standardA: data[i].standardA, |
| | | standardB: data[i].standardB, |
| | | standardC: data[i].standardC, |
| | | standardD: data[i].standardD, |
| | | standardE: data[i].standardE, |
| | | standardF: data[i].standardF, |
| | | oldStandard: data[i].equipmentImportanceId, |
| | | finalStandard: 'D', |
| | | } |
| | | addRows.push(equipment) |
| | | } |
| | | this.$refs.aBCAssessment.pushRows(addRows) |
| | | }, |
| | | changeDate(target){ |
| | | var standardA = target.row.standardA == null || target.row.standardA == undefined || target.row.standardA == '' ? 0 : parseInt(target.row.standardA); |
| | | var standardB = target.row.standardB == null || target.row.standardB == undefined || target.row.standardB == '' ? 0 : parseInt(target.row.standardB); |
| | | var standardC = target.row.standardC == null || target.row.standardC == undefined || target.row.standardC == '' ? 0 : parseInt(target.row.standardC); |
| | | var standardD = target.row.standardD == null || target.row.standardD == undefined || target.row.standardD == '' ? 0 : parseInt(target.row.standardD); |
| | | var standardE = target.row.standardE == null || target.row.standardE == undefined || target.row.standardE == '' ? 0 : parseInt(target.row.standardE); |
| | | var standardF = target.row.standardF == null || target.row.standardF == undefined || target.row.standardF == '' ? 0 : parseInt(target.row.standardF); |
| | | var sum = standardA + standardB + standardC + standardD + standardE + standardF; |
| | | console.log(target) |
| | | if (sum >= 18) { |
| | | target.row.finalStandard = 'A' |
| | | } else if (sum >= 10 && sum <= 17) { |
| | | target.row.finalStandard = 'B' |
| | | } else { |
| | | target.row.finalStandard = 'C' |
| | | } |
| | | }, |
| | | changeDateByRow(row){ |
| | | var standardA = row.standardA == null || row.standardA == undefined || row.standardA == '' ? 0 : parseInt(row.standardA); |
| | | var standardB = row.standardB == null || row.standardB == undefined || row.standardB == '' ? 0 : parseInt(row.standardB); |
| | | var standardC = row.standardC == null || row.standardC == undefined || row.standardC == '' ? 0 : parseInt(row.standardC); |
| | | var standardD = row.standardD == null || row.standardD == undefined || row.standardD == '' ? 0 : parseInt(row.standardD); |
| | | var standardE = row.standardE == null || row.standardE == undefined || row.standardE == '' ? 0 : parseInt(row.standardE); |
| | | var standardF = row.standardF == null || row.standardF == undefined || row.standardF == '' ? 0 : parseInt(row.standardF); |
| | | var sum = standardA + standardB + standardC + standardD + standardE + standardF; |
| | | if (sum >= 18) { |
| | | row.finalStandard = 'A' |
| | | } else if (sum >= 10 && sum <= 17) { |
| | | row.finalStandard = 'B' |
| | | } else { |
| | | row.finalStandard = 'C' |
| | | } |
| | | }, |
| | | } |
| | | addRows.push(equipment) |
| | | } |
| | | this.$refs.aBCAssessment.pushRows(addRows) |
| | | }, |
| | | changeDate(target) { |
| | | var standardA = target.row.standardA == null || target.row.standardA == undefined || target.row.standardA == '' ? 0 : parseInt(target.row.standardA); |
| | | var standardB = target.row.standardB == null || target.row.standardB == undefined || target.row.standardB == '' ? 0 : parseInt(target.row.standardB); |
| | | var standardC = target.row.standardC == null || target.row.standardC == undefined || target.row.standardC == '' ? 0 : parseInt(target.row.standardC); |
| | | var standardD = target.row.standardD == null || target.row.standardD == undefined || target.row.standardD == '' ? 0 : parseInt(target.row.standardD); |
| | | var standardE = target.row.standardE == null || target.row.standardE == undefined || target.row.standardE == '' ? 0 : parseInt(target.row.standardE); |
| | | var standardF = target.row.standardF == null || target.row.standardF == undefined || target.row.standardF == '' ? 0 : parseInt(target.row.standardF); |
| | | var sum = standardA + standardB + standardC + standardD + standardE + standardF; |
| | | console.log(target) |
| | | if (sum >= 18) { |
| | | target.row.finalStandard = 'A' |
| | | } else if (sum >= 10 && sum <= 17) { |
| | | target.row.finalStandard = 'B' |
| | | } else { |
| | | target.row.finalStandard = 'C' |
| | | } |
| | | }, |
| | | changeDateByRow(row) { |
| | | var standardA = row.standardA == null || row.standardA == undefined || row.standardA == '' ? 0 : parseInt(row.standardA); |
| | | var standardB = row.standardB == null || row.standardB == undefined || row.standardB == '' ? 0 : parseInt(row.standardB); |
| | | var standardC = row.standardC == null || row.standardC == undefined || row.standardC == '' ? 0 : parseInt(row.standardC); |
| | | var standardD = row.standardD == null || row.standardD == undefined || row.standardD == '' ? 0 : parseInt(row.standardD); |
| | | var standardE = row.standardE == null || row.standardE == undefined || row.standardE == '' ? 0 : parseInt(row.standardE); |
| | | var standardF = row.standardF == null || row.standardF == undefined || row.standardF == '' ? 0 : parseInt(row.standardF); |
| | | var sum = standardA + standardB + standardC + standardD + standardE + standardF; |
| | | if (sum >= 18) { |
| | | row.finalStandard = 'A' |
| | | } else if (sum >= 10 && sum <= 17) { |
| | | row.finalStandard = 'B' |
| | | } else { |
| | | row.finalStandard = 'C' |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |