Browse Source

修改 配置修改和修改数据

Qukatie 8 months ago
parent
commit
806a2ccd7f

+ 5 - 2
src/views/serviceConfiguration/configurationModification/detailsPage.vue

@@ -27,6 +27,9 @@
                             @click="addRow()">
                         </el-button>
                     </template>
+                    <template slot="index" slot-scope="{row,index}">
+                        <span>{{ index + 1 }}</span>
+                    </template>
                     <template slot-scope="{row,index}" slot="menu">
                         <el-button size="small" type="text" icon="el-icon-edit" @click.stop="rowEdit(row)">编 辑
                         </el-button>
@@ -146,7 +149,7 @@ export default {
                         rules: [
                             {
                                 required: true,
-                                message: '请选择商品类别',
+                                message: '',
                                 trigger: 'blur'
                             }
                         ]
@@ -160,7 +163,7 @@ export default {
                         rules: [
                             {
                                 required: true,
-                                message: '请选择商品类别',
+                                message: '',
                                 trigger: 'blur'
                             }
                         ]

+ 7 - 2
src/views/serviceConfiguration/configurationModification/index.vue

@@ -12,9 +12,9 @@
                     </el-button>
                 </template>
                 <template slot-scope="{row}" slot="menu">
-                    <el-button type="text" icon="el-icon-edit" @click.stop="rowEdit(row)">编 辑
+                    <el-button type="text" size="small"  icon="el-icon-edit" @click.stop="rowEdit(row)">编 辑
                     </el-button>
-                    <el-button type="text" icon="el-icon-edit" @click.stop="rowDel(row)">删 除
+                    <el-button type="text" size="small"  icon="el-icon-edit" @click.stop="rowDel(row)">删 除
                     </el-button>
                 </template>
             </avue-crud>
@@ -54,11 +54,13 @@ export default {
                 searchMenuSpan: 12,
                 border: true,
                 index: true,
+                indexFixed:false,
                 addBtn: false,
                 viewBtn: false,
                 editBtn: false,
                 delBtn: false,
                 selection: true,
+                selectionFixed:false,
                 searchIcon: true,
                 align: 'center',
                 searchIndex: 3,
@@ -118,6 +120,9 @@ export default {
         this.option = await this.getColumnData(this.getColumnName(416), this.optionBack)
     },
     activated() {
+        this.$nextTick(() => {
+            this.$refs.crud.doLayout();
+        });
     },
     methods: {
         addButton() {

+ 90 - 20
src/views/serviceConfiguration/modifyData/detailsPage.vue

@@ -7,8 +7,10 @@
                 </el-button>
             </div>
             <div class="add-customer-btn">
+                <el-button class="el-button--small-yh" style="margin-left: 6px;" size="small" @click="submit">提 交
+                </el-button>
                 <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
-                    @click="submit">保 存
+                    @click="save" :disabled="form.approvalStatus=='审核提交'">保 存
                 </el-button>
             </div>
         </div>
@@ -16,8 +18,9 @@
             <trade-card title="基础信息">
                 <avue-form :option="optionForm" v-model="form" ref="form">
                     <template slot="menuForm">
-                        <el-button icon="el-icon-search" type="primary" @click="searchChange">获取配置信息</el-button>
-                        <el-button icon="el-icon-search" type="success" :disabled="data.length == 0"
+                        <el-button icon="el-icon-search" type="primary" :disabled="data.length > 0||form.approvalStatus=='审核提交'"
+                            @click="searchChange">获取配置信息</el-button>
+                        <el-button icon="el-icon-search" type="success" :disabled="data.length == 0||form.approvalStatus=='审核提交'"
                             @click="getData">获取原始信息</el-button>
                     </template>
                 </avue-form>
@@ -29,9 +32,9 @@
                     @saveColumn="saveColumn('crud', 'option', 'optionBack', 415)">
                     <template slot-scope="{type,size,row,index}" slot="menu">
                         <el-button size="small" type="text" icon="el-icon-edit"
-                            @click.stop="$refs.crud.rowEdit(row, index)">编 辑
+                            @click.stop="$refs.crud.rowEdit(row, index)" :disabled="form.approvalStatus=='审核提交'">编 辑
                         </el-button>
-                        <el-button size="small" icon="el-icon-delete" type="text" @click.stop="rowDel(row, index)">删
+                        <el-button size="small" icon="el-icon-delete" type="text" @click.stop="rowDel(row, index)" :disabled="form.approvalStatus=='审核提交'">删
                             除</el-button>
                     </template>
                     <template slot-scope="{type,disabled}" slot="fieldValueNewNameForm">
@@ -39,7 +42,7 @@
                             v-model="rowFrom.fieldValueNewName"></el-input>
                         <dic-select v-if="rowFrom.fieldValueType == '选择器'" v-model="rowFrom.fieldValueNewName" key="id"
                             res="records" :label="rowFrom.fieldValueRetrieval" :url="rowFrom.fieldValueUrl"
-                            :filterable="true" :remote="true" :dataName="rowFrom.fieldValueRetrieval"
+                            :filterable="true" :remote="true" :dataName="rowFrom.fieldValueRetrieval" placeholder=""
                             @selectChange="dicChange(rowFrom.fieldValueNewName, $event)"></dic-select>
                     </template>
                 </avue-crud>
@@ -167,8 +170,10 @@ export default {
                 delBtn: false,
                 refreshBtn: false,
                 selection: true,
+                selectionFixed: false,
                 align: 'center',
                 index: true,
+                indexFixed: false,
                 column: [
                     {
                         label: "更改时间",
@@ -187,11 +192,26 @@ export default {
                         prop: "fieldValueName",
                         overHidden: true,
                         editDisplay: false,
+                        rules: [
+                            {
+                                required: true,
+                                message: '',
+                                trigger: 'blur'
+                            }
+                        ]
                     },
                     {
                         label: "字段新值",
                         prop: "fieldValueNewName",
+                        span: 24,
                         overHidden: true,
+                        rules: [
+                            {
+                                required: true,
+                                message: '',
+                                trigger: 'blur'
+                            }
+                        ]
                     }
                 ]
             },
@@ -211,6 +231,10 @@ export default {
         this.roleName = localStorage.getItem('roleName').split(',')
         this.saberUserInfo = JSON.parse(localStorage.getItem("saber-userInfo")).content
         this.option = await this.getColumnData(this.getColumnName(415), this.optionBack);
+        if (this.$route.query.billId) {
+            this.getDetails(this.$route.query.billId)
+        }
+        console.log(this.detailData.id,123123)
         if (this.detailData.id) {
             this.getDetails(this.detailData.id)
         }
@@ -231,15 +255,19 @@ export default {
             this.$refs["form"].validate((valid, done) => {
                 done();
                 if (valid) {
-                    getItemDetail(this.form).then(res => {
-                        let obj=res.data.data
-                        this.data.forEach(row=>{
-                            if(row.fieldValueType=='选择器'){
-                                row.fieldValue=obj[row.mainFieldId]
-                                row.fieldValueName=obj[row.mainFieldCname]
-                            }else{
-                                row.fieldValue=obj[row.fieldDescribe]
-                                row.fieldValueName=obj[row.fieldDescribe]
+                    let obj = {
+                        ...this.form
+                    }
+                    delete obj.updateItemList
+                    getItemDetail(obj).then(res => {
+                        let obj = res.data.data
+                        this.data.forEach(row => {
+                            if (row.fieldValueType == '选择器') {
+                                row.fieldValue = obj[row.mainFieldId]
+                                row.fieldValueName = obj[row.mainFieldCname]
+                            } else {
+                                row.fieldValue = obj[row.field]
+                                row.fieldValueName = obj[row.field]
                             }
                         })
                     })
@@ -283,31 +311,73 @@ export default {
             });
             getDetail({ id: id }).then(res => {
                 this.form = res.data.data
+                this.data = res.data.data.updateItemList
+                if(res.data.data.approvalStatus=="审核提交"){
+                    this.optionForm.disabled=true
+                }
             }).finally(() => {
                 loading.close()
             })
         },
         inEdit() {
         },
-        submit(type) {
+        save(type) {
             this.$refs["form"].validate((valid, done) => {
                 done();
                 if (valid) {
-                    if (this.$refs.feeInfo.submitValidate()) {
+                    const loading = this.$loading({
+                        lock: true,
+                        text: '加载中',
+                        spinner: 'el-icon-loading',
+                        background: 'rgba(255,255,255,0.7)'
+                    });
+                    this.form.updateItemList = this.data
+                    submit(this.form).then(res => {
+                        this.$message.success("保存成功");
+                        this.getDetails(res.data.data.id)
+                    }).finally(() => {
+                        loading.close();
+                    })
+                } else {
+                    return false;
+                }
+            });
+        },
+        submit() {
+            this.$refs["form"].validate((valid, done) => {
+                done();
+                if (valid) {
+                    for (let row of this.data) {
+                        if (!row.fieldValueName || !row.fieldValueNewName) {
+                            this.$refs.crud.rowCell(row, row.$index)
+                            return this.$message.error("请完善字段明细");
+                        }
+                    }
+                    this.$confirm('是否提交数据?', '提示', {
+                        confirmButtonText: '确定',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    }).then(() => {
+                        let obj = {
+                            ...this.form,
+                            updateItemList: this.data,
+                            url: '/serviceConfiguration/modifyData/index',
+                            pageStatus: '',
+                            pageLabel: '修改数据',
+                        }
                         const loading = this.$loading({
                             lock: true,
                             text: '加载中',
                             spinner: 'el-icon-loading',
                             background: 'rgba(255,255,255,0.7)'
                         });
-                        this.form.businessDate = this.form.contractDate
-                        submit(this.form).then(res => {
+                        checkUpdate(obj).then(res => {
                             this.$message.success("保存成功");
                             this.getDetails(res.data.data.id)
                         }).finally(() => {
                             loading.close();
                         })
-                    }
+                    })
 
                 } else {
                     return false;

+ 12 - 2
src/views/serviceConfiguration/modifyData/index.vue

@@ -20,9 +20,9 @@
                     </el-button>
                 </template>
                 <template slot-scope="{row}" slot="menu">
-                    <el-button type="text" icon="el-icon-edit" @click.stop="rowEdit(row)">编 辑
+                    <el-button type="text" size="small" icon="el-icon-edit" @click.stop="rowEdit(row)">编 辑
                     </el-button>
-                    <el-button type="text" icon="el-icon-edit" @click.stop="rowDel(row)">删 除
+                    <el-button type="text" size="small" icon="el-icon-edit" @click.stop="rowDel(row)" :disabled="row.approvalStatus=='审核提交'">删 除
                     </el-button>
                 </template>
             </avue-crud>
@@ -62,11 +62,13 @@ export default {
                 searchMenuSpan: 12,
                 border: true,
                 index: true,
+                indexFixed: false,
                 addBtn: false,
                 viewBtn: false,
                 editBtn: false,
                 delBtn: false,
                 selection: true,
+                selectionFixed: false,
                 searchIcon: true,
                 align: 'center',
                 searchIndex: 3,
@@ -132,6 +134,14 @@ export default {
         this.option = await this.getColumnData(this.getColumnName(414), this.optionBack)
     },
     activated() {
+        setTimeout(() => {
+            if (this.$route.query.billId) {
+                this.isShow = false
+            }
+        }, 100);
+        this.$nextTick(() => {
+            this.$refs.crud.doLayout();
+        });
     },
     methods: {
         handleClick(tab, event) {