You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1808 lines
62 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" :model="searchData">
  4. <el-form-item label="BU">
  5. <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 80px">
  6. <el-option
  7. v-for = "i in userBuList"
  8. :key = "i.buNo"
  9. :label = "i.buDesc"
  10. :value = "i.buDesc">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="计划编码">
  15. <el-input v-model="searchData.planID" clearable style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item label="工单编码">
  18. <el-input v-model="searchData.orderNo" clearable style="width: 120px"></el-input>
  19. </el-form-item>
  20. <el-form-item label="设备编码">
  21. <el-input v-model="searchData.objectID" clearable style="width: 120px"></el-input>
  22. </el-form-item>
  23. <el-form-item label="计划执行人员">
  24. <el-input v-model="searchData.planOperatorName" clearable style="width: 120px"></el-input>
  25. </el-form-item>
  26. </el-form>
  27. <el-form :inline="true" label-position="top" :model="searchData">
  28. <el-form-item label="状态">
  29. <el-select v-model="searchData.status" clearable style="width: 80px">
  30. <el-option label="未开工" value="未开工"></el-option>
  31. <el-option label="待审核" value="待审核"></el-option>
  32. <el-option label="已完工" value="已完工"></el-option>
  33. <el-option label="已取消" value="已取消"></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="计划执行日期">
  37. <el-date-picker
  38. style="width: 120px"
  39. v-model="searchData.startDate"
  40. :picker-options="pickerOptions"
  41. type="date"
  42. value-format="yyyy-MM-dd"
  43. placeholder="选择日期">
  44. </el-date-picker>
  45. </el-form-item>
  46. <el-form-item style="margin-top: 23px;">
  47. <laber style="margin-left: -9px;font-size: 19px">&#10142</laber>
  48. </el-form-item>
  49. <el-form-item :label="' '">
  50. <el-date-picker
  51. style="width: 120px"
  52. v-model="searchData.endDate"
  53. :picker-options="pickerOptions"
  54. type="date"
  55. value-format="yyyy-MM-dd"
  56. placeholder="选择日期">
  57. </el-date-picker>
  58. </el-form-item>
  59. <el-form-item label="部门">
  60. <el-select v-model="searchData.checkType" clearable style="width: 80px">
  61. <el-option label="生产" value="R022"></el-option>
  62. <el-option label="设备" value="R023"></el-option>
  63. <el-option label="质量" value="R024"></el-option>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item label=" ">
  67. <el-button v-if="!authSearch" :loading="searchLoading" @click="searchClick()">查询</el-button>
  68. <el-button type="primary" :loading="checkLoading" @click="checkModals()">批量审核</el-button>
  69. <!-- <el-button type="primary" @click="changeModel()">更改机修人员</el-button>-->
  70. <download-excel
  71. :fields="fields()"
  72. :data="exportData"
  73. type="xls"
  74. :name="exportName"
  75. :header="exportHeader"
  76. :footer="exportFooter"
  77. :fetch="createExportData"
  78. :before-generate="startDownload"
  79. :before-finish="finishDownload"
  80. worksheet="导出信息"
  81. class="el-button el-button--primary el-button--medium">
  82. {{ "导出" }}
  83. </download-excel>
  84. </el-form-item>
  85. </el-form>
  86. <el-table
  87. :height="height"
  88. :data="dataList"
  89. border
  90. @selection-change="selectionChangeHandle"
  91. :row-style="controlRowStyle"
  92. style="width: 100%;">
  93. <el-table-column
  94. type="selection"
  95. header-align="center"
  96. align="center"
  97. :selectable="selectFlag"
  98. width="50">
  99. </el-table-column>
  100. <el-table-column
  101. prop="checkResult"
  102. header-align="center"
  103. align="center"
  104. label="点检结论"
  105. width="80">
  106. <template slot-scope="scope">
  107. <div :style="{ color: scope.row.checkResult === '合格' ? 'green' : scope.row.checkResult === '不合格' ? 'red' : ''}">
  108. {{ scope.row.checkResult }}
  109. </div>
  110. </template>
  111. </el-table-column>
  112. <el-table-column
  113. v-for="(item,index) in columnList" :key="index"
  114. :sortable="item.columnSortable"
  115. :prop="item.columnProp"
  116. :header-align="item.headerAlign"
  117. :show-overflow-tooltip="item.showOverflowTooltip"
  118. :align="item.align"
  119. :fixed="item.fixed==''?false:item.fixed"
  120. :min-width="item.columnWidth"
  121. :label="item.columnLabel">
  122. <template slot-scope="scope">
  123. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  124. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column
  128. fixed="right"
  129. header-align="center"
  130. align="center"
  131. width="100"
  132. label="操作">
  133. <template slot-scope="scope">
  134. <!-- <a type="text" size="small" v-if="scope.row.status=='待审核'" @click="checkModal(scope.row)">审核</a>-->
  135. <el-link style="cursor: pointer" v-if="(scope.row.status==='待审核' || scope.row.status==='已完工') && !authDetail" @click="reportModal(scope.row)">详情</el-link>
  136. <el-link style="cursor: pointer" v-if="scope.row.status==='未开工' && !authCancel" @click="cancelOrder(scope.row)">取消工单</el-link>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <el-pagination
  141. @size-change="sizeChangeHandle"
  142. @current-change="currentChangeHandle"
  143. :current-page="pageIndex"
  144. :page-sizes="[20, 50, 100, 200, 500]"
  145. :page-size="pageSize"
  146. :total="totalPage"
  147. layout="total, sizes, prev, pager, next, jumper">
  148. </el-pagination>
  149. <el-dialog title="执行结果" top="8vh" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="1200px">
  150. <el-form :inline="true" label-position="top">
  151. <el-form-item :label="'工单号'">
  152. <el-input v-model="saveData.orderNo" disabled style="width: 221px"></el-input>
  153. </el-form-item>
  154. <el-form-item :label="'计划执行人员'">
  155. <el-input v-model="saveData.planOperatorName" disabled style="width: 221px"></el-input>
  156. </el-form-item>
  157. <el-form-item :label="'实际执行人员'">
  158. <el-input v-model="saveData.actualOperatorName" disabled style="width: 120px"></el-input>
  159. </el-form-item>
  160. <el-form-item>
  161. <span v-if="saveData.status === '待审核'" slot="label" @click="getOperatorList()"><a>协同人员</a></span>
  162. <span v-else slot="label">协同人员</span>
  163. <el-input v-model="saveData.operator" readonly style="width: 221px"></el-input>
  164. </el-form-item>
  165. </el-form>
  166. <el-form :inline="true" label-position="top">
  167. <el-form-item :label="'执行开始时间'">
  168. <el-date-picker :disabled="saveData.status === '已完工'" v-model="saveData.reachDate" style="width: 221px" type="datetime" value-format='yyyy-MM-dd HH:mm:ss' format='yyyy-MM-dd HH:mm:ss'></el-date-picker>
  169. </el-form-item>
  170. <el-form-item :label="'执行结束时间'">
  171. <el-date-picker :disabled="saveData.status === '已完工'" v-model="saveData.actualDate" style="width: 221px" type="datetime" value-format='yyyy-MM-dd HH:mm:ss' format='yyyy-MM-dd HH:mm:ss'></el-date-picker>
  172. </el-form-item>
  173. <el-form-item :label="'工作时长(m)'">
  174. <el-input class="numInput" :disabled="saveData.status === '已完工'" v-model="saveData.workTime" type="number" @input="handleInput(saveData.workTime,1)" style="width: 120px"></el-input>
  175. </el-form-item>
  176. <el-form-item :label="'点检结论'">
  177. <el-select :disabled="saveData.status === '已完工'" v-model="saveData.checkResult" style="width: 120px">
  178. <el-option label="合格" value="合格"></el-option>
  179. <el-option label="不合格" value="不合格"></el-option>
  180. </el-select>
  181. </el-form-item>
  182. <el-form-item :label="' '">
  183. <el-button v-if="saveData.status === '已完工'" type="primary" @click="checkModal()">取消审核</el-button>
  184. <el-button v-else type="primary" @click="checkModal()">审核</el-button>
  185. </el-form-item>
  186. </el-form>
  187. <el-form :inline="true" label-position="top">
  188. <el-form-item :label="'执行结果备注'">
  189. <el-input :disabled="saveData.status === '已完工'" type="textarea" v-model="saveData.remark" :rows="3" resize='none' show-word-limit style="width: 1177px;height: 20px"></el-input>
  190. </el-form-item>
  191. </el-form>
  192. <el-form :inline="true" label-position="top" style="margin-top: 47px">
  193. <el-form-item :label="'备注'">
  194. <el-input :disabled="saveData.status === '已完工'" type="textarea" v-model="saveData.checkRemark" :rows="3" resize='none' show-word-limit style="width: 1177px;height: 20px"></el-input>
  195. </el-form-item>
  196. </el-form>
  197. <div class="rq ">
  198. <el-table
  199. :height="400"
  200. :data="detailList"
  201. border
  202. v-loading="detailLoading"
  203. style="width: 100%;margin-top: 50px">
  204. <el-table-column
  205. prop=""
  206. header-align="center"
  207. align="center"
  208. min-width="40"
  209. label="操作">
  210. <template slot-scope="scope">
  211. <el-button class="el-icon-picture-outline" type="primary" @click="checkItemImageModal(scope.row)"></el-button>
  212. </template>
  213. </el-table-column>
  214. <el-table-column
  215. v-for="(item,index) in columnDetailList" :key="index"
  216. :sortable="item.columnSortable"
  217. :prop="item.columnProp"
  218. :header-align="item.headerAlign"
  219. :show-overflow-tooltip="item.showOverflowTooltip"
  220. :align="item.align"
  221. :fixed="item.fixed==''?false:item.fixed"
  222. :min-width="item.columnWidth"
  223. :label="item.columnLabel">
  224. <template slot-scope="scope">
  225. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  226. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  227. </template>
  228. </el-table-column>
  229. <el-table-column
  230. prop=""
  231. header-align="center"
  232. align="right"
  233. min-width="80"
  234. label="实测值">
  235. <template slot-scope="scope">
  236. <el-input v-if="scope.row.valueTypeDb === 'T' && saveData.status === '待审核'" v-model="scope.row.textValue" style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input>
  237. <el-input v-if="scope.row.valueTypeDb === 'T' && saveData.status === '已完工'" v-model="scope.row.textValue" readonly style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input>
  238. <el-input v-if="scope.row.valueTypeDb === 'N' && saveData.status === '待审核'" v-model="scope.row.numberValue" style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input>
  239. <el-input v-if="scope.row.valueTypeDb === 'N' && saveData.status === '已完工'" v-model="scope.row.numberValue" readonly style="height: 11px;padding: 0px " filterable allow-create>;width:98%"></el-input>
  240. </template>
  241. </el-table-column>
  242. <el-table-column
  243. prop=""
  244. header-align="center"
  245. align="right"
  246. min-width="80"
  247. label="检验结论">
  248. <template slot-scope="scope">
  249. <el-select :disabled="saveData.status === '已完工'" v-model="scope.row.itemResult" style="height: 11px;padding: 0px">
  250. <el-option label="合格" value="合格"></el-option>
  251. <el-option label="不合格" value="不合格"></el-option>
  252. </el-select>
  253. </template>
  254. </el-table-column>
  255. <el-table-column
  256. prop=""
  257. header-align="center"
  258. align="center"
  259. min-width="120"
  260. label="备注">
  261. <template slot-scope="scope">
  262. <el-input :readonly="saveData.status === '已完工'" v-model="scope.row.itemNotes" readonly style="height: 11px;width:98%"></el-input>
  263. </template>
  264. </el-table-column>
  265. </el-table>
  266. </div>
  267. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  268. <el-button type="primary" @click="updateWorkOrder()">确定</el-button>
  269. <el-button type="primary" @click="detailModelFlag = false">关闭</el-button>
  270. </el-footer>
  271. </el-dialog>
  272. <el-dialog title="批量修改计划人员" :close-on-click-modal="false" v-drag :visible.sync="changeModelFlag" width="300px">
  273. <el-form :inline="true" label-position="top" >
  274. <el-form-item style="margin-left: 10px" >
  275. <span slot="label" @click="getBaseList(201)"><a herf="#">计划执行人员</a></span>
  276. <el-input v-model="planOperator" style="width: 120px"></el-input>
  277. </el-form-item>
  278. <el-form-item :label="'人员名称'">
  279. <el-input v-model="planOperatorName" disabled style="width: 120px"></el-input>
  280. </el-form-item>
  281. </el-form>
  282. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  283. <el-button type="primary" @click="changeOrderOperator()">保存</el-button>
  284. <el-button type="primary" @click="changeModelFlag = false">关闭</el-button>
  285. </el-footer>
  286. </el-dialog>
  287. <el-dialog title="审核" :close-on-click-modal="false" v-drag :visible.sync="submitModelFlag" width="375px">
  288. <el-form :inline="true" label-position="top">
  289. <el-form-item :label="'难度等级'">
  290. <el-select filterable v-model="submitData.difficultyLevel" style="width: 130px" placeholder="请评估难度等级">
  291. <el-option label="难度一" value="难度一"></el-option>
  292. <el-option label="难度二" value="难度二"></el-option>
  293. <el-option label="难度三" value="难度三"></el-option>
  294. </el-select>
  295. </el-form-item>
  296. <el-form-item :label="'备注'">
  297. <el-input v-model="submitData.difficultyRemark" style="width: 200px"></el-input>
  298. </el-form-item>
  299. </el-form>
  300. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  301. <el-button type="primary" @click="submitModel()">确定</el-button>
  302. <el-button type="primary" @click="submitModelFlag = false">取消</el-button>
  303. </el-footer>
  304. </el-dialog>
  305. <el-dialog title="取消工单" :close-on-click-modal="false" v-drag :visible.sync="cancelModelFlag" width="350px">
  306. <el-form :inline="true" label-position="top">
  307. <el-form-item :label="' '">
  308. <h>是否取消选定工单?</h>
  309. </el-form-item>
  310. </el-form>
  311. <el-form :inline="true" label-position="top">
  312. <el-form-item :label="' '">
  313. <!-- <input type="checkbox" value="Y" name="addWorkOrderRule" v-model="cancelData.cancelAll"/>&nbsp;删除该计划下当前设备的所有工单-->
  314. <el-checkbox v-model="cancelData.cancelAll" true-label="Y">删除该计划下当前设备的所有工单</el-checkbox><br>
  315. </el-form-item>
  316. </el-form>
  317. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  318. <el-button type="primary" @click="cancelOrder2()">确定</el-button>
  319. <el-button type="primary" @click="cancelModelFlag = false">取消</el-button>
  320. </el-footer>
  321. </el-dialog>
  322. <el-dialog title="图片查看" :close-on-click-modal="false" v-drag :visible.sync="imageModalFlag" width="390px" style="height: 550px;">
  323. <div v-viewer>
  324. <img v-for="(item, index) in descImages" :src="item" :key="index" style="width: 100px;height: 100px"/>
  325. </div>
  326. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  327. <el-button type="primary" @click="imageModalFlag = false">关闭</el-button>
  328. </el-footer>
  329. </el-dialog>
  330. <!-- 人员 -->
  331. <el-dialog title="人员清单" :close-on-click-modal="false" v-drag :visible.sync="operatorModelFlag" width="520px">
  332. <div class="rq">
  333. <el-form :inline="true" label-position="top" :model="operatorData">
  334. <el-form-item :label="'所属角色'">
  335. <el-select v-model="operatorData.roleId" placeholder="请选择" style="width: 120px">
  336. <el-option
  337. v-for = "i in roleList"
  338. :key = "i.roleId"
  339. :label = "i.roleName"
  340. :value = "i.roleId">
  341. </el-option>
  342. </el-select>
  343. </el-form-item>
  344. <el-form-item :label="'用户账号'">
  345. <el-input v-model="operatorData.adminID" clearable style="width: 120px"></el-input>
  346. </el-form-item>
  347. <el-form-item :label="'用户名称'">
  348. <el-input v-model="operatorData.adminName" clearable style="width: 120px"></el-input>
  349. </el-form-item>
  350. <el-form-item :label="' '">
  351. <el-button type="primary" @click="getOperatorList2">查询</el-button>
  352. </el-form-item>
  353. </el-form>
  354. <el-table
  355. :height="300"
  356. :data="operatorList"
  357. ref="operatorTable"
  358. @row-click="operatorClickRow"
  359. @selection-change="selectionOperator"
  360. :row-key="getRowKeys"
  361. border
  362. style="width: 100%;">
  363. <el-table-column
  364. type="selection"
  365. header-align="center"
  366. align="center"
  367. :reserve-selection="true"
  368. width="50">
  369. </el-table-column>
  370. <el-table-column
  371. v-for="(item,index) in operatorDetailList" :key="index"
  372. :sortable="item.columnSortable"
  373. :prop="item.columnProp"
  374. :header-align="item.headerAlign"
  375. :show-overflow-tooltip="item.showOverflowTooltip"
  376. :align="item.align"
  377. :fixed="item.fixed==''?false:item.fixed"
  378. :min-width="item.columnWidth"
  379. :label="item.columnLabel">
  380. <template slot-scope="scope">
  381. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  382. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  383. </template>
  384. </el-table-column>
  385. </el-table>
  386. </div>
  387. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  388. <el-button type="primary" @click="confirmOperator()">确认</el-button>
  389. <el-button type="primary" @click="operatorModelFlag = false">关闭</el-button>
  390. </el-footer>
  391. </el-dialog>
  392. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  393. </div>
  394. </template>
  395. <script>
  396. import {
  397. eamWorkOrderSearch,
  398. eamWorkOrderReportSearch,
  399. cancelOrder,
  400. changeOrderOperator,
  401. checkWorkOrder, // 审核
  402. updateWorkOrder, // 修改工单
  403. searchFileUrl,
  404. getSiteAndBuByUserName,
  405. getUserRoleList,
  406. getOperatorList,
  407. getRoleByUserName,
  408. checkWorkOrders, // 批量审核
  409. } from "@/api/eam/eam.js"
  410. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  411. import Chooselist from '@/views/modules/common/Chooselist_eam'
  412. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  413. export default {
  414. components: {
  415. Chooselist
  416. },
  417. watch: {
  418. saveData: {
  419. deep: true,
  420. handler: function (newV, oldV) {
  421. if (this.saveData.actualDate != null && this.saveData.actualDate !== '' && this.saveData.reachDate != null && this.saveData.reachDate !== '') {
  422. this.saveData.workTime = Math.ceil(Math.floor(this.dayjs(this.saveData.actualDate).diff(this.saveData.reachDate, 'seconds') / 30) / 2)
  423. }
  424. }
  425. }
  426. },
  427. data () {
  428. return {
  429. // 是否收藏
  430. favorite: false,
  431. // 导出 start
  432. exportData: [],
  433. exportName: "点检工单" + this.dayjs().format('YYYYMMDDHHmmss'),
  434. exportHeader: ["点检工单"],
  435. exportFooter: [],
  436. exportList: [],
  437. // 导出 end
  438. tagNo:'',
  439. searchData: {
  440. site: this.$store.state.user.site,
  441. userName: this.$store.state.user.name,
  442. orderNo: '',
  443. planID: '',
  444. objectID: '',
  445. planOperator: '',
  446. buDesc: '',
  447. functionType: 'A',
  448. status: '',
  449. startDate:'',
  450. endDate:'',
  451. planDate: new Date(),
  452. page: 1,
  453. limit: 10,
  454. searchType: 'checkOrder',
  455. checkType: ''
  456. },
  457. height: 200,
  458. pageIndex: 1,
  459. pageSize: 20,
  460. totalPage: 0,
  461. dataList: [],
  462. dataListSelections: [],
  463. modalFlag: false,
  464. modalDisableFlag: false,
  465. modalData: {
  466. flag: '',
  467. bu: '',
  468. site: this.$store.state.user.site,
  469. groupID: '',
  470. groupDesc: '',
  471. active: '',
  472. },
  473. departmentList: [],
  474. // 展示列集
  475. columnList: [
  476. {
  477. userId: this.$store.state.user.name,
  478. functionId: 101002004,
  479. serialNumber: '101002004Table1BuDesc',
  480. tableId: "101002004Table1",
  481. tableName: "点检工单表",
  482. columnProp: 'buDesc',
  483. headerAlign: "center",
  484. align: "center",
  485. columnLabel: 'BU',
  486. columnHidden: false,
  487. columnImage: false,
  488. columnSortable: true,
  489. sortLv: 0,
  490. status: true,
  491. fixed: '',
  492. columnWidth: 100,
  493. },
  494. {
  495. userId: this.$store.state.user.name,
  496. functionId: 101002004,
  497. serialNumber: '101002004Table1PlanID',
  498. tableId: "101002004Table1",
  499. tableName: "点检工单表",
  500. columnProp: 'planID',
  501. headerAlign: "center",
  502. align: "center",
  503. columnLabel: '计划编码',
  504. columnHidden: false,
  505. columnImage: false,
  506. columnSortable: true,
  507. sortLv: 0,
  508. status: true,
  509. fixed: '',
  510. columnWidth: 100,
  511. },
  512. {
  513. userId: this.$store.state.user.name,
  514. functionId: 101002004,
  515. serialNumber: '101002004Table1PlanDesc',
  516. tableId: "101002004Table1",
  517. tableName: "点检工单表",
  518. columnProp: 'planDesc',
  519. headerAlign: "center",
  520. align: "center",
  521. columnLabel: '计划描述',
  522. columnHidden: false,
  523. columnImage: false,
  524. columnSortable: false,
  525. sortLv: 0,
  526. status: true,
  527. fixed: '',
  528. columnWidth: 120,
  529. },
  530. {
  531. userId: this.$store.state.user.name,
  532. functionId: 101002004,
  533. serialNumber: '101002004Table1OrderNo',
  534. tableId: "101002004Table1",
  535. tableName: "点检工单表",
  536. columnProp: 'orderNo',
  537. headerAlign: "center",
  538. align: "center",
  539. columnLabel: '工单编码',
  540. columnHidden: false,
  541. columnImage: false,
  542. columnSortable: true,
  543. sortLv: 0,
  544. status: true,
  545. fixed: '',
  546. columnWidth: 100,
  547. },
  548. {
  549. userId: this.$store.state.user.name,
  550. functionId: 101002004,
  551. serialNumber: '101002004Table1PropertiesCode',
  552. tableId: "101002004Table1",
  553. tableName: "点检工单表",
  554. columnProp: 'propertiesCode',
  555. headerAlign: "center",
  556. align: "center",
  557. columnLabel: '模板编码',
  558. columnHidden: false,
  559. columnImage: false,
  560. columnSortable: false,
  561. sortLv: 0,
  562. status: true,
  563. fixed: '',
  564. columnWidth: 80,
  565. },
  566. {
  567. userId: this.$store.state.user.name,
  568. functionId: 101002004,
  569. serialNumber: '101002004Table1CodeDesc',
  570. tableId: "101002004Table1",
  571. tableName: "点检工单表",
  572. columnProp: 'codeDesc',
  573. headerAlign: "center",
  574. align: "center",
  575. columnLabel: '模板名称',
  576. columnHidden: false,
  577. columnImage: false,
  578. columnSortable: false,
  579. sortLv: 0,
  580. status: true,
  581. fixed: '',
  582. columnWidth: 120,
  583. },
  584. {
  585. userId: this.$store.state.user.name,
  586. functionId: 101002004,
  587. serialNumber: '101002004Table1ObjectID',
  588. tableId: "101002004Table1",
  589. tableName: "点检工单表",
  590. columnProp: 'objectID',
  591. headerAlign: "center",
  592. align: "center",
  593. columnLabel: '设备编码',
  594. columnHidden: false,
  595. columnImage: false,
  596. columnSortable: false,
  597. sortLv: 0,
  598. status: true,
  599. fixed: '',
  600. columnWidth: 80,
  601. },
  602. {
  603. userId: this.$store.state.user.name,
  604. functionId: 101002004,
  605. serialNumber: '101002004Table1ObjectDesc',
  606. tableId: "101002004Table1",
  607. tableName: "点检工单表",
  608. columnProp: 'objectDesc',
  609. headerAlign: "center",
  610. align: "center",
  611. columnLabel: '设备名称',
  612. columnHidden: false,
  613. columnImage: false,
  614. columnSortable: false,
  615. sortLv: 0,
  616. status: true,
  617. fixed: '',
  618. columnWidth: 80,
  619. },
  620. {
  621. userId: this.$store.state.user.name,
  622. functionId: 101002004,
  623. serialNumber: '101002004Table1Status',
  624. tableId: "101002004Table1",
  625. tableName: "点检工单表",
  626. columnProp: 'status',
  627. headerAlign: "center",
  628. align: "center",
  629. columnLabel: '状态',
  630. columnHidden: false,
  631. columnImage: false,
  632. columnSortable: true,
  633. sortLv: 0,
  634. status: true,
  635. fixed: '',
  636. columnWidth: 80,
  637. },
  638. {
  639. userId: this.$store.state.user.name,
  640. functionId: 101002004,
  641. serialNumber: '101002004Table1PlanOperatorName',
  642. tableId: "101002004Table1",
  643. tableName: "点检工单表",
  644. columnProp: 'planOperatorName',
  645. headerAlign: "center",
  646. align: "center",
  647. columnLabel: '计划执行人员',
  648. columnHidden: false,
  649. columnImage: false,
  650. columnSortable: false,
  651. sortLv: 0,
  652. status: true,
  653. fixed: '',
  654. columnWidth: 120,
  655. },
  656. {
  657. userId: this.$store.state.user.name,
  658. functionId: 101002004,
  659. serialNumber: '101002004Table1ActualOperatorName',
  660. tableId: "101002004Table1",
  661. tableName: "点检工单表",
  662. columnProp: 'actualOperatorName',
  663. headerAlign: "center",
  664. align: "center",
  665. columnLabel: '实际执行人员',
  666. columnHidden: false,
  667. columnImage: false,
  668. columnSortable: false,
  669. sortLv: 0,
  670. status: true,
  671. fixed: '',
  672. columnWidth: 100,
  673. },
  674. {
  675. userId: this.$store.state.user.name,
  676. functionId: 101002004,
  677. serialNumber: '101002004Table1Operator',
  678. tableId: "101002004Table1",
  679. tableName: "点检工单表",
  680. columnProp: 'operator',
  681. headerAlign: "center",
  682. align: "center",
  683. columnLabel: '协同人员',
  684. columnHidden: false,
  685. columnImage: false,
  686. columnSortable: false,
  687. sortLv: 0,
  688. status: true,
  689. fixed: '',
  690. columnWidth: 120,
  691. },
  692. {
  693. userId: this.$store.state.user.name,
  694. functionId: 101002004,
  695. serialNumber: '101002004Table1CheckerName',
  696. tableId: "101002004Table1",
  697. tableName: "点检工单表",
  698. columnProp: 'checkerName',
  699. headerAlign: "center",
  700. align: "center",
  701. columnLabel: '审核人员',
  702. columnHidden: false,
  703. columnImage: false,
  704. columnSortable: false,
  705. sortLv: 0,
  706. status: true,
  707. fixed: '',
  708. columnWidth: 100,
  709. },
  710. {
  711. userId: this.$store.state.user.name,
  712. functionId: 101002004,
  713. serialNumber: '101002004Table1PlanDate',
  714. tableId: "101002004Table1",
  715. tableName: "点检工单表",
  716. columnProp: 'planDate',
  717. headerAlign: "center",
  718. align: "center",
  719. columnLabel: '计划执行日期',
  720. columnHidden: false,
  721. columnImage: false,
  722. columnSortable: false,
  723. sortLv: 0,
  724. status: true,
  725. fixed: '',
  726. columnWidth: 100,
  727. },
  728. {
  729. userId: this.$store.state.user.name,
  730. functionId: 101002004,
  731. serialNumber: '101002004Table1ReachDate',
  732. tableId: "101002004Table1",
  733. tableName: "点检工单表",
  734. columnProp: 'reachDate',
  735. headerAlign: "center",
  736. align: "center",
  737. columnLabel: '执行开始时间',
  738. columnHidden: false,
  739. columnImage: false,
  740. columnSortable: false,
  741. sortLv: 0,
  742. status: true,
  743. fixed: '',
  744. columnWidth: 130,
  745. },
  746. {
  747. userId: this.$store.state.user.name,
  748. functionId: 101002004,
  749. serialNumber: '101002004Table1ActualDate',
  750. tableId: "101002004Table1",
  751. tableName: "点检工单表",
  752. columnProp: 'actualDate',
  753. headerAlign: "center",
  754. align: "center",
  755. columnLabel: '执行结束时间',
  756. columnHidden: false,
  757. columnImage: false,
  758. columnSortable: false,
  759. sortLv: 0,
  760. status: true,
  761. fixed: '',
  762. columnWidth: 130,
  763. },
  764. {
  765. userId: this.$store.state.user.name,
  766. functionId: 101002004,
  767. serialNumber: '101002004Table1WorkTime',
  768. tableId: "101002004Table1",
  769. tableName: "点检工单表",
  770. columnProp: 'workTime',
  771. headerAlign: "center",
  772. align: "right",
  773. columnLabel: '工作时长(m)',
  774. columnHidden: false,
  775. columnImage: false,
  776. columnSortable: false,
  777. sortLv: 0,
  778. status: true,
  779. fixed: '',
  780. columnWidth: 80,
  781. },
  782. {
  783. userId: this.$store.state.user.name,
  784. functionId: 101002004,
  785. serialNumber: '101002004Table1Remark',
  786. tableId: "101002004Table1",
  787. tableName: "点检工单表",
  788. columnProp: 'remark',
  789. headerAlign: "center",
  790. align: "center",
  791. columnLabel: '执行结果备注',
  792. columnHidden: false,
  793. columnImage: false,
  794. columnSortable: false,
  795. sortLv: 0,
  796. status: true,
  797. fixed: '',
  798. columnWidth: 120,
  799. }
  800. ],
  801. //执行结果
  802. detailList: [],
  803. detailModelFlag: false,
  804. saveData: {
  805. site: '',
  806. orderNo: '',
  807. planOperatorName: '',
  808. workTime: '',
  809. remark: '',
  810. actualOperatorName: '',
  811. checkResult: '',
  812. planID: '',
  813. objectID: '',
  814. checker: '',
  815. checkerName: '',
  816. status: '',
  817. itemList: [],
  818. mesUser: '',
  819. functionType: 'A',
  820. checkRemark: '',
  821. reachDate: '',
  822. actualDate: '',
  823. operator: '',
  824. adminID: ''
  825. },
  826. columnDetailList: [
  827. {
  828. userId: this.$store.state.user.name,
  829. functionId: 101002004,
  830. serialNumber: '101002004Table2ItemNo',
  831. tableId: "101002004Table2",
  832. tableName: "点检项目表",
  833. columnProp: 'itemNo',
  834. headerAlign: "center",
  835. align: "center",
  836. columnLabel: '点检项目编码',
  837. columnHidden: false,
  838. columnImage: false,
  839. columnSortable: false,
  840. sortLv: 0,
  841. status: true,
  842. fixed: '',
  843. columnWidth: 90,
  844. },
  845. {
  846. userId: this.$store.state.user.name,
  847. functionId: 101002004,
  848. serialNumber: '101002004Table2ItemDesc',
  849. tableId: "101002004Table2",
  850. tableName: "点检项目表",
  851. columnProp: 'itemDesc',
  852. headerAlign: "center",
  853. align: "center",
  854. columnLabel: '点检项目名称',
  855. columnHidden: false,
  856. columnImage: false,
  857. columnSortable: false,
  858. sortLv: 0,
  859. status: true,
  860. fixed: '',
  861. columnWidth: 90,
  862. },
  863. {
  864. userId: this.$store.state.user.name,
  865. functionId: 101002004,
  866. serialNumber: '101002004Table2ItemRemark',
  867. tableId: "101002004Table2",
  868. tableName: "点检项目表",
  869. columnProp: 'itemRemark',
  870. headerAlign: "center",
  871. align: "center",
  872. columnLabel: '点检方法说明',
  873. columnHidden: false,
  874. columnImage: false,
  875. columnSortable: false,
  876. sortLv: 0,
  877. status: true,
  878. fixed: '',
  879. columnWidth: 120,
  880. },
  881. {
  882. userId: this.$store.state.user.name,
  883. functionId: 101002004,
  884. serialNumber: '101002004Table2ValueType',
  885. tableId: "101002004Table2",
  886. tableName: "点检项目表",
  887. columnProp: 'valueType',
  888. headerAlign: "center",
  889. align: "center",
  890. columnLabel: '检测值类型',
  891. columnHidden: false,
  892. columnImage: false,
  893. columnSortable: false,
  894. sortLv: 0,
  895. status: true,
  896. fixed: '',
  897. columnWidth: 70,
  898. },
  899. {
  900. userId: this.$store.state.user.name,
  901. functionId: 101002004,
  902. serialNumber: '101002004Table2DefaultValue',
  903. tableId: "101002004Table2",
  904. tableName: "点检项目表",
  905. columnProp: 'defaultValue',
  906. headerAlign: "center",
  907. align: "center",
  908. columnLabel: '参照值',
  909. columnHidden: false,
  910. columnImage: false,
  911. columnSortable: false,
  912. sortLv: 0,
  913. status: true,
  914. fixed: '',
  915. columnWidth: 70,
  916. },
  917. {
  918. userId: this.$store.state.user.name,
  919. functionId: 101002004,
  920. serialNumber: '101002004Table2MaxValue',
  921. tableId: "101002004Table2",
  922. tableName: "点检项目表",
  923. columnProp: 'maxValue',
  924. headerAlign: "center",
  925. align: "center",
  926. columnLabel: '最大值',
  927. columnHidden: false,
  928. columnImage: false,
  929. columnSortable: false,
  930. sortLv: 0,
  931. status: true,
  932. fixed: '',
  933. columnWidth: 70,
  934. },
  935. {
  936. userId: this.$store.state.user.name,
  937. functionId: 101002004,
  938. serialNumber: '101002004Table2MinValue',
  939. tableId: "101002004Table2",
  940. tableName: "点检项目表",
  941. columnProp: 'minValue',
  942. headerAlign: "center",
  943. align: "center",
  944. columnLabel: '最小值',
  945. columnHidden: false,
  946. columnImage: false,
  947. columnSortable: false,
  948. sortLv: 0,
  949. status: true,
  950. fixed: '',
  951. columnWidth: 70,
  952. },
  953. ],
  954. changeModelFlag: false,
  955. planOperator: '',
  956. planOperatorName: '',
  957. submitData: {
  958. site: '',
  959. buNo: '',
  960. orderNo: '',
  961. planID: '',
  962. objectID: '',
  963. checker: '',
  964. checkerName: '',
  965. difficultyLevel: '',
  966. difficultyRemark: '',
  967. status: ''
  968. },
  969. submitModelFlag: false,
  970. // 日期限制
  971. pickerOptions: {
  972. disabledDate(time) {
  973. return time.getTime() > Date.now();
  974. },
  975. },
  976. cancelModelFlag: false,
  977. cancelData: {
  978. site: '',
  979. buNo: '',
  980. orderNo: '',
  981. objectID: '',
  982. functionType: '',
  983. cancelAll: '',
  984. planID: '',
  985. status: '',
  986. userId: ''
  987. },
  988. descImages: [],
  989. imageModalFlag: false,
  990. operatorModelFlag: false,
  991. operatorData: {
  992. site: '',
  993. bu: '',
  994. adminID: '',
  995. adminName: '',
  996. roleId: '',
  997. roleName: '',
  998. },
  999. roleList: [],
  1000. operatorList: [],
  1001. operatorListSelections: [],
  1002. operatorDetailList: [
  1003. {
  1004. columnProp: 'adminID',
  1005. headerAlign: "center",
  1006. align: "center",
  1007. columnLabel: '用户账号',
  1008. columnHidden: false,
  1009. columnImage: false,
  1010. columnSortable: false,
  1011. sortLv: 0,
  1012. status: true,
  1013. fixed: '',
  1014. },
  1015. {
  1016. columnProp: 'adminName',
  1017. headerAlign: "center",
  1018. align: "center",
  1019. columnLabel: '用户名称',
  1020. columnHidden: false,
  1021. columnImage: false,
  1022. columnSortable: false,
  1023. sortLv: 0,
  1024. status: true,
  1025. fixed: '',
  1026. },
  1027. {
  1028. columnProp: 'email',
  1029. headerAlign: "center",
  1030. align: "center",
  1031. columnLabel: '邮箱',
  1032. columnHidden: false,
  1033. columnImage: false,
  1034. columnSortable: false,
  1035. sortLv: 0,
  1036. status: true,
  1037. fixed: '',
  1038. },
  1039. {
  1040. columnProp: 'phone',
  1041. headerAlign: "center",
  1042. align: "center",
  1043. columnLabel: '手机号',
  1044. columnHidden: false,
  1045. columnImage: false,
  1046. columnSortable: false,
  1047. sortLv: 0,
  1048. status: true,
  1049. fixed: '',
  1050. },
  1051. ],
  1052. userBuList: [],
  1053. userRoleList: [],
  1054. authSearch: false,
  1055. authDetail: false,
  1056. authCancel: false,
  1057. menuId: this.$route.meta.menuId,
  1058. detailLoading: false,
  1059. searchLoading: false,
  1060. checkLoading: false
  1061. }
  1062. },
  1063. mounted () {
  1064. this.$nextTick(() => {
  1065. this.height = window.innerHeight - 212
  1066. })
  1067. },
  1068. created () {
  1069. // 按钮控制
  1070. this.getButtonAuthData()
  1071. // 获取用户的 site 和 bu
  1072. this.getSiteAndBuByUserName()
  1073. // 获取用户的 role
  1074. //this.getRoleByUserName()
  1075. // 校验用户是否收藏
  1076. this.favoriteIsOk()
  1077. // 动态列
  1078. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  1079. this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
  1080. if (!this.authSearch) {
  1081. // 获取数据列表
  1082. this.getDataList()
  1083. }
  1084. // 获取用户角色
  1085. this.getUserRoleList()
  1086. },
  1087. methods: {
  1088. // 获取用户的bu
  1089. getSiteAndBuByUserName () {
  1090. let tempData = {
  1091. username: this.$store.state.user.name,
  1092. }
  1093. getSiteAndBuByUserName(tempData).then(({data}) => {
  1094. if (data.code === 0) {
  1095. this.userBuList = data.rows
  1096. }
  1097. })
  1098. },
  1099. // 获取用户的 role
  1100. getRoleByUserName () {
  1101. let tempData = {
  1102. username: this.$store.state.user.name,
  1103. }
  1104. getRoleByUserName(tempData).then(({data}) => {
  1105. if (data.code === 0) {
  1106. this.userRoleList = data.rows
  1107. }
  1108. })
  1109. },
  1110. // 正则校验
  1111. handleInput (value, type) {
  1112. // 大于等于0,且只能输入4位小数
  1113. let val = value.replace(/^\D*([0-9]\d*\.?\d{0,4})?.*$/,'$1')
  1114. if (val === null || val === undefined || val === '') {
  1115. val = 0
  1116. }
  1117. if (type === 1) {
  1118. this.saveData.workTime = val
  1119. }
  1120. },
  1121. // 控制单行的背景颜色
  1122. controlRowStyle ({row, rowIndex}) {
  1123. // 区分不同的样式对应不同的颜色
  1124. if (row.status === '待审核') {
  1125. return "background-color: #D8ECF1"
  1126. }
  1127. },
  1128. /**
  1129. * 查看项目图片
  1130. */
  1131. checkItemImageModal (row) {
  1132. this.descImages = []
  1133. let tempData = {
  1134. site: row.site,
  1135. orderNo: row.orderNo,
  1136. folder: row.itemNo,
  1137. buNo: row.buNo
  1138. }
  1139. searchFileUrl(tempData).then(({data}) => {
  1140. if (data.code === 0) {
  1141. for (let i = 0; i < data.rows.length; i++) {
  1142. this.descImages.push(data.rows[i].url)
  1143. }
  1144. } else {
  1145. this.$message.warning(data.msg)
  1146. }
  1147. })
  1148. this.imageModalFlag = true
  1149. },
  1150. // 校验用户是否收藏
  1151. favoriteIsOk () {
  1152. let userFavorite = {
  1153. userId: this.$store.state.user.id,
  1154. languageCode: this.$i18n.locale
  1155. }
  1156. userFavoriteList(userFavorite).then(({data}) => {
  1157. for (let i = 0; i < data.list.length; i++) {
  1158. if (this.$route.meta.menuId === data.list[i].menuId) {
  1159. this.favorite = true
  1160. }
  1161. }
  1162. })
  1163. },
  1164. // 收藏 OR 取消收藏
  1165. favoriteFunction () {
  1166. let userFavorite = {
  1167. userId: this.$store.state.user.id,
  1168. functionId: this.$route.meta.menuId,
  1169. }
  1170. if (this.favorite) {
  1171. removeUserFavorite(userFavorite).then(({data}) => {
  1172. this.$message.success(data.msg)
  1173. this.favorite = false
  1174. })
  1175. } else {
  1176. // 收藏
  1177. saveUserFavorite(userFavorite).then(({data}) => {
  1178. this.$message.success(data.msg)
  1179. this.favorite = true
  1180. })
  1181. }
  1182. },
  1183. // 获取基础数据列表S
  1184. getBaseList (val,type) {
  1185. this.tagNo = val
  1186. this.$nextTick(() => {
  1187. let strVal = ''
  1188. if (val === 201) {
  1189. strVal = this.planOperator
  1190. this.$refs.baseList.init(val, strVal)
  1191. }
  1192. })
  1193. },
  1194. /* 列表方法的回调 */
  1195. getBaseData (val) {
  1196. if (this.tagNo === 201) {
  1197. this.planOperator = val.username
  1198. this.planOperatorName = val.user_display
  1199. }
  1200. },
  1201. //导出excel
  1202. async createExportData () {
  1203. this.searchData.limit = -1
  1204. this.searchData.page = 1
  1205. await eamWorkOrderSearch(this.searchData).then(({data}) => {
  1206. this.exportList= data.page.list
  1207. })
  1208. return this.exportList
  1209. },
  1210. startDownload() {},
  1211. finishDownload() {},
  1212. fields() {
  1213. let json = "{"
  1214. this.columnList.forEach((item, index) => {
  1215. if (index == this.columnList.length - 1) {
  1216. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  1217. } else {
  1218. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  1219. }
  1220. })
  1221. json += "}"
  1222. let s = eval("(" + json + ")")
  1223. return s
  1224. },
  1225. // 重置查询时间
  1226. searchClick () {
  1227. this.searchData.planDate = ''
  1228. this.getDataList()
  1229. },
  1230. // 获取数据列表
  1231. getDataList () {
  1232. this.searchLoading = true
  1233. this.searchData.limit = this.pageSize
  1234. this.searchData.page = this.pageIndex
  1235. eamWorkOrderSearch(this.searchData).then(({data}) => {
  1236. if (data.code === 0) {
  1237. this.dataList = data.page.list
  1238. this.pageIndex = data.page.currPage
  1239. this.pageSize = data.page.pageSize
  1240. this.totalPage = data.page.totalCount
  1241. this.searchLoading = false
  1242. } else {
  1243. this.searchLoading = false
  1244. }
  1245. }).catch(() => {
  1246. this.searchLoading = false
  1247. })
  1248. },
  1249. // 每页数
  1250. sizeChangeHandle (val) {
  1251. this.pageSize = val
  1252. this.pageIndex = 1
  1253. this.getDataList()
  1254. },
  1255. // 当前页
  1256. currentChangeHandle (val) {
  1257. this.pageIndex = val
  1258. this.getDataList()
  1259. },
  1260. // 多选
  1261. selectionChangeHandle (val) {
  1262. this.dataListSelections = val
  1263. },
  1264. // 审核按钮
  1265. checkModal () {
  1266. let mesUser = this.$store.state.user.name
  1267. this.submitData.site = this.saveData.site
  1268. this.submitData.buNo = this.saveData.buNo
  1269. this.submitData.orderNo = this.saveData.orderNo
  1270. this.submitData.planID = this.saveData.planID
  1271. this.submitData.objectID = this.saveData.objectID
  1272. this.submitData.checker = this.saveData.checker
  1273. this.submitData.checkerName = this.saveData.checkerName
  1274. this.submitData.status = this.saveData.status
  1275. if (!this.submitData.checker.split(';').includes(mesUser)) {
  1276. this.$message.warning('审核人员与计划不符!')
  1277. return
  1278. }
  1279. if (this.submitData.status === '已完工') {
  1280. this.$confirm(`是否取消审核?`, '提示', {
  1281. confirmButtonText: '确定',
  1282. cancelButtonText: '取消',
  1283. type: 'warning'
  1284. }).then(() => {
  1285. checkWorkOrder(this.submitData).then(({data}) => {
  1286. if (data && data.code === 0) {
  1287. this.getDataList()
  1288. this.saveData.status = '待审核'
  1289. this.$message({
  1290. message: '操作成功',
  1291. type: 'success',
  1292. duration: 1500,
  1293. onClose: () => {}
  1294. })
  1295. } else {
  1296. this.$alert(data.msg, '错误', {
  1297. confirmButtonText: '确定'
  1298. })
  1299. }
  1300. })
  1301. })
  1302. } else if (this.submitData.status === '待审核') {
  1303. this.$confirm(`是否确认审核?`, '提示', {
  1304. confirmButtonText: '确定',
  1305. cancelButtonText: '取消',
  1306. type: 'warning'
  1307. }).then(() => {
  1308. checkWorkOrder(this.submitData).then(({data}) => {
  1309. if (data && data.code === 0) {
  1310. this.getDataList()
  1311. this.saveData.status = '已完工'
  1312. this.$message({
  1313. message: '操作成功',
  1314. type: 'success',
  1315. duration: 1500,
  1316. onClose: () => {}
  1317. })
  1318. } else {
  1319. this.$alert(data.msg, '错误', {
  1320. confirmButtonText: '确定'
  1321. })
  1322. }
  1323. })
  1324. })
  1325. }
  1326. },
  1327. // 批量审核按钮
  1328. checkModals () {
  1329. let tempData1 = '' // 记录不是待审核的单号
  1330. let tempData2 = '' // 记录审核人员不符的单号
  1331. let mesUser = this.$store.state.user.name
  1332. if (this.dataListSelections.length === 0) {
  1333. this.$message.warning('请勾选要审核的工单!')
  1334. return
  1335. }
  1336. for (let i = 0; i < this.dataListSelections.length; i++) {
  1337. if (this.dataListSelections[i].status !== '待审核') {
  1338. tempData1 = tempData1 + this.dataListSelections[i].orderNo + '、'
  1339. }
  1340. if (!this.dataListSelections[i].checker.split(';').includes(mesUser)) {
  1341. tempData2 = tempData2 + this.dataListSelections[i].orderNo + '、'
  1342. }
  1343. }
  1344. if (tempData1 !== '') {
  1345. tempData1 = tempData1.substring(0, tempData1.length - 1)
  1346. this.$message.warning('工单编码 [' + tempData1 + '] 不是待审核状态!')
  1347. return
  1348. }
  1349. if (tempData2 !== '') {
  1350. tempData2 = tempData2.substring(0, tempData2.length - 1)
  1351. this.$message.warning('工单编码 [' + tempData2 + '] 审核人员与计划不符!')
  1352. return
  1353. }
  1354. this.$confirm(`是否确认审核?`, '提示', {
  1355. confirmButtonText: '确定',
  1356. cancelButtonText: '取消',
  1357. type: 'warning'
  1358. }).then(() => {
  1359. this.checkLoading = true
  1360. let tempData = {
  1361. informationList: this.dataListSelections
  1362. }
  1363. checkWorkOrders(tempData).then(({data}) => {
  1364. if (data && data.code === 0) {
  1365. this.getDataList()
  1366. this.$message({
  1367. message: '操作成功',
  1368. type: 'success',
  1369. duration: 1500,
  1370. onClose: () => {}
  1371. })
  1372. this.checkLoading = false
  1373. } else {
  1374. this.checkLoading = false
  1375. this.$alert(data.msg, '错误', {
  1376. confirmButtonText: '确定'
  1377. })
  1378. }
  1379. }).catch(() => {
  1380. this.checkLoading = false
  1381. })
  1382. })
  1383. },
  1384. // 确认审核
  1385. submitModel () {
  1386. if (this.submitData.difficultyLevel === ''||this.submitData.difficultyLevel == null) {
  1387. this.$alert('请选择难度等级!', '提示', {
  1388. confirmButtonText: '确定'
  1389. })
  1390. return false
  1391. }
  1392. checkWorkOrder(this.submitData).then(({data}) => {
  1393. if (data && data.code === 0) {
  1394. this.getDataList()
  1395. this.submitModelFlag = false
  1396. this.$message({
  1397. message: '操作成功',
  1398. type: 'success',
  1399. duration: 1500,
  1400. onClose: () => {
  1401. }
  1402. })
  1403. } else {
  1404. this.$alert(data.msg, '错误', {
  1405. confirmButtonText: '确定'
  1406. })
  1407. }
  1408. })
  1409. },
  1410. // 详情
  1411. reportModal (row) {
  1412. let inData = {
  1413. site: row.site,
  1414. buNo: row.buNo,
  1415. itemNo: row.itemNo,
  1416. planID: row.planID,
  1417. orderNo: row.orderNo,
  1418. itemType: row.functionType,
  1419. }
  1420. this.detailLoading = true
  1421. eamWorkOrderReportSearch(inData).then(({data}) => {
  1422. this.detailList = data.rows
  1423. this.detailLoading = false
  1424. })
  1425. this.saveData = {
  1426. site: row.site,
  1427. buNo: row.buNo,
  1428. orderNo: row.orderNo,
  1429. planID: row.planID,
  1430. planOperatorName: row.planOperatorName,
  1431. workTime: row.workTime,
  1432. remark: row.remark,
  1433. actualOperatorName: row.actualOperatorName,
  1434. checkResult: row.checkResult,
  1435. objectID: row.objectID,
  1436. checker: row.checker,
  1437. checkerName: row.checkerName,
  1438. status: row.status,
  1439. itemList: [],
  1440. mesUser: this.$store.state.user.name,
  1441. functionType: 'A',
  1442. checkRemark: row.checkRemark,
  1443. reachDate: row.reachDate,
  1444. actualDate: row.actualDate,
  1445. operator: row.operator,
  1446. adminID: row.adminID
  1447. }
  1448. this.detailModelFlag = true
  1449. },
  1450. cancelOrder (row) {
  1451. this.cancelData = {
  1452. site: row.site,
  1453. buNo: row.buNo,
  1454. orderNo: row.orderNo,
  1455. objectID: row.objectID,
  1456. functionType: row.functionType,
  1457. planID: row.planID,
  1458. status: row.status,
  1459. cancelAll: '',
  1460. userId: this.$store.state.user.name
  1461. }
  1462. this.cancelModelFlag = true
  1463. },
  1464. cancelOrder2 () {
  1465. // let obj = document.getElementsByName('addWorkOrderRule')
  1466. // let s = ''
  1467. // for (let i = 0; i < obj.length; i++) {
  1468. // if (obj[i].checked) {
  1469. // s += obj[i].value + ','
  1470. // }
  1471. // }
  1472. // s = s.substring(0,s.length-1)
  1473. // this.cancelData.cancelAll = s
  1474. if (this.cancelData.cancelAll === 'Y') {
  1475. this.$confirm(`是否取消该计划设备的所有工单?`, '提示', {
  1476. confirmButtonText: '确定',
  1477. cancelButtonText: '取消',
  1478. type: 'warning'
  1479. }).then(() => {
  1480. this.cancelOrder3()
  1481. })
  1482. } else {
  1483. this.cancelOrder3()
  1484. }
  1485. },
  1486. cancelOrder3 () {
  1487. cancelOrder(this.cancelData).then(({data}) => {
  1488. if (data && data.code === 0) {
  1489. this.getDataList()
  1490. this.cancelModelFlag = false
  1491. this.$message({
  1492. message: '操作成功',
  1493. type: 'success',
  1494. duration: 1500,
  1495. onClose: () => {
  1496. }
  1497. })
  1498. } else {
  1499. this.$alert(data.msg, '错误', {
  1500. confirmButtonText: '确定'
  1501. })
  1502. }
  1503. })
  1504. },
  1505. selectFlag (row, index) {
  1506. // if (row.status !== '未开工') {
  1507. // return false
  1508. // } else {
  1509. return true
  1510. // }
  1511. },
  1512. changeModel () {
  1513. if (this.dataListSelections.length === 0) {
  1514. this.$alert('请勾选工单!', '错误', {
  1515. confirmButtonText: '确定'
  1516. })
  1517. return false
  1518. }
  1519. this.planOperator = ''
  1520. this.planOperatorName = ''
  1521. this.changeModelFlag = true
  1522. },
  1523. changeOrderOperator () {
  1524. let inList = JSON.parse(JSON.stringify(this.dataListSelections))
  1525. for (let i = 0; i <inList.length; i++) {
  1526. inList[i].planOperator = this.planOperator
  1527. }
  1528. changeOrderOperator(inList).then(({data}) => {
  1529. if (data && data.code === 0) {
  1530. this.changeModelFlag = false
  1531. this.getDataList()
  1532. this.$message({
  1533. message: '操作成功',
  1534. type: 'success',
  1535. duration: 1500,
  1536. onClose: () => {
  1537. }
  1538. })
  1539. } else {
  1540. this.$alert(data.msg, '错误', {
  1541. confirmButtonText: '确定'
  1542. })
  1543. }
  1544. })
  1545. },
  1546. updateWorkOrder () {
  1547. let tempFlag = 'N'
  1548. if (this.saveData.checkResult === '' || this.saveData.checkResult == null) {
  1549. this.$message.warning('请选择点检结论!')
  1550. return
  1551. }
  1552. if (this.saveData.workTime <= 0) {
  1553. this.$message.warning('工作时长不能 <= 0!')
  1554. return
  1555. }
  1556. for (let i = 0; i < this.detailList.length; i++) {
  1557. if (this.detailList[i].valueTypeDb === 'N' && (this.detailList[i].numberValue === '' || this.detailList[i].numberValue == null)) {
  1558. this.$message.warning(this.detailList[i].itemDesc+'实测值未填写!')
  1559. return
  1560. }
  1561. if (this.detailList[i].valueTypeDb === 'N' && this.detailList[i].numberValue !== '' && this.detailList[i].numberValue != null) {
  1562. if ((this.detailList[i].minValue !== "" && this.detailList[i].minValue != null && this.detailList[i].minValue > this.detailList[i].numberValue) || (this.detailList[i].minValue !== "" && this.detailList[i].minValue != null && this.detailList[i].maxValue < this.detailList[i].numberValue)) {
  1563. this.detailList[i].itemResult = '不合格'
  1564. }
  1565. }
  1566. }
  1567. if (this.saveData.checkResult === '不合格') {
  1568. const flag = this.detailList.some(item => item.itemResult === '不合格')
  1569. if (!flag) {
  1570. this.$message.warning('请选择不合格项目!')
  1571. return
  1572. }
  1573. }
  1574. this.saveData.itemList = JSON.parse(JSON.stringify(this.detailList))
  1575. updateWorkOrder(this.saveData).then(({data}) => {
  1576. if (data && data.code === 0) {
  1577. this.getDataList()
  1578. this.detailModelFlag = false
  1579. this.$message({
  1580. message: '操作成功',
  1581. type: 'success',
  1582. duration: 1500,
  1583. onClose: () => {}
  1584. })
  1585. } else {
  1586. this.$alert(data.msg, '错误', {
  1587. confirmButtonText: '确定'
  1588. })
  1589. }
  1590. })
  1591. },
  1592. // 获取用户角色
  1593. getUserRoleList () {
  1594. getUserRoleList().then(({data}) => {
  1595. if (data.code === 0) {
  1596. this.roleList = data.rows
  1597. } else {
  1598. this.roleList = []
  1599. }
  1600. })
  1601. },
  1602. // 获取人员列表
  1603. getOperatorList () {
  1604. this.operatorData.bu = this.saveData.site + '_' + this.saveData.buNo
  1605. if (this.roleList.length > 0) {
  1606. let filterList = this.roleList.filter(item => item.roleName === '机修人员')
  1607. if (filterList.length > 0) {
  1608. this.operatorData.roleId = filterList[0].roleId
  1609. } else {
  1610. this.operatorData.roleId = this.roleList[0].roleId
  1611. }
  1612. } else {
  1613. this.operatorData.roleId = ''
  1614. }
  1615. // 先清空缓存选中
  1616. this.$nextTick(() => this.$refs.operatorTable.clearSelection())
  1617. // 拿到选中的人员编号
  1618. let tempDataList = (this.saveData.adminID == null ? '' : this.saveData.adminID).split(';')
  1619. // 查询所有部门
  1620. getOperatorList(this.operatorData).then(({data}) => {
  1621. if (data && data.code === 0) {
  1622. this.operatorList = data.rows
  1623. this.operatorList.forEach(val => {
  1624. // 回显选中的部门
  1625. if (tempDataList.includes(val.adminID)) {
  1626. this.$nextTick(() => this.$refs.operatorTable.toggleRowSelection(val, true))
  1627. }
  1628. })
  1629. this.operatorModelFlag = true
  1630. } else {
  1631. this.$alert(data.msg, '错误', {
  1632. confirmButtonText: '确定'
  1633. })
  1634. }
  1635. })
  1636. },
  1637. // 查询机修人员列表
  1638. getOperatorList2 () {
  1639. // 拿到选中的人员编号
  1640. let tempDataList = (this.saveData.adminID == null ? '' : this.saveData.adminID).split(';')
  1641. getOperatorList(this.operatorData).then(({data}) => {
  1642. if (data && data.code === 0) {
  1643. this.operatorList = data.rows
  1644. this.operatorList.forEach(val => {
  1645. // 回显选中的部门
  1646. if (tempDataList.includes(val.adminID)) {
  1647. this.$nextTick(() => this.$refs.operatorTable.toggleRowSelection(val, true))
  1648. }
  1649. })
  1650. } else {
  1651. this.operatorList = []
  1652. }
  1653. })
  1654. },
  1655. // 部门
  1656. operatorClickRow (row) {
  1657. this.$refs.operatorTable.toggleRowSelection(row)
  1658. },
  1659. // 多选
  1660. selectionOperator (val) {
  1661. this.operatorListSelections = val
  1662. },
  1663. getRowKeys (row) {
  1664. // 唯一值,一般都为id
  1665. return row.adminID
  1666. },
  1667. // 确认多选部门
  1668. confirmOperator () {
  1669. this.saveData.adminID = ''
  1670. this.saveData.operator = ''
  1671. for (let i = 0; i < this.operatorListSelections.length; i++) {
  1672. this.saveData.adminID = this.saveData.adminID + ";" + this.operatorListSelections[i].adminID
  1673. this.saveData.operator = this.saveData.operator + ";" + this.operatorListSelections[i].adminName
  1674. }
  1675. this.saveData.adminID = this.saveData.adminID.substring(1)
  1676. this.saveData.operator = this.saveData.operator.substring(1)
  1677. this.operatorModelFlag = false
  1678. },
  1679. // 动态列开始 获取 用户保存的 格式列
  1680. async getTableUserColumn (tableId, columnId) {
  1681. let queryTableUser = {
  1682. userId: this.$store.state.user.name,
  1683. functionId: this.$route.meta.menuId,
  1684. tableId: tableId,
  1685. status: true,
  1686. languageCode: this.$i18n.locale
  1687. }
  1688. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  1689. if (data.rows.length > 0) {
  1690. //this.columnList1 = []
  1691. switch (columnId) {
  1692. case 1:
  1693. this.columnList = data.rows
  1694. break;
  1695. case 2:
  1696. this.columnDetailList = data.rows
  1697. break;
  1698. // case 3:
  1699. // this.columnList2 = data.rows
  1700. // break;
  1701. // case 4:
  1702. // this.columnList3 = data.rows
  1703. // break;
  1704. }
  1705. } else {
  1706. this.getColumnList(tableId, columnId)
  1707. }
  1708. })
  1709. },
  1710. // 获取 tableDefault 列
  1711. async getColumnList(tableId, columnId) {
  1712. let queryTable = {
  1713. functionId: this.$route.meta.menuId,
  1714. tableId: tableId,
  1715. languageCode: this.$i18n.locale
  1716. }
  1717. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  1718. if (!data.rows.length == 0) {
  1719. switch (columnId) {
  1720. case 1:
  1721. this.columnList = data.rows
  1722. break;
  1723. case 2:
  1724. this.columnDetailList = data.rows
  1725. break;
  1726. // case 3:
  1727. // this.columnList2 = data.rows
  1728. // break;
  1729. // case 4:
  1730. // this.columnList3 = data.rows
  1731. // break;
  1732. }
  1733. } else {
  1734. // this.showDefault = true.
  1735. }
  1736. })
  1737. },
  1738. //获取按钮的权限数据
  1739. getButtonAuthData () {
  1740. let searchFlag = this.isAuth(this.menuId+":search")
  1741. let detailFlag = this.isAuth(this.menuId+":detail")
  1742. let cancelFlag = this.isAuth(this.menuId+":cancel")
  1743. //处理页面的权限数据
  1744. this.authSearch = !searchFlag
  1745. this.authDetail = !detailFlag
  1746. this.authCancel = !cancelFlag
  1747. },
  1748. }
  1749. }
  1750. </script>
  1751. <style scoped>
  1752. .numInput /deep/ .el-input__inner{
  1753. text-align: right;
  1754. }
  1755. </style>