awayOffice.vue 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530
  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">
  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"></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(0)" v-model="DingdingForm.projectId" filterable clearable placeholder="请选择投入项目" >
  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. v-if="DingdingForm.projectId != null && wuduData.customDegreeActive == 1"
  535. style="width:300px;margin-right:30px;display:inline-block;"
  536. prop="degreeName">
  537. <el-select style="width:100%" v-model="DingdingForm.degreeId" filterable clearable placeholder="请选择" >
  538. <el-option
  539. v-for="item in wuduList"
  540. :key="item.id"
  541. :label="item.name"
  542. :value="item.id">
  543. </el-option>
  544. </el-select>
  545. </el-form-item>
  546. </el-form>
  547. <span slot="footer" class="dialog-footer">
  548. <el-button @click="DingdingEditDialog = false">取 消</el-button>
  549. <el-button type="primary" @click="DingdingDetermine()">确 定</el-button>
  550. </span>
  551. </el-dialog>
  552. </section>
  553. </template>
  554. <script>
  555. import citys from '../../assets/citys/shju.json'
  556. export default {
  557. name: "awayOffice",
  558. data(){
  559. // 验证手机号
  560. // var checks = (rule, value, callback) => {
  561. // if (!value) {
  562. // return callback(new Error('出差天数不能为空'));
  563. // } else {
  564. // if (value > this.timeChoose) {
  565. // return callback(new Error('超过当前选择日期的天数'));
  566. // } else {
  567. // callback();
  568. // }
  569. // }
  570. // };
  571. return {
  572. displayTable: false,
  573. formloading: false,
  574. apk: 0,
  575. // userdata: JSON.parse(sessionStorage.getItem("user")),
  576. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  577. addform: {
  578. reason: null, //出差事由
  579. startDate: null, //开始时间
  580. endDate: null, //结束时间
  581. way: 0, //交通工具
  582. cityFrom: null, //出发城市
  583. cityTo: null, //目的城市
  584. goBack: 0, //单程往返
  585. dayCount: null, //出差天数
  586. remark: '', //备注
  587. projectId: null, //项目id
  588. wuduId:null //维度id
  589. },
  590. formrules:{
  591. reason:[{ required: true, message: "请输入出差事由", trigger: "blur" }],
  592. cityFrom:[{ required: true, message: "请选择出发城市", trigger: "blur" }],
  593. cityTo:[{ required: true, message: "请选择目的城市", trigger: "blur" }],
  594. startDate:[{ required: true, message: "请选择开始时间", trigger: "blur" }],
  595. endDate:[{ required: true, message: "请选择结束时间", trigger: "blur" }]
  596. },
  597. editItemRules:{
  598. cityFrom:[{ required: true, message: "请选择出发城市", trigger: "blur" }],
  599. cityTo:[{ required: true, message: "请选择目的城市", trigger: "blur" }],
  600. startDate:[{ required: true, message: "请选择开始时间", trigger: "blur" }],
  601. endDate:[{ required: true, message: "请选择结束时间", trigger: "blur" }]
  602. },
  603. cityList:[],
  604. cityList2:[],
  605. projectList: [],
  606. wuduList: [],
  607. wuduData: JSON.parse(sessionStorage.getItem("user")).timeType,
  608. tableList: [],
  609. isAuditList: false,
  610. editItemForm: {},
  611. // editItemFormRules: {
  612. // timeDays: [{required: true, validator: checks, trigger: 'blur'}],
  613. // leaveType: [{ required: true, message: "请选择出差类型", trigger: "blur" }]
  614. // },
  615. editDialog: false,
  616. users: null,
  617. user: null,
  618. total:0,
  619. page: 1,
  620. size: 20,
  621. falg: 0,
  622. code: '',
  623. type: '',
  624. ownerIds: null,
  625. createDate: [],
  626. // 出差统计
  627. searchWord:'',
  628. searchDates: null,
  629. searchStartDate: null,
  630. searchEndDate: null,
  631. statisticalList: [],
  632. // 出差统计查看详情
  633. seeDialog: false,
  634. detailsData: [],
  635. detailstotal: 0,
  636. detailspage: 1,
  637. detailssize: 20,
  638. detailsuserid: null,
  639. // 出差审批流
  640. sdata: [],
  641. sdefaultProps: {
  642. children: 'children',
  643. label: 'label'
  644. },
  645. depData: null,
  646. dataArray: [],
  647. dialogVisible: false,
  648. curDeptId: null,
  649. isAdd: false,
  650. susers: [],
  651. // 钉钉环境交互
  652. isDingding: 0,
  653. DingdingEditDialog: false,
  654. DingdingForm:{}
  655. }
  656. },
  657. created(){
  658. this.cityList = citys
  659. // console.log("city",this.cityList);
  660. let height = window.innerHeight;
  661. this.tableHeight = height - 195;
  662. const that = this;
  663. window.onresize = function temp() {
  664. that.tableHeight = window.innerHeight - 195;
  665. };
  666. this.isDingding = this.wuduData.syncDingding
  667. },
  668. mounted(){
  669. if(this.isDingding){
  670. this.staffs(2,['2'])
  671. }
  672. this.getTableList()
  673. this.getProjectList()
  674. this.getDepartment()
  675. // console.log("session",this.wuduData);
  676. },
  677. methods: {
  678. // 钉钉环境交互
  679. DingdingEditor(e){
  680. this.DingdingEditDialog = true
  681. if(e.degreeId != null){
  682. e.degreeId = e.degreeId + ''
  683. // console.log("e.degreeId",e.degreeId);
  684. }
  685. this.DingdingForm = e
  686. this.getwuduList(2)
  687. // console.log('editor',this.DingdingForm);
  688. },
  689. DingdingDetermine(){
  690. let edddd = {
  691. id: this.DingdingForm.id,
  692. projectId: this.DingdingForm.projectId, //项目id
  693. degreeId:this.DingdingForm.degreeId, //维度id
  694. degreeName: null
  695. }
  696. for(let i=0; i<this.wuduList.length; i++){
  697. if(this.wuduList[i].id == edddd.degreeId){
  698. edddd.degreeName = this.wuduList[i].name
  699. }
  700. }
  701. this.http.post( '/business-trip/modifyProject', edddd,
  702. res => {
  703. if (res.code == "ok") {
  704. this.DingdingForm = {}
  705. this.DingdingEditDialog = false
  706. this.$message({
  707. message: '修改成功',
  708. type: 'success'
  709. })
  710. this.billss()
  711. } else {
  712. this.$message({
  713. message: res.msg,
  714. type: "error"
  715. });
  716. }
  717. },
  718. error => {
  719. this.$message({
  720. message: error,
  721. type: "error"
  722. });
  723. });
  724. },
  725. staffs(key, keyPath) {
  726. // console.log("keypath",keyPath)
  727. if (keyPath[0] == '1') {
  728. this.displayTable = false;
  729. this.apk = 0
  730. } else if(keyPath[0] == '2' || keyPath[0] == '3') {
  731. this.displayTable = true;
  732. this.apk = 0
  733. if(this.users == null){ this.getUsers() }
  734. } else if(keyPath[0] == '4'){
  735. if(this.searchDates == null){
  736. this.searchDates = this.getautoDate()
  737. // console.log('000');
  738. }
  739. this.displayTable = true;
  740. this.apk = 1
  741. this.statistical()
  742. } else {
  743. this.displayTable = true;
  744. this.apk = 2
  745. }
  746. },
  747. // 导航切换
  748. bills(audit, tr){
  749. if(tr) {
  750. this.code = ''
  751. this.createDate = []
  752. // this.ownerIds = ''
  753. this.type = ''
  754. if(tr == 1) {
  755. this.falg = 1
  756. this.code = 1
  757. } else if(tr == 2) {
  758. this.code = ''
  759. this.falg = 0
  760. } else {
  761. this.falg = 0
  762. }
  763. } else {
  764. this.falg = false
  765. }
  766. this.tableList = []
  767. this.displayTable = true;
  768. this.isAuditList = audit;
  769. this.loading = true
  770. var param = {
  771. pageIndex: this.page,
  772. pageSize: this.size,
  773. status: this.code,
  774. startDate: this.createDate[0],
  775. endDate: this.createDate[1],
  776. ownerId: this.ownerIds,
  777. leaveType: this.type,
  778. };
  779. if (this.isAuditList) {
  780. param.status = 1;
  781. }
  782. this.list = [];
  783. // this.total = 0;
  784. this.http.post('/business-trip/list', param,
  785. res => {
  786. if (res.code == "ok") {
  787. this.tableList = res.data.records
  788. this.total = res.data.total
  789. this.loading = false
  790. } else {
  791. this.loading = false
  792. this.$message({
  793. message: res.msg,
  794. type: "error"
  795. });
  796. }
  797. },
  798. error => {
  799. this.loading = false
  800. this.$message({
  801. message: error,
  802. type: "error"
  803. });
  804. });
  805. },
  806. handleSizeChange(val){
  807. this.size = val;
  808. this.bills()
  809. },
  810. handleCurrentChange(val) {
  811. // console.log(val, 1, '1')
  812. this.page = val;
  813. this.bills()
  814. },
  815. // 出差申请
  816. formsubmit(){
  817. this.$refs.addformAO.validate(val => {
  818. if(val){
  819. this.formloading = true
  820. // console.log("addform",this.addform);
  821. this.http.post( '/business-trip/add', this.addform,
  822. res => {
  823. if (res.code == "ok") {
  824. this.formloading = false
  825. this.$message({
  826. message: "申请成功",
  827. type: "success"
  828. })
  829. this.addform = {
  830. reason: null, //出差事由
  831. startDate: null, //开始时间
  832. endDate: null, //结束时间
  833. way: 0, //交通工具
  834. cityFrom: null, //出发城市
  835. cityTo: null, //目的城市
  836. goBack: 0, //单程往返
  837. dayCount: null, //出差天数
  838. remark: '', //备注
  839. projectId: null, //项目id
  840. degreeId:null //维度id
  841. }
  842. } else {
  843. this.formloading = false
  844. this.$message({
  845. message: res.msg,
  846. type: "error"
  847. });
  848. }
  849. },
  850. error => {
  851. this.formloading = false
  852. this.$message({
  853. message: error,
  854. type: "error"
  855. });
  856. });
  857. }
  858. })
  859. },
  860. // 日期改变
  861. datechg(e){
  862. if(this.addform.endDate != null && this.addform.startDate != null){
  863. let days = this.autoCountDay(this.addform.startDate,this.addform.endDate)
  864. if(days > 0){
  865. this.addform.dayCount = days
  866. }else{
  867. this.addform.dayCount = 1
  868. if(e){
  869. this.addform.endDate = this.addform.startDate
  870. }else{
  871. this.addform.startDate = this.addform.endDate
  872. }
  873. }
  874. }else{
  875. this.addform.dayCount = null
  876. }
  877. },
  878. datechg2(e){
  879. // console.log(this.editItemForm.startDate,this.editItemForm.endDate);
  880. if(this.editItemForm.endDate != null && this.editItemForm.startDate != null){
  881. let days = this.autoCountDay(this.editItemForm.startDate,this.editItemForm.endDate)
  882. if(days > 0){
  883. this.editItemForm.dayCount = days
  884. }else{
  885. this.editItemForm.dayCount = 1
  886. if(e){
  887. this.editItemForm.endDate = this.editItemForm.startDate
  888. }else{
  889. this.editItemForm.startDate = this.editItemForm.endDate
  890. }
  891. }
  892. }else{
  893. this.editItemForm.dayCount = null
  894. }
  895. },
  896. // 自动计算天数
  897. autoCountDay(st,ed){
  898. let differDay = new Date(ed).getTime() - new Date(st).getTime()
  899. let differDay2 = differDay/(24*3600*1000) + 1
  900. return differDay2
  901. },
  902. // 获取出差列表
  903. getTableList(){
  904. this.billss()
  905. // this.http.post('/business-trip/list', {
  906. // pageIndex: 1,
  907. // pageSize: 20,
  908. // status: '', // 全部/已审核
  909. // startDate: '', // start end
  910. // endDate: '',
  911. // ownerId: '',
  912. // leaveType: '', // way
  913. // },
  914. // res => {
  915. // if (res.code == "ok") {
  916. // this.tableList = res.data.records
  917. // // console.log("getlist",res.data);
  918. // } else {
  919. // this.$message({
  920. // message: res.msg,
  921. // type: "error"
  922. // });
  923. // }
  924. // },
  925. // error => {
  926. // this.$message({
  927. // message: error,
  928. // type: "error"
  929. // });
  930. // });
  931. },
  932. // 筛选刷新
  933. billss() {
  934. var param = {
  935. pageIndex: this.page,
  936. pageSize: this.size,
  937. status: this.code,
  938. startDate: this.createDate == null ? '' : this.createDate[0],
  939. endDate: this.createDate == null ? '' : this.createDate[1],
  940. ownerId: this.ownerIds,
  941. way: this.type,
  942. };
  943. this.http.post('/business-trip/list', param,
  944. res => {
  945. if (res.code == "ok") {
  946. this.tableList = res.data.records
  947. this.total = res.data.total
  948. this.loading = false
  949. console.log('tablelist',this.tableList);
  950. this.$forceUpdate()
  951. } else {
  952. this.loading = false
  953. this.$message({
  954. message: res.msg,
  955. type: "error"
  956. });
  957. }
  958. },
  959. error => {
  960. this.loading = false
  961. this.$message({
  962. message: error,
  963. type: "error"
  964. });
  965. });
  966. },
  967. // 操作 - 删除
  968. deletes(e) {
  969. this.$confirm("确认要删除吗?", "提示", {}).then(() => {
  970. this.http.post('/business-trip/delete', {id:e.id},
  971. res => {
  972. if (res.code == "ok") {
  973. this.getTableList();
  974. this.$message({
  975. message: '删除成功',
  976. type: "success"
  977. });
  978. } else {
  979. this.$message({
  980. message: res.msg,
  981. type: "error"
  982. });
  983. }
  984. },
  985. error => {
  986. this.$message({
  987. message: error,
  988. type: "error"
  989. });
  990. });
  991. });
  992. },
  993. // 操作 - 编辑
  994. editor(e) {
  995. // console.log("编辑",e);
  996. this.editDialog = true
  997. if(e.degreeId != null){
  998. e.degreeId = e.degreeId + ''
  999. // console.log("e.degreeId",e.degreeId);
  1000. }
  1001. this.editItemForm = e
  1002. this.getwuduList(0)
  1003. },
  1004. // 编辑框确定
  1005. determine(){
  1006. let edddd = {
  1007. id: this.editItemForm.id,
  1008. reason: this.editItemForm.reason, //出差事由
  1009. startDate: this.editItemForm.startDate, //开始时间
  1010. endDate: this.editItemForm.endDate, //结束时间
  1011. way: this.editItemForm.way, //交通工具
  1012. cityFrom: this.editItemForm.cityFrom, //出发城市
  1013. cityTo: this.editItemForm.cityTo, //目的城市
  1014. goBack: this.editItemForm.goBack, //单程往返
  1015. dayCount: this.editItemForm.dayCount, //出差天数
  1016. remark: this.editItemForm.remark, //备注
  1017. projectId: this.editItemForm.projectId, //项目id
  1018. degreeId:this.editItemForm.degreeId, //维度id
  1019. degreeName: null
  1020. }
  1021. for(let i=0; i<this.wuduList.length; i++){
  1022. if(this.wuduList[i].id == edddd.degreeId){
  1023. edddd.degreeName = this.wuduList[i].name
  1024. }
  1025. }
  1026. this.http.post( '/business-trip/add', edddd,
  1027. res => {
  1028. if (res.code == "ok") {
  1029. this.editItemForm = null
  1030. this.editDialog = false
  1031. this.billss()
  1032. this.$message({
  1033. message: '修改成功',
  1034. type: 'success'
  1035. })
  1036. } else {
  1037. this.$message({
  1038. message: res.msg,
  1039. type: "error"
  1040. });
  1041. }
  1042. },
  1043. error => {
  1044. this.$message({
  1045. message: error,
  1046. type: "error"
  1047. });
  1048. });
  1049. },
  1050. // 出差统计
  1051. statistical() {
  1052. // console.log("date",this.searchDates);
  1053. this.loading = true
  1054. this.http.post('/business-trip/summaryData', {
  1055. keyword: this.searchWord,
  1056. startDate: this.searchDates[0],
  1057. endDate: this.searchDates[1]
  1058. },
  1059. res => {
  1060. if (res.code == "ok") {
  1061. // console.log("出差统计",res.data);
  1062. this.statisticalList = res.data
  1063. this.loading = false
  1064. } else {
  1065. this.loading = false
  1066. this.$message({
  1067. message: res.msg,
  1068. type: "error"
  1069. });
  1070. }
  1071. },
  1072. error => {
  1073. this.$message({
  1074. message: error,
  1075. type: "error"
  1076. });
  1077. });
  1078. },
  1079. // 获取本月一号至今
  1080. getautoDate() {
  1081. let newdate = new Date()
  1082. let newyear = newdate.getFullYear()
  1083. let newmonth = newdate.getMonth() + 1
  1084. let newday = newdate.getDate()
  1085. let firstdate = newyear + '-' + (newmonth < 10 ? '0' + newmonth : newmonth) + '-01'
  1086. let seconddate = newyear + '-' + (newmonth < 10 ? '0' + newmonth : newmonth) + '-' + (newday < 10 ? '0' + newday : newday)
  1087. return [firstdate,seconddate]
  1088. },
  1089. // 出差统计列表查看详情
  1090. viewDetails(s,e){
  1091. // console.log("e",e);
  1092. if(s){
  1093. this.detailsuserid = e.ownerId
  1094. }
  1095. var param = {
  1096. pageIndex: this.detailspage,
  1097. pageSize: this.detailssize,
  1098. status: 0,
  1099. startDate: '',
  1100. endDate: '',
  1101. ownerId: this.detailsuserid,
  1102. way: '',
  1103. };
  1104. this.detailsloading = true
  1105. this.http.post('/business-trip/list', param,
  1106. res => {
  1107. if (res.code == "ok") {
  1108. // this.tableList = res.data.records
  1109. this.detailstotal = res.data.total
  1110. // this.loading = false
  1111. // this.$forceUpdate()
  1112. this.detailsData = res.data.records
  1113. this.seeDialog = true
  1114. // console.log('see',res.data);
  1115. this.$forceUpdate()
  1116. this.detailsloading = false
  1117. } else {
  1118. this.detailsloading = false
  1119. this.$message({
  1120. message: res.msg,
  1121. type: "error"
  1122. });
  1123. }
  1124. },
  1125. error => {
  1126. this.detailsloading = false
  1127. this.$message({
  1128. message: error,
  1129. type: "error"
  1130. });
  1131. });
  1132. },
  1133. detailsSizeChange(val){
  1134. this.detailssize = val;
  1135. this.viewDetails(0)
  1136. },
  1137. detailsCurrentChange(val) {
  1138. // console.log(val, 1, '1')
  1139. this.detailspage = val;
  1140. this.viewDetails(0)
  1141. },
  1142. // 出差审批流
  1143. // 获取部门列表
  1144. getDepartment() {
  1145. this.http.post( this.port.manage.depList, {},
  1146. res => {
  1147. if (res.code == "ok") {
  1148. var list = res.data , list1 = JSON.parse(JSON.stringify(res.data));
  1149. this.sdata = list;
  1150. this.soption = [
  1151. {value: 1 , label : "部门" , children : this.changeArr(list1)},
  1152. {value: 2 , label : "指定人员",children : this.susers}
  1153. ]
  1154. } else {
  1155. this.$message({
  1156. message: res.msg,
  1157. type: "error"
  1158. });
  1159. }
  1160. },
  1161. error => {
  1162. this.$message({
  1163. message: error,
  1164. type: "error"
  1165. });
  1166. });
  1167. },
  1168. changeArr(arr) {
  1169. for (var i = 0; i < arr.length; i++) {
  1170. if(arr[i].id != -1 && arr[i].id != 0) {
  1171. if (arr[i].children != null && arr[i].children.length>0) {
  1172. arr[i].children = this.changeArr(arr[i].children);
  1173. }
  1174. arr[i].id && (arr[i].value = arr[i].id);
  1175. delete arr[i].id;
  1176. }
  1177. }
  1178. for(var i in arr) {
  1179. if(arr[i].id == -1 || arr[i].id == 0) {
  1180. arr.splice(i,1)
  1181. }
  1182. }
  1183. return arr;
  1184. },
  1185. handleNodeClick(data) {
  1186. if(this.depData == null || data.id != this.depData.id) {
  1187. this.depData = data;
  1188. // console.log("depdata",this.depData);
  1189. this.getSettings();
  1190. }
  1191. },
  1192. getSettings() {
  1193. this.http.post('/audit-workflow-setting/get',{deptId: this.depData.id,type: 2},
  1194. res => {
  1195. this.listLoading = false;
  1196. if (res.code == "ok") {
  1197. this.dataArray = res.data;
  1198. // console.log("请求1",res.data);
  1199. } else {
  1200. this.$message({
  1201. message: res.msg,
  1202. type: "error"
  1203. });
  1204. }
  1205. },
  1206. error => {
  1207. this.listLoading = false;
  1208. this.$message({
  1209. message: error,
  1210. type: "error"
  1211. });
  1212. });
  1213. },
  1214. editNodeDialog(index, item) {
  1215. //检查是否可编辑
  1216. this.http.post('/audit-workflow-setting/checkNodeInUse',{auditDeptId: item.auditDeptId, deptId: this.depData.id,type: 2},
  1217. res => {
  1218. this.listLoading = false;
  1219. if (res.code == "ok") {
  1220. this.isAdd = false;
  1221. this.sindex = index;
  1222. this.curUserId = item.userId;
  1223. this.dialogVisible = true;
  1224. this.curDeptId = item.auditDeptId;
  1225. } else {
  1226. this.$message({
  1227. message: res.msg,
  1228. type: "error"
  1229. });
  1230. }
  1231. },
  1232. error => {
  1233. this.listLoading = false;
  1234. this.$message({
  1235. message: error,
  1236. type: "error"
  1237. });
  1238. });
  1239. },
  1240. showNodeDialog(index) {
  1241. this.isAdd = true;
  1242. this.sindex = index;
  1243. this.curDeptId = null;
  1244. this.curUserId = null;
  1245. this.dialogVisible = true;
  1246. },
  1247. submitInsert() {
  1248. this.http.post('/audit-workflow-setting/add',{json:JSON.stringify(this.dataArray), deptId: this.depData.id,type: 2},
  1249. res => {
  1250. this.listLoading = false;
  1251. if (res.code == "ok") {
  1252. this.$message({
  1253. message: '保存成功',
  1254. type: "success"
  1255. });
  1256. } else {
  1257. this.$message({
  1258. message: res.msg,
  1259. type: "error"
  1260. });
  1261. }
  1262. },
  1263. error => {
  1264. this.listLoading = false;
  1265. this.$message({
  1266. message: error,
  1267. type: "error"
  1268. });
  1269. });
  1270. },
  1271. deleteNode() {
  1272. this.dialogVisible = false;
  1273. this.dataArray.splice(this.sindex, 1);
  1274. },
  1275. addNode() {
  1276. this.dialogVisible = false;
  1277. if (this.curDeptId == null) return;
  1278. var node = this.$refs.deptCascader.getCheckedNodes()[0];
  1279. if (this.isAdd) {
  1280. if(node.path[0] == 1){
  1281. var node = {auditDeptId: node.value, auditDeptName: node.label, auditorType: 1};
  1282. }else if(node.path[0] == 2){
  1283. var node = {userId: node.value, userName: node.label, auditorType: 2};
  1284. }
  1285. this.dataArray.splice(this.sindex, 0, node);
  1286. } else {
  1287. //编辑
  1288. this.dataArray[this.sindex].auditDeptId = node.value;
  1289. this.dataArray[this.sindex].auditDeptName = node.label;
  1290. }
  1291. },
  1292. getUsers() {
  1293. this.http.post(this.port.manage.list, {
  1294. departmentId: -1,
  1295. pageIndex: 1,
  1296. pageSize: 99999
  1297. },
  1298. res => {
  1299. if (res.code == "ok") {
  1300. // console.log("users",res.data);
  1301. this.users = res.data.records;
  1302. for (let i = 0; i < this.users.length; i++) {
  1303. this.susers.push({value:this.users[i].id,label:this.users[i].name})
  1304. }
  1305. // if (this.user.role == 0) {
  1306. // this.editItemForm.ownerId = this.user.id;
  1307. // this.ownerIds = this.user.id
  1308. // this.editItemForm.status = 1;
  1309. // this.editItemForm.tel = this.user.phone
  1310. // }
  1311. } else {
  1312. this.$message({
  1313. message: res.msg,
  1314. type: "error"
  1315. });
  1316. }
  1317. },
  1318. error => {
  1319. this.$message({
  1320. message: error,
  1321. type: "error"
  1322. });
  1323. });
  1324. },
  1325. // 维度选择添加
  1326. getProjectList() {
  1327. this.http.post( this.port.project.list, {},
  1328. res => {
  1329. if (res.code == "ok") {
  1330. this.projectList = res.data;
  1331. // console.log("项目列表",this.projectList);
  1332. } else {
  1333. this.$message({
  1334. message: res.msg,
  1335. type: "error"
  1336. });
  1337. }
  1338. },
  1339. error => {
  1340. this.$message({
  1341. message: error,
  1342. type: "error"
  1343. });
  1344. });
  1345. },
  1346. // 获取维度数据
  1347. getwuduList(e) {
  1348. if(e == 1){
  1349. this.addform.wuduId = null
  1350. if(this.addform.projectId == '' || this.addform.projectId == null) {
  1351. return
  1352. }
  1353. var pId = this.addform.projectId
  1354. }else if(e == 0){
  1355. this.editItemForm.wuduId = null
  1356. if(this.editItemForm.projectId == '' || this.editItemForm.projectId == null) {
  1357. return
  1358. }
  1359. var pId = this.editItemForm.projectId
  1360. }else{
  1361. this.DingdingForm.wuduId = null
  1362. if(this.DingdingForm.projectId == '' || this.DingdingForm.projectId == null){
  1363. return
  1364. }
  1365. var pId = this.DingdingForm.projectId
  1366. }
  1367. this.http.post('/project/getDegreeList',{
  1368. projectId: pId,
  1369. },
  1370. res => {
  1371. if (res.code == "ok") {
  1372. // console.log("维度数据",res.data);
  1373. this.wuduList = res.data
  1374. this.$forceUpdate()
  1375. }
  1376. },
  1377. error => {
  1378. this.$message({
  1379. message: error,
  1380. type: "error"
  1381. });
  1382. }
  1383. );
  1384. },
  1385. //获取项目列表
  1386. // getProjectList() {
  1387. // this.listLoading = true;
  1388. // this.http.post( this.port.project.list, {},
  1389. // res => {
  1390. // this.listLoading = false;
  1391. // if (res.code == "ok") {
  1392. // this.projectList = res.data;
  1393. // console.log("项目列表",this.projectList);
  1394. // } else {
  1395. // this.$message({
  1396. // message: res.msg,
  1397. // type: "error"
  1398. // });
  1399. // }
  1400. // },
  1401. // error => {
  1402. // this.listLoading = false;
  1403. // this.$message({
  1404. // message: error,
  1405. // type: "error"
  1406. // });
  1407. // });
  1408. // },
  1409. }
  1410. }
  1411. </script>
  1412. <style lang="scss" scoped>
  1413. .sidebars {
  1414. height: 100%;
  1415. position: absolute;
  1416. border-right: 1px solid #E6E6E6;
  1417. z-index: 2;
  1418. top: 0;
  1419. h3 {
  1420. margin: 0;
  1421. line-height: 45px;
  1422. background: #ffffff;
  1423. font-weight: normal;
  1424. color: #666;
  1425. padding-left: 20px;
  1426. }
  1427. .el-col-12 {
  1428. width: 100%
  1429. }
  1430. }
  1431. .contents {
  1432. height: 100%;
  1433. background: #F7F7F7;
  1434. .tops {
  1435. width: 100%;
  1436. height:100%;
  1437. position: absolute;
  1438. background: #f7f7f7;
  1439. box-sizing: border-box;
  1440. padding: 20px 0 0 220px;
  1441. }
  1442. .ctons {
  1443. width: 86%;
  1444. height: 92%;
  1445. overflow: hidden;
  1446. background: #fff;
  1447. padding: 30px 40px;
  1448. box-sizing: border-box;
  1449. .el-form-item {
  1450. display: inline-block;
  1451. }
  1452. .flex {
  1453. display: flex;
  1454. padding: 0 0 20px 0;
  1455. border-bottom: 1px solid #f2f2f2;
  1456. span {
  1457. display: inline-block;
  1458. margin: 0 10px 0 20px;
  1459. }
  1460. }
  1461. .poss {
  1462. position: fixed;
  1463. bottom: 20px;
  1464. right: 1%;
  1465. box-sizing: border-box;
  1466. }
  1467. }
  1468. .headine {
  1469. width: 100%;
  1470. height: 46.4px;
  1471. line-height: 46.4px;
  1472. background: #fff;
  1473. box-sizing: border-box;
  1474. h3 {
  1475. margin: 0;
  1476. display: inline-block;
  1477. box-sizing: border-box;
  1478. color: #999;
  1479. }
  1480. p {
  1481. display: inline-block;
  1482. margin: 0;
  1483. }
  1484. }
  1485. }
  1486. .addNode {
  1487. cursor:pointer;
  1488. }
  1489. .addNode:hover {
  1490. color:#20a0ff;
  1491. }
  1492. </style>