Commit 5397b72d by lei wang

增加查询联动

parent 741177cd
......@@ -23,3 +23,11 @@ export function edit(data) {
export function deleteById(data) {
return Api.post(`/manager/tdh/deleteById`, data)
}
export function queryYearList(data) {
return Api.post(`/manager/tdh/queryYearList`, data)
}
export function queryCalList(data) {
return Api.post(`/manager/tdh/queryCalList`, data)
}
\ No newline at end of file
......@@ -13,7 +13,16 @@ export default class Tdh {
}
export const Pattern = {
"calyear": [
"dat": [
{ "required": true, "message": "必输项", "type": "string", "trigger": "blur" },
],
"calendar": [
{ "required": true, "message": "必输项", "type": "string", "trigger": "blur" },
],
"dateday": [
{ "required": true, "message": "必输项", "type": "string", "trigger": "blur" },
],
"calendarname": [
{ "required": true, "message": "必输项", "type": "string", "trigger": "blur" },
],
}
......@@ -5,7 +5,7 @@
<c-col :span="12" class="col-left">
<c-col :span="24">
<el-form-item label="日期" prop="dat">
<c-input v-model="model.dat" style="width: 100%" placeholder="请输入日期"> </c-input>
<c-date-picker type="date"  v-model="model.dat" style="width:100%"  placeholder="请选择日期"></c-date-picker>
</el-form-item>
</c-col>
<c-col :span="24">
......@@ -14,23 +14,17 @@
</c-input>
</el-form-item>
</c-col>
<c-col :span="24">
<el-form-item label="年份" prop="calyear">
<c-select :disabled="type === 'edit'" v-model="model.calyear" placeholder="请选择年份">
</c-select>
</el-form-item>
</c-col>
</c-col>
<!-- =============================================右边=========================================== -->
<c-col :span="12" class="col-right">
<c-col :span="24">
<el-form-item label="节日名" prop="dateday">
<c-input v-model="model.ownrefDesc" style="width: 100%" placeholder="请输入dateday"> </c-input>
<c-input v-model="model.dateday" style="width: 100%" placeholder="请输入节日名"> </c-input>
</el-form-item>
</c-col>
<c-col :span="24">
<el-form-item label="日历名称" prop="ownrefDesc">
<c-input :disabled="type === 'edit'" v-model="model.ownrefDesc" style="width: 100%" placeholder="请输入日历名称"> </c-input>
<el-form-item label="日历名称" prop="calendarname">
<c-input :disabled="type === 'edit'" v-model="model.calendarname" style="width: 100%" placeholder="请输入日历名称"> </c-input>
</el-form-item>
</c-col>
</c-col>
......
......@@ -90,7 +90,7 @@
created() {
if (this.type !== "add") {
const data = {"inr":this.$route.params.inr};
queryDetailById(data).then((res) => {
queryById(data).then((res) => {
if (res.inr) {
this.model = res;
} else {
......@@ -105,13 +105,8 @@
if (validated) {
add(this.model)
.then((res) => {
console.log('返回结果'+res.messsage);
if (res.messsage !== null && Object.keys(res.messsage).length > 0) {
this.$message.error(res.messsage)
} else {
this.$message.success("保存成功!")
this.goBack(true)
}
})
.catch((err) => {
this.$message.error("保存失败!");
......
......@@ -3,14 +3,9 @@
<c-col :span="12" class="col-left">
<c-col :span="24">
<el-form-item label="日历代码" prop="calendar">
<c-input v-model="model.calendar" placeholder="请输入日历代码" style="width: 100%">
</c-input>
</el-form-item>
</c-col>
<c-col :span="24">
<el-form-item label="年份" prop="calyear">
<c-select v-model="model.calyear" placeholder="请选择年份">
<el-form-item label="日历名称" prop="calendarname">
<c-select v-model="model.calendarname" placeholder="请选择日历名称" @change="getTdhYearList">
<el-option v-for="item in tdhCalList" :key="item.lable" :label="item.lable" :value="item.value"></el-option>
</c-select>
</el-form-item>
</c-col>
......@@ -18,9 +13,11 @@
<!------------- 右 ---------->
<c-col :span="12" class="col-right">
<c-col :span="24">
<el-form-item label="日历名称" prop="calendarName">
<c-input v-model="model.calendarName" placeholder="请输入日历名称" style="width: 100%">
</c-input>
<el-form-item label="年份" prop="calyear">
<c-select v-model="model.calyear" placeholder="请选择年份">
<el-option v-for="item in tdhYearList" :key="item.lable" :label="item.lable"
:value="item.value"></el-option>
</c-select>
</el-form-item>
</c-col>
</c-col>
......@@ -31,46 +28,19 @@
</c-col>
<c-col :span="12" style="text-align: right">
<el-button size="small" @click="handleReset">重置</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="small"
@click="onSearch()"
>查询
<el-button type="primary" icon="el-icon-search" size="small" @click="onSearch()">查询
</el-button>
</c-col>
</c-col>
<c-col :span="24">
<c-paging-table
:data="tdhData"
:columns="tdhColumns"
:pageNumber="model.pageNum"
:pageSize="model.pageSize"
:total="model.total"
v-on:queryFunc="queryFunc"
:border="true"
>
<c-paging-table :data="tdhData" :columns="tdhColumns" :pageNumber="model.pageNum" :pageSize="model.pageSize"
:total="model.total" v-on:queryFunc="queryFunc" :border="true">
<c-table-column fixed="right" prop="op" label="操作" width="240px">
<template slot-scope="{ scope }">
<c-button
style="margin-left: 0"
size="small"
@click="tdhInfo(scope.$index, scope.row)"
>详情</c-button
>
<c-button
style="margin-left: 5px"
size="small"
type="primary"
@click="tdhEdit(scope.$index, scope.row)"
>修改</c-button
>
<c-button
size="small"
style="margin-left: 5px"
@click="tdhDelete(scope.$index, scope.row)"
>删除</c-button
>
<c-button style="margin-left: 0" size="small" @click="tdhInfo(scope.$index, scope.row)">详情</c-button>
<c-button style="margin-left: 5px" size="small" type="primary"
@click="tdhEdit(scope.$index, scope.row)">修改</c-button>
<c-button size="small" style="margin-left: 5px" @click="tdhDelete(scope.$index, scope.row)">删除</c-button>
<el-popover placement="top-start" width="50" trigger="click">
<ul class="table-button-item-list">
<li>
......@@ -80,11 +50,7 @@
<c-button size="small" style="margin-left: 0">删除</c-button>
</li>
</ul>
<a
slot="reference"
href="javascript:void(0)"
style="margin-left: 5px"
>
<a slot="reference" href="javascript:void(0)" style="margin-left: 5px">
<i class="el-icon-more"></i>
</a>
</el-popover>
......@@ -93,15 +59,14 @@
</c-paging-table>
</c-col>
</div>
</template>
</template>
<script>
import { format } from "path";
<script>
import codes from "~/config/CodeTable";
import { queryByPage } from "~/service/test/tdh.js";
import { queryByPage, queryYearList, queryCalList } from "~/service/test/tdh.js";
export default {
export default {
name: "",
props: ["model"],
inject: ["root"],
......@@ -109,20 +74,37 @@ import codes from "~/config/CodeTable";
return {
tdhData: [],
tdhColumns: [
{ label: '日期', prop: 'dat', width: 'auto' },
{ label: '日期', prop: 'datStr', width: 'auto' },
{ label: '节日名', prop: 'dateday', width: 'auto' }
],
tdhYearList: [],
tdhCalList: [],
};
},
computed: {
},
created() {
this.getTdhCalList()
},
activated() {
this.getTdhCalList()
const { update } = this.$route.params
if (update) {
this.onInftdhSearch()
}
},
methods: {
getTdhCalList() {
queryCalList(this.model).then(res => {
this.tdhCalList = res.list
})
},
getTdhYearList() {
this.model.calyear ? this.model.calyear = '' : ''
queryYearList(this.model).then(res => {
this.tdhYearList = res.list
})
},
getCodesByKey(key) {
return codes[key] ?? [];
},
......@@ -167,19 +149,20 @@ import codes from "~/config/CodeTable";
this.$router.push(`/statics/dbdtdh/${row.inr}`)
},
},
};
</script>
};
</script>
<style scoped>
.table-button-item-list {
<style scoped>
.table-button-item-list {
padding: 0;
margin: 0;
}
.table-button-item-list li {
}
.table-button-item-list li {
list-style: none;
padding: 5px 0;
text-align: center;
color: #606266;
cursor: pointer;
}</style>
\ No newline at end of file
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment