| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473 |
- <!-- 任务单列表 -->
- <template>
- <div class="order">
- <template v-if="
- !attachVisible &&
- !addOrUpdateVisible &&
- !detailVisible &&
- !arrivedVisible &&
- !confirmVisible &&
- !noticeChangeAttachVisible &&
- !amountMaskSettingVisible
- ">
- <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
- <el-form-item label="客户名称">
- <cus-component v-model="dataForm.customerId" :cus-id="dataForm.customerId"></cus-component>
- </el-form-item>
- <el-form-item label="合同编码">
- <el-input v-model="dataForm.contractNumber" placeholder="合同号" clearable></el-input>
- </el-form-item>
- <el-form-item label="任务号">
- <el-input v-model="dataForm.orderCode" placeholder="任务号" clearable></el-input>
- </el-form-item>
- <el-form-item label="状态" prop="orderState">
- <el-select v-model="dataForm.orderState" remote placeholder="请选择">
- <el-option v-for="item in optionsOrderState" :key="item.code" :label="item.value" :value="item.code">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="创建日期">
- <el-date-picker v-model="dataForm.createTime" value-format="yyyy-MM-dd" type="date">
- </el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button @click="queryData()">查询</el-button>
- <el-button v-if="isAuth('order:ctl:save')" @click="addOrUpdateHandle(0, false)"
- type="primary">创建任务单</el-button>
- <el-button v-if="isAuth('order:ctl:noteChangeConfig')" type="primary"
- @click="setNoticeChangeHandel()">任务单变更通知设置</el-button>
- <el-button v-if="isAuth('order:ctl:priceConfig')" type="primary"
- @click="setAmountMaskHandel()">任务单金额屏蔽设置</el-button>
- </el-form-item>
- </el-form>
- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
- style="width: 100%">
- <el-table-column label="序号" type="index" width="50" align="center">
- </el-table-column>
- <!-- <el-table-column
- prop="orderCode"
- header-align="center"
- align="center"
- min-width="180"
- :show-tooltip-when-overflow="true"
- label="任务单编码">
- </el-table-column> -->
- <el-table-column prop="projectName" header-align="center" align="center" min-width="180"
- :show-tooltip-when-overflow="true" label="项目名称">
- </el-table-column>
- <el-table-column prop="orderCode" header-align="center" align="center" min-width="140"
- :show-tooltip-when-overflow="true" label="任务号">
- </el-table-column>
- <el-table-column prop="contractNumber" header-align="center" align="center" min-width="120"
- :show-tooltip-when-overflow="true" label="合同号">
- </el-table-column>
- <el-table-column prop="notes" header-align="center" align="center" min-width="300" :show-overflow-tooltip="true"
- label="备注">
- </el-table-column>
- <el-table-column prop="salesmanName" header-align="center" align="center" min-width="100"
- :show-tooltip-when-overflow="true" label="业务员">
- </el-table-column>
- <el-table-column prop="customerName" header-align="center" align="center" min-width="180"
- :show-overflow-tooltip="true" label="客户名称">
- </el-table-column>
- <!-- <el-table-column prop="productName" header-align="center" align="center" min-width="160"
- :show-tooltip-when-overflow="true" label="物料名称">
- </el-table-column>
- <el-table-column prop="batchNumber" header-align="center" align="center" min-width="160"
- :show-tooltip-when-overflow="true" label="批次号">
- </el-table-column>
- <el-table-column prop="mapNumber" header-align="center" align="center" min-width="160"
- :show-tooltip-when-overflow="true" label="主图号">
- </el-table-column>
- <el-table-column prop="productSpec" header-align="center" align="center" min-width="160"
- :show-tooltip-when-overflow="true" label="物料规格">
- </el-table-column>
- <el-table-column prop="orderCnt" header-align="center" align="center" min-width="80"
- :show-tooltip-when-overflow="true" label="任务数量">
- </el-table-column>
- <el-table-column prop="cnt" header-align="center" align="center" min-width="80" label="单套数量">
- </el-table-column>
- <el-table-column prop="planCnt" header-align="center" align="center" min-width="80" label="生产数量">
- </el-table-column>
- <el-table-column prop="materialCnt" header-align="center" align="center" min-width="80" label="入库数量">
- </el-table-column>
- <el-table-column prop="createTime" header-align="center" align="center" min-width="160" label="下单时间">
- </el-table-column> -->
- <!-- <el-table-column
- fixed="right"
- prop="state"
- header-align="center"
- align="center"
- min-width="120"
- :formatter="formatState"
- label="评审状态"
- >
- </el-table-column> -->
- <!-- <el-table-column prop="approver" header-align="center" align="center" :min-width="140"
- :show-overflow-tooltip="true" label="当前审批人">
- </el-table-column>
- <el-table-column prop="completeDate" header-align="center" align="center" min-width="160" label="任务单完成时间">
- </el-table-column> -->
- <el-table-column fixed="right" header-align="center" align="center" label="附件">
- <template slot-scope="scope">
- <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0
- " type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
- </template>
- </el-table-column>
- <el-table-column fixed="right" prop="deliveryDate" :formatter="formatDate" header-align="center" align="center"
- min-width="160" label="合同交期">
- </el-table-column>
- <el-table-column fixed="right" prop="orderState" header-align="center" align="center" min-width="120"
- :formatter="formatOrderState" label="任务单状态">
- </el-table-column>
- <el-table-column fixed="right" header-align="center" align="center" width="180" label="操作">
- <template slot-scope="scope">
- <el-button v-if="isAuth('order:ctl:info')" type="text" size="small"
- @click="detailHandle(scope.row.orderId)">查看</el-button>
- <el-button v-if="
- isAuth('order:ctl:editor')
- " type="text" size="small" @click="addOrUpdateHandle(scope.row.orderId, false)">编辑</el-button>
- <!-- <el-button v-if="isAuth('order:clt:revoke') && Number(scope.row.state) === 1 && scope.row.creatorId === userId.toString()" type="text" size="small" @click="cancelOrder(scope.row)">撤回</el-button> -->
- <el-button v-if="
- isAuth('order:ctl:delete') &&
- Number(scope.row.orderState) === 1
- " type="text" size="small" @click="deleteOrder(scope.row)" style="color: red">删除</el-button>
- <!-- <el-button v-if="
- isAuth('order:ctl:determine') &&
- Number(scope.row.state) === 3 &&
- Number(scope.row.orderState) === 6
- " type="text" size="small" @click="techConfirm(scope.row)">技术确定</el-button> -->
- <el-button type="text" size="small" @click="exportHandle(scope.row.orderId)">导出</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
- :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
- layout="total, sizes, prev, pager, next, jumper">
- </el-pagination>
- </template>
- <!-- 弹窗, 新增 / 修改 -->
- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"
- @onChose="onChose"></add-or-update>
- <detail v-if="detailVisible" ref="detail" @onChose="onChose" />
- <dispatch-arrived v-if="arrivedVisible" ref="arrived" @refreshDataList="getDataList"
- @onChose="onChose"></dispatch-arrived>
- <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose" />
- <amount-mask-setting v-if="amountMaskSettingVisible" ref="amountMaskSetting" @onChose="onChose" />
- <!-- 文件预览 -->
- <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose" />
- </div>
- </template>
- <script>
- import Vue from 'vue'
- import AddOrUpdate from './order-add-or-update'
- import Detail from './order-detail'
- import {
- getOrderList,
- deliverOrder,
- revokeOrder,
- deleteOrder
- } from '@/api/sale'
- import CusComponent from '../common/cus-component'
- import DispatchArrived from './dispatch-arrived'
- import NoticeChangeSetting from './order-notice-change-setting'
- import AmountMaskSetting from './order-amount-mask-setting'
- import AttachDetail from '@/views/modules/common/attach-detail.vue'
- export default {
- name: 'order',
- components: {
- AttachDetail,
- DispatchArrived,
- CusComponent,
- AddOrUpdate,
- Detail,
- NoticeChangeSetting,
- AmountMaskSetting
- },
- created() {
- this.optionsState = this.$store.state.common.approveStates
- this.userId = this.$store.state.user.id
- this.queryData()
- },
- data() {
- return {
- addOrUpdateVisible: false,
- detailVisible: false,
- arrivedVisible: false,
- confirmVisible: false,
- noticeChangeAttachVisible: false,
- amountMaskSettingVisible: false,
- dataForm: {
- customerId: null,
- contractNumber: null,
- orderCode: null,
- orderState: null,
- createTime: null
- },
- dataList: [],
- pageIndex: 1,
- pageSize: 10,
- totalPage: 0,
- dataListLoading: false,
- dataListSelections: [],
- optionsState: [],
- userId: 0,
- optionsOrderState: [
- {
- code: '1',
- value: '等待排产'
- },
- {
- code: '2',
- value: '生产中'
- },
- {
- code: '3',
- value: '已完成'
- },
- {
- code: '4',
- value: '部分发货'
- },
- {
- code: '5',
- value: '全部发货'
- },
- {
- code: '6',
- value: '部分送达'
- },
- {
- code: '7',
- value: '全部送达'
- }
- ],
- optionsCustomer: [],
- attachVisible: false
- }
- },
- methods: {
- formatDate(row, column, cellValue) {
- if (!cellValue) return ''
- const date = new Date(cellValue)
- const year = date.getFullYear()
- const month = (date.getMonth() + 1).toString().padStart(2, '0') // 补零
- const day = date.getDate().toString().padStart(2, '0')
- return `${year}-${month}-${day}`
- },
- onChose() {
- this.addOrUpdateVisible = false
- this.detailVisible = false
- this.arrivedVisible = false
- this.confirmVisible = false
- this.noticeChangeAttachVisible = false
- this.amountMaskSettingVisible = false
- this.attachVisible = false
- },
- // 查询
- queryData() {
- this.pageIndex = 1
- this.getDataList()
- },
- // 获取数据列表
- getDataList() {
- this.dataListLoading = true
- let params = {
- current: this.pageIndex,
- size: this.pageSize,
- createTime: this.dataForm.createTime ? this.dataForm.createTime : null,
- contractNumber: this.dataForm.contractNumber
- ? this.dataForm.contractNumber
- : null,
- customerId: this.dataForm.customerId ? this.dataForm.customerId : null,
- orderState: this.dataForm.orderState ? this.dataForm.orderState : null,
- orderCode: this.dataForm.orderCode ? this.dataForm.orderCode : null
- }
- getOrderList(params).then(({ data }) => {
- if (data && data.code === '200') {
- this.dataList = data.data.records
- this.totalPage = Number(data.data.total)
- } else {
- this.dataList = []
- this.totalPage = 0
- }
- this.dataListLoading = false
- })
- },
- // 每页数
- sizeChangeHandle(val) {
- this.pageSize = val
- this.pageIndex = 1
- this.getDataList()
- },
- // 当前页
- currentChangeHandle(val) {
- this.pageIndex = val
- this.getDataList()
- },
- // 多选
- selectionChangeHandle(val) {
- this.dataListSelections = val
- },
- // 新增 / 修改
- addOrUpdateHandle(id, disable) {
- this.addOrUpdateVisible = true
- this.$nextTick(() => {
- this.$refs.addOrUpdate.init(id, disable)
- })
- },
- // 转换属性“审批状态”
- formatState(row) {
- if (!row.state) return ''
- const item1 = this.optionsState.find(
- (item) => item.code === row.state.toString()
- )
- return item1 ? item1.value : ''
- },
- // 转换属性“任务单状态”
- formatOrderState(row) {
- if (!row.orderState) return ''
- const item1 = this.optionsOrderState.find(
- (item) => item.code === row.orderState.toString()
- )
- return item1 ? item1.value : ''
- },
- // 详情
- detailHandle(id) {
- this.detailVisible = true
- this.$nextTick(() => {
- this.$refs.detail.init(id)
- })
- },
- // 发货
- deliverHandle(orderId) {
- if (!orderId) return
- this.$confirm(`确定发货?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- deliverOrder({ orderId: orderId }).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.getDataList()
- }
- })
- } else {
- this.$message.error(data.msg)
- }
- })
- })
- .catch(() => { })
- },
- // 送达
- arrivedHandle(row) {
- this.arrivedVisible = true
- this.$nextTick(() => {
- this.$refs.arrived.init(row.orderId, row.orderCode)
- })
- },
- // 技术确定
- techConfirm(row) {
- this.addOrUpdateVisible = true
- this.$nextTick(() => {
- this.$refs.addOrUpdate.init(row.orderId, false, 2)
- })
- },
- // 变更通知人设置
- setNoticeChangeHandel() {
- this.noticeChangeAttachVisible = true
- this.$nextTick(() => {
- this.$refs.noticeChangeSetting.init()
- })
- },
- // 撤回任务单
- cancelOrder(row) {
- this.$confirm(`确定撤回任务单${row.orderCode}?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- revokeOrder({ id: row.orderId }).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- message: '撤回成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.queryData()
- }
- })
- } else {
- this.$message.error(data.msg)
- }
- })
- })
- .catch(() => { })
- },
- // 删除任务单
- deleteOrder(row) {
- this.$confirm('是否确认要删除?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- deleteOrder([row.orderId]).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- type: 'success',
- message: '删除成功!',
- duration: 1500,
- onClose: () => {
- this.queryData()
- }
- })
- } else {
- this.$message({
- type: 'error',
- message: data.msg
- })
- }
- })
- })
- .catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- })
- })
- },
- // 采购金额屏蔽设置
- setAmountMaskHandel() {
- this.amountMaskSettingVisible = true
- this.$nextTick(() => {
- this.$refs.amountMaskSetting.init()
- })
- },
- // 附件
- attachDetails(row) {
- this.attachVisible = true
- this.$nextTick(() => {
- this.$refs.attachDetail.init(row.attachList)
- })
- },
- exportHandle(val) {
- location.href = this.$http.adornUrl(
- `/biz-service/order/exportExcel/${val}?_token=${Vue.cookie.get(
- 'token'
- )}`
- )
- }
- }
- }
- </script>
- <style scoped></style>
|