oil-station/fuintAdmin_zt/src/views/setting/app/index.vue
DESKTOP-369JRHT\12997 20ef58f136 样式修改
2024-07-31 15:21:49 +08:00

351 lines
12 KiB
Vue

<template>
<div class="app-container">
<div class="card-change">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="" prop="legalRepresentativeContact">
<el-select
v-model="queryParams.orgId"
clearable
placeholder="所属机构"
>
<el-option v-for="item in deptList" :key="item.deptId" :label="item.deptName" :value="item.deptId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="" prop="legalRepresentativeContact">
<el-input
v-model="queryParams.legalRepresentativeContact"
placeholder="请输入法人联系方式"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="legalRepresentativeContact">
<el-select v-model="queryParams.appStatus" placeholder="请选择小程序状态">
<el-option label="停用" value="0" ></el-option>
<el-option label="启用" value="1" ></el-option>
</el-select>
</el-form-item>
<el-form-item style="float: right;margin-right: 0px">
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button
type="primary"
@click="handleAdd"
v-hasPermi="['setting:app:add']"
>新增小程序配置</el-button>
</el-form-item>
</el-form>
<!-- </el-card>-->
<!-- &lt;!&ndash; 列表信息&ndash;&gt;-->
<!-- <el-card style="margin-top: 20px" >-->
<el-table :data="tableData" style="width: 100%" border>
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="orgName" label="机构名称"></el-table-column>
<el-table-column prop="unifiedSocialCreditCode" label="统一社会信用代码"></el-table-column>
<el-table-column prop="appId" label="小程序appID"></el-table-column>
<el-table-column prop="appKey" label="密钥"></el-table-column>
<el-table-column prop="legalRepresentativeName" label="法人姓名"></el-table-column>
<el-table-column prop="legalRepresentativeWechat" label="法人微信号"></el-table-column>
<el-table-column prop="legalRepresentativeContact" label="法人联系方式"></el-table-column>
<el-table-column prop="appStatus" label="小程序状态">
<template slot-scope="scope">
<el-switch
v-model="scope.row.appStatus"
@change="changeStatus(scope.row)"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
<el-table-column prop="createByName" label="创建人"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column>
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="edit(scope.row)"
v-hasPermi="['setting:app:edit']"
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="del(scope.row)"
v-hasPermi="['setting:app:delete']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="30%" append-to-body>
<!-- <el-form ref="form" :model="deviceInfo" label-width="80px">-->
<el-form :model="deviceInfo" ref="deviceForm" label-width="140px" :rules="rule">
<!-- <el-form-item label="机构名称" prop="orgName">-->
<!-- <el-input v-model="deviceInfo.orgName" style="width: 300px"></el-input>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="机构名称" prop="orgName">-->
<!-- <el-input v-model="deviceInfo.orgName" style="width: 300px"></el-input>-->
<!-- </el-form-item>-->
<!-- -->
<el-form-item label="机构名称" prop="orgId">
<el-select
v-model="deviceInfo.orgId"
clearable
placeholder="机构名称"
style="width: 300px;"
>
<el-option v-for="item in deptList" :key="item.deptId" :label="item.deptName" :value="item.deptId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="统一社会信用代码" prop="unifiedSocialCreditCode">
<el-input v-model="deviceInfo.unifiedSocialCreditCode" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="小程序appID" prop="appId">
<el-input v-model="deviceInfo.appId" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="密钥" prop="appKey">
<el-input v-model="deviceInfo.appKey" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="法人姓名" prop="legalRepresentativeName">
<el-input v-model="deviceInfo.legalRepresentativeName" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="法人微信号" prop="legalRepresentativeWechat">
<el-input v-model="deviceInfo.legalRepresentativeWechat" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="法人联系方式" prop="legalRepresentativeContact">
<el-input v-model="deviceInfo.legalRepresentativeContact" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="小程序状态" prop="appStatus">
<el-switch
v-model="deviceInfo.appStatus"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('deviceForm')">提交</el-button>
</el-form-item>
</el-form>
<!-- </el-form>-->
</el-dialog>
</div>
</template>
<script>
import {deleteAppApi, getAppListApi, saveAppApi, updateAppApi} from "@/api/sys/app";
import {updateBannerApi} from "@/api/sys/banner";
import {getRunningWaterByTissueApi} from "@/api/allOrder";
export default {
name: "printIndex",
data() {
return {
tableData: [],
deptList: [],
deviceInfo: {
id: null, // 自增id
orgName: '', // 机构名称
orgId: '', // 机构名称
unifiedSocialCreditCode: '', // 统一社会信用代码
appId: '', // 小程序appID
appKey: '', // 密钥
legalRepresentativeName: '', // 法人姓名
legalRepresentativeWechat: '', // 法人微信
legalRepresentativeContact: '', // 法人联系方式
appStatus: false, // 小程序状态
createByName: '',
},
rule: {
orgId: [{required: true, message: '请选择机构名称', trigger: 'blur'},],
unifiedSocialCreditCode: [{required: true, message: '请填写统一社会信用代码', trigger: 'blur'},],
appId: [{required: true, message: '请填写小程序appID', trigger: 'blur'},],
appKey: [{required: true, message: '请填写密钥', trigger: 'blur'},],
legalRepresentativeName: [{required: true, message: '请填写法人姓名', trigger: 'blur'},],
legalRepresentativeWechat: [{required: true, message: '请填写法人微信号', trigger: 'blur'},],
legalRepresentativeContact: [{required: true, message: '请填写法人联系方式', trigger: 'blur'},],
},
// 是否显示弹出层
open: false,
title:"",
total:0,
// 查询参数
queryParams: {
page: 1,
pageSize: 10,
orgName:'',
orgId:'',
legalRepresentativeContact:'',
appStatus:'',
},
};
},
created() {
this.getList()
this.getDeptList()
},
methods: {
getDeptList() {
getRunningWaterByTissueApi(this.addDateRange(this.queryParams)).then(response => {
this.deptList = response.data.records;
})
},
getList(){
getAppListApi(this.queryParams).then(res=>{
this.tableData = res.data.records;
this.total = res.data.total
})
},
getsSubmitDeviceInfo(){},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
// 表单验证通过,可以提交数据
// 示例:调用 API 提交数据
this.submitDeviceInfo();
} else {
// 表单验证失败,不执行任何操作
return false;
}
});
},
submitDeviceInfo() {
// 在这里调用接口提交设备信息数据
let filter = this.deptList.filter(item => item.deptId == this.deviceInfo.orgId);
this.deviceInfo.orgName = filter[0].deptName
if (this.deviceInfo.id) {
updateAppApi(this.deviceInfo).then(res=>{
if(res.code === 200) {
this.getList()
this.open = false
}
})
}else {
saveAppApi(this.deviceInfo).then(res=>{
if(res.code === 200) {
this.getList()
this.open = false
}
})
}
},
changeStatus(data){
console.log(123123123)
updateAppApi(data).then(res=>{
if(res.code === 200) {
this.$message({
type: 'success',
message: '修改状态成功!'
});
this.getList()
}
})
},
handleQuery(){
this.getList()
},
resetQuery(){
this.queryParams = {
page: 1,
pageSize: 10,
deviceName:'',
},
this.getList()
},
handleAdd(e) {
this.clean()
this.open = true;
this.title = "新增小程序配置"
},
edit(e) {
this.clean()
this.open = true;
this.title = "编辑小程序配置"
this.deviceInfo = e
console.log('提交设备信息数据:', this.deviceInfo);
},
del(e) {
this.$confirm('此操作将永久删除该设备, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteAppApi(e.id).then(res=>{
if (res.code == 200) {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
clean() {
this.deviceInfo= {
id: null, // 自增id
orgName: '', // 机构名称
unifiedSocialCreditCode: '', // 统一社会信用代码
appId: '', // 小程序appID
appKey: '', // 密钥
legalRepresentativeName: '', // 法人姓名
legalRepresentativeWeChat: '', // 法人微信
legalRepresentativeContact: '', // 法人联系方式
appStatus: false, // 小程序状态
createByName: '',
}
},
}
};
</script>
<style lang="scss" scoped>
.common-dialog >>> .el-upload--picture-card {
width: 60px;
height: 50px;
line-height: 60px;
}
</style>