|
@@ -4,17 +4,22 @@
|
|
|
<div v-for="(titem, tkey) in inputTypeList" :key="tkey">
|
|
|
<h4>{{ tkey }}</h4>
|
|
|
<el-form-item v-for="(item, key) in titem" :key="key" :label="item.name" class="input-item">
|
|
|
- <el-input v-model="item.inputValue" v-if="item.inputMode == 'A1'|| item.inputMode == 'A2'" type="number">
|
|
|
- <template slot="append" v-if="item.Unit">{{item.Unit}}</template>
|
|
|
- </el-input>
|
|
|
- <el-input v-model="item.inputValue" v-else-if="item.inputMode == 'B1' || item.inputMode == 'L' || item.inputMode == 'M'"></el-input>
|
|
|
- <el-select v-model="item.inputValue" v-else-if="item.inputMode == 'D1'" placeholder="请选择">
|
|
|
- <el-option v-for="(soption,skey) in item.options" :key="skey" :label="soption.name" :value="soption.code">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- <el-cascader v-model="item.inputValue" v-else-if="item.inputMode == 'D1L'" placeholder="请在台账中维护该类型信息点"
|
|
|
- :props="item.props" :options="item.options" filterable clearable disabled :show-all-levels="false"></el-cascader>
|
|
|
- <el-input v-model="item.inputValue" v-else disabled placeholder="请在台账中维护该类型信息点"></el-input>
|
|
|
+ <template v-if="item.category=='STATIC'">
|
|
|
+ <el-input v-model="item.inputValue" v-if="item.dataType == dataTypeMap.DOUBLE || item.dataType == dataTypeMap.INTEGER" type="number">
|
|
|
+ <template slot="append" v-if="item.Unit">{{item.Unit}}</template>
|
|
|
+ </el-input>
|
|
|
+ <el-input v-model="item.inputValue" v-else-if="item.dataType == dataTypeMap.STRING"></el-input>
|
|
|
+ <el-select v-model="item.inputValue" v-else-if="item.dataType == dataTypeMap.ENUM || item.dataType == dataTypeMap.BOOLEAN" placeholder="请选择">
|
|
|
+ <el-option v-for="(soption,skey) in item.options" :key="skey" :label="soption.name" :value="soption.code">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-cascader v-model="item.inputValue" v-else-if="item.dataType == dataTypeMap.MENUM" placeholder="请在台账中维护该类型信息点"
|
|
|
+ :props="item.props" :options="item.options" filterable clearable disabled :show-all-levels="false"></el-cascader>
|
|
|
+ <el-input v-model="item.inputValue" v-else disabled placeholder="请在台账中维护该类型信息点"></el-input>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-input v-model="item.inputValue"></el-input>
|
|
|
+ </template>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
</el-form>
|
|
@@ -23,12 +28,14 @@
|
|
|
|
|
|
<script>
|
|
|
import tools from "@/utils/scan/tools";
|
|
|
+import dataTypeMap from "@/utils/handsontable/dataTypeMap"
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
form: {},
|
|
|
inputTypeList: {},//输入框表头种类
|
|
|
inputData: [],//所有输入框
|
|
|
+ dataTypeMap: dataTypeMap
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
@@ -37,8 +44,7 @@ export default {
|
|
|
type: String
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- },
|
|
|
+ created() { },
|
|
|
methods: {
|
|
|
//初始化
|
|
|
init(val) {
|
|
@@ -53,50 +59,46 @@ export default {
|
|
|
this.inputData = this.inputData.filter(item => {
|
|
|
return item.editable == true && item.visible == true && item.code;
|
|
|
})
|
|
|
- let numbersInput = ['A1', 'A2'];
|
|
|
- let stringInput = ['B1', 'L', 'M'];
|
|
|
- let arrayInput = ['D1'];
|
|
|
- let cascaderInput = ['D1L'];
|
|
|
this.inputData.map(item => {
|
|
|
- if (numbersInput.indexOf(item.inputMode) != -1) {
|
|
|
- item.inputValue = null;
|
|
|
- }
|
|
|
- else if (stringInput.indexOf(item.inputMode) != -1) {
|
|
|
- item.inputValue = '';
|
|
|
- }
|
|
|
- else if (arrayInput.indexOf(item.inputMode) != -1) {
|
|
|
- let options;
|
|
|
- if (item.dataSource instanceof Array) {
|
|
|
- options = item.dataSource;
|
|
|
- } else {
|
|
|
- options = JSON.parse(item.dataSource)
|
|
|
- }
|
|
|
- item.inputValue = '';
|
|
|
- item.options = options;
|
|
|
- }
|
|
|
- else if(cascaderInput.indexOf(item.inputMode) != -1){
|
|
|
- let options;
|
|
|
- if (item.dataSource) {
|
|
|
+ if (item.category == 'STATIC') {
|
|
|
+ if (item.dataType == dataTypeMap.DOUBLE || item.dataType == dataTypeMap.INTEGER) {
|
|
|
+ item.inputValue = null;
|
|
|
+ } else if (item.dataType == dataTypeMap.STRING) {
|
|
|
+ item.inputValue = '';
|
|
|
+ } else if (item.dataType == dataTypeMap.ENUM || item.dataType == dataTypeMap.BOOLEAN) {
|
|
|
+ let options;
|
|
|
if (item.dataSource instanceof Array) {
|
|
|
options = item.dataSource;
|
|
|
} else {
|
|
|
options = JSON.parse(item.dataSource)
|
|
|
}
|
|
|
- } else {
|
|
|
- options = []
|
|
|
- }
|
|
|
- if (options[0] && options[0].content) {
|
|
|
- item.props = {
|
|
|
- value: 'code',
|
|
|
- label: 'name',
|
|
|
- children: 'content',
|
|
|
- checkStrictly: true
|
|
|
+ item.inputValue = '';
|
|
|
+ item.options = options;
|
|
|
+ } else if(item.dataType == dataTypeMap.MENUM){
|
|
|
+ let options;
|
|
|
+ if (item.dataSource) {
|
|
|
+ if (item.dataSource instanceof Array) {
|
|
|
+ options = item.dataSource;
|
|
|
+ } else {
|
|
|
+ options = JSON.parse(item.dataSource)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ options = []
|
|
|
+ }
|
|
|
+ if (options[0] && options[0].content) {
|
|
|
+ item.props = {
|
|
|
+ value: 'code',
|
|
|
+ label: 'name',
|
|
|
+ children: 'content',
|
|
|
+ checkStrictly: true
|
|
|
+ }
|
|
|
}
|
|
|
+ item.options = options;
|
|
|
+ item.inputValue = [];
|
|
|
+ } else {
|
|
|
+ item.inputValue = '';
|
|
|
}
|
|
|
- item.options = options;
|
|
|
- item.inputValue = [];
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
item.inputValue = '';
|
|
|
}
|
|
|
});
|