index.vue 27 KB

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