ProdPlanList.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  1. <template>
  2. <a-card :bordered="false">
  3. <div ref="pie" :style="{
  4. width: '600px',
  5. height: '400px',
  6. position: 'absolute',
  7. left: '-9999px',
  8. top: '-9999px',
  9. visibility: 'hidden'
  10. }" />
  11. <div ref="barLine" :style="{
  12. width: '600px',
  13. height: '400px',
  14. left: '650px',
  15. position: 'absolute',
  16. top: '-9999px',
  17. visibility: 'hidden'
  18. }" />
  19. <!-- 查询区域 -->
  20. <div class="table-page-search-wrapper">
  21. <a-form layout="inline" @keyup.enter.native="searchQuery">
  22. <a-row :gutter="24">
  23. </a-row>
  24. </a-form>
  25. </div>
  26. <!-- 查询区域-END -->
  27. <!-- 操作按钮区域 -->
  28. <div class="table-operator">
  29. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  30. <!-- <a-button type="primary" icon="download" @click="handleExportXls('生产计划')">导出</a-button> -->
  31. <!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel" :customRequest="customRequest">
  32. <a-button type="primary" icon="import">导入</a-button>
  33. </a-upload> -->
  34. <!-- 高级查询区域 -->
  35. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  36. <a-dropdown v-if="selectedRowKeys.length > 0">
  37. <a-menu slot="overlay">
  38. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  39. </a-menu>
  40. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  41. </a-dropdown> -->
  42. </div>
  43. <!-- table区域-begin -->
  44. <div>
  45. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  46. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  47. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  48. </div>
  49. <a-table
  50. ref="table"
  51. size="middle"
  52. :scroll="{x:true}"
  53. bordered
  54. rowKey="id"
  55. :columns="columns"
  56. :dataSource="dataSource"
  57. :pagination="ipagination"
  58. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  59. class="j-table-force-nowrap"
  60. @change="handleTableChange">
  61. <template slot="htmlSlot" slot-scope="text">
  62. <div v-html="text"></div>
  63. </template>
  64. <template slot="imgSlot" slot-scope="text,record">
  65. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  66. <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  67. </template>
  68. <template slot="fileSlot" slot-scope="text, record" >
  69. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  70. <a-button
  71. v-else
  72. :ghost="true"
  73. type="primary"
  74. icon="download"
  75. size="small"
  76. @click="downloadFile(text)">
  77. 下载
  78. <span v-if="record.analysisState" style="color: #13CE66;">(已解析)</span>
  79. <span v-else style="color: #E6A23C;">(未解析)</span>
  80. </a-button>
  81. </template>
  82. <span slot="action" slot-scope="text, record">
  83. <a @click="handleEdit(record)">编辑</a>
  84. <a-divider type="vertical" />
  85. <a @click="handleDetail(record)">详情</a>
  86. <a-divider type="vertical" />
  87. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  88. <a>删除</a>
  89. </a-popconfirm>
  90. <a-divider type="vertical" />
  91. <a-button type="link" size="small" @click="handleAnalysis(record.id)" :loading="analysisLoading">解析</a-button>
  92. <a-divider type="vertical" />
  93. <a-button type="link" size="small" @click="handleReport(record)">生成报告</a-button>
  94. <a-divider type="vertical" />
  95. <a-button type="link" size="small" @click="handleEmal(record.id)" :loading="emailLoading">
  96. <span v-if="record.sendState === 1">重新发送</span>
  97. <span v-else>发送邮件</span>
  98. </a-button>
  99. </span>
  100. </a-table>
  101. </div>
  102. <prod-plan-modal ref="modalForm" @ok="modalFormOk"></prod-plan-modal>
  103. </a-card>
  104. </template>
  105. <script>
  106. import '@/assets/less/TableExpand.less'
  107. import { mixinDevice } from '@/utils/mixin'
  108. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  109. import ProdPlanModal from './modules/ProdPlanModal'
  110. import { getAction,downFile,postAction} from '@/api/manage'
  111. import { reactive, ref } from 'vue';
  112. export default {
  113. name: 'ProdPlanList',
  114. mixins:[JeecgListMixin, mixinDevice],
  115. components: {
  116. ProdPlanModal
  117. },
  118. data () {
  119. return {
  120. description: '生产计划管理页面',
  121. analysisLoading: false,
  122. emailLoading: false,
  123. pieInside: [],
  124. pieOutside: [],
  125. // 表头
  126. columns: [
  127. {
  128. title: '#',
  129. dataIndex: '',
  130. key:'rowIndex',
  131. width:60,
  132. align:"center",
  133. customRender:function (t,r,index) {
  134. return parseInt(index)+1;
  135. }
  136. },
  137. {
  138. title:'计划日期',
  139. align:"center",
  140. dataIndex: 'planDate',
  141. customRender:function (text) {
  142. return !text?"":(text.length>10?text.substr(0,10):text)
  143. }
  144. },
  145. {
  146. title:'计划表',
  147. align:"center",
  148. dataIndex: 'planSheet',
  149. scopedSlots: {customRender: 'fileSlot'}
  150. },
  151. {
  152. title:'发件状态',
  153. align:"center",
  154. dataIndex: 'sendState',
  155. customRender: (t, r, index, column) => {
  156. let that = this;
  157. const child = that.$createElement('span', {
  158. style: {
  159. color: t ? "#13CE66" : "#E6A23C"
  160. },
  161. domProps: {
  162. innerHTML: t ? "已发送" : "未发送"
  163. }
  164. })
  165. const obj = {
  166. children: child,
  167. attrs: {}
  168. }
  169. return obj;
  170. }
  171. },
  172. {
  173. title: '操作',
  174. dataIndex: 'action',
  175. align:"center",
  176. fixed:"right",
  177. width:147,
  178. scopedSlots: { customRender: 'action' }
  179. }
  180. ],
  181. url: {
  182. list: "/ProdPlan/prodPlan/list",
  183. delete: "/ProdPlan/prodPlan/delete",
  184. analysis: "/ProdPlan/prodPlan/analysis",
  185. report: "/ProdPlan/prodPlan/report",
  186. email: "/ProdPlan/prodPlan/email",
  187. deleteBatch: "/ProdPlan/prodPlan/deleteBatch",
  188. exportXlsUrl: "/ProdPlan/prodPlan/exportXls",
  189. importExcelUrl: "ProdPlan/prodPlan/importExcel",
  190. initPieAndColumnar: "/ProdPlan/delayProduct/getDelayProductByWeek",
  191. getChartData: "ProdPlan/prodPlan/getChartData"
  192. },
  193. dictOptions:{},
  194. superFieldList:[],
  195. minShow: 0
  196. }
  197. },
  198. created() {
  199. this.getSuperFieldList();
  200. },
  201. computed: {
  202. importExcelUrl: function(){
  203. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  204. },
  205. },
  206. mounted() {
  207. },
  208. methods: {
  209. customRequest(options){
  210. let params = new FormData();
  211. params.append("file", options.file)
  212. params.append("plan")
  213. httpAction(this.url.importExcelUrl,params,'POST').then(res=>{
  214. if(res.success){
  215. this.$message.success(res.message)
  216. this.searchQuery()
  217. }else{
  218. this.$message.warning(res.message);
  219. }
  220. })
  221. },
  222. initDictConfig(){
  223. },
  224. getSuperFieldList(){
  225. let fieldList=[];
  226. fieldList.push({type:'date',value:'planDate',text:'计划日期'})
  227. fieldList.push({type:'string',value:'planSheet',text:'计划表',dictCode:''})
  228. fieldList.push({type:'int',value:'sendState',text:'发件状态',dictCode:''})
  229. this.superFieldList = fieldList
  230. },
  231. handleAnalysis: function (id) {
  232. var that = this;
  233. that.analysisLoading = true;
  234. getAction(that.url.analysis, {id: id}).then((res) => {
  235. that.analysisLoading = false;
  236. this.searchQuery()
  237. if (res.success) {
  238. that.$message.success(res.message);
  239. } else {
  240. that.$message.warning(res.message);
  241. }
  242. });
  243. },
  244. handleReport(record){
  245. let fileName = "生产异常报告"
  246. this.prepareChart(record.id).then(()=>{
  247. let pie = this.pieChart.getDataURL({
  248. type: 'png',
  249. pixelRatio: 2, // 设置像素比,提高清晰度
  250. backgroundColor: '#fff' // 设置背景色
  251. }).replace(/^data:image\/\w+;base64,/, '')
  252. let barLine = this.barLineChart.getDataURL({
  253. type: 'png',
  254. pixelRatio: 2, // 设置像素比,提高清晰度
  255. backgroundColor: '#fff' // 设置背景色
  256. }).replace(/^data:image\/\w+;base64,/, '')
  257. downFile(this.url.report,{id: record.id,pie:pie,barLine:barLine},"POST").then((data)=>{
  258. if (!data) {
  259. this.$message.warning("文件下载失败")
  260. return
  261. }
  262. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  263. window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}), fileName+'.xlsx')
  264. // window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
  265. }else{
  266. let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}))
  267. // let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
  268. let link = document.createElement('a')
  269. link.style.display = 'none'
  270. link.href = url
  271. link.setAttribute('download', record.planDate + fileName +'.xlsx')
  272. document.body.appendChild(link)
  273. link.click()
  274. document.body.removeChild(link); //下载完成移除元素
  275. window.URL.revokeObjectURL(url); //释放掉blob对象
  276. }
  277. })
  278. })
  279. },
  280. handleEmal: function (id) {
  281. var that = this;
  282. that.emailLoading = true;
  283. this.prepareChart(id).then(()=>{
  284. let pie = this.pieChart.getDataURL({
  285. type: 'png',
  286. pixelRatio: 2, // 设置像素比,提高清晰度
  287. backgroundColor: '#fff' // 设置背景色
  288. }).replace(/^data:image\/\w+;base64,/, '')
  289. let barLine = this.barLineChart.getDataURL({
  290. type: 'png',
  291. pixelRatio: 2, // 设置像素比,提高清晰度
  292. backgroundColor: '#fff' // 设置背景色
  293. }).replace(/^data:image\/\w+;base64,/, '')
  294. postAction(that.url.email, {id: id,pie:pie,barLine:barLine}).then((res) => {
  295. that.emailLoading = false;
  296. this.searchQuery();
  297. if (res.success) {
  298. that.$message.success(res.message);
  299. } else {
  300. that.$message.warning(res.message);
  301. }
  302. });
  303. }).finally(()=>{
  304. that.emailLoading = false;
  305. })
  306. },
  307. async prepareChart (id) {
  308. var that = this;
  309. await getAction(that.url.getChartData, {id: id}).then((res) => {
  310. if (res.success) {
  311. let chartData = res.result;
  312. this.initPie(chartData.pieInside,chartData.pieOutside)
  313. this.initBarLine(chartData.weeks,chartData.bars,chartData.lineData)
  314. } else {
  315. that.$message.warning(res.message);
  316. }
  317. });
  318. },
  319. async initPie(pieInside,pieOutside){
  320. for(let pieIn of pieInside){
  321. pieIn.itemStyle = {color:pieIn.color}
  322. }
  323. let legendData = []
  324. for(let pieOut of pieOutside){
  325. pieOut.itemStyle = {color:pieOut.color}
  326. legendData.push(pieOut.name)
  327. }
  328. this.pieChart = this.$echarts.init(this.$refs.pie)
  329. let option = {
  330. tooltip: {
  331. trigger: 'item',
  332. formatter: '{a} <br/>{b}: {c} ({d}%)'
  333. },
  334. backgroundColor: '#fff',
  335. // legend: {
  336. // data: legendData
  337. // },
  338. "animation": false,
  339. series: [
  340. {
  341. name: '部门占比',
  342. type: 'pie',
  343. selectedMode: 'single',
  344. radius: [0, '30%'],
  345. label: {
  346. position: 'inner',
  347. fontSize: 14
  348. },
  349. labelLine: {
  350. show: false
  351. },
  352. data: pieInside
  353. },
  354. {
  355. name: '部门下原因占比',
  356. type: 'pie',
  357. radius: ['45%', '60%'],
  358. labelLine: {
  359. length: 30
  360. },
  361. label: {
  362. formatter: '{a|{b}}{abg|}\n{hr|}\n {b|数量:}{c} {per|{d}%} ',
  363. backgroundColor: '#F6F8FC',
  364. borderColor: '#8C8D8E',
  365. borderWidth: 1,
  366. borderRadius: 4,
  367. rich: {
  368. a: {
  369. color: '#6E7079',
  370. lineHeight: 22,
  371. align: 'center'
  372. },
  373. hr: {
  374. borderColor: '#8C8D8E',
  375. width: '100%',
  376. borderWidth: 1,
  377. height: 0
  378. },
  379. b: {
  380. color: '#4C5058',
  381. fontSize: 14,
  382. fontWeight: 'bold',
  383. lineHeight: 33
  384. },
  385. per: {
  386. color: '#fff',
  387. backgroundColor: '#4C5058',
  388. padding: [3, 4],
  389. borderRadius: 4
  390. }
  391. }
  392. },
  393. data: pieOutside
  394. }
  395. ]
  396. };
  397. console.log(option);
  398. this.pieChart.setOption(option)
  399. await this.$nextTick()
  400. },
  401. async initBarLine(weeks,bars,lineData){
  402. let barData = []
  403. let legendData = []
  404. let allData = []
  405. for(let bar of bars){
  406. allData = allData.concat(bar.data)
  407. barData.push(
  408. {
  409. "name": bar.name,
  410. "type": "bar",
  411. "stack": "总量",
  412. "barWidth": "40%",
  413. "data": bar.data,
  414. color: bar.color,
  415. itemStyle: {
  416. normal: {
  417. label: {
  418. show: true, //开启显示
  419. offset: [20, 0],
  420. formatter: (v) => {
  421. return this.minShow<v.value ? `{a|} `+v.value:''
  422. },
  423. rich: {
  424. a: {
  425. width: 30,
  426. height: 2,
  427. backgroundColor: bar.color
  428. },
  429. },
  430. textStyle: { //数值样式
  431. color: '#333',
  432. fontSize: 14
  433. }
  434. }
  435. }
  436. }
  437. }
  438. )
  439. legendData.push(
  440. {
  441. "name": bar.name
  442. }
  443. )
  444. }
  445. const sortedWithIndex = allData
  446. .map((value, idx) => ({ value, index: idx }))
  447. .sort((a, b) => b.value - a.value)
  448. this.minShow = sortedWithIndex[sortedWithIndex.length/3] .value
  449. this.barLineChart = this.$echarts.init(this.$refs.barLine)
  450. let option = {
  451. "legend": {
  452. "orient": "horizontal",
  453. "data": [
  454. ...legendData,
  455. {
  456. "name": "OTD0"
  457. },
  458. ],
  459. "left": 0,
  460. "top": "4%",
  461. "textStyle": {
  462. "color": "#666",
  463. "fontSize": 14
  464. }
  465. },
  466. "animation": false,
  467. "grid": {
  468. left: '2%',
  469. right: '4%',
  470. bottom: '6%',
  471. top: '16%',
  472. "containLabel": true
  473. },
  474. "tooltip": {
  475. "trigger": "axis",
  476. "axisPointer": {
  477. "type": "shadow"
  478. },
  479. "textStyle": {
  480. "align": "left"
  481. }
  482. },
  483. "xAxis": [
  484. {
  485. "type": "category",
  486. "data": weeks,
  487. "axisTick": {
  488. "show": false,
  489. },
  490. "axisLine": {
  491. "show": true,
  492. lineStyle: {
  493. color: '#cdd5e2'
  494. }
  495. },
  496. "axisLabel": {
  497. "show": true,
  498. "textStyle": {
  499. "color": "#282828",
  500. "fontSize": 14
  501. },
  502. "formatter": "{value}"
  503. },
  504. }
  505. ],
  506. "yAxis": [
  507. {
  508. "type": "value",
  509. // "max": "600",
  510. "axisTick": {
  511. "show": false
  512. },
  513. "axisLine": {
  514. "show": true,
  515. lineStyle: {
  516. color: '#cdd5e2'
  517. }
  518. },
  519. "axisLabel": {
  520. "show": true,
  521. "textStyle": {
  522. "color": "#282828",
  523. "fontSize": 14
  524. }
  525. },
  526. "splitLine": {
  527. "show": false,
  528. "lineStyle": {
  529. "color": "rgba(255,255,255,0.2)"
  530. }
  531. }
  532. },
  533. {
  534. type: "value",
  535. name: "百分比",
  536. // "max": "2",
  537. nameTextStyle: {
  538. color: "#666666"
  539. },
  540. position: "right",
  541. axisLine: {
  542. lineStyle: {
  543. color: '#cdd5e2'
  544. }
  545. },
  546. splitLine: {
  547. show: false,
  548. },
  549. axisLabel: {
  550. show: true,
  551. formatter: "{value} %", //右侧Y轴文字显示
  552. textStyle: {
  553. color: "#666666",
  554. fontSize: 14,
  555. }
  556. }
  557. }
  558. ],
  559. "series": [
  560. // {symbol: 'circle'},
  561. ...barData,
  562. {
  563. name: "OTD0",
  564. type: "line",
  565. yAxisIndex: 1, //使用的 y 轴的 index,在单个图表实例中存在多个 y轴的时候有用
  566. smooth: false, //平滑曲线显示
  567. symbol: "circle", //标记的图形为实心圆
  568. symbolSize: 8, //标记的大小
  569. itemStyle: {
  570. normal: {
  571. color: '#72A9FE',
  572. borderColor: 'rgba(114, 169, 254, 0.5)', //圆点透明 边框
  573. borderWidth: 7
  574. },
  575. },
  576. lineStyle: {
  577. color: "#72A9FE"
  578. },
  579. data: lineData
  580. },
  581. ]
  582. }
  583. this.barLineChart.setOption(option);
  584. await this.$nextTick()
  585. },
  586. initPieAndColumnar(){
  587. let data;
  588. let color;
  589. let columnarInside;
  590. let columnarOutside;
  591. getAction(this.url.initPieAndColumnar, 'get').then((res) => {
  592. if(res.success) {
  593. data = res.result;
  594. this.loadingPie(res.result);
  595. this.loadingShadow(res.result);
  596. }
  597. });
  598. },
  599. loadingPie(data) {
  600. this.pieChart = this.$echarts.init(this.$refs.pie)
  601. let legendData = [];
  602. let color = []
  603. data.pieInside.forEach(res => {
  604. legendData.push("name", res.name);
  605. color.push(res.itemStyle.color);
  606. })
  607. console.log(data);
  608. let option = {
  609. color: color,
  610. tooltip: {
  611. trigger: 'item',
  612. formatter: '{a} <br/>{b}: {c} ({d}%)'
  613. },
  614. backgroundColor: '#fff',
  615. legend: {
  616. data: legendData
  617. },
  618. series: [
  619. {
  620. name: 'Access From',
  621. type: 'pie',
  622. selectedMode: 'single',
  623. radius: [0, '30%'],
  624. label: {
  625. position: 'inner',
  626. fontSize: 14
  627. },
  628. labelLine: {
  629. show: false
  630. },
  631. data: data.pieInside
  632. },
  633. {
  634. name: 'Access From',
  635. type: 'pie',
  636. radius: ['45%', '60%'],
  637. labelLine: {
  638. length: 30
  639. },
  640. label: {
  641. formatter: '{a|{b}}{abg|}\n{hr|}\n {b|数量:}{c} {per|{d}%} ',
  642. backgroundColor: '#F6F8FC',
  643. borderColor: '#8C8D8E',
  644. borderWidth: 1,
  645. borderRadius: 4,
  646. rich: {
  647. a: {
  648. color: '#6E7079',
  649. lineHeight: 22,
  650. align: 'center'
  651. },
  652. hr: {
  653. borderColor: '#8C8D8E',
  654. width: '100%',
  655. borderWidth: 1,
  656. height: 0
  657. },
  658. b: {
  659. color: '#4C5058',
  660. fontSize: 14,
  661. fontWeight: 'bold',
  662. lineHeight: 33
  663. },
  664. per: {
  665. color: '#fff',
  666. backgroundColor: '#4C5058',
  667. padding: [3, 4],
  668. borderRadius: 4
  669. }
  670. }
  671. },
  672. data: data.pieOutside
  673. }
  674. ]
  675. };
  676. this.pieChart.setOption(option)
  677. },
  678. loadingShadow(data) {
  679. this.barLineChart = this.$echarts.init(this.$refs.barLine)
  680. let seriesData = [];
  681. let legendData = [];
  682. let lossData = {
  683. name: "LOSS",
  684. type: "line",
  685. yAxisIndex: 1, //使用的 y 轴的 index,在单个图表实例中存在多个 y轴的时候有用
  686. smooth: false, //平滑曲线显示
  687. symbol: "circle", //标记的图形为实心圆
  688. symbolSize: 8, //标记的大小
  689. itemStyle: {
  690. normal: {
  691. color: '#72A9FE',
  692. borderColor: 'rgba(114, 169, 254, 0.5)', //圆点透明 边框
  693. borderWidth: 7
  694. },
  695. },
  696. lineStyle: {
  697. color: "#72A9FE"
  698. },
  699. data: data.lossData
  700. }
  701. let itemStyle = {
  702. normal: {
  703. label: {
  704. show: false,
  705. textStyle: {
  706. color: '#333',
  707. fontSize: 14
  708. }
  709. }
  710. }
  711. }
  712. for (let key in data.columnarData) {
  713. legendData.push("name", key);
  714. seriesData.push({
  715. "name": key,
  716. "type": "bar",
  717. "data": data.columnarData[key],
  718. "stack": "总量",
  719. "barWidth": "40%",
  720. "itemStyle": itemStyle});
  721. }
  722. seriesData.push(lossData);
  723. let option = {
  724. "backgroundColor": "#fff",
  725. "color": [
  726. "#72A9FE",
  727. "#FFC533",
  728. "#56C994",
  729. "#F6856E",
  730. "#CC66FF",
  731. "#CCCC66"
  732. ],
  733. "title": {
  734. },
  735. "legend": {
  736. "orient": "horizontal",
  737. "data": legendData,
  738. "left": 0,
  739. "top": "4%",
  740. "textStyle": {
  741. "color": "#666",
  742. "fontSize": 14
  743. }
  744. },
  745. "grid": {
  746. left: '2%',
  747. right: '4%',
  748. bottom: '6%',
  749. top: '16%',
  750. "containLabel": true
  751. },
  752. "tooltip": {
  753. "trigger": "axis",
  754. "axisPointer": {
  755. "type": "shadow"
  756. },
  757. "textStyle": {
  758. "align": "left"
  759. }
  760. },
  761. "xAxis": [
  762. {
  763. "type": "category",
  764. "data": data.columnarWeeks,
  765. "axisTick": {
  766. "show": false,
  767. },
  768. "axisLine": {
  769. "show": true,
  770. lineStyle: {
  771. color: '#cdd5e2'
  772. }
  773. },
  774. "axisLabel": {
  775. "show": true,
  776. "textStyle": {
  777. "color": "#282828",
  778. "fontSize": 14
  779. },
  780. "formatter": "{value}"
  781. },
  782. }
  783. ],
  784. "yAxis": [
  785. {
  786. "type": "value",
  787. "max": data.weekMax,
  788. "axisTick": {
  789. "show": false
  790. },
  791. "axisLine": {
  792. "show": true,
  793. lineStyle: {
  794. color: '#cdd5e2'
  795. }
  796. },
  797. "axisLabel": {
  798. "show": true,
  799. "textStyle": {
  800. "color": "#282828",
  801. "fontSize": 14
  802. }
  803. },
  804. "splitLine": {
  805. "show": false,
  806. "lineStyle": {
  807. "color": "rgba(255,255,255,0.2)"
  808. }
  809. }
  810. },
  811. {
  812. type: "value",
  813. name: "百分比",
  814. "max": "10",
  815. nameTextStyle: {
  816. color: "#666666"
  817. },
  818. position: "right",
  819. axisLine: {
  820. lineStyle: {
  821. color: '#cdd5e2'
  822. }
  823. },
  824. splitLine: {
  825. show: false,
  826. },
  827. axisLabel: {
  828. show: true,
  829. formatter: "{value} %", //右侧Y轴文字显示
  830. textStyle: {
  831. color: "#666666",
  832. fontSize: 14,
  833. }
  834. }
  835. }
  836. ],
  837. dataZoom: [
  838. {
  839. show: true,
  840. realtime: true,
  841. "height": 12,
  842. start: 0,
  843. end: 70,
  844. bottom: '2%',
  845. },
  846. {
  847. type: 'inside',
  848. realtime: true,
  849. "height": 12,
  850. start: 0,
  851. end: 70
  852. }
  853. ],
  854. "series": seriesData,
  855. }
  856. this.barLineChart.setOption(option);
  857. }
  858. }
  859. }
  860. </script>
  861. <style scoped>
  862. @import '~@assets/less/common.less';
  863. </style>