lb #1
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -2603,6 +2603,12 @@
 | 
			
		||||
      "resolved": "https://registry.npm.taobao.org/@types/json-schema/download/@types/json-schema-7.0.5.tgz",
 | 
			
		||||
      "integrity": "sha1-3M5EMOZLRDuolF8CkPtWStW6xt0="
 | 
			
		||||
    },
 | 
			
		||||
    "@types/lodash": {
 | 
			
		||||
      "version": "4.14.182",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz",
 | 
			
		||||
      "integrity": "sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==",
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "@types/minimatch": {
 | 
			
		||||
      "version": "3.0.3",
 | 
			
		||||
      "resolved": "https://registry.npm.taobao.org/@types/minimatch/download/@types/minimatch-3.0.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fminimatch%2Fdownload%2F%40types%2Fminimatch-3.0.3.tgz",
 | 
			
		||||
 
 | 
			
		||||
@@ -32,6 +32,7 @@
 | 
			
		||||
    "vuex": "^3.5.1"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/lodash": "^4.14.182",
 | 
			
		||||
    "@vue/cli-plugin-babel": "^4.4.6",
 | 
			
		||||
    "@vue/cli-service": "^4.4.6",
 | 
			
		||||
    "element-theme-chalk": "^2.15.7",
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@
 | 
			
		||||
				</template>
 | 
			
		||||
			</el-form>
 | 
			
		||||
 | 
			
		||||
			<template v-if="configs.subtable">
 | 
			
		||||
			<template v-if="dataForm.id && configs.subtable">
 | 
			
		||||
				<h3>{{ configs.subtable.title }}</h3>
 | 
			
		||||
				<component
 | 
			
		||||
					key="sub-table"
 | 
			
		||||
@@ -60,15 +60,21 @@
 | 
			
		||||
		<span slot="footer" class="dialog-footer">
 | 
			
		||||
			<template v-for="(operate, index) in configs.operations">
 | 
			
		||||
				<!-- {{ operate.name | btnNameFilter }} -->
 | 
			
		||||
				<el-button v-if="operate.permission ? $hasPermission(operate.permission) : true" :key="`operate-${index}`" :type="btnType[operate.name]" @click="handleClick(operate)">{{
 | 
			
		||||
					btnName[operate.name]
 | 
			
		||||
				}}</el-button>
 | 
			
		||||
				<el-button
 | 
			
		||||
					v-if="(operate.showAlways || ((dataForm.id && operate.showOnEdit) || (!dataForm.id && !operate.showOnEdit)) && (operate.permission ? $hasPermission(operate.permission) : true))"
 | 
			
		||||
					:key="`operate-${index}`"
 | 
			
		||||
					:type="btnType[operate.name]"
 | 
			
		||||
					@click="handleClick(operate)"
 | 
			
		||||
					>{{ btnName[operate.name] }}</el-button
 | 
			
		||||
				>
 | 
			
		||||
			</template>
 | 
			
		||||
		</span>
 | 
			
		||||
	</el-dialog>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { pick } from 'lodash/object'
 | 
			
		||||
 | 
			
		||||
// 标题 for i18n
 | 
			
		||||
const title = {
 | 
			
		||||
	detail: '详情',
 | 
			
		||||
@@ -81,6 +87,7 @@ const btnType = {
 | 
			
		||||
	save: 'success',
 | 
			
		||||
	update: 'primary',
 | 
			
		||||
	reset: 'text'
 | 
			
		||||
	// cancel: 'text'
 | 
			
		||||
	// add more...
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -88,7 +95,8 @@ const btnName = {
 | 
			
		||||
	// for i18n
 | 
			
		||||
	save: '保存',
 | 
			
		||||
	update: '更新',
 | 
			
		||||
	reset: '重置'
 | 
			
		||||
	reset: '重置',
 | 
			
		||||
	cancel: '取消'
 | 
			
		||||
	// add more...
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -283,17 +291,25 @@ export default {
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		init(id) {
 | 
			
		||||
			this.dataForm.id = id || null
 | 
			
		||||
			this.visible = true
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				this.$refs['dataForm'].resetFields()
 | 
			
		||||
				this.dataForm.id = id || null
 | 
			
		||||
				console.log('dataform ===> ', this.dataForm)
 | 
			
		||||
 | 
			
		||||
				if (this.dataForm.id) {
 | 
			
		||||
					console.log('here...')
 | 
			
		||||
					this.$http({
 | 
			
		||||
						url: this.$http.adornUrl(`${this.infoUrl}/${this.dataForm.id}`),
 | 
			
		||||
						url: this.$http.adornUrl(`${this.configs.infoUrl}/${this.dataForm.id}`),
 | 
			
		||||
						method: 'get'
 | 
			
		||||
					}).then(({ data: res }) => {
 | 
			
		||||
						if (res && res.code === 0) {
 | 
			
		||||
							this.dataForm =
 | 
			
		||||
							const dataFormKeys = Object.keys(this.dataForm)
 | 
			
		||||
							console.log('keys: ', dataFormKeys)
 | 
			
		||||
							console.log('resdata: ', res.data)
 | 
			
		||||
							console.log('pick: ', pick)
 | 
			
		||||
							console.log('after pick data: ', pick(res.data, dataFormKeys))
 | 
			
		||||
							this.dataForm = pick(res.data, dataFormKeys)
 | 
			
		||||
						}
 | 
			
		||||
					})
 | 
			
		||||
				}
 | 
			
		||||
@@ -343,8 +359,9 @@ export default {
 | 
			
		||||
							this.dataForm[key] = null
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					console.log('after reset: ', JSON.stringify(this.dataForm))
 | 
			
		||||
					break
 | 
			
		||||
				case 'cancel': 
 | 
			
		||||
					this.visible = false
 | 
			
		||||
				// add more..
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
 
 | 
			
		||||
@@ -149,9 +149,10 @@ const addOrUpdateConfigs = {
 | 
			
		||||
		}
 | 
			
		||||
	],
 | 
			
		||||
	operations: [
 | 
			
		||||
		{ name: 'reset', url: true },
 | 
			
		||||
		{ name: 'save', url: '/monitoring/product', permission: '' },
 | 
			
		||||
		{ name: 'update', url: '/monitoring/product', permission: '' }
 | 
			
		||||
		// { name: 'reset', url: true },
 | 
			
		||||
		{ name: 'cancel', url: true, showAlways: true },
 | 
			
		||||
		{ name: 'save', url: '/monitoring/product', permission: '', showOnEdit: false },
 | 
			
		||||
		{ name: 'update', url: '/monitoring/product', permission: '', showOnEdit: true }
 | 
			
		||||
	],
 | 
			
		||||
	subtable: {
 | 
			
		||||
		// for i18n
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user