awayOffice.vue 67 KB

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