index.vue 14 KB

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