master
xy 3 years ago
parent 96e036672e
commit d90edb70bb

@ -9,6 +9,15 @@ export function getNotice(params,noLoading = false){
}) })
} }
export function getNotice2(params,noLoading = false){
return request({
method:'get',
url:'/api/admin/notice/index-v2',
params,
noLoading
})
}
export function readNotice(params){ export function readNotice(params){
return request({ return request({
method:'get', method:'get',

@ -203,6 +203,13 @@ export default {
async getDetail() { async getDetail() {
const res = await show({ id: this.id }); const res = await show({ id: this.id });
this.$integrateData(this.form, res); this.$integrateData(this.form, res);
this.fileList = res.files.map(i => {
return {
url: i.url,
name: i.original_name,
response: i
}
})
}, },
submit() { submit() {
@ -219,6 +226,7 @@ export default {
writable: true, writable: true,
}); });
} }
this.form.file_ids = this.fileList.map(i => i.response?.id)
save(this.form).then((res) => { save(this.form).then((res) => {
this.$message({ this.$message({
type: "success", type: "success",

@ -199,7 +199,15 @@ export default {
async getDetail() { async getDetail() {
const res = await show({ id: this.id }); const res = await show({ id: this.id });
res.year = res.year.toString();
this.$integrateData(this.form, res); this.$integrateData(this.form, res);
this.fileList = res.files.map(i => {
return {
url: i.url,
name: i.original_name,
response: i
}
})
}, },
submit() { submit() {
@ -216,6 +224,7 @@ export default {
writable: true, writable: true,
}); });
} }
this.form.file_ids = this.fileList.map(i => i.response?.id);
save(this.form).then((res) => { save(this.form).then((res) => {
this.$message({ this.$message({
type: "success", type: "success",

@ -25,7 +25,7 @@
:table-item="table" :table-item="table"
@editor="row => { @editor="row => {
$refs['addUpload'].id = row.id; $refs['addUpload'].id = row.id;
$refs['addUpload'].type = 'edit'; $refs['addUpload'].type = 'editor';
$refs['addUpload'].show(); $refs['addUpload'].show();
}" }"
@delete=""> @delete="">
@ -56,6 +56,10 @@ export default {
}, },
total: 0, total: 0,
table: [ table: [
{
type: "index",
width: 60
},
{ {
label: "项目所属年份", label: "项目所属年份",
prop: "year", prop: "year",
@ -64,7 +68,13 @@ export default {
{ {
label: "备注", label: "备注",
prop: "remark", prop: "remark",
align: "left",
minWidth: 200 minWidth: 200
},
{
label: "上传时间",
prop: "created_at",
width: 200
} }
], ],
list: [] list: []

@ -1859,6 +1859,7 @@ export default {
supply:this.form.supply, supply:this.form.supply,
money:this.form?.money, money:this.form?.money,
status:this.form?.is_simple ? 2 : 1, status:this.form?.is_simple ? 2 : 1,
is_framework:this.form?.is_framework
}).then(res => { }).then(res => {
this.isShowAdd = false this.isShowAdd = false
Message({ Message({
@ -1995,10 +1996,12 @@ export default {
} }
}, },
created() { created() {
this.select.keyword = this.$route.query.keyword
iframe = document.createElement('iframe'); iframe = document.createElement('iframe');
iframe.src = `${process.env.VUE_APP_OUT_OLD}/login/oss_login?id=${this.$store.state.user.userId}&username=${this.$store.state.user.username}` iframe.src = `${process.env.VUE_APP_OUT_OLD}/login/oss_login?id=${this.$store.state.user.userId}&username=${this.$store.state.user.username}`
iframe.style.display = 'none' iframe.style.display = 'none'
document.body.appendChild(iframe); document.body.appendChild(iframe);
}, },
destroyed() { destroyed() {
window.onfocus = null window.onfocus = null

@ -8,25 +8,38 @@
</div> </div>
<div> <div>
<Table :height="tableHeight" :loading="loading" size="small" :data="/^\/system/.test(this.$route.path) ? example : list" :columns="table"></Table> <Table
:height="tableHeight"
:loading="loading"
size="small"
:data="/^\/system/.test(this.$route.path) ? example : list"
:columns="table"
></Table>
<div ref="todo-page" style="display: flex; justify-content: center; margin: 10px 0"> <div
<Page :total="/^\/system/.test(this.$route.path) ? example.length : total" ref="todo-page"
size="small" style="display: flex; justify-content: center; margin: 10px 0"
show-elevator >
show-total <Page
@on-change="e => { :total="/^\/system/.test(this.$route.path) ? example.length : total"
select.page = e; size="small"
getNotices(); show-elevator
}"/> show-total
@on-change="
(e) => {
select.page = e;
getNotices();
}
"
/>
</div> </div>
</div> </div>
</el-card> </el-card>
</template> </template>
<script> <script>
import { getNotice, readNotice } from '@/api/dashboard/notice' import { getNotice2, readNotice } from "@/api/dashboard/notice";
import ElementResize from 'element-resize-detector' import ElementResize from "element-resize-detector";
export default { export default {
name: "card2", name: "card2",
@ -40,23 +53,29 @@ export default {
}, },
data() { data() {
return { return {
example:[ window: {
width: 0,
height: 0,
top: 0,
left: 0,
},
example: [
{ {
type: 1, type: 1,
content: "示例1", content: "示例1",
created_at:this.$moment().format("YYYY-MM-DD HH:mm:ss"), created_at: this.$moment().format("YYYY-MM-DD HH:mm:ss"),
read_count: true read_count: true,
}, },
{ {
type: 2, type: 2,
content: "示例2", content: "示例2",
created_at:this.$moment().format("YYYY-MM-DD HH:mm:ss"), created_at: this.$moment().format("YYYY-MM-DD HH:mm:ss"),
read_count: false read_count: false,
} },
], ],
select:{ select: {
page: 1, page: 1,
page_size: 10 page_size: 10,
}, },
tableHeight: 120, tableHeight: 120,
loading: false, loading: false,
@ -67,14 +86,18 @@ export default {
type: "index", type: "index",
title: "序号", title: "序号",
align: "center", align: "center",
width: 64 width: 64,
}, },
{ {
title: "类型", title: "类型",
align: "center", align: "center",
width: 100, width: 100,
render: (h, { row }) => { render: (h, { row }) => {
return h("span", {}, row.type === 1 ? "合同流程" : "付款计划"); let map = new Map([
["szemcold", "审批流转"],
["contract", "预算绩效"],
]);
return h("span", {}, map.get(row.from_type));
}, },
}, },
{ {
@ -83,94 +106,140 @@ export default {
align: "left", align: "left",
ellipsis: true, ellipsis: true,
tooltip: true, tooltip: true,
minWidth: 120 minWidth: 120,
}, },
{ {
title: "下发时间", title: "下发时间",
key: "created_at", key: "created_at",
width: 180, width: 180,
align: "center" align: "center",
}, },
{ {
title: "状态", title: "查看",
key: "read_count", key: "show",
width: 120, width: 120,
render: (h, { row }) => { render: (h, { row }) => {
return row.read_count return h(
? h( "Button",
"el-link", {
{ props: {
props: { type: "primary",
type: "success", size: "small",
underline: false, ghost: true,
}, },
}, on: {
"已读" ["click"]: (_) => {
) if (row.from_type === "szemcold") {
: h( window.open(
"Button", `${process.env.VUE_APP_OUT_OLD}/index.php?s=/flow/edit/id/${row.id}&username=${this.$store.state.user.username}`,
{ "edit",
props: { `top=${this.window.top},left=${this.window.left},width=${this.window.width},height=${this.window.height},location=0`
type: "error", );
size: "small", return
ghost: true }
}, if(row.from_type === 'contract') {
on: { this.$router.push({
['click']:e => { path: '/contract/contract/contractList',
if(/^\/system/.test(this.$route.path)) return query: {
keyword:/\[(.*?)\]/.exec(row.content) ? /\[(.*?)\]/.exec(row.content)[1] : ''
readNotice({ }
id: row.id })
}).then(res => {
this.$message({
type: 'success',
message: '已读'
})
this.getNotices()
})
}
} }
}, },
"未读" },
); },
"查看"
);
}, },
}, },
// {
// title: "",
// key: "read_count",
// width: 120,
// render: (h, { row }) => {
// return row.read_count
// ? h(
// "el-link",
// {
// props: {
// type: "success",
// underline: false,
// },
// },
// ""
// )
// : h(
// "Button",
// {
// props: {
// type: "error",
// size: "small",
// ghost: true
// },
// on: {
// ['click']:e => {
// if(/^\/system/.test(this.$route.path)) return
//
// readNotice({
// id: row.id
// }).then(res => {
// this.$message({
// type: 'success',
// message: ''
// })
// this.getNotices()
// })
// }
// }
// },
// ""
// );
// },
// },
], ],
}; };
}, },
methods: { methods: {
async getNotices() { async getNotices() {
if(/^\/system/.test(this.$route.path)) return if (/^\/system/.test(this.$route.path)) return;
try{ try {
this.loading = true this.loading = true;
const res = await getNotice(this.select,true); const res = await getNotice2(this.select, true);
this.list = res.data; this.list = res;
this.total = res.total; this.total = res.length;
this.loading = false this.loading = false;
}catch (e) { } catch (e) {
this.loading = false this.loading = false;
} }
}, },
init() { init() {
let cardDom = document.getElementById('todo-card'); let cardDom = document.getElementById("todo-card");
let cardTitleH = 58; let cardTitleH = 58;
let page = this.$refs['todo-page'] let page = this.$refs["todo-page"];
const elementResize = ElementResize({ const elementResize = ElementResize({
strategy:'scroll' strategy: "scroll",
}) });
elementResize.listenTo(cardDom,ele => { elementResize.listenTo(cardDom, (ele) => {
this.tableHeight = cardDom.getBoundingClientRect().height - 40 - cardTitleH - page.getBoundingClientRect().height this.tableHeight =
}) cardDom.getBoundingClientRect().height -
} 40 -
cardTitleH -
page.getBoundingClientRect().height;
});
},
}, },
computed: {}, computed: {},
created() { created() {
this.window.width = screen.availWidth * 0.95;
this.window.height = screen.availHeight * 0.95;
this.window.top = (window.screen.height - 30 - this.window.height) / 2;
this.window.left = (window.screen.width - 10 - this.window.width) / 2;
this.getNotices(); this.getNotices();
}, },
mounted() { mounted() {
this.init(); this.init();
} },
}; };
</script> </script>

Loading…
Cancel
Save