|
@@ -4,6 +4,8 @@
|
|
|
:visible.sync="dialogVisible"
|
|
|
width="70%"
|
|
|
append-to-body
|
|
|
+ :close-on-click-modal="false"
|
|
|
+
|
|
|
>
|
|
|
|
|
|
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
|
|
@@ -60,19 +62,27 @@
|
|
|
<el-table-column label="数据填充">
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="scope.row.isEdit">
|
|
|
- <el-input v-model="scope.row.data" placeholder="输入生成编号时包含的固定字符" v-if="scope.row.rule===1"></el-input>
|
|
|
+ <el-input v-model="scope.row.data" placeholder="*输入生成编号时包含的固定字符" v-if="scope.row.rule===1"></el-input>
|
|
|
<el-input v-model="scope.row.data" placeholder="*自动获取当前合同段编号" v-if="scope.row.rule===2" disabled></el-input>
|
|
|
<el-input v-model="scope.row.data" placeholder="*自动获取各试验参数掩码" v-if="scope.row.rule===3" disabled></el-input>
|
|
|
<el-input v-model="scope.row.data" placeholder="*自动获取当前年份" v-if="scope.row.rule===4" disabled></el-input>
|
|
|
<el-input v-model="scope.row.data" placeholder="*自动获取当前月份" v-if="scope.row.rule===5" disabled></el-input>
|
|
|
<el-input
|
|
|
- v-model="scope.row.data"
|
|
|
- v-if="scope.row.rule === 6"
|
|
|
- @input="scope.row.data = scope.row.data.replace(/[^0-9]/g, '')"></el-input>
|
|
|
+ v-model="scope.row.data"
|
|
|
+ v-if="scope.row.rule === 6"
|
|
|
+ @input="scope.row.data = scope.row.data.replace(/[^0-9]/g, '')"></el-input>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
- <span v-else>{{ scope.row.data }}</span>
|
|
|
+ <!-- <span v-else>{{ scope.row.data }}</span> -->
|
|
|
+ <div v-else>
|
|
|
+ <span v-if="scope.row.rule===1">*输入生成编号时包含的固定字符</span>
|
|
|
+ <span v-if="scope.row.rule===2">*自动获取当前合同段编号</span>
|
|
|
+ <span v-if="scope.row.rule===3">*自动获取各试验参数掩码</span>
|
|
|
+ <span v-if="scope.row.rule===4">*自动获取当前年份</span>
|
|
|
+ <span v-if="scope.row.rule===5">*自动获取当前月份</span>
|
|
|
+ <span v-if="scope.row.rule===6">*{{ scope.row.data }}</span>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
@@ -165,12 +175,15 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
-
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="saveCodeSet" :loading="saveCodeLoad">确 定</el-button>
|
|
|
+ </span>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {getTrialNumberRule,save,update,remove,sort } from "@/api/ruleManage/codeRule.js";
|
|
|
+import {getTrialNumberRule,save,update,remove,sort,submitList } from "@/api/ruleManage/codeRule.js";
|
|
|
import { getDictionary } from "@/api/system/dict";
|
|
|
export default {
|
|
|
name: 'FileRuleDialog',
|
|
@@ -178,7 +191,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
projectId: '',
|
|
|
-
|
|
|
+ saveCodeLoad: false,
|
|
|
dialogVisible: false,
|
|
|
loading: false,
|
|
|
tableData: [],
|
|
@@ -349,32 +362,57 @@ export default {
|
|
|
this.$message.warning('请选择规则!')
|
|
|
return;
|
|
|
}
|
|
|
- row.loading = true;
|
|
|
- const apiMethod = row.id ? update : save;
|
|
|
- const params = {
|
|
|
- ...row,
|
|
|
- type: this.activeName,
|
|
|
- projectId: this.projectId,
|
|
|
- contractId: 0
|
|
|
- };
|
|
|
+ row.isEdit = false;
|
|
|
+ // row.loading = true;
|
|
|
+ // const apiMethod = row.id ? update : save;
|
|
|
+ // const params = {
|
|
|
+ // ...row,
|
|
|
+ // type: this.activeName,
|
|
|
+ // projectId: this.projectId,
|
|
|
+ // contractId: 0
|
|
|
+ // };
|
|
|
|
|
|
- apiMethod(params).then((res) => {
|
|
|
- if (res.data.code === 200) {
|
|
|
- this.dataNumber = res.data.data;
|
|
|
- this.$message.success(res.data.msg);
|
|
|
- this.getTableData();
|
|
|
- } else {
|
|
|
- this.dataNumber = '';
|
|
|
- this.$message.error(res.data.msg);
|
|
|
+ // apiMethod(params).then((res) => {
|
|
|
+ // if (res.data.code === 200) {
|
|
|
+ // this.dataNumber = res.data.data;
|
|
|
+ // this.$message.success(res.data.msg);
|
|
|
+ // this.getTableData();
|
|
|
+ // } else {
|
|
|
+ // this.dataNumber = '';
|
|
|
+ // this.$message.error(res.data.msg);
|
|
|
+ // }
|
|
|
+ // }).catch(() => {
|
|
|
+ // this.$message.error('操作失败');
|
|
|
+ // }).finally(() => {
|
|
|
+ // row.loading = false;
|
|
|
+ // row.isEdit = false;
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ saveCodeSet(){
|
|
|
+ for (let row of this.tableData) {
|
|
|
+ // 检查 row.rule 是否有值
|
|
|
+ if (!row.rule) {
|
|
|
+ // 显示警告信息
|
|
|
+ this.$message.warning('请选择规则!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error('操作失败');
|
|
|
- }).finally(() => {
|
|
|
- row.loading = false;
|
|
|
- row.isEdit = false;
|
|
|
- });
|
|
|
+ this.saveCodeLoad = true;
|
|
|
+ submitList(this.tableData).then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ this.dataNumber = res.data.data;
|
|
|
+ this.$message.success(res.data.msg);
|
|
|
+ this.getTableData();
|
|
|
+ } else {
|
|
|
+ this.dataNumber = '';
|
|
|
+ this.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error('操作失败');
|
|
|
+ }).finally(() => {
|
|
|
+ this.saveCodeLoad = false;
|
|
|
+ });
|
|
|
},
|
|
|
-
|
|
|
handleDelete(index, row) {
|
|
|
if(!row.id) {
|
|
|
this.tableData.splice(index, 1)
|