123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757 |
- <template>
- <div class="app-container">
- <el-form
- :model="queryParams"
- class="queryForm"
- ref="queryForm"
- size="small"
- :inline="true"
- v-show="showSearch"
- >
- <el-row>
- <el-col :span="24">
- <el-form-item label="单据编号" prop="orderNumber">
- <el-input
- v-model="queryParams.orderNumber"
- placeholder="请输入单据编号"
- clearable
- @keyup.enter.native="handleQuery"
- disabled
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item label="资产编号" prop="assetNumber">
- <template>
- <el-select
- v-model="queryParams.assetNumber"
- filterable
- placeholder="请输入资产编号"
- >
- <el-option
- v-for="item in informationList"
- :key="item.number"
- :label="item.name"
- :value="item.number"
- >
- <span style="float: left">{{ item.name }}</span>
- <span style="float: right; color: #8492a6; font-size: 13px">{{ item.number }}</span>
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 2"
- label="【调拨】旧管理人"
- prop="allocationOldResponsiblePerson"
- >
- <el-input
- v-model="queryParams.allocationOldResponsiblePerson"
- placeholder="请输入【调拨】旧管理人"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 2"
- label="【调拨】旧功能位置"
- prop="allocationOldLocationNumber"
- >
- <!-- <el-input
- v-model="queryParams.allocationOldLocationNumber"
- placeholder="请输入【调拨】旧功能位置编号"
- clearable
- @keyup.enter.native="handleQuery"
- /> -->
- <treeselect v-model="queryParams.allocationOldLocationNumber" :options="locationList" :normalizer="tenantIdnormalizer" placeholder="【调拨】旧功能位置" />
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 2"
- label="【调拨】新管理人"
- prop="allocationNewResponsiblePerson"
- >
- <el-input
- v-model="queryParams.allocationNewResponsiblePerson"
- placeholder="请输入【调拨】新管理人"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 2"
- label="【调拨】新功能位置"
- prop="allocationNewLocationNumber"
- >
- <!-- <el-select
- v-model="queryParams.allocationNewLocationNumber"
- placeholder="请选择【调拨】新功能位置"
- >
- <el-option
- v-for="item in locationList"
- :key="item.number"
- :label="item.name"
- :value="item.number"
- ></el-option>
- </el-select> -->
- <treeselect v-model="queryParams.allocationNewLocationNumber" :options="locationList" :normalizer="tenantIdnormalizer" placeholder="【调拨】新功能位置" />
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 3"
- label="【借出】预计归还时间"
- prop="lendReturnDate"
- >
- <el-date-picker
- clearable
- v-model="queryParams.lendReturnDate"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="请选择【借出】预计归还时间"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 3"
- label="【借出】实际归还时间"
- prop="lendActualReturnDate"
- >
- <el-date-picker
- clearable
- v-model="queryParams.lendActualReturnDate"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="请选择【借出】实际归还时间"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 3"
- label="【借出】归还经手人"
- prop="lendBySponsor"
- >
- <el-input
- v-model="queryParams.lendBySponsor"
- placeholder="请输入【借出】归还经手人"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- icon="el-icon-search"
- size="mini"
- @click="handleQuery"
- >搜索</el-button
- >
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
- >重置</el-button
- >
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col
- :span="1.5"
- v-if="orderInfo.id === null || orderInfo.recordStatus < 1"
- >
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['order:detail:add']"
- >新增</el-button
- >
- </el-col>
- <el-col
- :span="1.5"
- v-if="orderInfo.id === null || orderInfo.recordStatus < 1"
- >
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- :disabled="single"
- @click="handleUpdate"
- v-hasPermi="['order:detail:edit']"
- >修改</el-button
- >
- </el-col>
- <el-col
- :span="1.5"
- v-if="orderInfo.id === null || orderInfo.recordStatus < 1"
- >
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- size="mini"
- :disabled="multiple"
- @click="handleDelete"
- v-hasPermi="['order:detail:remove']"
- >删除</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- @click="handleExport"
- v-hasPermi="['order:detail:export']"
- >导出</el-button
- >
- </el-col>
- <right-toolbar
- :showSearch.sync="showSearch"
- @queryTable="getList"
- ></right-toolbar>
- </el-row>
- <el-table
- v-loading="loading"
- :data="detailList"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="编号" align="center" prop="id" />
- <!-- <el-table-column label="单据编号" align="center" prop="orderNumber" /> -->
- <el-table-column label="资产编号" align="center" prop="assetNumber" >
- <template slot-scope="scope">
- <span>{{ scope.row.assetNumber != null ? getAssetName(scope.row.assetNumber) : ""}}</span>
- </template>
- </el-table-column>
- <el-table-column
- v-if="orderInfo.orderType === 2"
- label="【调拨】旧管理人"
- align="center"
- prop="allocationOldResponsiblePerson"
- />
- <el-table-column
- v-if="orderInfo.orderType === 2"
- label="【调拨】旧功能位置编号"
- align="center"
- prop="allocationOldLocationNumber"
- />
- <el-table-column
- v-if="orderInfo.orderType === 2"
- label="【调拨】新管理人"
- align="center"
- prop="allocationNewResponsiblePerson"
- />
- <el-table-column
- v-if="orderInfo.orderType === 2"
- label="【调拨】新功能位置编号"
- align="center"
- prop="allocationNewLocationNumber"
- />
- <el-table-column
- v-if="orderInfo.orderType === 3"
- label="【借出】预计归还时间"
- align="center"
- prop="lendReturnDate"
- width="180"
- >
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.lendReturnDate, "{y}-{m}-{d}") }}</span>
- </template>
- </el-table-column>
- <el-table-column
- v-if="orderInfo.orderType === 3"
- label="【借出】实际归还时间"
- align="center"
- prop="lendActualReturnDate"
- width="180"
- >
- <template slot-scope="scope">
- <span>{{
- parseTime(scope.row.lendActualReturnDate, "{y}-{m}-{d}")
- }}</span>
- </template>
- </el-table-column>
- <el-table-column
- v-if="orderInfo.orderType === 3"
- label="【借出】归还经手人"
- align="center"
- prop="lendBySponsor"
- />
- <el-table-column label="备注" align="center" prop="remark" />
- <el-table-column
- label="操作"
- align="center"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope">
- <el-button
- v-if="orderInfo.orderType === 3 && orderInfo.recordStatus > 1"
- size="mini"
- type="text"
- icon="el-icon-position"
- @click="onReturn(scope.row)"
- v-hasPermi="['order:order:edit']"
- >归还</el-button
- >
- <el-button
- :disabled="orderInfo.recordStatus > 0"
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['order:detail:edit']"
- >修改</el-button
- >
- <el-button
- :disabled="orderInfo.recordStatus > 0"
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['order:detail:remove']"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <div class="btns">
- <el-button v-if="(orderInfo.orderType === 1 || orderInfo.existDetail || detailList.length > 0) && orderInfo.recordStatus === 0" type="warning" @click="submitFormByOrder(1)">提 交</el-button>
- <el-button v-if="orderInfo.recordStatus === 0" type="primary" @click="submitFormByOrder(0)">保 存</el-button>
- <el-button v-if="orderInfo.recordStatus === 0" @click="cancelByOrder">取 消</el-button>
- </div>
- <!-- 添加或修改单据明细对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="170px">
- <el-form-item label="单据编号" prop="orderNumber">
- <el-input
- v-model="form.orderNumber"
- placeholder="请输入单据编号"
- disabled
- />
- </el-form-item>
- <el-form-item label="资产编号" prop="assetNumber">
- <template>
- <el-select
- v-model="form.assetNumber"
- filterable
- placeholder="请输入资产编号"
- :disabled="orderInfo.recordStatus > 0"
- >
- <el-option
- v-for="item in informationList"
- :key="item.number"
- :label="item.name"
- :value="item.number"
- >
- <span style="float: left">{{ item.name }}</span>
- <span style="float: right; color: #8492a6; font-size: 13px">{{ item.number }}</span>
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 2"
- label="【调拨】旧管理人"
- prop="allocationOldResponsiblePerson"
- >
- <el-input
- v-model="form.allocationOldResponsiblePerson"
- placeholder="系统自动补充"
- disabled
- />
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 2"
- label="【调拨】旧功能位置"
- prop="allocationOldLocationNumber"
- >
- <el-select
- v-model="form.allocationOldLocationNumber"
- placeholder="系统自动补充"
- disabled
- >
- <el-option
- v-for="item in locationList"
- :key="item.number"
- :label="item.name"
- :value="item.number"
- ></el-option>
- </el-select>
- <!-- <treeselect v-model="form.allocationNewLocationNumber" :options="locationList" :normalizer="tenantIdnormalizer" placeholder="请选择【调拨】新功能位置" /> -->
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 2"
- label="【调拨】新管理人"
- prop="allocationNewResponsiblePerson"
- >
- <el-input
- v-model="form.allocationNewResponsiblePerson"
- placeholder="请输入【调拨】新管理人"
- />
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 2"
- label="【调拨】新功能位置"
- prop="allocationNewLocationNumber"
- >
- <!-- <el-select
- v-model="form.allocationNewLocationNumber"
- placeholder="请选择【调拨】新功能位置"
- >
- <el-option
- v-for="item in locationList"
- :key="item.number"
- :label="item.name"
- :value="item.number"
- ></el-option>
- </el-select> -->
- <treeselect v-model="form.allocationNewLocationNumber" :options="locationList" :normalizer="tenantIdnormalizer" placeholder="请选择【调拨】新功能位置" />
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 3"
- label="【借出】预计归还时间"
- prop="lendReturnDate"
- >
- <el-date-picker
- clearable
- :disabled="orderInfo.recordStatus > 0"
- v-model="form.lendReturnDate"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="请选择【借出】预计归还时间"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 3"
- label="【借出】实际归还时间"
- prop="lendActualReturnDate"
- >
- <el-date-picker
- clearable
- :disabled="orderInfo.recordStatus < 2"
- v-model="form.lendActualReturnDate"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="请选择【借出】实际归还时间"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item
- v-if="orderInfo.orderType === 3"
- label="【借出】归还经手人"
- prop="lendBySponsor"
- >
- <el-input
- v-model="form.lendBySponsor"
- placeholder="请输入【借出】归还经手人"
- :disabled="orderInfo.recordStatus < 2"
- />
- </el-form-item>
- <el-form-item label="备注" prop="remark">
- <el-input
- v-model="form.remark"
- placeholder="请输入备注"
- :disabled="orderInfo.recordStatus > 0"
- />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- listDetail,
- getDetail,
- delDetail,
- addDetail,
- updateDetail,
- } from "@/api/order/detail";
- import { updateOrder } from '@/api/order/order'
- import { treeSelect } from "@/api/asset/location";
- import { listInformation2 } from "@/api/asset/information";
- import Treeselect from "@riophae/vue-treeselect";
- import "@riophae/vue-treeselect/dist/vue-treeselect.css";
- export default {
- name: "Detail",
- props: {
- orderInfo: {
- type: Object,
- default: () => {
- return {
- id: null,
- orderNumber: null,
- orderType: null,
- applicationDate: null,
- applicationDepartment: null,
- adjustmentAssetNumber: null,
- allocationCallOutDepartment: null,
- allocationCallOutBy: null,
- allocationCallOutDate: null,
- allocationCallInDepartment: null,
- allocationCallInBy: null,
- allocationCallInDate: null,
- lendDepartment: null,
- lendBySponsor: null,
- lendPassingUnit: null,
- reason: null,
- preparedBy: null,
- preparedDepartment: null,
- corporation: null,
- recordStatus: null,
- };
- },
- },
- },
- components: {
- Treeselect
- },
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 单据明细表格数据
- detailList: [],
- // 所属位置表格数据
- locationList: [],
- // 资产信息表格数据
- informationList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- orderNumber: this.orderInfo.orderNumber,
- assetNumber: null,
- allocationOldResponsiblePerson: null,
- allocationOldLocationNumber: null,
- allocationNewResponsiblePerson: null,
- allocationNewLocationNumber: null,
- lendReturnDate: null,
- lendActualReturnDate: null,
- lendBySponsor: null,
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- // orderNumber: [
- // { required: true, message: "单据编号不能为空", trigger: "blur" }
- // ],
- assetNumber: [
- { required: true, message: "资产编号不能为空", trigger: "blur" },
- ],
- },
- };
- },
- created() {
- this.getLocation();
- this.getList();
- },
- methods: {
- /** 查询单据明细列表 */
- getList() {
- this.loading = true;
- listInformation2().then((response) => {
- this.informationList = response.data;
- });
- listDetail(this.queryParams).then((response) => {
- this.detailList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- tenantIdnormalizer(node) {
- return {
- id: node.number,
- label: node.label,
- children: node.children
- }
- },
- /** 获取所属位置 */
- getLocation() {
- treeSelect().then((response) => {
- this.locationList = response.data;
- });
- },
- getAssetName(val){
- let arr = this.informationList.filter(item => item.number===val);
- if (arr.length === 0) {
- return ''
- }
- return arr[0].name
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- cancelByOrder() {
- this.$emit('cancelByOrder', 1)
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- orderNumber: this.orderInfo.orderNumber,
- assetNumber: null,
- allocationOldResponsiblePerson: null,
- allocationOldLocationNumber: null,
- allocationNewResponsiblePerson: null,
- allocationNewLocationNumber: null,
- lendReturnDate: null,
- lendActualReturnDate: null,
- lendBySponsor: null,
- remark: null,
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map((item) => item.id);
- this.single = selection.length !== 1;
- this.multiple = !selection.length;
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.form.orderNumber = this.orderInfo.orderNumber;
- this.open = true;
- this.title = "添加单据明细";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids;
- getDetail(id).then((response) => {
- this.form = response.data;
- this.open = true;
- this.title = "修改单据明细";
- });
- },
- onReturn(row) {
- this.reset();
- const id = row.id || this.ids;
- getDetail(id).then((response) => {
- this.form = response.data;
- this.open = true;
- this.title = "归还单据信息";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- if (this.form.id != null) {
- updateDetail(this.form).then((response) => {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addDetail(this.form).then((response) => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 提交按钮 */
- submitFormByOrder(recordStatus) {
- let form = this.orderInfo
- form.recordStatus = recordStatus
- updateOrder(form).then((response) => {
- if (recordStatus === 0) {
- this.$modal.msgSuccess('保存成功')
- } else {
- this.$modal.msgSuccess('提交成功')
- }
- this.cancelByOrder()
- })
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$modal
- .confirm('是否确认删除单据明细编号为"' + ids + '"的数据项?')
- .then(function () {
- return delDetail(ids);
- })
- .then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- })
- .catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download(
- "order/detail/export",
- {
- ...this.queryParams,
- },
- `detail_${new Date().getTime()}.xlsx`
- );
- },
- },
- };
- </script>
- <style lang="less" scoped>
- /deep/ .vue-treeselect {
- display: inline-block;
- }
- .btns{
- margin-top: 50px;
- text-align: center;
- }
- .queryForm {
- /deep/ .vue-treeselect {
- width: 205px;
- height: 32px;
- }
- }
- </style>
|