index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. <template>
  2. <div class="app-container" v-if="!open">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="仓库名称" prop="fWarehouseid">
  5. <el-select
  6. v-model="queryParams.fWarehouseid"
  7. filterable
  8. placeholder="请选择仓库名称"
  9. >
  10. <el-option
  11. v-for="(item, index) in warehouseOptions"
  12. :key="index.fId"
  13. :label="item.fName"
  14. :value="item.fId"
  15. ></el-option>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="计划日期">
  19. <el-date-picker
  20. v-model="fPlanneddate"
  21. @change="planDateMethod"
  22. type="daterange"
  23. :clearable="false"
  24. start-placeholder="开始日期"
  25. end-placeholder="结束日期"
  26. value-format="yyyy-MM-dd HH:mm:ss"
  27. :default-time="['00:00:00', '23:59:59']"
  28. :picker-options="pickerOptions"
  29. unlink-panels>
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item label="巡检人" prop="fInspectorid">
  33. <el-select
  34. v-model="queryParams.fInspectorid"
  35. filterable
  36. placeholder="请选择巡检人"
  37. >
  38. <el-option
  39. v-for="(item, index) in patrolInspection"
  40. :key="index.userId"
  41. :label="item.userName"
  42. :value="item.userId"
  43. ></el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="巡检备注" prop="remark">
  47. <el-input
  48. v-model="queryParams.remark"
  49. placeholder="请输入巡检备注"
  50. clearable
  51. size="small"
  52. />
  53. </el-form-item>
  54. <el-form-item>
  55. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  56. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  57. </el-form-item>
  58. </el-form>
  59. <el-row :gutter="10" class="mb8">
  60. <el-col :span="1.5">
  61. <el-button
  62. type="primary"
  63. icon="el-icon-plus"
  64. size="mini"
  65. @click="handleAdd"
  66. >新增
  67. </el-button>
  68. </el-col>
  69. <el-col :span="1.5">
  70. <el-button
  71. type="success"
  72. icon="el-icon-edit"
  73. size="mini"
  74. :disabled="single"
  75. @click="handleUpdate"
  76. >修改
  77. </el-button>
  78. </el-col>
  79. <el-col :span="1.5">
  80. <el-button
  81. type="danger"
  82. icon="el-icon-delete"
  83. size="mini"
  84. :disabled="multiple"
  85. @click="handleDelete"
  86. >删除
  87. </el-button>
  88. </el-col>
  89. <!-- <el-col :span="1.5">-->
  90. <!-- <el-button-->
  91. <!-- type="warning"-->
  92. <!-- icon="el-icon-download"-->
  93. <!-- size="mini"-->
  94. <!-- @click="handleExport"-->
  95. <!-- >导出-->
  96. <!-- </el-button>-->
  97. <!-- </el-col>-->
  98. <right-toolbar :showSearch.sync="showSearch" @queryTable="resetQuery"></right-toolbar>
  99. </el-row>
  100. <el-table v-loading="loading" :data="logList" @selection-change="handleSelectionChange" ref="table"
  101. :height="tableHeight">
  102. <el-table-column type="selection" width="55" align="center"/>
  103. <el-table-column label="序号" type="index" width="50" fixed align="center"/>
  104. <el-table-column label="仓库名称" align="center" prop="fWarehouseName" width="280" show-overflow-tooltip/>
  105. <el-table-column label="巡检人" align="center" prop="fInspectorName" show-overflow-tooltip/>
  106. <el-table-column label="巡检计划日期起" align="center" prop="fInspectorBeginDatetime" width="180" show-overflow-tooltip>
  107. <template slot-scope="scope">
  108. <span>{{ parseTime(scope.row.fInspectorBeginDatetime, '{y}-{m}-{d}') }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="巡检计划日期止" align="center" prop="fInspectorEndDatetime" width="180" show-overflow-tooltip>
  112. <template slot-scope="scope">
  113. <span>{{ parseTime(scope.row.fInspectorEndDatetime, '{y}-{m}-{d}') }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="制单人" align="center" prop="fCreateByName" show-overflow-tooltip/>
  117. <el-table-column label="制单日期" align="center" prop="fCreateTime" width="180" show-overflow-tooltip>
  118. <template slot-scope="scope">
  119. <span>{{ parseTime(scope.row.fCreateTime, '{y}-{m}-{d}') }}</span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="更新人" align="center" prop="fUpdateByName" show-overflow-tooltip/>
  123. <el-table-column label="最新时间" align="center" prop="fUpdateTime" width="180" show-overflow-tooltip>
  124. <template slot-scope="scope">
  125. <span>{{ parseTime(scope.row.fUpdateTime, '{y}-{m}-{d}') }}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="系统编号" align="center" prop="fSystemNo" show-overflow-tooltip/>
  129. <el-table-column label="备注" align="center" prop="fRemark" show-overflow-tooltip/>
  130. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160" fixed="right">
  131. <template slot-scope="scope">
  132. <el-button
  133. size="mini"
  134. type="text"
  135. icon="el-icon-edit"
  136. @click="viewDetails(scope.row)"
  137. >查看
  138. </el-button>
  139. <el-button
  140. size="mini"
  141. type="text"
  142. icon="el-icon-delete"
  143. @click="handleDelete(scope.row,scope.$index)"
  144. >删除
  145. </el-button>
  146. </template>
  147. </el-table-column>
  148. </el-table>
  149. <pagination
  150. v-show="total>0"
  151. :total="total"
  152. :page.sync="queryParams.pageNum"
  153. :limit.sync="queryParams.pageSize"
  154. @pagination="getList"
  155. />
  156. </div>
  157. <div class="app-container" v-else>
  158. <!-- 添加或修改入出库状态对话框 -->
  159. <el-button type="danger" size="mini" @click="cancel">返回列表</el-button>
  160. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  161. <el-row>
  162. <el-col :span="8">
  163. <el-form-item label="仓库名称" prop="fWarehouseFid">
  164. <el-select
  165. v-model="form.fWarehouseFid"
  166. filterable
  167. style="width: 260px;"
  168. placeholder="请选择仓库名称"
  169. >
  170. <el-option
  171. v-for="(item, index) in warehouseOptions"
  172. :key="index.fId"
  173. :label="item.fName"
  174. :value="item.fId"
  175. ></el-option>
  176. </el-select>
  177. </el-form-item>
  178. </el-col>
  179. <el-col :span="8">
  180. <el-form-item label="巡检日期起" prop="fInspectorBeginDatetime">
  181. <el-date-picker
  182. style="width: 260px;"
  183. v-model="form.fInspectorBeginDatetime"
  184. value-format="yyyy-MM-dd HH:mm:ss"
  185. type="datetime"
  186. placeholder="选择日期时间">
  187. </el-date-picker>
  188. </el-form-item>
  189. </el-col>
  190. <el-col :span="8">
  191. <el-form-item label="巡检日期止" prop="fInspectorEndDatetime">
  192. <el-date-picker
  193. style="width: 260px;"
  194. v-model="form.fInspectorEndDatetime"
  195. value-format="yyyy-MM-dd HH:mm:ss"
  196. type="datetime"
  197. placeholder="选择日期时间">
  198. </el-date-picker>
  199. </el-form-item>
  200. </el-col>
  201. </el-row>
  202. <el-row>
  203. <el-col :span="8">
  204. <el-form-item label="巡检人" prop="fInspectorId">
  205. <el-select
  206. v-model="form.fInspectorId"
  207. filterable
  208. style="width: 260px;"
  209. placeholder="请选择巡检人"
  210. >
  211. <el-option
  212. v-for="(item, index) in patrolInspection"
  213. :key="index.userId"
  214. :label="item.userName"
  215. :value="item.userId"
  216. ></el-option>
  217. </el-select>
  218. </el-form-item>
  219. </el-col>
  220. <el-col :span="8">
  221. <el-form-item label="备注" prop="fRemark">
  222. <el-input v-model="form.remark" type="textarea" style="width: 260px;" placeholder="请输入内容" autosize/>
  223. </el-form-item>
  224. </el-col>
  225. </el-row>
  226. </el-form>
  227. <div style="width: 100%;margin: 10px auto">
  228. <el-button type="primary" size="mini" @click="inputDetails">录入明细</el-button>
  229. <el-button type="success" size="mini" @click="submitForm">保 存</el-button>
  230. </div>
  231. <div style="width: 100%;">
  232. <el-table
  233. :data="form.tWarehouseCheckItemsList"
  234. style="width: 100%">
  235. <el-table-column label="序号" type="index" width="50" fixed align="center"/>
  236. <el-table-column label="仓库名称" align="center" prop="fWarehouseFid">
  237. <template slot-scope="scope">
  238. <el-select
  239. v-model="scope.row.fWarehouseFid"
  240. filterable
  241. placeholder="请选择仓库名称"
  242. >
  243. <el-option
  244. v-for="(item, index) in warehouseOptions"
  245. :key="index.fId"
  246. :label="item.fName"
  247. :value="item.fId"
  248. ></el-option>
  249. </el-select>
  250. </template>
  251. </el-table-column>
  252. <el-table-column label="巡检人" align="center" prop="fInspectorId">
  253. <template slot-scope="scope">
  254. <el-select
  255. v-model="scope.row.fInspectorId"
  256. filterable
  257. placeholder="请选择巡检人"
  258. >
  259. <el-option
  260. v-for="(item, index) in patrolInspection"
  261. :key="index.userId"
  262. :label="item.userName"
  263. :value="item.userId"
  264. ></el-option>
  265. </el-select>
  266. </template>
  267. </el-table-column>
  268. <el-table-column label="计划日期" align="center" prop="fInspectionDatetime">
  269. <template slot-scope="scope">
  270. <el-date-picker
  271. style="width: 100%;"
  272. v-model="scope.row.fInspectionDatetime"
  273. value-format="yyyy-MM-dd HH:mm:ss"
  274. type="datetime"
  275. placeholder="选择日期时间">
  276. </el-date-picker>
  277. </template>
  278. </el-table-column>
  279. <el-table-column label="最新巡检日期" align="center" prop="fUpdateTime">
  280. <template slot-scope="scope">
  281. <el-date-picker
  282. style="width: 100%;"
  283. disabled
  284. v-model="scope.row.fUpdateTime"
  285. value-format="yyyy-MM-dd HH:mm:ss"
  286. type="datetime"
  287. placeholder="选择日期时间">
  288. </el-date-picker>
  289. </template>
  290. </el-table-column>
  291. <el-table-column label="最新巡检人" align="center" prop="fUpdateBy">
  292. <template slot-scope="scope">
  293. <el-select
  294. disabled
  295. v-model="scope.row.fUpdateBy"
  296. filterable
  297. placeholder="最新巡检人"
  298. >
  299. <el-option
  300. v-for="(item, index) in patrolInspection"
  301. :key="index.userId"
  302. :label="item.userName"
  303. :value="item.userId"
  304. ></el-option>
  305. </el-select>
  306. </template>
  307. </el-table-column>
  308. <el-table-column label="巡检记录" align="center">
  309. <template slot-scope="scope" style="width: 100px;">
  310. <el-button
  311. size="mini"
  312. type="text"
  313. :disabled="!scope.row.fId"
  314. @click="pictureList(scope)"
  315. icon="el-icon-document"
  316. >详情
  317. </el-button>
  318. </template>
  319. </el-table-column>
  320. <!-- <el-table-column label="录入人" align="center" prop="createBy">-->
  321. <!-- <template slot-scope="scope">-->
  322. <!-- <el-input v-model="scope.row.createBy" placeholder="请输入内容"></el-input>-->
  323. <!-- </template>-->
  324. <!-- </el-table-column>-->
  325. <!-- <el-table-column label="录入日期" align="center" prop="createTime">-->
  326. <!-- <template slot-scope="scope">-->
  327. <!-- <el-date-picker-->
  328. <!-- style="width: 100%;"-->
  329. <!-- v-model="scope.row.createTime"-->
  330. <!-- value-format="yyyy-MM-dd"-->
  331. <!-- type="date"-->
  332. <!-- placeholder="选择日期">-->
  333. <!-- </el-date-picker>-->
  334. <!-- </template>-->
  335. <!-- </el-table-column>-->
  336. <!-- <el-table-column label="更新人" align="center" prop="updateBy">-->
  337. <!-- <template slot-scope="scope">-->
  338. <!-- <el-input v-model="scope.row.updateBy" placeholder="请输入内容"></el-input>-->
  339. <!-- </template>-->
  340. <!-- </el-table-column>-->
  341. <!-- <el-table-column label="更新日期" align="center" prop="updateTime">-->
  342. <!-- <template slot-scope="scope">-->
  343. <!-- <el-date-picker-->
  344. <!-- style="width: 100%;"-->
  345. <!-- v-model="scope.row.updateTime"-->
  346. <!-- value-format="yyyy-MM-dd"-->
  347. <!-- type="date"-->
  348. <!-- placeholder="选择日期">-->
  349. <!-- </el-date-picker>-->
  350. <!-- </template>-->
  351. <!-- </el-table-column>-->
  352. <el-table-column label="备注" align="center" prop="fRemark">
  353. <template slot-scope="scope">
  354. <el-input v-model="scope.row.fRemark" placeholder="请输入备注"></el-input>
  355. </template>
  356. </el-table-column>
  357. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  358. <template slot-scope="scope" style="width: 100px;">
  359. <el-button
  360. size="mini"
  361. type="text"
  362. icon="el-icon-delete"
  363. @click="singleItemDeletion(scope.$index,scope)"
  364. >删除
  365. </el-button>
  366. </template>
  367. </el-table-column>
  368. </el-table>
  369. </div>
  370. <div slot="footer" class="dialog-footer">
  371. </div>
  372. <el-dialog
  373. title="图片明细"
  374. :visible.sync="opentwo"
  375. append-to-body
  376. width="70%">
  377. <el-form ref="form" :model="twarehousecheckdetailList" label-width="80px"
  378. style="display:flex;flex-wrap: wrap;justify-content: space-between">
  379. <el-form-item label="仓库名称" prop="fWarehouseid">
  380. <el-select
  381. v-model="twarehousecheckdetailList.fWarehouseid"
  382. filterable
  383. disabled
  384. placeholder="请选择仓库名称"
  385. style="width: 200px;"
  386. >
  387. <el-option
  388. v-for="(item, index) in warehouseOptions"
  389. :key="index.fId"
  390. :label="item.fName"
  391. :value="item.fId"
  392. ></el-option>
  393. </el-select>
  394. </el-form-item>
  395. <el-form-item label="巡检日期" prop="fCreateTime">
  396. <el-date-picker
  397. style="width: 200px;"
  398. disabled
  399. v-model="twarehousecheckdetailList.fCreateTime"
  400. type="date"
  401. value-format="yyyy-MM-dd"
  402. placeholder="选择日期">
  403. </el-date-picker>
  404. </el-form-item>
  405. <el-form-item label="巡检人" prop="fInspectorid">
  406. <el-select
  407. disabled
  408. v-model="twarehousecheckdetailList.fInspectorid"
  409. filterable
  410. placeholder="最新巡检人"
  411. >
  412. <el-option
  413. v-for="(item, index) in patrolInspection"
  414. :key="index.userId"
  415. :label="item.userName"
  416. :value="item.userId"
  417. ></el-option>
  418. </el-select>
  419. </el-form-item>
  420. <el-form-item label="备注" prop="fRemark">
  421. <el-input style="width: 200px;" v-model="twarehousecheckdetailList.fRemark" type="textarea"
  422. placeholder="请输入内容" autosize/>
  423. </el-form-item>
  424. </el-form>
  425. <div style="margin-top: 20px;border: 1px solid #cccccc;padding: 5px;border-radius: 10px">
  426. <el-upload
  427. :headers="headers"
  428. :action="uploadImgUrl"
  429. :on-success="onSuccess"
  430. list-type="picture-card"
  431. :file-list="fileList"
  432. accept=".jpeg,.jpg,.png,.svg,.webp"
  433. :limit="100"
  434. :on-preview="handlePictureCardPreview"
  435. :on-remove="handleRemove">
  436. <i class="el-icon-plus"></i>
  437. </el-upload>
  438. <el-dialog :visible.sync="dVisible" append-to-body>
  439. <img width="100%" :src="dialogImageUrl" alt="">
  440. </el-dialog>
  441. </div>
  442. <span slot="footer" class="dialog-footer">
  443. <el-button @click="closePicture">取 消</el-button>
  444. <el-button type="primary" @click="preservationtwo">保 存</el-button>
  445. </span>
  446. </el-dialog>
  447. </div>
  448. </template>
  449. <script>
  450. import {
  451. listCorps,
  452. deleteMasterTable,
  453. delLog,
  454. information,
  455. secondDelete,
  456. newlyAdded,
  457. savePicture,
  458. selectUserByRole,
  459. addOrModifyPictureList,
  460. currentLogin
  461. } from '@/api/warehouseCheck/index'
  462. import {listWarehousesss} from "@/api/basicdata/warehouse";
  463. import {getToken} from "@/utils/auth";
  464. export default {
  465. name: "Log",
  466. components: {},
  467. data() {
  468. return {
  469. tableHeight: '600',
  470. headers: {
  471. Authorization: "Bearer " + getToken(),
  472. },
  473. patrolInspection: [],
  474. uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
  475. warehouseOptions: [],
  476. fPlanneddate: [],
  477. fileList: [],
  478. dialogImageUrl: '',
  479. dVisible: false,
  480. // 遮罩层
  481. loading: true,
  482. // 选中数组
  483. ids: [],
  484. // 非单个禁用
  485. single: true,
  486. // 非多个禁用
  487. multiple: true,
  488. // 显示搜索条件
  489. showSearch: true,
  490. pictureEist: [],
  491. // 总条数
  492. total: 0,
  493. // 入出库状态表格数据
  494. logList: [],
  495. // 弹出层标题
  496. title: "",
  497. // 是否显示弹出层
  498. open: false,
  499. opentwo: false,
  500. // 查询参数
  501. queryParams: {
  502. pageNum: 1,
  503. pageSize: 10,
  504. },
  505. // 表单参数
  506. form: {},
  507. formList: [],
  508. // 表单校验
  509. rules: {},
  510. twarehousecheckdetailList: {},
  511. picturefId: '',
  512. pickerOptions: {
  513. shortcuts: [{
  514. text: '最近一周',
  515. onClick(picker) {
  516. const end = new Date();
  517. const start = new Date();
  518. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  519. picker.$emit('pick', [start, end]);
  520. }
  521. }, {
  522. text: '最近一个月',
  523. onClick(picker) {
  524. const end = new Date();
  525. const start = new Date();
  526. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  527. picker.$emit('pick', [start, end]);
  528. }
  529. }, {
  530. text: '最近三个月',
  531. onClick(picker) {
  532. const end = new Date();
  533. const start = new Date();
  534. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  535. picker.$emit('pick', [start, end]);
  536. }
  537. }]
  538. },
  539. };
  540. },
  541. created() {
  542. let date = new Date();
  543. let lYear = parseInt(date.getFullYear())
  544. let lMonth = parseInt(date.getMonth())
  545. if (lMonth == 0) {
  546. lMonth = 12
  547. lYear = lYear - 1
  548. }
  549. let nYear = parseInt(date.getFullYear())
  550. let nMonth = parseInt(date.getMonth() + 2)
  551. if (nMonth > 12) {
  552. nMonth = nMonth - 12
  553. nYear = nYear + 1
  554. }
  555. let day30 = [4, 6, 9, 11]
  556. let day31 = [1, 3, 5, 7, 8, 10, 12]
  557. let nDay = null
  558. if (day31.indexOf(nMonth) > -1) {
  559. nDay = 31
  560. } else if (day30.indexOf(nMonth) > -1) {
  561. nDay = 30
  562. } else if ((nYear % 4 == 0) && (nYear % 100 != 0 || nYear % 400 == 0)) {
  563. nDay = 29
  564. } else {
  565. nDay = 28
  566. }
  567. this.fPlanneddate = [lYear + '-' + lMonth + '-' + '01 00:00:00', nYear + '-' + nMonth + '-' + nDay + '23:59:59']
  568. currentLogin().then(res => {
  569. console.log(res)
  570. })
  571. selectUserByRole().then(res => {
  572. this.patrolInspection = res.rows
  573. console.log(res)
  574. })
  575. listWarehousesss({fStatus: 0, delFlag: 0}).then((response) => {
  576. this.warehouseOptions = response.rows;
  577. });
  578. this.getList();
  579. },
  580. mounted() {
  581. this.$nextTick(() => {
  582. // 监听浏览器高度变化,改变表格高度
  583. window.onresize = () => {
  584. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  585. }
  586. })
  587. },
  588. methods: {
  589. // 获取当前月的第一天和最后一天
  590. getMonth() {
  591. let date = new Date();
  592. let year = parseInt(date.getFullYear())
  593. let month = parseInt(date.getMonth() + 1)
  594. let currentMonth = date.getMonth()
  595. let nextMonth = ++currentMonth
  596. let nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1) // 下个月的第一天
  597. let oneDay = 1000 * 60 * 60 * 24
  598. let lastTime = new Date(nextMonthFirstDay - oneDay) // 下个月的第一天减去一天,就是上个月的最后一天
  599. let day = lastTime.getDate()
  600. if (day < 10) {
  601. day = '0' + day
  602. }
  603. this.queryParams.timeInterval = [year + '-' + month + '-' + '01 00:00:00', year + '-' + month + '-' + day + ' 23:59:59']
  604. },
  605. onSuccess(response, file, fileList) {
  606. console.log(fileList)
  607. this.pictureEist = fileList
  608. },
  609. handlePictureCardPreview(file) {
  610. this.dialogImageUrl = file.url;
  611. this.dVisible = true;
  612. },
  613. //移除图片
  614. handleRemove(file, fileList) {
  615. console.log(fileList);
  616. this.pictureEist = fileList
  617. },
  618. //录入新行
  619. inputDetails() {
  620. if (this.form.tWarehouseCheckItemsList === null) this.form.tWarehouseCheckItemsList = []
  621. this.form.tWarehouseCheckItemsList.push({
  622. fWarehousename: '',
  623. fWarehouseFid: this.form.fWarehouseFid,
  624. fLatestinspectorid: '',
  625. fInspectorId: this.form.fInspectorId,
  626. fPlanneddate: '',
  627. fLatestinspectdate: '',
  628. fInspectionrecord: '',
  629. updateTime: '',
  630. createBy: '',
  631. createTime: '',
  632. updateBy: '',
  633. remark: '',
  634. })
  635. },
  636. //关闭新增图片弹窗
  637. closePicture() {
  638. this.opentwo = false
  639. this.fileList = []
  640. },
  641. //图片保存
  642. preservationtwo() {
  643. this.twarehousecheckdetailList.fPhotoUrl = []
  644. for (let item in this.pictureEist) {
  645. if (this.pictureEist[item].response) {
  646. this.twarehousecheckdetailList.fPhotoUrl.push({
  647. url: this.pictureEist[item].response.url
  648. })
  649. } else {
  650. this.twarehousecheckdetailList.fPhotoUrl.push({
  651. url: this.pictureEist[item].url
  652. })
  653. }
  654. }
  655. this.twarehousecheckdetailList.fPhotoUrl = JSON.stringify(this.twarehousecheckdetailList.fPhotoUrl)
  656. if (!this.twarehousecheckdetailList.fId) {
  657. addOrModifyPictureList(this.twarehousecheckdetailList, 'post').then(res => {
  658. console.log(res)
  659. })
  660. } else {
  661. addOrModifyPictureList(this.twarehousecheckdetailList, 'put').then(res => {
  662. console.log(res)
  663. })
  664. }
  665. },
  666. pictureList(scope) {
  667. let data = {
  668. fItemFid: scope.row.fId
  669. }
  670. savePicture(data).then(res => {
  671. let data = res.rows
  672. if (data.length === 0) {
  673. this.twarehousecheckdetailList = {
  674. fCheckFid: scope.row.fCheckFid,
  675. fItemFid: scope.row.fId,
  676. fWarehouseid: scope.row.fWarehouseFid, //仓库名称
  677. fCreateTime: '',
  678. fInspectorid: '',
  679. fRemark: '',
  680. fPhotoUrl: []
  681. }
  682. } else {
  683. this.twarehousecheckdetailList = res.rows[0]
  684. this.twarehousecheckdetailList.fWarehouseid = scope.row.fWarehouseFid
  685. this.fileList = []
  686. for (let item in JSON.parse(res.rows[0].fPhotoUrl)) {
  687. this.fileList.push(JSON.parse(res.rows[0].fPhotoUrl)[item])
  688. }
  689. this.pictureEist = this.fileList
  690. }
  691. })
  692. this.opentwo = true
  693. },
  694. //查看明细
  695. viewDetails(row) {
  696. information(row.fId).then(res => {
  697. this.open = true
  698. if (res.data.twarehousecheckitemsVOList === null) res.data.twarehousecheckitemsVOList = []
  699. this.form = res.data
  700. })
  701. },
  702. //明细删除第二弹窗
  703. singleItemDeletion(index, scope) {
  704. let this_ = this
  705. if (scope.row.fId) {
  706. secondDelete(scope.row.fId).then(res => {
  707. this_.$message({
  708. showClose: true,
  709. message: '删除成功',
  710. type: 'success'
  711. });
  712. this_.viewDetails(this_.form)
  713. })
  714. } else {
  715. this_.form.tWarehouseCheckItemsList.splice(index, 1);
  716. }
  717. },
  718. //拆分计划日期
  719. planDateMethod() {
  720. if (this.fPlanneddate) {
  721. this.$set(this.queryParams, 'fBegintime', this.fPlanneddate[0])
  722. this.$set(this.queryParams, 'fEndtime', this.fPlanneddate[1])
  723. }
  724. },
  725. /** 查询入出库状态列表 */
  726. getList() {
  727. listCorps(this.queryParams).then(res => {
  728. if (res.code === 200) {
  729. this.logList = res.rows
  730. this.loading = false
  731. this.total = res.total
  732. // 根据浏览器高度设置初始高度
  733. this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  734. // setInterval(() => {
  735. // this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 70
  736. // }, 300)
  737. }
  738. })
  739. },
  740. // 取消按钮
  741. cancel() {
  742. this.open = false;
  743. this.getList();
  744. this.reset();
  745. },
  746. // 表单重置
  747. reset() {
  748. this.form = {
  749. fId: null,
  750. fPid: null,
  751. fItmeid: null,
  752. fItmestatus: 0,
  753. fBillstatus: "0",
  754. createTime: null,
  755. createBy: null,
  756. updateBy: null,
  757. updateTime: null,
  758. remark: null
  759. };
  760. this.resetForm("form");
  761. },
  762. /** 搜索按钮操作 */
  763. handleQuery() {
  764. this.queryParams.pageNum = 1;
  765. this.getList();
  766. },
  767. /** 重置按钮操作 */
  768. resetQuery() {
  769. this.queryParams = {
  770. pageNum: 1,
  771. pageSize: 10,
  772. }
  773. this.fPlanneddate = []
  774. this.handleQuery();
  775. },
  776. // 多选框选中数据
  777. handleSelectionChange(selection) {
  778. this.ids = selection.map(item => item.fId)
  779. this.single = selection.length !== 1
  780. this.multiple = !selection.length
  781. },
  782. /** 新增按钮操作 */
  783. handleAdd() {
  784. this.reset();
  785. this.open = true;
  786. this.form.tWarehouseCheckItemsList = []
  787. this.title = "添加巡检详情";
  788. },
  789. /** 修改按钮操作 */
  790. handleUpdate(row) {
  791. this.reset();
  792. const fId = row.fId || this.ids
  793. },
  794. /** 提交按钮 */
  795. submitForm() {
  796. this.$refs["form"].validate(valid => {
  797. if (valid) {
  798. newlyAdded(this.form).then(response => {
  799. this.msgSuccess("新增成功");
  800. this.viewDetails({fId: response.data})
  801. // this.open = false;
  802. // this.getList();
  803. });
  804. }
  805. });
  806. },
  807. /** 删除按钮操作 */
  808. handleDelete(row,index) {
  809. const fIds = row.fId || this.ids;
  810. this.$confirm('是否确认删除序号"' + Number(index+1) + '"的数据?', "警告", {
  811. confirmButtonText: "确定",
  812. cancelButtonText: "取消",
  813. type: "warning"
  814. }).then(function () {
  815. return deleteMasterTable(fIds);
  816. }).then(() => {
  817. this.getList();
  818. this.msgSuccess("删除成功");
  819. })
  820. },
  821. /** 导出按钮操作 */
  822. handleExport() {
  823. const queryParams = this.queryParams;
  824. this.$confirm('是否确认导出所有入出库状态数据项?', "警告", {
  825. confirmButtonText: "确定",
  826. cancelButtonText: "取消",
  827. type: "warning"
  828. }).then(function () {
  829. return exportLog(queryParams);
  830. }).then(response => {
  831. this.download(response.msg);
  832. })
  833. }
  834. }
  835. };
  836. </script>