order.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <hc-new-card>
  3. <template #header>
  4. <hc-new-switch :datas="tabTab" :keys="tabKey" :round="false" size="default" @change="tabChange" />
  5. <div v-if="tabKey === 'key2'" class="ml-3 w-40">
  6. <el-select v-model="searchForm.key1" filterable block placeholder="选择工区">
  7. <el-option label="工区1" value="1" />
  8. <el-option label="工区2" value="2" />
  9. <el-option label="工区3" value="3" />
  10. </el-select>
  11. </div>
  12. </template>
  13. <template #extra>
  14. <el-button hc-btn type="primary" @click="addModalClick">
  15. <hc-icon name="add" />
  16. <span>新增</span>
  17. </el-button>
  18. <el-button hc-btn type="warning" @click="reportClick">
  19. <hc-icon name="send-plane-2" />
  20. <span>上报</span>
  21. </el-button>
  22. </template>
  23. <div class="relative h-full flex">
  24. <div :id="`hc_table_card_${uuid}`" class="flex-1">
  25. <hc-card-item>
  26. <hc-table ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" is-current-row is-new :index-style="{ width: 60 }" @row-click="tableRowClick">
  27. <template #action="{ row }">
  28. <template v-if="row.approveStatus === 2">
  29. <el-link v-if="row.commandStatus === 0" type="success">下达</el-link>
  30. <el-link v-if="row.commandStatus === 0" type="danger">删除</el-link>
  31. <el-link v-if="row.commandStatus === 1 && row.citeStatus === 0" type="success">撤销下达</el-link>
  32. </template>
  33. <template v-if="row.approveStatus === 0">
  34. <el-link type="success" @click="rowEditClick(row)">修改</el-link>
  35. <el-link type="danger">删除</el-link>
  36. </template>
  37. <template v-if="row.approveStatus === 3">
  38. <el-link type="danger">删除</el-link>
  39. </template>
  40. </template>
  41. </hc-table>
  42. <template #action>
  43. <hc-pages :pages="searchForm" @change="pageChange" />
  44. </template>
  45. </hc-card-item>
  46. </div>
  47. <div :id="`hc_info_card_${uuid}`">
  48. <el-scrollbar>
  49. <hc-card-item title="详情信息">
  50. <hc-info-table>
  51. <tr>
  52. <hc-info-table-td center is-title>变更方案编号:</hc-info-table-td>
  53. <hc-info-table-td width="120px">{{ tableInfo.changeNumber ?? '-' }}</hc-info-table-td>
  54. <hc-info-table-td center is-title>变更方案名称:</hc-info-table-td>
  55. <hc-info-table-td width="120px">{{ tableInfo.changeName ?? '-' }}</hc-info-table-td>
  56. <hc-info-table-td center is-title>变更发起单位:</hc-info-table-td>
  57. <hc-info-table-td width="120px">{{ tableInfo.changeUnit ?? '-' }}</hc-info-table-td>
  58. </tr>
  59. <tr>
  60. <hc-info-table-td center is-title>业务日期:</hc-info-table-td>
  61. <hc-info-table-td width="160px">{{ tableInfo.businessDate ?? '-' }}</hc-info-table-td>
  62. <hc-info-table-td center is-title>变更类型:</hc-info-table-td>
  63. <hc-info-table-td width="120px">{{ tableInfo.changeTypeName ?? '-' }}</hc-info-table-td>
  64. <hc-info-table-td center is-title>延长工期:</hc-info-table-td>
  65. <hc-info-table-td width="120px">{{ tableInfo.lengthenDays ?? '-' }}</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">{{ tableInfo.changeMoney ?? '-' }}</hc-info-table-td>
  70. <hc-info-table-td center is-title>设计图完成时间:</hc-info-table-td>
  71. <hc-info-table-td width="120px">{{ tableInfo.designDate ?? '-' }}</hc-info-table-td>
  72. <hc-info-table-td center is-title>实际变更桩号:</hc-info-table-td>
  73. <hc-info-table-td width="120px">{{ tableInfo.realityChangeNumber ?? '-' }}</hc-info-table-td>
  74. </tr>
  75. <tr>
  76. <hc-info-table-td center is-title>变更归类:</hc-info-table-td>
  77. <hc-info-table-td width="120px">{{ tableInfo.changeClassifyName ?? '-' }}</hc-info-table-td>
  78. <hc-info-table-td center is-title>变更批复文号:</hc-info-table-td>
  79. <hc-info-table-td width="120px">{{ tableInfo.changeApprovalNumber ?? '-' }}</hc-info-table-td>
  80. <hc-info-table-td center is-title>变更批复时间:</hc-info-table-td>
  81. <hc-info-table-td width="120px">{{ tableInfo.changeApprovalDate ?? '-' }}</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="5">-</hc-info-table-td>
  86. </tr>
  87. <tr>
  88. <hc-info-table-td center is-title>变更原因:</hc-info-table-td>
  89. <hc-info-table-td width="auto" colspan="5">{{ tableInfo.changeCause ?? '-' }}</hc-info-table-td>
  90. </tr>
  91. </hc-info-table>
  92. </hc-card-item>
  93. <hc-card-item class="mt-3" title="变更申请部位">
  94. <hc-table :column="tableColumn1" :datas="tableInfo.nodeList" is-new :index-style="{ width: 60 }" is-current-row @row-click="tableNodeRowClick" />
  95. </hc-card-item>
  96. <hc-card-item v-if="tableChangeData.length > 0" class="mt-3" title="变更申请清单">
  97. <div class="hc-table-ref-box no-border">
  98. <el-table class="w-full" :data="tableChangeData" row-key="id" height="100%" highlight-current-row border>
  99. <el-table-column type="index" label="序号" />
  100. <el-table-column prop="formNumber" label="清单编号" />
  101. <el-table-column prop="formName" label="清单名称" />
  102. <el-table-column prop="currentPrice" label="单价" />
  103. <el-table-column label="数量" align="center">
  104. <el-table-column prop="contractTotal" label="变更前" />
  105. <el-table-column prop="currentChangeTotal" label="变更增减" />
  106. <el-table-column prop="changeTotal" label="变更后" />
  107. </el-table-column>
  108. <el-table-column label="金额" align="center">
  109. <el-table-column prop="contractMoney" label="变更前" />
  110. <el-table-column prop="currentChangeMoney" label="变更增减" />
  111. <el-table-column prop="changeMoney" label="变更后" />
  112. </el-table-column>
  113. </el-table>
  114. </div>
  115. </hc-card-item>
  116. <!-- 附件列表 -->
  117. <hc-card-item class="mt-3" title="附件列表">
  118. <hc-form-upload class="table-info-file" type="list" :src="tableInfo.fileList" :h-props="uploadFormProps" />
  119. </hc-card-item>
  120. </el-scrollbar>
  121. </div>
  122. </div>
  123. <!-- 上报弹窗 -->
  124. <hc-report-dialog v-model="isReport" />
  125. <!-- 新增修改的弹窗 -->
  126. <addModal v-model="isAddShow" />
  127. </hc-new-card>
  128. </template>
  129. <script setup>
  130. import { nextTick, onMounted, ref } from 'vue'
  131. import { useAppStore } from '~src/store'
  132. import { getArrValue, getObjValue, getRandom } from 'js-fast-way'
  133. import mainApi from '~api/alter/admin/order'
  134. import addModal from './components/order/addModal.vue'
  135. defineOptions({
  136. name: 'AlterAdminOrder',
  137. })
  138. const uuid = getRandom(4)
  139. const useAppState = useAppStore()
  140. const projectId = ref(useAppState.getProjectId || '')
  141. const contractId = ref(useAppState.getContractId || '')
  142. //渲染完成
  143. onMounted(() => {
  144. setSplitRef()
  145. getTableData()
  146. })
  147. //初始化设置拖动分割线
  148. const setSplitRef = () => {
  149. //配置参考: https://split.js.org/#/?direction=vertical&snapOffset=0
  150. nextTick(() => {
  151. window.$split(['#hc_table_card_' + uuid, '#hc_info_card_' + uuid], {
  152. sizes: [60, 40],
  153. snapOffset: 0,
  154. minSize: [100, 400],
  155. })
  156. })
  157. }
  158. //类型tab数据和相关处理
  159. const tabKey = ref('key1')
  160. const tabTab = ref([
  161. { key: 'key1', name: '普通变更' },
  162. { key: 'key2', name: '工区变更' },
  163. ])
  164. const tabChange = (item) => {
  165. tabKey.value = item?.key
  166. }
  167. //搜索表单
  168. const searchForm = ref({
  169. key1: null, current: 1, size: 10, total: 0,
  170. })
  171. //分页
  172. const pageChange = ({ current, size }) => {
  173. searchForm.value.current = current
  174. searchForm.value.size = size
  175. getTableData()
  176. }
  177. //表格数据
  178. const tableRef = ref(null)
  179. const tableColumn = ref([
  180. { key: 'changeNumber', name: '变更编号' },
  181. { key: 'changeName', name: '变更名称' },
  182. { key: 'changeMoney', name: '变更金额' },
  183. { key: 'changeTypeName', name: '变更类型' },
  184. { key: 'changeApprovalDate', name: '变更批复日期' },
  185. { key: 'approveStatusName', name: '审批状态' },
  186. { key: 'action', name: '操作', width: 94 },
  187. ])
  188. const tableData = ref([])
  189. //获取表格数据
  190. const tableLoading = ref(false)
  191. const getTableData = async () => {
  192. tableData.value = []
  193. tableLoading.value = true
  194. const { data } = await mainApi.getPage({
  195. ...searchForm.value,
  196. projectId: projectId.value,
  197. contractId: contractId.value,
  198. })
  199. tableData.value = getArrValue(data['records'])
  200. searchForm.value.total = data.total || 0
  201. tableLoading.value = false
  202. //默认选中第一行
  203. let info = {}
  204. if (tableData.value.length > 0) {
  205. info = tableData.value[0]
  206. }
  207. tableRef.value?.tableRef?.setCurrentRow(info)
  208. getTableDetail(info).then()
  209. }
  210. //表格行被点击
  211. const tableRowClick = ({ row }) => {
  212. getTableDetail(row)
  213. }
  214. //获取详情
  215. const tableInfo = ref({})
  216. const getTableDetail = async (row) => {
  217. const { data } = await mainApi.getDetail({ id: row.id })
  218. const info = getObjValue(data)
  219. info.nodeList = getArrValue(info.nodeList)
  220. tableInfo.value = info
  221. console.log(info)
  222. }
  223. const rowEditClick = () => {
  224. }
  225. //新增修改的弹窗
  226. const isAddShow = ref(false)
  227. const addModalClick = () => {
  228. isAddShow.value = true
  229. }
  230. //申请部位
  231. const tableColumn1 = ref([
  232. { key: 'nodeName', name: '工程名称' },
  233. { key: 'nodeUrl', name: '节点路径' },
  234. { key: 'contractPicture', name: '合同图号' },
  235. { key: 'changeMoney', name: '变更后金额(元)' },
  236. { key: 'isSupplementName', name: '是否增补' },
  237. ])
  238. //申请部位被点击
  239. const tableChangeData = ref([])
  240. const tableNodeRowClick = ({ row }) => {
  241. tableChangeData.value = getArrValue(row.formList)
  242. }
  243. //附件列表
  244. const uploadFormProps = {
  245. url: 'fileUrl',
  246. name: 'fileName',
  247. }
  248. //是否上报
  249. const isReport = ref(false)
  250. const reportClick = () => {
  251. isReport.value = true
  252. }
  253. </script>
  254. <style lang="scss">
  255. .table-info-file .item-upload-btn {
  256. display: none;
  257. }
  258. .hc-ui-form-upload-box.table-info-file .hc-ui-form-item-dashed.list .file-list-box {
  259. margin-top: 0;
  260. }
  261. .hc-ui-form-upload-box.table-info-file .hc-ui-form-item-dashed.list .file-list-box .item .close-icon {
  262. display: none;
  263. }
  264. </style>