fzq #31

Closed
fanzhiqin wants to merge 215 commits from fzq into test
2 changed files with 92 additions and 5 deletions
Showing only changes of commit 2911cf2a90 - Show all commits

View File

@ -1,3 +1,48 @@
<template> <template>
<el-dialog></el-dialog> <el-dialog :title="isDetail ? '详情' : !dataForm.id ? '新增' : '修改'" :visible.sync="visible" @close="handleClose"> </el-dialog>
</template> </template>
<script>
const compareCache = (dataForm, cache) => {
// dataForm cache
// js
// 使 _.isEqual() ---
return JSON.stringify(dataForm) === JSON.stringify(cache)
}
export default {
name: 'AddOrUpdateDialog',
data() {
return {
visible: false,
isEdit: false,
isDetail: false,
// cached: false // updated dataForm confirm emit(refreshDataList)
isUpdated: false
}
},
updated() {
this.isUpdated = true // emit(refreshDataList)
},
// beforeDestroy() {
//
// localStoragedataForm
// emit
//
// localStorage
// if (cached && compareCache(this.dataForm, localStorage...) || !isEdit) {
// // emit
// clearCache()
// this.$emit('refreshDataList')
// }
// },
methods: {
init() {
this.visible = true
},
handleClose() {
if (this.isAdd || this.isUpdated) this.$emit('refreshDataList')
this.visible = false
}
}
}
</script>

View File

@ -7,7 +7,6 @@
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getDataList()">查询</el-button>
<el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;"> <!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
@ -92,9 +91,52 @@ const tableConfigs = [
// { "prop": "version", "name": "" } // { "prop": "version", "name": "" }
] ]
const addOrUpdateConfigs = {
type: 'dialog', // dialog | drawer | page
fields: [
'name',
{
name: 'code',
api: 'xx/code'
},
{
name: 'processTime',
type: 'number', // type: number(input+number) | default(input) | textarea | select(options) | datetime
required: true,
validator: false //
},
'remark',
'specifications',
{
name: 'typeDictValue',
type: 'select',
options: [
//
{ label: 'ces', value: 1 },
{ label: 'sec', value: 2 }
]
},
{
name: 'unitDictValue',
type: 'select',
options: [
//
{ label: 'h', value: 'h' },
{ label: 'l', value: 'l' }
]
}
],
operations: [
{ add: 'api/product/add' },
{ update: 'api/product/update' },
{ reset: true }
]
}
export default { export default {
data() { data() {
return {tableConfigs, return {
tableConfigs,
tableConfigs, tableConfigs,
dataForm: { dataForm: {
key: '' key: ''