|
@@ -17,15 +17,15 @@
|
|
|
<el-select v-model="value" placeholder="请选择" style="width: 100%;">
|
|
|
<el-option
|
|
|
v-for="item in options"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.label">
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.paramName"
|
|
|
+ :value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row style="text-align: right">
|
|
|
- <el-button type="primary" size="small" icon="el-icon-circle-plus-outline" @click="addList">添加至列表</el-button>
|
|
|
+ <el-row style="text-align: center;margin-top: 15px;">
|
|
|
+ <el-button type="primary" size="small" icon="el-icon-circle-plus-outline" @click="addList">保存入库</el-button>
|
|
|
</el-row>
|
|
|
<el-row style="margin-top: 15px;">
|
|
|
<el-table
|
|
@@ -34,72 +34,78 @@
|
|
|
style="width: 100%">
|
|
|
<el-table-column
|
|
|
fixed
|
|
|
- prop="site"
|
|
|
+ prop="elementName"
|
|
|
label="元素位置"
|
|
|
- width="150">
|
|
|
+ >
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="name"
|
|
|
+ prop="paramName"
|
|
|
label="参数名称"
|
|
|
- width="120">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="isGlobal"
|
|
|
- label="是否全局参数"
|
|
|
- width="120">
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- fixed="right"
|
|
|
- label="操作"
|
|
|
>
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-link @click="editClick(scope.$index,scope.row)" type="primary" size="small" style="margin-right: 4px;" v-if="!scope.row.isEdit">编辑</el-link>
|
|
|
- <el-link @click="saveClick(scope.$index,scope.row)" type="primary" size="small" style="margin-right: 4px;" v-else>保存</el-link>
|
|
|
- <el-link type="danger" size="small" @click="delRow(scope.$index,scope.row)">删除</el-link>
|
|
|
- </template>
|
|
|
</el-table-column>
|
|
|
+
|
|
|
+
|
|
|
</el-table>
|
|
|
</el-row>
|
|
|
- <el-row style="margin-top: 15px;text-align: right">
|
|
|
- <el-button type="primary" size="small" icon="el-icon-circle-plus-outline" @click="saveType()">保存入库</el-button>
|
|
|
- </el-row>
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { dictionary, saveInput, getColByTabId } from "@/api/manager/AdjustForm";
|
|
|
-import { getExcelHtml } from '@/api/exctab/excelmodel'
|
|
|
-import { save } from "../../../../../api/certificate/list";
|
|
|
+
|
|
|
+import {checkParamElement } from '@/api/exctab/exceltab'
|
|
|
+
|
|
|
+import { queryParameterList,submitElement } from "@/api/paramter/parmter.js";
|
|
|
export default {
|
|
|
- props: ['pkeyId', 'htmlData'],
|
|
|
+ props: ['pkeyId1', 'htmlData'],
|
|
|
|
|
|
|
|
|
|
|
|
data() {
|
|
|
return {
|
|
|
- options: [{
|
|
|
- value: '选项1',
|
|
|
- label: '黄金糕'
|
|
|
- }, {
|
|
|
- value: '选项2',
|
|
|
- label: '双皮奶'
|
|
|
- }, {
|
|
|
- value: '选项3',
|
|
|
- label: '蚵仔煎'
|
|
|
- }, {
|
|
|
- value: '选项4',
|
|
|
- label: '龙须面'
|
|
|
- }, {
|
|
|
- value: '选项5',
|
|
|
- label: '北京烤鸭'
|
|
|
- }],
|
|
|
+ options: [],
|
|
|
value: '',
|
|
|
- tableData: []
|
|
|
+ tableData: [],
|
|
|
+ projectId:''
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.projectId = this.$route.query.pid;
|
|
|
+ this.getOptionData();
|
|
|
+ this.getTableData()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ getOptionData () {
|
|
|
+ queryParameterList({
|
|
|
+ current: 1,
|
|
|
+ size:1000
|
|
|
+ }).then((res) => {
|
|
|
+ if(res.data.code===200){
|
|
|
+ this.options = res.data.data.records;
|
|
|
+ }else{
|
|
|
+ this.options=[]
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取表格数据
|
|
|
+ getTableData(){
|
|
|
+ checkParamElement({
|
|
|
+ pkeyId:this.pkeyId1,
|
|
|
+
|
|
|
+ }).then((res) => {
|
|
|
+ console.log(res,'res');
|
|
|
+
|
|
|
+ if(res.data.code===200){
|
|
|
+ this.tableData = res.data.data
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.tableData=[]
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
addList() {
|
|
|
try {
|
|
|
// 检查关键字段是否存在
|
|
@@ -107,26 +113,39 @@ export default {
|
|
|
console.error('缺少必要的数据字段');
|
|
|
return;
|
|
|
}
|
|
|
- // 使用常量定义 isGlobal 的值
|
|
|
- const IS_GLOBAL = '是';
|
|
|
- // 提前声明变量以提高可读性
|
|
|
- const keyname = this.htmlData.keyname;
|
|
|
- const site = this.htmlData.name;
|
|
|
- const name = this.value;
|
|
|
- // 检查 keyname 是否已存在于 tableData 中
|
|
|
- const isKeynameExists = this.tableData.some(item => item.keyname === keyname);
|
|
|
+ console.log(this.htmlData,'this.htmlData');
|
|
|
+
|
|
|
+ const {name}=this.htmlData
|
|
|
+ const paramId = this.value;
|
|
|
+ let type=''
|
|
|
+ this.options.forEach(item => {
|
|
|
+ if (item.id === paramId) {
|
|
|
+ type= item.type;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 检查 name 是否已存在于 tableData 中
|
|
|
+ const isKeynameExists = this.tableData.some(item => item.elementName === name);
|
|
|
if (isKeynameExists) {
|
|
|
this.$message.warning('已存在相同的关键字段,请勿重复添加');
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- // 插入新数据到表格
|
|
|
- this.tableData.push({
|
|
|
- site,
|
|
|
- name,
|
|
|
- isGlobal: IS_GLOBAL,
|
|
|
- keyname
|
|
|
- });
|
|
|
+ let subObj={
|
|
|
+ parameterId: paramId,
|
|
|
+ type:type,
|
|
|
+ elementName:name,
|
|
|
+ projectList:[{projectId:this.projectId}]
|
|
|
+ }
|
|
|
+
|
|
|
+ submitElement([subObj]).then((res) => {
|
|
|
+ if(res.data.code==200){
|
|
|
+ this.$message.success(res.data.msg)
|
|
|
+
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.data.msg)
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getTableData()
|
|
|
+ });
|
|
|
|
|
|
} catch (error) {
|
|
|
console.error('插入数据时发生错误:', error);
|