123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- <template>
- <div class="InsCountry-all">
- <el-dialog width="830px" class="InsCountry-dialog" title="新增编辑" :visible.sync="dialogTableVisible" :close-on-click-modal="false">
- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="110px" class="demo-ruleForm">
- <div class="InsCountry-form">
- <el-form-item label="国家名称" prop="countryName">
- <el-input v-model="ruleForm.countryName"></el-input>
- </el-form-item>
- <el-form-item label="是否为申根国" prop="isSchengen">
- <el-radio-group v-model="ruleForm.isSchengen">
- <el-radio label="是申根国"></el-radio>
- <el-radio label="不是申根国"></el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="保险费用" prop="cost">
- <el-input-number class="append_unit" data-unit="CNY" :controls="false" v-model="ruleForm.cost" :precision="2">
-
- </el-input-number>
- </el-form-item>
- <el-form-item style="width:100%;" label="备注">
- <el-input type="textarea" :rows="2" v-model="ruleForm.remark"></el-input>
- </el-form-item>
- </div>
- <el-form-item style="text-align: right;width:100%;">
- <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
- <el-button @click="resetForm('ruleForm')">重置</el-button>
- <el-button @click="dialogTableVisible=false">取消</el-button>
- </el-form-item>
- </el-form>
- </el-dialog>
- <div>国家保险标准</div>
- <div class="InsCountry-search">
- <div>
- <el-input clearable size="small" style="width:250px;" v-model="searchinput" placeholder="请输入国家"></el-input>
- <el-button @click="InsuranceCostPageItem" size="small" type="primary">查询</el-button>
- </div>
- <el-button @click="InsCountryadd" size="small" type="primary">新增</el-button>
- </div>
- <div class="InsCountry-table">
- <el-table
- :data="tableData"
- border
- style="width: 100%">
- <el-table-column
- prop="countryName"
- label="国家"
- width="180">
- </el-table-column>
- <el-table-column
- prop="cost"
- label="金额"
- width="180">
- <template slot-scope="scope">
- {{ townum(scope.row.cost) }}
- </template>
- </el-table-column>
- <el-table-column
- prop="createTime"
- label="更新时间"
- width="180">
- </el-table-column>
- <el-table-column
- prop="createUserName"
- label="录入人"
- width="180">
- </el-table-column>
- <el-table-column
- prop="remark"
- label="备注">
- </el-table-column>
- <el-table-column
- label="操作"
- width="180">
- <template slot-scope="scope">
- <el-button size="mini" @click="upDate(scope.row)">编辑</el-button>
- <el-button size="mini" type="danger" @click="del(scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div class="block">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-sizes="[10,14, 15, 20, 30]"
- :page-size="pagesize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- token:'',
- userid:'',
- tableData:[],
- searchinput:'',
- currentPage:1,
- pagesize:14,
- total:0,
- dialogTableVisible:false,
- ruleForm: {
- id:'',
- countryName:'',
- cost:0,
- isSchengen:'',
- remark: '',
- },
- rules: {
- countryName: [
- { required: true, message: '请输入', trigger: 'blur' },
- ],
- cost: [
- { required: true, message: '请输入', trigger: 'blur' }
- ],
- isSchengen: [
- { required: true, message: '请选择', trigger: 'change' }
- ],
- },
- }
- },
- methods:{
- //保留两位小数
- townum(val){
- val=Number(val);
- return val.toFixed(2);
- },
- handleSizeChange(val) {
- this.currentPage=1;
- this.pagesize=val;
- this.InsuranceCostPageItem();
- },
- handleCurrentChange(val) {
- this.currentPage=val;
- this.InsuranceCostPageItem();
- },
- //获取表格
- InsuranceCostPageItem(){
- var url = "/api/Resource/InsuranceCostPageItem"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data:{
- portType:1,
- pageIndex:that.currentPage,
- pageSize:that.pagesize,
- search:that.searchinput,
- }
- }).then(function (res) {
- if(res.data.code==200){
- that.tableData=res.data.data;
- that.total=res.data.count;
- }else{
- that.$message({
- message: '加载失败!原因:'+res.data.msg,
- type: 'warning'
- });
- }
- })
- },
- InsCountryadd(){
- this.dialogTableVisible=true;
- this.ruleForm={
- id:'',
- countryName:'',
- cost:0,
- isSchengen:'',
- remark: '',
- }
- },
- //编辑
- upDate(val){
- this.InsCountryadd();
- this.InsuranceCostInfo(val.id)
- },
- //获取详情
- InsuranceCostInfo(val){
- var url = "/api/Resource/InsuranceCostInfo"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data:{
- portType:1,
- id:val,
- }
- }).then(function (res) {
- if(res.data.code==200){
- let infobxbz=res.data.data
- that.ruleForm.id=infobxbz.id;
- that.ruleForm.countryName=infobxbz.countryName;
- that.ruleForm.cost=infobxbz.cost;
- that.ruleForm.isSchengen=infobxbz.isSchengen==1?'是申根国':'不是申根国';
- that.ruleForm.remark=infobxbz.remark;
- }else{
- that.$message({
- message: '加载失败!原因:'+res.data.msg,
- type: 'warning'
- });
- }
- })
- },
- del(row) {
- this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- var url = "/api/Resource/InsuranceCostSoftDel"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data: {
- portType:1,
- currUserId: that.userid,
- id: row.id,
- }
- }).then(function (res) {
- if (res.data.code == 200) {
- that.dialogTableVisible=false;
- that.$message({
- message:res.data.msg,
- type: 'success'
- });
- that.InsuranceCostPageItem();
- } else {
- that.$message.error(res.data.msg);
- }
- }).catch(function (error) {
- that.$message.error("出错!请联系信息部");
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '操作已取消!'
- });
- });
- },
- //新增api
- InsuranceCostOp(){
- var url = "/api/Resource/InsuranceCostOp"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer '
- },
- data:{
- portType:1,
- id:that.ruleForm.id==''?0:that.ruleForm.id,
- currUserId:that.userid,
- isSchengen:that.ruleForm.isSchengen=='是申根国'?1:0,
- countryName:that.ruleForm.countryName,
- cost:that.ruleForm.cost,
- remark:that.ruleForm.remark,
- }
- }).then(function (res) {
- if(res.data.code==200){
- that.dialogTableVisible=false
- that.$message({
- type: 'success',
- message: res.data.msg
- });
- that.InsuranceCostPageItem();
- }else{
- that.$message({
- message: '加载失败!原因:'+res.data.msg,
- type: 'warning'
- });
- }
- })
- },
- submitForm(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.InsuranceCostOp();
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- resetForm(formName) {
- this.$refs[formName].resetFields();
- },
- },
- mounted(){
- this.token = JSON.parse(localStorage.getItem('userinif')).token;
- this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
- this.InsuranceCostPageItem();
- },
- }
- </script>
- <style>
- .InsCountry-all {
- background-color: #fff;
- padding: 10px;
- box-shadow: 0 0 5px #0005;
- border-radius: 10px;
- min-height: 830px;
- }
- .InsCountry-search{
- display: flex;
- justify-content: space-between;
- margin: 10px 0 ;
- }
- .InsCountry-table .block{
- text-align: center;
- margin-top: 15px;
- }
- .InsCountry-dialog .el-form-item{
- width: 395px;
- }
- .InsCountry-dialog .el-select,.el-input,.el-input-number{
- width: 100%;
- }
- .InsCountry-form{
- display: flex;
- flex-wrap:wrap ;
- }
- </style>
|