awayOffice.vue 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805
  1. <template>
  2. <section>
  3. <div class="sidebars" ref="sidebars" style="width: 200px;display: block;background: #fff" v-if="!isDingding">
  4. <h3><i class="iconfont firerock-iconbaoxiao" style="padding-right: 10px"></i>出差管理</h3>
  5. <el-divider ></el-divider>
  6. <el-col :span="12">
  7. <el-menu default-active="1" class="el-menu-vertical-demo" @select="staffs" background-color="#ffffff" text-color="#666666" active-text-color="#20A0FF" style="width:100%">
  8. <el-menu-item index="1" v-if="permissions.awayOfficeFil">
  9. <i class="iconfont firerock-icontianbao"></i>
  10. <span slot="title">出差填报</span>
  11. </el-menu-item>
  12. <el-submenu index="2" v-if="permissions.awayOfficeAll">
  13. <template slot="title">
  14. <i class="iconfont firerock-iconbaoxiaodan"></i>
  15. <span>{{"出差列表"}}</span>
  16. </template>
  17. <!-- 导航切换 -->
  18. <el-menu-item index="2-1" v-if="permissions.awayOfficeAll"><p @click="bills(false, 2)">全部</p></el-menu-item>
  19. <el-menu-item index="2-2" v-if="permissions.awayOfficeAudit && !isDingding"><p @click="bills(true, 1)">待审核</p></el-menu-item>
  20. </el-submenu>
  21. <el-menu-item index="3" @click="bills(false, 2)" v-if="!permissions.awayOfficeAll">
  22. <i class="iconfont firerock-iconbaoxiaodan"></i>
  23. <span slot="title">我的出差</span>
  24. </el-menu-item>
  25. <el-menu-item index="4" v-if="permissions.awayOfficeStatistical">
  26. <template slot="title">
  27. <i class="iconfont firerock-icontianbao"></i>
  28. <span slot="title">出差统计</span>
  29. </template>
  30. </el-menu-item>
  31. <el-menu-item index="5" v-if="permissions.awayOfficeProcess">
  32. <template slot="title">
  33. <i class="iconfont firerock-iconliucheng"></i>
  34. <span slot="title">出差审批流程</span>
  35. </template>
  36. </el-menu-item>
  37. </el-menu>
  38. </el-col>
  39. </div>
  40. <div class="contents">
  41. <div ref="headine" class="headine" v-if="!displayTable">
  42. <h3 ref="headHe" style="padding-left: 220px">出差填报</h3>
  43. </div>
  44. <!-- 出差填报 -->
  45. <div class="tops" v-if="!displayTable && apk == 0">
  46. <div class="ctons">
  47. <el-form ref="addformAO" v-loading="formloading" :model="addform" label-width="80px" :rules="formrules" style="width:700px">
  48. <!-- 出差事由 -->
  49. <el-form-item label="出差事由" prop="reason" style="width:100%">
  50. <el-input v-model="addform.reason" style="width: 555px" maxlength="25" type="text" show-word-limit></el-input>
  51. </el-form-item>
  52. <!-- 维度选择添加 -->
  53. <el-form-item label="投入项目" style="width:300px;margin-right:30px" prop="projectId">
  54. <el-select style="width:100%" @change="getwuduList(1)" v-model="addform.projectId" filterable clearable placeholder="请选择投入项目" >
  55. <el-option
  56. v-for="item in projectList"
  57. :key="item.id"
  58. :label="item.projectName"
  59. :value="item.id">
  60. </el-option>
  61. </el-select>
  62. </el-form-item>
  63. <el-form-item :label="wuduData.customDegreeName"
  64. v-if="addform.projectId != null && wuduData.customDegreeActive == 1"
  65. style="width:300px;margin-right:30px"
  66. prop="degreeId">
  67. <el-select style="width:100%" v-model="addform.degreeId" filterable clearable placeholder="请选择" >
  68. <el-option
  69. v-for="item in wuduList"
  70. :key="item.id"
  71. :label="item.name"
  72. :value="item.id">
  73. </el-option>
  74. </el-select>
  75. </el-form-item>
  76. <!-- <span>行程</span> -->
  77. <!-- 交通工具 -->
  78. <el-form-item label="交通工具" style="width:100%">
  79. <el-radio-group v-model="addform.way">
  80. <el-radio :label="0">飞机</el-radio>
  81. <el-radio :label="1">火车</el-radio>
  82. <el-radio :label="2">汽车</el-radio>
  83. <el-radio :label="3">轮船</el-radio>
  84. <el-radio :label="4">其他</el-radio>
  85. </el-radio-group>
  86. </el-form-item>
  87. <!-- 出发城市 -->
  88. <el-form-item label="出发城市" style="width:300px;margin-right:30px" prop="cityFrom">
  89. <el-select style="width:100%" v-model="addform.cityFrom" filterable clearable placeholder="请选择出发城市" >
  90. <el-option
  91. v-for="item in cityList"
  92. :key="item.value"
  93. :label="item.label"
  94. :value="item.label">
  95. </el-option>
  96. </el-select>
  97. </el-form-item>
  98. <!-- 目的城市 -->
  99. <el-form-item label="目的城市" style="width:300px" prop="cityTo">
  100. <el-select style="width:100%" v-model="addform.cityTo" filterable clearable placeholder="请选择目的城市">
  101. <el-option
  102. v-for="item in cityList"
  103. :key="item.value"
  104. :label="item.label"
  105. :value="item.label">
  106. </el-option>
  107. </el-select>
  108. </el-form-item>
  109. <!-- 开始时间 -->
  110. <el-form-item label="开始时间" style="width:300px;margin-right:30px" prop="startDate">
  111. <el-date-picker
  112. type="date"
  113. placeholder="开始日期"
  114. value-format="yyyy-MM-dd"
  115. v-model="addform.startDate"
  116. style="width:100%"
  117. @change="datechg(1)">
  118. </el-date-picker>
  119. </el-form-item>
  120. <!-- 结束时间 -->
  121. <el-form-item label="结束时间" style="width:300px" prop="endDate">
  122. <el-date-picker
  123. type="date"
  124. placeholder="结束日期"
  125. value-format="yyyy-MM-dd"
  126. v-model="addform.endDate"
  127. style="width:100%"
  128. @change="datechg(0)">
  129. </el-date-picker>
  130. </el-form-item>
  131. <!-- 单程/往返 -->
  132. <el-form-item label="单程往返" style="width:300px;margin-right:30px">
  133. <el-radio-group v-model="addform.goBack">
  134. <el-radio :label="0">单程</el-radio>
  135. <el-radio :label="1">往返</el-radio>
  136. </el-radio-group>
  137. </el-form-item>
  138. <!-- 出差天数 -->
  139. <el-form-item label="出差天数" style="width:300px">
  140. <el-input type="number" placeholder="自动计算" v-model="addform.dayCount" min="0" style="width:100%"></el-input>
  141. </el-form-item>
  142. <!-- 出差备注 -->
  143. <el-form-item label="出差备注" style="width:635px">
  144. <el-input type="textarea" v-model="addform.remark" :rows="3" style="width: 100%" maxlength="100" show-word-limit></el-input>
  145. </el-form-item>
  146. </el-form>
  147. <div>
  148. <p style="width:635px;text-align:center;">
  149. <el-button type="primary" @click="formsubmit('formrules')" size="mini">提交</el-button>
  150. </p>
  151. </div>
  152. </div>
  153. </div>
  154. <!-- 出差列表 -->
  155. <div class="tops" v-if="displayTable && apk == 0" :style="isDingding ? 'padding-left:20px' : ''">
  156. <div class="ctons">
  157. <!-- 出差列表筛选 -->
  158. <div class="flex">
  159. <div><el-select v-model="ownerIds" placeholder="请选择出差人员" clearable @change="billss()" style="width: 140px" size="small" filterable="true">
  160. <el-option
  161. v-for="item in users"
  162. :key="item.id"
  163. :label="item.name"
  164. :value="item.id">
  165. </el-option>
  166. </el-select></div>
  167. <div><span style="color: #606266">交通工具</span>
  168. <el-select v-model="type" placeholder="请选择交通工具" clearable @change="billss()" style="width: 140px;" size="small" filterable="true">
  169. <el-option label="飞机" :value="0"></el-option>
  170. <el-option label="火车" :value="1"></el-option>
  171. <el-option label="汽车" :value="2"></el-option>
  172. <el-option label="轮船" :value="3"></el-option>
  173. <el-option label="其他" :value="4"></el-option>
  174. </el-select>
  175. </div>
  176. <div><span style="color: #606266">出差状态</span>
  177. <el-select :disabled="falg" v-model="code" placeholder="请选择出差状态" clearable @change="billss()" size="small" style="width: 140px" filterable="true">
  178. <el-option label="审核通过" :value="0"></el-option>
  179. <el-option label="待审核" :value="1"></el-option>
  180. <el-option label="驳回" :value="2"></el-option>
  181. <el-option label="已撤销" :value="3"></el-option>
  182. </el-select>
  183. </div>
  184. <div><span style="color: #606266">时间段</span>
  185. <el-date-picker v-model="createDate" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="billss()" value-format="yyyy-MM-dd" placeholder="选择日期" size="small" clearable style="width:280px"></el-date-picker>
  186. </div>
  187. <!-- 从顶顶同步按钮 -->
  188. <div style="margin: 0 0 0 20px">
  189. <el-button size="small" type="primary" @click="dingdingClick()">从钉钉同步</el-button>
  190. </div>
  191. </div>
  192. <!-- 出差列表 -->
  193. <el-table :data="tableList" style="width: 100%" height="90%">
  194. <el-table-column prop="ownerName" label="出差人员" width="100" fixed="left" align="center"></el-table-column>
  195. <el-table-column prop="reason" label="出差事由" width="150" header-align="center"></el-table-column>
  196. <el-table-column label="出差详情" width="600" align="center">
  197. <template slot-scope="scope">
  198. <div v-for="item in scope.row.projectList" :key="item.projectId" class="detailsScope">
  199. <span>{{item.startDate + '至' + item.endDate}}</span><span>{{item.projectName}}</span><span>{{item.degreeName}}</span>
  200. </div>
  201. </template>
  202. </el-table-column>
  203. <!-- <el-table-column prop="degreeName" :label="wuduData.customDegreeName" width="150" align="center">
  204. <template slot-scope="scope">
  205. <span v-for="item in scope.row.projectList" :key="item.projectId">{{item.degreeName == null ? '' : item.degreeName + '\u3000'}}</span>
  206. </template>
  207. </el-table-column> -->
  208. <el-table-column label="交通工具" width="120" align="center">
  209. <template slot-scope="scope">
  210. <span v-if="scope.row.way == 0">飞机</span>
  211. <span v-if="scope.row.way == 1">火车</span>
  212. <span v-if="scope.row.way == 2">汽车</span>
  213. <span v-if="scope.row.way == 3">轮船</span>
  214. <span v-if="scope.row.way == 4">其他</span>
  215. </template>
  216. </el-table-column>
  217. <el-table-column label="行程" width="120" align="center" v-if="!isDingding">
  218. <template slot-scope="scope">{{scope.row.cityFrom + '-' + scope.row.cityTo}}</template>
  219. </el-table-column>
  220. <el-table-column prop="indate" label="申请时间" width="150" align="center" v-if="!isDingding"></el-table-column>
  221. <el-table-column label="出差天数" width="120" align="center">
  222. <template slot-scope="scope">
  223. <div>{{scope.row.dayCount}}天</div>
  224. </template>
  225. </el-table-column>
  226. <el-table-column prop="startDate" label="出差开始时间" width="150"></el-table-column>
  227. <el-table-column prop="endDate" label="出差结束时间" width="150"></el-table-column>
  228. <el-table-column prop="status" label="状态" width="100">
  229. <template slot-scope="scope">
  230. <span v-if="scope.row.status == 0">审核通过</span>
  231. <span v-if="scope.row.status == 1" style="color: orange">待审核</span>
  232. <span v-if="scope.row.status == 2" style="color: red">驳回</span>
  233. <span v-if="scope.row.status == 3" style="color: #666666">撤销</span>
  234. </template>
  235. </el-table-column>
  236. <el-table-column prop="remark" label="备注" width="200">
  237. <template slot-scope="scope">
  238. <el-popover placement="top-start" title="标题" width="200" trigger="hover" :content="scope.row.remark">
  239. <div slot="reference" class="apls">{{scope.row.remark}}</div>
  240. </el-popover>
  241. </template>
  242. </el-table-column>
  243. <el-table-column v-if="!isDingding" :label="isAuditList ? '审核' : '操作'" width="180" fixed="right" >
  244. <template slot-scope="scope">
  245. <div v-if="isAuditList">
  246. <el-button icon="el-icon-check" circle size="mini" @click="approve(scope.row)"></el-button>
  247. <el-button icon="el-icon-close" circle size="mini" @click="deny(scope.row)"></el-button>
  248. </div>
  249. <div v-if="!isAuditList">
  250. <el-button v-if="!isAuditList && ((scope.row.status != 0 && scope.row.ownerId == user.id) || permissions.leaveAll)" icon="el-icon-delete" circle size="mini" @click="deletes(scope.row)"></el-button>
  251. <el-button v-if="((scope.row.status != 0 && scope.row.ownerId == user.id) || permissions.leaveAll) || scope.row.status == 1" icon="el-icon-edit" circle size="mini" @click="editor(scope.row)"></el-button>
  252. </div>
  253. </template>
  254. </el-table-column>
  255. <el-table-column v-if="isDingding" label="操作" width="90" fixed="right">
  256. <template slot-scope="scope">
  257. <el-button icon="iconfont firerock-iconguanlian" circle size="mini" @click="DingdingEditor(scope.row)"></el-button>
  258. </template>
  259. </el-table-column>
  260. </el-table>
  261. <!-- 页码 -->
  262. <div class="poss">
  263. <el-pagination
  264. @size-change="handleSizeChange"
  265. @current-change="handleCurrentChange"
  266. :current-page="page"
  267. :page-sizes="[20, 50, 100, 200]"
  268. :page-size="20"
  269. layout="total, sizes, prev, pager, next"
  270. :total="total">
  271. </el-pagination>
  272. </div>
  273. </div>
  274. </div>
  275. <!-- 出差统计 -->
  276. <div class="tops" v-if="displayTable && apk == 1">
  277. <div class="ctons">
  278. <div style="display: flex;align-items: center;padding-bottom: 20px;border-bottom: 1px solid #f2f2f2">
  279. <div style="display: inline-block;width: 350px">
  280. <el-input style="float:left;" v-model="searchWord" class="input-with-select" placeholder="请输入人员搜索" clearable="true" size="small">
  281. <el-button slot="append" @click="statistical()" icon="el-icon-search"></el-button>
  282. </el-input>
  283. </div>
  284. <div style="display: inline-block;width: 700px;margin-left: 100px">
  285. <span style="display: inline-block;margin: 0 15px 0 20px;color: rgb(96, 98, 102);">时间段</span>
  286. <el-date-picker
  287. size="small"
  288. v-model="searchDates"
  289. type="daterange"
  290. range-separator="至"
  291. start-placeholder="开始日期"
  292. end-placeholder="结束日期"
  293. @change="statistical()"
  294. :clearable="false"
  295. value-format="yyyy-MM-dd">
  296. </el-date-picker>
  297. </div>
  298. </div>
  299. <!-- <div style="margin-top: 30px"> -->
  300. <div>
  301. <el-table key="apk2is4" v-loading="loading" :data="statisticalList" height="780px" style="width: 99%">
  302. <el-table-column prop="ownerName" label="姓名" width="300">
  303. <template slot-scope="scope">
  304. <div v-if="scope.row.ownerName">
  305. {{scope.row.ownerName}}
  306. </div>
  307. <div v-else>
  308. <span>暂无出差统计</span>
  309. </div>
  310. </template>
  311. </el-table-column>
  312. <el-table-column prop="departmentName" label="部门" width="300">
  313. <!-- <template slot-scope="scope">
  314. {{scope.row.departmentName}}/天
  315. </template> -->
  316. </el-table-column>
  317. <el-table-column prop="dayCount" label="累计出差天数" width="300">
  318. <template slot-scope="scope">
  319. {{scope.row.dayCount}}天
  320. </template>
  321. </el-table-column>
  322. <el-table-column label="详情" width="300">
  323. <template slot-scope="scope">
  324. <!-- {{scope.row.timeDays}} -->
  325. <el-button size="mini" @click="viewDetails(1,scope.row)">查看详情</el-button>
  326. </template>
  327. </el-table-column>
  328. </el-table>
  329. </div>
  330. </div>
  331. </div>
  332. <!-- 出差审批流 -->
  333. <div class="tops" v-if="displayTable && apk == 2">
  334. <div class="ctons">
  335. <el-col :span="6" >
  336. <el-scrollbar style="height:100%;border:1px solid #dddddd;margin-left:15px;" >
  337. <div class="tree" :style="'height:'+ (tableHeight-120) + 'px'">
  338. <el-tree :data="sdata" :props="sdefaultProps" @node-click="handleNodeClick" accordion></el-tree>
  339. </div>
  340. </el-scrollbar>
  341. </el-col>
  342. <el-col :span="18" >
  343. <el-scrollbar style="height:100%;border:1px solid #dddddd;margin-right:20px;" >
  344. <div class="tree" :style="'height:'+ (tableHeight-120) + 'px'">
  345. <div style="padding:5px;color:#333;" v-if="depData != null">设置 &lt;<span style="color:#20a0ff;">{{depData.label}}&gt;</span> 直属人员出差审批流程
  346. <el-tooltip effect="dark" v-if="depData != null && depData.children!=null" content="仅适用于当前部门的直属人员,子部门人员的审批流程需要单独设置" placement="top-start">
  347. <i class="el-icon-question"></i>
  348. </el-tooltip>
  349. </div>
  350. <div style="padding:5px;" v-if="depData == null">请选择部门</div>
  351. <div style="width:100%;margin:0 auto;text-align: center; margin-top:50px;" v-if="depData != null">
  352. <span>员工填报</span>
  353. <icon class="iconfont firerock-iconright"></icon>
  354. <icon class="iconfont firerock-iconInsertLine addNode" @click="showNodeDialog(0)"></icon>
  355. <icon class="iconfont firerock-iconright"></icon>
  356. <span v-for="(item, index) in dataArray" :key="item.seq" >
  357. <el-button type="primary" v-if="item.auditorType == 1" @click="editNodeDialog(index, item)">{{item.auditDeptName}}</el-button>
  358. <el-button type="primary" v-if="item.auditorType == 0" >项目负责人</el-button>
  359. <el-button type="primary" v-if="item.auditorType == 2" @click="editNodeDialog(index, item)">{{item.userName}}</el-button>
  360. <icon class="iconfont firerock-iconright"></icon>
  361. <icon class="iconfont firerock-iconInsertLine addNode" @click="showNodeDialog(index+1)"></icon>
  362. <icon class="iconfont firerock-iconright"></icon>
  363. </span>
  364. <icon class="iconfont firerock-iconApp_New_Line" style="color:#20A0FF;"></icon>
  365. 审批完成
  366. </div>
  367. <div style="width:100%;margin:0 auto;margin-bottom:30px;position: absolute;bottom: 0px;text-align: center; ">
  368. <el-button type="primary" @click="submitInsert">保存</el-button>
  369. </div>
  370. </div>
  371. </el-scrollbar>
  372. </el-col>
  373. </div>
  374. <el-dialog title="请选择审批人" v-if="dialogVisible" :visible.sync="dialogVisible" width="460px">
  375. <el-form label-width="140px">
  376. <el-form-item label="选择部门/指定人员" >
  377. <el-cascader filterable ref="deptCascader" v-model="curDeptId" placeholder="请选择部门/指定人员" style="width: 100%" @change="chooseDept" :options="soption" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
  378. </el-form-item>
  379. </el-form>
  380. <div slot="footer" class="dialog-footer">
  381. <el-button type="default" @click="deleteNode" v-if="!isAdd" style="float:left;">删除</el-button>
  382. <el-button type="primary" @click="addNode" >确定</el-button>
  383. </div>
  384. </el-dialog>
  385. </div>
  386. </div>
  387. <!-- 编辑框 -->
  388. <el-dialog title="出差详情" v-if="editDialog" :visible.sync="editDialog" width="1000px">
  389. <!-- <el-form ref="editItemForm" :model="editItemForm" label-width="80px" :rules="editItemFormRules"> -->
  390. <el-form ref="editItemForm" :model="editItemForm" label-width="80px" :rules="editItemRules">
  391. <el-form-item label="出差人员" prop="ownerName" style="width: 300px;display: inline-block;">
  392. <span>{{editItemForm.ownerName}}</span>
  393. </el-form-item>
  394. <el-form-item label="单程/往返" prop="goBack" style="width: 300px;display: inline-block;">
  395. <el-radio-group v-model="editItemForm.goBack">
  396. <el-radio :label="0">单程</el-radio>
  397. <el-radio :label="1">往返</el-radio>
  398. </el-radio-group>
  399. </el-form-item>
  400. <!-- 交通工具 -->
  401. <el-form-item label="交通工具" style="width:100%">
  402. <el-radio-group v-model="editItemForm.way">
  403. <el-radio :label="0">飞机</el-radio>
  404. <el-radio :label="1">火车</el-radio>
  405. <el-radio :label="2">汽车</el-radio>
  406. <el-radio :label="3">轮船</el-radio>
  407. <el-radio :label="4">其他</el-radio>
  408. </el-radio-group>
  409. </el-form-item>
  410. <el-form-item label="投入项目" style="width:300px;margin-right:30px;display:inline-block;" prop="projectId">
  411. <el-select style="width:100%" @change="getwuduList(0)" v-model="editItemForm.projectId" filterable clearable placeholder="请选择投入项目" >
  412. <el-option
  413. v-for="item in projectList"
  414. :key="item.id"
  415. :label="item.projectName"
  416. :value="item.id">
  417. </el-option>
  418. </el-select>
  419. </el-form-item>
  420. <el-form-item :label="wuduData.customDegreeName"
  421. v-if="editItemForm.projectId != null && wuduData.customDegreeActive == 1"
  422. style="width:300px;margin-right:30px;display:inline-block;"
  423. prop="degreeName">
  424. <el-select style="width:100%" v-model="editItemForm.degreeId" filterable clearable placeholder="请选择" >
  425. <el-option
  426. v-for="item in wuduList"
  427. :key="item.id"
  428. :label="item.name"
  429. :value="item.id">
  430. </el-option>
  431. </el-select>
  432. </el-form-item>
  433. <el-form-item label="出发城市" style="width:300px;margin-right:30px;display: inline-block;" prop="cityFrom">
  434. <el-select style="width:100%" v-model="editItemForm.cityFrom" filterable clearable placeholder="请选择出发城市" >
  435. <el-option
  436. v-for="item in cityList"
  437. :key="item.value"
  438. :label="item.label"
  439. :value="item.label">
  440. </el-option>
  441. </el-select>
  442. </el-form-item>
  443. <!-- 目的城市 -->
  444. <el-form-item label="目的城市" style="width:300px;display: inline-block;" prop="cityTo">
  445. <el-select style="width:100%" v-model="editItemForm.cityTo" filterable clearable placeholder="请选择目的城市">
  446. <el-option
  447. v-for="item in cityList"
  448. :key="item.value"
  449. :label="item.label"
  450. :value="item.label">
  451. </el-option>
  452. </el-select>
  453. </el-form-item>
  454. <el-form-item label="开始时间" style="width:300px;margin-right:30px;display:inline-block;" prop="startDate">
  455. <el-date-picker
  456. type="date"
  457. placeholder="开始日期"
  458. value-format="yyyy-MM-dd"
  459. v-model="editItemForm.startDate"
  460. style="width:100%"
  461. @change="datechg2(1)">
  462. </el-date-picker>
  463. </el-form-item>
  464. <!-- 结束时间 -->
  465. <el-form-item label="结束时间" style="width:300px;display:inline-block;" prop="endDate">
  466. <el-date-picker
  467. type="date"
  468. placeholder="结束日期"
  469. value-format="yyyy-MM-dd"
  470. v-model="editItemForm.endDate"
  471. style="width:100%"
  472. @change="datechg2(0)">
  473. </el-date-picker>
  474. </el-form-item>
  475. <el-form-item label="出差天数" style="width:300px">
  476. <el-input type="number" placeholder="自动计算" v-model="editItemForm.dayCount" min="0" style="width:100%"></el-input>
  477. </el-form-item>
  478. <el-form-item label="备注" style="width: 100%">
  479. <el-input type="textarea" v-model="editItemForm.remark" :rows="3" style="width: 62%" maxlength="100" show-word-limit></el-input>
  480. </el-form-item>
  481. </el-form>
  482. <span slot="footer" class="dialog-footer">
  483. <el-button @click="editDialog = false">取 消</el-button>
  484. <el-button type="primary" @click="determine()">确 定</el-button>
  485. </span>
  486. </el-dialog>
  487. <!-- 出差统计查看详情 -->
  488. <el-dialog title="出差详情" :visible.sync="seeDialog" width="1000px">
  489. <el-table :data="detailsData" style="width:100%" height="400" v-loading="detailsloading">
  490. <!-- <el-table-column prop="date" label="日期" width="150"></el-table-column>
  491. <el-table-column prop="name" label="姓名" width="200"></el-table-column>
  492. <el-table-column prop="address" label="地址"></el-table-column> -->
  493. <el-table-column prop="ownerName" label="出差人员" width="100" fixed="left"></el-table-column>
  494. <el-table-column prop="reason" label="出差事由" width="150" header-align="center"></el-table-column>
  495. <el-table-column prop="projectName" label="投入项目" width="150" align="center"></el-table-column>
  496. <el-table-column label="交通工具" width="120" align="center">
  497. <template slot-scope="scope">
  498. <span v-if="scope.row.way == 0">飞机</span>
  499. <span v-if="scope.row.way == 1">火车</span>
  500. <span v-if="scope.row.way == 2">汽车</span>
  501. <span v-if="scope.row.way == 3">轮船</span>
  502. <span v-if="scope.row.way == 4">其他</span>
  503. </template>
  504. </el-table-column>
  505. <el-table-column label="行程" width="120" align="center">
  506. <template slot-scope="scope">{{scope.row.cityFrom + '-' + scope.row.cityTo}}</template>
  507. </el-table-column>
  508. <el-table-column prop="indate" label="申请时间" width="150" align="center"></el-table-column>
  509. <el-table-column label="出差天数" width="80" align="center">
  510. <template slot-scope="scope"><div>{{scope.row.dayCount}}天</div></template>
  511. </el-table-column>
  512. <el-table-column prop="startDate" label="出差开始时间" width="150" align="center"></el-table-column>
  513. <el-table-column prop="endDate" label="出差结束时间" width="150" align="center"></el-table-column>
  514. <el-table-column prop="remark" label="备注" width="200">
  515. <template slot-scope="scope">
  516. <el-popover placement="top-start" title="标题" width="200" trigger="hover" :content="scope.row.remark">
  517. <div slot="reference" class="apls">{{scope.row.remark}}</div>
  518. </el-popover>
  519. </template>
  520. </el-table-column>
  521. </el-table>
  522. <div class="poss" style="text-align:right;">
  523. <el-pagination
  524. @size-change="detailsSizeChange"
  525. @current-change="detailsCurrentChange"
  526. :current-page="detailspage"
  527. :page-sizes="[20, 50, 100, 200]"
  528. :page-size="20"
  529. layout="total, sizes, prev, pager, next"
  530. :total="detailstotal">
  531. </el-pagination>
  532. </div>
  533. </el-dialog>
  534. <!-- 钉钉环境交互效果切换 -->
  535. <el-dialog title="项目关联信息" v-if="DingdingEditDialog" :close-on-click-modal="false" :visible.sync="DingdingEditDialog" width="800px" customClass="customWidth">
  536. <el-table :data="relationList" :loading="DingdingTableLoading">
  537. <el-table-column label="时间段">
  538. <template slot-scope="scope">
  539. <span>{{scope.row.startDate + '至' + scope.row.endDate}}</span>
  540. </template>
  541. </el-table-column>
  542. <el-table-column label="关联项目" prop="projectName" show-overflow-tooltip></el-table-column>
  543. <el-table-column :label="wuduData.customDegreeName" prop="degreeName" show-overflow-tooltip></el-table-column>
  544. <el-table-column label="操作" width="150">
  545. <template slot-scope="scope">
  546. <el-button size="small" type="primary" @click="DingdingAddorMod(scope.row)">编辑</el-button>
  547. <el-button size="small" type="danger" @click="DingdingDelete(scope.row)">删除</el-button>
  548. </template>
  549. </el-table-column>
  550. </el-table>
  551. <div slot="footer" class="dialog-footer">
  552. <el-button type="primary" @click="DingdingEditDialog = false">关闭</el-button>
  553. <el-button type="primary" @click="DingdingAddorMod()">新增关联项目</el-button>
  554. </div>
  555. <el-dialog append-to-body title="新增/修改关联项目" v-if="appendAddorModDialog" :visible.sync="appendAddorModDialog" width="700px" customClass="customWidth">
  556. <el-form label-width="100" :inline="true" style="margin-top:20px" :model="relationItem" :rules="relationItemRules" ref="relationItemForm">
  557. <el-form-item label="开始日期" prop="startDate">
  558. <el-date-picker
  559. style="width:220px"
  560. v-model="relationItem.startDate"
  561. value-format="yyyy-MM-dd"
  562. type="date"
  563. @change="datechg3(1)"
  564. placeholder="请选择日期"></el-date-picker>
  565. </el-form-item>
  566. <el-form-item label="结束日期" prop="endDate" style="margin-left:35px">
  567. <el-date-picker
  568. style="width:220px"
  569. v-model="relationItem.endDate"
  570. value-format="yyyy-MM-dd"
  571. type="date"
  572. @change="datechg3(0)"
  573. placeholder="请选择日期"></el-date-picker>
  574. </el-form-item><br>
  575. <el-form-item label="关联项目" prop="projectId">
  576. <el-select v-model="relationItem.projectId" placeholder="请选择项目" @change="getwuduList(2)" style="width:220px" filterable>
  577. <el-option
  578. v-for="item in projectList"
  579. :key="item.id"
  580. :value="item.id"
  581. :label="item.projectName"></el-option>
  582. </el-select>
  583. </el-form-item>
  584. <el-form-item :label="wuduData.customDegreeName" prop="degreeId" style="margin-left:44.5px">
  585. <el-select v-model="relationItem.degreeId" :placeholder="'请选择' + wuduData.customDegreeName" style="width:220px">
  586. <el-option
  587. v-for="item in wuduList"
  588. :key="item.id"
  589. :value="item.id"
  590. :label="item.name"></el-option>
  591. </el-select>
  592. </el-form-item>
  593. </el-form>
  594. <div slot="footer" class="dialog-footer">
  595. <el-button @click="appendAddorModDialog = false">取消</el-button>
  596. <el-button type="primary" @click="appendAddorModSure('relationItemForm')">提交</el-button>
  597. </div>
  598. </el-dialog>
  599. </el-dialog>
  600. <!-- 点击钉钉同步弹窗 -->
  601. <el-dialog title="从钉钉同步" :visible.sync="synchronizationDaying" width="480px" :before-close="handleClose">
  602. <div>
  603. <div class="dingdingtongbu">
  604. <span>选择人员</span>
  605. <el-select v-model="ownerIdsId" placeholder="请选择人员" style="width:280px" size="small" filterable="true">
  606. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id">
  607. </el-option>
  608. </el-select>
  609. </div>
  610. <div class="dingdingtongbu" style="margin-top: 20px">
  611. <span>时间段</span>
  612. <el-date-picker v-model="createDateList" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" placeholder="选择日期" size="small" clearable style="width:280px"></el-date-picker>
  613. <span style="width: 300px;color: #E6A23C;font-size: 10px;padding-left: 105px;margin-top: 10px"> <i class="el-icon-warning-outline"></i> 从钉钉同步 时间段不能超过七天</span>
  614. </div>
  615. </div>
  616. <span slot="footer" class="dialog-footer">
  617. <el-button @click="synchronizationDaying = false">取 消</el-button>
  618. <el-button type="primary" @click="listSynchronize()" :loading="synchronizeLoading">同 步</el-button>
  619. </span>
  620. </el-dialog>
  621. </section>
  622. </template>
  623. <script>
  624. import citys from '../../assets/citys/shju.json'
  625. export default {
  626. name: "awayOffice",
  627. data(){
  628. // 验证手机号
  629. // var checks = (rule, value, callback) => {
  630. // if (!value) {
  631. // return callback(new Error('出差天数不能为空'));
  632. // } else {
  633. // if (value > this.timeChoose) {
  634. // return callback(new Error('超过当前选择日期的天数'));
  635. // } else {
  636. // callback();
  637. // }
  638. // }
  639. // };
  640. return {
  641. displayTable: false,
  642. formloading: false,
  643. apk: 0,
  644. // userdata: JSON.parse(sessionStorage.getItem("user")),
  645. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  646. userComLis: JSON.parse(sessionStorage.getItem("user")),
  647. addform: {
  648. reason: null, //出差事由
  649. startDate: null, //开始时间
  650. endDate: null, //结束时间
  651. way: 0, //交通工具
  652. cityFrom: null, //出发城市
  653. cityTo: null, //目的城市
  654. goBack: 0, //单程往返
  655. dayCount: null, //出差天数
  656. remark: '', //备注
  657. projectId: null, //项目id
  658. wuduId:null //维度id
  659. },
  660. formrules:{
  661. reason:[{ required: true, message: "请输入出差事由", trigger: "blur" }],
  662. cityFrom:[{ required: true, message: "请选择出发城市", trigger: "blur" }],
  663. cityTo:[{ required: true, message: "请选择目的城市", trigger: "blur" }],
  664. startDate:[{ required: true, message: "请选择开始时间", trigger: "blur" }],
  665. endDate:[{ required: true, message: "请选择结束时间", trigger: "blur" }]
  666. },
  667. editItemRules:{
  668. cityFrom:[{ required: true, message: "请选择出发城市", trigger: "blur" }],
  669. cityTo:[{ required: true, message: "请选择目的城市", trigger: "blur" }],
  670. startDate:[{ required: true, message: "请选择开始时间", trigger: "blur" }],
  671. endDate:[{ required: true, message: "请选择结束时间", trigger: "blur" }]
  672. },
  673. cityList:[],
  674. cityList2:[],
  675. projectList: [],
  676. wuduList: [],
  677. wuduData: JSON.parse(sessionStorage.getItem("user")).timeType,
  678. tableList: [],
  679. isAuditList: false,
  680. editItemForm: {},
  681. // editItemFormRules: {
  682. // timeDays: [{required: true, validator: checks, trigger: 'blur'}],
  683. // leaveType: [{ required: true, message: "请选择出差类型", trigger: "blur" }]
  684. // },
  685. editDialog: false,
  686. users: null,
  687. user: null,
  688. total:0,
  689. page: 1,
  690. size: 20,
  691. falg: 0,
  692. code: '',
  693. type: '',
  694. ownerIds: null,
  695. createDate: [],
  696. // 出差统计
  697. searchWord:'',
  698. searchDates: null,
  699. searchStartDate: null,
  700. searchEndDate: null,
  701. statisticalList: [],
  702. // 出差统计查看详情
  703. seeDialog: false,
  704. detailsData: [],
  705. detailstotal: 0,
  706. detailspage: 1,
  707. detailssize: 20,
  708. detailsuserid: null,
  709. // 出差审批流
  710. sdata: [],
  711. sdefaultProps: {
  712. children: 'children',
  713. label: 'label'
  714. },
  715. depData: null,
  716. dataArray: [],
  717. dialogVisible: false,
  718. curDeptId: null,
  719. isAdd: false,
  720. susers: [],
  721. // 钉钉环境交互
  722. isDingding: 0,
  723. DingdingEditDialog: false,
  724. DingdingTableLoading: false,
  725. appendAddorModDialog: false,
  726. relationList: [],
  727. relationItem: {
  728. bustripId: null, //出差记录id
  729. startDate: null,
  730. endDate: null,
  731. projectId: null,
  732. degreeId: null
  733. },
  734. relationItemRules: {
  735. startDate:[{required: true,message: '请选择开始日期',trigger: 'change'}],
  736. endDate:[{required: true,message: '请选择结束日期',trigger: 'change'}],
  737. projectId:[{required: true,message: '请选择要关联的项目',trigger: 'change'}],
  738. },
  739. relationItemTemporaryDate: {},
  740. synchronizeLoading: false,
  741. synchronizationDaying:false,
  742. createDateList: [],
  743. ownerIdsId: ''
  744. }
  745. },
  746. created(){
  747. this.cityList = citys
  748. // console.log("city",this.cityList);
  749. let height = window.innerHeight;
  750. this.tableHeight = height - 195;
  751. const that = this;
  752. window.onresize = function temp() {
  753. that.tableHeight = window.innerHeight - 195;
  754. };
  755. this.isDingding = this.wuduData.syncDingding
  756. },
  757. mounted(){
  758. if(this.isDingding){
  759. this.staffs(2,['2'])
  760. }
  761. this.getTableList()
  762. this.getProjectList()
  763. this.getDepartment()
  764. // console.log("session",this.wuduData);
  765. },
  766. methods: {
  767. dingdingClick() {
  768. this.synchronizationDaying = true
  769. this.ownerIdsId = this.users[0].id
  770. let startDates = this.dayjs().add('-7','day').format("YYYY-MM-DD")
  771. let endDates = this.dayjs().format("YYYY-MM-DD")
  772. let arr = []
  773. arr.push(startDates)
  774. arr.push(endDates)
  775. this.createDateList = arr
  776. },
  777. // 判断日期
  778. determineDate(startDate, endDate) {
  779. let startTime = new Date(Date.parse(startDate.replace(/-/g, "/"))).getTime();
  780. let endTime = new Date(Date.parse(endDate.replace(/-/g, "/"))).getTime();
  781. let dates = Math.abs((startTime - endTime)) / (1000 * 60 * 60 * 24);
  782. let flg = dates > 7 ? false : true
  783. return flg ;
  784. },
  785. // 从钉钉同步假期剩余表
  786. listSynchronize(){
  787. // 判断日期
  788. let flgs = this.determineDate(this.createDateList[0], this.createDateList[1])
  789. if(flgs) {
  790. this.synchronizeLoading = true
  791. let transmissionObj = {}
  792. transmissionObj.userId = this.ownerIdsId
  793. transmissionObj.companyId = this.userComLis.companyId
  794. console.log(this.createDateList, '俺看')
  795. if(this.createDateList != 'null' && this.createDateList != null) {
  796. if(this.createDateList.length > 0) {
  797. transmissionObj.startDate = this.createDateList[0]
  798. transmissionObj.endDate = this.createDateList[1]
  799. } else {
  800. transmissionObj.startDate = this.dayjs().add('-7','day').format("YYYY-MM-DD")
  801. transmissionObj.endDate = this.dayjs().format("YYYY-MM-DD")
  802. }
  803. } else {
  804. transmissionObj.startDate = ''
  805. transmissionObj.endDate = ''
  806. }
  807. this.http.post('/dingding/syncUserWorkData',transmissionObj,
  808. res => {
  809. if(res.code == 'ok'){
  810. this.synchronizeLoading = false
  811. this.synchronizationDaying = false
  812. this.$message({
  813. message: '同步成功',
  814. type: 'success'
  815. })
  816. // this.ownerIdsId = ''
  817. // this.createDateList = []
  818. this.getTableList()
  819. }else {
  820. this.synchronizeLoading = false
  821. this.$message({
  822. message: res.msg,
  823. type: 'error'
  824. })
  825. }
  826. },err => {
  827. this.synchronizeLoading = false
  828. this.$message({
  829. message: err,
  830. type: 'error'
  831. })
  832. })
  833. } else {
  834. this.$message({
  835. message: '从钉钉同步消息时间段不能超过七天',
  836. type: 'warning'
  837. });
  838. }
  839. },
  840. // 钉钉环境交互
  841. DingdingEditor(e){
  842. console.log(e);
  843. this.DingdingEditDialog = true
  844. this.relationItem.bustripId = e.id
  845. this.relationItemTemporaryDate = {
  846. startDate: e.startDate,
  847. endDate: e.endDate
  848. }
  849. this.getRelationList()
  850. },
  851. getRelationList(){
  852. this.DingdingTableLoading = true
  853. this.http.post('/bustrip-project/list',{
  854. bustripId: this.relationItem.bustripId
  855. },res => {
  856. if(res.code == 'ok'){
  857. this.DingdingTableLoading = false
  858. console.log('getlist',res.data);
  859. this.relationList = res.data
  860. }else {
  861. this.DingdingTableLoading = false
  862. this.$message({
  863. message: res.msg,
  864. type: 'error'
  865. })
  866. }
  867. },err => {
  868. this.DingdingTableLoading = false
  869. this.$message({
  870. message: err,
  871. type: 'error'
  872. })
  873. })
  874. },
  875. DingdingAddorMod(row){
  876. this.appendAddorModDialog = true
  877. if(row){
  878. this.relationItem.id = row.id
  879. this.relationItem.projectId = row.projectId
  880. this.getwuduList(2,1)
  881. this.relationItem.startDate = row.startDate
  882. this.relationItem.endDate = row.endDate
  883. this.relationItem.degreeId = row.degreeId == null ? row.degreeId : row.degreeId.toString()
  884. // console.log('degreeId',this.relationItem.degreeId);
  885. }else {
  886. this.relationItem.startDate = this.relationItemTemporaryDate.startDate
  887. this.relationItem.endDate = this.relationItemTemporaryDate.endDate
  888. this.relationItem.projectId = null
  889. this.relationItem.degreeId = null
  890. delete this.relationItem.id
  891. }
  892. },
  893. appendAddorModSure(formname){
  894. this.$refs[formname].validate((valid)=>{
  895. if(valid){
  896. this.http.post('/bustrip-project/addOrMod',this.relationItem,
  897. res => {
  898. if(res.code == 'ok'){
  899. this.appendAddorModDialog = false
  900. this.getRelationList()
  901. this.getTableList()
  902. }else {
  903. this.$message({
  904. message: res.msg,
  905. type: 'error'
  906. })
  907. }
  908. },err => {
  909. this.$message({
  910. message: err,
  911. type: 'error'
  912. })
  913. })
  914. }else {
  915. return false
  916. }
  917. })
  918. },
  919. DingdingDelete(row){
  920. console.log('row',row);
  921. this.$confirm('是否确认删除?','提示',{
  922. confirmButtonText: '确定',
  923. cancelButtonText: '取消',
  924. type: 'warning'
  925. }).then(()=>{
  926. this.http.post('/bustrip-project/delete',{
  927. id:row.id
  928. },res => {
  929. if(res.code == 'ok'){
  930. // this.$message({
  931. // message: '删除成功',
  932. // type: 'success'
  933. // })
  934. this.getRelationList()
  935. }else {
  936. this.$message({
  937. message: res.msg,
  938. type: 'error'
  939. })
  940. }
  941. },err => {
  942. this.$message({
  943. message: err,
  944. type: 'error'
  945. })
  946. })
  947. })
  948. },
  949. staffs(key, keyPath) {
  950. // console.log("keypath",keyPath)
  951. if (keyPath[0] == '1') {
  952. this.displayTable = false;
  953. this.apk = 0
  954. } else if(keyPath[0] == '2' || keyPath[0] == '3') {
  955. this.displayTable = true;
  956. this.apk = 0
  957. if(this.users == null){ this.getUsers() }
  958. } else if(keyPath[0] == '4'){
  959. if(this.searchDates == null){
  960. this.searchDates = this.getautoDate()
  961. // console.log('000');
  962. }
  963. this.displayTable = true;
  964. this.apk = 1
  965. this.statistical()
  966. } else {
  967. this.displayTable = true;
  968. this.apk = 2
  969. }
  970. },
  971. // 导航切换
  972. bills(audit, tr){
  973. if(tr) {
  974. this.code = ''
  975. this.createDate = []
  976. // this.ownerIds = ''
  977. this.type = ''
  978. if(tr == 1) {
  979. this.falg = 1
  980. this.code = 1
  981. } else if(tr == 2) {
  982. this.code = ''
  983. this.falg = 0
  984. } else {
  985. this.falg = 0
  986. }
  987. } else {
  988. this.falg = false
  989. }
  990. this.tableList = []
  991. this.displayTable = true;
  992. this.isAuditList = audit;
  993. this.loading = true
  994. var param = {
  995. pageIndex: this.page,
  996. pageSize: this.size,
  997. status: this.code,
  998. startDate: this.createDate[0],
  999. endDate: this.createDate[1],
  1000. ownerId: this.ownerIds,
  1001. leaveType: this.type,
  1002. };
  1003. if (this.isAuditList) {
  1004. param.status = 1;
  1005. }
  1006. this.list = [];
  1007. // this.total = 0;
  1008. this.http.post('/business-trip/list', param,
  1009. res => {
  1010. if (res.code == "ok") {
  1011. this.tableList = res.data.records
  1012. this.total = res.data.total
  1013. this.loading = false
  1014. } else {
  1015. this.loading = false
  1016. this.$message({
  1017. message: res.msg,
  1018. type: "error"
  1019. });
  1020. }
  1021. },
  1022. error => {
  1023. this.loading = false
  1024. this.$message({
  1025. message: error,
  1026. type: "error"
  1027. });
  1028. });
  1029. },
  1030. handleSizeChange(val){
  1031. this.size = val;
  1032. this.bills()
  1033. },
  1034. handleCurrentChange(val) {
  1035. // console.log(val, 1, '1')
  1036. this.page = val;
  1037. this.bills()
  1038. },
  1039. // 出差申请
  1040. formsubmit(){
  1041. this.$refs.addformAO.validate(val => {
  1042. if(val){
  1043. this.formloading = true
  1044. // console.log("addform",this.addform);
  1045. this.http.post( '/business-trip/add', this.addform,
  1046. res => {
  1047. if (res.code == "ok") {
  1048. this.formloading = false
  1049. this.$message({
  1050. message: "申请成功",
  1051. type: "success"
  1052. })
  1053. this.addform = {
  1054. reason: null, //出差事由
  1055. startDate: null, //开始时间
  1056. endDate: null, //结束时间
  1057. way: 0, //交通工具
  1058. cityFrom: null, //出发城市
  1059. cityTo: null, //目的城市
  1060. goBack: 0, //单程往返
  1061. dayCount: null, //出差天数
  1062. remark: '', //备注
  1063. projectId: null, //项目id
  1064. degreeId:null //维度id
  1065. }
  1066. } else {
  1067. this.formloading = false
  1068. this.$message({
  1069. message: res.msg,
  1070. type: "error"
  1071. });
  1072. }
  1073. },
  1074. error => {
  1075. this.formloading = false
  1076. this.$message({
  1077. message: error,
  1078. type: "error"
  1079. });
  1080. });
  1081. }
  1082. })
  1083. },
  1084. // 日期改变
  1085. datechg(e){
  1086. if(this.addform.endDate != null && this.addform.startDate != null){
  1087. let days = this.autoCountDay(this.addform.startDate,this.addform.endDate)
  1088. if(days > 0){
  1089. this.addform.dayCount = days
  1090. }else{
  1091. this.addform.dayCount = 1
  1092. if(e){
  1093. this.addform.endDate = this.addform.startDate
  1094. }else{
  1095. this.addform.startDate = this.addform.endDate
  1096. }
  1097. }
  1098. }else{
  1099. this.addform.dayCount = null
  1100. }
  1101. },
  1102. datechg2(e){
  1103. // console.log(this.editItemForm.startDate,this.editItemForm.endDate);
  1104. if(this.editItemForm.endDate != null && this.editItemForm.startDate != null){
  1105. let days = this.autoCountDay(this.editItemForm.startDate,this.editItemForm.endDate)
  1106. if(days > 0){
  1107. this.editItemForm.dayCount = days
  1108. }else{
  1109. this.editItemForm.dayCount = 1
  1110. if(e){
  1111. this.editItemForm.endDate = this.editItemForm.startDate
  1112. }else{
  1113. this.editItemForm.startDate = this.editItemForm.endDate
  1114. }
  1115. }
  1116. }else{
  1117. this.editItemForm.dayCount = null
  1118. }
  1119. },
  1120. datechg3(e){
  1121. if(this.relationItem.endDate != null && this.relationItem.startDate != null){
  1122. let days = this.autoCountDay(this.relationItem.startDate,this.relationItem.endDate)
  1123. if(days <= 0){
  1124. if(e){
  1125. this.relationItem.endDate = this.relationItem.startDate
  1126. }else{
  1127. this.relationItem.startDate = this.relationItem.endDate
  1128. }
  1129. }
  1130. }
  1131. },
  1132. // 自动计算天数
  1133. autoCountDay(st,ed){
  1134. let differDay = new Date(ed).getTime() - new Date(st).getTime()
  1135. let differDay2 = differDay/(24*3600*1000) + 1
  1136. return differDay2
  1137. },
  1138. // 获取出差列表
  1139. getTableList(){
  1140. this.billss()
  1141. // this.http.post('/business-trip/list', {
  1142. // pageIndex: 1,
  1143. // pageSize: 20,
  1144. // status: '', // 全部/已审核
  1145. // startDate: '', // start end
  1146. // endDate: '',
  1147. // ownerId: '',
  1148. // leaveType: '', // way
  1149. // },
  1150. // res => {
  1151. // if (res.code == "ok") {
  1152. // this.tableList = res.data.records
  1153. // // console.log("getlist",res.data);
  1154. // } else {
  1155. // this.$message({
  1156. // message: res.msg,
  1157. // type: "error"
  1158. // });
  1159. // }
  1160. // },
  1161. // error => {
  1162. // this.$message({
  1163. // message: error,
  1164. // type: "error"
  1165. // });
  1166. // });
  1167. },
  1168. // 筛选刷新
  1169. billss() {
  1170. this.page = 1
  1171. var param = {
  1172. pageIndex: this.page,
  1173. pageSize: this.size,
  1174. status: this.code,
  1175. startDate: this.createDate == null ? '' : this.createDate[0],
  1176. endDate: this.createDate == null ? '' : this.createDate[1],
  1177. ownerId: this.ownerIds,
  1178. way: this.type,
  1179. };
  1180. this.http.post('/business-trip/list', param,
  1181. res => {
  1182. if (res.code == "ok") {
  1183. this.tableList = res.data.records
  1184. this.total = res.data.total
  1185. this.loading = false
  1186. console.log('tablelist',this.tableList);
  1187. this.$forceUpdate()
  1188. } else {
  1189. this.loading = false
  1190. this.$message({
  1191. message: res.msg,
  1192. type: "error"
  1193. });
  1194. }
  1195. },
  1196. error => {
  1197. this.loading = false
  1198. this.$message({
  1199. message: error,
  1200. type: "error"
  1201. });
  1202. });
  1203. },
  1204. // 操作 - 删除
  1205. deletes(e) {
  1206. this.$confirm("确认要删除吗?", "提示", {}).then(() => {
  1207. this.http.post('/business-trip/delete', {id:e.id},
  1208. res => {
  1209. if (res.code == "ok") {
  1210. this.getTableList();
  1211. this.$message({
  1212. message: '删除成功',
  1213. type: "success"
  1214. });
  1215. } else {
  1216. this.$message({
  1217. message: res.msg,
  1218. type: "error"
  1219. });
  1220. }
  1221. },
  1222. error => {
  1223. this.$message({
  1224. message: error,
  1225. type: "error"
  1226. });
  1227. });
  1228. });
  1229. },
  1230. // 操作 - 编辑
  1231. editor(e) {
  1232. // console.log("编辑",e);
  1233. this.editDialog = true
  1234. if(e.degreeId != null){
  1235. e.degreeId = e.degreeId + ''
  1236. // console.log("e.degreeId",e.degreeId);
  1237. }
  1238. this.editItemForm = e
  1239. this.getwuduList(0)
  1240. },
  1241. // 编辑框确定
  1242. determine(){
  1243. let edddd = {
  1244. id: this.editItemForm.id,
  1245. reason: this.editItemForm.reason, //出差事由
  1246. startDate: this.editItemForm.startDate, //开始时间
  1247. endDate: this.editItemForm.endDate, //结束时间
  1248. way: this.editItemForm.way, //交通工具
  1249. cityFrom: this.editItemForm.cityFrom, //出发城市
  1250. cityTo: this.editItemForm.cityTo, //目的城市
  1251. goBack: this.editItemForm.goBack, //单程往返
  1252. dayCount: this.editItemForm.dayCount, //出差天数
  1253. remark: this.editItemForm.remark, //备注
  1254. projectId: this.editItemForm.projectId, //项目id
  1255. degreeId:this.editItemForm.degreeId, //维度id
  1256. degreeName: null
  1257. }
  1258. for(let i=0; i<this.wuduList.length; i++){
  1259. if(this.wuduList[i].id == edddd.degreeId){
  1260. edddd.degreeName = this.wuduList[i].name
  1261. }
  1262. }
  1263. this.http.post( '/business-trip/add', edddd,
  1264. res => {
  1265. if (res.code == "ok") {
  1266. this.editItemForm = null
  1267. this.editDialog = false
  1268. this.billss()
  1269. this.$message({
  1270. message: '修改成功',
  1271. type: 'success'
  1272. })
  1273. } else {
  1274. this.$message({
  1275. message: res.msg,
  1276. type: "error"
  1277. });
  1278. }
  1279. },
  1280. error => {
  1281. this.$message({
  1282. message: error,
  1283. type: "error"
  1284. });
  1285. });
  1286. },
  1287. // 出差统计
  1288. statistical() {
  1289. // console.log("date",this.searchDates);
  1290. this.loading = true
  1291. this.http.post('/business-trip/summaryData', {
  1292. keyword: this.searchWord,
  1293. startDate: this.searchDates[0],
  1294. endDate: this.searchDates[1]
  1295. },
  1296. res => {
  1297. if (res.code == "ok") {
  1298. // console.log("出差统计",res.data);
  1299. this.statisticalList = res.data
  1300. this.loading = false
  1301. } else {
  1302. this.loading = false
  1303. this.$message({
  1304. message: res.msg,
  1305. type: "error"
  1306. });
  1307. }
  1308. },
  1309. error => {
  1310. this.$message({
  1311. message: error,
  1312. type: "error"
  1313. });
  1314. });
  1315. },
  1316. // 获取本月一号至今
  1317. getautoDate() {
  1318. let newdate = new Date()
  1319. let newyear = newdate.getFullYear()
  1320. let newmonth = newdate.getMonth() + 1
  1321. let newday = newdate.getDate()
  1322. let firstdate = newyear + '-' + (newmonth < 10 ? '0' + newmonth : newmonth) + '-01'
  1323. let seconddate = newyear + '-' + (newmonth < 10 ? '0' + newmonth : newmonth) + '-' + (newday < 10 ? '0' + newday : newday)
  1324. return [firstdate,seconddate]
  1325. },
  1326. // 出差统计列表查看详情
  1327. viewDetails(s,e){
  1328. // console.log("e",e);
  1329. if(s){
  1330. this.detailsuserid = e.ownerId
  1331. }
  1332. var param = {
  1333. pageIndex: this.detailspage,
  1334. pageSize: this.detailssize,
  1335. status: 0,
  1336. startDate: '',
  1337. endDate: '',
  1338. ownerId: this.detailsuserid,
  1339. way: '',
  1340. };
  1341. this.detailsloading = true
  1342. this.http.post('/business-trip/list', param,
  1343. res => {
  1344. if (res.code == "ok") {
  1345. // this.tableList = res.data.records
  1346. this.detailstotal = res.data.total
  1347. // this.loading = false
  1348. // this.$forceUpdate()
  1349. this.detailsData = res.data.records
  1350. this.seeDialog = true
  1351. // console.log('see',res.data);
  1352. this.$forceUpdate()
  1353. this.detailsloading = false
  1354. } else {
  1355. this.detailsloading = false
  1356. this.$message({
  1357. message: res.msg,
  1358. type: "error"
  1359. });
  1360. }
  1361. },
  1362. error => {
  1363. this.detailsloading = false
  1364. this.$message({
  1365. message: error,
  1366. type: "error"
  1367. });
  1368. });
  1369. },
  1370. detailsSizeChange(val){
  1371. this.detailssize = val;
  1372. this.viewDetails(0)
  1373. },
  1374. detailsCurrentChange(val) {
  1375. // console.log(val, 1, '1')
  1376. this.detailspage = val;
  1377. this.viewDetails(0)
  1378. },
  1379. // 出差审批流
  1380. // 获取部门列表
  1381. getDepartment() {
  1382. this.http.post( this.port.manage.depList, {},
  1383. res => {
  1384. if (res.code == "ok") {
  1385. var list = res.data , list1 = JSON.parse(JSON.stringify(res.data));
  1386. this.sdata = list;
  1387. this.soption = [
  1388. {value: 1 , label : "部门" , children : this.changeArr(list1)},
  1389. {value: 2 , label : "指定人员",children : this.susers}
  1390. ]
  1391. } else {
  1392. this.$message({
  1393. message: res.msg,
  1394. type: "error"
  1395. });
  1396. }
  1397. },
  1398. error => {
  1399. this.$message({
  1400. message: error,
  1401. type: "error"
  1402. });
  1403. });
  1404. },
  1405. changeArr(arr) {
  1406. for (var i = 0; i < arr.length; i++) {
  1407. if(arr[i].id != -1 && arr[i].id != 0) {
  1408. if (arr[i].children != null && arr[i].children.length>0) {
  1409. arr[i].children = this.changeArr(arr[i].children);
  1410. }
  1411. arr[i].id && (arr[i].value = arr[i].id);
  1412. delete arr[i].id;
  1413. }
  1414. }
  1415. for(var i in arr) {
  1416. if(arr[i].id == -1 || arr[i].id == 0) {
  1417. arr.splice(i,1)
  1418. }
  1419. }
  1420. return arr;
  1421. },
  1422. handleNodeClick(data) {
  1423. if(this.depData == null || data.id != this.depData.id) {
  1424. this.depData = data;
  1425. // console.log("depdata",this.depData);
  1426. this.getSettings();
  1427. }
  1428. },
  1429. getSettings() {
  1430. this.http.post('/audit-workflow-setting/get',{deptId: this.depData.id,type: 2},
  1431. res => {
  1432. this.listLoading = false;
  1433. if (res.code == "ok") {
  1434. this.dataArray = res.data;
  1435. // console.log("请求1",res.data);
  1436. } else {
  1437. this.$message({
  1438. message: res.msg,
  1439. type: "error"
  1440. });
  1441. }
  1442. },
  1443. error => {
  1444. this.listLoading = false;
  1445. this.$message({
  1446. message: error,
  1447. type: "error"
  1448. });
  1449. });
  1450. },
  1451. editNodeDialog(index, item) {
  1452. //检查是否可编辑
  1453. this.http.post('/audit-workflow-setting/checkNodeInUse',{auditDeptId: item.auditDeptId, deptId: this.depData.id,type: 2},
  1454. res => {
  1455. this.listLoading = false;
  1456. if (res.code == "ok") {
  1457. this.isAdd = false;
  1458. this.sindex = index;
  1459. this.curUserId = item.userId;
  1460. this.dialogVisible = true;
  1461. this.curDeptId = item.auditDeptId;
  1462. } else {
  1463. this.$message({
  1464. message: res.msg,
  1465. type: "error"
  1466. });
  1467. }
  1468. },
  1469. error => {
  1470. this.listLoading = false;
  1471. this.$message({
  1472. message: error,
  1473. type: "error"
  1474. });
  1475. });
  1476. },
  1477. showNodeDialog(index) {
  1478. this.isAdd = true;
  1479. this.sindex = index;
  1480. this.curDeptId = null;
  1481. this.curUserId = null;
  1482. this.dialogVisible = true;
  1483. },
  1484. submitInsert() {
  1485. this.http.post('/audit-workflow-setting/add',{json:JSON.stringify(this.dataArray), deptId: this.depData.id,type: 2},
  1486. res => {
  1487. this.listLoading = false;
  1488. if (res.code == "ok") {
  1489. this.$message({
  1490. message: '保存成功',
  1491. type: "success"
  1492. });
  1493. } else {
  1494. this.$message({
  1495. message: res.msg,
  1496. type: "error"
  1497. });
  1498. }
  1499. },
  1500. error => {
  1501. this.listLoading = false;
  1502. this.$message({
  1503. message: error,
  1504. type: "error"
  1505. });
  1506. });
  1507. },
  1508. deleteNode() {
  1509. this.dialogVisible = false;
  1510. this.dataArray.splice(this.sindex, 1);
  1511. },
  1512. addNode() {
  1513. this.dialogVisible = false;
  1514. if (this.curDeptId == null) return;
  1515. var node = this.$refs.deptCascader.getCheckedNodes()[0];
  1516. if (this.isAdd) {
  1517. if(node.path[0] == 1){
  1518. var node = {auditDeptId: node.value, auditDeptName: node.label, auditorType: 1};
  1519. }else if(node.path[0] == 2){
  1520. var node = {userId: node.value, userName: node.label, auditorType: 2};
  1521. }
  1522. this.dataArray.splice(this.sindex, 0, node);
  1523. } else {
  1524. //编辑
  1525. this.dataArray[this.sindex].auditDeptId = node.value;
  1526. this.dataArray[this.sindex].auditDeptName = node.label;
  1527. }
  1528. },
  1529. getUsers() {
  1530. // this.http.post(this.port.manage.list, {
  1531. // departmentId: -1,
  1532. // pageIndex: 1,
  1533. // // pageSize: 99999
  1534. // pageSize: -1
  1535. // },
  1536. this.http.post('/user/getSimpleActiveUserList', {},
  1537. res => {
  1538. if (res.code == "ok") {
  1539. // console.log("users",res.data);
  1540. // this.users = res.data.records;
  1541. this.users = res.data;
  1542. for (let i = 0; i < this.users.length; i++) {
  1543. this.susers.push({value:this.users[i].id,label:this.users[i].name})
  1544. }
  1545. // if (this.user.role == 0) {
  1546. // this.editItemForm.ownerId = this.user.id;
  1547. // this.ownerIds = this.user.id
  1548. // this.editItemForm.status = 1;
  1549. // this.editItemForm.tel = this.user.phone
  1550. // }
  1551. } else {
  1552. this.$message({
  1553. message: res.msg,
  1554. type: "error"
  1555. });
  1556. }
  1557. },
  1558. error => {
  1559. this.$message({
  1560. message: error,
  1561. type: "error"
  1562. });
  1563. });
  1564. },
  1565. // 维度选择添加
  1566. getProjectList() {
  1567. this.http.post( this.port.project.list, {},
  1568. res => {
  1569. if (res.code == "ok") {
  1570. this.projectList = res.data;
  1571. console.log("项目列表",this.projectList);
  1572. } else {
  1573. this.$message({
  1574. message: res.msg,
  1575. type: "error"
  1576. });
  1577. }
  1578. },
  1579. error => {
  1580. this.$message({
  1581. message: error,
  1582. type: "error"
  1583. });
  1584. });
  1585. },
  1586. // 获取维度数据
  1587. getwuduList(e,i) {
  1588. if(e == 1){
  1589. this.addform.wuduId = null
  1590. if(this.addform.projectId == '' || this.addform.projectId == null) {
  1591. return
  1592. }
  1593. var pId = this.addform.projectId
  1594. }else if(e == 0){
  1595. this.editItemForm.wuduId = null
  1596. if(this.editItemForm.projectId == '' || this.editItemForm.projectId == null) {
  1597. return
  1598. }
  1599. var pId = this.editItemForm.projectId
  1600. }else{
  1601. if(i != 1){this.relationItem.degreeId = null}
  1602. if(this.relationItem.projectId == '' || this.relationItem.projectId == null){
  1603. return
  1604. }
  1605. var pId = this.relationItem.projectId
  1606. // if(i == 1){
  1607. // this.DingdingForm.degreeId = null
  1608. // }
  1609. // if(this.DingdingForm.projectId == '' || this.DingdingForm.projectId == null){
  1610. // return
  1611. // }
  1612. // var pId = this.DingdingForm.projectId
  1613. }
  1614. this.http.post('/project/getDegreeList',{
  1615. projectId: pId,
  1616. },
  1617. res => {
  1618. if (res.code == "ok") {
  1619. console.log("维度数据",res.data[0].id);
  1620. this.wuduList = res.data
  1621. }
  1622. },
  1623. error => {
  1624. this.$message({
  1625. message: error,
  1626. type: "error"
  1627. });
  1628. }
  1629. );
  1630. },
  1631. //获取项目列表
  1632. // getProjectList() {
  1633. // this.listLoading = true;
  1634. // this.http.post( this.port.project.list, {},
  1635. // res => {
  1636. // this.listLoading = false;
  1637. // if (res.code == "ok") {
  1638. // this.projectList = res.data;
  1639. // console.log("项目列表",this.projectList);
  1640. // } else {
  1641. // this.$message({
  1642. // message: res.msg,
  1643. // type: "error"
  1644. // });
  1645. // }
  1646. // },
  1647. // error => {
  1648. // this.listLoading = false;
  1649. // this.$message({
  1650. // message: error,
  1651. // type: "error"
  1652. // });
  1653. // });
  1654. // },
  1655. }
  1656. }
  1657. </script>
  1658. <style lang="scss" scoped>
  1659. .sidebars {
  1660. height: 100%;
  1661. position: absolute;
  1662. border-right: 1px solid #E6E6E6;
  1663. z-index: 2;
  1664. top: 0;
  1665. h3 {
  1666. margin: 0;
  1667. line-height: 45px;
  1668. background: #ffffff;
  1669. font-weight: normal;
  1670. color: #666;
  1671. padding-left: 20px;
  1672. }
  1673. .el-col-12 {
  1674. width: 100%
  1675. }
  1676. }
  1677. .contents {
  1678. height: 100%;
  1679. background: #F7F7F7;
  1680. .tops {
  1681. width: 100%;
  1682. height:100%;
  1683. position: absolute;
  1684. background: #f7f7f7;
  1685. box-sizing: border-box;
  1686. padding: 20px 0 0 220px;
  1687. }
  1688. .ctons {
  1689. width: 86%;
  1690. height: 92%;
  1691. overflow: hidden;
  1692. background: #fff;
  1693. padding: 30px 40px;
  1694. box-sizing: border-box;
  1695. .el-form-item {
  1696. display: inline-block;
  1697. }
  1698. .flex {
  1699. display: flex;
  1700. padding: 0 0 20px 0;
  1701. border-bottom: 1px solid #f2f2f2;
  1702. span {
  1703. display: inline-block;
  1704. margin: 0 10px 0 20px;
  1705. }
  1706. }
  1707. .poss {
  1708. position: fixed;
  1709. bottom: 20px;
  1710. right: 1%;
  1711. box-sizing: border-box;
  1712. }
  1713. }
  1714. .headine {
  1715. width: 100%;
  1716. height: 46.4px;
  1717. line-height: 46.4px;
  1718. background: #fff;
  1719. box-sizing: border-box;
  1720. h3 {
  1721. margin: 0;
  1722. display: inline-block;
  1723. box-sizing: border-box;
  1724. color: #999;
  1725. }
  1726. p {
  1727. display: inline-block;
  1728. margin: 0;
  1729. }
  1730. }
  1731. }
  1732. .addNode {
  1733. cursor:pointer;
  1734. }
  1735. .addNode:hover {
  1736. color:#20a0ff;
  1737. }
  1738. .detailsScope{
  1739. font-size: 12px;
  1740. padding: 3px 0;
  1741. line-height: 15px;
  1742. }
  1743. .detailsScope span:nth-child(1){
  1744. display: inline-block;
  1745. width: 25%;
  1746. }
  1747. .detailsScope span:nth-child(2){
  1748. display: inline-block;
  1749. width: 40%;
  1750. text-align: left;
  1751. }
  1752. .detailsScope span:nth-child(3){
  1753. display: inline-block;
  1754. width: 35%;
  1755. text-align: left;
  1756. }
  1757. .dingdingtongbu span {
  1758. display: inline-block;
  1759. width: 80px;
  1760. padding-left: 20px;
  1761. }
  1762. </style>