Compare commits
3 Commits
d042fca3de
...
aabca97d1a
Author | SHA1 | Date |
---|---|---|
|
aabca97d1a | |
|
12e88f8475 | |
|
16c91c6ce6 |
|
@ -0,0 +1,88 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
title="添加线索"
|
||||
class="addDialog"
|
||||
v-model='dialogVisible'
|
||||
draggable
|
||||
align-center=true
|
||||
@close="onClose"
|
||||
>
|
||||
<el-container class="addForm">
|
||||
<el-form label-width="100px">
|
||||
<el-form-item v-for="(col, index) in addClueCols" :key="index" :label="col.col_name">
|
||||
<el-input v-model="formData['col_'+col.col_id]" :placeholder="'输入' + col.col_name"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-footer class="dialog-footer">
|
||||
<el-button @click="clickToCloseDialog">取 消</el-button>
|
||||
<el-button type="primary" @click="onSave">保 存</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name:'AddDialog',
|
||||
props: {
|
||||
visible:Boolean,
|
||||
addClueCols:Array,
|
||||
id:Number,
|
||||
tableId:String,
|
||||
},
|
||||
data() {
|
||||
return{
|
||||
formData:{},
|
||||
dialogVisible:false,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(value){
|
||||
this.dialogVisible = value;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
clickToCloseDialog(){
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
onClose(){
|
||||
this.formData = {};
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
onSave(){
|
||||
this.formData.clue_id = this.id;
|
||||
this.formData.delete_flag = 0;
|
||||
console.log('修改后: ',this.formData);
|
||||
this.$axios.post('http://localhost:8000/addOneClue/',
|
||||
{table_id:this.tableId,record:this.formData})
|
||||
.then(response=>{
|
||||
if(response.data.message == '添加成功'){
|
||||
this.$message({
|
||||
type:'success',
|
||||
message:'添加成功'
|
||||
});
|
||||
location.reload();
|
||||
}else if(response.data.message == '添加失败'){
|
||||
this.$message({
|
||||
typeof:'error',
|
||||
message:'添加失败,请重试!'
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(error=>{
|
||||
this.$handleNetError(error);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.addDialog{
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -43,6 +43,7 @@
|
|||
@confirm = 'handleSearchDialogConfirm'
|
||||
/>
|
||||
</el-button>
|
||||
|
||||
<el-button class = 'btnMore' @click="dochart">
|
||||
<el-tooltip content = '更多'>
|
||||
<el-icon><More /></el-icon>
|
||||
|
@ -78,6 +79,20 @@
|
|||
</el-table>
|
||||
</el-main>
|
||||
<!-- </el-main> -->
|
||||
<el-footer>
|
||||
<el-button class = 'btnPlus' @click="addOneClue">
|
||||
<el-tooltip content = '添加'>
|
||||
<el-icon><Plus /></el-icon>
|
||||
</el-tooltip>
|
||||
</el-button>
|
||||
<AddDialog
|
||||
ref="addDialog"
|
||||
:addClueCols="clueCols"
|
||||
:id="MaxId"
|
||||
:tableId="clueId"
|
||||
>
|
||||
</AddDialog>
|
||||
</el-footer>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
|
@ -108,6 +123,7 @@ window.ResizeObserver = class ResizeObserver extends _ResizeObserver{
|
|||
import ConstraintSearchDialog from "@/components/components_cluespage/ConstraintSearchDialog.vue"
|
||||
import EditDialog from "@/components/components_cluespage/EditDialog.vue"
|
||||
import HeaderPage from "@/views/HeaderPage.vue"
|
||||
import AddDialog from "@/components/components_cluespage/AddDialog.vue"
|
||||
import {ref} from 'vue'
|
||||
|
||||
export default{
|
||||
|
@ -115,7 +131,7 @@ export default{
|
|||
ConstraintSearchDialog,
|
||||
HeaderPage,
|
||||
EditDialog,
|
||||
|
||||
AddDialog,
|
||||
},
|
||||
name:'CluesPage',
|
||||
data(){
|
||||
|
@ -135,7 +151,7 @@ export default{
|
|||
return data;
|
||||
};
|
||||
|
||||
const clueCols = generateColumns(4); // 生成包含10列的列定义数组, 实际运行时可能需要注释掉,防止与data中的冲突
|
||||
const clueCols = generateColumns(20); // 生成包含10列的列定义数组, 实际运行时可能需要注释掉,防止与data中的冲突
|
||||
|
||||
// 生成10列的列定义数组
|
||||
function generateColumns(numCols) {
|
||||
|
@ -157,8 +173,10 @@ export default{
|
|||
{"merge":"OR","col_id":"4","type":"string","down":"","up":"","inside":"AAA","date":""} // 或者满足第1_4列(字符串),存在“AAA”这个连续字串的
|
||||
],
|
||||
// 显示当前页面的名称
|
||||
pageTitle,
|
||||
clueId,
|
||||
pageTitle, // 标题
|
||||
clueId, // 线索库ID
|
||||
MaxId:Number ,// 线索的最大Id
|
||||
addDialogVisible:false, // 添加线索库对话框是否显示
|
||||
chart:false,
|
||||
currentEditDataID: {},
|
||||
selectedColumnData :{},
|
||||
|
@ -296,12 +314,12 @@ export default{
|
|||
editClue(row){
|
||||
let editDataID = {
|
||||
table_id:this.clueId,
|
||||
clue_id:row.col_id
|
||||
clue_id:row.clue_id // clue_id,不要换
|
||||
};
|
||||
this.$refs.editDialog.dialogVisible = true; // 对话框是否可见
|
||||
this.$refs.editDialog.formData = this.formatFormData(row); // 表单数据
|
||||
this.currentEditDataID = editDataID;
|
||||
console.log(editDataID);
|
||||
console.log('editDataID',editDataID);
|
||||
},
|
||||
// 将数据格式化成表单数据
|
||||
formatFormData(row) {
|
||||
|
@ -314,6 +332,11 @@ export default{
|
|||
|
||||
return formData;
|
||||
},
|
||||
// 添加一条线索记录
|
||||
addOneClue(){
|
||||
this.$refs.addDialog.dialogVisible = true; // 打开添加对话框
|
||||
this.MaxId = this.clueData.length + 1;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
cols(){
|
||||
|
|
Loading…
Reference in New Issue