¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-card :bordered="false"> |
| | | <a-button |
| | | v-if="equipmentSelectionRows.length == 1 && this.dataSource.length == 0" |
| | | @click="handleAdd" |
| | | type="primary" |
| | | icon="plus" |
| | | >æ°å¢</a-button> |
| | | <div> |
| | | <a-table |
| | | ref="table" |
| | | size="middle" |
| | | bordered |
| | | rowKey="id" |
| | | :columns="columns" |
| | | :dataSource="dataSource" |
| | | :pagination=false |
| | | :loading="loading" |
| | | @change="handleTableChange" |
| | | > |
| | | |
| | | <template |
| | | v-for="col in columns" |
| | | :slot="col.dataIndex" |
| | | slot-scope='text, record, index' |
| | | > |
| | | <div :key="col.dataIndex"> |
| | | |
| | | <span v-if="col.dataIndex == 'remark'"> |
| | | <j-ellipsis |
| | | :value="text" |
| | | :length="10" |
| | | /> |
| | | </span> |
| | | |
| | | <a-input-number |
| | | :value="text" |
| | | v-if="col.dataIndex == 'parametersValue'" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | style="width: 100%" |
| | | /> |
| | | |
| | | <span v-if="col.dataIndex == 'action'"> |
| | | <a-button |
| | | type="primary" |
| | | @click="handleEdit(record)" |
| | | >æäº¤</a-button> |
| | | </span> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | </a-table> |
| | | </div> |
| | | |
| | | <!-- 表ååºå --> |
| | | <process-parameters-modal |
| | | ref="modalForm" |
| | | @ok="modalFormOk" |
| | | ></process-parameters-modal> |
| | | |
| | | </a-card> |
| | | </template> |
| | | |
| | | <script> |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | import { getAction, postAction } from '@/api/manage' |
| | | import JInput from '@/components/jeecg/JInput' |
| | | import Tooltip from 'ant-design-vue/es/tooltip' |
| | | import JEllipsis from "@/components/jeecg/JEllipsis"; |
| | | |
| | | import ProcessParametersModal from './ProcessParametersModal' |
| | | |
| | | export default { |
| | | name: "ProcessParametersList", |
| | | mixins: [JeecgListMixin], |
| | | components: { |
| | | JInput, |
| | | Tooltip, |
| | | JEllipsis, |
| | | ProcessParametersModal, |
| | | }, |
| | | data() { |
| | | return { |
| | | description: 'å·¥èºåæ°', |
| | | // 表头 |
| | | columns: [ |
| | | { |
| | | title: '#', |
| | | dataIndex: '', |
| | | key: 'rowIndex', |
| | | width: 60, |
| | | align: "center", |
| | | customRender: function (t, r, index) { |
| | | return parseInt(index) + 1; |
| | | } |
| | | }, |
| | | { |
| | | title: 'å·¥èºåæ°ç¼ç ', |
| | | align: "center", |
| | | dataIndex: 'processParametersNum', |
| | | }, |
| | | { |
| | | title: 'å·¥èºåæ°åç§°', |
| | | align: "center", |
| | | dataIndex: 'processParametersName', |
| | | }, |
| | | { |
| | | title: '计éåä½', |
| | | align: "center", |
| | | dataIndex: 'processParametersUnitName', |
| | | }, |
| | | { |
| | | title: 'åæ°å¼', |
| | | align: "center", |
| | | dataIndex: 'parametersValue', |
| | | scopedSlots: { |
| | | customRender: 'parametersValue' |
| | | }, |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: '夿³¨', |
| | | align: "center", |
| | | dataIndex: 'remark', |
| | | scopedSlots: { |
| | | customRender: 'remark' |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | align: "center", |
| | | dataIndex: 'action', |
| | | scopedSlots: { |
| | | customRender: 'action' |
| | | }, |
| | | width: 100, |
| | | }, |
| | | ], |
| | | url: { |
| | | list: "/eam/equipmentProcessParameters/list", |
| | | edit: "/eam/equipmentProcessParameters/edit", |
| | | }, |
| | | equipmentSelectionRows: [], |
| | | equipmentId: '', |
| | | } |
| | | }, |
| | | watch: { |
| | | equipmentId() { |
| | | this.queryParam = {}; |
| | | this.queryParam.equipmentId = this.equipmentId; |
| | | this.loadData(1); |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.$bus.$on('equipmentSelectionRows', (data) => { |
| | | this.equipmentSelectionRows = data |
| | | }) |
| | | }, |
| | | methods: { |
| | | |
| | | handleAdd: function () { |
| | | this.$refs.modalForm.add(); |
| | | this.$refs.modalForm.title = "设å¤å·¥èºåæ°ç»å®"; |
| | | this.$refs.modalForm.disableSubmit = false; |
| | | this.$refs.modalForm.equipmentId = this.equipmentSelectionRows[0].id |
| | | }, |
| | | |
| | | modalFormOk() { |
| | | this.loadData(1); |
| | | }, |
| | | |
| | | handleEdit(record) { |
| | | this.loading = true; |
| | | if (record.parametersValue === "" || record.parametersValue === null) { |
| | | this.$message.warning("åèå¼ä¸è½ä¸ºç©ºï¼") |
| | | this.loading = false; |
| | | return |
| | | } |
| | | postAction(this.url.edit, record).then((res) => { |
| | | if (res.success) { |
| | | this.$message.success(res.message); |
| | | this.loadData() |
| | | } else { |
| | | this.$message.warning(res.message); |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | |
| | | handleChange(value, key, column, index) { |
| | | let that = this; |
| | | const temp = [...that.dataSource]; |
| | | const target = temp.filter(item => key === item.key)[index]; |
| | | if (target) { |
| | | target[column.dataIndex] = value; |
| | | if ('parametersValue' == column.dataIndex) { |
| | | target['parametersValue'] = value; |
| | | } |
| | | //æ¾ç¤ºå¸¦è¿æ¥çæ°æ® |
| | | that.dataSource = temp; |
| | | } |
| | | }, |
| | | |
| | | loadData(arg) { |
| | | if (!this.url.list) { |
| | | this.$message.error("请设置url.list屿§!") |
| | | return |
| | | } |
| | | if (arg === 1) { |
| | | this.ipagination.current = 1; |
| | | } |
| | | var params = this.getQueryParams();//æ¥è¯¢æ¡ä»¶ |
| | | if (this.equipmentId == '') { |
| | | params.equipmentId = '-1'; |
| | | } |
| | | this.loading = true; |
| | | getAction(this.url.list, params).then((res) => { |
| | | if (res.success) { |
| | | this.dataSource = res.result.records || res.result; |
| | | if (res.result.total) { |
| | | this.ipagination.total = res.result.total; |
| | | } else { |
| | | this.ipagination.total = 0; |
| | | } |
| | | } else { |
| | | this.$message.warning(res.message) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | @import '~@assets/less/common.less'; |
| | | /deep/ .frozenRowClass { |
| | | color: #c9c9c9; |
| | | } |
| | | .success { |
| | | color: green; |
| | | } |
| | | .error { |
| | | color: red; |
| | | } |
| | | .fontweight { |
| | | font-weight: bold; |
| | | } |
| | | .fontweightGreen { |
| | | font-weight: bold; |
| | | color: green; |
| | | } |
| | | .ant-card { |
| | | margin-left: -30px; |
| | | margin-right: -30px; |
| | | } |
| | | </style> |