|
|
@@ -0,0 +1,169 @@
|
|
|
+<template>
|
|
|
+ <div class="InvoicedAndSettled" style="width: 99%; margin-top: 0px">
|
|
|
+ <templateTable ref="templateTable" :tableConfig="tableConfig" :data="tableData"
|
|
|
+ :btnGroup="btnGroup" :formList="formList" @handleSearchList="handleSearchList"
|
|
|
+ @findPage="findPage" @getList="findPage" :pagination="pageData">
|
|
|
+ </templateTable>
|
|
|
+
|
|
|
+ <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="50%" :before-close="handleClose">
|
|
|
+ <el-form ref="form" :model="formAdd" label-width="130px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="项目名称">
|
|
|
+ <el-input v-model="formAdd.projectName" class="inputType"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="项目类型">
|
|
|
+ <el-select v-model="formAdd.projectType" placeholder="请选择">
|
|
|
+ <el-option label="产品型项目" value="1"></el-option>
|
|
|
+ <el-option label="项目型项目" value="2"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="项目描述">
|
|
|
+ <el-input v-model="formAdd.projectDesc" class="inputType"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="addSubmit">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import templateTable from '@/components/TemplateTable/index.vue'
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ templateTable
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ tableData:[],
|
|
|
+ tableConfig: {
|
|
|
+ columns: [
|
|
|
+ { prop: "projectName", label: "项目名称", type: "text"},
|
|
|
+ { prop: "projectDesc", label: "项目描述", type: "text" },
|
|
|
+ { prop: "projectType", label: "项目类型", type: "statMap", options:[{ label: "产品型项目 ", value: "1", }, { label: "项目型项目", value: "2", }]},
|
|
|
+ { prop: "creator", label: "创建人", type: "text" },
|
|
|
+ { prop: "createTime", label: "创建时间", type: "text" },
|
|
|
+ ],
|
|
|
+ isPaginationShow:true,
|
|
|
+ loading: true,
|
|
|
+ tableHeight: 'auto',
|
|
|
+ optBtns:[
|
|
|
+ { type:'primary', label:'编辑', click:(row, index) => {return this.haldUpload(row)}},
|
|
|
+ { type:'primary', label:'删除', click:(row, index) => {return this.haldDelete(row)}},
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ pageData: { pageNum: 1, pageSize: 20},
|
|
|
+ btnGroup: [
|
|
|
+ { name:'新增', click:() => {return this.newAdd()}, },
|
|
|
+ ],
|
|
|
+ formList: [
|
|
|
+ { label: "项目名称", prop: "projectName", type: "input", },
|
|
|
+ { prop: "projectType", label: "项目类型", type: "select", options:[{ label: "产品型项目 ", value: "1", }, { label: "项目型项目", value: "2", }]},
|
|
|
+ ],
|
|
|
+ dialogVisible: false,
|
|
|
+ formAdd: {},
|
|
|
+ dialogTitle: '新增',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.findPage();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ findPage(data) {
|
|
|
+ this.$api.task.selectProject({...this.pageData, ...data}).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.tableData = res.data.records
|
|
|
+ this.pageData.pageNum = res.data.current
|
|
|
+ this.pageData.pageSize = res.data.size
|
|
|
+ this.pageData.totalSize = res.data.total
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ this.tableConfig.loading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSearchList(data) {
|
|
|
+ this.findPage(data);
|
|
|
+ },
|
|
|
+ addSubmit() {
|
|
|
+ console.log(this.formAdd)
|
|
|
+ if (this.dialogTitle == '新增') {
|
|
|
+ this.$api.task.addProject(this.formAdd).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ this.findPage()
|
|
|
+ this.handleClose()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$api.task.updateProject(this.formAdd).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ this.findPage()
|
|
|
+ this.handleClose()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ newAdd() {
|
|
|
+ this.dialogTitle = '新增'
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ haldUpload(row) {
|
|
|
+ this.dialogTitle = '编辑'
|
|
|
+ this.dialogVisible = true
|
|
|
+ this.formAdd = {
|
|
|
+ projectName: row.projectName,
|
|
|
+ projectType: row.projectType,
|
|
|
+ projectDesc: row.projectDesc,
|
|
|
+ id: row.id
|
|
|
+ }
|
|
|
+ },
|
|
|
+ haldDelete(row) {
|
|
|
+ this.$confirm('确认是否删除?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$api.task.removeProject({
|
|
|
+ id: row.id
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ this.findPage()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error('已取消删除')
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.formAdd = {
|
|
|
+ projectType: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+ .InvoicedAndSettled>>>.el-table__body-wrapper {
|
|
|
+ overflow-y: auto !important;
|
|
|
+ height: auto !important;
|
|
|
+ }
|
|
|
+</style>
|