awayOffice.vue 74 KB

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