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.

590 lines
20 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 months ago
​
​
​
4 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
4 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 months ago
4 months ago
​
​
​
​
​
4 months ago
​
​
4 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 months ago
​
​
​
​
​
​
​
​
​
​
​
4 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 months ago
​
​
​
​
  1. <template>
  2. <div class="inspection-request-detail">
  3. <!-- 编辑模式 -->
  4. <div v-if="isEditMode" class="edit-form">
  5. <el-form label-position="top" class="detail-form">
  6. <el-row :gutter="20">
  7. <el-col :span="6">
  8. <el-form-item label="申请单号">
  9. <el-input v-model="detailData.requestNo" disabled />
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="6">
  13. <el-form-item label="申请日期">
  14. <el-input :value="formatDate(detailData.requestDate)" disabled />
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="6">
  18. <el-form-item label="供应商编码">
  19. <el-input v-model="detailData.supplierNo" disabled />
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="6">
  23. <el-form-item label="供应商名称">
  24. <el-input v-model="detailData.supplierName" disabled />
  25. </el-form-item>
  26. </el-col>
  27. </el-row>
  28. <el-row :gutter="20">
  29. <el-col :span="10">
  30. <el-form-item>
  31. <span slot="label" class="choose-label" @click="openAddressDialog">验货地址</span>
  32. <el-input v-model="editData.inspectAddress" readonly @click.native="openAddressDialog" placeholder="点击标签选择验货地址" />
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="4">
  36. <el-form-item label="城市简称">
  37. <el-input v-model="editData.inspectCityShort" readonly placeholder=" " />
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="5">
  41. <el-form-item label="联系人">
  42. <el-input v-model="editData.inspectContract" placeholder="请输入联系人" />
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="5">
  46. <el-form-item label="联系电话">
  47. <el-input v-model="editData.inspectPhone" placeholder="选择地址自动带出" />
  48. </el-form-item>
  49. </el-col>
  50. </el-row>
  51. <el-row :gutter="20">
  52. <el-col :span="4">
  53. <el-form-item label="申请录入人">
  54. <el-input v-model="detailData.createBy" disabled />
  55. </el-form-item>
  56. </el-col>
  57. <el-col :span="6">
  58. <el-form-item label="申请录入时间">
  59. <el-input v-model="detailData.createDate" disabled />
  60. </el-form-item>
  61. </el-col>
  62. <el-col :span="5">
  63. <el-form-item label="建议验货日期">
  64. <el-date-picker
  65. v-model="editData.needInspectDate"
  66. type="date"
  67. value-format="yyyy-MM-dd"
  68. placeholder="请选择建议验货日期"
  69. style="width: 100%"
  70. />
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="4">
  74. <el-form-item label="QC">
  75. <el-input v-model="detailData.qcOperator" disabled placeholder=" " />
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="5">
  79. <el-form-item label="QC联系方式">
  80. <el-input v-model="detailData.qcContact" disabled placeholder=" " />
  81. </el-form-item>
  82. </el-col>
  83. </el-row>
  84. <el-row :gutter="20">
  85. <el-col :span="6">
  86. <el-form-item label="排程人">
  87. <el-input v-model="detailData.scheduledBy" disabled placeholder=" " />
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="6">
  91. <el-form-item label="排程时间">
  92. <el-input v-model="detailData.scheduledDate" disabled placeholder=" " />
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="6">
  96. <el-form-item label="状态">
  97. <el-input v-model="detailData.status" disabled />
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="6">
  101. <el-form-item label="计划验货日期">
  102. <el-input v-model="detailData.planStartDate" disabled placeholder=" " />
  103. </el-form-item>
  104. </el-col>
  105. </el-row>
  106. <el-row :gutter="20">
  107. <el-col :span="24" style="text-align: right;">
  108. <el-button type="primary" @click="handleSave" :loading="saveLoading">保存</el-button>
  109. <el-button @click="handleCancelEdit">取消</el-button>
  110. </el-col>
  111. </el-row>
  112. </el-form>
  113. </div>
  114. <!-- 查看模式 -->
  115. <div v-else>
  116. <el-form label-position="top" class="detail-form">
  117. <el-row :gutter="20">
  118. <el-col :span="6">
  119. <el-form-item label="申请单号">
  120. <el-input v-model="detailData.requestNo" disabled />
  121. </el-form-item>
  122. </el-col>
  123. <el-col :span="6">
  124. <el-form-item label="申请日期">
  125. <el-input :value="formatDate(detailData.requestDate)" disabled />
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="6">
  129. <el-form-item label="供应商编码">
  130. <el-input v-model="detailData.supplierNo" disabled />
  131. </el-form-item>
  132. </el-col>
  133. <el-col :span="6">
  134. <el-form-item label="供应商名称">
  135. <el-input v-model="detailData.supplierName" disabled />
  136. </el-form-item>
  137. </el-col>
  138. </el-row>
  139. <el-row :gutter="20">
  140. <el-col :span="10">
  141. <el-form-item label="验货地址">
  142. <el-input v-model="detailData.inspectAddress" disabled placeholder=" " />
  143. </el-form-item>
  144. </el-col>
  145. <el-col :span="4">
  146. <el-form-item label="城市简称">
  147. <el-input v-model="detailData.inspectCityShort" disabled placeholder=" " />
  148. </el-form-item>
  149. </el-col>
  150. <el-col :span="5">
  151. <el-form-item label="联系人">
  152. <el-input v-model="detailData.inspectContract" disabled placeholder=" " />
  153. </el-form-item>
  154. </el-col>
  155. <el-col :span="5">
  156. <el-form-item label="联系电话">
  157. <el-input v-model="detailData.inspectPhone" disabled placeholder=" " />
  158. </el-form-item>
  159. </el-col>
  160. </el-row>
  161. <el-row :gutter="20">
  162. <el-col :span="4">
  163. <el-form-item label="申请录入人">
  164. <el-input v-model="detailData.createBy" disabled />
  165. </el-form-item>
  166. </el-col>
  167. <el-col :span="6">
  168. <el-form-item label="申请录入时间">
  169. <el-input v-model="detailData.createDate" disabled />
  170. </el-form-item>
  171. </el-col>
  172. <el-col :span="5">
  173. <el-form-item label="建议验货日期">
  174. <el-input :value="formatDate(detailData.needInspectDate)" disabled />
  175. </el-form-item>
  176. </el-col>
  177. <el-col :span="4">
  178. <el-form-item label="QC">
  179. <el-input v-model="detailData.qcOperator" disabled placeholder=" " />
  180. </el-form-item>
  181. </el-col>
  182. <el-col :span="5">
  183. <el-form-item label="QC联系方式">
  184. <el-input v-model="detailData.qcContact" disabled placeholder=" " />
  185. </el-form-item>
  186. </el-col>
  187. </el-row>
  188. <el-row :gutter="20">
  189. <el-col :span="6">
  190. <el-form-item label="排程人">
  191. <el-input v-model="detailData.scheduledBy" disabled placeholder=" " />
  192. </el-form-item>
  193. </el-col>
  194. <el-col :span="6">
  195. <el-form-item label="排程时间">
  196. <el-input v-model="detailData.scheduledDate" disabled placeholder=" " />
  197. </el-form-item>
  198. </el-col>
  199. <el-col :span="6">
  200. <el-form-item label="状态">
  201. <el-input v-model="detailData.status" disabled />
  202. </el-form-item>
  203. </el-col>
  204. <el-col :span="6">
  205. <el-form-item label="计划验货日期">
  206. <el-input v-model="detailData.planStartDate" disabled placeholder=" " />
  207. </el-form-item>
  208. </el-col>
  209. </el-row>
  210. <!-- Planner与备注展示:仅调用页开启 showPlannerRemark 时显示(如验货申请列表基本信息页签) - rqrq -->
  211. <el-row v-if="showPlannerRemark" :gutter="20">
  212. <el-col :span="6">
  213. <el-form-item label="Planner">
  214. <el-input v-model="detailData.planner" disabled placeholder=" " />
  215. </el-form-item>
  216. </el-col>
  217. <el-col :span="18">
  218. <el-form-item label="备注">
  219. <el-input v-model="detailData.remark" disabled placeholder=" " />
  220. </el-form-item>
  221. </el-col>
  222. </el-row>
  223. </el-form>
  224. </div>
  225. <el-dialog
  226. title="选择验货地址"
  227. :visible.sync="addressDialogVisible"
  228. width="980px"
  229. append-to-body
  230. :close-on-click-modal="false">
  231. <el-form :inline="true" label-width="80px" size="mini" label-position="top">
  232. <el-form-item label="供应商编码">
  233. <el-input :value="detailData.supplierNo || ''" readonly style="width: 140px" />
  234. </el-form-item>
  235. <el-form-item label="供应商名称">
  236. <el-input :value="detailData.supplierName || ''" readonly style="width: 220px" />
  237. </el-form-item>
  238. <!-- <el-form-item label="地址关键词">-->
  239. <!-- <el-input-->
  240. <!-- v-model="addressSearch.keyword"-->
  241. <!-- clearable-->
  242. <!-- style="width: 260px"-->
  243. <!-- @keyup.enter.native="searchAddressList" />-->
  244. <!-- </el-form-item>-->
  245. <!-- <el-form-item label=" ">-->
  246. <!-- <el-button type="primary" @click="searchAddressList">查询</el-button>-->
  247. <!-- <el-button @click="resetAddressSearch">重置</el-button>-->
  248. <!-- </el-form-item>-->
  249. </el-form>
  250. <el-table
  251. ref="addressTable"
  252. :data="addressList"
  253. border
  254. height="360px"
  255. v-loading="addressLoading"
  256. highlight-current-row
  257. @current-change="onAddressCurrentChange"
  258. @row-dblclick="onAddressRowDblClick">
  259. <el-table-column prop="addressId" label="地址ID" header-align="center" align="left" min-width="120" show-overflow-tooltip />
  260. <el-table-column prop="companyName" label="公司名称" header-align="center" align="left" min-width="180" show-overflow-tooltip />
  261. <el-table-column prop="cityShort" label="城市简称" header-align="center" align="left" min-width="120" show-overflow-tooltip />
  262. <el-table-column prop="address" label="验货地址" header-align="center" align="left" min-width="280" show-overflow-tooltip />
  263. <el-table-column prop="contact" label="联系人" header-align="center" align="left" min-width="120" show-overflow-tooltip />
  264. <el-table-column prop="phoneNo" label="联系电话" header-align="center" align="left" min-width="140" show-overflow-tooltip />
  265. <el-table-column prop="email" label="邮箱" header-align="center" align="left" min-width="180" show-overflow-tooltip />
  266. </el-table>
  267. <el-pagination
  268. style="margin-top: 10px; text-align: right"
  269. @size-change="onAddressPageSizeChange"
  270. @current-change="onAddressPageCurrentChange"
  271. :current-page="addressPageIndex"
  272. :page-sizes="[20, 50, 100, 200]"
  273. :page-size="addressPageSize"
  274. :total="addressTotal"
  275. layout="total, sizes, prev, pager, next, jumper">
  276. </el-pagination>
  277. <div slot="footer" class="dialog-footer">
  278. <el-button type="primary" @click="confirmAddressSelect">确认</el-button>
  279. <el-button @click="addressDialogVisible = false">取消</el-button>
  280. </div>
  281. </el-dialog>
  282. </div>
  283. </template>
  284. <script>
  285. import { updateInspectionRequest } from '@/api/inspection/inspectionRequestHeader.js'
  286. import { searchSrmSupplierAddressList } from '@/api/srm/srmSupplier.js'
  287. export default {
  288. name: 'InspectionRequestDetail',
  289. props: {
  290. detailData: {
  291. type: Object,
  292. default: () => ({})
  293. },
  294. // 是否在查看模式展示 Planner 与备注(默认不展示,保持其他引用页不变) - rqrq
  295. showPlannerRemark: {
  296. type: Boolean,
  297. default: false
  298. }
  299. },
  300. data() {
  301. return {
  302. isEditMode: false,
  303. saveLoading: false,
  304. editData: {},
  305. originalData: {},
  306. addressDialogVisible: false,
  307. addressLoading: false,
  308. addressList: [],
  309. addressCurrentRow: null,
  310. addressPageIndex: 1,
  311. addressPageSize: 20,
  312. addressTotal: 0,
  313. addressSearch: {
  314. keyword: ''
  315. }
  316. }
  317. },
  318. methods: {
  319. formatDate(dateStr) {
  320. if (!dateStr) return ''
  321. return dateStr.length > 10 ? dateStr.substring(0, 10) : dateStr
  322. },
  323. handleEdit() {
  324. this.editData = {
  325. requestNo: this.detailData.requestNo,
  326. needInspectDate: this.detailData.needInspectDate,
  327. inspectAddressId: this.detailData.inspectAddressId || this.detailData.inspectAddress || '',
  328. inspectAddress: this.detailData.inspectAddress,
  329. inspectCityShort: this.detailData.inspectCityShort || '',
  330. inspectContract: this.detailData.inspectContract,
  331. inspectPhone: this.detailData.inspectPhone || ''
  332. }
  333. this.originalData = JSON.parse(JSON.stringify(this.editData))
  334. this.isEditMode = true
  335. },
  336. handleCancelEdit() {
  337. this.editData = JSON.parse(JSON.stringify(this.originalData))
  338. this.addressDialogVisible = false
  339. this.isEditMode = false
  340. },
  341. openAddressDialog () {
  342. if (!this.detailData.supplierNo) {
  343. this.$message.warning('当前申请单缺少供应商编码')
  344. return
  345. }
  346. this.addressDialogVisible = true
  347. this.addressPageIndex = 1
  348. this.addressSearch.keyword = ''
  349. this.addressCurrentRow = null
  350. this.loadAddressList()
  351. },
  352. normalizeAddressRows (list) {
  353. return (list || []).map(item => ({
  354. ...item,
  355. supplierId: item.supplierId || item.supplier_id || '',
  356. addressId: item.addressId || item.address_id || '',
  357. cityShort: item.cityShort || item.city_short || '',
  358. companyName: item.companyName || item.company_name || '',
  359. contact: item.contact || '',
  360. phoneNo: item.phoneNo || item.phone_no || '',
  361. email: item.email || '',
  362. address: item.address || '',
  363. addressType: item.addressType || item.address_type || ''
  364. }))
  365. },
  366. loadAddressList () {
  367. const supplierNo = this.detailData.supplierNo || ''
  368. if (!supplierNo) {
  369. this.addressList = []
  370. this.addressTotal = 0
  371. return
  372. }
  373. const params = {
  374. site: this.$store.state.user.site,
  375. supplierId: supplierNo,
  376. addressType: '验货地址',
  377. page: this.addressPageIndex,
  378. limit: this.addressPageSize
  379. }
  380. if (this.addressSearch.keyword) {
  381. params.address = this.addressSearch.keyword
  382. }
  383. this.addressLoading = true
  384. searchSrmSupplierAddressList(params).then(({ data }) => {
  385. if (data && data.code === 0) {
  386. const pageData = data.page || data.data || {}
  387. const rawList = Array.isArray(pageData.list) ? pageData.list : (Array.isArray(pageData) ? pageData : [])
  388. this.addressList = this.normalizeAddressRows(rawList)
  389. this.addressTotal = pageData.totalCount || this.addressList.length
  390. this.addressPageIndex = pageData.currPage || this.addressPageIndex
  391. this.addressPageSize = pageData.pageSize || this.addressPageSize
  392. this.$nextTick(() => {
  393. if (this.addressList.length > 0) {
  394. this.addressCurrentRow = this.addressList[0]
  395. if (this.$refs.addressTable) {
  396. this.$refs.addressTable.setCurrentRow(this.addressCurrentRow)
  397. }
  398. } else {
  399. this.addressCurrentRow = null
  400. if (this.$refs.addressTable) {
  401. this.$refs.addressTable.setCurrentRow()
  402. }
  403. }
  404. })
  405. } else {
  406. this.addressList = []
  407. this.addressCurrentRow = null
  408. this.addressTotal = 0
  409. }
  410. }).catch((error) => {
  411. this.addressList = []
  412. this.addressCurrentRow = null
  413. this.addressTotal = 0
  414. console.error('查询验货地址失败:', error)
  415. this.$message.error('查询验货地址失败')
  416. }).finally(() => {
  417. this.addressLoading = false
  418. })
  419. },
  420. searchAddressList () {
  421. this.addressPageIndex = 1
  422. this.loadAddressList()
  423. },
  424. resetAddressSearch () {
  425. this.addressSearch.keyword = ''
  426. this.addressPageIndex = 1
  427. this.loadAddressList()
  428. },
  429. onAddressPageSizeChange (val) {
  430. this.addressPageSize = val
  431. this.addressPageIndex = 1
  432. this.loadAddressList()
  433. },
  434. onAddressPageCurrentChange (val) {
  435. this.addressPageIndex = val
  436. this.loadAddressList()
  437. },
  438. onAddressCurrentChange (row) {
  439. this.addressCurrentRow = row || null
  440. },
  441. onAddressRowDblClick (row) {
  442. this.selectAddressRow(row)
  443. },
  444. confirmAddressSelect () {
  445. this.selectAddressRow(this.addressCurrentRow)
  446. },
  447. selectAddressRow (row) {
  448. if (!row || !row.addressId) {
  449. this.$message.warning('请选择验货地址')
  450. return
  451. }
  452. this.editData.inspectAddressId = row.addressId || ''
  453. this.editData.inspectAddress = row.address || ''
  454. this.editData.inspectCityShort = row.cityShort || ''
  455. this.editData.inspectContract = row.contact || this.editData.inspectContract || ''
  456. this.editData.inspectPhone = row.phoneNo || ''
  457. this.addressDialogVisible = false
  458. },
  459. async handleSave() {
  460. if (!this.editData.needInspectDate) {
  461. this.$message.warning('请选择建议验货日期')
  462. return
  463. }
  464. const isChanged =
  465. JSON.stringify(this.editData) !== JSON.stringify(this.originalData)
  466. this.saveLoading = true
  467. try {
  468. await updateInspectionRequest({
  469. ...this.editData,
  470. inspectAddress: this.editData.inspectAddressId || this.editData.inspectAddress,
  471. inspectAddressId: this.editData.inspectAddressId || '',
  472. isChanged: isChanged ? 'Y' : 'N'
  473. })
  474. this.$message.success('修改成功')
  475. this.$emit('update-success')
  476. this.isEditMode = false
  477. } catch (e) {
  478. this.$message.error(e.message || '修改失败')
  479. } finally {
  480. this.saveLoading = false
  481. }
  482. }
  483. }
  484. }
  485. </script>
  486. <style scoped lang="scss">
  487. .inspection-request-detail {
  488. width: 100%;
  489. }
  490. .detail-form {
  491. width: 100%;
  492. }
  493. // 表单项底部间距 - 与产品页面保持一致
  494. .el-form-item {
  495. margin-bottom: 20px;
  496. }
  497. // 标签样式:字体14px,与产品页面一致
  498. /deep/ .el-form-item__label {
  499. font-size: 14px;
  500. color: #606266;
  501. line-height: 1.5;
  502. padding-bottom: 6px;
  503. font-weight: normal;
  504. }
  505. // 输入框样式 - 与产品页面完全一致(默认尺寸)
  506. /deep/ .el-input__inner {
  507. height: 32px;
  508. line-height: 32px;
  509. font-size: 13px;
  510. border-radius: 4px;
  511. border: 1px solid #dcdfe6;
  512. background-color: #fff;
  513. }
  514. // disabled 状态样式 - 文字加深便于阅读(原浅灰 #c0c4cc 太浅) - rqrq
  515. /deep/ .el-input.is-disabled .el-input__inner {
  516. background-color: #f5f7fa;
  517. border-color: #e4e7ed;
  518. color: #303133;
  519. cursor: not-allowed;
  520. }
  521. /deep/ .el-input__inner:focus {
  522. border-color: #409eff;
  523. outline: none;
  524. }
  525. // 日期选择器样式
  526. /deep/ .el-date-editor.el-input {
  527. width: 100%;
  528. }
  529. /deep/ .el-date-editor .el-input__inner {
  530. padding-left: 35px;
  531. }
  532. // 按钮样式 - 使用 Element UI 默认样式,不覆盖颜色
  533. /deep/ .el-button {
  534. height: 32px;
  535. line-height: 32px;
  536. padding: 0 15px;
  537. font-size: 13px;
  538. border-radius: 4px;
  539. }
  540. .choose-label {
  541. cursor: pointer;
  542. color: #409eff;
  543. }
  544. </style>