index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <div class="app-container">
  3. <y-data-view-page-layout title="市场管理首页" class="staff-admin-index">
  4. <y-data-view-module>
  5. <div style="width: 1660px">
  6. <y-d-v-over-view style="width: 220px" title="本年签约目标" :typeId="1" :ico="require('@/assets/statics/pg8.png')" :data="[{text:marketStaticsInfo.yearSaleTarget,value:'元'}]" @click.native="openSet('本年签约目标')"></y-d-v-over-view>
  7. <y-d-v-over-view style="width: 220px" title="本年回款目标" :typeId="2" :ico="require('@/assets/statics/pg8.png')" :data="[{text:marketStaticsInfo.yearPaymentTarget,value:'元'}]" @click.native="openSet('本年回款目标')"></y-d-v-over-view>
  8. <y-d-v-over-view style="width: 220px" title="潜在商机" :typeId="3" :ico="require('@/assets/statics/pg8.png')" :data="[{text:marketStaticsInfo.businessNum,value:'个'}]" @click.native="toBusinessPage()"></y-d-v-over-view>
  9. <y-d-v-over-view style="width: 220px" title="预计签约金额" :typeId="6" :ico="require('@/assets/statics/pg9.png')" :data="[{text:marketStaticsInfo.estimateAmount,value:'元'}]" @click.native="toBusinessPage()"></y-d-v-over-view>
  10. <y-d-v-over-view style="width: 220px" title="本年已签约" :typeId="4" :ico="require('@/assets/statics/pg9.png')" :data="[{text:marketStaticsInfo.yearSaleDone,value:'元'}]" @click.native="toItemPage()"></y-d-v-over-view>
  11. <y-d-v-over-view style="width: 220px" title="本年已回款" :typeId="5" :ico="require('@/assets/statics/pg9.png')" :data="[{text:marketStaticsInfo.yearPaymentDone,value:'元'}]" @click.native="toPaymentPage('year')"></y-d-v-over-view>
  12. <y-d-v-over-view style="width: 220px" title="本月已回款" :typeId="6" :ico="require('@/assets/statics/pg9.png')" :data="[{text:marketStaticsInfo.monthPaymentDone,value:'元'}]" @click.native="toPaymentPage('month')"></y-d-v-over-view>
  13. <el-tooltip class="item" effect="dark" content="当月回款完成率" placement="bottom">
  14. <el-progress style=" margin-left:12px ;width: 91%" :text-inside="true" :stroke-width="24" :percentage=percentage status="success" />
  15. </el-tooltip>
  16. </div>
  17. </y-data-view-module>
  18. <div class="calendar-class">
  19. <span style="margin-left: 20px">工作台历</span>
  20. <el-calendar v-model="value">
  21. <div class="cell"
  22. slot="dateCell"
  23. slot-scope="{date, data}" @click="openDrawer(data)" style="width: 100%;height: 100%">
  24. <span :class="data.isSelected ? 'is-selected' : ''" >
  25. {{ data.day.split('-').slice(1).join('-') }} {{ data.isSelected ? '✔️' : ''}}
  26. </span>
  27. <el-icon v-if="checkStar(data.day)" class="el-icon-star-on" style="color: #ffdf1a;font-size: 30px "/>
  28. </div>
  29. </el-calendar>
  30. </div>
  31. <el-drawer
  32. :title="title"
  33. :before-close="handleClose"
  34. :visible.sync="dialog"
  35. direction="rtl"
  36. custom-class="demo-drawer"
  37. ref="drawer"
  38. >
  39. <div class="demo-drawer__content">
  40. <el-form :model="form">
  41. <el-col :span="10" style="padding-right: 10px">
  42. <y-data-view-module>
  43. <el-button type="warning" style="position: absolute;top:20px;right:60px;font-weight: bolder;cursor: pointer" @click="dialogVisible = true" >添加内容</el-button>
  44. <div class="plan-class">
  45. <div style="width: 530px;display: flex " v-for="(item,index) in dynamicTags">
  46. <span style="display:inline-block;width:500px;word-break: break-all; white-space:normal;margin: 10px 10px 10px 10px;line-height: 25px;">
  47. {{ index+1 }}、{{ item.content }}
  48. </span>
  49. <el-icon class="el-icon-edit-outline" style="color: red;cursor:pointer; margin-left: 5px" @click.native="editNote(item)"/>
  50. <el-icon class="el-icon-circle-close" style="color: red;cursor:pointer; margin-left: 5px" @click.native="deltag(item.id)"/>
  51. </div>
  52. <span v-if="dynamicTags.length<8 & dynamicTags.length!=0" style="display:inline-block;width:530px;height:400px;word-break: break-all; white-space:normal;margin: 10px 10px 10px 10px;line-height: 25px;" >
  53. </span>
  54. <div class="plan-class" v-if="dynamicTags.length===0">
  55. <span style="display:inline-block;width:530px;height:500px;word-break: break-all; white-space:normal;margin: 10px 10px 10px 10px;line-height: 25px;">
  56. </span>
  57. </div>
  58. </div>
  59. </y-data-view-module>
  60. <el-dialog
  61. title="便签内容"
  62. :visible.sync="dialogVisible"
  63. width="30%"
  64. custom-class="tag-class"
  65. >
  66. <el-input
  67. type="textarea"
  68. :rows="2"
  69. placeholder="请输入内容"
  70. v-model="textareadata"
  71. />
  72. <span slot="footer" class="dialog-footer">
  73. <el-button @click="dialogVisible = false">取 消</el-button>
  74. <el-button type="primary" @click="addtag">确 定</el-button>
  75. </span>
  76. </el-dialog>
  77. </el-col>
  78. </el-form>
  79. </div>
  80. </el-drawer>
  81. <el-dialog
  82. :title="setName"
  83. width="600px"
  84. :visible.sync="setDialogFormVisible"
  85. :close-on-click-modal="false"
  86. >
  87. <template>
  88. <el-table
  89. :data="tableData"
  90. border
  91. style="width: 100%">
  92. <el-table-column
  93. prop="date"
  94. label="姓名"
  95. align="center"
  96. width="280px">
  97. <template slot-scope="{row}">
  98. <span>{{ row.userName }}</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column v-if="setName==='本年签约目标' "
  102. prop="name"
  103. label="签约目标"
  104. align="center"
  105. width="278px">
  106. <template slot-scope="{row}">
  107. <span>{{ row.saleTarget }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column v-if="setName==='本年回款目标' "
  111. prop="name"
  112. label="回款目标"
  113. align="center"
  114. width="278px">
  115. <template slot-scope="{row}">
  116. <span>{{ row.paymentTarget }}</span>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. </template>
  121. <br>
  122. <el-form
  123. ref="setForm"
  124. :model="temp"
  125. label-position="right"
  126. label-width="110px"
  127. style="width: 400px; margin-left:50px;"
  128. >
  129. <el-form-item label="我的目标:" prop="amount">
  130. <el-input v-model.number="temp.amount" class="filter-item" type="number"/>
  131. </el-form-item>
  132. <el-form-item label="">
  133. <el-button @click="setDialogFormVisible = false">
  134. 取消
  135. </el-button>
  136. <el-button type="primary" @click="saveSet()">
  137. 保存
  138. </el-button>
  139. </el-form-item>
  140. </el-form>
  141. </el-dialog>
  142. </y-data-view-page-layout>
  143. </div>
  144. </template>
  145. <script>
  146. import YDVOverView from '@/components/YDataViewPageLayout/YDVOverView'
  147. import YDataViewModule from '@/components/YDataViewPageLayout/YDataViewModule'
  148. import YDataViewPageLayout from '@/components/YDataViewPageLayout'
  149. export default {
  150. name: 'logIndex',
  151. components: {
  152. YDVOverView,
  153. YDataViewModule,
  154. YDataViewPageLayout
  155. },
  156. data() {
  157. return {
  158. value: new Date(),
  159. marketStaticsInfo:{},
  160. table: false,
  161. dialog: false,
  162. loading: false,
  163. form: {
  164. name: '',
  165. region: '',
  166. date1: '',
  167. date2: '',
  168. delivery: false,
  169. type: [],
  170. resource: '',
  171. desc: ''
  172. },
  173. formLabelWidth: '80px',
  174. timer: null,
  175. currentDate:'',
  176. editId:'',
  177. textareadata:'',
  178. dialogVisible:false,
  179. dynamicTags: [],
  180. calandarList:[],
  181. setDialogFormVisible:false,
  182. temp:{
  183. saleTarget:null,
  184. paymentTarget:null,
  185. amount:null
  186. },
  187. setName:'',
  188. tableData:[],
  189. noteId:null,
  190. }
  191. },
  192. created() {
  193. this.getCanlendarList();
  194. this.getMarketStat();
  195. },
  196. computed:{
  197. title(){
  198. return this.currentDate +" 工作计划";
  199. },
  200. percentage(){
  201. const date = new Date();
  202. const month = date.getMonth() + 1;
  203. const target = this.marketStaticsInfo.yearPaymentTarget;
  204. const paymentDone = this.marketStaticsInfo.yearPaymentDone;
  205. const currentTarget = target/10 * month===0?1:target/10 * month;
  206. const percent = Math.round((paymentDone/currentTarget) * 100)
  207. if (!isNaN(percent)){
  208. return Math.round((paymentDone/currentTarget) * 100);
  209. }
  210. }
  211. },
  212. methods: {
  213. editNote(item){
  214. this.dialogVisible = true;
  215. this.textareadata = item.content;
  216. this.noteId = item.id;
  217. },
  218. toItemPage(){
  219. this.$router.push(`/item/list/mine?isCurYear=true`);
  220. },
  221. toBusinessPage() {
  222. this.$router.push(`/market/business`)
  223. },
  224. toPaymentPage(val) {
  225. const date = new Date();
  226. if (val === 'year'){
  227. this.$router.push(`/market/payment/list?isCurYear=true`)
  228. }
  229. if (val === 'month'){
  230. this.$router.push(`/market/payment/list?isCurMonth=true`)
  231. }
  232. },
  233. saveSet(){
  234. if (isNaN(this.temp.amount) || this.temp.amount===null){
  235. this.$notify({
  236. title: '失败',
  237. message: '请输入数字',
  238. type: 'error',
  239. duration: 2000
  240. });
  241. return
  242. }
  243. if (this.setName === '本年签约目标'){
  244. this.temp.saleTarget = this.temp.amount;
  245. }
  246. if (this.setName === '本年回款目标'){
  247. this.temp.paymentTarget = this.temp.amount;
  248. }
  249. let data = {
  250. saleTarget:this.temp.saleTarget,
  251. paymentTarget:this.temp.paymentTarget
  252. };
  253. this.$api.userTarget.add(data).then(data => {
  254. if (data.code === 200) {
  255. this.setDialogFormVisible = false;
  256. this.$notify({
  257. title: '成功',
  258. message: '修改成功',
  259. type: 'success',
  260. duration: 2000
  261. });
  262. this.getMarketStat();
  263. }else{
  264. this.$message.success(data.msg)
  265. }
  266. })
  267. },
  268. openSet(key){
  269. this.$api.userTarget.list().then(data=>{
  270. if (data.code ===200){
  271. this.tableData = data.data
  272. }else{
  273. this.$message.success(data.msg)
  274. }
  275. });
  276. this.temp.amount = null;
  277. this.setName = key;
  278. this.setDialogFormVisible = true;
  279. },
  280. getCanlendarList(){
  281. let userId = this.$store.getters.userInfo.id;
  282. this.$api.note.countByDate(userId).then(data => {
  283. if (data.code ===200){
  284. this.calandarList = data.data
  285. }else{
  286. this.$message.success(data.msg)
  287. }
  288. })
  289. },
  290. checkStar(day){
  291. this.flag = false;
  292. for(let item of this.calandarList){
  293. if (item.noteDate === day){
  294. this.flag = true;
  295. }
  296. }
  297. return this.flag;
  298. },
  299. addtag(){
  300. let data = {
  301. noteDate:this.currentDate,
  302. content:this.textareadata,
  303. userId: this.$store.getters.userInfo.id,
  304. id:this.noteId
  305. };
  306. if(data.id){
  307. this.$api.note.edit(data).then(data => {
  308. if (data.code ===200){
  309. this.$message.success('修改成功');
  310. this.dialogVisible=false
  311. this.textareadata = '';
  312. this.tagdata();
  313. this.editId = '';
  314. this.getCanlendarList();
  315. }else{
  316. this.$message.success(data.msg)
  317. }
  318. this.noteId = null;
  319. })
  320. }else{
  321. this.$api.note.add(data).then(data => {
  322. if (data.code ===200){
  323. this.$message.success('保存成功');
  324. this.dialogVisible=false;
  325. this.textareadata = '';
  326. this.tagdata();
  327. this.editId = '';
  328. this.getCanlendarList();
  329. }else{
  330. this.$message.success(data.msg)
  331. }
  332. })
  333. }
  334. },
  335. tagdata(){
  336. let data = {
  337. noteDate:this.currentDate,
  338. userId: this.$store.getters.userInfo.id
  339. }
  340. this.$api.note.listByDate(data).then(data => {
  341. if (data.code ===200){
  342. this.dynamicTags = data.data
  343. }else{
  344. this.$message.success(data.msg)
  345. }
  346. })
  347. },
  348. deltag(val){
  349. this.$api.note.delete(val).then(data => {
  350. if (data.code ===200){
  351. this.$message.success('删除成功')
  352. this.tagdata()
  353. this.getCanlendarList();
  354. }else{
  355. this.$message.success(data.msg)
  356. }
  357. })
  358. },
  359. handleClose(done) {
  360. if (this.loading) {
  361. return;
  362. }
  363. done();
  364. // 动画关闭需要一定的时间
  365. setTimeout(() => {
  366. this.loading = false;
  367. }, 400);
  368. },
  369. cancelForm() {
  370. this.loading = false;
  371. this.dialog = false;
  372. clearTimeout(this.timer);
  373. },
  374. openDrawer(date){
  375. this.dialog = true
  376. this.currentDate = date.day;
  377. this.tagdata();
  378. },
  379. getMarketStat(){
  380. this.$api.marketStat.getMarketStat().then(res => {
  381. if (res.code === 200){
  382. this.marketStaticsInfo = res.data;
  383. }
  384. });
  385. },
  386. }
  387. }
  388. </script>
  389. <style lang="css" scoped>
  390. .calendar-class{
  391. margin-left: 20px;
  392. height: 500px;
  393. }
  394. .plan-class{
  395. /*width: 540px;*/
  396. /*border: 1px solid darkgray;*/
  397. /*box-shadow: 10px 10px 5px #888888;;*/
  398. /*border-radius: 10px;*/
  399. /*overflow: auto;*/
  400. width: 540px;
  401. -moz-box-shadow: 0 2px 10px 1px rgba(0, 0, 0, 0.2);
  402. -webkit-box-shadow: 0 2px 10px 1px rgba(0, 0, 0, 0.2);
  403. box-shadow: 0 2px 10px 1px rgba(0, 0, 0, 0.2);
  404. background:
  405. -moz-repeating-linear-gradient(
  406. top,
  407. #fcf59b,
  408. #fcf59b 29px,
  409. #81cbbc 30px
  410. );
  411. background:
  412. -webkit-gradient(
  413. linear,
  414. left top, left bottom,
  415. from(#81cbbc),
  416. color-stop(2%, #fcf59b)
  417. );
  418. background:
  419. repeating-linear-gradient(
  420. top,
  421. #fcf59b,
  422. #fcf59b 29px,
  423. #81cbbc 30px
  424. );
  425. -webkit-background-size: 100% 30px;
  426. }
  427. .plan-class:after {
  428. width: 180px;
  429. height: 30px;
  430. content: " ";
  431. margin-left: -90px;
  432. border: 1px solid rgba(200, 200, 200, .8);
  433. background: rgba(254, 254, 254, .6);
  434. -moz-box-shadow: 0px 0 3px rgba(0, 0, 0, 0.1);
  435. -webkit-box-shadow: 0px 0 3px rgba(0, 0, 0, 0.1);
  436. box-shadow: 0px 0 3px rgba(0, 0, 0, 0.1);
  437. -moz-transform: rotate(-5deg);
  438. -webkit-transform: rotate(-5deg);
  439. -o-transform: rotate(-5deg);
  440. transform: rotate(-5deg);
  441. position: absolute;
  442. left: 50%;
  443. top: 95px;
  444. }
  445. /deep/.tag-class{
  446. border-radius: 20px;
  447. }
  448. div.cell{
  449. float: right;
  450. }
  451. </style>