diff --git a/.prettierrc b/.prettierrc
index 301f171..bdc632a 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -2,8 +2,9 @@
"singleQuote": true,
"tabWidth": 2,
"bracketSameLine": true,
+ "jsxBracketSameLine": true,
"embeddedLanguageFormatting": "auto",
- "printWidth": 180,
+ "printWidth": 80,
"quoteProps": "consistent",
"trailingComma": "none",
"semi": false,
diff --git a/src/views/modules/monitoring/workShopSection.vue b/src/views/modules/monitoring/workShopSection.vue
index 35d9c26..5c9ef63 100644
--- a/src/views/modules/monitoring/workShopSection.vue
+++ b/src/views/modules/monitoring/workShopSection.vue
@@ -92,8 +92,6 @@ export default {
getProductLine() {
this.$http.get(this.$http.adornUrl('/monitoring/productionLine/list')).then(({ data: res }) => {
if (res && res.code === 0) {
- // this.plList = res.data
- console.log('res', res)
this.addOrUpdateConfigs.fields.forEach(item => {
if (item.name === 'productionLineId') item.options = res.data.map(item => ({ label: item.name, value: item.id }))
})
diff --git a/src/views/modules/monitoring/workshopSectionDialog.vue b/src/views/modules/monitoring/workshopSectionDialog.vue
index cd2fbb9..0be2595 100644
--- a/src/views/modules/monitoring/workshopSectionDialog.vue
+++ b/src/views/modules/monitoring/workshopSectionDialog.vue
@@ -1,55 +1,108 @@
-
+
+
+
-
-
+
+
+
+
-
-
设备绑定 新增
-
-
-
+
+ 设备绑定
+ 新增
+
+
+
+
+
+
-
-
+
@@ -59,53 +112,19 @@ import BaseTable from '@/components/base-table'
import SmallTitle from '@/components/small-title'
import { pick } from 'lodash/object'
import TableOperateComponent from '@/components/base-table/components/operationComponent'
-
-const AttrForm = {
- name: 'AttrForm',
- props: ['workshopSectionId'],
- data() {
- return {
- dataForm: {
- id: '',
- equipmentId: null
- }
- }
- },
- methods: {
- getEqList() {},
- handleCancel() {},
- handleSave() {}
- },
- template: `
-
-
-
-
-
-
-
- 取消
- 保存
-
-
- `,
- render: function(h) {
- var self = this
- return h('div', { style: { background: '#eee', borderRadius: '8px', padding: '8px' } }, [
- h('el-row', null,
- h('el-form', { ref: 'dataForm' },
- h('el-form-item', { props: { label: '设备名', prop: 'equipmentId' } },
- h('el-input', { domProps: { value: self.dataForm.equipmentId } })
- ),
- h('el-row', null, [])
- ])
- }
-}
+import AttrForm from './workshopSectionDialogAttrForm.vue'
const tableProps = [
{ name: '设备名', prop: 'equipmentName' },
{ name: '排序', prop: 'sort' },
- { name: '操作', prop: 'operations', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
+ {
+ name: '操作',
+ prop: 'operations',
+ fixed: 'right',
+ width: 180,
+ subcomponent: TableOperateComponent,
+ options: ['edit', 'delete']
+ }
]
export default {
@@ -159,11 +178,19 @@ export default {
if (id) {
// 编辑
this.$http({
- url: this.$http.adornUrl('/monitoring/workshopSection/' + this.dataForm.id),
+ url: this.$http.adornUrl(
+ '/monitoring/workshopSection/' + this.dataForm.id
+ ),
method: 'get'
}).then(({ data: res }) => {
if (res.data) {
- const { name, code, productionLineId, description, remark } = res.data
+ const {
+ name,
+ code,
+ productionLineId,
+ description,
+ remark
+ } = res.data
this.dataForm.name = name
this.dataForm.code = code
this.dataForm.productionLineId = productionLineId
@@ -234,10 +261,85 @@ export default {
this.getDataList()
},
addEq() {
- this.showAttrForm = true
+ this.handleAddOrUpdate()
},
- handleOperations() {},
- handleClose() {}
+ handleOperations({ type, data: id }) {
+ switch (type) {
+ case 'edit':
+ this.handleAddOrUpdate(id)
+ break
+ case 'delete':
+ this.handleDeleteEq(id)
+ break
+ }
+ },
+ handleDeleteEq(id) {
+ this.$confirm(`确定删除这条记录吗?`, '提示', {
+ // this.$confirm(`确定删除 ${id} 吗?`, '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ this.$http({
+ url: '/yd-monitor/monitoring/workshopSectionEquipment',
+ method: 'delete',
+ data: [id]
+ }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message({
+ message: '操作成功',
+ type: 'success',
+ duration: 1500,
+ onClose: () => {
+ this.getDataList()
+ }
+ })
+ } else {
+ this.$message.error(data.msg)
+ }
+ })
+ })
+ },
+ handleRefreshList() {
+ this.getDataList()
+ this.showAttrForm = false
+ },
+ handleAddOrUpdate(id) {
+ this.showAttrForm = true
+ if (id) {
+ this.$nextTick(() => {
+ this.$refs.AttrFrom.setInitialId(id)
+ })
+ }
+ },
+ handleClick({ name }) {
+ switch (name) {
+ case 'cancel':
+ this.visible = false
+ break
+ case 'update':
+ case 'save':
+ this.handleCreateOrUpdate()
+ break
+ }
+ },
+ handleCreateOrUpdate() {
+ this.$http({
+ url: '/yd-monitor/monitoring/workshopSection',
+ method: this.dataForm.id ? 'put' : 'post',
+ data: {
+ ...this.dataForm
+ }
+ }).then(({ data: res }) => {
+ this.$message.success({
+ message: '操作成功',
+ onClose: () => {
+ this.$emit('refreshDataList')
+ this.visible = false
+ }
+ })
+ })
+ }
}
}
diff --git a/src/views/modules/monitoring/workshopSectionDialogAttrForm.vue b/src/views/modules/monitoring/workshopSectionDialogAttrForm.vue
new file mode 100644
index 0000000..31bc293
--- /dev/null
+++ b/src/views/modules/monitoring/workshopSectionDialogAttrForm.vue
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ {{
+ edit ? '修改' : '绑定'
+ }}
+
+
+
+
+