1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <div id="shujudetail">
- <shujudetail-detail
- :info="info"
- :liebiaoList="liebiaoList"
- :imageList="imageList"
- :gonggaoList="tzggList"
- :shangbaoList="shangbaoList"
- :tongzhiList="tzggList"
- ></shujudetail-detail>
- </div>
- </template>
- <script>
- import shujudetailDetail from '@/components/shuju/shujudetail.vue';
- import { createNamespacedHelpers, mapGetters } from 'vuex';
- import _ from 'loadsh';
- const { mapActions: mapSite } = createNamespacedHelpers('site');
- const { mapActions: mappolicyColumn } = createNamespacedHelpers('recordColumn');
- const { mapActions: mappolicyNews } = createNamespacedHelpers('recordNews');
- export default {
- name: 'shujudetail',
- props: {},
- components: { shujudetailDetail },
- data: () => ({
- info: {},
- liebiaoList: [],
- display: 'list',
- columnName: '',
- contentList: [],
- total: 1,
- leftId: '',
- columnTitle: '',
- policyInfo: {},
- }),
- async created() {
- this.searchSite();
- await this.policyColumn();
- await this.defaultColumn();
- },
- computed: {},
- methods: {
- ...mapSite(['showInfo']),
- ...mappolicyColumn({ policyColumns: 'query', policyfetch: 'fetch' }),
- ...mappolicyNews({ policyNew: 'query', newsFetch: 'fetch' }),
- // 查询站点信息
- async searchSite() {
- let res = await this.showInfo();
- let object = JSON.parse(JSON.stringify(res.data));
- if (object) {
- this.$set(this, `info`, res.data);
- } else {
- this.$message.error(res.errmsg ? res.errmsg : 'error');
- }
- },
- async policyColumn({ ...info } = {}) {
- const res = await this.policyColumns({ ...info });
- if (this.$checkRes(res)) {
- this.$set(this, `liebiaoList`, res.data);
- }
- },
- submit({ id }) {
- this.$set(this, `leftId`, id);
- this.display = 'list';
- this.searchRight();
- },
- async searchRight({ skip = 0, limit = 10, column_id } = {}) {
- const res = await this.policyNew({ skip, limit, column_id: this.leftId });
- for (const val of res.data) {
- const result = await this.policyfetch(val.column_id);
- val.column_name = result.data.name;
- }
- this.$set(this, `contentList`, res.data);
- this.$set(this, `total`, res.data.length);
- for (const val of res.data) {
- this.$set(this, `columnName`, val.column_name);
- }
- },
- async defaultColumn() {
- if (!(this.liebiaoList.length > 0)) return;
- let id = _.get(this.liebiaoList[0], 'id', false);
- if (!id) return;
- this.submit({ id });
- },
- async fetchInfo(id) {
- this.display = 'detail';
- const res = await this.newsFetch(id);
- const result = await this.policyfetch(res.data.column_id);
- this.$set(this, `columnTitle`, result.data.name);
- this.$set(this, `policyInfo`, res.data);
- // 查询详情,赋值
- },
- },
- };
- </script>
- <style lang="scss" scoped></style>
|