123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290 |
- <template>
- <div class="updateSteelDetails">
- <!-- 车牌号查询框 -->
- <div class="top">
- <el-input
- v-model="inputCapacity"
- placeholder="请输入车牌号"
- clearable
- ></el-input>
- <el-button type="primary" @click="onclick">查询</el-button>
- <el-button type="primary" @click="back" icon="el-icon-d-arrow-left"
- >返回</el-button
- >
- </div>
- <!-- //物资模态框多选 -->
- <div class="edrwer">
- <!-- 物资选择模态框 -->
- <el-drawer
- title="选择物资信息"
- :visible.sync="table1"
- direction="rtl"
- size="90%"
- :show-close="true"
- >
- <el-form :inline="true" style="margin-top: 0.5rem;">
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >物资名称/型号</label
- >
- </el-form-item>
- <el-form-item>
- <el-input
- placeholder="请输入物资名称或型号"
- v-model="materialNameText"
- clearable
- ></el-input>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">规格</label>
- </el-form-item>
- <el-form-item>
- <el-input
- placeholder="请输入内容"
- v-model="materialSpecificationText"
- clearable
- ><template slot="prepend">Φ</template></el-input
- >
- </el-form-item>
- <el-button
- type="primary"
- class="btn"
- @click="onclick"
- style="margin-left: 4px;"
- ><i class="el-icon-search"></i>查询</el-button
- >
- <el-button type="primary" @click="makeSureMaterial"
- ><i class="el-icon-check"></i>确定</el-button
- >
- </el-form>
- <div class="tablecls">
- <!-- 查询所有的物资 -->
- <dilTable
- v-bind.sync="option"
- @selection-change="selectionChange"
- @rowDbClick="rowDbClick"
- >
- </dilTable>
- </div>
- </el-drawer>
- </div>
- <!-- //物资模态框单选 -->
- <div class="edrwer">
- <!-- 物资选择模态框 -->
- <el-drawer
- title="选择物资信息"
- :visible.sync="currentTable"
- direction="rtl"
- size="90%"
- :show-close="true"
- >
- <el-form :inline="true" style="margin-top: 0.5rem;">
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >物资名称/型号</label
- >
- </el-form-item>
- <el-form-item>
- <el-input
- placeholder="请输入物资名称或型号"
- v-model="materialNameText"
- clearable
- ></el-input>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">规格</label>
- </el-form-item>
- <el-form-item>
- <el-input
- placeholder="请输入内容"
- v-model="materialSpecificationText"
- clearable
- ><template slot="prepend">Φ</template></el-input
- >
- </el-form-item>
- <el-button
- type="primary"
- class="btn"
- @click="onclick1"
- style="margin-left: 4px;"
- ><i class="el-icon-search"></i>查询</el-button
- >
- <el-button type="primary" @click="makeSureChange"
- ><i class="el-icon-check"></i>确定</el-button
- >
- </el-form>
- <div class="tablecls">
- <!-- 查询所有的物资 -->
- <dilTable
- v-bind.sync="option1"
- @radio-change="currentRadioChange"
- @rowDbClick="rowDbClick1"
- >
- </dilTable>
- </div>
- </el-drawer>
- </div>
- <div class="table">
- <el-table
- :data="tableData"
- style="width: 100%"
- :span-method="objectSpanMethod"
- border
- key="orderTable"
- >
- <el-table-column
- width="50"
- label="序号"
- align="center"
- fixed="left"
- :resizable="false"
- >
- <template slot-scope="scope">{{ scope.row.group + 1 }}</template>
- </el-table-column>
- <el-table-column property="capacityNumber" label="车牌号" width="120">
- </el-table-column>
- <el-table-column property="consigneeCompanyName" label="收货单位">
- </el-table-column>
- <el-table-column property="completeAddress" label="收货地址">
- </el-table-column>
- <el-table-column property="carrierName" label="承运商">
- </el-table-column>
- <el-table-column property="materialName" label="物资名称">
- </el-table-column>
- <el-table-column property="materialSpecification" label="规格">
- </el-table-column>
- <el-table-column property="orderPlanWeight" label="物资件数">
- </el-table-column>
- <el-table-column property="materialModel" label="型号">
- </el-table-column>
- <el-table-column fixed="right" label="操作" width="200">
- <template slot-scope="scope">
- <el-button
- type="text"
- size="mini"
- @click="updateMaterial(scope)"
- v-if="deleted == 1"
- >
- 物资变更
- </el-button>
- <el-button
- type="text"
- size="mini"
- @click="updateCapacity(scope)"
- v-if="deleted == 0"
- >
- 车辆变更
- </el-button>
- <el-button
- type="text"
- size="mini"
- @click="closeFlu(scope)"
- v-if="deleted == 0 && scope.row.materialStatus == null"
- >
- 关闭分录
- </el-button>
- <el-button
- type="text"
- size="mini"
- @click="updateAddress(scope)"
- v-if="deleted == 0"
- >
- 收货地址变更
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="dialog">
- <el-dialog
- :title="title"
- :visible.sync="dialogTableVisible"
- :center="true"
- width="1100px"
- >
- <div class="errorMaterial">
- <el-button @click="openDrawer" type="primary">新增拼数</el-button>
- </div>
- <div class="">
- <el-table
- :data="materialList"
- border
- :span-method="objectSpanMethod1"
- highlight-current-row
- key="materialTable"
- >
- <el-table-column
- v-for="(item, i) in materialTableTop"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- :width="item.width"
- align="center"
- show-overflow-tooltip
- >
- <!-- 插入输入框 -->
- <template slot-scope="scope">
- <template v-if="item.slot">
- <!-- 物资名称 -->
- <template v-if="item.prop == 'materialName'">
- <el-input
- style="width: 200px"
- v-model="scope.row.materialName"
- disabled
- >
- </el-input>
- <el-button
- type="primary"
- @click="changeMaterial(scope.$index)"
- v-if="scope.row.netWeight == null"
- >更改</el-button
- >
- </template>
- <!-- 物资件数 -->
- <template v-if="item.prop == 'orderPlanWeight'">
- <el-input
- class="textinput111"
- v-model.number="scope.row.orderPlanWeight"
- placeholder="(必填)"
- :disabled="scope.row.netWeight != null"
- ></el-input>
- </template>
- <!-- 米数 -->
- <template v-if="item.prop == 'meterNumber'">
- <el-input
- v-if="scope.row.haveMeter == 1"
- :disabled="
- scope.row.isDisable == 1 || scope.row.netWeight != null
- "
- class="textinput111"
- v-model.number="scope.row.meterNumber"
- placeholder="(必填)"
- ></el-input>
- </template>
- <!-- 是否磅重销售 -->
- <template v-if="item.prop == 'isPound'">
- <el-select
- v-model="scope.row.isPound"
- placeholder="请选择"
- style="width:65px"
- :disabled="scope.row.netWeight != null"
- >
- <el-option
- v-for="item in options2"
- :key="item.values2"
- :label="item.label2"
- :value="item.values2"
- >
- </el-option>
- </el-select>
- </template>
- </template>
- <template v-else>
- <span>{{ scope.row[item.prop] }}</span>
- </template>
- </template>
- </el-table-column>
- <!-- 操作列 -->
- <el-table-column fixed="right" label="操作" width="100">
- <template slot-scope="scope">
- <el-button
- @click.native.prevent="
- deleteMaterialRow(scope.$index, materialList)
- "
- type="text"
- icon="el-icon-close"
- size="big"
- v-if="scope.row.netWeight == null"
- ></el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="buttonx">
- <el-button type="primary" @click="makeSureUpdateMaterial"
- >确定</el-button
- >
- <el-button type="primary" @click="cancelUpdateMaterial"
- >取消</el-button
- >
- </div>
- </el-dialog>
- </div>
- <div class="addressDialog">
- <!-- 收货地址弹出框 -->
- <el-dialog title="收货地址" :visible.sync="addressDialog" width="90%">
- <div style="magin-bottom:20px,color: red;">
- 原收货地址:{{ oldAddress }}
- </div>
- <div class="addressItem">
- <el-form :inline="true">
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">省</label>
- <el-select
- v-model="province"
- filterable
- placeholder="请选择"
- @change="onchangeProvince"
- >
- <el-option
- v-for="item in provinceList"
- :key="item.id"
- :label="item.addressProvince"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;">市</label>
- <el-select
- v-model="city"
- filterable
- placeholder="请选择"
- @change="onchangeCity"
- >
- <el-option
- v-for="item in cityList"
- :key="item.id"
- :label="item.addressDistrict"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >县(区)</label
- >
- <el-select
- v-model="county"
- filterable
- placeholder="请选择"
- @change="onchangeCounty"
- >
- <el-option
- v-for="item in countyList"
- :key="item.id"
- :label="item.addressTown"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <label class="el-form-item__label" style="width: auto;"
- >具体收货地址</label
- >
- <el-autocomplete
- class="inline-input"
- v-model="place"
- :fetch-suggestions="querySearch1"
- placeholder="请输入具体收货地址"
- :trigger-on-focus="false"
- @select="handleSelect1"
- >
- </el-autocomplete>
- </el-form-item>
- </el-form>
- </div>
- <div slot="footer" class="button-box">
- <el-button @click="addressDialog = false">取 消</el-button>
- <el-button type="primary" @click="addAddressClick">确定</el-button>
- </div>
- </el-dialog>
- </div>
- <!-- 修改运力弹窗 -->
- <div class="updateCapcityDialog">
- <el-dialog title="修改车牌号" :visible.sync="capacityDialog" width="90%">
- <div style="magin-bottom:20px,color: red;">
- 原车牌号:{{ oldCapacityNum }}
- </div>
- <div class="inputItem">
- <el-input v-model="inputCapacity1" style="width:200px"></el-input>
- <el-button type="primary" @click="handleCapacity"
- ><i class="el-icon-search"></i
- ></el-button>
- </div>
- <div class="capacityItem">
- <dilTable
- v-bind.sync="capacityOptions"
- @radio-change="radioChangeCapcity"
- ></dilTable>
- </div>
- <div slot="footer" class="button-box">
- <el-button @click="capacityDialog = false">取 消</el-button>
- <el-button type="primary" @click="updateCapacitySure">确定</el-button>
- </div>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- inputCapacity1: null,
- newCapacityId: null,
- newCapacityNum: null,
- oldCapacityNum: null,
- capacityDialog: false,
- addressDialog: false,
- currentTable: false,
- title: "",
- capacityNumber: null,
- oldAddress: null,
- //是否磅重销售
- options2: [
- {
- values2: 0,
- label2: "是"
- },
- {
- values2: 1,
- label2: "否"
- }
- ],
- capacityOptions: {
- requestUrl: "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248",
- // 控制显示单选列
- selectionType: "radio"
- },
- table1: false,
- isDelete: false,
- dialogTableVisible: false,
- inputCapacity: null,
- tableData: [],
- tableData1: [],
- materialList1: [],
- materialList: [],
- //存放每一行记录的合并数
- spanArr: [],
- spanArr1: [],
- status: null,
- //物资表格多选
- option: {
- // 表格请求数据的地址
- requestUrl: "",
- // 控制显示多选列
- selectionType: "select"
- },
- //物资表格单选
- option1: {
- // 表格请求数据的地址
- requestUrl: "",
- // 控制显示单选列
- selectionType: "radio"
- },
- materialSpecificationText: null,
- materialNameText: null,
- spanArr: [],
- materialTableTop: [
- {
- prop: "capacityNumber",
- label: "车牌号",
- width: "100px"
- },
- {
- prop: "materialName",
- label: "物资名称",
- width: "400px",
- slot: true
- },
- {
- prop: "meterNumber",
- label: "米数",
- width: "100px",
- slot: true
- },
- {
- prop: "Specification",
- label: "规格型号",
- width: "140px"
- },
- {
- prop: "orderPlanWeight",
- label: "件数",
- width: "100px",
- slot: true
- },
- {
- prop: "isPound",
- label: "是否磅重销售",
- width: "100px",
- slot: true
- }
- ],
- orderId: null,
- selectedMaterialCode: null,
- selectedMaterialModel: null,
- selectedMaterialSpecification: null,
- selectedMaterialName: null,
- selectedMaterialId: null,
- //所有省
- provinceList: [],
- //选中的省
- province: "",
- //所有市
- cityList: [],
- //选中的市
- city: "",
- //所有的县(区)
- countyList: [],
- //选中的县
- county: "",
- //判断是内层还是外层点击的收货地址浏览
- inOrOut: 0,
- //地址输入框的值
- addresText: "",
- //已选中省市县
- address: null,
- //具体地址
- place: null,
- //暂存具体地址
- place1: null,
- //省市县Id
- addressId: null,
- orderSaleMap: {},
- isNewCar: null,
- deleted: 0,
- lineSequence: null
- };
- },
- watch: {
- dialogTableVisible() {
- this.getOrderList();
- },
- capacityDialog() {
- this.getOrderList();
- this.inputCapacity1 = null;
- this.capacityOptions.requestUrl =
- "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&i=" + new Date();
- }
- },
- created() {
- this.deleted = this.$route.params.deleted;
- },
- mounted() {
- console.log(this.$route);
- console.log(this.$route.params.deleted);
- this.getOrderList();
- this.getAllProvince();
- },
- methods: {
- closeFlu(scope) {
- this.capacityNumber = scope.row.capacityNumber;
- this.deleteEasEntryId(scope.row);
- console.log(scope.row);
- },
- //车辆变更
- updateCapacity(scope) {
- this.oldCapacityNum = scope.row.capacityNumber;
- this.saleOrderMaterialId = scope.row.saleOrderMaterialId;
- this.lineSequence = scope.row.lineSequence;
- this.orderId = scope.row.orderId;
- this.$confirm("确定变更车辆吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- center: true,
- type: "info"
- })
- .then(() => {
- this.capacityDialog = true;
- })
- .catch(() => {
- this.$message.info("取消变更");
- });
- },
- radioChangeCapcity(row) {
- this.newCapacityNum = row.capacityNumber;
- this.newCapacityId = row.capacityId;
- },
- updateCapacitySure() {
- let map = {
- orderId: this.orderId,
- saleOrderMaterialId: this.saleOrderMaterialId,
- lineSequence: this.lineSequence,
- capacityId: this.newCapacityId
- };
- let title = `确定将-${this.oldCapacityNum}-替换为-${this.newCapacityNum}?`;
- this.$confirm(title, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "info",
- center: true
- }).then(() => {
- this.axios
- .post("/api/v1/ams/updateCapacityNumberInFactory", map)
- .then(res => {
- if (res.data.code == 200) {
- this.$message.success("变更成功");
- this.getOrderList();
- this.capacityDialog = false;
- } else {
- this.$message.success("变更失败,请联系管理员");
- this.capacityDialog = false;
- }
- })
- .catch(() => {
- this.$message.success("变更失败,请联系管理员");
- this.capacityDialog = false;
- });
- });
- },
- handleCapacity() {
- this.capacityOptions.requestUrl =
- "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&index=" +
- this.inputCapacity1 +
- "&i=" +
- new Date();
- },
- updateAddress(scope) {
- this.capacityNumber = scope.row.capacityNumber;
- this.oldAddress = scope.row.completeAddress;
- this.orderSaleMap = scope.row;
- console.log(this.orderSaleMap);
- let title = `请选择对-${scope.row.capacityNumber}-进行的操作?`;
- let confirmText = `关闭-${scope.row.capacityNumber}-金蝶分录`;
- let cancelText = `不关闭-${scope.row.capacityNumber}-金蝶分录`;
- this.$confirm(title, "提示", {
- confirmButtonText: confirmText,
- cancelButtonText: cancelText,
- distinguishCancelAndClose: true,
- center: true,
- type: "info"
- })
- .then(() => {
- this.deleteEasEntryId(scope.row);
- })
- .catch(action => {
- console.log(action);
- if (action === "cancel") {
- this.noDeleteEasEntryId();
- }
- });
- },
- //删除金蝶分录
- deleteEasEntryId(row) {
- let title = `确定关闭-${this.capacityNumber}-金蝶分录?`;
- this.$confirm(title, {
- confirmButtonText: "是",
- cancelButtonText: "否",
- center: true,
- type: "warning"
- })
- .then(() => {
- let map = row;
- map.isCloseEas = Number(0);
- map.saleOrderId = this.$route.params.saleOrderId;
- this.axios
- .post("/api/v1/ams/updateCarAddress", map)
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("关闭成功");
- this.getOrderList();
- } else {
- this.$message.error("关闭失败");
- this.getOrderList();
- }
- })
- .catch(() => {
- this.$message.error("关闭失败");
- this.getOrderList();
- });
- })
- .catch(() => {
- this.$message.info("取消删除");
- });
- },
- //不删除金蝶分录,继续选择
- noDeleteEasEntryId() {
- let title = `请选择对-${this.capacityNumber}-进行的操作?`;
- let confirmText = `仅更换-${this.capacityNumber}-的收货地址`;
- this.$confirm(title, {
- confirmButtonText: confirmText,
- cancelButtonText: "更换地址且换车",
- center: true,
- distinguishCancelAndClose: true,
- type: "info"
- })
- .then(() => {
- this.onlyUpdateAddress();
- })
- .catch(action => {
- if (action === "cancel") {
- this.updateAddressAndCar();
- }
- });
- },
- onlyUpdateAddress() {
- let title = `仅更换-${this.capacityNumber}-的收货地址吗`;
- this.$confirm(title, {
- confirmButtonText: "是",
- cancelButtonText: "否",
- center: true,
- type: "warning"
- }).then(() => {
- this.addressDialog = true;
- this.isNewCar = 1;
- });
- },
- //收货地址弹出层
- handleSelect1(item) {
- console.log("获取所有下拉值!");
- },
- //以下是收货地址边输边查搜索
- querySearch1(queryString, cb) {
- this.axios
- .post(
- "/api/v1/ams/getRealAddressByLike?addressId=" +
- this.addressId +
- "&index=" +
- queryString
- )
- .then(res => {
- if (res.data.code == "200") {
- var restaurants = res.data.data;
- var results = queryString
- ? restaurants.filter(this.createFilter1(queryString))
- : restaurants;
- // 调用 callback 返回建议列表的数据
- cb(results);
- }
- });
- },
- createFilter1(queryString) {
- return restaurants => {
- return (
- restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
- -1
- );
- };
- },
- //以上是收货地址边输边查搜索
- //监听收货地址模态框点击事件
- currentRadioChange1(radioList) {
- this.addressId = radioList.addressId;
- this.address = radioList.address;
- },
- //确定收货地址事件
- addAddressClick() {
- let map = this.orderSaleMap;
- map.isCloseEas = Number(1);
- map.isNewCar = Number(this.isNewCar);
- map.saleOrderId = this.$route.params.saleOrderId;
- map.place = this.place;
- map.shipperAddressId = this.addressId;
- this.axios.post("/api/v1/ams/updateCarAddress", map).then(res => {
- console.log(res.data);
- if (res.data.code == "200") {
- this.$message.success("修改成功");
- this.getOrderList();
- } else {
- this.$message.error("修改失败");
- this.getOrderList();
- }
- });
- this.addressDialog = false;
- //初始化
- this.addressId = null;
- this.province = null;
- this.cityList = [];
- this.city = null;
- this.countyList = [];
- this.county = null;
- //暂存具体地址
- this.place1 = this.place;
- this.place = null;
- this.addresText = null;
- },
- updateAddressAndCar() {
- this.$confirm("确定修改收货地址且换车?将会解除授权!", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- center: true,
- type: "warning"
- })
- .then(() => {
- this.addressDialog = true;
- this.isNewCar = 0;
- })
- .catch(() => {
- this.$message.info("取消");
- });
- },
- //获取所有省数据
- getAllProvince() {
- this.axios.post("/api/v1/uc/getAllProvince").then(res => {
- this.provinceList = res.data.data;
- });
- },
- //省改变
- onchangeProvince() {
- this.axios
- .post(
- "/api/v1/uc/getDistrictByProvince?addressProvince=" + this.province
- )
- .then(res => {
- this.cityList = res.data.data;
- });
- },
- //市改变
- onchangeCity() {
- this.axios
- .post("/api/v1/uc/getTownByDistrict?addressDistrict=" + this.city)
- .then(res => {
- this.countyList = res.data.data;
- });
- },
- //县(区)改变
- onchangeCounty() {
- let mapValue = {
- addressProvince: this.province,
- addressDistrict: this.city,
- addressTown: this.county
- };
- this.axios.post("/api/v1/uc/getPlaceByAllAddress", mapValue).then(res => {
- this.addressId = res.data.data[0].addressId;
- });
- },
- rowDbClick1(row) {
- this.selectedMaterialId = row.materialId;
- this.selectedMaterialName = row.materialName;
- this.selectedMaterialSpecification = row.materialSpecification;
- this.selectedMaterialModel = row.materialModel;
- this.selectedMaterialCode = row.materialCode;
- this.makeSureChange();
- },
- //更改行物资
- changeMaterial(index) {
- this.option1.requestUrl =
- "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
- this.currentTable = true;
- this.materialNameText = null;
- this.materialSpecificationText = null;
- this.isOpenDrawer = 1;
- this.indexChangeMaterial = index;
- },
- //单选一行物资
- currentRadioChange(row) {
- this.selectedMaterialId = row.materialId;
- this.selectedMaterialName = row.materialName;
- this.selectedMaterialSpecification = row.materialSpecification;
- this.selectedMaterialModel = row.materialModel;
- this.selectedMaterialCode = row.materialCode;
- },
- //确认物资修改
- makeSureChange() {
- if (!this.selectedMaterialId) {
- this.$message.warning("请先选择一个物资!");
- } else {
- if (!this.selectedMaterialSpecification) {
- this.selectedMaterialSpecification = "";
- }
- if (!this.selectedMaterialModel) {
- this.selectedMaterialModel = "";
- }
- //记录是理重还是磅重
- var getisPound = 1;
- //判断物资是否为盘螺或非定尺
- if (
- this.selectedMaterialName.includes("盘螺") ||
- this.selectedMaterialName.includes("乱尺") ||
- this.selectedMaterialName.includes("盘元") ||
- this.selectedMaterialName.includes("盘圆")
- ) {
- getisPound = 0;
- } else {
- getisPound = 1;
- }
- this.materialList[
- this.indexChangeMaterial
- ].materialId = this.selectedMaterialId;
- this.materialList[
- this.indexChangeMaterial
- ].materialName = this.selectedMaterialName;
- this.materialList[this.indexChangeMaterial].Specification =
- this.selectedMaterialSpecification + this.selectedMaterialModel;
- this.materialList[
- this.indexChangeMaterial
- ].materialCode = this.selectedMaterialModel;
- this.materialList[this.indexChangeMaterial].isPound = getisPound;
- //确定更改的物资有无米数
- if (
- this.selectedMaterialName.includes("盘螺") ||
- this.selectedMaterialName.includes("盘圆") ||
- this.selectedMaterialName.includes("盘元")
- ) {
- this.materialList[this.indexChangeMaterial].haveMeter = 0;
- this.materialList[this.indexChangeMaterial].meterNumber = null;
- } else {
- if (this.selectedMaterialName.includes("米")) {
- this.materialList[this.indexChangeMaterial].haveMeter = 1;
- this.materialList[this.indexChangeMaterial].isDisable = 1;
- this.materialList[this.indexChangeMaterial].meterNumber = Number(
- this.selectedMaterialName.replace(/[^0-9]/gi, "")
- );
- } else {
- this.materialList[this.indexChangeMaterial].haveMeter = 1;
- this.materialList[this.indexChangeMaterial].isDisable = 0;
- this.materialList[this.indexChangeMaterial].meterNumber = null;
- }
- }
- //重新初始化
- this.indexChangeMaterial = null;
- this.selectedMaterialId = null;
- this.selectedMaterialName = null;
- this.selectedMaterialSpecification = null;
- this.selectedMaterialModel = null;
- this.selectedMaterialCode = null;
- //关闭弹出框
- this.currentTable = false;
- this.isOpenDrawer = 0;
- //初始化查询数据
- this.materialNameText = null;
- this.materialSpecificationText = null;
- }
- },
- cancelUpdateMaterial() {
- this.getOrderList();
- this.dialogTableVisible = false;
- },
- makeSureUpdateMaterial() {
- let i = 0;
- if (this.materialList.length == 0) {
- this.$message.error("物资信息不能为空");
- return;
- }
- this.materialList.forEach(e => {
- if (!/(^[1-9]\d*$)/.test(e.meterNumber) && e.meterNumber != null) {
- e.meterNumber = null;
- i++;
- }
- });
- if (i != 0) {
- i = 0;
- this.$message.error("米数请输入正整数");
- return;
- }
- this.materialList.forEach(e => {
- if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
- e.orderPlanWeight = null;
- i++;
- }
- });
- if (i != 0) {
- this.$message.error("件数必填且请输入正整数");
- return;
- }
- this.materialList.forEach(e => {
- if (e.materialName.includes("定尺")) {
- if (!e.meterNumber) {
- i++;
- }
- }
- });
- if (i != 0) {
- this.$message.error("定尺必须填写米数");
- return;
- }
- this.dialogTableVisible = false;
- this.saleOrderId = this.$route.params.saleOrderId;
- let mapVal = {
- orderId: this.orderId,
- saleOrderMaterialId: this.saleOrderMaterialId,
- saleOrderId: this.saleOrderId,
- mapList: this.materialList
- };
- console.log(mapVal);
- this.axios
- .post("/api/v1/ams/updateAllMaterialInSale", mapVal)
- .then(res => {
- console.log(res.data);
- if (res.data.code == "200") {
- this.$message.success("修改成功!");
- this.getOrderList();
- } else {
- this.$message.warning("修改失败");
- this.getOrderList();
- }
- });
- },
- makeSureMaterial() {
- //记录是理重还是磅重
- var getisPound = 1;
- this.materialList1.forEach(e => {
- if (!e.materialSpecification) {
- e.materialSpecification = "";
- }
- if (!e.materialModel) {
- e.materialModel = "";
- }
- //判断物资是否为盘螺或非定尺
- if (
- e.materialName.includes("盘螺") ||
- e.materialName.includes("乱尺") ||
- e.materialName.includes("盘元") ||
- e.materialName.includes("盘圆")
- ) {
- getisPound = 0;
- } else {
- getisPound = 1;
- }
- //若物资为带有盘螺、盘圆、盘元,默认无米数
- if (
- e.materialName.includes("盘螺") ||
- e.materialName.includes("盘圆") ||
- e.materialName.includes("盘元")
- ) {
- var addmap = {
- orderId: this.orderId,
- capacityNumber: this.capacityNumber,
- materialName: e.materialName,
- Specification: e.materialSpecification + e.materialModel,
- materialCode: e.materialCode,
- orderPlanWeight: null,
- meterNumber: null,
- isPound: getisPound,
- //物资Id
- materialId: e.materialId,
- haveMeter: 0
- };
- } else {
- if (e.materialName.includes("米")) {
- var addmap = {
- capacityNumber: this.capacityNumber,
- orderId: this.orderId,
- materialName: e.materialName,
- Specification: e.materialSpecification + e.materialModel,
- materialCode: e.materialCode,
- orderPlanWeight: null,
- haveMeter: 1,
- meterNumber: e.materialName.replace(/[^0-9]/gi, ""),
- isPound: getisPound,
- //物资Id
- materialId: e.materialId,
- isDisable: 1
- //有米数
- };
- console.log(addmap);
- } else {
- var addmap = {
- capacityNumber: this.capacityNumber,
- orderId: this.orderId,
- materialName: e.materialName,
- Specification: e.materialSpecification + e.materialModel,
- materialCode: e.materialCode,
- orderPlanWeight: null,
- meterNumber: null,
- isPound: getisPound,
- haveMeter: 1,
- //物资Id
- materialId: e.materialId
- };
- }
- }
- this.materialList.push(addmap);
- this.materialList.forEach(e => {
- this.$set(e, "capacityNumber", this.capacityNumber);
- });
- this.getSpanArr1(this.materialList);
- console.log(this.materialList);
- });
- this.materialList1 = [];
- this.table1 = false;
- },
- rowDbClick(row) {
- this.materialList1 = [];
- this.materialList1.push(row);
- this.makeSureMaterial();
- },
- openDrawer() {
- this.option.requestUrl =
- "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
- this.materialModelText = null;
- this.materialSpecificationText = null;
- this.materialNameText = null;
- this.table1 = true;
- },
- //返回选中的物资信息
- selectionChange(selection) {
- this.materialList1 = [];
- this.materialList1 = selection;
- },
- //物资模态框查询
- onclick() {
- this.option.requestUrl =
- "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
- this.materialNameText +
- "&materialSpecificationText=" +
- this.materialSpecificationText +
- "&i=" +
- new Date();
- },
- onclick1() {
- this.option1.requestUrl =
- "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
- this.materialNameText +
- "&materialSpecificationText=" +
- this.materialSpecificationText +
- "&i=" +
- new Date();
- },
- //开关是否删除
- showDelete() {
- this.isDelete = true;
- },
- deleteMaterialRow(index, rows) {
- rows.splice(index, 1);
- this.status = 1;
- },
- updateMaterial(scope) {
- this.materialList = [];
- this.materialList = this.tableData.filter((item, index) => {
- return item.orderId == scope.row.orderId;
- });
- this.materialList.forEach(e => {
- this.capacityNumber = e.capacityNumber;
- this.orderId = e.orderId;
- if (
- e.materialName.includes("盘螺") ||
- e.materialName.includes("盘圆") ||
- e.materialName.includes("盘元")
- ) {
- e.haveMeter = 0;
- } else {
- e.haveMeter = 1;
- if (e.materialName.includes("米")) {
- e.isDisable = 1;
- }
- }
- });
- this.getSpanArr1(this.materialList);
- this.title = "处理" + "-" + this.capacityNumber + "-" + "异常物资信息";
- this.dialogTableVisible = true;
- },
- getOrderList() {
- this.axios
- .post(
- "/api/v1/oms/getDriverInfoForSale1?saleOrderId=" +
- this.$route.params.saleOrderId +
- "&i=" +
- new Date()
- )
- .then(res => {
- console.log(res.data.data);
- this.tableData = [];
- this.tableData = res.data.data;
- // this.orderId = this.tableData[0].orderId;
- // this.lineSequence = this.tableData[0].lineSequence;
- // this.saleOrderMaterialId = this.tableData[0].saleOrderMaterialId;
- this.getSpanArr(this.tableData);
- });
- },
- back() {
- this.$router.push("/saleOrderSteel");
- },
- //合并方法
- getSpanArr1(data) {
- //每次调用方法初始化
- this.spanArr1 = [];
- for (var i = 0; i < data.length; i++) {
- if (i === 0) {
- this.spanArr1.push(1);
- this.pos1 = 0;
- } else {
- // 判断当前元素与上一个元素是否相同
- if (data[i].saleOrderMaterialId === data[i - 1].saleOrderMaterialId) {
- this.spanArr1[this.pos1] += 1;
- this.spanArr1.push(0);
- } else {
- this.spanArr1.push(1);
- this.pos1 = i;
- }
- }
- }
- },
- objectSpanMethod1({ row, column, rowIndex, columnIndex }) {
- if (columnIndex === 0) {
- const _row = this.spanArr1[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- };
- }
- },
- //记录每一行的合并数
- getSpanArr(data) {
- //每次调用方法初始化
- this.spanArr = [];
- for (var i = 0; i < data.length; i++) {
- if (i === 0) {
- this.spanArr.push(1);
- this.pos = 0;
- data[i].group = i;
- } else {
- // 判断当前元素与上一个元素是否相同
- if (data[i].orderId === data[i - 1].orderId) {
- this.spanArr[this.pos] += 1;
- this.spanArr.push(0);
- data[i].group = data[i - 1].group;
- } else {
- this.spanArr.push(1);
- this.pos = i;
- data[i].group = data[i - 1].group + 1;
- }
- }
- }
- },
- objectSpanMethod({ row, column, rowIndex, columnIndex }) {
- if (
- columnIndex === 0 ||
- columnIndex === 1 ||
- columnIndex === 2 ||
- columnIndex === 3 ||
- columnIndex === 4
- ) {
- const _row = this.spanArr[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- };
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .updateSteelDetails {
- .top {
- margin-top: 20px;
- margin-left: 20px;
- .el-input {
- width: 250px;
- }
- }
- .table {
- margin-top: 20px;
- margin-left: 20px;
- }
- .dialog {
- .buttonx {
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- .addressDialog {
- .addressDialog {
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .button-box {
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- }
- </style>
|