Files
scrq-hd/.svn/pristine/57/572bcf8f7cba785ce78f3d78b08b2d6f9614267f.svn-base
2025-07-03 10:34:04 +08:00

356 lines
9.2 KiB
Plaintext

<template>
<div class="app-container">
<div class="query" ref="query">
<el-form :model="queryParams" ref="queryParams" :inline="true" label-width="100px">
<el-form-item>
<el-input
v-model="queryParams.name"
placeholder="名称"
clearable
size="small"
style="width: 230px"
@keyup.enter.native="Query"
/>
</el-form-item>
<el-form-item>
<el-select
v-model="queryParams.type"
placeholder="元素类型"
clearable
size="small"
style="width: 230px"
>
<el-option
v-for="dict in this.$dictType.getBasicTypeArry()"
:key="dict.key"
:label="dict.text"
:value="dict.key"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="Query">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</div>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="Add"
v-hasPermi="['system:user:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-edit"
size="mini"
:disabled="buttonEnable"
@click="update"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="buttonEnable"
@click="deleteThis"
>删除</el-button>
</el-col>
</el-row>
<el-table
v-loading="loading"
highlight-current-row
:data="tableData"
:height="tableHeight"
border
@current-change="handleCurrentChange"
ref="singleTable"
class="tableStyle">
<el-table-column
align="center"
type="index"
label="序号"
width="50">
</el-table-column>
<el-table-column
align="center"
prop="name"
label="表单名称"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="typeShow"
label="类型"
width="130">
</el-table-column>
<el-table-column
align="center"
prop="dataSource"
label="数据源"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="dataSourceKey"
label="标签键名"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="dataSourceValue"
label="标签值名"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="defaultValue"
:show-overflow-tooltip="true"
label="默认值"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="showisReadonly"
label="是否只读"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="showisRequire"
label="是否必填"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="maxLength"
label="最大长度"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="placeholder"
:show-overflow-tooltip="true"
label="提示"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="remark"
:show-overflow-tooltip="true"
label="备注"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="selectStaticValue"
:show-overflow-tooltip="true"
label="选择静态值"
width="100">
</el-table-column>
<el-table-column
align="center"
prop="updatedBy"
:show-overflow-tooltip="true"
label="修改人"
width="80">
</el-table-column>
<el-table-column
align="center"
prop="updatedDt"
label="修改时间"
:show-overflow-tooltip="true"
width="200">
</el-table-column>
<el-table-column
align="center"
prop="createdBy"
:show-overflow-tooltip="true"
label="创建人"
width="80">
</el-table-column>
<el-table-column
align="center"
prop="createdDt"
label="创建时间"
:show-overflow-tooltip="true"
width="200">
</el-table-column>
<el-table-column
align="center"
prop="field"
label="字段名"
width="100">
</el-table-column>
</el-table>
<el-pagination
style="margin-top: 10px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange2"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100,200,500,1000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</template>
<script>
import edit from "./edit"
export default {
name: "BasicElement",
data() {
return {
queryParams: {
},
isAdd:null,
propThis:this,
loading:true,
tableData:[],
buttonEnable:true,
pageSize:50,
currentPage:null,
total:null,
tableHeight:0,
selectVal:{},
};
},
mounted(){
this.$nextTick(() => {
this.tableHeight = window.innerHeight - this.$refs.query.offsetHeight - 250;
});
this.getListD();
},
methods: {
getListD() {//获取所有元素
let params={
name:this.queryParams.name,
type:this.queryParams.type,
pageNo:this.currentPage,
pageSize:this.pageSize
}
this.$QualityTemplate.getList(params).then(resp=>{
this.loading = false
if(resp.data.code===200){
// console.log("整体数据",resp.data.data)
this.tableData = resp.data.data.data
this.tableData.forEach(value=>{
value.typeShow = this.$dictType.getBasicType(value.type)
value.isRequire===1? value.showisRequire='是':value.showisRequire='否'
value.isReadonly===1?value.showisReadonly='是':value.showisReadonly='否'
})
this.total = resp.data.data.recordsTotal
}
})
},
Query() {
this.getListD();
},
resetQuery() {
this.queryParams = {
name: null,
type:null
};
},
handleCurrentChange2(val) {
console.log(val)
this.currentPage = val;
this.getListD()
},
handleSizeChange(val){
this.pageSize = val;
this.getListD()
},
handleCurrentChange(val){
this.selectVal=val
this.buttonEnable=false;
},
deleteThis(){
this.$confirm('将删除该元素', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params={
id:this.selectVal.id
}
this.$QualityTemplate.DeleteThis(params).then(resp=>{
if(resp.data.code==200){
this.getListD();
}
})
})
},
Add(){
this.isAdd = true
this.$layer.iframe({
shadeClose: false,
content: {
content: edit, //传递的组件对象
parent: this,//当前的vue对象
shadeClose: false,
},
title: '新增'
})
},
update(){
this.$layer.iframe({
shadeClose: false,
content: {
content: edit, //传递的组件对象
parent: this,//当前的vue对象
shadeClose: false,
data:{
formType:1,
row:this.selectVal
}
},
title: '修改'
})
}
}
};
</script>
<style lang="scss" scoped>
>>>.el-table__expanded-cell:hover{
/*padding:20px 0px;*/
background-color: white !important;
}
>>>.el-table--striped .el-table__body tr.el-table__row--striped.current-row td,
>>>.el-table__body tr.current-row > td {
background-color: #8AC1FF !important;
cursor:pointer;
}
>>>.el-table__body tr:hover>td {
background-color: #E9EDF3;
cursor:pointer;
}
>>>.el-link.el-link--default{
color: white;
}
</style>