|
@@ -1,20 +1,23 @@
|
|
|
<template>
|
|
|
- <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
|
|
|
- :operationColumnWidth="50" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
|
|
|
- :column-parsing="columnParsing" :operation="operation()" :exportList="exportList">
|
|
|
- <el-dialog title="" width="1200px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
|
|
|
- :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
|
|
|
- <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
|
|
|
- <zj-form-module :title="formDialogTitles[formDialogType]" label-width="170px" :showPackUp="false"
|
|
|
- :form-data="formData" :form-items="formItems" :disabled="formDialogType == 2">
|
|
|
- </zj-form-module>
|
|
|
- </zj-form-container>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button size="mini" @click="formCancel">取 消</el-button>
|
|
|
- <el-button size="mini" type="primary" @click="formConfirm()">确定</el-button>
|
|
|
+ <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: '列表页面', essential: true }]">
|
|
|
+ <template slot-scope="{activeKey, data}">
|
|
|
+ <template-page v-if="activeKey == 'list'" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
|
|
|
+ :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing" :operationColumnWidth="50"
|
|
|
+ :operation="operation()" :exportList="exportList">
|
|
|
+ </template-page>
|
|
|
+ <div v-if="~['add', 'edit'].indexOf(activeKey)">
|
|
|
+ <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
|
|
|
+ <zj-form-module title="" label-width="170px" :showPackUp="false"
|
|
|
+ :form-data="formData" :form-items="formItems" :disabled="formDialogType == 2">
|
|
|
+ </zj-form-module>
|
|
|
+ </zj-form-container>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="mini" @click="data.removeTab()">取 消</el-button>
|
|
|
+ <el-button v-if="formDialogType !== 2" size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </el-dialog>
|
|
|
- </template-page>
|
|
|
+ </template>
|
|
|
+ </zj-tab-page>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
@@ -66,7 +69,9 @@ export default {
|
|
|
},
|
|
|
partsUnitList: [],
|
|
|
brandList: [],
|
|
|
- categoryList: []
|
|
|
+ categoryList: [],
|
|
|
+ formType: 'add',
|
|
|
+ formVisible: false,
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -76,7 +81,9 @@ export default {
|
|
|
[
|
|
|
[
|
|
|
this.optionsEvensAuth("add", {
|
|
|
- click: this.addData
|
|
|
+ click: () => {
|
|
|
+ this.openForm('add')
|
|
|
+ }
|
|
|
}),
|
|
|
],
|
|
|
],
|
|
@@ -162,7 +169,7 @@ export default {
|
|
|
},
|
|
|
formItems() {
|
|
|
return [{
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: true,
|
|
|
name: 'el-input',
|
|
|
attributes: { placeholder: '请输入', disabled: true },
|
|
@@ -172,7 +179,7 @@ export default {
|
|
|
rules: [...required]
|
|
|
},
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: true,
|
|
|
name: 'slot-component',
|
|
|
attributes: {},
|
|
@@ -191,7 +198,7 @@ export default {
|
|
|
)
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: true,
|
|
|
name: 'el-input',
|
|
|
attributes: { placeholder: '请输入配件名称', },
|
|
@@ -201,7 +208,7 @@ export default {
|
|
|
rules: [...required]
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: true,
|
|
|
name: 'el-select-add',
|
|
|
labelKey: 'dictValue',
|
|
@@ -219,7 +226,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: true,
|
|
|
name: 'el-input',
|
|
|
attributes: { placeholder: '请输入配件代码' },
|
|
@@ -229,7 +236,7 @@ export default {
|
|
|
rules: [...required]
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: true,
|
|
|
name: 'slot-component',
|
|
|
attributes: {},
|
|
@@ -284,7 +291,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: this.formData.normType == 'M' ? true : false,
|
|
|
name: 'slot-component',
|
|
|
attributes: { placeholder: '请输入', type: 'number' },
|
|
@@ -305,7 +312,7 @@ export default {
|
|
|
)
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: this.formData.normType == 'M' ? true : false,
|
|
|
name: 'slot-component',
|
|
|
attributes: { placeholder: '请输入', type: 'number' },
|
|
@@ -339,7 +346,7 @@ export default {
|
|
|
)
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: this.formData.normType == 'M' ? true : false,
|
|
|
name: 'slot-component',
|
|
|
attributes: { placeholder: '请输入', type: 'number' },
|
|
@@ -367,7 +374,7 @@ export default {
|
|
|
)
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: this.formData.normType == 'M' ? false : true,
|
|
|
name: 'slot-component',
|
|
|
attributes: { placeholder: '请输入', type: 'number' },
|
|
@@ -399,7 +406,7 @@ export default {
|
|
|
)
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: this.formData.normType == 'M' ? true : false,
|
|
|
name: 'slot-component',
|
|
|
attributes: { placeholder: '请输入', type: 'number' },
|
|
@@ -427,7 +434,7 @@ export default {
|
|
|
)
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: this.formData.normType == 'M' ? true : false,
|
|
|
name: 'slot-component',
|
|
|
attributes: { placeholder: '请输入', type: 'number' },
|
|
@@ -447,7 +454,7 @@ export default {
|
|
|
)
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: this.formData.normType == 'M' ? false : true,
|
|
|
name: 'slot-component',
|
|
|
attributes: { placeholder: '请输入', type: 'number' },
|
|
@@ -479,7 +486,7 @@ export default {
|
|
|
)
|
|
|
}
|
|
|
}, {
|
|
|
- md: 12,
|
|
|
+ md: 6,
|
|
|
isShow: this.formData.normType == 'M' ? true : false,
|
|
|
name: 'slot-component',
|
|
|
attributes: { placeholder: '请输入', type: 'number' },
|
|
@@ -573,36 +580,53 @@ export default {
|
|
|
return this.operationBtn({
|
|
|
edit: {
|
|
|
click: ({ row, index, column }) => {
|
|
|
- getDetail({ id: row.goodsId }).then(res => {
|
|
|
- Object.assign(this.formData, res.data, {
|
|
|
- brandList: res.data.brandList ? res.data.brandList : [],
|
|
|
- categoryList: res.data.categoryList ? res.data.categoryList : [],
|
|
|
-
|
|
|
- })
|
|
|
- console.log(this.formData)
|
|
|
- this.formDialogType = 1
|
|
|
- this.openForm()
|
|
|
- })
|
|
|
+ this.openForm('edit',row.goodsId)
|
|
|
}
|
|
|
},
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- addData() {
|
|
|
- this.formDialogType = 0
|
|
|
- this.openForm()
|
|
|
- console.log(this.partsUnitList, this.brandList, this.categoryList)
|
|
|
- },
|
|
|
- openForm() {
|
|
|
- this.getTypeList('PARTS_UNIT', 'partsUnitList')
|
|
|
- this.getTypeList('BRAND', 'brandList')
|
|
|
- this.getCategoryList()
|
|
|
- this.formDialog = true;
|
|
|
+ // 打开 新增编辑 网点表单
|
|
|
+ openForm(type, id) {
|
|
|
+ this.$refs.tabPage.addTab({
|
|
|
+ // 对应显示的模块
|
|
|
+ activeKey: type,
|
|
|
+ // 唯一标识
|
|
|
+ key: type,
|
|
|
+ // 页签名称
|
|
|
+ label: ({ edit: "编辑", add: "新增" })[type],
|
|
|
+ // 打开时事件
|
|
|
+ triggerEvent: () => {
|
|
|
+ this.formCancel()
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.formType = type
|
|
|
+ this.formVisible = true
|
|
|
+ this.getTypeList('PARTS_UNIT', 'partsUnitList')
|
|
|
+ this.getTypeList('BRAND', 'brandList')
|
|
|
+ this.getCategoryList()
|
|
|
+ if (type == 'add') {
|
|
|
+ this.formDialogType = 0
|
|
|
+ } else if(type == 'edit'){
|
|
|
+ this.formDialogType = 1
|
|
|
+ getDetail({ id }).then(res => {
|
|
|
+ Object.assign(this.formData, res.data, {
|
|
|
+ brandList: res.data.brandList ? res.data.brandList : [],
|
|
|
+ categoryList: res.data.categoryList ? res.data.categoryList : [],
|
|
|
+
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 关闭时事件
|
|
|
+ closeEvent: () => {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
formCancel() {
|
|
|
- this.$refs.formRef.$refs.inlineForm.clearValidate()
|
|
|
- this.$data.formData = this.$options.data().formData
|
|
|
- this.formDialog = false
|
|
|
+ this.formVisible = false
|
|
|
+ this.$refs?.formRef?.resetFields()
|
|
|
+ this.$data.formRef = this.$options.data().formRef
|
|
|
},
|
|
|
updateStatus(stateEnum) {
|
|
|
if (this.recordSelected.length == 0) {
|
|
@@ -627,12 +651,12 @@ export default {
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
- formConfirm() {
|
|
|
+ formConfirm(cancel) {
|
|
|
this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
|
|
|
if (valid) {
|
|
|
([add, edit][this.formDialogType])(this.formData).then(res => {
|
|
|
this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
|
|
|
- this.formCancel()
|
|
|
+ cancel('list')
|
|
|
this.$refs.pageRef.refreshList()
|
|
|
})
|
|
|
}
|