index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <u-sticky class="shadow-default projectOverview" bgColor="#fff" style="top: 0">
  3. <u-navbar :titleStyle="{ color: '#000' }" :autoBack="true" title="概览" :placeholder="true" :safeAreaInsetTop="true" bgColor="#fff">
  4. <template #left>
  5. <view class="u-navbar__content__left__item">
  6. <u-icon name="arrow-left" size="20" color="#000"></u-icon>
  7. </view>
  8. </template>
  9. </u-navbar>
  10. </u-sticky>
  11. <oa-scroll
  12. customClass="invoicing-container scroll-height"
  13. :customStyle="{}"
  14. :isSticky="true"
  15. :refresherLoad="false"
  16. :refresherEnabled="false"
  17. :refresherDefaultStyle="'none'"
  18. :refresherThreshold="44"
  19. :refresherBackground="'#f5f6f7'"
  20. :scrollIntoView="scrollIntoView"
  21. :data-theme="'theme-' + proxy.$settingStore.themeColor.name"
  22. style="height: calc(100% - 44px);"
  23. >
  24. <view class="projectName">{{ project.projectName }}</view>
  25. <view>
  26. <view class="menu-list" style="font-size: 15px; line-height: 30px;padding:0;">
  27. <view class="list-cell" style="color: #666666;padding:10px;">
  28. <view class="menu-item">
  29. <span style="color:#559AFF;font-weight:bold;font-size: 15px;">丨 概况</span>
  30. </view>
  31. <view class="tableType4" style="margin-top:10px;">
  32. <u-row v-for="(item, index) in overviewData" :key="index">
  33. <u-col span="4">
  34. <view style="text-align: left; padding: 0px 5px 0px 5px" >{{ item.label }}</view>
  35. </u-col>
  36. <u-col span="8">
  37. <view style="text-align: left; padding: 0px 5px 0px 5px;overflow-x:scroll !important;width:100%;white-space:none !important;" v-if="!item.color">{{ item.value ? item.value : '无' }}</view>
  38. <view style="text-align: left; padding: 0px 5px 0px 5px;overflow-x:scroll !important;width:100%;white-space:none !important;" v-if="item.color"><span :style="{color:item.color}">{{ item.value }}</span></view>
  39. </u-col>
  40. </u-row>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="menu-list" style="font-size: 15px; line-height: 30px;padding:0;">
  45. <view class="list-cell" style="color: #666666;padding:10px;">
  46. <view class="menu-item">
  47. <span style="color:#559AFF;font-weight:bold;">丨 背景</span>
  48. </view>
  49. <view class="menu-item textExceeds">
  50. <span>{{ project.projectDescribe ? project.projectDescribe : "无" }}</span>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="menu-list" style="font-size: 15px; line-height: 30px;padding:0;">
  55. <view class="list-cell" style="color: #666666;padding:10px;">
  56. <view class="menu-item">
  57. <span style="color:#559AFF;font-weight:bold;">丨 工时投入统计</span>
  58. </view>
  59. <view class="menu-item">
  60. <view class="example-body" style="width:100%">
  61. <uni-datetime-picker v-model="range" type="daterange" :clear-icon="false" @change="changeTime" style="margin:10px 0;"/>
  62. <lineEcharts :xAxisDataList="xAxisDataList" :seriesDataList="seriesDataList" style="width:100%;margin-top:10px;" v-if="xAxisDataList.length>0"></lineEcharts>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </oa-scroll>
  69. </template>
  70. <script setup>
  71. /*----------------------------------依赖引入-----------------------------------*/
  72. import { onLoad, onShow, onReady, onHide, onLaunch, onNavigationBarButtonTap, onPageScroll } from "@dcloudio/uni-app";
  73. import { ref, reactive, computed, getCurrentInstance, toRefs, inject } from "vue";
  74. /*----------------------------------接口引入-----------------------------------*/
  75. import { crmInvoiceInfo, page } from "@/api/common/invoicing.js";
  76. import { projectApi } from "@/api/business/project.js";
  77. import { dUserList } from "@/api/system/user.js";
  78. import dayjs from 'dayjs/esm/index'
  79. /*----------------------------------组件引入-----------------------------------*/
  80. import lineEcharts from "./components/echarts.vue";
  81. /*----------------------------------store引入-----------------------------------*/
  82. /*----------------------------------公共方法引入-----------------------------------*/
  83. /*----------------------------------公共变量-----------------------------------*/
  84. const { proxy } = getCurrentInstance();
  85. const { project_type,project_status } = proxy.useDict("project_type","project_status");
  86. /*----------------------------------变量声明-----------------------------------*/
  87. const uForm = ref(null);
  88. const range = ref([dayjs().subtract(30, "day").format("YYYY-MM-DD"),dayjs().subtract(0, "day").format("YYYY-MM-DD")])
  89. const state = reactive({
  90. projectId: "",//项目id
  91. project:{},//项目信息
  92. userDate:[],//人员列表
  93. form: {
  94. customId: "", //客户管理id
  95. invoiceTitle: "", //发票抬头
  96. dutyId: "", //税号
  97. email: "", //电子邮箱
  98. applicant: "", //申请人
  99. phone: "", //手机号码
  100. amount: "", //金额
  101. invoiceType: "1", //发票类型;1:普票,2:专票
  102. invoiceAttribute: "1", //发票性质;1:电子发票,2:纸质发票
  103. sendAddress: "", //邮寄地址
  104. paymentReceipt: "", //付款回执
  105. },
  106. overviewData:[
  107. { label:"负责人", value:"",color:"" },
  108. { label:"状态", value:"",color:"" },
  109. { label:"类型", value:"",color:"" },
  110. { label:"计划人天", value:"",color:"" },
  111. { label:"成员", value:"",color:"" },
  112. { label:"时间", value:"",color:"" },
  113. ],
  114. xAxisDataList:[],
  115. seriesDataList:[],
  116. scrollIntoView: "",
  117. promptStatus: false,
  118. });
  119. const { scrollIntoView, promptStatus,project,userDate,overviewData,projectId,xAxisDataList,seriesDataList } = toRefs(state);
  120. /**
  121. * @提交
  122. */
  123. function handleSubmit(value) {
  124. scrollIntoView.value = "";
  125. uForm.value
  126. .validate()
  127. .then((res) => {
  128. uni.$u.toast("校验通过");
  129. proxy.$modal.loading("加载中");
  130. page({
  131. current: 1,
  132. size: 10,
  133. invoiceTitle: form.value.invoiceTitle,
  134. startTime: proxy.$time.getYearLast(new Date()),
  135. endTime: proxy.$time.getFormatterDate(new Date()),
  136. }).then((requset) => {
  137. if (requset.status === "SUCCESS") {
  138. proxy.$modal.closeLoading();
  139. if (requset.data.records.length > 0) {
  140. promptStatus.value = true;
  141. scrollIntoView.value = "noticeBar";
  142. } else {
  143. var param = {
  144. customId: parseInt(form.value.customId), //客户管理id
  145. invoiceTitle: form.value.invoiceTitle, //发票抬头
  146. dutyId: form.value.dutyId, //税号
  147. email: form.value.email, //电子邮箱
  148. applicant: form.value.applicant, //申请人
  149. phone: form.value.phone, //手机号码
  150. amount: parseFloat(form.value.amount), //金额
  151. invoiceType: parseInt(form.value.invoiceType), //发票类型;1:普票,2:专票
  152. invoiceAttribute: parseInt(form.value.invoiceAttribute), //发票性质;1:电子发票,2:纸质发票
  153. sendAddress: form.value.sendAddress, //邮寄地址
  154. paymentReceipt: form.value.paymentReceipt, //付款回执
  155. };
  156. crmInvoiceInfo(param).then((requset) => {
  157. if (requset.status === "SUCCESS") {
  158. proxy.$tab.navigateTo("/pages/common/success/index?codeName=提交成功");
  159. }
  160. });
  161. }
  162. }
  163. });
  164. })
  165. .catch((errors) => {
  166. uni.$u.toast("校验失败");
  167. });
  168. }
  169. function changeTime(e){
  170. xAxisDataList.value=[]
  171. getEchartsData()
  172. }
  173. /**
  174. * @api接口查询
  175. */
  176. function selectListApi(id) {
  177. dUserList().then((res) => {
  178. state.userDate = res.data;
  179. projectApi()
  180. .ProjectsList({
  181. projectId: id,
  182. })
  183. .then((requset) => {
  184. project.value = requset.data.records[0];
  185. overviewData.value[0].value = proxy.$common.mapping("nickName", "userId", project.value.projectHead, userDate.value)
  186. overviewData.value[1].value = proxy.$common.mapping("label", "value", project.value.projectStatus, project_status.value)
  187. overviewData.value[1].color = proxy.$common.mapping("elTagClass", "value", project.value.projectStatus, project_status.value)
  188. overviewData.value[2].value = proxy.$common.mapping("label", "value", project.value.projectType, project_type.value)
  189. overviewData.value[3].value = project.value.projectWorkload
  190. overviewData.value[4].value = proxy.$common.mapping("nickName", "userId", project.value.projectMember, userDate.value)
  191. overviewData.value[5].value = project.value.startTime || project.value.endTime ?
  192. (project.value.startTime ? project.value.startTime.slice(0, 10) : "") +
  193. " 至 " + (project.value.endTime ? project.value.endTime.slice(0, 10) : '') : ""
  194. })
  195. });
  196. }
  197. function getEchartsData(){
  198. projectApi()
  199. .usersProjectWorkTime(
  200. {
  201. projectId:projectId.value,
  202. startDate:range.value[0],
  203. endDate:range.value[1]
  204. }
  205. ).then((res) => {
  206. xAxisDataList.value = res.data.users
  207. seriesDataList.value = res.data.workTime
  208. })
  209. }
  210. onLoad((options) => {
  211. if(options.id){
  212. projectId.value= options.id
  213. selectListApi(options.id)
  214. getEchartsData()
  215. }
  216. });
  217. onReady(() => {});
  218. onShow((options) => {
  219. //调用系统主题颜色
  220. proxy.$settingStore.systemThemeColor([1]);
  221. });
  222. // 自定义导航事件
  223. onNavigationBarButtonTap((e) => {
  224. if (e.float == "right") {
  225. }
  226. });
  227. </script>
  228. <style lang="scss" scoped>
  229. :deep(.uni-page-head__title) {
  230. opacity: 1 !important;
  231. }
  232. .projectName{
  233. text-align: center;
  234. font-size: 15px;
  235. font-weight: bold;
  236. margin:10px 0 0 ;
  237. }
  238. </style>
  239. <style>
  240. /* 时间样式 */
  241. :deep(.uni-date-editor--x){
  242. border-radius: 20px !important;
  243. width:100% !important;
  244. }
  245. :deep(.uni-date-x){
  246. background-color: transparent !important;
  247. }
  248. </style>