diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue
index 971d78b..b3e1a9f 100644
--- a/src/components/base-dialog/addOrUpdate/index.vue
+++ b/src/components/base-dialog/addOrUpdate/index.vue
@@ -11,20 +11,10 @@
:label="getLabel(n, c)"
>
-
+
-
+
@@ -129,7 +119,8 @@ export default {
remark: '备注',
specifications: '规格'
// add more...
- }
+ },
+ defaultPlaceholders: {} // 自动根据 defaultNames 计算得来
}
},
computed: {
@@ -139,8 +130,14 @@ export default {
}
},
mounted() {
+ /** 计算 defaultPlaceholders */
+ const prefix = '请输入'
+ Object.entries(this.defaultNames).map(([key, value]) => {
+ this.defaultPlaceholders[key] = prefix + value
+ })
+
+ /** 转换 configs.fields 的结构,把纯字符串转为对象 */
this.$nextTick(() => {
- /** 转换 configs.fields 的结构,把纯字符串转为对象 */
this.configs.fields = this.configs.fields.map(item => {
if (typeof item === 'string') {
return { name: item }
@@ -234,6 +231,13 @@ export default {
return opt.label ? opt.label : this.defaultNames[opt.name]
}
},
+ getPlaceholder(n, c) {
+ const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
+ if (opt) {
+ // if opt is valid
+ return opt.placeholder ? opt.placeholder : this.defaultPlaceholders[opt.name]
+ }
+ },
getType(n, c) {
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
if (opt) {
@@ -251,17 +255,18 @@ export default {
this.visible = true
},
handleClick(btn) {
- this.$refs['dataForm'].validate(valid => {
- if (valid) {
- /** 提取url */
- const urls = {}
- this.configs.operations.map(item => {
- urls[item.name] = item.url
- })
- /** 操作 */
- switch (btn.name) {
- case 'save':
- case 'update':
+ /** 提取url */
+ const urls = {}
+ this.configs.operations.map(item => {
+ urls[item.name] = item.url
+ })
+ /** 操作 */
+ switch (btn.name) {
+ case 'save':
+ case 'update':
+ /** 需要验证表单的操作 */
+ this.$refs['dataForm'].validate(valid => {
+ if (valid) {
this.$http({
url: this.$http.adornUrl(urls[btn.name]),
method: btn.name === 'save' ? 'POST' : 'PUT',
@@ -279,23 +284,23 @@ export default {
})
}
})
- return
- case 'reset':
- for (const key of Object.keys(this.dataForm)) {
- if (typeof this.dataForm[key] === 'string') {
- this.dataForm[key] = ''
- } else if (this.dataForm[key] instanceof Array) {
- this.dataForm[key].splice(0)
- } else {
- this.dataForm[key] = null
- }
- }
- console.log('after reset: ', JSON.stringify(this.dataForm))
- break
- // add more..
+ }
+ })
+ return
+ case 'reset':
+ for (const key of Object.keys(this.dataForm)) {
+ if (typeof this.dataForm[key] === 'string') {
+ this.dataForm[key] = ''
+ } else if (this.dataForm[key] instanceof Array) {
+ this.dataForm[key].splice(0)
+ } else {
+ this.dataForm[key] = null
+ }
}
- }
- })
+ console.log('after reset: ', JSON.stringify(this.dataForm))
+ break
+ // add more..
+ }
},
handleClose() {
if (this.isAdd || this.isUpdated) this.$emit('refreshDataList')
diff --git a/src/utils/request.js b/src/utils/request.js
index 74202e6..7a81e32 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -97,6 +97,7 @@ http.adornData = (data = {}, openDefaultdata = true, contentType = 'json') => {
}
data = openDefaultdata ? merge(defaults, data) : data
return contentType === 'json' ? JSON.stringify(data) : qs.stringify(data)
+ // return contentType === 'json' ? JSON.stringify(data, (_, v) => typeof v === 'bigint' ? v.toString() : v) : qs.stringify(data)
}
diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue
index 8032eae..22e394e 100644
--- a/src/views/modules/monitoring/product.vue
+++ b/src/views/modules/monitoring/product.vue
@@ -141,6 +141,7 @@ const addOrUpdateConfigs = {
name: 'unitDictValue',
label: '单位',
type: 'select',
+ // placeholder: '请选择单位',
options: [
// 动态获取
]
@@ -265,6 +266,7 @@ export default {
deleteHandle(id) {
var ids = id
? [id]
+ // ? [1556817256347828335]
: this.dataListSelections.map(item => {
return item.id
})