| | |
| | | <template> |
| | | <FYTable @search="onSearch"> |
| | | <template #options> </template> |
| | | |
| | | <template #buttons> </template> |
| | | |
| | | <FYTable |
| | | :data="data" |
| | | :total-count="total" |
| | | @search="onSearch" |
| | | :extraHeight="tabsHeaderHeight" |
| | | :defaultPageSize="10" |
| | | > |
| | | <template #options> |
| | | <FYOptionLocation |
| | | :disabled="true" |
| | | :checkStrictly="false" |
| | | :initValue="false" |
| | | :allOption="false" |
| | | :level="3" |
| | | v-model:value="formSearch._locations" |
| | | ></FYOptionLocation> |
| | | </template> |
| | | <!-- <template #buttons> </template> --> |
| | | <template #table-column> |
| | | <el-table-column |
| | | fixed="left" |
| | |
| | | {{ $fm.formatYMD(row.ncCreateTime) }} |
| | | </template> |
| | | </el-table-column> --> |
| | | <el-table-column prop="ncUserId" label="匹配用户" width="110"> |
| | | <el-table-column prop="ncUserId" label="匹配用户"> |
| | | <template #default="{ row }"> |
| | | <el-text v-loading="row._loading">{{ |
| | | row._user ? row._user.realName : '未匹配' |
| | | }}</el-text> |
| | | <el-text |
| | | :loading="row._loading" |
| | | :type="row._user ? 'primary' : 'danger'" |
| | | >{{ row._user ? row._user.realname : '未匹配' }}</el-text |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="操作" width="160"> |
| | | <template #default="scope"> |
| | | <el-table-column fixed="right" label="操作" width="80"> |
| | | <template #default="{ row }"> |
| | | <el-button |
| | | :loading="scope.row.loading1" |
| | | :disabled="row._loading" |
| | | type="default" |
| | | size="small" |
| | | @click="itemEdit(scope)" |
| | | @click="itemEdit(row)" |
| | | >编辑</el-button |
| | | > |
| | | <el-button |
| | | :loading="scope.row.loading2" |
| | | :type="scope.row.extension1 != '0' ? 'danger' : 'primary'" |
| | | size="small" |
| | | @click="itemActive(scope)" |
| | | >{{ scope.row.extension1 != '0' ? '下线' : '上线' }}</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </FYTable> |
| | | <el-dialog v-model="dialog" destroy-on-close> |
| | | <CompInfoSearchFysp |
| | | v-model="selectedSVUser" |
| | | :area="area" |
| | | :defaultText="defaultText" |
| | | searchTextWidth="400px" |
| | | /> |
| | | <template #footer> |
| | | <el-button @click="dialog = false">取消</el-button> |
| | | <el-button type="primary" @click="submit" :disabled="!selectedSVUser" |
| | | >确定</el-button |
| | | > |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | <script setup> |
| | | import { ref } from 'vue'; |
| | | import { ref, inject, computed } from 'vue'; |
| | | import nightConstructionApi from '@/api/fysp/nightConstructionApi'; |
| | | import userApi from '@/api/fysp/userApi'; |
| | | import CompInfoSearchFysp from '@/views/fysp/config/components/CompInfoSearchFysp.vue'; |
| | | import { ElMessage } from 'element-plus'; |
| | | |
| | | const tabsHeaderHeight = inject('tabsHeaderHeight', 0); |
| | | |
| | | const formSearch = ref({ |
| | | _locations: { |
| | | pCode: '31', |
| | | pName: '上海市', |
| | | cCode: '3100', |
| | | cName: '上海市', |
| | | dCode: '310106', |
| | | dName: '静安区' |
| | | } |
| | | }); |
| | | // 夜间施工记录及总数 |
| | | const data = ref([]); |
| | | const total = ref(0); |
| | | |
| | | // 夜间施工记录匹配弹窗 |
| | | const dialog = ref(false); |
| | | const selectedSVUser = ref(null); |
| | | const selectedRow = ref(null); |
| | | const area = ref({ |
| | | provincecode: '31', |
| | | provincename: '上海市', |
| | | citycode: '3100', |
| | | cityname: '上海市', |
| | | districtcode: '310106', |
| | | districtname: '静安区', |
| | | scensetypeid: '1' |
| | | }); |
| | | const defaultText = computed(() => { |
| | | return selectedRow.value?.ncItemName || undefined; |
| | | }); |
| | | |
| | | function onSearch(page, callback) { |
| | | return nightConstructionApi |
| | |
| | | }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | res.data.forEach((d) => { |
| | | res.data._loading = true; |
| | | userApi.getUserById(d.ncUserId).then((res1) => { |
| | | res.data._user = res1; |
| | | }); |
| | | data.value = res.data; |
| | | data.value.forEach((d) => { |
| | | d._loading = true; |
| | | if (d.ncUserId) { |
| | | userApi |
| | | .getUserById(d.ncUserId) |
| | | .then((res1) => { |
| | | d._user = res1; |
| | | }) |
| | | .finally(() => { |
| | | d._loading = false; |
| | | }); |
| | | } else { |
| | | d._loading = false; |
| | | } |
| | | }); |
| | | callback({ |
| | | data: res.data, |
| | | total: res.head.totalCount |
| | | }); |
| | | total.value = res.head.totalCount; |
| | | callback(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function itemEdit(row) { |
| | | selectedRow.value = row; |
| | | selectedSVUser.value = row._user; |
| | | dialog.value = true; |
| | | } |
| | | |
| | | function submit() { |
| | | if (!selectedSVUser.value) { |
| | | return ElMessage.error('请选择用户'); |
| | | } |
| | | nightConstructionApi |
| | | .updateRecord({ |
| | | recordId: selectedRow.value.ncId, |
| | | userId: selectedSVUser.value.guid, |
| | | sceneId: selectedSVUser.value.dguid |
| | | }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | selectedRow.value.ncUserId = res.data.ncUserId; |
| | | selectedRow.value.ncSceneId = res.data.ncSceneId; |
| | | userApi |
| | | .getUserById(selectedRow.value.ncUserId) |
| | | .then((res1) => { |
| | | selectedRow.value._user = res1; |
| | | }) |
| | | .finally(() => { |
| | | selectedRow.value._loading = false; |
| | | }); |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | dialog.value = false; |
| | | selectedRow.value._user = selectedSVUser.value; |
| | | }); |
| | | } |
| | | </script> |