|
|
@@ -46,71 +46,93 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
- <!-- <template slot-scope="{ row }">
|
|
|
- <el-select
|
|
|
- @change="settype(row, $event)"
|
|
|
- v-model="row.type.code"
|
|
|
- placeholder="请选择"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in options.type"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </template> -->
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="content" label="内容" width="180">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <!-- 固定值 -->
|
|
|
- <el-input
|
|
|
- v-if="row.type.code == 3"
|
|
|
- v-model="row.content"
|
|
|
- placeholder="请输入内容"
|
|
|
- ></el-input>
|
|
|
- <!-- 日期 -->
|
|
|
- <el-select
|
|
|
- v-if="row.type.code == 1"
|
|
|
- v-model="row.content"
|
|
|
- placeholder="请选择"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in options.date"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'tableData.' + scope.$index + '.content'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '',
|
|
|
+ trigger: 'blur'
|
|
|
+ }"
|
|
|
+ v-if="scope.row.type.code!=2"
|
|
|
+ >
|
|
|
+ <!-- 固定值 -->
|
|
|
+ <el-input
|
|
|
+ v-if="scope.row.type.code == 3"
|
|
|
+ v-model="scope.row.content"
|
|
|
+ placeholder="请输入内容"
|
|
|
+ ></el-input>
|
|
|
+ <!-- 日期 -->
|
|
|
+ <el-select
|
|
|
+ v-if="scope.row.type.code == 1"
|
|
|
+ v-model="scope.row.content"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in options.date"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="length" label="长度">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-input
|
|
|
- v-if="row.type.code == 2"
|
|
|
- v-model="row.length"
|
|
|
- placeholder="请输入"
|
|
|
- ></el-input>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'tableData.' + scope.$index + '.length'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '',
|
|
|
+ trigger: 'blur'
|
|
|
+ }"
|
|
|
+ v-if="scope.row.type.code == 2"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.length"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="currentId" label="当前流水">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-input
|
|
|
- v-if="row.type.code == 2"
|
|
|
- v-model="row.currentId"
|
|
|
- placeholder="请输入"
|
|
|
- ></el-input>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'tableData.' + scope.$index + '.currentId'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '',
|
|
|
+ trigger: 'blur'
|
|
|
+ }"
|
|
|
+ v-if="scope.row.type.code == 2"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.currentId"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="step" label="步长">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-input
|
|
|
- v-if="row.type.code == 2"
|
|
|
- v-model="row.step"
|
|
|
- placeholder="请输入"
|
|
|
- ></el-input>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'tableData.' + scope.$index + '.step'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '',
|
|
|
+ trigger: 'blur'
|
|
|
+ }"
|
|
|
+ v-if="scope.row.type.code == 2"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.step"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="address" label="说明">
|
|
|
@@ -196,11 +218,11 @@
|
|
|
_delete () {
|
|
|
let selection = this.getSelection();
|
|
|
if (selection.length > 0) {
|
|
|
- let itemIndex = this.tableData.findIndex((n) => {
|
|
|
+ let itemIndex = this.form.tableData.findIndex((n) => {
|
|
|
return n.sort == selection[0].sort;
|
|
|
});
|
|
|
if (itemIndex !== -1) {
|
|
|
- this.tableData.splice(itemIndex, 1);
|
|
|
+ this.form.tableData.splice(itemIndex, 1);
|
|
|
this.againSort();
|
|
|
}
|
|
|
}
|
|
|
@@ -251,7 +273,19 @@
|
|
|
this.$refs.tableForm.validate((valid) => {
|
|
|
callback(valid);
|
|
|
});
|
|
|
+ },
|
|
|
+
|
|
|
+ // 清空表单校验
|
|
|
+ handleReset() {
|
|
|
+ this.$refs["tableForm"].resetFields();
|
|
|
+ this.form.tableData = []
|
|
|
+ },
|
|
|
+
|
|
|
+ // 返回列表数据
|
|
|
+ getTableValue(){
|
|
|
+ return this.form.tableData
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
</script>
|