detailInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <basicDetails
  3. ref="details"
  4. :titleText="'年度目标' + mainData.year + '年'"
  5. :oldFormPath="{edit:'HManagement/personalTarget/target/modules/edit/components'}"
  6. :editData="mainData"
  7. :mainAreaData="mainAreaData"
  8. :turnPageId="20220909154602"
  9. idname="sa_salestargetbillid"
  10. ownertable="sa_salestargetbill"
  11. tags=""
  12. :tabs="['项目清单','系统信息']"
  13. @pageChange="pageChange"
  14. @onEditSuccess="queryMainData($route.query.id)"
  15. @onTabClick="onTabClick"
  16. :pageChange="true"
  17. :hideTags="true"
  18. >
  19. <div slot="customOperation">
  20. <!-- 此区域提供了自定义操作按钮 -->
  21. <!-- <issue :data="mainData" @onSuccess="onSuccess"></issue>
  22. <adjustment :data="mainData" @onSuccess="onSuccess" ></adjustment>
  23. <close v-if="mainData.status === '已下达'" :data="mainData" @onClose="onSuccess"></close>
  24. <importFile class="inline-16" accept=".xlsx" :folderid="folderid" :bindData="{ownertable:'sa_salestargetbill',ownerid:'',usetype:'default'}" @onImportSuccess="onImportSuccess">
  25. <a class="error-link" v-if="errorurl" :href="errorurl" slot="errorFile">下载错误数据</a>
  26. </importFile>-->
  27. </div>
  28. <div slot="slot0">
  29. <div class="mt-10">
  30. <project_add v-if="tool.checkAuth($route.name,'addProject') && mainData.status === '新建'" :id="this.$route.query.id" :year="this.$route.query.year" @onSuccess="onSuccess" :disabled="disable" class="inline-16"></project_add>
  31. <el-input style="width:200px;" placeholder="请输入搜索内容" suffix-icon="el-icon-search" @input="searchChange" v-model="params.content.where.condition" @keyup.native.enter="getprojectTargetList(params.content.pageNumber = 1)" @clear="getprojectTargetList(params.content.pageNumber = 1)" size="small" class="input-with-select inline-16" clearable>
  32. </el-input>
  33. </div>
  34. <tableLayout ref="list" :layout="tablecols" :data="list" :custom="true" height="300">
  35. <!-- <template v-slot:customcol="scope">
  36. <div v-if="scope.column.columnname === 'point'">33333</div>
  37. <div v-else ></div>
  38. </template>-->
  39. <template v-slot:customcol="scope">
  40. <el-input size="mini" v-if="(scope.column.columnname === 'target_l' || scope.column.columnname === 'target_h' ) && actindex === scope.column.data.rowindex" v-model="scope.column.data[scope.column.columnname]"></el-input>
  41. <div v-else-if="scope.column.columnname === 'point'">
  42. <el-date-picker
  43. v-if="actindex === scope.column.data.rowindex"
  44. v-model="date"
  45. type="month"
  46. size="mini"
  47. placeholder="选择月"
  48. :picker-options="pickerOptions">
  49. </el-date-picker>
  50. <p v-else>{{scope.column.data.point > 10?scope.column.data.year + '-' + scope.column.data.point:scope.column.data.year + '-0' + scope.column.data.point}}</p>
  51. </div>
  52. <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
  53. </template>
  54. <template v-slot:opreation="scope">
  55. <el-button type="text" size="mini" class="inline-16" @click="edit(scope.data)" v-if="editShow && tool.checkAuth($route.name,'editProjectTask')" :disabled="disable || mainData.status !== '新建'">编辑</el-button>
  56. <el-button type="text" style="color: #e09a1a" size="mini" class="inline-16" v-if="saveShow && actindex === (scope.data.index + 1)" @click="save(scope.data)">保存</el-button>
  57. <project_del class="inline-16" :status="mainData.status" v-if="editShow && tool.checkAuth($route.name,'deleteProject')" :data="scope.data" @onDel="onProjectSuccess" :disabled="disable || mainData.status !== '新建'"></project_del>
  58. </template>
  59. </tableLayout>
  60. <div>
  61. <div class="container normal-panel" style="text-align:right">
  62. <div style="float: left">
  63. <label class="search__label">项目总数:</label>
  64. {{total}}</div>
  65. <div style="float: left;margin-left: 20px">
  66. <label class="search__label" style="width: 160px">项目基本目标(万元):</label>{{target_l}}</div>
  67. <div style="float: left;margin-left: 20px" ><label class="search__label" style="width: 160px">项目挑战目标(万元):</label>{{target_h}}</div>
  68. <el-pagination
  69. background
  70. small
  71. @size-change="handleSizeChange"
  72. @current-change="handleCurrentChange"
  73. :current-page="currentPage"
  74. :page-sizes="[20, 50, 100, 200]"
  75. layout="total,sizes, prev, pager, next, jumper"
  76. :total="total">
  77. </el-pagination>
  78. </div>
  79. </div>
  80. <!-- <targetTable ref="list" class="container normal-panel">
  81. <template v-slot:editTarget="scope">
  82. <editTarget v-if="tool.checkAuth($route.name,'update')" style="display:inline" :year="mainInfo.year" :data="scope.data" @onSuccess="onSuccess"></editTarget>
  83. </template>
  84. <template v-slot:del="scope">
  85. <ondel v-if="tool.checkAuth($route.name,'delete')" :data="scope.data" @onSuccess="onSuccess"></ondel>
  86. </template>
  87. </targetTable>-->
  88. </div>
  89. <div slot="slot1">
  90. <detail_information ref="detailed"></detail_information>
  91. </div>
  92. </basicDetails>
  93. </template>
  94. <script>
  95. import detail_information from './components/detailedInformation'
  96. import project_add from './components/projectAdd/index.vue'
  97. import project_del from './components/delProject'
  98. export default {
  99. components:{detail_information,project_add,project_del},
  100. data(){
  101. return {
  102. pickerOptions:{
  103. disabledDate(time){
  104. return time.getTime() < Date.now()
  105. }
  106. },
  107. disable:false,
  108. actindex:0,
  109. mainData:{},
  110. mainAreaData:[],
  111. editShow:true,
  112. saveShow:false,
  113. tablecols:'',
  114. target_l:0,
  115. target_h:0,
  116. list:[],
  117. total:0,
  118. currentPage:0,
  119. date:'',
  120. params: {
  121. "id": 20220906104002,
  122. "content": {
  123. "year": this.$route.query.year,
  124. "hrid": this.$route.query.id,
  125. "where": {
  126. "condition": ""
  127. },
  128. "pageNumber": 1,
  129. "pageSize": 20
  130. }
  131. }
  132. }
  133. },
  134. methods:{
  135. onTabClick(){
  136. this.$nextTick(e=>{
  137. /*this.$refs.list? this.$refs.list.queryData():''*/
  138. this.$refs.detailed? this.$refs.detailed.detailedList(this.mainData):''
  139. })
  140. },
  141. async queryMainData(id){
  142. console.log(this.$route.query.year)
  143. const res = await this.$api.requested({
  144. "id": 20220906094602,
  145. "content": {
  146. "year": this.$route.query.year,
  147. "hrid": id,
  148. /* "sa_salestargetbillid": 2*///可不传
  149. },
  150. })
  151. this.mainData = res.data
  152. console.log(this.mainData)
  153. if (this.$route.query.id === this.$route.query.ownerHrid){
  154. this.disable = false
  155. }else{
  156. this.disable = true
  157. }
  158. this.changeDataStructure()
  159. this.getprojectTargetList()
  160. },
  161. // 监听切换数据,上一页,下一页
  162. pageChange (id,rowindex) {
  163. this.$router.replace({path:'/projectDetail',query:{id:id,rowindex:rowindex}})
  164. this.queryMainData(id)
  165. },
  166. changeDataStructure(){
  167. this.mainAreaData = [
  168. {
  169. label:'部门',
  170. value:this.mainData.depname
  171. },
  172. {
  173. label:'姓名',
  174. value:this.mainData.name
  175. },
  176. {
  177. label:'职位',
  178. value:this.mainData.position
  179. },
  180. /*{
  181. label:'营销区域',
  182. value:this.mainData.areaname
  183. },*/
  184. {
  185. label:'状态',
  186. value:this.mainData.status
  187. }
  188. ]
  189. },
  190. /* 获取项目目标数据 */
  191. async getprojectTargetList() {
  192. /*this.params.content.hrid = this.hrid*/
  193. let res = await this.$api.requested(this.params)
  194. this.list = res.data
  195. this.total = res.total
  196. this.currentPage = res.pageNumber
  197. console.log("获取项目数据")
  198. console.log(this.list);
  199. const total_target_l = []
  200. this.list.forEach((i,index)=>{
  201. /*total_target_l[index] = i.target_l*/
  202. this.target_l = this.target_l + i.target_l
  203. this.target_h = this.target_h + i.target_h
  204. })
  205. },
  206. searchChange(){
  207. this.getprojectTargetList()
  208. },
  209. onSuccess(){
  210. this.queryMainData(this.$route.query.id)
  211. },
  212. onProjectSuccess(){
  213. this.getprojectTargetList()
  214. },
  215. handleSizeChange(val) {
  216. // console.log(`每页 ${val} 条`);
  217. this.params.content.pageSize = val
  218. this.listData()
  219. },
  220. handleCurrentChange(val) {
  221. // console.log(`当前页: ${val}`);
  222. this.params.content.pageNumber = val
  223. this.listData()
  224. },
  225. edit(rowIndex){
  226. console.log("输出")
  227. console.log(rowIndex)
  228. this.actindex = rowIndex.index + 1
  229. if (rowIndex.point < 10){
  230. this.date = rowIndex.year + '-0' + rowIndex.point
  231. }else {
  232. this.date = rowIndex.year + '-' + rowIndex.point
  233. }
  234. this.saveShow = true
  235. this.editShow = false
  236. },
  237. async save(row){
  238. console.log("保存数据")
  239. console.log(row)
  240. console.log(this.date)
  241. const dateNow = new Date(this.date)
  242. const month = dateNow.getMonth() +1
  243. /* const datenow = new Date()*/
  244. console.log(dateNow.getFullYear(),this.$route.query.year)
  245. if (dateNow.getFullYear() != this.$route.query.year){
  246. this.open()
  247. }else {
  248. console.log(month)
  249. this.saveShow = false
  250. this.editShow = true
  251. this.actindex = 0
  252. const res = await this.$api.requested({
  253. "id": 20220906112602,
  254. "content": {
  255. "sa_salestargetid": row.sa_salestargetid,
  256. "target_l": row.target_l,
  257. "target_h": row.target_h,
  258. "month":month
  259. },
  260. })
  261. this.tool.showMessage(res,()=>{
  262. this.getprojectTargetList()
  263. })
  264. }
  265. },
  266. open() {
  267. this.$confirm('只能填写目标年度的月份!', '提示', {
  268. confirmButtonText: '确定',
  269. showCancelButton:false,
  270. closeOnClickModal:false,
  271. type: 'warning'
  272. }).then(() => {
  273. this.$message({
  274. type: 'success',
  275. message: '请重新填写!'
  276. });
  277. }).catch(() => {
  278. this.$message({
  279. type: 'info',
  280. message: '已取消'
  281. });
  282. });
  283. }
  284. },
  285. created() {
  286. this.queryMainData(this.$route.query.id)
  287. this.tablecols = this.tool.tabelCol(this.$route.name).projectTargetTable.tablecols
  288. console.log(this.$route.query.id)
  289. console.log(this.$route.query.ownerHrid)
  290. if (this.$route.query.id === this.$route.query.ownerHrid){
  291. this.disable = false
  292. }else {
  293. this.disable = true
  294. }
  295. console.log(this.disable)
  296. }
  297. }
  298. </script>
  299. <style>
  300. </style>