order.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <hc-new-card>
  3. <template #header>
  4. <div class="w-40">
  5. <el-select v-model="searchForm.meterPeriodId" placeholder="选择计量期" filterable clearable block @change="searchKey1Click">
  6. <el-option v-for="item in key1Data" :key="item.id" :label="item.periodName" :value="item.id" />
  7. </el-select>
  8. </div>
  9. </template>
  10. <template #extra>
  11. <el-button hc-btn type="primary" @click="addModalClick">
  12. <HcIcon name="add" />
  13. <span>新增</span>
  14. </el-button>
  15. <el-button hc-btn type="primary" @click="reportClick">
  16. <HcIcon name="send-plane-2" />
  17. <span>上报</span>
  18. </el-button>
  19. </template>
  20. <div class="relative h-full flex">
  21. <div class="flex-1">
  22. <hc-card-item>
  23. <hc-table
  24. is-current-row
  25. :column="tableColumn" :datas="tableData" :loading="tableLoading"
  26. is-new is-check :check-style="{ width: 29 }" :index-style="{ width: 60 }"
  27. @selection-change="tableCheckChange"
  28. @row-click="hanleRow"
  29. >
  30. <template #action="{ row }">
  31. <el-link type="success" @click="rowEditClick(row)">修改</el-link>
  32. <el-link type="danger" @click="delRowClick(row)">删除</el-link>
  33. </template>
  34. </hc-table>
  35. <template #action>
  36. <hc-pages :pages="searchForm" @change="pageChange" />
  37. </template>
  38. </hc-card-item>
  39. </div>
  40. <div class="ml-3 w-[600px]">
  41. <hc-card-item title="详情信息" scrollbar>
  42. <hc-info-table>
  43. <tr>
  44. <hc-info-table-td center is-title>合同材料:</hc-info-table-td>
  45. <hc-info-table-td width="120px">{{ infoData?.contractMaterialName }}</hc-info-table-td>
  46. <hc-info-table-td center is-title>材料到场编号:</hc-info-table-td>
  47. <hc-info-table-td width="120px">{{ infoData?.materialArriveNumber }}</hc-info-table-td>
  48. </tr>
  49. <tr>
  50. <hc-info-table-td center is-title>计量期:</hc-info-table-td>
  51. <hc-info-table-td width="120px">{{ infoData?.meterPeriodName }}</hc-info-table-td>
  52. <hc-info-table-td center is-title>业务日期:</hc-info-table-td>
  53. <hc-info-table-td width="120px">{{ infoData?.businessDate }}</hc-info-table-td>
  54. </tr>
  55. <tr>
  56. <hc-info-table-td center is-title>单价:</hc-info-table-td>
  57. <hc-info-table-td width="120px">{{ infoData?.price }}</hc-info-table-td>
  58. <hc-info-table-td center is-title>计量数量:</hc-info-table-td>
  59. <hc-info-table-td width="120px">{{ infoData?.meterAmount }}</hc-info-table-td>
  60. </tr>
  61. <tr>
  62. <hc-info-table-td center is-title>计量金额:</hc-info-table-td>
  63. <hc-info-table-td width="120px">{{ infoData?.meterMoney }}</hc-info-table-td>
  64. <hc-info-table-td center is-title>备料堆放地点:</hc-info-table-td>
  65. <hc-info-table-td width="120px">{{ infoData?.storagePlace }}</hc-info-table-td>
  66. </tr>
  67. <tr>
  68. <hc-info-table-td center is-title>存储情况:</hc-info-table-td>
  69. <hc-info-table-td width="120px">-</hc-info-table-td>
  70. <hc-info-table-td center is-title>材料来源:</hc-info-table-td>
  71. <hc-info-table-td width="120px">{{ infoData?.storageStatus }}</hc-info-table-td>
  72. </tr>
  73. <tr>
  74. <hc-info-table-td center is-title>材料是否符合要求:</hc-info-table-td>
  75. <hc-info-table-td width="120px">{{ infoData?.materialConformName }}</hc-info-table-td>
  76. <hc-info-table-td center is-title>存储方法是否符合要求:</hc-info-table-td>
  77. <hc-info-table-td width="120px">{{ infoData?.storageConformName }}</hc-info-table-td>
  78. </tr>
  79. <tr>
  80. <hc-info-table-td center is-title>合格证号:</hc-info-table-td>
  81. <hc-info-table-td width="auto" colspan="3">{{ infoData?.certificate }}</hc-info-table-td>
  82. </tr>
  83. <tr>
  84. <hc-info-table-td center is-title>备注:</hc-info-table-td>
  85. <hc-info-table-td width="auto" colspan="3">{{ infoData?.remark }}</hc-info-table-td>
  86. </tr>
  87. </hc-info-table>
  88. <div class="mt-5">附件列表</div>
  89. <div class="mt-3">
  90. <template v-if="infoData?.fileList?.length > 0">
  91. <el-check-tag v-for="item in infoData?.fileList" :key="item.id" checked class="mr-2">{{ item.fileName }}</el-check-tag>
  92. </template>
  93. <HcNoData v-else />
  94. </div>
  95. </hc-card-item>
  96. </div>
  97. </div>
  98. <!-- 新增/修改 -->
  99. <HcDataModal v-model="isDataModal" :info-data="infoData" :ids="editId" @close="finishData" />
  100. <!-- 上报弹窗 -->
  101. <hc-report-dialog v-model="isReport" />
  102. </hc-new-card>
  103. </template>
  104. <script setup>
  105. import { onActivated, onMounted, ref } from 'vue'
  106. import HcDataModal from './components/order/dataModal.vue'
  107. import mainApi from '~api/debit-pay/material/order.js'
  108. import periodApi from '~api/debit-pay/material/periods.js'
  109. import { getArrValue, getObjValue } from 'js-fast-way'
  110. import { useAppStore } from '~src/store'
  111. const useAppState = useAppStore()
  112. const contractId = ref(useAppState.getContractId)
  113. import { delMessageV2 } from '~com/message/index.js'
  114. defineOptions({
  115. name: 'DebitPayMaterialOrder',
  116. })
  117. //渲染完成
  118. onActivated(() => {
  119. getKey1Data()
  120. })
  121. onMounted(() => {
  122. getTableData()
  123. })
  124. //搜索表单
  125. const searchForm = ref({
  126. meterPeriodId: null, current: 1, size: 10, total: 0,
  127. })
  128. //计量期
  129. const key1Data = ref([])
  130. const getKey1Data = async ()=>{
  131. const { error, code, data } = await periodApi.allPeriod({
  132. contractId:contractId.value,
  133. type:1,
  134. })
  135. tableLoading.value = false
  136. if (!error && code === 200) {
  137. key1Data.value = getArrValue(data)
  138. if (key1Data.value.length > 0) {
  139. searchForm.value.meterPeriodId = key1Data.value[0].id
  140. }
  141. } else {
  142. key1Data.value = []
  143. }
  144. }
  145. const searchKey1Click = () => {
  146. getTableData()
  147. }
  148. //分页
  149. const pageChange = ({ current, size }) => {
  150. searchForm.value.current = current
  151. searchForm.value.size = size
  152. }
  153. //表格数据
  154. const tableLoading = ref(false)
  155. const tableColumn = ref([
  156. { key: 'contractMaterialName', name: '合同材料' },
  157. { key: 'materialArriveNumber', name: '材料到场编号' },
  158. { key: 'businessDate', name: '业务日期' },
  159. { key: 'meterMoney', name: '计量金额' },
  160. { key: 'approveStatusName', name: '审核状态' },
  161. { key: 'action', name: '操作', width: 94 },
  162. ])
  163. const tableData = ref([
  164. ])
  165. const getTableData = async () => {
  166. tableLoading.value = true
  167. console.log(searchForm.value, 'searchForm.value')
  168. const { error, code, data } = await mainApi.getPage({
  169. ...searchForm.value,
  170. contractId:contractId.value,
  171. // meterPeriodId:searchForm.value.key1,
  172. })
  173. tableLoading.value = false
  174. if (!error && code === 200) {
  175. tableData.value = getArrValue(data['records'])
  176. if (tableData.value.length > 0) {
  177. getDetail(tableData.value[0].id)
  178. }
  179. } else {
  180. tableData.value = []
  181. }
  182. }
  183. const hanleRow = ({ row })=>{
  184. getDetail(row.id)
  185. }
  186. //获取详情
  187. const infoData = ref({})
  188. const getDetail = async (id)=>{
  189. const { error, code, data } = await mainApi.detail({
  190. id,
  191. })
  192. if (!error && code === 200) {
  193. infoData.value = getObjValue(data)
  194. } else {
  195. infoData.value = {}
  196. }
  197. }
  198. //表格选择
  199. const tableCheckChange = () => {
  200. }
  201. //新增
  202. const isDataModal = ref(false)
  203. const addModalClick = () => {
  204. isDataModal.value = true
  205. editId.value = ''
  206. }
  207. const finishData = ()=>{
  208. isDataModal.value = false
  209. getTableData()
  210. }
  211. //修改
  212. const editId = ref('')
  213. const rowEditClick = (row) => {
  214. isDataModal.value = true
  215. editId.value = row.id
  216. }
  217. const delRowClick = async (row)=>{
  218. delMessageV2(async (action, instance, done) => {
  219. if (action === 'confirm') {
  220. instance.confirmButtonLoading = true
  221. removeProPay(row.id)
  222. instance.confirmButtonLoading = false
  223. done()
  224. } else {
  225. done()
  226. }
  227. })
  228. }
  229. const removeProPay = async (id) => {
  230. const { error, code } = await mainApi.remove({
  231. ids: id,
  232. })
  233. if (!error && code === 200) {
  234. window?.$message?.success('删除成功')
  235. getTableData()
  236. }
  237. }
  238. //是否上报
  239. const isReport = ref(false)
  240. const reportClick = () => {
  241. isReport.value = true
  242. }
  243. </script>
  244. <style scoped lang="scss">
  245. </style>