Commit 5397b72d by lei wang

增加查询联动

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