123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- <template>
- <div>
- <div class="gutter-example">
- <a-row :gutter="20">
- <a-col class="gutter-row" :span="8">
- <div class="gutter-box">
- <a-row type="flex" justify="space-between" style="flex:1; font-size:22px;font-weight: 500;color: #373737;">
- <a-col>待入库总数</a-col>
- <a-col>{{ topData.inTotalNum }}</a-col>
- </a-row>
- <a-row type="flex" justify="space-between" :gutter="[0,16]" style="flex:1;font-size:18px;font-weight: 500;">
- <a-col >
- <a-badge color="#E4007F"/>
- <span style="color:#E4007F;">采集入库 {{ topData.purchaseApplyNum }}</span>
- </a-col>
- <a-col >
- <a-badge color="#5864FF"/>
- <span style="color:#5864FF;">闲置入库 {{ topData.spareBackApplyNum }}</span>
- </a-col>
- </a-row>
- <a-row type="flex" justify="space-between" :gutter="[0,16]" style="flex:1;font-size:18px;font-weight: 500;">
- <a-col >
- <a-badge color="#F19149"/>
- <span style="color:#F19149;">其他入库 {{ topData.otherNum }}</span>
- </a-col>
- <a-col>
- <a-badge color="#009944"/>
- <span style="color:#009944;">调拨入库 {{ topData.applyDBNum }}</span>
- </a-col>
- </a-row>
- </div>
- </a-col>
- <a-col class="gutter-row" :span="8">
- <div class="gutter-box">
- <a-row type="flex" justify="space-between" style="flex:1; font-size:22px;font-weight: 500;color: #373737;">
- <a-col>待出库总数</a-col>
- <a-col>{{ topData.outTotalNum }}</a-col>
- </a-row>
- <a-row type="flex" justify="space-between" :gutter="[0,16]" style="flex:1;font-size:18px;font-weight: 500;">
- <a-col >
- <a-badge color="#E4007F"/>
- <span style="color:#E4007F;">待调拨出库 {{ topData.outDBNum }}</span>
- </a-col>
- <a-col >
- <a-badge color="#5864FF"/>
- <span style="color:#5864FF;">待领用出库 {{ topData.lyNum }}</span>
- </a-col>
- </a-row>
- <a-row type="flex" justify="space-between" :gutter="[0,16]" style="flex:1;font-size:18px;font-weight: 500;">
- <a-col >
- <a-badge color="#F19149"/>
- <span style="color:#F19149;">报废出库 {{ topData.bfNum }}</span>
- </a-col>
- <a-col>
- <a-badge color="#009944"/>
- <span style="color:#009944;">其他出库 {{ topData.otherOutNum }}</span>
- </a-col>
- </a-row>
- </div>
- </a-col>
- <a-col class="gutter-row" :span="8">
- <div style="display:flex;text-align:center;background:#fff;height: 170px;">
- <div style="width:48%;margin:auto;font-size:30px; line-height: 60px;">
- <div>仓库总数</div>
- <div style="font-size:24px;">{{ topData.storeNums }}</div>
- </div>
- <div style="width: 1px;height: 70px;background: #999999;margin:auto;"></div>
- <div style="width:48%;margin:auto; font-size:30px;line-height: 60px;">
- <div>备件总价值</div>
- <div style="font-size:24px;">{{ topData.totalPrice }}</div>
- </div>
- </div>
- </a-col>
- </a-row>
- </div>
- <div class="gutter-example">
- <a-row :gutter="[20,40]">
- <a-col class="gutter-row" :span="8">
- <div style="height: 471px;background: #FFFFFF;padding:24px">
- <div style="display:flex;justify-content: space-between;width:160px;height: 18px; font-size:16px;color: #555555; ">
- <div>备件类型数量统计</div>
- <!-- <div>设备总数100</div> -->
- </div>
- <div id="container-pie"></div>
- </div>
- </a-col>
- <a-col class="gutter-row" :span="12">
- <div style="height: 471px;background: #FFFFFF; padding:24px;">
- <div style="display:flex;justify-content: space-between;width:190px;height: 18px; font-size:16px;color: #555555; margin-bottom:80px;">
- <div style="width: 7px;background: #4D86ED;"></div>
- <div>近一周每日出入库数据</div>
- </div>
- <div id="container-line"></div>
- </div>
- </a-col>
- <a-col class="gutter-row" :span="4">
- <div style="height: 471px;display:flex;flex-direction:column;justify-content: space-between">
- <div class="btn" style="background:linear-gradient(to right,#36B5FA,#26ECF5);">
- <my-icon type="icon-chukuguanli" style="font-size:58px;"/>
- <span>出库</span>
- </div>
- <div class="btn" style="background:linear-gradient(to right,#FF416D,#FF847F);">
- <my-icon type="icon-rukuguanli" style="font-size:58px;"/>
- <span>入库</span>
- </div>
- <div class="btn" style="background:linear-gradient(to right,#FB47D1,#F96EFE);">
- <my-icon type="icon-zichanguanli-zichantiaobo" style="font-size:58px;"/>
- <span>调拨</span>
- </div>
- <div class="btn" style="background:linear-gradient(to right,#941FFF,#BC72FB);">
- <my-icon type="icon-xinzengyugengxinhuopindangan-copy" style="font-size:58px;"/>
- <span>新增</span>
- </div>
- </div>
- </a-col>
- </a-row>
- </div>
- <div class="gutter-example">
- <a-row :gutter="20">
- <a-col class="gutter-row" :span="6">
- <div class="information">
- <div style="display:flex;justify-content: space-between;align-items: center; padding-bottom:20px;">
- <div style="display:flex; width:65px;height:17px;justify-content: space-between;align-items: center;">
- <div style=" width: 17px;height: 17px;background: #3462FD;border-radius: 50%;"></div>
- <div style="font-size: 18px;font-weight: 800;color: #333333;">资料</div>
- </div>
- <div >
- 查看全部
- <my-icon type="icon-xiangyou-copy" style="font-size:13px;"/>
- </div>
- </div>
- <div
- class="demo-infinite-container"
- >
- <a-list size="small" bordered :data-source="information">
- <a-list-item slot="renderItem" slot-scope="item,index" :class="{discolor: index%2}">
- <a-list-item-meta>
- <div slot="title" :href="item.href">{{ item.name }}</div>
- </a-list-item-meta>
- <div>{{ item.time }}</div>
- </a-list-item>
- </a-list>
- </div>
- </div>
- </a-col>
- <a-col class="gutter-row" :span="18">
- <div class="information">
- <s-table
- ref="table"
- size="small"
- bordered
- rowKey="id"
- :columns="columns"
- :data="loadData"
- :pageSize="10"
- :scroll="{ y: 190 }"
- >
- <span slot="action" slot-scope="record">
- <template>
- <a @click="handle(record)">详情</a>
- <a-divider v-if="record.status === 1" type="vertical" />
- <a v-if="record.status === 1" @click="dealJumpDetail(record)">跳转</a>
- </template>
- </span>
- <span slot="content" slot-scope="text" v-html="text">
- </span>
- </s-table>
- </div>
- </a-col>
- </a-row>
- </div>
- </div>
- </template>
- <script>
- import { STable } from '@/components'
- import { getWorkplaceBacklogUserPage, getWorkplaceBacklogTopData, getWorkplaceBacklogWeekData, getWorkplaceBacklogPie } from '@/api/workplace/backlog'
- import { Chart } from '@antv/g2'
- export default {
- name: 'NewWorkplaceBacklog',
- components: {
- STable,
- Chart
- },
- data () {
- return {
- equipmentData: [
- { item: '事例一', count: 40, percent: 0.4 },
- { item: '事例二', count: 21, percent: 0.21 },
- { item: '事例三', count: 17, percent: 0.17 },
- { item: '事例四', count: 13, percent: 0.13 },
- { item: '事例五', count: 9, percent: 0.09 }
- ],
- lineData: [
- { week: '周一', value: 3 },
- { week: '周二', value: 4 },
- { week: '周三', value: 7.5 },
- { week: '周四', value: 5 },
- { week: '周五', value: 4.9 },
- { week: '周六', value: 6 },
- { week: '周日', value: 7 }
- ],
- storeNums: 0,
- allCount: 100,
- chartPie: null,
- chartLine: null,
- topData: null,
- queryParam: {
- status: 1
- },
- information: [
- {
- name: '项目管理通知',
- time: '2022-4-7'
- },
- {
- name: '项目管理通知',
- time: '2022-4-7'
- },
- {
- name: '项目管理通知',
- time: '2022-4-7'
- },
- {
- name: '项目管理通知',
- time: '2022-4-7'
- }, {
- name: '项目管理通知',
- time: '2022-4-7'
- },
- {
- name: '项目管理通知',
- time: '2022-4-7'
- },
- {
- name: '项目管理通知',
- time: '2022-4-7'
- }
- ],
- columns: [
- {
- title: '序号',
- dataIndex: 'index',
- align: 'center',
- width: 50,
- customRender: (text, record, index) => {
- return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
- }
- },
- {
- title: '类型',
- dataIndex: 'type',
- align: 'center',
- width: 100,
- customRender: (text, record, index) => {
- return this.typeDict[text]
- }
- },
- {
- title: '详细类型',
- dataIndex: 'detailType',
- align: 'center',
- width: 140,
- customRender: (text, record, index) => {
- return this.typeDetailDict[text]
- }
- },
- {
- title: '内容',
- dataIndex: 'content',
- align: 'center',
- width: 460,
- ellipsis: true,
- scopedSlots: { customRender: 'content' }
- },
- {
- title: '时间',
- align: 'center',
- width: 160,
- dataIndex: 'createdTime'
- },
- {
- title: '状态',
- align: 'center',
- dataIndex: 'status',
- width: 100,
- customRender: (text, record, index) => {
- return (text === 1 ? '未读' : '已读')
- }
- },
- {
- title: '操作',
- key: 'action',
- width: 150,
- align: 'center',
- scopedSlots: { customRender: 'action' }
- }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- parameter = {
- ...parameter,
- ...this.queryParam
- }
- return getWorkplaceBacklogUserPage(parameter)
- .then(res => {
- return res.data
- })
- }
- }
- },
- computed: {
- role () {
- if (this.$store.state.user.roles.join().includes('manage')) {
- return 'workplace_store_manage'
- } else if (this.$store.state.user.roles.join().includes('normal')) {
- return 'workplace_store_normal'
- } else {
- return ''
- }
- }
- },
- created () {
- this.getDict()
- console.log(this.role)
- // this.getInfo()
- },
- mounted () {
- this.$nextTick(function () {
- this.getInfo()
- })
- },
- methods: {
- getDict () {
- this.typeDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE)
- this.typeDetailDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE)
- getWorkplaceBacklogTopData(this.role).then(res => {
- this.topData = res.data
- })
- },
- getInfo () {
- Promise.all([getWorkplaceBacklogWeekData(this.role), getWorkplaceBacklogPie(this.role)]).then(res => {
- console.log(res)
- this.lineData = res[0].data.inStoreDetailVOS.reduce((pre, item) => {
- pre.push({
- week: item.weekDayName,
- value: item.num,
- name: '入库'
- })
- return pre
- }, [])
- this.lineData.push(
- ...res[0].data.outStoreDetailVOS.reduce((pre, item) => {
- pre.push({
- week: item.weekDayName,
- value: item.num,
- name: '出库'
- })
- return pre
- }, [])
- )
- this.equipmentData = res[1].data.reduce((pre, item) => {
- pre.push({
- item: item.name,
- count: item.currentStock,
- percent: item.currentStock
- })
- return pre
- }, [])
- }).then(() => {
- this.getPieCharts('container-pie', this.equipmentData)
- this.getLineCharts('container-line', this.lineData)
- })
- },
- getPieCharts (id, data) {
- this.chartPie && this.chartPie.destroy()// 防止点击搜索按钮新增一个
- this.chartPie = new Chart({
- container: id,
- autoFit: true,
- height: 400
- })
- this.chartPie.data(data)
- this.chartPie.scale('count', {
- nice: true
- })
- this.chartPie.coordinate('theta', {
- radius: 0.6,
- innerRadius: 0.5
- })
- this.chartPie.tooltip({
- showTitle: false,
- showMarkers: false,
- itemTpl: `<li class="g2-tooltip-list-item">
- <span style="background-color:{color};" class="g2-tooltip-marker"></span>
- {name}: {value}
- </li>`
- })
- // 辅助文本
- this.chartPie
- .annotation()
- this.chartPie
- .interval()
- .adjust('stack')
- .position('percent')
- .color('item')
- .label('percent', (percent) => {
- return {
- content: (data) => {
- return `${data.item}: ${percent}`
- }
- }
- })
- .tooltip('item*count', (item, count) => {
- return {
- name: item,
- value: count
- }
- })
- // this.chartPie.interaction('element-active')
- this.chartPie.interaction('active-region')
- this.chartPie.render()
- },
- getLineCharts (id, data) {
- this.chartLine = new Chart({
- container: id,
- autoFit: true,
- height: 300
- })
- this.chartLine.data(data)
- this.chartLine.scale({
- value: {
- min: 0,
- nice: true
- }
- })
- this.chartLine.tooltip({
- showCrosshairs: true, // 展示 Tooltip 辅助线
- shared: true
- })
- this.chartLine.axis('value', {
- label: {
- formatter: (val) => {
- return val
- }
- }
- })
- this.chartLine.interval().position('week*value').color('name').adjust([
- {
- type: 'dodge',
- marginRatio: 0
- }
- ])
- this.chartLine.interaction('active-region')
- this.chartLine.render()
- }
- }
- }
- </script>
- <style scoped>
- .gutter-example >>> .ant-row > div {
- background: transparent;
- border: 0;
- font-family: PingFang SC;
- }
- .gutter-box {
- display:flex;
- flex-direction:column;
- justify-content: space-between;
- background: #fff;
- padding: 18px 41px;
- height: 170px;
- }
- .btn{
- height: 113px;
- width: 100%;
- color: #fff!important;
- font-size:28px;
- border-radius: 20px;
- display:flex;
- align-items: center;
- justify-content: space-around;
- }
- .information{
- background: #fff;
- padding: 30px 12px;
- height: 260px;
- color:#666;
- }
- .discolor{
- background: #EFEFFB;
- }
- .demo-infinite-container {
- overflow: auto;
- height: 190px;
- }
- ::-webkit-scrollbar { width: 0; height: 0; color: transparent; }
- </style>
|